@schema-forms-data/react 4.0.3 → 4.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +28 -28
- package/dist/index.js +6196 -6245
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const N=require("react"),o=require("react/jsx-runtime"),$e=require("react-hook-form"),_=require("lucide-react"),yi=require("react-dom"),Yt=require("@dnd-kit/sortable"),oa=require("@dnd-kit/utilities"),Zt=require("@dnd-kit/core");function wi(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const g=wi(N),Pt=wi(_),co=wi(yi);var T=(e=>(e.TEXTO="texto",e.TEXTAREA="textarea",e.NUMBER="number",e.EMAIL="email",e.PASSWORD="password",e.TELEFONE="telefone",e.CPF="cpf",e.CEP="cep",e.DATE="date",e.DATETIME="datetime",e.TIME="time",e.DATE_RANGE="date_range",e.SELECT="select",e.AUTOCOMPLETE="autocomplete",e.RADIO="radio",e.CHECKBOX="checkbox",e.CHECKBOX_GROUP="checkbox_group",e.SWITCH="switch",e.SLIDER="slider",e.RATING="rating",e.COLOR="color",e.FILE="file",e.HIDDEN="hidden",e.FIELD_ARRAY="field_array",e.PARTICIPATION_TYPE="participation_type",e.PAYMENT_METHOD="payment_method",e.TERMS="terms",e.SUB_FORM="sub_form",e))(T||{}),ji=(e=>(e.RASCUNHO="rascunho",e.ATIVO="ativo",e.INATIVO="inativo",e))(ji||{}),au=(e=>(e.CPF="cpf",e.TELEFONE="telefone",e.CEP="cep",e.CUSTOM="custom",e))(au||{});const Vx={texto:"Texto",textarea:"Área de texto",number:"Número",email:"E-mail",password:"Senha",telefone:"Telefone",cpf:"CPF",cep:"CEP",date:"Data",datetime:"Data e hora",time:"Horário",date_range:"Período (data inicial/final)",select:"Seleção",autocomplete:"Autocomplete",radio:"Radio",checkbox:"Checkbox",checkbox_group:"Grupo de checkboxes",switch:"Switch (toggle)",slider:"Slider",rating:"Avaliação (estrelas)",color:"Cor",file:"Arquivo",hidden:"Oculto",field_array:"Lista de itens",participation_type:"Tipo de participação",payment_method:"Forma de pagamento",terms:"Termos e condições",sub_form:"Sub-formulário"},Bx={texto:"Type",textarea:"AlignLeft",number:"Hash",email:"Mail",password:"Lock",telefone:"Phone",cpf:"CreditCard",cep:"MapPin",date:"Calendar",datetime:"Clock",time:"Timer",date_range:"CalendarRange",select:"ChevronDown",autocomplete:"Search",radio:"CircleDot",checkbox:"CheckSquare",checkbox_group:"ListChecks",switch:"ToggleLeft",slider:"SlidersHorizontal",rating:"Star",color:"Palette",file:"Upload",hidden:"EyeOff",field_array:"List",participation_type:"CalendarDays",payment_method:"Wallet",terms:"ScrollText",sub_form:"LayoutList"},ou=()=>{if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID();if(typeof crypto<"u"&&typeof crypto.getRandomValues=="function"){const e=new Uint8Array(16);crypto.getRandomValues(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128;const t=Array.from(e).map(r=>r.toString(16).padStart(2,"0")).join("");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}return console.warn("[schema-forms-data] generateId: crypto API indisponível neste ambiente. Usando Math.random() como fallback — NÃO USE em contextos de segurança."),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})},St=ou,jt={primary:"#3b82f6",primaryHover:"#2563eb",accent:"#8b5cf6",background:"hsl(var(--background))",surface:"hsl(var(--card))",text:"hsl(var(--foreground))",textMuted:"hsl(var(--muted-foreground))",border:"hsl(var(--border))",error:"hsl(var(--destructive))"},Ux={primary:"#f97316",primaryHover:"#ea580c",accent:"#ef4444",background:"#09090b",surface:"rgba(24,24,27,0.9)",text:"#ffffff",textMuted:"#a1a1aa",border:"rgba(249,115,22,0.2)",error:"#f87171"},Hx={...jt,primary:"#18181b",primaryHover:"#27272a",accent:"#71717a",border:"#e4e4e7"},Wx={...jt,primary:"#1e3a5f",primaryHover:"#162d4a",accent:"#c9a84c"},qx={...jt,primary:"#ec4899",primaryHover:"#db2777",accent:"#8b5cf6",background:"#0f0f1a",text:"#ffffff",textMuted:"#a78bfa"},Gx={...jt,primary:"#059669",primaryHover:"#047857",accent:"#6ee7b7"},Xx={...jt,primary:"#0ea5e9",primaryHover:"#0284c7",accent:"#38bdf8"},Zx={...jt,primary:"#6366f1",primaryHover:"#4f46e5",accent:"#818cf8"},Kx={...jt,primary:"#d97706",primaryHover:"#b45309",accent:"#fbbf24"},Yx={...jt,primary:"#10b981",primaryHover:"#059669",accent:"#34d399"},Jx={...jt,primary:"#b45309",primaryHover:"#92400e",accent:"#f59e0b",background:"#0c0c0c",text:"#fafafa",textMuted:"#d4af37"},Qx={...jt,primary:"#dc2626",primaryHover:"#b91c1c",accent:"#f97316"},eg={...jt,primary:"#7c3aed",primaryHover:"#6d28d9",accent:"#a78bfa"},tg={primary:"#374151",primaryHover:"#1f2937",accent:"#6b7280",background:"#ffffff",surface:"#f9fafb",text:"#111827",textMuted:"#6b7280",border:"#e5e7eb",error:"#ef4444"},rg={primary:"#16a34a",primaryHover:"#15803d",accent:"#4ade80",background:"#fefce8",surface:"#ffffff",text:"#1c1917",textMuted:"#78716c",border:"#d6d3d1",error:"#dc2626"},ng={primary:"#d4af37",primaryHover:"#b8962e",accent:"#f0d060",background:"#0a0a0f",surface:"rgba(20,20,30,0.95)",text:"#f8f8f0",textMuted:"#9990aa",border:"rgba(212,175,55,0.25)",error:"#f87171"},Kr={moderno:{id:"moderno",displayName:"Moderno",colors:{...jt},layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"normal",roundness:"rounded-xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-muted/30"},minimalista:{id:"minimalista",displayName:"Minimalista",colors:Hx,layout:{stepNavigation:"wizard",containerStyle:"flat",spacing:"relaxed",roundness:"rounded-lg",showProgressBar:!1,showStepIndicators:!1},wrapperClass:"bg-background"},card:{id:"card",displayName:"Card",colors:{...jt},layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"normal",roundness:"rounded-2xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-muted/40"},banner:{id:"banner",displayName:"Banner",colors:{...jt},layout:{stepNavigation:"tabs",containerStyle:"bordered",spacing:"normal",roundness:"rounded-xl",showProgressBar:!1,showStepIndicators:!0},wrapperClass:"bg-background"},acampamento:{id:"acampamento",displayName:"Acampamento",colors:Ux,layout:{stepNavigation:"wizard",containerStyle:"glassmorphism",spacing:"normal",roundness:"rounded-2xl",showProgressBar:!0,showStepIndicators:!0,stepIndicatorVariant:"icons-labeled",stepIndicatorPosition:"top-center",stepIndicatorOrientation:"horizontal",eventTitleStyle:"inline"},typography:{fontFamily:"font-sans",stepTitleClass:"text-2xl font-bold text-white",stepDescClass:"text-sm text-zinc-400",labelClass:"font-medium text-zinc-200"},wrapperClass:"bg-[#09090b]"},acampamento_imersivo:{id:"acampamento_imersivo",displayName:"Acampamento Imersivo",colors:{primary:"#f97316",primaryHover:"#ea580c",accent:"#fb923c",background:"#09090b",surface:"rgba(20,20,22,0.85)",text:"#ffffff",textMuted:"#a1a1aa",border:"rgba(249,115,22,0.25)",error:"#f87171"},layout:{stepNavigation:"wizard",containerStyle:"glassmorphism",spacing:"normal",roundness:"rounded-2xl",showProgressBar:!0,showStepIndicators:!0,stepIndicatorVariant:"icons-labeled",stepIndicatorPosition:"top-center",stepIndicatorOrientation:"horizontal",eventTitleStyle:"inline"},typography:{fontFamily:"font-sans",stepTitleClass:"text-2xl font-bold text-white",stepDescClass:"text-sm text-zinc-400",labelClass:"font-medium text-zinc-200"},wrapperClass:"bg-[#09090b]"},corporativo:{id:"corporativo",displayName:"Corporativo",colors:Wx,layout:{stepNavigation:"wizard",containerStyle:"bordered",spacing:"normal",roundness:"rounded-lg",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-slate-50 dark:bg-slate-950"},festival:{id:"festival",displayName:"Festival",colors:qx,layout:{stepNavigation:"wizard",containerStyle:"glassmorphism",spacing:"relaxed",roundness:"rounded-2xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-[#0f0f1a]"},webinar:{id:"webinar",displayName:"Webinar",colors:Xx,layout:{stepNavigation:"tabs",containerStyle:"card",spacing:"compact",roundness:"rounded-xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-background"},retiro:{id:"retiro",displayName:"Retiro",colors:Gx,layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"relaxed",roundness:"rounded-2xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-emerald-50 dark:bg-emerald-950/20"},conferencia:{id:"conferencia",displayName:"Conferência",colors:Zx,layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"normal",roundness:"rounded-xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-background"},social:{id:"social",displayName:"Social",colors:Yx,layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"normal",roundness:"rounded-xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-background"},workshop:{id:"workshop",displayName:"Workshop",colors:Kx,layout:{stepNavigation:"vertical",containerStyle:"bordered",spacing:"compact",roundness:"rounded-lg",showProgressBar:!0,showStepIndicators:!0,stepIndicatorVariant:"icons-labeled",stepIndicatorOrientation:"vertical",eventTitleStyle:"bar"},wrapperClass:"bg-amber-50 dark:bg-amber-950/10"},gala:{id:"gala",displayName:"Gala",colors:Jx,layout:{stepNavigation:"wizard",containerStyle:"glassmorphism",spacing:"relaxed",roundness:"rounded-2xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-[#0c0c0c]"},acao:{id:"acao",displayName:"Ação",colors:Qx,layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"compact",roundness:"rounded-lg",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-background"},podcast:{id:"podcast",displayName:"Podcast",colors:eg,layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"normal",roundness:"rounded-xl",showProgressBar:!1,showStepIndicators:!0},wrapperClass:"bg-background"},classico:{id:"classico",displayName:"Clássico",colors:tg,layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"normal",roundness:"rounded-xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-white dark:bg-background"},comunitario:{id:"comunitario",displayName:"Comunitário",colors:rg,layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"relaxed",roundness:"rounded-2xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-yellow-50 dark:bg-background"},noturno:{id:"noturno",displayName:"Noturno",colors:ng,layout:{stepNavigation:"wizard",containerStyle:"glassmorphism",spacing:"relaxed",roundness:"rounded-2xl",showProgressBar:!0,showStepIndicators:!0},typography:{fontFamily:"font-sans",stepTitleClass:"text-2xl font-bold text-[#f8f8f0]",stepDescClass:"text-sm text-[#9990aa]",labelClass:"font-medium text-[#d4d4c8]"},wrapperClass:"bg-[#0a0a0f]"}},uo=e=>e&&e in Kr?Kr[e]:Kr.moderno,ag=()=>Object.values(Kr),og=e=>e.layout.containerStyle==="glassmorphism",su=e=>e.colors.background.startsWith("#0")||e.colors.background.startsWith("rgba(0")||e.colors.text==="#ffffff";var Bs={exports:{}},Un={};/**
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const N=require("react"),o=require("react/jsx-runtime"),Ee=require("react-hook-form"),I=require("lucide-react"),xi=require("react-dom"),Kt=require("@dnd-kit/sortable"),ta=require("@dnd-kit/utilities"),Xt=require("@dnd-kit/core");function gi(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const g=gi(N),Pt=gi(I),ao=gi(xi);var D=(e=>(e.TEXTO="texto",e.TEXTAREA="textarea",e.NUMBER="number",e.EMAIL="email",e.PASSWORD="password",e.TELEFONE="telefone",e.CPF="cpf",e.CEP="cep",e.DATE="date",e.DATETIME="datetime",e.TIME="time",e.DATE_RANGE="date_range",e.SELECT="select",e.AUTOCOMPLETE="autocomplete",e.RADIO="radio",e.CHECKBOX="checkbox",e.CHECKBOX_GROUP="checkbox_group",e.SWITCH="switch",e.SLIDER="slider",e.RATING="rating",e.COLOR="color",e.FILE="file",e.HIDDEN="hidden",e.FIELD_ARRAY="field_array",e.PARTICIPATION_TYPE="participation_type",e.PAYMENT_METHOD="payment_method",e.TERMS="terms",e.SUB_FORM="sub_form",e))(D||{}),vi=(e=>(e.RASCUNHO="rascunho",e.ATIVO="ativo",e.INATIVO="inativo",e))(vi||{}),au=(e=>(e.CPF="cpf",e.TELEFONE="telefone",e.CEP="cep",e.CUSTOM="custom",e))(au||{});const qx={texto:"Texto",textarea:"Área de texto",number:"Número",email:"E-mail",password:"Senha",telefone:"Telefone",cpf:"CPF",cep:"CEP",date:"Data",datetime:"Data e hora",time:"Horário",date_range:"Período (data inicial/final)",select:"Seleção",autocomplete:"Autocomplete",radio:"Radio",checkbox:"Checkbox",checkbox_group:"Grupo de checkboxes",switch:"Switch (toggle)",slider:"Slider",rating:"Avaliação (estrelas)",color:"Cor",file:"Arquivo",hidden:"Oculto",field_array:"Lista de itens",participation_type:"Tipo de participação",payment_method:"Forma de pagamento",terms:"Termos e condições",sub_form:"Sub-formulário"},Gx={texto:"Type",textarea:"AlignLeft",number:"Hash",email:"Mail",password:"Lock",telefone:"Phone",cpf:"CreditCard",cep:"MapPin",date:"Calendar",datetime:"Clock",time:"Timer",date_range:"CalendarRange",select:"ChevronDown",autocomplete:"Search",radio:"CircleDot",checkbox:"CheckSquare",checkbox_group:"ListChecks",switch:"ToggleLeft",slider:"SlidersHorizontal",rating:"Star",color:"Palette",file:"Upload",hidden:"EyeOff",field_array:"List",participation_type:"CalendarDays",payment_method:"Wallet",terms:"ScrollText",sub_form:"LayoutList"},ou=()=>{if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID();if(typeof crypto<"u"&&typeof crypto.getRandomValues=="function"){const e=new Uint8Array(16);crypto.getRandomValues(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128;const t=Array.from(e).map(r=>r.toString(16).padStart(2,"0")).join("");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}return console.warn("[schema-forms-data] generateId: crypto API indisponível neste ambiente. Usando Math.random() como fallback — NÃO USE em contextos de segurança."),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})},Nt=ou,su=/^\d{3}\.?\d{3}\.?\d{3}-?\d{2}$/,iu=/^\(?\d{2}\)?\s?\d{4,5}-?\d{4}$/,lu=/^\d{5}-?\d{3}$/,cu=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,du=e=>{const t=e.replace(/\D/g,"");if(t.length!==11||/^(\d)\1{10}$/.test(t))return!1;const r=n=>{let a=0;for(let i=0;i<n;i++)a+=parseInt(t[i])*(n+1-i);const s=a*10%11;return s>=10?0:s};return r(9)===parseInt(t[9])&&r(10)===parseInt(t[10])},$e=(e,t,r={})=>{if(!e)return!0;if("and"in e||"or"in e){const d="and"in e&&Array.isArray(e.and)&&e.and.length>0,u="or"in e&&Array.isArray(e.or)&&e.or.length>0;return d&&u?(console.warn("[evaluateFieldCondition] FieldConditionGroup com `and` e `or` simultâneos — apenas `and` será avaliado."),e.and.every(m=>$e(m,t,r))):d?e.and.every(m=>$e(m,t,r)):u?e.or.some(m=>$e(m,t,r)):!0}const n=e;if(!n.campoId)return!0;const a=n.source==="evento"?r[n.campoId]:t[n.campoId];if(Array.isArray(a)){const d=n.valor;switch(n.operador){case"contem":return a.includes(d);case"naoContem":return!a.includes(d);case"vazio":return a.length===0;case"naoVazio":return a.length>0;case"igual":return a.length===1&&a[0]===d;case"diferente":return!(a.length===1&&a[0]===d);default:return!0}}const s=a==null||a===!1?"":a===!0?"1":String(a),i=n.valor!==void 0?String(n.valor):"",l=Number(s),c=Number(i);switch(n.operador){case"igual":return s===i;case"diferente":return s!==i;case"vazio":return!s;case"naoVazio":return!!s;case"contem":return s.includes(i);case"naoContem":return!s.includes(i);case"maiorQue":return!isNaN(l)&&!isNaN(c)?l>c:s>i;case"menorQue":return!isNaN(l)&&!isNaN(c)?l<c:s<i;case"maiorOuIgual":return!isNaN(l)&&!isNaN(c)?l>=c:s>=i;case"menorOuIgual":return!isNaN(l)&&!isNaN(c)?l<=c:s<=i;default:return!0}},bi=(e,t,r={})=>{const n={...t},a=[],s=[...e.containers].sort((i,l)=>i.ordem-l.ordem);for(const i of s){if(i.repeatable)continue;const l=$e(i.condicional,t,r),c=[...i.campos].sort((d,u)=>d.ordem-u.ordem);for(const d of c)if(!(l&&$e(d.condicional,t,r))){if(d.tipo===D.FILE){const m=n[d.nome];typeof m=="string"&&m&&a.push(m)}delete n[d.nome]}}return{cleaned:n,fileIdsToDelete:a}},Mn=new Map,Xx=e=>{if(Mn.has(e))return Mn.get(e);if(/^\/.*\/[gimsuy]*$/.test(e))return Mn.set(e,null),null;try{const t=new RegExp(e);return Mn.set(e,t),t}catch{return Mn.set(e,null),null}},es=(e,t,r)=>{const n=e.validacao;if(e.tipo===D.CHECKBOX||e.tipo===D.SWITCH)return e.obrigatorio&&!t?"Campo obrigatório":void 0;if(e.tipo===D.SLIDER){const s=t!=null&&t!==""?Number(t):NaN;return e.obrigatorio&&isNaN(s)?"Campo obrigatório":isNaN(s)?void 0:(n==null?void 0:n.min)!==void 0&&s<n.min?`Valor mínimo: ${n.min}`:(n==null?void 0:n.max)!==void 0&&s>n.max?`Valor máximo: ${n.max}`:void 0}if(e.tipo===D.RATING){const s=t!==void 0?Number(t):0;return e.obrigatorio&&(!s||s<1)?"Avaliação obrigatória":void 0}if(e.tipo===D.DATE_RANGE){const s=t;if(e.obrigatorio){if(!(s!=null&&s.start))return"Data inicial obrigatória";if(!(s!=null&&s.end))return"Data final obrigatória"}return s!=null&&s.start&&(s!=null&&s.end)&&s.start>s.end?"A data inicial deve ser menor ou igual à data final":void 0}if(e.tipo===D.PARTICIPATION_TYPE){if(!e.obrigatorio)return;const s=t;return s!=null&&s.tipo?s.tipo==="por_dia"&&!s.data?"Selecione um dia para participar":"genero"in(s??{})&&!(s!=null&&s.genero)?"Selecione o sexo":void 0:"Selecione o tipo de participação"}if(e.tipo===D.CHECKBOX_GROUP){const s=Array.isArray(t)?t:[];return e.obrigatorio&&s.length===0?"Selecione pelo menos uma opção":void 0}if(e.tipo===D.FILE)return e.obrigatorio&&!t?"Arquivo obrigatório":void 0;if(e.tipo===D.TERMS)return e.obrigatorio&&t!=="accepted"?"Você precisa aceitar os termos para continuar":void 0;if(e.tipo===D.NUMBER){const s=t!=null?String(t):"";if(e.obrigatorio&&!s)return"Campo obrigatório";if(!s)return;const i=Number(s);return isNaN(i)?"Deve ser um número":(n==null?void 0:n.min)!==void 0&&i<n.min?`Valor mínimo: ${n.min}`:(n==null?void 0:n.max)!==void 0&&i>n.max?`Valor máximo: ${n.max}`:void 0}if(e.tipo===D.SELECT||e.tipo===D.AUTOCOMPLETE||e.tipo===D.RADIO){const s=t!=null?String(t):"";return e.obrigatorio&&!s?"Campo obrigatório":s&&e.opcoes&&e.opcoes.length>0&&!e.opcoes.map(l=>String(l.valor)).includes(s)?"Opção inválida":void 0}const a=t!=null?String(t):"";if(e.obrigatorio&&!a.trim())return"Campo obrigatório";if(a){if(e.tipo===D.EMAIL&&!cu.test(a))return"E-mail inválido";if(e.tipo===D.CPF&&(!su.test(a)||!du(a)))return"CPF inválido";if(e.tipo===D.TELEFONE&&!iu.test(a))return"Telefone inválido";if(e.tipo===D.CEP&&!lu.test(a))return"CEP inválido";if(n!=null&&n.minLength&&a.length<n.minLength)return`Mínimo ${n.minLength} caracteres`;if(n!=null&&n.maxLength&&a.length>n.maxLength)return`Máximo ${n.maxLength} caracteres`;if((e.tipo===D.DATE||e.tipo===D.DATETIME)&&a){if(n!=null&&n.minDate&&a<n.minDate)return`Data mínima: ${n.minDate}`;if(n!=null&&n.maxDate&&a>n.maxDate)return`Data máxima: ${n.maxDate}`}if((e.tipo===D.DATE||e.tipo===D.DATETIME)&&a&&((n==null?void 0:n.minAge)!=null||(n==null?void 0:n.maxAge)!=null)){const s=a.split("T")[0],i=new Date(s+"T00:00:00"),l=r["evento.dataInicioEvento"],c=l?new Date(l.split("T")[0]+"T00:00:00"):new Date;let d=c.getFullYear()-i.getFullYear();const u=c.getMonth()-i.getMonth();if((u<0||u===0&&c.getDate()<i.getDate())&&d--,n.minAge!=null&&d<n.minAge)return`Idade mínima: ${n.minAge} ano${n.minAge!==1?"s":""}`;if(n.maxAge!=null&&d>n.maxAge)return`Idade máxima: ${n.maxAge} ano${n.maxAge!==1?"s":""}`}if(n!=null&&n.regex){const s=Xx(n.regex);if(s&&!s.test(a))return n.regexMessage||"Formato inválido"}}},yi=(e,t,r={})=>{var n;const a=[],s=[...e.containers].sort((i,l)=>i.ordem-l.ordem);for(const i of s){if(i.repeatable||!$e(i.condicional,t,r))continue;const c=[...i.campos].sort((d,u)=>d.ordem-u.ordem);for(const d of c){if(d.tipo===D.HIDDEN||d.isDisabled||d.isReadOnly||!$e(d.condicional,t,r))continue;if(d.tipo===D.FIELD_ARRAY){const p=Array.isArray(t[d.nome])?t[d.nome]:[];d.obrigatorio&&p.length===0?a.push({campo:d.nome,label:d.label,message:"Adicione pelo menos um item"}):d.minItems&&p.length<d.minItems?a.push({campo:d.nome,label:d.label,message:`Mínimo de ${d.minItems} item${d.minItems!==1?"s":""}`}):d.maxItems&&p.length>d.maxItems&&a.push({campo:d.nome,label:d.label,message:`Máximo de ${d.maxItems} item${d.maxItems!==1?"s":""}`});for(let f=0;f<p.length;f++){const v=p[f];if(v)for(const h of d.subFields??[]){if(h.isDisabled||h.isReadOnly||!$e(h.condicional,v,r))continue;const b=es(h,v[h.nome],r);b&&a.push({campo:`${d.nome}[${f}].${h.nome}`,label:h.label,message:b})}}continue}if(d.tipo===D.SUB_FORM){const p=t[d.nome]??{};d.obrigatorio&&Object.keys(p).length===0&&a.push({campo:d.nome,label:d.label,message:"Campo obrigatório"});for(const f of((n=d.subSchema)==null?void 0:n.fields)??[]){if(f.isDisabled||f.isReadOnly)continue;const v=es(f,p[f.nome],r);v&&a.push({campo:`${d.nome}.${f.nome}`,label:f.label,message:v})}continue}const m=es(d,t[d.nome],r);m&&a.push({campo:d.nome,label:d.label,message:m})}}return{valid:a.length===0,errors:a}},jt={primary:"#3b82f6",primaryHover:"#2563eb",accent:"#8b5cf6",background:"hsl(var(--background))",surface:"hsl(var(--card))",text:"hsl(var(--foreground))",textMuted:"hsl(var(--muted-foreground))",border:"hsl(var(--border))",error:"hsl(var(--destructive))"},Zx={primary:"#f97316",primaryHover:"#ea580c",accent:"#ef4444",background:"#09090b",surface:"rgba(24,24,27,0.9)",text:"#ffffff",textMuted:"#a1a1aa",border:"rgba(249,115,22,0.2)",error:"#f87171"},Kx={...jt,primary:"#18181b",primaryHover:"#27272a",accent:"#71717a",border:"#e4e4e7"},Yx={...jt,primary:"#1e3a5f",primaryHover:"#162d4a",accent:"#c9a84c"},Jx={...jt,primary:"#ec4899",primaryHover:"#db2777",accent:"#8b5cf6",background:"#0f0f1a",text:"#ffffff",textMuted:"#a78bfa"},Qx={...jt,primary:"#059669",primaryHover:"#047857",accent:"#6ee7b7"},eg={...jt,primary:"#0ea5e9",primaryHover:"#0284c7",accent:"#38bdf8"},tg={...jt,primary:"#6366f1",primaryHover:"#4f46e5",accent:"#818cf8"},rg={...jt,primary:"#d97706",primaryHover:"#b45309",accent:"#fbbf24"},ng={...jt,primary:"#10b981",primaryHover:"#059669",accent:"#34d399"},ag={...jt,primary:"#b45309",primaryHover:"#92400e",accent:"#f59e0b",background:"#0c0c0c",text:"#fafafa",textMuted:"#d4af37"},og={...jt,primary:"#dc2626",primaryHover:"#b91c1c",accent:"#f97316"},sg={...jt,primary:"#7c3aed",primaryHover:"#6d28d9",accent:"#a78bfa"},ig={primary:"#374151",primaryHover:"#1f2937",accent:"#6b7280",background:"#ffffff",surface:"#f9fafb",text:"#111827",textMuted:"#6b7280",border:"#e5e7eb",error:"#ef4444"},lg={primary:"#16a34a",primaryHover:"#15803d",accent:"#4ade80",background:"#fefce8",surface:"#ffffff",text:"#1c1917",textMuted:"#78716c",border:"#d6d3d1",error:"#dc2626"},cg={primary:"#d4af37",primaryHover:"#b8962e",accent:"#f0d060",background:"#0a0a0f",surface:"rgba(20,20,30,0.95)",text:"#f8f8f0",textMuted:"#9990aa",border:"rgba(212,175,55,0.25)",error:"#f87171"},Zr={moderno:{id:"moderno",displayName:"Moderno",colors:{...jt},layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"normal",roundness:"rounded-xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-muted/30"},minimalista:{id:"minimalista",displayName:"Minimalista",colors:Kx,layout:{stepNavigation:"wizard",containerStyle:"flat",spacing:"relaxed",roundness:"rounded-lg",showProgressBar:!1,showStepIndicators:!1},wrapperClass:"bg-background"},card:{id:"card",displayName:"Card",colors:{...jt},layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"normal",roundness:"rounded-2xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-muted/40"},banner:{id:"banner",displayName:"Banner",colors:{...jt},layout:{stepNavigation:"tabs",containerStyle:"bordered",spacing:"normal",roundness:"rounded-xl",showProgressBar:!1,showStepIndicators:!0},wrapperClass:"bg-background"},acampamento:{id:"acampamento",displayName:"Acampamento",colors:Zx,layout:{stepNavigation:"wizard",containerStyle:"glassmorphism",spacing:"normal",roundness:"rounded-2xl",showProgressBar:!0,showStepIndicators:!0,stepIndicatorVariant:"icons-labeled",stepIndicatorPosition:"top-center",stepIndicatorOrientation:"horizontal",eventTitleStyle:"inline"},typography:{fontFamily:"font-sans",stepTitleClass:"text-2xl font-bold text-white",stepDescClass:"text-sm text-zinc-400",labelClass:"font-medium text-zinc-200"},wrapperClass:"bg-[#09090b]"},acampamento_imersivo:{id:"acampamento_imersivo",displayName:"Acampamento Imersivo",colors:{primary:"#f97316",primaryHover:"#ea580c",accent:"#fb923c",background:"#09090b",surface:"rgba(20,20,22,0.85)",text:"#ffffff",textMuted:"#a1a1aa",border:"rgba(249,115,22,0.25)",error:"#f87171"},layout:{stepNavigation:"wizard",containerStyle:"glassmorphism",spacing:"normal",roundness:"rounded-2xl",showProgressBar:!0,showStepIndicators:!0,stepIndicatorVariant:"icons-labeled",stepIndicatorPosition:"top-center",stepIndicatorOrientation:"horizontal",eventTitleStyle:"inline"},typography:{fontFamily:"font-sans",stepTitleClass:"text-2xl font-bold text-white",stepDescClass:"text-sm text-zinc-400",labelClass:"font-medium text-zinc-200"},wrapperClass:"bg-[#09090b]"},corporativo:{id:"corporativo",displayName:"Corporativo",colors:Yx,layout:{stepNavigation:"wizard",containerStyle:"bordered",spacing:"normal",roundness:"rounded-lg",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-slate-50 dark:bg-slate-950"},festival:{id:"festival",displayName:"Festival",colors:Jx,layout:{stepNavigation:"wizard",containerStyle:"glassmorphism",spacing:"relaxed",roundness:"rounded-2xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-[#0f0f1a]"},webinar:{id:"webinar",displayName:"Webinar",colors:eg,layout:{stepNavigation:"tabs",containerStyle:"card",spacing:"compact",roundness:"rounded-xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-background"},retiro:{id:"retiro",displayName:"Retiro",colors:Qx,layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"relaxed",roundness:"rounded-2xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-emerald-50 dark:bg-emerald-950/20"},conferencia:{id:"conferencia",displayName:"Conferência",colors:tg,layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"normal",roundness:"rounded-xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-background"},social:{id:"social",displayName:"Social",colors:ng,layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"normal",roundness:"rounded-xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-background"},workshop:{id:"workshop",displayName:"Workshop",colors:rg,layout:{stepNavigation:"vertical",containerStyle:"bordered",spacing:"compact",roundness:"rounded-lg",showProgressBar:!0,showStepIndicators:!0,stepIndicatorVariant:"icons-labeled",stepIndicatorOrientation:"vertical",eventTitleStyle:"bar"},wrapperClass:"bg-amber-50 dark:bg-amber-950/10"},gala:{id:"gala",displayName:"Gala",colors:ag,layout:{stepNavigation:"wizard",containerStyle:"glassmorphism",spacing:"relaxed",roundness:"rounded-2xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-[#0c0c0c]"},acao:{id:"acao",displayName:"Ação",colors:og,layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"compact",roundness:"rounded-lg",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-background"},podcast:{id:"podcast",displayName:"Podcast",colors:sg,layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"normal",roundness:"rounded-xl",showProgressBar:!1,showStepIndicators:!0},wrapperClass:"bg-background"},classico:{id:"classico",displayName:"Clássico",colors:ig,layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"normal",roundness:"rounded-xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-white dark:bg-background"},comunitario:{id:"comunitario",displayName:"Comunitário",colors:lg,layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"relaxed",roundness:"rounded-2xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-yellow-50 dark:bg-background"},noturno:{id:"noturno",displayName:"Noturno",colors:cg,layout:{stepNavigation:"wizard",containerStyle:"glassmorphism",spacing:"relaxed",roundness:"rounded-2xl",showProgressBar:!0,showStepIndicators:!0},typography:{fontFamily:"font-sans",stepTitleClass:"text-2xl font-bold text-[#f8f8f0]",stepDescClass:"text-sm text-[#9990aa]",labelClass:"font-medium text-[#d4d4c8]"},wrapperClass:"bg-[#0a0a0f]"}},oo=e=>e&&e in Zr?Zr[e]:Zr.moderno,dg=()=>Object.values(Zr),ug=e=>e.layout.containerStyle==="glassmorphism",uu=e=>e.colors.background.startsWith("#0")||e.colors.background.startsWith("rgba(0")||e.colors.text==="#ffffff";var zs={exports:{}},Vn={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.min.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var Xl;function
|
|
9
|
+
*/var Xl;function mg(){if(Xl)return Vn;Xl=1;var e=N,t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function i(l,c,d){var u,m={},p=null,f=null;d!==void 0&&(p=""+d),c.key!==void 0&&(p=""+c.key),c.ref!==void 0&&(f=c.ref);for(u in c)n.call(c,u)&&!s.hasOwnProperty(u)&&(m[u]=c[u]);if(l&&l.defaultProps)for(u in c=l.defaultProps,c)m[u]===void 0&&(m[u]=c[u]);return{$$typeof:t,type:l,key:p,ref:f,props:m,_owner:a.current}}return Vn.Fragment=r,Vn.jsx=i,Vn.jsxs=i,Vn}var xa={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,25 +14,25 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var Zl;function
|
|
18
|
-
`+G+R}}var J=!1,te;{var ce=typeof WeakMap=="function"?WeakMap:Map;te=new ce}function be(R,ee){if(!R||J)return"";{var de=te.get(R);if(de!==void 0)return de}var je;J=!0;var
|
|
17
|
+
*/var Zl;function pg(){return Zl||(Zl=1,process.env.NODE_ENV!=="production"&&function(){var e=N,t=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),m=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),f=Symbol.for("react.offscreen"),v=Symbol.iterator,h="@@iterator";function x(R){if(R===null||typeof R!="object")return null;var ee=v&&R[v]||R[h];return typeof ee=="function"?ee:null}var b=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function y(R){{for(var ee=arguments.length,de=new Array(ee>1?ee-1:0),je=1;je<ee;je++)de[je-1]=arguments[je];j("error",R,de)}}function j(R,ee,de){{var je=b.ReactDebugCurrentFrame,Ie=je.getStackAddendum();Ie!==""&&(ee+="%s",de=de.concat([Ie]));var Le=de.map(function(Re){return String(Re)});Le.unshift("Warning: "+ee),Function.prototype.apply.call(console[R],console,Le)}}var w=!1,C=!1,S=!1,$=!1,k=!1,E;E=Symbol.for("react.module.reference");function T(R){return!!(typeof R=="string"||typeof R=="function"||R===n||R===s||k||R===a||R===d||R===u||$||R===f||w||C||S||typeof R=="object"&&R!==null&&(R.$$typeof===p||R.$$typeof===m||R.$$typeof===i||R.$$typeof===l||R.$$typeof===c||R.$$typeof===E||R.getModuleId!==void 0))}function O(R,ee,de){var je=R.displayName;if(je)return je;var Ie=ee.displayName||ee.name||"";return Ie!==""?de+"("+Ie+")":de}function L(R){return R.displayName||"Context"}function A(R){if(R==null)return null;if(typeof R.tag=="number"&&y("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof R=="function")return R.displayName||R.name||null;if(typeof R=="string")return R;switch(R){case n:return"Fragment";case r:return"Portal";case s:return"Profiler";case a:return"StrictMode";case d:return"Suspense";case u:return"SuspenseList"}if(typeof R=="object")switch(R.$$typeof){case l:var ee=R;return L(ee)+".Consumer";case i:var de=R;return L(de._context)+".Provider";case c:return O(R,R.render,"ForwardRef");case m:var je=R.displayName||null;return je!==null?je:A(R.type)||"Memo";case p:{var Ie=R,Le=Ie._payload,Re=Ie._init;try{return A(Re(Le))}catch{return null}}}return null}var z=Object.assign,X=0,q,Z,V,M,_,se,U;function Q(){}Q.__reactDisabledLog=!0;function Y(){{if(X===0){q=console.log,Z=console.info,V=console.warn,M=console.error,_=console.group,se=console.groupCollapsed,U=console.groupEnd;var R={configurable:!0,enumerable:!0,value:Q,writable:!0};Object.defineProperties(console,{info:R,log:R,warn:R,error:R,group:R,groupCollapsed:R,groupEnd:R})}X++}}function H(){{if(X--,X===0){var R={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:z({},R,{value:q}),info:z({},R,{value:Z}),warn:z({},R,{value:V}),error:z({},R,{value:M}),group:z({},R,{value:_}),groupCollapsed:z({},R,{value:se}),groupEnd:z({},R,{value:U})})}X<0&&y("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var W=b.ReactCurrentDispatcher,G;function ne(R,ee,de){{if(G===void 0)try{throw Error()}catch(Ie){var je=Ie.stack.trim().match(/\n( *(at )?)/);G=je&&je[1]||""}return`
|
|
18
|
+
`+G+R}}var J=!1,te;{var ce=typeof WeakMap=="function"?WeakMap:Map;te=new ce}function be(R,ee){if(!R||J)return"";{var de=te.get(R);if(de!==void 0)return de}var je;J=!0;var Ie=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var Le;Le=W.current,W.current=null,Y();try{if(ee){var Re=function(){throw Error()};if(Object.defineProperty(Re.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Re,[])}catch(vt){je=vt}Reflect.construct(R,[],Re)}else{try{Re.call()}catch(vt){je=vt}R.call(Re.prototype)}}else{try{throw Error()}catch(vt){je=vt}R()}}catch(vt){if(vt&&je&&typeof vt.stack=="string"){for(var De=vt.stack.split(`
|
|
19
19
|
`),ut=je.stack.split(`
|
|
20
|
-
`),
|
|
21
|
-
`+
|
|
20
|
+
`),Ue=De.length-1,Ye=ut.length-1;Ue>=1&&Ye>=0&&De[Ue]!==ut[Ye];)Ye--;for(;Ue>=1&&Ye>=0;Ue--,Ye--)if(De[Ue]!==ut[Ye]){if(Ue!==1||Ye!==1)do if(Ue--,Ye--,Ye<0||De[Ue]!==ut[Ye]){var Ot=`
|
|
21
|
+
`+De[Ue].replace(" at new "," at ");return R.displayName&&Ot.includes("<anonymous>")&&(Ot=Ot.replace("<anonymous>",R.displayName)),typeof R=="function"&&te.set(R,Ot),Ot}while(Ue>=1&&Ye>=0);break}}}finally{J=!1,W.current=Le,H(),Error.prepareStackTrace=Ie}var ln=R?R.displayName||R.name:"",Hr=ln?ne(ln):"";return typeof R=="function"&&te.set(R,Hr),Hr}function Ce(R,ee,de){return be(R,!1)}function ve(R){var ee=R.prototype;return!!(ee&&ee.isReactComponent)}function me(R,ee,de){if(R==null)return"";if(typeof R=="function")return be(R,ve(R));if(typeof R=="string")return ne(R);switch(R){case d:return ne("Suspense");case u:return ne("SuspenseList")}if(typeof R=="object")switch(R.$$typeof){case c:return Ce(R.render);case m:return me(R.type,ee,de);case p:{var je=R,Ie=je._payload,Le=je._init;try{return me(Le(Ie),ee,de)}catch{}}}return""}var Te=Object.prototype.hasOwnProperty,ze={},dt=b.ReactDebugCurrentFrame;function Ve(R){if(R){var ee=R._owner,de=me(R.type,R._source,ee?ee.type:null);dt.setExtraStackFrame(de)}else dt.setExtraStackFrame(null)}function P(R,ee,de,je,Ie){{var Le=Function.call.bind(Te);for(var Re in R)if(Le(R,Re)){var De=void 0;try{if(typeof R[Re]!="function"){var ut=Error((je||"React class")+": "+de+" type `"+Re+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof R[Re]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw ut.name="Invariant Violation",ut}De=R[Re](ee,Re,je,de,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Ue){De=Ue}De&&!(De instanceof Error)&&(Ve(Ie),y("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",je||"React class",de,Re,typeof De),Ve(null)),De instanceof Error&&!(De.message in ze)&&(ze[De.message]=!0,Ve(Ie),y("Failed %s type: %s",de,De.message),Ve(null))}}}var F=Array.isArray;function B(R){return F(R)}function le(R){{var ee=typeof Symbol=="function"&&Symbol.toStringTag,de=ee&&R[Symbol.toStringTag]||R.constructor.name||"Object";return de}}function oe(R){try{return re(R),!1}catch{return!0}}function re(R){return""+R}function ye(R){if(oe(R))return y("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",le(R)),re(R)}var Pe=b.ReactCurrentOwner,_e={key:!0,ref:!0,__self:!0,__source:!0},st,er;function tr(R){if(Te.call(R,"ref")){var ee=Object.getOwnPropertyDescriptor(R,"ref").get;if(ee&&ee.isReactWarning)return!1}return R.ref!==void 0}function Xo(R){if(Te.call(R,"key")){var ee=Object.getOwnPropertyDescriptor(R,"key").get;if(ee&&ee.isReactWarning)return!1}return R.key!==void 0}function zn(R,ee){typeof R.ref=="string"&&Pe.current}function Ln(R,ee){{var de=function(){st||(st=!0,y("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",ee))};de.isReactWarning=!0,Object.defineProperty(R,"key",{get:de,configurable:!0})}}function Zo(R,ee){{var de=function(){er||(er=!0,y("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",ee))};de.isReactWarning=!0,Object.defineProperty(R,"ref",{get:de,configurable:!0})}}var ha=function(R,ee,de,je,Ie,Le,Re){var De={$$typeof:t,type:R,key:ee,ref:de,props:Re,_owner:Le};return De._store={},Object.defineProperty(De._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(De,"_self",{configurable:!1,enumerable:!1,writable:!1,value:je}),Object.defineProperty(De,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Ie}),Object.freeze&&(Object.freeze(De.props),Object.freeze(De)),De};function Ko(R,ee,de,je,Ie){{var Le,Re={},De=null,ut=null;de!==void 0&&(ye(de),De=""+de),Xo(ee)&&(ye(ee.key),De=""+ee.key),tr(ee)&&(ut=ee.ref,zn(ee));for(Le in ee)Te.call(ee,Le)&&!_e.hasOwnProperty(Le)&&(Re[Le]=ee[Le]);if(R&&R.defaultProps){var Ue=R.defaultProps;for(Le in Ue)Re[Le]===void 0&&(Re[Le]=Ue[Le])}if(De||ut){var Ye=typeof R=="function"?R.displayName||R.name||"Unknown":R;De&&Ln(Re,Ye),ut&&Zo(Re,Ye)}return ha(R,De,ut,Ie,je,Pe.current,Re)}}var on=b.ReactCurrentOwner,Vl=b.ReactDebugCurrentFrame;function sn(R){if(R){var ee=R._owner,de=me(R.type,R._source,ee?ee.type:null);Vl.setExtraStackFrame(de)}else Vl.setExtraStackFrame(null)}var Yo;Yo=!1;function Jo(R){return typeof R=="object"&&R!==null&&R.$$typeof===t}function Bl(){{if(on.current){var R=A(on.current.type);if(R)return`
|
|
22
22
|
|
|
23
|
-
Check the render method of \``+R+"`."}return""}}function
|
|
23
|
+
Check the render method of \``+R+"`."}return""}}function Ox(R){return""}var Ul={};function Fx(R){{var ee=Bl();if(!ee){var de=typeof R=="string"?R:R.displayName||R.name;de&&(ee=`
|
|
24
24
|
|
|
25
|
-
Check the top-level render call using <`+de+">.")}return ee}}function Hl(R,ee){{if(!R._store||R._store.validated||R.key!=null)return;R._store.validated=!0;var de=
|
|
25
|
+
Check the top-level render call using <`+de+">.")}return ee}}function Hl(R,ee){{if(!R._store||R._store.validated||R.key!=null)return;R._store.validated=!0;var de=Fx(ee);if(Ul[de])return;Ul[de]=!0;var je="";R&&R._owner&&R._owner!==on.current&&(je=" It was passed a child from "+A(R._owner.type)+"."),sn(R),y('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',de,je),sn(null)}}function Wl(R,ee){{if(typeof R!="object")return;if(B(R))for(var de=0;de<R.length;de++){var je=R[de];Jo(je)&&Hl(je,ee)}else if(Jo(R))R._store&&(R._store.validated=!0);else if(R){var Ie=x(R);if(typeof Ie=="function"&&Ie!==R.entries)for(var Le=Ie.call(R),Re;!(Re=Le.next()).done;)Jo(Re.value)&&Hl(Re.value,ee)}}}function zx(R){{var ee=R.type;if(ee==null||typeof ee=="string")return;var de;if(typeof ee=="function")de=ee.propTypes;else if(typeof ee=="object"&&(ee.$$typeof===c||ee.$$typeof===m))de=ee.propTypes;else return;if(de){var je=A(ee);P(de,R.props,"prop",je,R)}else if(ee.PropTypes!==void 0&&!Yo){Yo=!0;var Ie=A(ee);y("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Ie||"Unknown")}typeof ee.getDefaultProps=="function"&&!ee.getDefaultProps.isReactClassApproved&&y("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Lx(R){{for(var ee=Object.keys(R.props),de=0;de<ee.length;de++){var je=ee[de];if(je!=="children"&&je!=="key"){sn(R),y("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",je),sn(null);break}}R.ref!==null&&(sn(R),y("Invalid attribute `ref` supplied to `React.Fragment`."),sn(null))}}var ql={};function Gl(R,ee,de,je,Ie,Le){{var Re=T(R);if(!Re){var De="";(R===void 0||typeof R=="object"&&R!==null&&Object.keys(R).length===0)&&(De+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var ut=Ox();ut?De+=ut:De+=Bl();var Ue;R===null?Ue="null":B(R)?Ue="array":R!==void 0&&R.$$typeof===t?(Ue="<"+(A(R.type)||"Unknown")+" />",De=" Did you accidentally export a JSX literal instead of a component?"):Ue=typeof R,y("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Ue,De)}var Ye=Ko(R,ee,de,Ie,Le);if(Ye==null)return Ye;if(Re){var Ot=ee.children;if(Ot!==void 0)if(je)if(B(Ot)){for(var ln=0;ln<Ot.length;ln++)Wl(Ot[ln],R);Object.freeze&&Object.freeze(Ot)}else y("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Wl(Ot,R)}if(Te.call(ee,"key")){var Hr=A(R),vt=Object.keys(ee).filter(function(Wx){return Wx!=="key"}),Qo=vt.length>0?"{key: someKey, "+vt.join(": ..., ")+": ...}":"{key: someKey}";if(!ql[Hr+Qo]){var Hx=vt.length>0?"{"+vt.join(": ..., ")+": ...}":"{}";y(`A props object containing a "key" prop is being spread into JSX:
|
|
26
26
|
let props = %s;
|
|
27
27
|
<%s {...props} />
|
|
28
28
|
React keys must be passed directly to JSX without using spread:
|
|
29
29
|
let props = %s;
|
|
30
|
-
<%s key={someKey} {...props} />`,as,Wr,Lx,Wr),ql[Wr+as]=!0}}return R===n?Px(Ze):Ix(Ze),Ze}}function _x(R,ee,de){return Gl(R,ee,de,!0)}function Ox(R,ee,de){return Gl(R,ee,de,!1)}var Fx=Ox,zx=_x;wa.Fragment=n,wa.jsx=Fx,wa.jsxs=zx}()),wa}process.env.NODE_ENV==="production"?Bs.exports=sg():Bs.exports=ig();var os=Bs.exports;const Us=N.createContext(uo("moderno")),ea=({config:e,children:t,renderWrapper:r=!0,className:n,style:a})=>{const s={"--t-primary":e.colors.primary,"--t-primary-hover":e.colors.primaryHover,"--t-accent":e.colors.accent,"--t-bg":e.colors.background,"--t-surface":e.colors.surface,"--t-text":e.colors.text,"--t-text-muted":e.colors.textMuted,"--t-border":e.colors.border,"--t-error":e.colors.error,...a};return r?os.jsx(Us.Provider,{value:e,children:os.jsx("div",{className:n,style:s,"data-template":"1",children:t})}):os.jsx(Us.Provider,{value:e,children:t})},sa=()=>N.useContext(Us),mo=[{id:"preset_personal",name:"Dados Pessoais",description:"Nome, e-mail, CPF, telefone e data de nascimento",icon:"User",category:"personal",containerTemplate:{titulo:"Dados Pessoais",icone:"User",ordem:0,campos:[{id:"_personal_nome",nome:"nome",tipo:T.TEXTO,label:"Nome completo",ordem:0,tamanho:12,obrigatorio:!0,placeholder:"Seu nome completo"},{id:"_personal_email",nome:"email",tipo:T.EMAIL,label:"E-mail",ordem:1,tamanho:6,obrigatorio:!0,placeholder:"seuemail@exemplo.com"},{id:"_personal_telefone",nome:"telefone",tipo:T.TELEFONE,label:"Telefone / WhatsApp",ordem:2,tamanho:6,obrigatorio:!0,placeholder:"(11) 99999-9999"},{id:"_personal_cpf",nome:"cpf",tipo:T.CPF,label:"CPF",ordem:3,tamanho:6,obrigatorio:!1,placeholder:"000.000.000-00"},{id:"_personal_nascimento",nome:"data_nascimento",tipo:T.DATE,label:"Data de nascimento",ordem:4,tamanho:6,obrigatorio:!1}]}},{id:"preset_emergency_array",name:"Contatos de Emergência",description:"Lista de contatos (mín. 2, máx. 7) com Nome, Parentesco e Telefone",icon:"PhoneCall",category:"emergency",containerTemplate:{titulo:"Contatos de Emergência",icone:"PhoneCall",ordem:0,campos:[{id:"_emerg_array_contatos",nome:"contatos_emergencia",tipo:T.FIELD_ARRAY,label:"Contatos de Emergência",ordem:0,tamanho:12,obrigatorio:!0,itemLabel:"Contato",minItems:2,maxItems:7,addLabel:"Adicionar Contato",subFields:[{id:"_emerg_array_nome",nome:"nome",tipo:T.TEXTO,label:"Nome",ordem:0,tamanho:4,obrigatorio:!0,placeholder:"Nome completo do contato"},{id:"_emerg_array_parentesco",nome:"parentesco",tipo:T.SELECT,label:"Parentesco",ordem:1,tamanho:4,obrigatorio:!0,opcoes:[{valor:"pai",label:"Pai"},{valor:"mae",label:"Mãe"},{valor:"conjuge",label:"Cônjuge"},{valor:"irmao",label:"Irmão/Irmã"},{valor:"avo",label:"Avô/Avó"},{valor:"tio",label:"Tio/Tia"},{valor:"amigo",label:"Amigo(a)"},{valor:"outro",label:"Outro"}]},{id:"_emerg_array_telefone",nome:"telefone",tipo:T.TELEFONE,label:"Celular",ordem:2,tamanho:4,obrigatorio:!0,placeholder:"(34) 99999-9999"}]}]}},{id:"preset_emergency",name:"Contatos de Emergência (Repetível)",description:"Lista repetível de contatos de emergência (mínimo 2)",icon:"PhoneCall",category:"emergency",containerTemplate:{titulo:"Contatos de Emergência",icone:"PhoneCall",ordem:0,nome:"contatos_emergencia",repeatable:!0,minItems:2,maxItems:5,itemLabel:"Contato",campos:[{id:"_emerg_nome",nome:"nome",tipo:T.TEXTO,label:"Nome",ordem:0,tamanho:12,obrigatorio:!0,placeholder:"Nome completo do contato"},{id:"_emerg_parentesco",nome:"parentesco",tipo:T.SELECT,label:"Parentesco",ordem:1,tamanho:6,obrigatorio:!0,opcoes:[{valor:"pai",label:"Pai"},{valor:"mae",label:"Mãe"},{valor:"conjuge",label:"Cônjuge"},{valor:"irmao",label:"Irmão/Irmã"},{valor:"avo",label:"Avô/Avó"},{valor:"amigo",label:"Amigo(a)"},{valor:"outro",label:"Outro"}]},{id:"_emerg_telefone",nome:"telefone",tipo:T.TELEFONE,label:"Telefone",ordem:2,tamanho:6,obrigatorio:!0,placeholder:"(11) 99999-9999"}]}},{id:"preset_address",name:"Endereço",description:"CEP com preenchimento automático via ViaCEP + campos de endereço",icon:"MapPin",category:"address",containerTemplate:{titulo:"Endereço",icone:"MapPin",ordem:0,campos:[{id:"_address_cep",nome:"_address_cep",tipo:T.CEP,label:"CEP",ordem:0,tamanho:4,obrigatorio:!1,placeholder:"00000-000",hint:"Preencha o CEP para auto-completar o endereço",locked:!0,cepFillMap:{logradouro:"_address_logradouro",bairro:"_address_bairro",cidade:"_address_cidade",estado:"_address_estado"}},{id:"_address_logradouro",nome:"_address_logradouro",tipo:T.TEXTO,label:"Logradouro",ordem:1,tamanho:8,obrigatorio:!1,placeholder:"Rua, Av., Travessa...",locked:!0},{id:"_address_numero",nome:"_address_numero",tipo:T.TEXTO,label:"Número",ordem:2,tamanho:3,obrigatorio:!1,placeholder:"Nº"},{id:"_address_complemento",nome:"_address_complemento",tipo:T.TEXTO,label:"Complemento",ordem:3,tamanho:9,obrigatorio:!1,placeholder:"Apto, bloco, casa..."},{id:"_address_bairro",nome:"_address_bairro",tipo:T.TEXTO,label:"Bairro",ordem:4,tamanho:5,obrigatorio:!1,locked:!0},{id:"_address_cidade",nome:"_address_cidade",tipo:T.TEXTO,label:"Cidade",ordem:5,tamanho:5,obrigatorio:!1,locked:!0},{id:"_address_estado",nome:"_address_estado",tipo:T.TEXTO,label:"Estado (UF)",ordem:6,tamanho:2,obrigatorio:!1,placeholder:"SP",locked:!0}]}},{id:"preset_responsible",name:"Responsável",description:"Dados do responsável legal (para menores ou dependentes)",icon:"Users",category:"personal",containerTemplate:{titulo:"Responsável",icone:"Users",ordem:0,campos:[{id:"_resp_nome",nome:"responsavel_nome",tipo:T.TEXTO,label:"Nome do responsável",ordem:0,tamanho:12,obrigatorio:!0,placeholder:"Nome completo do responsável"},{id:"_resp_parentesco",nome:"responsavel_parentesco",tipo:T.SELECT,label:"Parentesco",ordem:1,tamanho:6,obrigatorio:!0,opcoes:[{valor:"pai",label:"Pai"},{valor:"mae",label:"Mãe"},{valor:"avo",label:"Avô/Avó"},{valor:"outro",label:"Outro"}]},{id:"_resp_telefone",nome:"responsavel_telefone",tipo:T.TELEFONE,label:"Telefone do responsável",ordem:2,tamanho:6,obrigatorio:!0,placeholder:"(11) 99999-9999"},{id:"_resp_cpf",nome:"responsavel_cpf",tipo:T.CPF,label:"CPF do responsável",ordem:3,tamanho:6,obrigatorio:!1,placeholder:"000.000.000-00"}]}},{id:"preset_health",name:"Informações de Saúde",description:"Alergias, medicamentos, tipo sanguíneo e plano de saúde",icon:"HeartPulse",category:"health",containerTemplate:{titulo:"Informações de Saúde",icone:"HeartPulse",ordem:0,campos:[{id:"_health_tipo_sanguineo",nome:"tipo_sanguineo",tipo:T.SELECT,label:"Tipo sanguíneo",ordem:0,tamanho:4,obrigatorio:!1,opcoes:[{valor:"A+",label:"A+"},{valor:"A-",label:"A-"},{valor:"B+",label:"B+"},{valor:"B-",label:"B-"},{valor:"AB+",label:"AB+"},{valor:"AB-",label:"AB-"},{valor:"O+",label:"O+"},{valor:"O-",label:"O-"},{valor:"nao_sei",label:"Não sei"}]},{id:"_health_plano",nome:"plano_saude",tipo:T.TEXTO,label:"Plano de saúde",ordem:1,tamanho:8,obrigatorio:!1,placeholder:'Ex: Unimed... ou "Nenhum"'},{id:"_health_alergias",nome:"alergias",tipo:T.TEXTAREA,label:"Alergias",ordem:2,tamanho:12,obrigatorio:!1,placeholder:"Descreva alergias conhecidas"},{id:"_health_medicamentos",nome:"medicamentos",tipo:T.TEXTAREA,label:"Medicamentos em uso contínuo",ordem:3,tamanho:12,obrigatorio:!1,placeholder:"Nome, dosagem e frequência"},{id:"_health_obs",nome:"observacoes_medicas",tipo:T.TEXTAREA,label:"Outras observações médicas",ordem:4,tamanho:12,obrigatorio:!1}]}},{id:"preset_participation",name:"Participação",description:"Restrições alimentares, tamanho de camiseta e observações gerais",icon:"ClipboardList",category:"event",containerTemplate:{titulo:"Participação",icone:"ClipboardList",ordem:0,campos:[{id:"_part_restricao_alimentar",nome:"restricao_alimentar",tipo:T.SELECT,label:"Restrição alimentar",ordem:0,tamanho:6,obrigatorio:!1,opcoes:[{valor:"nenhuma",label:"Nenhuma"},{valor:"vegetariano",label:"Vegetariano"},{valor:"vegano",label:"Vegano"},{valor:"sem_gluten",label:"Sem glúten"},{valor:"sem_lactose",label:"Sem lactose"},{valor:"outro",label:"Outro"}]},{id:"_part_camiseta",nome:"tamanho_camiseta",tipo:T.SELECT,label:"Tamanho da camiseta",ordem:1,tamanho:6,obrigatorio:!1,opcoes:[{valor:"PP",label:"PP"},{valor:"P",label:"P"},{valor:"M",label:"M"},{valor:"G",label:"G"},{valor:"GG",label:"GG"},{valor:"XGG",label:"XGG"}]},{id:"_part_obs",nome:"observacoes_participacao",tipo:T.TEXTAREA,label:"Observações",ordem:2,tamanho:12,obrigatorio:!1}]}},{id:"preset_payment",name:"Informações de Pagamento",description:"Forma de pagamento e comprovante",icon:"CreditCard",category:"payment",containerTemplate:{titulo:"Pagamento",icone:"CreditCard",ordem:0,campos:[{id:"_pay_forma",nome:"forma_pagamento",tipo:T.SELECT,label:"Forma de pagamento",ordem:0,tamanho:6,obrigatorio:!0,opcoes:[{valor:"pix",label:"PIX"},{valor:"cartao",label:"Cartão de crédito/débito"},{valor:"boleto",label:"Boleto bancário"},{valor:"dinheiro",label:"Dinheiro (presencial)"}]},{id:"_pay_comprovante",nome:"comprovante_pagamento",tipo:T.FILE,label:"Comprovante de pagamento",ordem:1,tamanho:6,obrigatorio:!1,hint:"Envie o comprovante caso já tenha efetuado o pagamento"}]}},{id:"preset_participation_type",name:"Tipo de Participação",description:"Seleção de todos os dias ou dia específico. Datas, preços e vagas carregados via externalData.",icon:"CalendarDays",category:"event",containerTemplate:{titulo:"Tipo de Participação",icone:"CalendarDays",descricao:"Escolha como você deseja participar do evento",ordem:0,campos:[{id:"_participation_type_field",nome:"tipo_participacao",tipo:T.PARTICIPATION_TYPE,label:"Tipo de Participação",hint:"Escolha como você deseja participar",ordem:0,tamanho:12,obrigatorio:!0,locked:!0}]}}],lg=e=>mo.filter(t=>t.category===e),ki=e=>mo.find(t=>t.id===e),Ci=[{id:"preset_steps_participation_payment",name:"Participação + Pagamento",description:"Dois steps: seleção do tipo de participação e escolha da forma de pagamento com cálculo automático de taxas.",icon:"Wallet",steps:[{titulo:"Tipo de Participação",descricao:"Escolha como deseja participar do evento",icone:"CalendarDays",containers:[{titulo:"Tipo de Participação",icone:"CalendarDays",descricao:"Escolha como você deseja participar do evento",ordem:0,campos:[{id:"_participation_type_field",nome:"tipo_participacao",tipo:T.PARTICIPATION_TYPE,label:"Tipo de Participação",hint:"Escolha como você deseja participar",ordem:0,tamanho:12,obrigatorio:!0,locked:!0}]}]},{titulo:"Forma de Pagamento",descricao:"Escolha como deseja pagar sua inscrição",icone:"Wallet",containers:[{titulo:"Forma de Pagamento",icone:"Wallet",descricao:"Escolha como deseja pagar sua inscrição",ordem:0,campos:[{id:"_payment_method_field",nome:"forma_pagamento",tipo:T.PAYMENT_METHOD,label:"Forma de Pagamento",ordem:0,tamanho:12,obrigatorio:!0,locked:!0,relatedFieldName:"tipo_participacao"}]}]}]}],cg=e=>Ci.find(t=>t.id===e);function iu(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(r=iu(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function lu(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=iu(e))&&(n&&(n+=" "),n+=t);return n}const dg=(e,t)=>{const r=new Array(e.length+t.length);for(let n=0;n<e.length;n++)r[n]=e[n];for(let n=0;n<t.length;n++)r[e.length+n]=t[n];return r},ug=(e,t)=>({classGroupId:e,validator:t}),cu=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),Va="-",Kl=[],mg="arbitrary..",pg=e=>{const t=hg(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return fg(a);const s=a.split(Va),i=s[0]===""&&s.length>1?1:0;return du(s,i,t)},getConflictingClassGroupIds:(a,s)=>{if(s){const i=n[a],l=r[a];return i?l?dg(l,i):i:l||Kl}return r[a]||Kl}}},du=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const n=e[t],a=r.nextPart.get(n);if(a){const c=du(e,t+1,a);if(c)return c}const s=r.validators;if(s===null)return;const i=t===0?e.join(Va):e.slice(t).join(Va),l=s.length;for(let c=0;c<l;c++){const d=s[c];if(d.validator(i))return d.classGroupId}},fg=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),n=t.slice(0,r);return n?mg+n:void 0})(),hg=e=>{const{theme:t,classGroups:r}=e;return xg(r,t)},xg=(e,t)=>{const r=cu();for(const n in e){const a=e[n];Ni(a,r,n,t)}return r},Ni=(e,t,r,n)=>{const a=e.length;for(let s=0;s<a;s++){const i=e[s];gg(i,t,r,n)}},gg=(e,t,r,n)=>{if(typeof e=="string"){vg(e,t,r);return}if(typeof e=="function"){bg(e,t,r,n);return}yg(e,t,r,n)},vg=(e,t,r)=>{const n=e===""?t:uu(t,e);n.classGroupId=r},bg=(e,t,r,n)=>{if(wg(e)){Ni(e(n),t,r,n);return}t.validators===null&&(t.validators=[]),t.validators.push(ug(r,e))},yg=(e,t,r,n)=>{const a=Object.entries(e),s=a.length;for(let i=0;i<s;i++){const[l,c]=a[i];Ni(c,uu(t,l),r,n)}},uu=(e,t)=>{let r=e;const n=t.split(Va),a=n.length;for(let s=0;s<a;s++){const i=n[s];let l=r.nextPart.get(i);l||(l=cu(),r.nextPart.set(i,l)),r=l}return r},wg=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,jg=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null);const a=(s,i)=>{r[s]=i,t++,t>e&&(t=0,n=r,r=Object.create(null))};return{get(s){let i=r[s];if(i!==void 0)return i;if((i=n[s])!==void 0)return a(s,i),i},set(s,i){s in r?r[s]=i:a(s,i)}}},Hs="!",Yl=":",kg=[],Jl=(e,t,r,n,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:a}),Cg=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=a=>{const s=[];let i=0,l=0,c=0,d;const u=a.length;for(let h=0;h<u;h++){const x=a[h];if(i===0&&l===0){if(x===Yl){s.push(a.slice(c,h)),c=h+1;continue}if(x==="/"){d=h;continue}}x==="["?i++:x==="]"?i--:x==="("?l++:x===")"&&l--}const m=s.length===0?a:a.slice(c);let p=m,f=!1;m.endsWith(Hs)?(p=m.slice(0,-1),f=!0):m.startsWith(Hs)&&(p=m.slice(1),f=!0);const b=d&&d>c?d-c:void 0;return Jl(s,f,p,b)};if(t){const a=t+Yl,s=n;n=i=>i.startsWith(a)?s(i.slice(a.length)):Jl(kg,!1,i,void 0,!0)}if(r){const a=n;n=s=>r({className:s,parseClassName:a})}return n},Ng=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,n)=>{t.set(r,1e6+n)}),r=>{const n=[];let a=[];for(let s=0;s<r.length;s++){const i=r[s],l=i[0]==="[",c=t.has(i);l||c?(a.length>0&&(a.sort(),n.push(...a),a=[]),n.push(i)):a.push(i)}return a.length>0&&(a.sort(),n.push(...a)),n}},Sg=e=>({cache:jg(e.cacheSize),parseClassName:Cg(e),sortModifiers:Ng(e),...pg(e)}),$g=/\s+/,Eg=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:s}=t,i=[],l=e.trim().split($g);let c="";for(let d=l.length-1;d>=0;d-=1){const u=l[d],{isExternal:m,modifiers:p,hasImportantModifier:f,baseClassName:b,maybePostfixModifierPosition:h}=r(u);if(m){c=u+(c.length>0?" "+c:c);continue}let x=!!h,y=n(x?b.substring(0,h):b);if(!y){if(!x){c=u+(c.length>0?" "+c:c);continue}if(y=n(b),!y){c=u+(c.length>0?" "+c:c);continue}x=!1}const v=p.length===0?"":p.length===1?p[0]:s(p).join(":"),j=f?v+Hs:v,w=j+y;if(i.indexOf(w)>-1)continue;i.push(w);const C=a(y,x);for(let S=0;S<C.length;++S){const $=C[S];i.push(j+$)}c=u+(c.length>0?" "+c:c)}return c},Dg=(...e)=>{let t=0,r,n,a="";for(;t<e.length;)(r=e[t++])&&(n=mu(r))&&(a&&(a+=" "),a+=n);return a},mu=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=mu(e[n]))&&(r&&(r+=" "),r+=t);return r},Tg=(e,...t)=>{let r,n,a,s;const i=c=>{const d=t.reduce((u,m)=>m(u),e());return r=Sg(d),n=r.cache.get,a=r.cache.set,s=l,l(c)},l=c=>{const d=n(c);if(d)return d;const u=Eg(c,r);return a(c,u),u};return s=i,(...c)=>s(Dg(...c))},Ag=[],rt=e=>{const t=r=>r[e]||Ag;return t.isThemeGetter=!0,t},pu=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,fu=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Rg=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Ig=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Pg=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,_g=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Og=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Fg=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Sr=e=>Rg.test(e),Ne=e=>!!e&&!Number.isNaN(Number(e)),$r=e=>!!e&&Number.isInteger(Number(e)),ss=e=>e.endsWith("%")&&Ne(e.slice(0,-1)),hr=e=>Ig.test(e),hu=()=>!0,zg=e=>Pg.test(e)&&!_g.test(e),Si=()=>!1,Lg=e=>Og.test(e),Mg=e=>Fg.test(e),Vg=e=>!pe(e)&&!he(e),Bg=e=>Lr(e,vu,Si),pe=e=>pu.test(e),qr=e=>Lr(e,bu,zg),Ql=e=>Lr(e,Kg,Ne),Ug=e=>Lr(e,wu,hu),Hg=e=>Lr(e,yu,Si),ec=e=>Lr(e,xu,Si),Wg=e=>Lr(e,gu,Mg),ja=e=>Lr(e,ju,Lg),he=e=>fu.test(e),Hn=e=>an(e,bu),qg=e=>an(e,yu),tc=e=>an(e,xu),Gg=e=>an(e,vu),Xg=e=>an(e,gu),ka=e=>an(e,ju,!0),Zg=e=>an(e,wu,!0),Lr=(e,t,r)=>{const n=pu.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},an=(e,t,r=!1)=>{const n=fu.exec(e);return n?n[1]?t(n[1]):r:!1},xu=e=>e==="position"||e==="percentage",gu=e=>e==="image"||e==="url",vu=e=>e==="length"||e==="size"||e==="bg-size",bu=e=>e==="length",Kg=e=>e==="number",yu=e=>e==="family-name",wu=e=>e==="number"||e==="weight",ju=e=>e==="shadow",Yg=()=>{const e=rt("color"),t=rt("font"),r=rt("text"),n=rt("font-weight"),a=rt("tracking"),s=rt("leading"),i=rt("breakpoint"),l=rt("container"),c=rt("spacing"),d=rt("radius"),u=rt("shadow"),m=rt("inset-shadow"),p=rt("text-shadow"),f=rt("drop-shadow"),b=rt("blur"),h=rt("perspective"),x=rt("aspect"),y=rt("ease"),v=rt("animate"),j=()=>["auto","avoid","all","avoid-page","page","left","right","column"],w=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],C=()=>[...w(),he,pe],S=()=>["auto","hidden","clip","visible","scroll"],$=()=>["auto","contain","none"],k=()=>[he,pe,c],E=()=>[Sr,"full","auto",...k()],D=()=>[$r,"none","subgrid",he,pe],O=()=>["auto",{span:["full",$r,he,pe]},$r,he,pe],L=()=>[$r,"auto",he,pe],A=()=>["auto","min","max","fr",he,pe],z=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],X=()=>["start","end","center","stretch","center-safe","end-safe"],q=()=>["auto",...k()],Z=()=>[Sr,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...k()],V=()=>[Sr,"screen","full","dvw","lvw","svw","min","max","fit",...k()],M=()=>[Sr,"screen","full","lh","dvh","lvh","svh","min","max","fit",...k()],P=()=>[e,he,pe],se=()=>[...w(),tc,ec,{position:[he,pe]}],U=()=>["no-repeat",{repeat:["","x","y","space","round"]}],Q=()=>["auto","cover","contain",Gg,Bg,{size:[he,pe]}],Y=()=>[ss,Hn,qr],H=()=>["","none","full",d,he,pe],W=()=>["",Ne,Hn,qr],G=()=>["solid","dashed","dotted","double"],ne=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],J=()=>[Ne,ss,tc,ec],te=()=>["","none",b,he,pe],ce=()=>["none",Ne,he,pe],be=()=>["none",Ne,he,pe],Ce=()=>[Ne,he,pe],ve=()=>[Sr,"full",...k()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[hr],breakpoint:[hr],color:[hu],container:[hr],"drop-shadow":[hr],ease:["in","out","in-out"],font:[Vg],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[hr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[hr],shadow:[hr],spacing:["px",Ne],text:[hr],"text-shadow":[hr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Sr,pe,he,x]}],container:["container"],columns:[{columns:[Ne,pe,he,l]}],"break-after":[{"break-after":j()}],"break-before":[{"break-before":j()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:C()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:$()}],"overscroll-x":[{"overscroll-x":$()}],"overscroll-y":[{"overscroll-y":$()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:E()}],"inset-x":[{"inset-x":E()}],"inset-y":[{"inset-y":E()}],start:[{"inset-s":E(),start:E()}],end:[{"inset-e":E(),end:E()}],"inset-bs":[{"inset-bs":E()}],"inset-be":[{"inset-be":E()}],top:[{top:E()}],right:[{right:E()}],bottom:[{bottom:E()}],left:[{left:E()}],visibility:["visible","invisible","collapse"],z:[{z:[$r,"auto",he,pe]}],basis:[{basis:[Sr,"full","auto",l,...k()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ne,Sr,"auto","initial","none",pe]}],grow:[{grow:["",Ne,he,pe]}],shrink:[{shrink:["",Ne,he,pe]}],order:[{order:[$r,"first","last","none",he,pe]}],"grid-cols":[{"grid-cols":D()}],"col-start-end":[{col:O()}],"col-start":[{"col-start":L()}],"col-end":[{"col-end":L()}],"grid-rows":[{"grid-rows":D()}],"row-start-end":[{row:O()}],"row-start":[{"row-start":L()}],"row-end":[{"row-end":L()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":A()}],"auto-rows":[{"auto-rows":A()}],gap:[{gap:k()}],"gap-x":[{"gap-x":k()}],"gap-y":[{"gap-y":k()}],"justify-content":[{justify:[...z(),"normal"]}],"justify-items":[{"justify-items":[...X(),"normal"]}],"justify-self":[{"justify-self":["auto",...X()]}],"align-content":[{content:["normal",...z()]}],"align-items":[{items:[...X(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...X(),{baseline:["","last"]}]}],"place-content":[{"place-content":z()}],"place-items":[{"place-items":[...X(),"baseline"]}],"place-self":[{"place-self":["auto",...X()]}],p:[{p:k()}],px:[{px:k()}],py:[{py:k()}],ps:[{ps:k()}],pe:[{pe:k()}],pbs:[{pbs:k()}],pbe:[{pbe:k()}],pt:[{pt:k()}],pr:[{pr:k()}],pb:[{pb:k()}],pl:[{pl:k()}],m:[{m:q()}],mx:[{mx:q()}],my:[{my:q()}],ms:[{ms:q()}],me:[{me:q()}],mbs:[{mbs:q()}],mbe:[{mbe:q()}],mt:[{mt:q()}],mr:[{mr:q()}],mb:[{mb:q()}],ml:[{ml:q()}],"space-x":[{"space-x":k()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":k()}],"space-y-reverse":["space-y-reverse"],size:[{size:Z()}],"inline-size":[{inline:["auto",...V()]}],"min-inline-size":[{"min-inline":["auto",...V()]}],"max-inline-size":[{"max-inline":["none",...V()]}],"block-size":[{block:["auto",...M()]}],"min-block-size":[{"min-block":["auto",...M()]}],"max-block-size":[{"max-block":["none",...M()]}],w:[{w:[l,"screen",...Z()]}],"min-w":[{"min-w":[l,"screen","none",...Z()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[i]},...Z()]}],h:[{h:["screen","lh",...Z()]}],"min-h":[{"min-h":["screen","lh","none",...Z()]}],"max-h":[{"max-h":["screen","lh",...Z()]}],"font-size":[{text:["base",r,Hn,qr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,Zg,Ug]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",ss,pe]}],"font-family":[{font:[qg,Hg,t]}],"font-features":[{"font-features":[pe]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,he,pe]}],"line-clamp":[{"line-clamp":[Ne,"none",he,Ql]}],leading:[{leading:[s,...k()]}],"list-image":[{"list-image":["none",he,pe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",he,pe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:P()}],"text-color":[{text:P()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...G(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ne,"from-font","auto",he,qr]}],"text-decoration-color":[{decoration:P()}],"underline-offset":[{"underline-offset":[Ne,"auto",he,pe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:k()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",he,pe]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",he,pe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:se()}],"bg-repeat":[{bg:U()}],"bg-size":[{bg:Q()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},$r,he,pe],radial:["",he,pe],conic:[$r,he,pe]},Xg,Wg]}],"bg-color":[{bg:P()}],"gradient-from-pos":[{from:Y()}],"gradient-via-pos":[{via:Y()}],"gradient-to-pos":[{to:Y()}],"gradient-from":[{from:P()}],"gradient-via":[{via:P()}],"gradient-to":[{to:P()}],rounded:[{rounded:H()}],"rounded-s":[{"rounded-s":H()}],"rounded-e":[{"rounded-e":H()}],"rounded-t":[{"rounded-t":H()}],"rounded-r":[{"rounded-r":H()}],"rounded-b":[{"rounded-b":H()}],"rounded-l":[{"rounded-l":H()}],"rounded-ss":[{"rounded-ss":H()}],"rounded-se":[{"rounded-se":H()}],"rounded-ee":[{"rounded-ee":H()}],"rounded-es":[{"rounded-es":H()}],"rounded-tl":[{"rounded-tl":H()}],"rounded-tr":[{"rounded-tr":H()}],"rounded-br":[{"rounded-br":H()}],"rounded-bl":[{"rounded-bl":H()}],"border-w":[{border:W()}],"border-w-x":[{"border-x":W()}],"border-w-y":[{"border-y":W()}],"border-w-s":[{"border-s":W()}],"border-w-e":[{"border-e":W()}],"border-w-bs":[{"border-bs":W()}],"border-w-be":[{"border-be":W()}],"border-w-t":[{"border-t":W()}],"border-w-r":[{"border-r":W()}],"border-w-b":[{"border-b":W()}],"border-w-l":[{"border-l":W()}],"divide-x":[{"divide-x":W()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":W()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...G(),"hidden","none"]}],"divide-style":[{divide:[...G(),"hidden","none"]}],"border-color":[{border:P()}],"border-color-x":[{"border-x":P()}],"border-color-y":[{"border-y":P()}],"border-color-s":[{"border-s":P()}],"border-color-e":[{"border-e":P()}],"border-color-bs":[{"border-bs":P()}],"border-color-be":[{"border-be":P()}],"border-color-t":[{"border-t":P()}],"border-color-r":[{"border-r":P()}],"border-color-b":[{"border-b":P()}],"border-color-l":[{"border-l":P()}],"divide-color":[{divide:P()}],"outline-style":[{outline:[...G(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ne,he,pe]}],"outline-w":[{outline:["",Ne,Hn,qr]}],"outline-color":[{outline:P()}],shadow:[{shadow:["","none",u,ka,ja]}],"shadow-color":[{shadow:P()}],"inset-shadow":[{"inset-shadow":["none",m,ka,ja]}],"inset-shadow-color":[{"inset-shadow":P()}],"ring-w":[{ring:W()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:P()}],"ring-offset-w":[{"ring-offset":[Ne,qr]}],"ring-offset-color":[{"ring-offset":P()}],"inset-ring-w":[{"inset-ring":W()}],"inset-ring-color":[{"inset-ring":P()}],"text-shadow":[{"text-shadow":["none",p,ka,ja]}],"text-shadow-color":[{"text-shadow":P()}],opacity:[{opacity:[Ne,he,pe]}],"mix-blend":[{"mix-blend":[...ne(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ne()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ne]}],"mask-image-linear-from-pos":[{"mask-linear-from":J()}],"mask-image-linear-to-pos":[{"mask-linear-to":J()}],"mask-image-linear-from-color":[{"mask-linear-from":P()}],"mask-image-linear-to-color":[{"mask-linear-to":P()}],"mask-image-t-from-pos":[{"mask-t-from":J()}],"mask-image-t-to-pos":[{"mask-t-to":J()}],"mask-image-t-from-color":[{"mask-t-from":P()}],"mask-image-t-to-color":[{"mask-t-to":P()}],"mask-image-r-from-pos":[{"mask-r-from":J()}],"mask-image-r-to-pos":[{"mask-r-to":J()}],"mask-image-r-from-color":[{"mask-r-from":P()}],"mask-image-r-to-color":[{"mask-r-to":P()}],"mask-image-b-from-pos":[{"mask-b-from":J()}],"mask-image-b-to-pos":[{"mask-b-to":J()}],"mask-image-b-from-color":[{"mask-b-from":P()}],"mask-image-b-to-color":[{"mask-b-to":P()}],"mask-image-l-from-pos":[{"mask-l-from":J()}],"mask-image-l-to-pos":[{"mask-l-to":J()}],"mask-image-l-from-color":[{"mask-l-from":P()}],"mask-image-l-to-color":[{"mask-l-to":P()}],"mask-image-x-from-pos":[{"mask-x-from":J()}],"mask-image-x-to-pos":[{"mask-x-to":J()}],"mask-image-x-from-color":[{"mask-x-from":P()}],"mask-image-x-to-color":[{"mask-x-to":P()}],"mask-image-y-from-pos":[{"mask-y-from":J()}],"mask-image-y-to-pos":[{"mask-y-to":J()}],"mask-image-y-from-color":[{"mask-y-from":P()}],"mask-image-y-to-color":[{"mask-y-to":P()}],"mask-image-radial":[{"mask-radial":[he,pe]}],"mask-image-radial-from-pos":[{"mask-radial-from":J()}],"mask-image-radial-to-pos":[{"mask-radial-to":J()}],"mask-image-radial-from-color":[{"mask-radial-from":P()}],"mask-image-radial-to-color":[{"mask-radial-to":P()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":w()}],"mask-image-conic-pos":[{"mask-conic":[Ne]}],"mask-image-conic-from-pos":[{"mask-conic-from":J()}],"mask-image-conic-to-pos":[{"mask-conic-to":J()}],"mask-image-conic-from-color":[{"mask-conic-from":P()}],"mask-image-conic-to-color":[{"mask-conic-to":P()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:se()}],"mask-repeat":[{mask:U()}],"mask-size":[{mask:Q()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",he,pe]}],filter:[{filter:["","none",he,pe]}],blur:[{blur:te()}],brightness:[{brightness:[Ne,he,pe]}],contrast:[{contrast:[Ne,he,pe]}],"drop-shadow":[{"drop-shadow":["","none",f,ka,ja]}],"drop-shadow-color":[{"drop-shadow":P()}],grayscale:[{grayscale:["",Ne,he,pe]}],"hue-rotate":[{"hue-rotate":[Ne,he,pe]}],invert:[{invert:["",Ne,he,pe]}],saturate:[{saturate:[Ne,he,pe]}],sepia:[{sepia:["",Ne,he,pe]}],"backdrop-filter":[{"backdrop-filter":["","none",he,pe]}],"backdrop-blur":[{"backdrop-blur":te()}],"backdrop-brightness":[{"backdrop-brightness":[Ne,he,pe]}],"backdrop-contrast":[{"backdrop-contrast":[Ne,he,pe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ne,he,pe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ne,he,pe]}],"backdrop-invert":[{"backdrop-invert":["",Ne,he,pe]}],"backdrop-opacity":[{"backdrop-opacity":[Ne,he,pe]}],"backdrop-saturate":[{"backdrop-saturate":[Ne,he,pe]}],"backdrop-sepia":[{"backdrop-sepia":["",Ne,he,pe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":k()}],"border-spacing-x":[{"border-spacing-x":k()}],"border-spacing-y":[{"border-spacing-y":k()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",he,pe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ne,"initial",he,pe]}],ease:[{ease:["linear","initial",y,he,pe]}],delay:[{delay:[Ne,he,pe]}],animate:[{animate:["none",v,he,pe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[h,he,pe]}],"perspective-origin":[{"perspective-origin":C()}],rotate:[{rotate:ce()}],"rotate-x":[{"rotate-x":ce()}],"rotate-y":[{"rotate-y":ce()}],"rotate-z":[{"rotate-z":ce()}],scale:[{scale:be()}],"scale-x":[{"scale-x":be()}],"scale-y":[{"scale-y":be()}],"scale-z":[{"scale-z":be()}],"scale-3d":["scale-3d"],skew:[{skew:Ce()}],"skew-x":[{"skew-x":Ce()}],"skew-y":[{"skew-y":Ce()}],transform:[{transform:[he,pe,"","none","gpu","cpu"]}],"transform-origin":[{origin:C()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ve()}],"translate-x":[{"translate-x":ve()}],"translate-y":[{"translate-y":ve()}],"translate-z":[{"translate-z":ve()}],"translate-none":["translate-none"],accent:[{accent:P()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:P()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",he,pe]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":k()}],"scroll-mx":[{"scroll-mx":k()}],"scroll-my":[{"scroll-my":k()}],"scroll-ms":[{"scroll-ms":k()}],"scroll-me":[{"scroll-me":k()}],"scroll-mbs":[{"scroll-mbs":k()}],"scroll-mbe":[{"scroll-mbe":k()}],"scroll-mt":[{"scroll-mt":k()}],"scroll-mr":[{"scroll-mr":k()}],"scroll-mb":[{"scroll-mb":k()}],"scroll-ml":[{"scroll-ml":k()}],"scroll-p":[{"scroll-p":k()}],"scroll-px":[{"scroll-px":k()}],"scroll-py":[{"scroll-py":k()}],"scroll-ps":[{"scroll-ps":k()}],"scroll-pe":[{"scroll-pe":k()}],"scroll-pbs":[{"scroll-pbs":k()}],"scroll-pbe":[{"scroll-pbe":k()}],"scroll-pt":[{"scroll-pt":k()}],"scroll-pr":[{"scroll-pr":k()}],"scroll-pb":[{"scroll-pb":k()}],"scroll-pl":[{"scroll-pl":k()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",he,pe]}],fill:[{fill:["none",...P()]}],"stroke-w":[{stroke:[Ne,Hn,qr,Ql]}],stroke:[{stroke:["none",...P()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},Jg=Tg(Yg);function K(...e){return Jg(lu(e))}function Qg(e){if(!e)return null;if(e.includes("-")){const t=e.split("-").map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("");return _.icons[t]??null}return _.icons[e]??null}function rc(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function $i(...e){return t=>{let r=!1;const n=e.map(a=>{const s=rc(a,t);return!r&&typeof s=="function"&&(r=!0),s});if(r)return()=>{for(let a=0;a<n.length;a++){const s=n[a];typeof s=="function"?s():rc(e[a],null)}}}}function ke(...e){return g.useCallback($i(...e),e)}var ev=Symbol.for("react.lazy"),Ba=g[" use ".trim().toString()];function tv(e){return typeof e=="object"&&e!==null&&"then"in e}function ku(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===ev&&"_payload"in e&&tv(e._payload)}function Cu(e){const t=nv(e),r=g.forwardRef((n,a)=>{let{children:s,...i}=n;ku(s)&&typeof Ba=="function"&&(s=Ba(s._payload));const l=g.Children.toArray(s),c=l.find(ov);if(c){const d=c.props.children,u=l.map(m=>m===c?g.Children.count(d)>1?g.Children.only(null):g.isValidElement(d)?d.props.children:null:m);return o.jsx(t,{...i,ref:a,children:g.isValidElement(d)?g.cloneElement(d,void 0,u):null})}return o.jsx(t,{...i,ref:a,children:s})});return r.displayName=`${e}.Slot`,r}var rv=Cu("Slot");function nv(e){const t=g.forwardRef((r,n)=>{let{children:a,...s}=r;if(ku(a)&&typeof Ba=="function"&&(a=Ba(a._payload)),g.isValidElement(a)){const i=iv(a),l=sv(s,a.props);return a.type!==g.Fragment&&(l.ref=n?$i(n,i):i),g.cloneElement(a,l)}return g.Children.count(a)>1?g.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var av=Symbol("radix.slottable");function ov(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===av}function sv(e,t){const r={...t};for(const n in t){const a=e[n],s=t[n];/^on[A-Z]/.test(n)?a&&s?r[n]=(...i)=>{const l=s(...i);return a(...i),l}:a&&(r[n]=a):n==="style"?r[n]={...a,...s}:n==="className"&&(r[n]=[a,s].filter(Boolean).join(" "))}return{...e,...r}}function iv(e){var t,r;let n=(t=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:t.get,a=n&&"isReactWarning"in n&&n.isReactWarning;return a?e.ref:(n=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,a=n&&"isReactWarning"in n&&n.isReactWarning,a?e.props.ref:e.props.ref||e.ref)}const nc=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,ac=lu,Ei=(e,t)=>r=>{var n;if((t==null?void 0:t.variants)==null)return ac(e,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:a,defaultVariants:s}=t,i=Object.keys(a).map(d=>{const u=r==null?void 0:r[d],m=s==null?void 0:s[d];if(u===null)return null;const p=nc(u)||nc(m);return a[d][p]}),l=r&&Object.entries(r).reduce((d,u)=>{let[m,p]=u;return p===void 0||(d[m]=p),d},{}),c=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((d,u)=>{let{class:m,className:p,...f}=u;return Object.entries(f).every(b=>{let[h,x]=b;return Array.isArray(x)?x.includes({...s,...l}[h]):{...s,...l}[h]===x})?[...d,m,p]:d},[]);return ac(e,i,c,r==null?void 0:r.class,r==null?void 0:r.className)},lv=Ei("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),De=g.forwardRef(({className:e,variant:t,size:r,asChild:n=!1,...a},s)=>o.jsx(n?rv:"button",{className:K(lv({variant:t,size:r,className:e})),ref:s,...a}));De.displayName="Button";const ue=g.forwardRef(({className:e,type:t,...r},n)=>o.jsx("input",{type:t,className:K("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:n,...r}));ue.displayName="Input";const po=g.forwardRef(({className:e,...t},r)=>o.jsx("textarea",{className:K("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...t}));po.displayName="Textarea";var cv=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],fo=cv.reduce((e,t)=>{const r=Cu(`Primitive.${t}`),n=g.forwardRef((a,s)=>{const{asChild:i,...l}=a,c=i?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:s})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),dv="Label",Nu=g.forwardRef((e,t)=>o.jsx(fo.label,{...e,ref:t,onMouseDown:r=>{var n;r.target.closest("button, input, select, textarea")||((n=e.onMouseDown)==null||n.call(e,r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));Nu.displayName=dv;var Su=Nu;const uv=Ei("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),ie=g.forwardRef(({className:e,...t},r)=>o.jsx(Su,{ref:r,className:K(uv(),e),...t}));ie.displayName=Su.displayName;const mv=Ei("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground",success:"border-transparent bg-green-500 text-white shadow"}},defaultVariants:{variant:"default"}});function Di({className:e,variant:t,...r}){return o.jsx("div",{className:K(mv({variant:t}),e),...r})}var pv="Separator",oc="horizontal",fv=["horizontal","vertical"],$u=g.forwardRef((e,t)=>{const{decorative:r,orientation:n=oc,...a}=e,s=hv(n)?n:oc,i=r?{role:"none"}:{"aria-orientation":s==="vertical"?s:void 0,role:"separator"};return o.jsx(fo.div,{"data-orientation":s,...i,...a,ref:t})});$u.displayName=pv;function hv(e){return fv.includes(e)}var Eu=$u;const it=g.forwardRef(({className:e,orientation:t="horizontal",decorative:r=!0,...n},a)=>o.jsx(Eu,{ref:a,decorative:r,orientation:t,className:K("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...n}));it.displayName=Eu.displayName;function xv(e,t){const r=g.createContext(t),n=s=>{const{children:i,...l}=s,c=g.useMemo(()=>l,Object.values(l));return o.jsx(r.Provider,{value:c,children:i})};n.displayName=e+"Provider";function a(s){const i=g.useContext(r);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[n,a]}function _t(e,t=[]){let r=[];function n(s,i){const l=g.createContext(i),c=r.length;r=[...r,i];const d=m=>{var p;const{scope:f,children:b,...h}=m,x=((p=f==null?void 0:f[e])==null?void 0:p[c])||l,y=g.useMemo(()=>h,Object.values(h));return o.jsx(x.Provider,{value:y,children:b})};d.displayName=s+"Provider";function u(m,p){var f;const b=((f=p==null?void 0:p[e])==null?void 0:f[c])||l,h=g.useContext(b);if(h)return h;if(i!==void 0)return i;throw new Error(`\`${m}\` must be used within \`${s}\``)}return[d,u]}const a=()=>{const s=r.map(i=>g.createContext(i));return function(i){const l=(i==null?void 0:i[e])||s;return g.useMemo(()=>({[`__scope${e}`]:{...i,[e]:l}}),[i,l])}};return a.scopeName=e,[n,gv(a,...t)]}function gv(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(a){const s=n.reduce((i,{useScope:l,scopeName:c})=>{const d=l(a)[`__scope${c}`];return{...i,...d}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return r.scopeName=t.scopeName,r}function ge(e,t,{checkForDefaultPrevented:r=!0}={}){return function(n){if(e==null||e(n),r===!1||!n.defaultPrevented)return t==null?void 0:t(n)}}var lt=globalThis!=null&&globalThis.document?g.useLayoutEffect:()=>{},vv=g[" useInsertionEffect ".trim().toString()]||lt;function dr({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){const[a,s,i]=bv({defaultProp:t,onChange:r}),l=e!==void 0,c=l?e:a;{const u=g.useRef(e!==void 0);g.useEffect(()=>{const m=u.current;m!==l&&console.warn(`${n} is changing from ${m?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=l},[l,n])}const d=g.useCallback(u=>{var m;if(l){const p=yv(u)?u(e):u;p!==e&&((m=i.current)==null||m.call(i,p))}else s(u)},[l,e,s,i]);return[c,d]}function bv({defaultProp:e,onChange:t}){const[r,n]=g.useState(e),a=g.useRef(r),s=g.useRef(t);return vv(()=>{s.current=t},[t]),g.useEffect(()=>{var i;a.current!==r&&((i=s.current)==null||i.call(s,r),a.current=r)},[r,a]),[r,n,s]}function yv(e){return typeof e=="function"}function ia(e){const t=g.useRef({value:e,previous:e});return g.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function la(e){const[t,r]=g.useState(void 0);return lt(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const n=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const s=a[0];let i,l;if("borderBoxSize"in s){const c=s.borderBoxSize,d=Array.isArray(c)?c[0]:c;i=d.inlineSize,l=d.blockSize}else i=e.offsetWidth,l=e.offsetHeight;r({width:i,height:l})});return n.observe(e,{box:"border-box"}),()=>n.unobserve(e)}else r(void 0)},[e]),t}function wv(e,t){return g.useReducer((r,n)=>t[r][n]??r,e)}var Ot=e=>{const{present:t,children:r}=e,n=jv(t),a=typeof r=="function"?r({present:n.isPresent}):g.Children.only(r),s=ke(n.ref,kv(a));return typeof r=="function"||n.isPresent?g.cloneElement(a,{ref:s}):null};Ot.displayName="Presence";function jv(e){const[t,r]=g.useState(),n=g.useRef(null),a=g.useRef(e),s=g.useRef("none"),i=e?"mounted":"unmounted",[l,c]=wv(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return g.useEffect(()=>{const d=Ca(n.current);s.current=l==="mounted"?d:"none"},[l]),lt(()=>{const d=n.current,u=a.current;if(u!==e){const m=s.current,p=Ca(d);e?c("MOUNT"):p==="none"||(d==null?void 0:d.display)==="none"?c("UNMOUNT"):c(u&&m!==p?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,c]),lt(()=>{if(t){let d;const u=t.ownerDocument.defaultView??window,m=f=>{const b=Ca(n.current).includes(CSS.escape(f.animationName));if(f.target===t&&b&&(c("ANIMATION_END"),!a.current)){const h=t.style.animationFillMode;t.style.animationFillMode="forwards",d=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=h)})}},p=f=>{f.target===t&&(s.current=Ca(n.current))};return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",m),t.addEventListener("animationend",m),()=>{u.clearTimeout(d),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",m),t.removeEventListener("animationend",m)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:g.useCallback(d=>{n.current=d?getComputedStyle(d):null,r(d)},[])}}function Ca(e){return(e==null?void 0:e.animationName)||"none"}function kv(e){var t,r;let n=(t=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:t.get,a=n&&"isReactWarning"in n&&n.isReactWarning;return a?e.ref:(n=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,a=n&&"isReactWarning"in n&&n.isReactWarning,a?e.props.ref:e.props.ref||e.ref)}function $n(e){const t=Cv(e),r=g.forwardRef((n,a)=>{const{children:s,...i}=n,l=g.Children.toArray(s),c=l.find(Sv);if(c){const d=c.props.children,u=l.map(m=>m===c?g.Children.count(d)>1?g.Children.only(null):g.isValidElement(d)?d.props.children:null:m);return o.jsx(t,{...i,ref:a,children:g.isValidElement(d)?g.cloneElement(d,void 0,u):null})}return o.jsx(t,{...i,ref:a,children:s})});return r.displayName=`${e}.Slot`,r}function Cv(e){const t=g.forwardRef((r,n)=>{const{children:a,...s}=r;if(g.isValidElement(a)){const i=Ev(a),l=$v(s,a.props);return a.type!==g.Fragment&&(l.ref=n?$i(n,i):i),g.cloneElement(a,l)}return g.Children.count(a)>1?g.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Du=Symbol("radix.slottable");function Nv(e){const t=({children:r})=>o.jsx(o.Fragment,{children:r});return t.displayName=`${e}.Slottable`,t.__radixId=Du,t}function Sv(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Du}function $v(e,t){const r={...t};for(const n in t){const a=e[n],s=t[n];/^on[A-Z]/.test(n)?a&&s?r[n]=(...i)=>{const l=s(...i);return a(...i),l}:a&&(r[n]=a):n==="style"?r[n]={...a,...s}:n==="className"&&(r[n]=[a,s].filter(Boolean).join(" "))}return{...e,...r}}function Ev(e){var t,r;let n=(t=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:t.get,a=n&&"isReactWarning"in n&&n.isReactWarning;return a?e.ref:(n=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,a=n&&"isReactWarning"in n&&n.isReactWarning,a?e.props.ref:e.props.ref||e.ref)}var Dv=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],we=Dv.reduce((e,t)=>{const r=$n(`Primitive.${t}`),n=g.forwardRef((a,s)=>{const{asChild:i,...l}=a,c=i?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:s})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function Tv(e,t){e&&co.flushSync(()=>e.dispatchEvent(t))}var ho="Checkbox",[Av]=_t(ho),[Rv,Ti]=Av(ho);function Iv(e){const{__scopeCheckbox:t,checked:r,children:n,defaultChecked:a,disabled:s,form:i,name:l,onCheckedChange:c,required:d,value:u="on",internal_do_not_use_render:m}=e,[p,f]=dr({prop:r,defaultProp:a??!1,onChange:c,caller:ho}),[b,h]=g.useState(null),[x,y]=g.useState(null),v=g.useRef(!1),j=b?!!i||!!b.closest("form"):!0,w={checked:p,disabled:s,setChecked:f,control:b,setControl:h,name:l,form:i,value:u,hasConsumerStoppedPropagationRef:v,required:d,defaultChecked:Pr(a)?!1:a,isFormControl:j,bubbleInput:x,setBubbleInput:y};return o.jsx(Rv,{scope:t,...w,children:Pv(m)?m(w):n})}var Tu="CheckboxTrigger",Au=g.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:r,...n},a)=>{const{control:s,value:i,disabled:l,checked:c,required:d,setControl:u,setChecked:m,hasConsumerStoppedPropagationRef:p,isFormControl:f,bubbleInput:b}=Ti(Tu,e),h=ke(a,u),x=g.useRef(c);return g.useEffect(()=>{const y=s==null?void 0:s.form;if(y){const v=()=>m(x.current);return y.addEventListener("reset",v),()=>y.removeEventListener("reset",v)}},[s,m]),o.jsx(we.button,{type:"button",role:"checkbox","aria-checked":Pr(c)?"mixed":c,"aria-required":d,"data-state":Ou(c),"data-disabled":l?"":void 0,disabled:l,value:i,...n,ref:h,onKeyDown:ge(t,y=>{y.key==="Enter"&&y.preventDefault()}),onClick:ge(r,y=>{m(v=>Pr(v)?!0:!v),b&&f&&(p.current=y.isPropagationStopped(),p.current||y.stopPropagation())})})});Au.displayName=Tu;var Ai=g.forwardRef((e,t)=>{const{__scopeCheckbox:r,name:n,checked:a,defaultChecked:s,required:i,disabled:l,value:c,onCheckedChange:d,form:u,...m}=e;return o.jsx(Iv,{__scopeCheckbox:r,checked:a,defaultChecked:s,disabled:l,required:i,onCheckedChange:d,name:n,form:u,value:c,internal_do_not_use_render:({isFormControl:p})=>o.jsxs(o.Fragment,{children:[o.jsx(Au,{...m,ref:t,__scopeCheckbox:r}),p&&o.jsx(_u,{__scopeCheckbox:r})]})})});Ai.displayName=ho;var Ru="CheckboxIndicator",Iu=g.forwardRef((e,t)=>{const{__scopeCheckbox:r,forceMount:n,...a}=e,s=Ti(Ru,r);return o.jsx(Ot,{present:n||Pr(s.checked)||s.checked===!0,children:o.jsx(we.span,{"data-state":Ou(s.checked),"data-disabled":s.disabled?"":void 0,...a,ref:t,style:{pointerEvents:"none",...e.style}})})});Iu.displayName=Ru;var Pu="CheckboxBubbleInput",_u=g.forwardRef(({__scopeCheckbox:e,...t},r)=>{const{control:n,hasConsumerStoppedPropagationRef:a,checked:s,defaultChecked:i,required:l,disabled:c,name:d,value:u,form:m,bubbleInput:p,setBubbleInput:f}=Ti(Pu,e),b=ke(r,f),h=ia(s),x=la(n);g.useEffect(()=>{const v=p;if(!v)return;const j=window.HTMLInputElement.prototype,w=Object.getOwnPropertyDescriptor(j,"checked").set,C=!a.current;if(h!==s&&w){const S=new Event("click",{bubbles:C});v.indeterminate=Pr(s),w.call(v,Pr(s)?!1:s),v.dispatchEvent(S)}},[p,h,s,a]);const y=g.useRef(Pr(s)?!1:s);return o.jsx(we.input,{type:"checkbox","aria-hidden":!0,defaultChecked:i??y.current,required:l,disabled:c,name:d,value:u,form:m,...t,tabIndex:-1,ref:b,style:{...t.style,...x,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});_u.displayName=Pu;function Pv(e){return typeof e=="function"}function Pr(e){return e==="indeterminate"}function Ou(e){return Pr(e)?"indeterminate":e?"checked":"unchecked"}const et=g.forwardRef(({className:e,...t},r)=>o.jsx(Ai,{ref:r,className:K("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:o.jsx(Iu,{className:K("flex items-center justify-center text-current"),children:o.jsx(_.Check,{className:"h-4 w-4"})})}));et.displayName=Ai.displayName;function Ri(e){const t=e+"CollectionProvider",[r,n]=_t(t),[a,s]=r(t,{collectionRef:{current:null},itemMap:new Map}),i=h=>{const{scope:x,children:y}=h,v=N.useRef(null),j=N.useRef(new Map).current;return o.jsx(a,{scope:x,itemMap:j,collectionRef:v,children:y})};i.displayName=t;const l=e+"CollectionSlot",c=$n(l),d=N.forwardRef((h,x)=>{const{scope:y,children:v}=h,j=s(l,y),w=ke(x,j.collectionRef);return o.jsx(c,{ref:w,children:v})});d.displayName=l;const u=e+"CollectionItemSlot",m="data-radix-collection-item",p=$n(u),f=N.forwardRef((h,x)=>{const{scope:y,children:v,...j}=h,w=N.useRef(null),C=ke(x,w),S=s(u,y);return N.useEffect(()=>(S.itemMap.set(w,{ref:w,...j}),()=>void S.itemMap.delete(w))),o.jsx(p,{[m]:"",ref:C,children:v})});f.displayName=u;function b(h){const x=s(e+"CollectionConsumer",h);return N.useCallback(()=>{const y=x.collectionRef.current;if(!y)return[];const v=Array.from(y.querySelectorAll(`[${m}]`));return Array.from(x.itemMap.values()).sort((j,w)=>v.indexOf(j.ref.current)-v.indexOf(w.ref.current))},[x.collectionRef,x.itemMap])}return[{Provider:i,Slot:d,ItemSlot:f},b,n]}var _v=g[" useId ".trim().toString()]||(()=>{}),Ov=0;function wr(e){const[t,r]=g.useState(_v());return lt(()=>{r(n=>n??String(Ov++))},[e]),t?`radix-${t}`:""}function ft(e){const t=g.useRef(e);return g.useEffect(()=>{t.current=e}),g.useMemo(()=>(...r)=>{var n;return(n=t.current)==null?void 0:n.call(t,...r)},[])}var Fv=g.createContext(void 0);function ca(e){const t=g.useContext(Fv);return e||t||"ltr"}var is="rovingFocusGroup.onEntryFocus",zv={bubbles:!1,cancelable:!0},da="RovingFocusGroup",[Ws,Fu,Lv]=Ri(da),[Mv,zu]=_t(da,[Lv]),[Vv,Bv]=Mv(da),Lu=g.forwardRef((e,t)=>o.jsx(Ws.Provider,{scope:e.__scopeRovingFocusGroup,children:o.jsx(Ws.Slot,{scope:e.__scopeRovingFocusGroup,children:o.jsx(Uv,{...e,ref:t})})}));Lu.displayName=da;var Uv=g.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,orientation:n,loop:a=!1,dir:s,currentTabStopId:i,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:d,preventScrollOnEntryFocus:u=!1,...m}=e,p=g.useRef(null),f=ke(t,p),b=ca(s),[h,x]=dr({prop:i,defaultProp:l??null,onChange:c,caller:da}),[y,v]=g.useState(!1),j=ft(d),w=Fu(r),C=g.useRef(!1),[S,$]=g.useState(0);return g.useEffect(()=>{const k=p.current;if(k)return k.addEventListener(is,j),()=>k.removeEventListener(is,j)},[j]),o.jsx(Vv,{scope:r,orientation:n,dir:b,loop:a,currentTabStopId:h,onItemFocus:g.useCallback(k=>x(k),[x]),onItemShiftTab:g.useCallback(()=>v(!0),[]),onFocusableItemAdd:g.useCallback(()=>$(k=>k+1),[]),onFocusableItemRemove:g.useCallback(()=>$(k=>k-1),[]),children:o.jsx(we.div,{tabIndex:y||S===0?-1:0,"data-orientation":n,...m,ref:f,style:{outline:"none",...e.style},onMouseDown:ge(e.onMouseDown,()=>{C.current=!0}),onFocus:ge(e.onFocus,k=>{const E=!C.current;if(k.target===k.currentTarget&&E&&!y){const D=new CustomEvent(is,zv);if(k.currentTarget.dispatchEvent(D),!D.defaultPrevented){const O=w().filter(X=>X.focusable),L=O.find(X=>X.active),A=O.find(X=>X.id===h),z=[L,A,...O].filter(Boolean).map(X=>X.ref.current);Bu(z,u)}}C.current=!1}),onBlur:ge(e.onBlur,()=>v(!1))})})}),Mu="RovingFocusGroupItem",Vu=g.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:n=!0,active:a=!1,tabStopId:s,children:i,...l}=e,c=wr(),d=s||c,u=Bv(Mu,r),m=u.currentTabStopId===d,p=Fu(r),{onFocusableItemAdd:f,onFocusableItemRemove:b,currentTabStopId:h}=u;return g.useEffect(()=>{if(n)return f(),()=>b()},[n,f,b]),o.jsx(Ws.ItemSlot,{scope:r,id:d,focusable:n,active:a,children:o.jsx(we.span,{tabIndex:m?0:-1,"data-orientation":u.orientation,...l,ref:t,onMouseDown:ge(e.onMouseDown,x=>{n?u.onItemFocus(d):x.preventDefault()}),onFocus:ge(e.onFocus,()=>u.onItemFocus(d)),onKeyDown:ge(e.onKeyDown,x=>{if(x.key==="Tab"&&x.shiftKey){u.onItemShiftTab();return}if(x.target!==x.currentTarget)return;const y=qv(x,u.orientation,u.dir);if(y!==void 0){if(x.metaKey||x.ctrlKey||x.altKey||x.shiftKey)return;x.preventDefault();let v=p().filter(j=>j.focusable).map(j=>j.ref.current);if(y==="last")v.reverse();else if(y==="prev"||y==="next"){y==="prev"&&v.reverse();const j=v.indexOf(x.currentTarget);v=u.loop?Gv(v,j+1):v.slice(j+1)}setTimeout(()=>Bu(v))}}),children:typeof i=="function"?i({isCurrentTabStop:m,hasTabStop:h!=null}):i})})});Vu.displayName=Mu;var Hv={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Wv(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function qv(e,t,r){const n=Wv(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return Hv[n]}function Bu(e,t=!1){const r=document.activeElement;for(const n of e)if(n===r||(n.focus({preventScroll:t}),document.activeElement!==r))return}function Gv(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var Xv=Lu,Zv=Vu,Ii="Radio",[Kv,Uu]=_t(Ii),[Yv,Jv]=Kv(Ii),Hu=g.forwardRef((e,t)=>{const{__scopeRadio:r,name:n,checked:a=!1,required:s,disabled:i,value:l="on",onCheck:c,form:d,...u}=e,[m,p]=g.useState(null),f=ke(t,x=>p(x)),b=g.useRef(!1),h=m?d||!!m.closest("form"):!0;return o.jsxs(Yv,{scope:r,checked:a,disabled:i,children:[o.jsx(we.button,{type:"button",role:"radio","aria-checked":a,"data-state":Xu(a),"data-disabled":i?"":void 0,disabled:i,value:l,...u,ref:f,onClick:ge(e.onClick,x=>{a||c==null||c(),h&&(b.current=x.isPropagationStopped(),b.current||x.stopPropagation())})}),h&&o.jsx(Gu,{control:m,bubbles:!b.current,name:n,value:l,checked:a,required:s,disabled:i,form:d,style:{transform:"translateX(-100%)"}})]})});Hu.displayName=Ii;var Wu="RadioIndicator",qu=g.forwardRef((e,t)=>{const{__scopeRadio:r,forceMount:n,...a}=e,s=Jv(Wu,r);return o.jsx(Ot,{present:n||s.checked,children:o.jsx(we.span,{"data-state":Xu(s.checked),"data-disabled":s.disabled?"":void 0,...a,ref:t})})});qu.displayName=Wu;var Qv="RadioBubbleInput",Gu=g.forwardRef(({__scopeRadio:e,control:t,checked:r,bubbles:n=!0,...a},s)=>{const i=g.useRef(null),l=ke(i,s),c=ia(r),d=la(t);return g.useEffect(()=>{const u=i.current;if(!u)return;const m=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(m,"checked").set;if(c!==r&&p){const f=new Event("click",{bubbles:n});p.call(u,r),u.dispatchEvent(f)}},[c,r,n]),o.jsx(we.input,{type:"radio","aria-hidden":!0,defaultChecked:r,...a,tabIndex:-1,ref:l,style:{...a.style,...d,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});Gu.displayName=Qv;function Xu(e){return e?"checked":"unchecked"}var eb=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],xo="RadioGroup",[tb]=_t(xo,[zu,Uu]),Zu=zu(),Ku=Uu(),[rb,nb]=tb(xo),Yu=g.forwardRef((e,t)=>{const{__scopeRadioGroup:r,name:n,defaultValue:a,value:s,required:i=!1,disabled:l=!1,orientation:c,dir:d,loop:u=!0,onValueChange:m,...p}=e,f=Zu(r),b=ca(d),[h,x]=dr({prop:s,defaultProp:a??null,onChange:m,caller:xo});return o.jsx(rb,{scope:r,name:n,required:i,disabled:l,value:h,onValueChange:x,children:o.jsx(Xv,{asChild:!0,...f,orientation:c,dir:b,loop:u,children:o.jsx(we.div,{role:"radiogroup","aria-required":i,"aria-orientation":c,"data-disabled":l?"":void 0,dir:b,...p,ref:t})})})});Yu.displayName=xo;var Ju="RadioGroupItem",Qu=g.forwardRef((e,t)=>{const{__scopeRadioGroup:r,disabled:n,...a}=e,s=nb(Ju,r),i=s.disabled||n,l=Zu(r),c=Ku(r),d=g.useRef(null),u=ke(t,d),m=s.value===a.value,p=g.useRef(!1);return g.useEffect(()=>{const f=h=>{eb.includes(h.key)&&(p.current=!0)},b=()=>p.current=!1;return document.addEventListener("keydown",f),document.addEventListener("keyup",b),()=>{document.removeEventListener("keydown",f),document.removeEventListener("keyup",b)}},[]),o.jsx(Zv,{asChild:!0,...l,focusable:!i,active:m,children:o.jsx(Hu,{disabled:i,required:s.required,checked:m,...c,...a,name:s.name,ref:u,onCheck:()=>s.onValueChange(a.value),onKeyDown:ge(f=>{f.key==="Enter"&&f.preventDefault()}),onFocus:ge(a.onFocus,()=>{var f;p.current&&((f=d.current)==null||f.click())})})})});Qu.displayName=Ju;var ab="RadioGroupIndicator",em=g.forwardRef((e,t)=>{const{__scopeRadioGroup:r,...n}=e,a=Ku(r);return o.jsx(qu,{...a,...n,ref:t})});em.displayName=ab;var tm=Yu,rm=Qu,ob=em;const Pi=g.forwardRef(({className:e,...t},r)=>o.jsx(tm,{className:K("grid gap-2",e),...t,ref:r}));Pi.displayName=tm.displayName;const _i=g.forwardRef(({className:e,...t},r)=>o.jsx(rm,{ref:r,className:K("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:o.jsx(ob,{className:"flex items-center justify-center",children:o.jsx(_.Circle,{className:"h-2.5 w-2.5 fill-current text-current"})})}));_i.displayName=rm.displayName;var go="Switch",[sb]=_t(go),[ib,lb]=sb(go),nm=g.forwardRef((e,t)=>{const{__scopeSwitch:r,name:n,checked:a,defaultChecked:s,required:i,disabled:l,value:c="on",onCheckedChange:d,form:u,...m}=e,[p,f]=g.useState(null),b=ke(t,j=>f(j)),h=g.useRef(!1),x=p?u||!!p.closest("form"):!0,[y,v]=dr({prop:a,defaultProp:s??!1,onChange:d,caller:go});return o.jsxs(ib,{scope:r,checked:y,disabled:l,children:[o.jsx(we.button,{type:"button",role:"switch","aria-checked":y,"aria-required":i,"data-state":im(y),"data-disabled":l?"":void 0,disabled:l,value:c,...m,ref:b,onClick:ge(e.onClick,j=>{v(w=>!w),x&&(h.current=j.isPropagationStopped(),h.current||j.stopPropagation())})}),x&&o.jsx(sm,{control:p,bubbles:!h.current,name:n,value:c,checked:y,required:i,disabled:l,form:u,style:{transform:"translateX(-100%)"}})]})});nm.displayName=go;var am="SwitchThumb",om=g.forwardRef((e,t)=>{const{__scopeSwitch:r,...n}=e,a=lb(am,r);return o.jsx(we.span,{"data-state":im(a.checked),"data-disabled":a.disabled?"":void 0,...n,ref:t})});om.displayName=am;var cb="SwitchBubbleInput",sm=g.forwardRef(({__scopeSwitch:e,control:t,checked:r,bubbles:n=!0,...a},s)=>{const i=g.useRef(null),l=ke(i,s),c=ia(r),d=la(t);return g.useEffect(()=>{const u=i.current;if(!u)return;const m=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(m,"checked").set;if(c!==r&&p){const f=new Event("click",{bubbles:n});p.call(u,r),u.dispatchEvent(f)}},[c,r,n]),o.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...a,tabIndex:-1,ref:l,style:{...a.style,...d,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});sm.displayName=cb;function im(e){return e?"checked":"unchecked"}var lm=nm,db=om;const Oi=g.forwardRef(({className:e,...t},r)=>o.jsx(lm,{ref:r,className:K("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,children:o.jsx(db,{className:K("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));Oi.displayName=lm.displayName;function ta(e,[t,r]){return Math.min(r,Math.max(t,e))}function ub(e,t=globalThis==null?void 0:globalThis.document){const r=ft(e);g.useEffect(()=>{const n=a=>{a.key==="Escape"&&r(a)};return t.addEventListener("keydown",n,{capture:!0}),()=>t.removeEventListener("keydown",n,{capture:!0})},[r,t])}var mb="DismissableLayer",qs="dismissableLayer.update",pb="dismissableLayer.pointerDownOutside",fb="dismissableLayer.focusOutside",sc,cm=g.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),ua=g.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:a,onFocusOutside:s,onInteractOutside:i,onDismiss:l,...c}=e,d=g.useContext(cm),[u,m]=g.useState(null),p=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,f]=g.useState({}),b=ke(t,$=>m($)),h=Array.from(d.layers),[x]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),y=h.indexOf(x),v=u?h.indexOf(u):-1,j=d.layersWithOutsidePointerEventsDisabled.size>0,w=v>=y,C=gb($=>{const k=$.target,E=[...d.branches].some(D=>D.contains(k));!w||E||(a==null||a($),i==null||i($),$.defaultPrevented||l==null||l())},p),S=vb($=>{const k=$.target;[...d.branches].some(E=>E.contains(k))||(s==null||s($),i==null||i($),$.defaultPrevented||l==null||l())},p);return ub($=>{v===d.layers.size-1&&(n==null||n($),!$.defaultPrevented&&l&&($.preventDefault(),l()))},p),g.useEffect(()=>{if(u)return r&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(sc=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(u)),d.layers.add(u),ic(),()=>{r&&d.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=sc)}},[u,p,r,d]),g.useEffect(()=>()=>{u&&(d.layers.delete(u),d.layersWithOutsidePointerEventsDisabled.delete(u),ic())},[u,d]),g.useEffect(()=>{const $=()=>f({});return document.addEventListener(qs,$),()=>document.removeEventListener(qs,$)},[]),o.jsx(we.div,{...c,ref:b,style:{pointerEvents:j?w?"auto":"none":void 0,...e.style},onFocusCapture:ge(e.onFocusCapture,S.onFocusCapture),onBlurCapture:ge(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:ge(e.onPointerDownCapture,C.onPointerDownCapture)})});ua.displayName=mb;var hb="DismissableLayerBranch",xb=g.forwardRef((e,t)=>{const r=g.useContext(cm),n=g.useRef(null),a=ke(t,n);return g.useEffect(()=>{const s=n.current;if(s)return r.branches.add(s),()=>{r.branches.delete(s)}},[r.branches]),o.jsx(we.div,{...e,ref:a})});xb.displayName=hb;function gb(e,t=globalThis==null?void 0:globalThis.document){const r=ft(e),n=g.useRef(!1),a=g.useRef(()=>{});return g.useEffect(()=>{const s=l=>{if(l.target&&!n.current){let c=function(){dm(pb,r,d,{discrete:!0})};const d={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",a.current),a.current=c,t.addEventListener("click",a.current,{once:!0})):c()}else t.removeEventListener("click",a.current);n.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",s),t.removeEventListener("click",a.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function vb(e,t=globalThis==null?void 0:globalThis.document){const r=ft(e),n=g.useRef(!1);return g.useEffect(()=>{const a=s=>{s.target&&!n.current&&dm(fb,r,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function ic(){const e=new CustomEvent(qs);document.dispatchEvent(e)}function dm(e,t,r,{discrete:n}){const a=r.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&a.addEventListener(e,t,{once:!0}),n?Tv(a,s):a.dispatchEvent(s)}var ls=0;function Fi(){g.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??lc()),document.body.insertAdjacentElement("beforeend",e[1]??lc()),ls++,()=>{ls===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),ls--}},[])}function lc(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var cs="focusScope.autoFocusOnMount",ds="focusScope.autoFocusOnUnmount",cc={bubbles:!1,cancelable:!0},bb="FocusScope",vo=g.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:a,onUnmountAutoFocus:s,...i}=e,[l,c]=g.useState(null),d=ft(a),u=ft(s),m=g.useRef(null),p=ke(t,h=>c(h)),f=g.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;g.useEffect(()=>{if(n){let h=function(j){if(f.paused||!l)return;const w=j.target;l.contains(w)?m.current=w:Ar(m.current,{select:!0})},x=function(j){if(f.paused||!l)return;const w=j.relatedTarget;w!==null&&(l.contains(w)||Ar(m.current,{select:!0}))},y=function(j){if(document.activeElement===document.body)for(const w of j)w.removedNodes.length>0&&Ar(l)};document.addEventListener("focusin",h),document.addEventListener("focusout",x);const v=new MutationObserver(y);return l&&v.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",h),document.removeEventListener("focusout",x),v.disconnect()}}},[n,l,f.paused]),g.useEffect(()=>{if(l){uc.add(f);const h=document.activeElement;if(!l.contains(h)){const x=new CustomEvent(cs,cc);l.addEventListener(cs,d),l.dispatchEvent(x),x.defaultPrevented||(yb(Nb(um(l)),{select:!0}),document.activeElement===h&&Ar(l))}return()=>{l.removeEventListener(cs,d),setTimeout(()=>{const x=new CustomEvent(ds,cc);l.addEventListener(ds,u),l.dispatchEvent(x),x.defaultPrevented||Ar(h??document.body,{select:!0}),l.removeEventListener(ds,u),uc.remove(f)},0)}}},[l,d,u,f]);const b=g.useCallback(h=>{if(!r&&!n||f.paused)return;const x=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,y=document.activeElement;if(x&&y){const v=h.currentTarget,[j,w]=wb(v);j&&w?!h.shiftKey&&y===w?(h.preventDefault(),r&&Ar(j,{select:!0})):h.shiftKey&&y===j&&(h.preventDefault(),r&&Ar(w,{select:!0})):y===v&&h.preventDefault()}},[r,n,f.paused]);return o.jsx(we.div,{tabIndex:-1,...i,ref:p,onKeyDown:b})});vo.displayName=bb;function yb(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(Ar(n,{select:t}),document.activeElement!==r)return}function wb(e){const t=um(e),r=dc(t,e),n=dc(t.reverse(),e);return[r,n]}function um(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const a=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||a?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function dc(e,t){for(const r of e)if(!jb(r,{upTo:t}))return r}function jb(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function kb(e){return e instanceof HTMLInputElement&&"select"in e}function Ar(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&kb(e)&&t&&e.select()}}var uc=Cb();function Cb(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=mc(e,t),e.unshift(t)},remove(t){var r;e=mc(e,t),(r=e[0])==null||r.resume()}}}function mc(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function Nb(e){return e.filter(t=>t.tagName!=="A")}const Sb=["top","right","bottom","left"],Fr=Math.min,Et=Math.max,Ua=Math.round,Na=Math.floor,cr=e=>({x:e,y:e}),$b={left:"right",right:"left",bottom:"top",top:"bottom"};function Gs(e,t,r){return Et(e,Fr(t,r))}function jr(e,t){return typeof e=="function"?e(t):e}function kr(e){return e.split("-")[0]}function _n(e){return e.split("-")[1]}function zi(e){return e==="x"?"y":"x"}function Li(e){return e==="y"?"height":"width"}function lr(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Mi(e){return zi(lr(e))}function Eb(e,t,r){r===void 0&&(r=!1);const n=_n(e),a=Mi(e),s=Li(a);let i=a==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Ha(i)),[i,Ha(i)]}function Db(e){const t=Ha(e);return[Xs(e),t,Xs(t)]}function Xs(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const pc=["left","right"],fc=["right","left"],Tb=["top","bottom"],Ab=["bottom","top"];function Rb(e,t,r){switch(e){case"top":case"bottom":return r?t?fc:pc:t?pc:fc;case"left":case"right":return t?Tb:Ab;default:return[]}}function Ib(e,t,r,n){const a=_n(e);let s=Rb(kr(e),r==="start",n);return a&&(s=s.map(i=>i+"-"+a),t&&(s=s.concat(s.map(Xs)))),s}function Ha(e){const t=kr(e);return $b[t]+e.slice(t.length)}function Pb(e){return{top:0,right:0,bottom:0,left:0,...e}}function mm(e){return typeof e!="number"?Pb(e):{top:e,right:e,bottom:e,left:e}}function Wa(e){const{x:t,y:r,width:n,height:a}=e;return{width:n,height:a,top:r,left:t,right:t+n,bottom:r+a,x:t,y:r}}function hc(e,t,r){let{reference:n,floating:a}=e;const s=lr(t),i=Mi(t),l=Li(i),c=kr(t),d=s==="y",u=n.x+n.width/2-a.width/2,m=n.y+n.height/2-a.height/2,p=n[l]/2-a[l]/2;let f;switch(c){case"top":f={x:u,y:n.y-a.height};break;case"bottom":f={x:u,y:n.y+n.height};break;case"right":f={x:n.x+n.width,y:m};break;case"left":f={x:n.x-a.width,y:m};break;default:f={x:n.x,y:n.y}}switch(_n(t)){case"start":f[i]-=p*(r&&d?-1:1);break;case"end":f[i]+=p*(r&&d?-1:1);break}return f}async function _b(e,t){var r;t===void 0&&(t={});const{x:n,y:a,platform:s,rects:i,elements:l,strategy:c}=e,{boundary:d="clippingAncestors",rootBoundary:u="viewport",elementContext:m="floating",altBoundary:p=!1,padding:f=0}=jr(t,e),b=mm(f),h=l[p?m==="floating"?"reference":"floating":m],x=Wa(await s.getClippingRect({element:(r=await(s.isElement==null?void 0:s.isElement(h)))==null||r?h:h.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:d,rootBoundary:u,strategy:c})),y=m==="floating"?{x:n,y:a,width:i.floating.width,height:i.floating.height}:i.reference,v=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),j=await(s.isElement==null?void 0:s.isElement(v))?await(s.getScale==null?void 0:s.getScale(v))||{x:1,y:1}:{x:1,y:1},w=Wa(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:y,offsetParent:v,strategy:c}):y);return{top:(x.top-w.top+b.top)/j.y,bottom:(w.bottom-x.bottom+b.bottom)/j.y,left:(x.left-w.left+b.left)/j.x,right:(w.right-x.right+b.right)/j.x}}const Ob=50,Fb=async(e,t,r)=>{const{placement:n="bottom",strategy:a="absolute",middleware:s=[],platform:i}=r,l=i.detectOverflow?i:{...i,detectOverflow:_b},c=await(i.isRTL==null?void 0:i.isRTL(t));let d=await i.getElementRects({reference:e,floating:t,strategy:a}),{x:u,y:m}=hc(d,n,c),p=n,f=0;const b={};for(let h=0;h<s.length;h++){const x=s[h];if(!x)continue;const{name:y,fn:v}=x,{x:j,y:w,data:C,reset:S}=await v({x:u,y:m,initialPlacement:n,placement:p,strategy:a,middlewareData:b,rects:d,platform:l,elements:{reference:e,floating:t}});u=j??u,m=w??m,b[y]={...b[y],...C},S&&f<Ob&&(f++,typeof S=="object"&&(S.placement&&(p=S.placement),S.rects&&(d=S.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:a}):S.rects),{x:u,y:m}=hc(d,p,c)),h=-1)}return{x:u,y:m,placement:p,strategy:a,middlewareData:b}},zb=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:n,placement:a,rects:s,platform:i,elements:l,middlewareData:c}=t,{element:d,padding:u=0}=jr(e,t)||{};if(d==null)return{};const m=mm(u),p={x:r,y:n},f=Mi(a),b=Li(f),h=await i.getDimensions(d),x=f==="y",y=x?"top":"left",v=x?"bottom":"right",j=x?"clientHeight":"clientWidth",w=s.reference[b]+s.reference[f]-p[f]-s.floating[b],C=p[f]-s.reference[f],S=await(i.getOffsetParent==null?void 0:i.getOffsetParent(d));let $=S?S[j]:0;(!$||!await(i.isElement==null?void 0:i.isElement(S)))&&($=l.floating[j]||s.floating[b]);const k=w/2-C/2,E=$/2-h[b]/2-1,D=Fr(m[y],E),O=Fr(m[v],E),L=D,A=$-h[b]-O,z=$/2-h[b]/2+k,X=Gs(L,z,A),q=!c.arrow&&_n(a)!=null&&z!==X&&s.reference[b]/2-(z<L?D:O)-h[b]/2<0,Z=q?z<L?z-L:z-A:0;return{[f]:p[f]+Z,data:{[f]:X,centerOffset:z-X-Z,...q&&{alignmentOffset:Z}},reset:q}}}),Lb=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,n;const{placement:a,middlewareData:s,rects:i,initialPlacement:l,platform:c,elements:d}=t,{mainAxis:u=!0,crossAxis:m=!0,fallbackPlacements:p,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:h=!0,...x}=jr(e,t);if((r=s.arrow)!=null&&r.alignmentOffset)return{};const y=kr(a),v=lr(l),j=kr(l)===l,w=await(c.isRTL==null?void 0:c.isRTL(d.floating)),C=p||(j||!h?[Ha(l)]:Db(l)),S=b!=="none";!p&&S&&C.push(...Ib(l,h,b,w));const $=[l,...C],k=await c.detectOverflow(t,x),E=[];let D=((n=s.flip)==null?void 0:n.overflows)||[];if(u&&E.push(k[y]),m){const z=Eb(a,i,w);E.push(k[z[0]],k[z[1]])}if(D=[...D,{placement:a,overflows:E}],!E.every(z=>z<=0)){var O,L;const z=(((O=s.flip)==null?void 0:O.index)||0)+1,X=$[z];if(X&&(!(m==="alignment"&&v!==lr(X))||D.every(Z=>lr(Z.placement)===v?Z.overflows[0]>0:!0)))return{data:{index:z,overflows:D},reset:{placement:X}};let q=(L=D.filter(Z=>Z.overflows[0]<=0).sort((Z,V)=>Z.overflows[1]-V.overflows[1])[0])==null?void 0:L.placement;if(!q)switch(f){case"bestFit":{var A;const Z=(A=D.filter(V=>{if(S){const M=lr(V.placement);return M===v||M==="y"}return!0}).map(V=>[V.placement,V.overflows.filter(M=>M>0).reduce((M,P)=>M+P,0)]).sort((V,M)=>V[1]-M[1])[0])==null?void 0:A[0];Z&&(q=Z);break}case"initialPlacement":q=l;break}if(a!==q)return{reset:{placement:q}}}return{}}}};function xc(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function gc(e){return Sb.some(t=>e[t]>=0)}const Mb=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r,platform:n}=t,{strategy:a="referenceHidden",...s}=jr(e,t);switch(a){case"referenceHidden":{const i=await n.detectOverflow(t,{...s,elementContext:"reference"}),l=xc(i,r.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:gc(l)}}}case"escaped":{const i=await n.detectOverflow(t,{...s,altBoundary:!0}),l=xc(i,r.floating);return{data:{escapedOffsets:l,escaped:gc(l)}}}default:return{}}}}},pm=new Set(["left","top"]);async function Vb(e,t){const{placement:r,platform:n,elements:a}=e,s=await(n.isRTL==null?void 0:n.isRTL(a.floating)),i=kr(r),l=_n(r),c=lr(r)==="y",d=pm.has(i)?-1:1,u=s&&c?-1:1,m=jr(t,e);let{mainAxis:p,crossAxis:f,alignmentAxis:b}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return l&&typeof b=="number"&&(f=l==="end"?b*-1:b),c?{x:f*u,y:p*d}:{x:p*d,y:f*u}}const Bb=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,n;const{x:a,y:s,placement:i,middlewareData:l}=t,c=await Vb(t,e);return i===((r=l.offset)==null?void 0:r.placement)&&(n=l.arrow)!=null&&n.alignmentOffset?{}:{x:a+c.x,y:s+c.y,data:{...c,placement:i}}}}},Ub=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:n,placement:a,platform:s}=t,{mainAxis:i=!0,crossAxis:l=!1,limiter:c={fn:y=>{let{x:v,y:j}=y;return{x:v,y:j}}},...d}=jr(e,t),u={x:r,y:n},m=await s.detectOverflow(t,d),p=lr(kr(a)),f=zi(p);let b=u[f],h=u[p];if(i){const y=f==="y"?"top":"left",v=f==="y"?"bottom":"right",j=b+m[y],w=b-m[v];b=Gs(j,b,w)}if(l){const y=p==="y"?"top":"left",v=p==="y"?"bottom":"right",j=h+m[y],w=h-m[v];h=Gs(j,h,w)}const x=c.fn({...t,[f]:b,[p]:h});return{...x,data:{x:x.x-r,y:x.y-n,enabled:{[f]:i,[p]:l}}}}}},Hb=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:n,placement:a,rects:s,middlewareData:i}=t,{offset:l=0,mainAxis:c=!0,crossAxis:d=!0}=jr(e,t),u={x:r,y:n},m=lr(a),p=zi(m);let f=u[p],b=u[m];const h=jr(l,t),x=typeof h=="number"?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){const j=p==="y"?"height":"width",w=s.reference[p]-s.floating[j]+x.mainAxis,C=s.reference[p]+s.reference[j]-x.mainAxis;f<w?f=w:f>C&&(f=C)}if(d){var y,v;const j=p==="y"?"width":"height",w=pm.has(kr(a)),C=s.reference[m]-s.floating[j]+(w&&((y=i.offset)==null?void 0:y[m])||0)+(w?0:x.crossAxis),S=s.reference[m]+s.reference[j]+(w?0:((v=i.offset)==null?void 0:v[m])||0)-(w?x.crossAxis:0);b<C?b=C:b>S&&(b=S)}return{[p]:f,[m]:b}}}},Wb=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,n;const{placement:a,rects:s,platform:i,elements:l}=t,{apply:c=()=>{},...d}=jr(e,t),u=await i.detectOverflow(t,d),m=kr(a),p=_n(a),f=lr(a)==="y",{width:b,height:h}=s.floating;let x,y;m==="top"||m==="bottom"?(x=m,y=p===(await(i.isRTL==null?void 0:i.isRTL(l.floating))?"start":"end")?"left":"right"):(y=m,x=p==="end"?"top":"bottom");const v=h-u.top-u.bottom,j=b-u.left-u.right,w=Fr(h-u[x],v),C=Fr(b-u[y],j),S=!t.middlewareData.shift;let $=w,k=C;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(k=j),(n=t.middlewareData.shift)!=null&&n.enabled.y&&($=v),S&&!p){const D=Et(u.left,0),O=Et(u.right,0),L=Et(u.top,0),A=Et(u.bottom,0);f?k=b-2*(D!==0||O!==0?D+O:Et(u.left,u.right)):$=h-2*(L!==0||A!==0?L+A:Et(u.top,u.bottom))}await c({...t,availableWidth:k,availableHeight:$});const E=await i.getDimensions(l.floating);return b!==E.width||h!==E.height?{reset:{rects:!0}}:{}}}};function bo(){return typeof window<"u"}function On(e){return fm(e)?(e.nodeName||"").toLowerCase():"#document"}function At(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function pr(e){var t;return(t=(fm(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function fm(e){return bo()?e instanceof Node||e instanceof At(e).Node:!1}function Jt(e){return bo()?e instanceof Element||e instanceof At(e).Element:!1}function Cr(e){return bo()?e instanceof HTMLElement||e instanceof At(e).HTMLElement:!1}function vc(e){return!bo()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof At(e).ShadowRoot}function ma(e){const{overflow:t,overflowX:r,overflowY:n,display:a}=Qt(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&a!=="inline"&&a!=="contents"}function qb(e){return/^(table|td|th)$/.test(On(e))}function yo(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Gb=/transform|translate|scale|rotate|perspective|filter/,Xb=/paint|layout|strict|content/,Gr=e=>!!e&&e!=="none";let us;function Vi(e){const t=Jt(e)?Qt(e):e;return Gr(t.transform)||Gr(t.translate)||Gr(t.scale)||Gr(t.rotate)||Gr(t.perspective)||!Bi()&&(Gr(t.backdropFilter)||Gr(t.filter))||Gb.test(t.willChange||"")||Xb.test(t.contain||"")}function Zb(e){let t=zr(e);for(;Cr(t)&&!En(t);){if(Vi(t))return t;if(yo(t))return null;t=zr(t)}return null}function Bi(){return us==null&&(us=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),us}function En(e){return/^(html|body|#document)$/.test(On(e))}function Qt(e){return At(e).getComputedStyle(e)}function wo(e){return Jt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function zr(e){if(On(e)==="html")return e;const t=e.assignedSlot||e.parentNode||vc(e)&&e.host||pr(e);return vc(t)?t.host:t}function hm(e){const t=zr(e);return En(t)?e.ownerDocument?e.ownerDocument.body:e.body:Cr(t)&&ma(t)?t:hm(t)}function ra(e,t,r){var n;t===void 0&&(t=[]),r===void 0&&(r=!0);const a=hm(e),s=a===((n=e.ownerDocument)==null?void 0:n.body),i=At(a);if(s){const l=Zs(i);return t.concat(i,i.visualViewport||[],ma(a)?a:[],l&&r?ra(l):[])}else return t.concat(a,ra(a,[],r))}function Zs(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function xm(e){const t=Qt(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const a=Cr(e),s=a?e.offsetWidth:r,i=a?e.offsetHeight:n,l=Ua(r)!==s||Ua(n)!==i;return l&&(r=s,n=i),{width:r,height:n,$:l}}function Ui(e){return Jt(e)?e:e.contextElement}function Cn(e){const t=Ui(e);if(!Cr(t))return cr(1);const r=t.getBoundingClientRect(),{width:n,height:a,$:s}=xm(t);let i=(s?Ua(r.width):r.width)/n,l=(s?Ua(r.height):r.height)/a;return(!i||!Number.isFinite(i))&&(i=1),(!l||!Number.isFinite(l))&&(l=1),{x:i,y:l}}const Kb=cr(0);function gm(e){const t=At(e);return!Bi()||!t.visualViewport?Kb:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Yb(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==At(e)?!1:t}function en(e,t,r,n){t===void 0&&(t=!1),r===void 0&&(r=!1);const a=e.getBoundingClientRect(),s=Ui(e);let i=cr(1);t&&(n?Jt(n)&&(i=Cn(n)):i=Cn(e));const l=Yb(s,r,n)?gm(s):cr(0);let c=(a.left+l.x)/i.x,d=(a.top+l.y)/i.y,u=a.width/i.x,m=a.height/i.y;if(s){const p=At(s),f=n&&Jt(n)?At(n):n;let b=p,h=Zs(b);for(;h&&n&&f!==b;){const x=Cn(h),y=h.getBoundingClientRect(),v=Qt(h),j=y.left+(h.clientLeft+parseFloat(v.paddingLeft))*x.x,w=y.top+(h.clientTop+parseFloat(v.paddingTop))*x.y;c*=x.x,d*=x.y,u*=x.x,m*=x.y,c+=j,d+=w,b=At(h),h=Zs(b)}}return Wa({width:u,height:m,x:c,y:d})}function jo(e,t){const r=wo(e).scrollLeft;return t?t.left+r:en(pr(e)).left+r}function vm(e,t){const r=e.getBoundingClientRect(),n=r.left+t.scrollLeft-jo(e,r),a=r.top+t.scrollTop;return{x:n,y:a}}function Jb(e){let{elements:t,rect:r,offsetParent:n,strategy:a}=e;const s=a==="fixed",i=pr(n),l=t?yo(t.floating):!1;if(n===i||l&&s)return r;let c={scrollLeft:0,scrollTop:0},d=cr(1);const u=cr(0),m=Cr(n);if((m||!m&&!s)&&((On(n)!=="body"||ma(i))&&(c=wo(n)),m)){const f=en(n);d=Cn(n),u.x=f.x+n.clientLeft,u.y=f.y+n.clientTop}const p=i&&!m&&!s?vm(i,c):cr(0);return{width:r.width*d.x,height:r.height*d.y,x:r.x*d.x-c.scrollLeft*d.x+u.x+p.x,y:r.y*d.y-c.scrollTop*d.y+u.y+p.y}}function Qb(e){return Array.from(e.getClientRects())}function ey(e){const t=pr(e),r=wo(e),n=e.ownerDocument.body,a=Et(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),s=Et(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let i=-r.scrollLeft+jo(e);const l=-r.scrollTop;return Qt(n).direction==="rtl"&&(i+=Et(t.clientWidth,n.clientWidth)-a),{width:a,height:s,x:i,y:l}}const bc=25;function ty(e,t){const r=At(e),n=pr(e),a=r.visualViewport;let s=n.clientWidth,i=n.clientHeight,l=0,c=0;if(a){s=a.width,i=a.height;const u=Bi();(!u||u&&t==="fixed")&&(l=a.offsetLeft,c=a.offsetTop)}const d=jo(n);if(d<=0){const u=n.ownerDocument,m=u.body,p=getComputedStyle(m),f=u.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,b=Math.abs(n.clientWidth-m.clientWidth-f);b<=bc&&(s-=b)}else d<=bc&&(s+=d);return{width:s,height:i,x:l,y:c}}function ry(e,t){const r=en(e,!0,t==="fixed"),n=r.top+e.clientTop,a=r.left+e.clientLeft,s=Cr(e)?Cn(e):cr(1),i=e.clientWidth*s.x,l=e.clientHeight*s.y,c=a*s.x,d=n*s.y;return{width:i,height:l,x:c,y:d}}function yc(e,t,r){let n;if(t==="viewport")n=ty(e,r);else if(t==="document")n=ey(pr(e));else if(Jt(t))n=ry(t,r);else{const a=gm(e);n={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return Wa(n)}function bm(e,t){const r=zr(e);return r===t||!Jt(r)||En(r)?!1:Qt(r).position==="fixed"||bm(r,t)}function ny(e,t){const r=t.get(e);if(r)return r;let n=ra(e,[],!1).filter(l=>Jt(l)&&On(l)!=="body"),a=null;const s=Qt(e).position==="fixed";let i=s?zr(e):e;for(;Jt(i)&&!En(i);){const l=Qt(i),c=Vi(i);!c&&l.position==="fixed"&&(a=null),(s?!c&&!a:!c&&l.position==="static"&&a&&(a.position==="absolute"||a.position==="fixed")||ma(i)&&!c&&bm(e,i))?n=n.filter(d=>d!==i):a=l,i=zr(i)}return t.set(e,n),n}function ay(e){let{element:t,boundary:r,rootBoundary:n,strategy:a}=e;const s=[...r==="clippingAncestors"?yo(t)?[]:ny(t,this._c):[].concat(r),n],i=yc(t,s[0],a);let l=i.top,c=i.right,d=i.bottom,u=i.left;for(let m=1;m<s.length;m++){const p=yc(t,s[m],a);l=Et(p.top,l),c=Fr(p.right,c),d=Fr(p.bottom,d),u=Et(p.left,u)}return{width:c-u,height:d-l,x:u,y:l}}function oy(e){const{width:t,height:r}=xm(e);return{width:t,height:r}}function sy(e,t,r){const n=Cr(t),a=pr(t),s=r==="fixed",i=en(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const c=cr(0);function d(){c.x=jo(a)}if(n||!n&&!s)if((On(t)!=="body"||ma(a))&&(l=wo(t)),n){const f=en(t,!0,s,t);c.x=f.x+t.clientLeft,c.y=f.y+t.clientTop}else a&&d();s&&!n&&a&&d();const u=a&&!n&&!s?vm(a,l):cr(0),m=i.left+l.scrollLeft-c.x-u.x,p=i.top+l.scrollTop-c.y-u.y;return{x:m,y:p,width:i.width,height:i.height}}function ms(e){return Qt(e).position==="static"}function wc(e,t){if(!Cr(e)||Qt(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return pr(e)===r&&(r=r.ownerDocument.body),r}function ym(e,t){const r=At(e);if(yo(e))return r;if(!Cr(e)){let a=zr(e);for(;a&&!En(a);){if(Jt(a)&&!ms(a))return a;a=zr(a)}return r}let n=wc(e,t);for(;n&&qb(n)&&ms(n);)n=wc(n,t);return n&&En(n)&&ms(n)&&!Vi(n)?r:n||Zb(e)||r}const iy=async function(e){const t=this.getOffsetParent||ym,r=this.getDimensions,n=await r(e.floating);return{reference:sy(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function ly(e){return Qt(e).direction==="rtl"}const cy={convertOffsetParentRelativeRectToViewportRelativeRect:Jb,getDocumentElement:pr,getClippingRect:ay,getOffsetParent:ym,getElementRects:iy,getClientRects:Qb,getDimensions:oy,getScale:Cn,isElement:Jt,isRTL:ly};function wm(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function dy(e,t){let r=null,n;const a=pr(e);function s(){var l;clearTimeout(n),(l=r)==null||l.disconnect(),r=null}function i(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),s();const d=e.getBoundingClientRect(),{left:u,top:m,width:p,height:f}=d;if(l||t(),!p||!f)return;const b=Na(m),h=Na(a.clientWidth-(u+p)),x=Na(a.clientHeight-(m+f)),y=Na(u),v={rootMargin:-b+"px "+-h+"px "+-x+"px "+-y+"px",threshold:Et(0,Fr(1,c))||1};let j=!0;function w(C){const S=C[0].intersectionRatio;if(S!==c){if(!j)return i();S?i(!1,S):n=setTimeout(()=>{i(!1,1e-7)},1e3)}S===1&&!wm(d,e.getBoundingClientRect())&&i(),j=!1}try{r=new IntersectionObserver(w,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(w,v)}r.observe(e)}return i(!0),s}function uy(e,t,r,n){n===void 0&&(n={});const{ancestorScroll:a=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=n,d=Ui(e),u=a||s?[...d?ra(d):[],...t?ra(t):[]]:[];u.forEach(y=>{a&&y.addEventListener("scroll",r,{passive:!0}),s&&y.addEventListener("resize",r)});const m=d&&l?dy(d,r):null;let p=-1,f=null;i&&(f=new ResizeObserver(y=>{let[v]=y;v&&v.target===d&&f&&t&&(f.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var j;(j=f)==null||j.observe(t)})),r()}),d&&!c&&f.observe(d),t&&f.observe(t));let b,h=c?en(e):null;c&&x();function x(){const y=en(e);h&&!wm(h,y)&&r(),h=y,b=requestAnimationFrame(x)}return r(),()=>{var y;u.forEach(v=>{a&&v.removeEventListener("scroll",r),s&&v.removeEventListener("resize",r)}),m==null||m(),(y=f)==null||y.disconnect(),f=null,c&&cancelAnimationFrame(b)}}const my=Bb,py=Ub,fy=Lb,hy=Wb,xy=Mb,jc=zb,gy=Hb,vy=(e,t,r)=>{const n=new Map,a={platform:cy,...r},s={...a.platform,_c:n};return Fb(e,t,{...a,platform:s})};var by=typeof document<"u",yy=function(){},za=by?N.useLayoutEffect:yy;function qa(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let r,n,a;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(n=r;n--!==0;)if(!qa(e[n],t[n]))return!1;return!0}if(a=Object.keys(e),r=a.length,r!==Object.keys(t).length)return!1;for(n=r;n--!==0;)if(!{}.hasOwnProperty.call(t,a[n]))return!1;for(n=r;n--!==0;){const s=a[n];if(!(s==="_owner"&&e.$$typeof)&&!qa(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function jm(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function kc(e,t){const r=jm(e);return Math.round(t*r)/r}function ps(e){const t=g.useRef(e);return za(()=>{t.current=e}),t}function wy(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:a,elements:{reference:s,floating:i}={},transform:l=!0,whileElementsMounted:c,open:d}=e,[u,m]=g.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[p,f]=g.useState(n);qa(p,n)||f(n);const[b,h]=g.useState(null),[x,y]=g.useState(null),v=g.useCallback(V=>{V!==S.current&&(S.current=V,h(V))},[]),j=g.useCallback(V=>{V!==$.current&&($.current=V,y(V))},[]),w=s||b,C=i||x,S=g.useRef(null),$=g.useRef(null),k=g.useRef(u),E=c!=null,D=ps(c),O=ps(a),L=ps(d),A=g.useCallback(()=>{if(!S.current||!$.current)return;const V={placement:t,strategy:r,middleware:p};O.current&&(V.platform=O.current),vy(S.current,$.current,V).then(M=>{const P={...M,isPositioned:L.current!==!1};z.current&&!qa(k.current,P)&&(k.current=P,co.flushSync(()=>{m(P)}))})},[p,t,r,O,L]);za(()=>{d===!1&&k.current.isPositioned&&(k.current.isPositioned=!1,m(V=>({...V,isPositioned:!1})))},[d]);const z=g.useRef(!1);za(()=>(z.current=!0,()=>{z.current=!1}),[]),za(()=>{if(w&&(S.current=w),C&&($.current=C),w&&C){if(D.current)return D.current(w,C,A);A()}},[w,C,A,D,E]);const X=g.useMemo(()=>({reference:S,floating:$,setReference:v,setFloating:j}),[v,j]),q=g.useMemo(()=>({reference:w,floating:C}),[w,C]),Z=g.useMemo(()=>{const V={position:r,left:0,top:0};if(!q.floating)return V;const M=kc(q.floating,u.x),P=kc(q.floating,u.y);return l?{...V,transform:"translate("+M+"px, "+P+"px)",...jm(q.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:M,top:P}},[r,l,q.floating,u.x,u.y]);return g.useMemo(()=>({...u,update:A,refs:X,elements:q,floatingStyles:Z}),[u,A,X,q,Z])}const jy=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:n,padding:a}=typeof e=="function"?e(r):e;return n&&t(n)?n.current!=null?jc({element:n.current,padding:a}).fn(r):{}:n?jc({element:n,padding:a}).fn(r):{}}}},ky=(e,t)=>{const r=my(e);return{name:r.name,fn:r.fn,options:[e,t]}},Cy=(e,t)=>{const r=py(e);return{name:r.name,fn:r.fn,options:[e,t]}},Ny=(e,t)=>({fn:gy(e).fn,options:[e,t]}),Sy=(e,t)=>{const r=fy(e);return{name:r.name,fn:r.fn,options:[e,t]}},$y=(e,t)=>{const r=hy(e);return{name:r.name,fn:r.fn,options:[e,t]}},Ey=(e,t)=>{const r=xy(e);return{name:r.name,fn:r.fn,options:[e,t]}},Dy=(e,t)=>{const r=jy(e);return{name:r.name,fn:r.fn,options:[e,t]}};var Ty="Arrow",km=g.forwardRef((e,t)=>{const{children:r,width:n=10,height:a=5,...s}=e;return o.jsx(we.svg,{...s,ref:t,width:n,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:o.jsx("polygon",{points:"0,0 30,0 15,10"})})});km.displayName=Ty;var Ay=km,Hi="Popper",[Cm,Fn]=_t(Hi),[Ry,Nm]=Cm(Hi),Sm=e=>{const{__scopePopper:t,children:r}=e,[n,a]=g.useState(null);return o.jsx(Ry,{scope:t,anchor:n,onAnchorChange:a,children:r})};Sm.displayName=Hi;var $m="PopperAnchor",Em=g.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:n,...a}=e,s=Nm($m,r),i=g.useRef(null),l=ke(t,i),c=g.useRef(null);return g.useEffect(()=>{const d=c.current;c.current=(n==null?void 0:n.current)||i.current,d!==c.current&&s.onAnchorChange(c.current)}),n?null:o.jsx(we.div,{...a,ref:l})});Em.displayName=$m;var Wi="PopperContent",[Iy,Py]=Cm(Wi),Dm=g.forwardRef((e,t)=>{var r,n,a,s,i,l;const{__scopePopper:c,side:d="bottom",sideOffset:u=0,align:m="center",alignOffset:p=0,arrowPadding:f=0,avoidCollisions:b=!0,collisionBoundary:h=[],collisionPadding:x=0,sticky:y="partial",hideWhenDetached:v=!1,updatePositionStrategy:j="optimized",onPlaced:w,...C}=e,S=Nm(Wi,c),[$,k]=g.useState(null),E=ke(t,Ce=>k(Ce)),[D,O]=g.useState(null),L=la(D),A=(L==null?void 0:L.width)??0,z=(L==null?void 0:L.height)??0,X=d+(m!=="center"?"-"+m:""),q=typeof x=="number"?x:{top:0,right:0,bottom:0,left:0,...x},Z=Array.isArray(h)?h:[h],V=Z.length>0,M={padding:q,boundary:Z.filter(Oy),altBoundary:V},{refs:P,floatingStyles:se,placement:U,isPositioned:Q,middlewareData:Y}=wy({strategy:"fixed",placement:X,whileElementsMounted:(...Ce)=>uy(...Ce,{animationFrame:j==="always"}),elements:{reference:S.anchor},middleware:[ky({mainAxis:u+z,alignmentAxis:p}),b&&Cy({mainAxis:!0,crossAxis:!1,limiter:y==="partial"?Ny():void 0,...M}),b&&Sy({...M}),$y({...M,apply:({elements:Ce,rects:ve,availableWidth:me,availableHeight:Ee})=>{const{width:Fe,height:Nt}=ve.reference,dt=Ce.floating.style;dt.setProperty("--radix-popper-available-width",`${me}px`),dt.setProperty("--radix-popper-available-height",`${Ee}px`),dt.setProperty("--radix-popper-anchor-width",`${Fe}px`),dt.setProperty("--radix-popper-anchor-height",`${Nt}px`)}}),D&&Dy({element:D,padding:f}),Fy({arrowWidth:A,arrowHeight:z}),v&&Ey({strategy:"referenceHidden",...M})]}),[H,W]=Rm(U),G=ft(w);lt(()=>{Q&&(G==null||G())},[Q,G]);const ne=(r=Y.arrow)==null?void 0:r.x,J=(n=Y.arrow)==null?void 0:n.y,te=((a=Y.arrow)==null?void 0:a.centerOffset)!==0,[ce,be]=g.useState();return lt(()=>{$&&be(window.getComputedStyle($).zIndex)},[$]),o.jsx("div",{ref:P.setFloating,"data-radix-popper-content-wrapper":"",style:{...se,transform:Q?se.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ce,"--radix-popper-transform-origin":[(s=Y.transformOrigin)==null?void 0:s.x,(i=Y.transformOrigin)==null?void 0:i.y].join(" "),...((l=Y.hide)==null?void 0:l.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:o.jsx(Iy,{scope:c,placedSide:H,onArrowChange:O,arrowX:ne,arrowY:J,shouldHideArrow:te,children:o.jsx(we.div,{"data-side":H,"data-align":W,...C,ref:E,style:{...C.style,animation:Q?void 0:"none"}})})})});Dm.displayName=Wi;var Tm="PopperArrow",_y={top:"bottom",right:"left",bottom:"top",left:"right"},Am=g.forwardRef(function(e,t){const{__scopePopper:r,...n}=e,a=Py(Tm,r),s=_y[a.placedSide];return o.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:o.jsx(Ay,{...n,ref:t,style:{...n.style,display:"block"}})})});Am.displayName=Tm;function Oy(e){return e!==null}var Fy=e=>({name:"transformOrigin",options:e,fn(t){var r,n,a;const{placement:s,rects:i,middlewareData:l}=t,c=((r=l.arrow)==null?void 0:r.centerOffset)!==0,d=c?0:e.arrowWidth,u=c?0:e.arrowHeight,[m,p]=Rm(s),f={start:"0%",center:"50%",end:"100%"}[p],b=(((n=l.arrow)==null?void 0:n.x)??0)+d/2,h=(((a=l.arrow)==null?void 0:a.y)??0)+u/2;let x="",y="";return m==="bottom"?(x=c?f:`${b}px`,y=`${-u}px`):m==="top"?(x=c?f:`${b}px`,y=`${i.floating.height+u}px`):m==="right"?(x=`${-u}px`,y=c?f:`${h}px`):m==="left"&&(x=`${i.floating.width+u}px`,y=c?f:`${h}px`),{data:{x,y}}}});function Rm(e){const[t,r="center"]=e.split("-");return[t,r]}var qi=Sm,ko=Em,Gi=Dm,Xi=Am,zy="Portal",Co=g.forwardRef((e,t)=>{var r;const{container:n,...a}=e,[s,i]=g.useState(!1);lt(()=>i(!0),[]);const l=n||s&&((r=globalThis==null?void 0:globalThis.document)==null?void 0:r.body);return l?yi.createPortal(o.jsx(we.div,{...a,ref:t}),l):null});Co.displayName=zy;var Im=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Ly="VisuallyHidden",Pm=g.forwardRef((e,t)=>o.jsx(we.span,{...e,ref:t,style:{...Im,...e.style}}));Pm.displayName=Ly;var My=Pm,Vy=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},dn=new WeakMap,Sa=new WeakMap,$a={},fs=0,_m=function(e){return e&&(e.host||_m(e.parentNode))},By=function(e,t){return t.map(function(r){if(e.contains(r))return r;var n=_m(r);return n&&e.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},Uy=function(e,t,r,n){var a=By(t,Array.isArray(e)?e:[e]);$a[r]||($a[r]=new WeakMap);var s=$a[r],i=[],l=new Set,c=new Set(a),d=function(m){!m||l.has(m)||(l.add(m),d(m.parentNode))};a.forEach(d);var u=function(m){!m||c.has(m)||Array.prototype.forEach.call(m.children,function(p){if(l.has(p))u(p);else try{var f=p.getAttribute(n),b=f!==null&&f!=="false",h=(dn.get(p)||0)+1,x=(s.get(p)||0)+1;dn.set(p,h),s.set(p,x),i.push(p),h===1&&b&&Sa.set(p,!0),x===1&&p.setAttribute(r,"true"),b||p.setAttribute(n,"true")}catch(y){console.error("aria-hidden: cannot operate on ",p,y)}})};return u(t),l.clear(),fs++,function(){i.forEach(function(m){var p=dn.get(m)-1,f=s.get(m)-1;dn.set(m,p),s.set(m,f),p||(Sa.has(m)||m.removeAttribute(n),Sa.delete(m)),f||m.removeAttribute(r)}),fs--,fs||(dn=new WeakMap,dn=new WeakMap,Sa=new WeakMap,$a={})}},Zi=function(e,t,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),a=Vy(e);return a?(n.push.apply(n,Array.from(a.querySelectorAll("[aria-live], script"))),Uy(n,a,r,"aria-hidden")):function(){return null}},ir=function(){return ir=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},ir.apply(this,arguments)};function Om(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]]);return r}function Hy(e,t,r){for(var n=0,a=t.length,s;n<a;n++)(s||!(n in t))&&(s||(s=Array.prototype.slice.call(t,0,n)),s[n]=t[n]);return e.concat(s||Array.prototype.slice.call(t))}var La="right-scroll-bar-position",Ma="width-before-scroll-bar",Wy="with-scroll-bars-hidden",qy="--removed-body-scroll-bar-size";function hs(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Gy(e,t){var r=N.useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(n){var a=r.value;a!==n&&(r.value=n,r.callback(n,a))}}}})[0];return r.callback=t,r.facade}var Xy=typeof window<"u"?g.useLayoutEffect:g.useEffect,Cc=new WeakMap;function Zy(e,t){var r=Gy(null,function(n){return e.forEach(function(a){return hs(a,n)})});return Xy(function(){var n=Cc.get(r);if(n){var a=new Set(n),s=new Set(e),i=r.current;a.forEach(function(l){s.has(l)||hs(l,null)}),s.forEach(function(l){a.has(l)||hs(l,i)})}Cc.set(r,e)},[e]),r}function Ky(e){return e}function Yy(e,t){t===void 0&&(t=Ky);var r=[],n=!1,a={read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(s){var i=t(s,n);return r.push(i),function(){r=r.filter(function(l){return l!==i})}},assignSyncMedium:function(s){for(n=!0;r.length;){var i=r;r=[],i.forEach(s)}r={push:function(l){return s(l)},filter:function(){return r}}},assignMedium:function(s){n=!0;var i=[];if(r.length){var l=r;r=[],l.forEach(s),i=r}var c=function(){var u=i;i=[],u.forEach(s)},d=function(){return Promise.resolve().then(c)};d(),r={push:function(u){i.push(u),d()},filter:function(u){return i=i.filter(u),r}}}};return a}function Jy(e){e===void 0&&(e={});var t=Yy(null);return t.options=ir({async:!0,ssr:!1},e),t}var Fm=function(e){var t=e.sideCar,r=Om(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=t.read();if(!n)throw new Error("Sidecar medium not found");return g.createElement(n,ir({},r))};Fm.isSideCarExport=!0;function Qy(e,t){return e.useMedium(t),Fm}var zm=Jy(),xs=function(){},No=g.forwardRef(function(e,t){var r=g.useRef(null),n=g.useState({onScrollCapture:xs,onWheelCapture:xs,onTouchMoveCapture:xs}),a=n[0],s=n[1],i=e.forwardProps,l=e.children,c=e.className,d=e.removeScrollBar,u=e.enabled,m=e.shards,p=e.sideCar,f=e.noRelative,b=e.noIsolation,h=e.inert,x=e.allowPinchZoom,y=e.as,v=y===void 0?"div":y,j=e.gapMode,w=Om(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=p,S=Zy([r,t]),$=ir(ir({},w),a);return g.createElement(g.Fragment,null,u&&g.createElement(C,{sideCar:zm,removeScrollBar:d,shards:m,noRelative:f,noIsolation:b,inert:h,setCallbacks:s,allowPinchZoom:!!x,lockRef:r,gapMode:j}),i?g.cloneElement(g.Children.only(l),ir(ir({},$),{ref:S})):g.createElement(v,ir({},$,{className:c,ref:S}),l))});No.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};No.classNames={fullWidth:Ma,zeroRight:La};var e0=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function t0(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=e0();return t&&e.setAttribute("nonce",t),e}function r0(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function n0(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var a0=function(){var e=0,t=null;return{add:function(r){e==0&&(t=t0())&&(r0(t,r),n0(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},o0=function(){var e=a0();return function(t,r){g.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},Lm=function(){var e=o0(),t=function(r){var n=r.styles,a=r.dynamic;return e(n,a),null};return t},s0={left:0,top:0,right:0,gap:0},gs=function(e){return parseInt(e||"",10)||0},i0=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],n=t[e==="padding"?"paddingTop":"marginTop"],a=t[e==="padding"?"paddingRight":"marginRight"];return[gs(r),gs(n),gs(a)]},l0=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return s0;var t=i0(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},c0=Lm(),Nn="data-scroll-locked",d0=function(e,t,r,n){var a=e.left,s=e.top,i=e.right,l=e.gap;return r===void 0&&(r="margin"),`
|
|
31
|
-
.`.concat(
|
|
30
|
+
<%s key={someKey} {...props} />`,Qo,Hr,Hx,Hr),ql[Hr+Qo]=!0}}return R===n?Lx(Ye):zx(Ye),Ye}}function Mx(R,ee,de){return Gl(R,ee,de,!0)}function Vx(R,ee,de){return Gl(R,ee,de,!1)}var Bx=Vx,Ux=Mx;xa.Fragment=n,xa.jsx=Bx,xa.jsxs=Ux}()),xa}process.env.NODE_ENV==="production"?zs.exports=mg():zs.exports=pg();var ts=zs.exports;const Ls=N.createContext(oo("moderno")),Kn=({config:e,children:t,renderWrapper:r=!0,className:n,style:a})=>{const s={"--t-primary":e.colors.primary,"--t-primary-hover":e.colors.primaryHover,"--t-accent":e.colors.accent,"--t-bg":e.colors.background,"--t-surface":e.colors.surface,"--t-text":e.colors.text,"--t-text-muted":e.colors.textMuted,"--t-border":e.colors.border,"--t-error":e.colors.error,...a};return r?ts.jsx(Ls.Provider,{value:e,children:ts.jsx("div",{className:n,style:s,"data-template":"1",children:t})}):ts.jsx(Ls.Provider,{value:e,children:t})},ra=()=>N.useContext(Ls),so=[{id:"preset_personal",name:"Dados Pessoais",description:"Nome, e-mail, CPF, telefone e data de nascimento",icon:"User",category:"personal",containerTemplate:{titulo:"Dados Pessoais",icone:"User",ordem:0,campos:[{id:"_personal_nome",nome:"nome",tipo:D.TEXTO,label:"Nome completo",ordem:0,tamanho:12,obrigatorio:!0,placeholder:"Seu nome completo"},{id:"_personal_email",nome:"email",tipo:D.EMAIL,label:"E-mail",ordem:1,tamanho:6,obrigatorio:!0,placeholder:"seuemail@exemplo.com"},{id:"_personal_telefone",nome:"telefone",tipo:D.TELEFONE,label:"Telefone / WhatsApp",ordem:2,tamanho:6,obrigatorio:!0,placeholder:"(11) 99999-9999"},{id:"_personal_cpf",nome:"cpf",tipo:D.CPF,label:"CPF",ordem:3,tamanho:6,obrigatorio:!1,placeholder:"000.000.000-00"},{id:"_personal_nascimento",nome:"data_nascimento",tipo:D.DATE,label:"Data de nascimento",ordem:4,tamanho:6,obrigatorio:!1}]}},{id:"preset_emergency_array",name:"Contatos de Emergência",description:"Lista de contatos (mín. 2, máx. 7) com Nome, Parentesco e Telefone",icon:"PhoneCall",category:"emergency",containerTemplate:{titulo:"Contatos de Emergência",icone:"PhoneCall",ordem:0,campos:[{id:"_emerg_array_contatos",nome:"contatos_emergencia",tipo:D.FIELD_ARRAY,label:"Contatos de Emergência",ordem:0,tamanho:12,obrigatorio:!0,itemLabel:"Contato",minItems:2,maxItems:7,addLabel:"Adicionar Contato",subFields:[{id:"_emerg_array_nome",nome:"nome",tipo:D.TEXTO,label:"Nome",ordem:0,tamanho:4,obrigatorio:!0,placeholder:"Nome completo do contato"},{id:"_emerg_array_parentesco",nome:"parentesco",tipo:D.SELECT,label:"Parentesco",ordem:1,tamanho:4,obrigatorio:!0,opcoes:[{valor:"pai",label:"Pai"},{valor:"mae",label:"Mãe"},{valor:"conjuge",label:"Cônjuge"},{valor:"irmao",label:"Irmão/Irmã"},{valor:"avo",label:"Avô/Avó"},{valor:"tio",label:"Tio/Tia"},{valor:"amigo",label:"Amigo(a)"},{valor:"outro",label:"Outro"}]},{id:"_emerg_array_telefone",nome:"telefone",tipo:D.TELEFONE,label:"Celular",ordem:2,tamanho:4,obrigatorio:!0,placeholder:"(34) 99999-9999"}]}]}},{id:"preset_emergency",name:"Contatos de Emergência (Repetível)",description:"Lista repetível de contatos de emergência (mínimo 2)",icon:"PhoneCall",category:"emergency",containerTemplate:{titulo:"Contatos de Emergência",icone:"PhoneCall",ordem:0,nome:"contatos_emergencia",repeatable:!0,minItems:2,maxItems:5,itemLabel:"Contato",campos:[{id:"_emerg_nome",nome:"nome",tipo:D.TEXTO,label:"Nome",ordem:0,tamanho:12,obrigatorio:!0,placeholder:"Nome completo do contato"},{id:"_emerg_parentesco",nome:"parentesco",tipo:D.SELECT,label:"Parentesco",ordem:1,tamanho:6,obrigatorio:!0,opcoes:[{valor:"pai",label:"Pai"},{valor:"mae",label:"Mãe"},{valor:"conjuge",label:"Cônjuge"},{valor:"irmao",label:"Irmão/Irmã"},{valor:"avo",label:"Avô/Avó"},{valor:"amigo",label:"Amigo(a)"},{valor:"outro",label:"Outro"}]},{id:"_emerg_telefone",nome:"telefone",tipo:D.TELEFONE,label:"Telefone",ordem:2,tamanho:6,obrigatorio:!0,placeholder:"(11) 99999-9999"}]}},{id:"preset_address",name:"Endereço",description:"CEP com preenchimento automático via ViaCEP + campos de endereço",icon:"MapPin",category:"address",containerTemplate:{titulo:"Endereço",icone:"MapPin",ordem:0,campos:[{id:"_address_cep",nome:"_address_cep",tipo:D.CEP,label:"CEP",ordem:0,tamanho:4,obrigatorio:!1,placeholder:"00000-000",hint:"Preencha o CEP para auto-completar o endereço",locked:!0,cepFillMap:{logradouro:"_address_logradouro",bairro:"_address_bairro",cidade:"_address_cidade",estado:"_address_estado"}},{id:"_address_logradouro",nome:"_address_logradouro",tipo:D.TEXTO,label:"Logradouro",ordem:1,tamanho:8,obrigatorio:!1,placeholder:"Rua, Av., Travessa...",locked:!0},{id:"_address_numero",nome:"_address_numero",tipo:D.TEXTO,label:"Número",ordem:2,tamanho:3,obrigatorio:!1,placeholder:"Nº"},{id:"_address_complemento",nome:"_address_complemento",tipo:D.TEXTO,label:"Complemento",ordem:3,tamanho:9,obrigatorio:!1,placeholder:"Apto, bloco, casa..."},{id:"_address_bairro",nome:"_address_bairro",tipo:D.TEXTO,label:"Bairro",ordem:4,tamanho:5,obrigatorio:!1,locked:!0},{id:"_address_cidade",nome:"_address_cidade",tipo:D.TEXTO,label:"Cidade",ordem:5,tamanho:5,obrigatorio:!1,locked:!0},{id:"_address_estado",nome:"_address_estado",tipo:D.TEXTO,label:"Estado (UF)",ordem:6,tamanho:2,obrigatorio:!1,placeholder:"SP",locked:!0}]}},{id:"preset_responsible",name:"Responsável",description:"Dados do responsável legal (para menores ou dependentes)",icon:"Users",category:"personal",containerTemplate:{titulo:"Responsável",icone:"Users",ordem:0,campos:[{id:"_resp_nome",nome:"responsavel_nome",tipo:D.TEXTO,label:"Nome do responsável",ordem:0,tamanho:12,obrigatorio:!0,placeholder:"Nome completo do responsável"},{id:"_resp_parentesco",nome:"responsavel_parentesco",tipo:D.SELECT,label:"Parentesco",ordem:1,tamanho:6,obrigatorio:!0,opcoes:[{valor:"pai",label:"Pai"},{valor:"mae",label:"Mãe"},{valor:"avo",label:"Avô/Avó"},{valor:"outro",label:"Outro"}]},{id:"_resp_telefone",nome:"responsavel_telefone",tipo:D.TELEFONE,label:"Telefone do responsável",ordem:2,tamanho:6,obrigatorio:!0,placeholder:"(11) 99999-9999"},{id:"_resp_cpf",nome:"responsavel_cpf",tipo:D.CPF,label:"CPF do responsável",ordem:3,tamanho:6,obrigatorio:!1,placeholder:"000.000.000-00"}]}},{id:"preset_health",name:"Informações de Saúde",description:"Alergias, medicamentos, tipo sanguíneo e plano de saúde",icon:"HeartPulse",category:"health",containerTemplate:{titulo:"Informações de Saúde",icone:"HeartPulse",ordem:0,campos:[{id:"_health_tipo_sanguineo",nome:"tipo_sanguineo",tipo:D.SELECT,label:"Tipo sanguíneo",ordem:0,tamanho:4,obrigatorio:!1,opcoes:[{valor:"A+",label:"A+"},{valor:"A-",label:"A-"},{valor:"B+",label:"B+"},{valor:"B-",label:"B-"},{valor:"AB+",label:"AB+"},{valor:"AB-",label:"AB-"},{valor:"O+",label:"O+"},{valor:"O-",label:"O-"},{valor:"nao_sei",label:"Não sei"}]},{id:"_health_plano",nome:"plano_saude",tipo:D.TEXTO,label:"Plano de saúde",ordem:1,tamanho:8,obrigatorio:!1,placeholder:'Ex: Unimed... ou "Nenhum"'},{id:"_health_alergias",nome:"alergias",tipo:D.TEXTAREA,label:"Alergias",ordem:2,tamanho:12,obrigatorio:!1,placeholder:"Descreva alergias conhecidas"},{id:"_health_medicamentos",nome:"medicamentos",tipo:D.TEXTAREA,label:"Medicamentos em uso contínuo",ordem:3,tamanho:12,obrigatorio:!1,placeholder:"Nome, dosagem e frequência"},{id:"_health_obs",nome:"observacoes_medicas",tipo:D.TEXTAREA,label:"Outras observações médicas",ordem:4,tamanho:12,obrigatorio:!1}]}},{id:"preset_participation",name:"Participação",description:"Restrições alimentares, tamanho de camiseta e observações gerais",icon:"ClipboardList",category:"event",containerTemplate:{titulo:"Participação",icone:"ClipboardList",ordem:0,campos:[{id:"_part_restricao_alimentar",nome:"restricao_alimentar",tipo:D.SELECT,label:"Restrição alimentar",ordem:0,tamanho:6,obrigatorio:!1,opcoes:[{valor:"nenhuma",label:"Nenhuma"},{valor:"vegetariano",label:"Vegetariano"},{valor:"vegano",label:"Vegano"},{valor:"sem_gluten",label:"Sem glúten"},{valor:"sem_lactose",label:"Sem lactose"},{valor:"outro",label:"Outro"}]},{id:"_part_camiseta",nome:"tamanho_camiseta",tipo:D.SELECT,label:"Tamanho da camiseta",ordem:1,tamanho:6,obrigatorio:!1,opcoes:[{valor:"PP",label:"PP"},{valor:"P",label:"P"},{valor:"M",label:"M"},{valor:"G",label:"G"},{valor:"GG",label:"GG"},{valor:"XGG",label:"XGG"}]},{id:"_part_obs",nome:"observacoes_participacao",tipo:D.TEXTAREA,label:"Observações",ordem:2,tamanho:12,obrigatorio:!1}]}},{id:"preset_payment",name:"Informações de Pagamento",description:"Forma de pagamento e comprovante",icon:"CreditCard",category:"payment",containerTemplate:{titulo:"Pagamento",icone:"CreditCard",ordem:0,campos:[{id:"_pay_forma",nome:"forma_pagamento",tipo:D.SELECT,label:"Forma de pagamento",ordem:0,tamanho:6,obrigatorio:!0,opcoes:[{valor:"pix",label:"PIX"},{valor:"cartao",label:"Cartão de crédito/débito"},{valor:"boleto",label:"Boleto bancário"},{valor:"dinheiro",label:"Dinheiro (presencial)"}]},{id:"_pay_comprovante",nome:"comprovante_pagamento",tipo:D.FILE,label:"Comprovante de pagamento",ordem:1,tamanho:6,obrigatorio:!1,hint:"Envie o comprovante caso já tenha efetuado o pagamento"}]}},{id:"preset_participation_type",name:"Tipo de Participação",description:"Seleção de todos os dias ou dia específico. Datas, preços e vagas carregados via externalData.",icon:"CalendarDays",category:"event",containerTemplate:{titulo:"Tipo de Participação",icone:"CalendarDays",descricao:"Escolha como você deseja participar do evento",ordem:0,campos:[{id:"_participation_type_field",nome:"tipo_participacao",tipo:D.PARTICIPATION_TYPE,label:"Tipo de Participação",hint:"Escolha como você deseja participar",ordem:0,tamanho:12,obrigatorio:!0,locked:!0}]}}],fg=e=>so.filter(t=>t.category===e),wi=e=>so.find(t=>t.id===e),ji=[{id:"preset_steps_participation_payment",name:"Participação + Pagamento",description:"Dois steps: seleção do tipo de participação e escolha da forma de pagamento com cálculo automático de taxas.",icon:"Wallet",steps:[{titulo:"Tipo de Participação",descricao:"Escolha como deseja participar do evento",icone:"CalendarDays",containers:[{titulo:"Tipo de Participação",icone:"CalendarDays",descricao:"Escolha como você deseja participar do evento",ordem:0,campos:[{id:"_participation_type_field",nome:"tipo_participacao",tipo:D.PARTICIPATION_TYPE,label:"Tipo de Participação",hint:"Escolha como você deseja participar",ordem:0,tamanho:12,obrigatorio:!0,locked:!0}]}]},{titulo:"Forma de Pagamento",descricao:"Escolha como deseja pagar sua inscrição",icone:"Wallet",containers:[{titulo:"Forma de Pagamento",icone:"Wallet",descricao:"Escolha como deseja pagar sua inscrição",ordem:0,campos:[{id:"_payment_method_field",nome:"forma_pagamento",tipo:D.PAYMENT_METHOD,label:"Forma de Pagamento",ordem:0,tamanho:12,obrigatorio:!0,locked:!0,relatedFieldName:"tipo_participacao"}]}]}]}],hg=e=>ji.find(t=>t.id===e);function mu(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(r=mu(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function pu(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=mu(e))&&(n&&(n+=" "),n+=t);return n}const xg=(e,t)=>{const r=new Array(e.length+t.length);for(let n=0;n<e.length;n++)r[n]=e[n];for(let n=0;n<t.length;n++)r[e.length+n]=t[n];return r},gg=(e,t)=>({classGroupId:e,validator:t}),fu=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),Oa="-",Kl=[],vg="arbitrary..",bg=e=>{const t=wg(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return yg(a);const s=a.split(Oa),i=s[0]===""&&s.length>1?1:0;return hu(s,i,t)},getConflictingClassGroupIds:(a,s)=>{if(s){const i=n[a],l=r[a];return i?l?xg(l,i):i:l||Kl}return r[a]||Kl}}},hu=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const n=e[t],a=r.nextPart.get(n);if(a){const c=hu(e,t+1,a);if(c)return c}const s=r.validators;if(s===null)return;const i=t===0?e.join(Oa):e.slice(t).join(Oa),l=s.length;for(let c=0;c<l;c++){const d=s[c];if(d.validator(i))return d.classGroupId}},yg=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),n=t.slice(0,r);return n?vg+n:void 0})(),wg=e=>{const{theme:t,classGroups:r}=e;return jg(r,t)},jg=(e,t)=>{const r=fu();for(const n in e){const a=e[n];ki(a,r,n,t)}return r},ki=(e,t,r,n)=>{const a=e.length;for(let s=0;s<a;s++){const i=e[s];kg(i,t,r,n)}},kg=(e,t,r,n)=>{if(typeof e=="string"){Cg(e,t,r);return}if(typeof e=="function"){Ng(e,t,r,n);return}Sg(e,t,r,n)},Cg=(e,t,r)=>{const n=e===""?t:xu(t,e);n.classGroupId=r},Ng=(e,t,r,n)=>{if($g(e)){ki(e(n),t,r,n);return}t.validators===null&&(t.validators=[]),t.validators.push(gg(r,e))},Sg=(e,t,r,n)=>{const a=Object.entries(e),s=a.length;for(let i=0;i<s;i++){const[l,c]=a[i];ki(c,xu(t,l),r,n)}},xu=(e,t)=>{let r=e;const n=t.split(Oa),a=n.length;for(let s=0;s<a;s++){const i=n[s];let l=r.nextPart.get(i);l||(l=fu(),r.nextPart.set(i,l)),r=l}return r},$g=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,Eg=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null);const a=(s,i)=>{r[s]=i,t++,t>e&&(t=0,n=r,r=Object.create(null))};return{get(s){let i=r[s];if(i!==void 0)return i;if((i=n[s])!==void 0)return a(s,i),i},set(s,i){s in r?r[s]=i:a(s,i)}}},Ms="!",Yl=":",Tg=[],Jl=(e,t,r,n,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:a}),Ag=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=a=>{const s=[];let i=0,l=0,c=0,d;const u=a.length;for(let h=0;h<u;h++){const x=a[h];if(i===0&&l===0){if(x===Yl){s.push(a.slice(c,h)),c=h+1;continue}if(x==="/"){d=h;continue}}x==="["?i++:x==="]"?i--:x==="("?l++:x===")"&&l--}const m=s.length===0?a:a.slice(c);let p=m,f=!1;m.endsWith(Ms)?(p=m.slice(0,-1),f=!0):m.startsWith(Ms)&&(p=m.slice(1),f=!0);const v=d&&d>c?d-c:void 0;return Jl(s,f,p,v)};if(t){const a=t+Yl,s=n;n=i=>i.startsWith(a)?s(i.slice(a.length)):Jl(Tg,!1,i,void 0,!0)}if(r){const a=n;n=s=>r({className:s,parseClassName:a})}return n},Dg=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,n)=>{t.set(r,1e6+n)}),r=>{const n=[];let a=[];for(let s=0;s<r.length;s++){const i=r[s],l=i[0]==="[",c=t.has(i);l||c?(a.length>0&&(a.sort(),n.push(...a),a=[]),n.push(i)):a.push(i)}return a.length>0&&(a.sort(),n.push(...a)),n}},Rg=e=>({cache:Eg(e.cacheSize),parseClassName:Ag(e),sortModifiers:Dg(e),...bg(e)}),Pg=/\s+/,_g=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:s}=t,i=[],l=e.trim().split(Pg);let c="";for(let d=l.length-1;d>=0;d-=1){const u=l[d],{isExternal:m,modifiers:p,hasImportantModifier:f,baseClassName:v,maybePostfixModifierPosition:h}=r(u);if(m){c=u+(c.length>0?" "+c:c);continue}let x=!!h,b=n(x?v.substring(0,h):v);if(!b){if(!x){c=u+(c.length>0?" "+c:c);continue}if(b=n(v),!b){c=u+(c.length>0?" "+c:c);continue}x=!1}const y=p.length===0?"":p.length===1?p[0]:s(p).join(":"),j=f?y+Ms:y,w=j+b;if(i.indexOf(w)>-1)continue;i.push(w);const C=a(b,x);for(let S=0;S<C.length;++S){const $=C[S];i.push(j+$)}c=u+(c.length>0?" "+c:c)}return c},Ig=(...e)=>{let t=0,r,n,a="";for(;t<e.length;)(r=e[t++])&&(n=gu(r))&&(a&&(a+=" "),a+=n);return a},gu=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=gu(e[n]))&&(r&&(r+=" "),r+=t);return r},Og=(e,...t)=>{let r,n,a,s;const i=c=>{const d=t.reduce((u,m)=>m(u),e());return r=Rg(d),n=r.cache.get,a=r.cache.set,s=l,l(c)},l=c=>{const d=n(c);if(d)return d;const u=_g(c,r);return a(c,u),u};return s=i,(...c)=>s(Ig(...c))},Fg=[],at=e=>{const t=r=>r[e]||Fg;return t.isThemeGetter=!0,t},vu=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,bu=/^\((?:(\w[\w-]*):)?(.+)\)$/i,zg=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Lg=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Mg=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Vg=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Bg=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Ug=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Nr=e=>zg.test(e),Ne=e=>!!e&&!Number.isNaN(Number(e)),Sr=e=>!!e&&Number.isInteger(Number(e)),rs=e=>e.endsWith("%")&&Ne(e.slice(0,-1)),fr=e=>Lg.test(e),yu=()=>!0,Hg=e=>Mg.test(e)&&!Vg.test(e),Ci=()=>!1,Wg=e=>Bg.test(e),qg=e=>Ug.test(e),Gg=e=>!pe(e)&&!he(e),Xg=e=>zr(e,ku,Ci),pe=e=>vu.test(e),Wr=e=>zr(e,Cu,Hg),Ql=e=>zr(e,rv,Ne),Zg=e=>zr(e,Su,yu),Kg=e=>zr(e,Nu,Ci),ec=e=>zr(e,wu,Ci),Yg=e=>zr(e,ju,qg),ga=e=>zr(e,$u,Wg),he=e=>bu.test(e),Bn=e=>nn(e,Cu),Jg=e=>nn(e,Nu),tc=e=>nn(e,wu),Qg=e=>nn(e,ku),ev=e=>nn(e,ju),va=e=>nn(e,$u,!0),tv=e=>nn(e,Su,!0),zr=(e,t,r)=>{const n=vu.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},nn=(e,t,r=!1)=>{const n=bu.exec(e);return n?n[1]?t(n[1]):r:!1},wu=e=>e==="position"||e==="percentage",ju=e=>e==="image"||e==="url",ku=e=>e==="length"||e==="size"||e==="bg-size",Cu=e=>e==="length",rv=e=>e==="number",Nu=e=>e==="family-name",Su=e=>e==="number"||e==="weight",$u=e=>e==="shadow",nv=()=>{const e=at("color"),t=at("font"),r=at("text"),n=at("font-weight"),a=at("tracking"),s=at("leading"),i=at("breakpoint"),l=at("container"),c=at("spacing"),d=at("radius"),u=at("shadow"),m=at("inset-shadow"),p=at("text-shadow"),f=at("drop-shadow"),v=at("blur"),h=at("perspective"),x=at("aspect"),b=at("ease"),y=at("animate"),j=()=>["auto","avoid","all","avoid-page","page","left","right","column"],w=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],C=()=>[...w(),he,pe],S=()=>["auto","hidden","clip","visible","scroll"],$=()=>["auto","contain","none"],k=()=>[he,pe,c],E=()=>[Nr,"full","auto",...k()],T=()=>[Sr,"none","subgrid",he,pe],O=()=>["auto",{span:["full",Sr,he,pe]},Sr,he,pe],L=()=>[Sr,"auto",he,pe],A=()=>["auto","min","max","fr",he,pe],z=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],X=()=>["start","end","center","stretch","center-safe","end-safe"],q=()=>["auto",...k()],Z=()=>[Nr,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...k()],V=()=>[Nr,"screen","full","dvw","lvw","svw","min","max","fit",...k()],M=()=>[Nr,"screen","full","lh","dvh","lvh","svh","min","max","fit",...k()],_=()=>[e,he,pe],se=()=>[...w(),tc,ec,{position:[he,pe]}],U=()=>["no-repeat",{repeat:["","x","y","space","round"]}],Q=()=>["auto","cover","contain",Qg,Xg,{size:[he,pe]}],Y=()=>[rs,Bn,Wr],H=()=>["","none","full",d,he,pe],W=()=>["",Ne,Bn,Wr],G=()=>["solid","dashed","dotted","double"],ne=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],J=()=>[Ne,rs,tc,ec],te=()=>["","none",v,he,pe],ce=()=>["none",Ne,he,pe],be=()=>["none",Ne,he,pe],Ce=()=>[Ne,he,pe],ve=()=>[Nr,"full",...k()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[fr],breakpoint:[fr],color:[yu],container:[fr],"drop-shadow":[fr],ease:["in","out","in-out"],font:[Gg],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[fr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[fr],shadow:[fr],spacing:["px",Ne],text:[fr],"text-shadow":[fr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Nr,pe,he,x]}],container:["container"],columns:[{columns:[Ne,pe,he,l]}],"break-after":[{"break-after":j()}],"break-before":[{"break-before":j()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:C()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:$()}],"overscroll-x":[{"overscroll-x":$()}],"overscroll-y":[{"overscroll-y":$()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:E()}],"inset-x":[{"inset-x":E()}],"inset-y":[{"inset-y":E()}],start:[{"inset-s":E(),start:E()}],end:[{"inset-e":E(),end:E()}],"inset-bs":[{"inset-bs":E()}],"inset-be":[{"inset-be":E()}],top:[{top:E()}],right:[{right:E()}],bottom:[{bottom:E()}],left:[{left:E()}],visibility:["visible","invisible","collapse"],z:[{z:[Sr,"auto",he,pe]}],basis:[{basis:[Nr,"full","auto",l,...k()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ne,Nr,"auto","initial","none",pe]}],grow:[{grow:["",Ne,he,pe]}],shrink:[{shrink:["",Ne,he,pe]}],order:[{order:[Sr,"first","last","none",he,pe]}],"grid-cols":[{"grid-cols":T()}],"col-start-end":[{col:O()}],"col-start":[{"col-start":L()}],"col-end":[{"col-end":L()}],"grid-rows":[{"grid-rows":T()}],"row-start-end":[{row:O()}],"row-start":[{"row-start":L()}],"row-end":[{"row-end":L()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":A()}],"auto-rows":[{"auto-rows":A()}],gap:[{gap:k()}],"gap-x":[{"gap-x":k()}],"gap-y":[{"gap-y":k()}],"justify-content":[{justify:[...z(),"normal"]}],"justify-items":[{"justify-items":[...X(),"normal"]}],"justify-self":[{"justify-self":["auto",...X()]}],"align-content":[{content:["normal",...z()]}],"align-items":[{items:[...X(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...X(),{baseline:["","last"]}]}],"place-content":[{"place-content":z()}],"place-items":[{"place-items":[...X(),"baseline"]}],"place-self":[{"place-self":["auto",...X()]}],p:[{p:k()}],px:[{px:k()}],py:[{py:k()}],ps:[{ps:k()}],pe:[{pe:k()}],pbs:[{pbs:k()}],pbe:[{pbe:k()}],pt:[{pt:k()}],pr:[{pr:k()}],pb:[{pb:k()}],pl:[{pl:k()}],m:[{m:q()}],mx:[{mx:q()}],my:[{my:q()}],ms:[{ms:q()}],me:[{me:q()}],mbs:[{mbs:q()}],mbe:[{mbe:q()}],mt:[{mt:q()}],mr:[{mr:q()}],mb:[{mb:q()}],ml:[{ml:q()}],"space-x":[{"space-x":k()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":k()}],"space-y-reverse":["space-y-reverse"],size:[{size:Z()}],"inline-size":[{inline:["auto",...V()]}],"min-inline-size":[{"min-inline":["auto",...V()]}],"max-inline-size":[{"max-inline":["none",...V()]}],"block-size":[{block:["auto",...M()]}],"min-block-size":[{"min-block":["auto",...M()]}],"max-block-size":[{"max-block":["none",...M()]}],w:[{w:[l,"screen",...Z()]}],"min-w":[{"min-w":[l,"screen","none",...Z()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[i]},...Z()]}],h:[{h:["screen","lh",...Z()]}],"min-h":[{"min-h":["screen","lh","none",...Z()]}],"max-h":[{"max-h":["screen","lh",...Z()]}],"font-size":[{text:["base",r,Bn,Wr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,tv,Zg]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",rs,pe]}],"font-family":[{font:[Jg,Kg,t]}],"font-features":[{"font-features":[pe]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,he,pe]}],"line-clamp":[{"line-clamp":[Ne,"none",he,Ql]}],leading:[{leading:[s,...k()]}],"list-image":[{"list-image":["none",he,pe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",he,pe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:_()}],"text-color":[{text:_()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...G(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ne,"from-font","auto",he,Wr]}],"text-decoration-color":[{decoration:_()}],"underline-offset":[{"underline-offset":[Ne,"auto",he,pe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:k()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",he,pe]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",he,pe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:se()}],"bg-repeat":[{bg:U()}],"bg-size":[{bg:Q()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Sr,he,pe],radial:["",he,pe],conic:[Sr,he,pe]},ev,Yg]}],"bg-color":[{bg:_()}],"gradient-from-pos":[{from:Y()}],"gradient-via-pos":[{via:Y()}],"gradient-to-pos":[{to:Y()}],"gradient-from":[{from:_()}],"gradient-via":[{via:_()}],"gradient-to":[{to:_()}],rounded:[{rounded:H()}],"rounded-s":[{"rounded-s":H()}],"rounded-e":[{"rounded-e":H()}],"rounded-t":[{"rounded-t":H()}],"rounded-r":[{"rounded-r":H()}],"rounded-b":[{"rounded-b":H()}],"rounded-l":[{"rounded-l":H()}],"rounded-ss":[{"rounded-ss":H()}],"rounded-se":[{"rounded-se":H()}],"rounded-ee":[{"rounded-ee":H()}],"rounded-es":[{"rounded-es":H()}],"rounded-tl":[{"rounded-tl":H()}],"rounded-tr":[{"rounded-tr":H()}],"rounded-br":[{"rounded-br":H()}],"rounded-bl":[{"rounded-bl":H()}],"border-w":[{border:W()}],"border-w-x":[{"border-x":W()}],"border-w-y":[{"border-y":W()}],"border-w-s":[{"border-s":W()}],"border-w-e":[{"border-e":W()}],"border-w-bs":[{"border-bs":W()}],"border-w-be":[{"border-be":W()}],"border-w-t":[{"border-t":W()}],"border-w-r":[{"border-r":W()}],"border-w-b":[{"border-b":W()}],"border-w-l":[{"border-l":W()}],"divide-x":[{"divide-x":W()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":W()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...G(),"hidden","none"]}],"divide-style":[{divide:[...G(),"hidden","none"]}],"border-color":[{border:_()}],"border-color-x":[{"border-x":_()}],"border-color-y":[{"border-y":_()}],"border-color-s":[{"border-s":_()}],"border-color-e":[{"border-e":_()}],"border-color-bs":[{"border-bs":_()}],"border-color-be":[{"border-be":_()}],"border-color-t":[{"border-t":_()}],"border-color-r":[{"border-r":_()}],"border-color-b":[{"border-b":_()}],"border-color-l":[{"border-l":_()}],"divide-color":[{divide:_()}],"outline-style":[{outline:[...G(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ne,he,pe]}],"outline-w":[{outline:["",Ne,Bn,Wr]}],"outline-color":[{outline:_()}],shadow:[{shadow:["","none",u,va,ga]}],"shadow-color":[{shadow:_()}],"inset-shadow":[{"inset-shadow":["none",m,va,ga]}],"inset-shadow-color":[{"inset-shadow":_()}],"ring-w":[{ring:W()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:_()}],"ring-offset-w":[{"ring-offset":[Ne,Wr]}],"ring-offset-color":[{"ring-offset":_()}],"inset-ring-w":[{"inset-ring":W()}],"inset-ring-color":[{"inset-ring":_()}],"text-shadow":[{"text-shadow":["none",p,va,ga]}],"text-shadow-color":[{"text-shadow":_()}],opacity:[{opacity:[Ne,he,pe]}],"mix-blend":[{"mix-blend":[...ne(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ne()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ne]}],"mask-image-linear-from-pos":[{"mask-linear-from":J()}],"mask-image-linear-to-pos":[{"mask-linear-to":J()}],"mask-image-linear-from-color":[{"mask-linear-from":_()}],"mask-image-linear-to-color":[{"mask-linear-to":_()}],"mask-image-t-from-pos":[{"mask-t-from":J()}],"mask-image-t-to-pos":[{"mask-t-to":J()}],"mask-image-t-from-color":[{"mask-t-from":_()}],"mask-image-t-to-color":[{"mask-t-to":_()}],"mask-image-r-from-pos":[{"mask-r-from":J()}],"mask-image-r-to-pos":[{"mask-r-to":J()}],"mask-image-r-from-color":[{"mask-r-from":_()}],"mask-image-r-to-color":[{"mask-r-to":_()}],"mask-image-b-from-pos":[{"mask-b-from":J()}],"mask-image-b-to-pos":[{"mask-b-to":J()}],"mask-image-b-from-color":[{"mask-b-from":_()}],"mask-image-b-to-color":[{"mask-b-to":_()}],"mask-image-l-from-pos":[{"mask-l-from":J()}],"mask-image-l-to-pos":[{"mask-l-to":J()}],"mask-image-l-from-color":[{"mask-l-from":_()}],"mask-image-l-to-color":[{"mask-l-to":_()}],"mask-image-x-from-pos":[{"mask-x-from":J()}],"mask-image-x-to-pos":[{"mask-x-to":J()}],"mask-image-x-from-color":[{"mask-x-from":_()}],"mask-image-x-to-color":[{"mask-x-to":_()}],"mask-image-y-from-pos":[{"mask-y-from":J()}],"mask-image-y-to-pos":[{"mask-y-to":J()}],"mask-image-y-from-color":[{"mask-y-from":_()}],"mask-image-y-to-color":[{"mask-y-to":_()}],"mask-image-radial":[{"mask-radial":[he,pe]}],"mask-image-radial-from-pos":[{"mask-radial-from":J()}],"mask-image-radial-to-pos":[{"mask-radial-to":J()}],"mask-image-radial-from-color":[{"mask-radial-from":_()}],"mask-image-radial-to-color":[{"mask-radial-to":_()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":w()}],"mask-image-conic-pos":[{"mask-conic":[Ne]}],"mask-image-conic-from-pos":[{"mask-conic-from":J()}],"mask-image-conic-to-pos":[{"mask-conic-to":J()}],"mask-image-conic-from-color":[{"mask-conic-from":_()}],"mask-image-conic-to-color":[{"mask-conic-to":_()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:se()}],"mask-repeat":[{mask:U()}],"mask-size":[{mask:Q()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",he,pe]}],filter:[{filter:["","none",he,pe]}],blur:[{blur:te()}],brightness:[{brightness:[Ne,he,pe]}],contrast:[{contrast:[Ne,he,pe]}],"drop-shadow":[{"drop-shadow":["","none",f,va,ga]}],"drop-shadow-color":[{"drop-shadow":_()}],grayscale:[{grayscale:["",Ne,he,pe]}],"hue-rotate":[{"hue-rotate":[Ne,he,pe]}],invert:[{invert:["",Ne,he,pe]}],saturate:[{saturate:[Ne,he,pe]}],sepia:[{sepia:["",Ne,he,pe]}],"backdrop-filter":[{"backdrop-filter":["","none",he,pe]}],"backdrop-blur":[{"backdrop-blur":te()}],"backdrop-brightness":[{"backdrop-brightness":[Ne,he,pe]}],"backdrop-contrast":[{"backdrop-contrast":[Ne,he,pe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ne,he,pe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ne,he,pe]}],"backdrop-invert":[{"backdrop-invert":["",Ne,he,pe]}],"backdrop-opacity":[{"backdrop-opacity":[Ne,he,pe]}],"backdrop-saturate":[{"backdrop-saturate":[Ne,he,pe]}],"backdrop-sepia":[{"backdrop-sepia":["",Ne,he,pe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":k()}],"border-spacing-x":[{"border-spacing-x":k()}],"border-spacing-y":[{"border-spacing-y":k()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",he,pe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ne,"initial",he,pe]}],ease:[{ease:["linear","initial",b,he,pe]}],delay:[{delay:[Ne,he,pe]}],animate:[{animate:["none",y,he,pe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[h,he,pe]}],"perspective-origin":[{"perspective-origin":C()}],rotate:[{rotate:ce()}],"rotate-x":[{"rotate-x":ce()}],"rotate-y":[{"rotate-y":ce()}],"rotate-z":[{"rotate-z":ce()}],scale:[{scale:be()}],"scale-x":[{"scale-x":be()}],"scale-y":[{"scale-y":be()}],"scale-z":[{"scale-z":be()}],"scale-3d":["scale-3d"],skew:[{skew:Ce()}],"skew-x":[{"skew-x":Ce()}],"skew-y":[{"skew-y":Ce()}],transform:[{transform:[he,pe,"","none","gpu","cpu"]}],"transform-origin":[{origin:C()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ve()}],"translate-x":[{"translate-x":ve()}],"translate-y":[{"translate-y":ve()}],"translate-z":[{"translate-z":ve()}],"translate-none":["translate-none"],accent:[{accent:_()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:_()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",he,pe]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":k()}],"scroll-mx":[{"scroll-mx":k()}],"scroll-my":[{"scroll-my":k()}],"scroll-ms":[{"scroll-ms":k()}],"scroll-me":[{"scroll-me":k()}],"scroll-mbs":[{"scroll-mbs":k()}],"scroll-mbe":[{"scroll-mbe":k()}],"scroll-mt":[{"scroll-mt":k()}],"scroll-mr":[{"scroll-mr":k()}],"scroll-mb":[{"scroll-mb":k()}],"scroll-ml":[{"scroll-ml":k()}],"scroll-p":[{"scroll-p":k()}],"scroll-px":[{"scroll-px":k()}],"scroll-py":[{"scroll-py":k()}],"scroll-ps":[{"scroll-ps":k()}],"scroll-pe":[{"scroll-pe":k()}],"scroll-pbs":[{"scroll-pbs":k()}],"scroll-pbe":[{"scroll-pbe":k()}],"scroll-pt":[{"scroll-pt":k()}],"scroll-pr":[{"scroll-pr":k()}],"scroll-pb":[{"scroll-pb":k()}],"scroll-pl":[{"scroll-pl":k()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",he,pe]}],fill:[{fill:["none",..._()]}],"stroke-w":[{stroke:[Ne,Bn,Wr,Ql]}],stroke:[{stroke:["none",..._()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},av=Og(nv);function K(...e){return av(pu(e))}function ov(e){if(!e)return null;if(e.includes("-")){const t=e.split("-").map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("");return I.icons[t]??null}return I.icons[e]??null}function rc(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Ni(...e){return t=>{let r=!1;const n=e.map(a=>{const s=rc(a,t);return!r&&typeof s=="function"&&(r=!0),s});if(r)return()=>{for(let a=0;a<n.length;a++){const s=n[a];typeof s=="function"?s():rc(e[a],null)}}}}function ke(...e){return g.useCallback(Ni(...e),e)}var sv=Symbol.for("react.lazy"),Fa=g[" use ".trim().toString()];function iv(e){return typeof e=="object"&&e!==null&&"then"in e}function Eu(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===sv&&"_payload"in e&&iv(e._payload)}function Tu(e){const t=cv(e),r=g.forwardRef((n,a)=>{let{children:s,...i}=n;Eu(s)&&typeof Fa=="function"&&(s=Fa(s._payload));const l=g.Children.toArray(s),c=l.find(uv);if(c){const d=c.props.children,u=l.map(m=>m===c?g.Children.count(d)>1?g.Children.only(null):g.isValidElement(d)?d.props.children:null:m);return o.jsx(t,{...i,ref:a,children:g.isValidElement(d)?g.cloneElement(d,void 0,u):null})}return o.jsx(t,{...i,ref:a,children:s})});return r.displayName=`${e}.Slot`,r}var lv=Tu("Slot");function cv(e){const t=g.forwardRef((r,n)=>{let{children:a,...s}=r;if(Eu(a)&&typeof Fa=="function"&&(a=Fa(a._payload)),g.isValidElement(a)){const i=pv(a),l=mv(s,a.props);return a.type!==g.Fragment&&(l.ref=n?Ni(n,i):i),g.cloneElement(a,l)}return g.Children.count(a)>1?g.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var dv=Symbol("radix.slottable");function uv(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===dv}function mv(e,t){const r={...t};for(const n in t){const a=e[n],s=t[n];/^on[A-Z]/.test(n)?a&&s?r[n]=(...i)=>{const l=s(...i);return a(...i),l}:a&&(r[n]=a):n==="style"?r[n]={...a,...s}:n==="className"&&(r[n]=[a,s].filter(Boolean).join(" "))}return{...e,...r}}function pv(e){var t,r;let n=(t=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:t.get,a=n&&"isReactWarning"in n&&n.isReactWarning;return a?e.ref:(n=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,a=n&&"isReactWarning"in n&&n.isReactWarning,a?e.props.ref:e.props.ref||e.ref)}const nc=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,ac=pu,Si=(e,t)=>r=>{var n;if((t==null?void 0:t.variants)==null)return ac(e,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:a,defaultVariants:s}=t,i=Object.keys(a).map(d=>{const u=r==null?void 0:r[d],m=s==null?void 0:s[d];if(u===null)return null;const p=nc(u)||nc(m);return a[d][p]}),l=r&&Object.entries(r).reduce((d,u)=>{let[m,p]=u;return p===void 0||(d[m]=p),d},{}),c=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((d,u)=>{let{class:m,className:p,...f}=u;return Object.entries(f).every(v=>{let[h,x]=v;return Array.isArray(x)?x.includes({...s,...l}[h]):{...s,...l}[h]===x})?[...d,m,p]:d},[]);return ac(e,i,c,r==null?void 0:r.class,r==null?void 0:r.className)},fv=Si("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),Ae=g.forwardRef(({className:e,variant:t,size:r,asChild:n=!1,...a},s)=>o.jsx(n?lv:"button",{className:K(fv({variant:t,size:r,className:e})),ref:s,...a}));Ae.displayName="Button";const ue=g.forwardRef(({className:e,type:t,...r},n)=>o.jsx("input",{type:t,className:K("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:n,...r}));ue.displayName="Input";const io=g.forwardRef(({className:e,...t},r)=>o.jsx("textarea",{className:K("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...t}));io.displayName="Textarea";var hv=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],lo=hv.reduce((e,t)=>{const r=Tu(`Primitive.${t}`),n=g.forwardRef((a,s)=>{const{asChild:i,...l}=a,c=i?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:s})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),xv="Label",Au=g.forwardRef((e,t)=>o.jsx(lo.label,{...e,ref:t,onMouseDown:r=>{var n;r.target.closest("button, input, select, textarea")||((n=e.onMouseDown)==null||n.call(e,r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));Au.displayName=xv;var Du=Au;const gv=Si("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),ie=g.forwardRef(({className:e,...t},r)=>o.jsx(Du,{ref:r,className:K(gv(),e),...t}));ie.displayName=Du.displayName;const vv=Si("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground",success:"border-transparent bg-green-500 text-white shadow"}},defaultVariants:{variant:"default"}});function $i({className:e,variant:t,...r}){return o.jsx("div",{className:K(vv({variant:t}),e),...r})}var bv="Separator",oc="horizontal",yv=["horizontal","vertical"],Ru=g.forwardRef((e,t)=>{const{decorative:r,orientation:n=oc,...a}=e,s=wv(n)?n:oc,i=r?{role:"none"}:{"aria-orientation":s==="vertical"?s:void 0,role:"separator"};return o.jsx(lo.div,{"data-orientation":s,...i,...a,ref:t})});Ru.displayName=bv;function wv(e){return yv.includes(e)}var Pu=Ru;const it=g.forwardRef(({className:e,orientation:t="horizontal",decorative:r=!0,...n},a)=>o.jsx(Pu,{ref:a,decorative:r,orientation:t,className:K("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...n}));it.displayName=Pu.displayName;function jv(e,t){const r=g.createContext(t),n=s=>{const{children:i,...l}=s,c=g.useMemo(()=>l,Object.values(l));return o.jsx(r.Provider,{value:c,children:i})};n.displayName=e+"Provider";function a(s){const i=g.useContext(r);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[n,a]}function _t(e,t=[]){let r=[];function n(s,i){const l=g.createContext(i),c=r.length;r=[...r,i];const d=m=>{var p;const{scope:f,children:v,...h}=m,x=((p=f==null?void 0:f[e])==null?void 0:p[c])||l,b=g.useMemo(()=>h,Object.values(h));return o.jsx(x.Provider,{value:b,children:v})};d.displayName=s+"Provider";function u(m,p){var f;const v=((f=p==null?void 0:p[e])==null?void 0:f[c])||l,h=g.useContext(v);if(h)return h;if(i!==void 0)return i;throw new Error(`\`${m}\` must be used within \`${s}\``)}return[d,u]}const a=()=>{const s=r.map(i=>g.createContext(i));return function(i){const l=(i==null?void 0:i[e])||s;return g.useMemo(()=>({[`__scope${e}`]:{...i,[e]:l}}),[i,l])}};return a.scopeName=e,[n,kv(a,...t)]}function kv(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(a){const s=n.reduce((i,{useScope:l,scopeName:c})=>{const d=l(a)[`__scope${c}`];return{...i,...d}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return r.scopeName=t.scopeName,r}function ge(e,t,{checkForDefaultPrevented:r=!0}={}){return function(n){if(e==null||e(n),r===!1||!n.defaultPrevented)return t==null?void 0:t(n)}}var lt=globalThis!=null&&globalThis.document?g.useLayoutEffect:()=>{},Cv=g[" useInsertionEffect ".trim().toString()]||lt;function cr({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){const[a,s,i]=Nv({defaultProp:t,onChange:r}),l=e!==void 0,c=l?e:a;{const u=g.useRef(e!==void 0);g.useEffect(()=>{const m=u.current;m!==l&&console.warn(`${n} is changing from ${m?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=l},[l,n])}const d=g.useCallback(u=>{var m;if(l){const p=Sv(u)?u(e):u;p!==e&&((m=i.current)==null||m.call(i,p))}else s(u)},[l,e,s,i]);return[c,d]}function Nv({defaultProp:e,onChange:t}){const[r,n]=g.useState(e),a=g.useRef(r),s=g.useRef(t);return Cv(()=>{s.current=t},[t]),g.useEffect(()=>{var i;a.current!==r&&((i=s.current)==null||i.call(s,r),a.current=r)},[r,a]),[r,n,s]}function Sv(e){return typeof e=="function"}function na(e){const t=g.useRef({value:e,previous:e});return g.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function aa(e){const[t,r]=g.useState(void 0);return lt(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const n=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const s=a[0];let i,l;if("borderBoxSize"in s){const c=s.borderBoxSize,d=Array.isArray(c)?c[0]:c;i=d.inlineSize,l=d.blockSize}else i=e.offsetWidth,l=e.offsetHeight;r({width:i,height:l})});return n.observe(e,{box:"border-box"}),()=>n.unobserve(e)}else r(void 0)},[e]),t}function $v(e,t){return g.useReducer((r,n)=>t[r][n]??r,e)}var It=e=>{const{present:t,children:r}=e,n=Ev(t),a=typeof r=="function"?r({present:n.isPresent}):g.Children.only(r),s=ke(n.ref,Tv(a));return typeof r=="function"||n.isPresent?g.cloneElement(a,{ref:s}):null};It.displayName="Presence";function Ev(e){const[t,r]=g.useState(),n=g.useRef(null),a=g.useRef(e),s=g.useRef("none"),i=e?"mounted":"unmounted",[l,c]=$v(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return g.useEffect(()=>{const d=ba(n.current);s.current=l==="mounted"?d:"none"},[l]),lt(()=>{const d=n.current,u=a.current;if(u!==e){const m=s.current,p=ba(d);e?c("MOUNT"):p==="none"||(d==null?void 0:d.display)==="none"?c("UNMOUNT"):c(u&&m!==p?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,c]),lt(()=>{if(t){let d;const u=t.ownerDocument.defaultView??window,m=f=>{const v=ba(n.current).includes(CSS.escape(f.animationName));if(f.target===t&&v&&(c("ANIMATION_END"),!a.current)){const h=t.style.animationFillMode;t.style.animationFillMode="forwards",d=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=h)})}},p=f=>{f.target===t&&(s.current=ba(n.current))};return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",m),t.addEventListener("animationend",m),()=>{u.clearTimeout(d),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",m),t.removeEventListener("animationend",m)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:g.useCallback(d=>{n.current=d?getComputedStyle(d):null,r(d)},[])}}function ba(e){return(e==null?void 0:e.animationName)||"none"}function Tv(e){var t,r;let n=(t=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:t.get,a=n&&"isReactWarning"in n&&n.isReactWarning;return a?e.ref:(n=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,a=n&&"isReactWarning"in n&&n.isReactWarning,a?e.props.ref:e.props.ref||e.ref)}function Cn(e){const t=Av(e),r=g.forwardRef((n,a)=>{const{children:s,...i}=n,l=g.Children.toArray(s),c=l.find(Rv);if(c){const d=c.props.children,u=l.map(m=>m===c?g.Children.count(d)>1?g.Children.only(null):g.isValidElement(d)?d.props.children:null:m);return o.jsx(t,{...i,ref:a,children:g.isValidElement(d)?g.cloneElement(d,void 0,u):null})}return o.jsx(t,{...i,ref:a,children:s})});return r.displayName=`${e}.Slot`,r}function Av(e){const t=g.forwardRef((r,n)=>{const{children:a,...s}=r;if(g.isValidElement(a)){const i=_v(a),l=Pv(s,a.props);return a.type!==g.Fragment&&(l.ref=n?Ni(n,i):i),g.cloneElement(a,l)}return g.Children.count(a)>1?g.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var _u=Symbol("radix.slottable");function Dv(e){const t=({children:r})=>o.jsx(o.Fragment,{children:r});return t.displayName=`${e}.Slottable`,t.__radixId=_u,t}function Rv(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===_u}function Pv(e,t){const r={...t};for(const n in t){const a=e[n],s=t[n];/^on[A-Z]/.test(n)?a&&s?r[n]=(...i)=>{const l=s(...i);return a(...i),l}:a&&(r[n]=a):n==="style"?r[n]={...a,...s}:n==="className"&&(r[n]=[a,s].filter(Boolean).join(" "))}return{...e,...r}}function _v(e){var t,r;let n=(t=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:t.get,a=n&&"isReactWarning"in n&&n.isReactWarning;return a?e.ref:(n=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,a=n&&"isReactWarning"in n&&n.isReactWarning,a?e.props.ref:e.props.ref||e.ref)}var Iv=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],we=Iv.reduce((e,t)=>{const r=Cn(`Primitive.${t}`),n=g.forwardRef((a,s)=>{const{asChild:i,...l}=a,c=i?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:s})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function Ov(e,t){e&&ao.flushSync(()=>e.dispatchEvent(t))}var co="Checkbox",[Fv]=_t(co),[zv,Ei]=Fv(co);function Lv(e){const{__scopeCheckbox:t,checked:r,children:n,defaultChecked:a,disabled:s,form:i,name:l,onCheckedChange:c,required:d,value:u="on",internal_do_not_use_render:m}=e,[p,f]=cr({prop:r,defaultProp:a??!1,onChange:c,caller:co}),[v,h]=g.useState(null),[x,b]=g.useState(null),y=g.useRef(!1),j=v?!!i||!!v.closest("form"):!0,w={checked:p,disabled:s,setChecked:f,control:v,setControl:h,name:l,form:i,value:u,hasConsumerStoppedPropagationRef:y,required:d,defaultChecked:Pr(a)?!1:a,isFormControl:j,bubbleInput:x,setBubbleInput:b};return o.jsx(zv,{scope:t,...w,children:Mv(m)?m(w):n})}var Iu="CheckboxTrigger",Ou=g.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:r,...n},a)=>{const{control:s,value:i,disabled:l,checked:c,required:d,setControl:u,setChecked:m,hasConsumerStoppedPropagationRef:p,isFormControl:f,bubbleInput:v}=Ei(Iu,e),h=ke(a,u),x=g.useRef(c);return g.useEffect(()=>{const b=s==null?void 0:s.form;if(b){const y=()=>m(x.current);return b.addEventListener("reset",y),()=>b.removeEventListener("reset",y)}},[s,m]),o.jsx(we.button,{type:"button",role:"checkbox","aria-checked":Pr(c)?"mixed":c,"aria-required":d,"data-state":Vu(c),"data-disabled":l?"":void 0,disabled:l,value:i,...n,ref:h,onKeyDown:ge(t,b=>{b.key==="Enter"&&b.preventDefault()}),onClick:ge(r,b=>{m(y=>Pr(y)?!0:!y),v&&f&&(p.current=b.isPropagationStopped(),p.current||b.stopPropagation())})})});Ou.displayName=Iu;var Ti=g.forwardRef((e,t)=>{const{__scopeCheckbox:r,name:n,checked:a,defaultChecked:s,required:i,disabled:l,value:c,onCheckedChange:d,form:u,...m}=e;return o.jsx(Lv,{__scopeCheckbox:r,checked:a,defaultChecked:s,disabled:l,required:i,onCheckedChange:d,name:n,form:u,value:c,internal_do_not_use_render:({isFormControl:p})=>o.jsxs(o.Fragment,{children:[o.jsx(Ou,{...m,ref:t,__scopeCheckbox:r}),p&&o.jsx(Mu,{__scopeCheckbox:r})]})})});Ti.displayName=co;var Fu="CheckboxIndicator",zu=g.forwardRef((e,t)=>{const{__scopeCheckbox:r,forceMount:n,...a}=e,s=Ei(Fu,r);return o.jsx(It,{present:n||Pr(s.checked)||s.checked===!0,children:o.jsx(we.span,{"data-state":Vu(s.checked),"data-disabled":s.disabled?"":void 0,...a,ref:t,style:{pointerEvents:"none",...e.style}})})});zu.displayName=Fu;var Lu="CheckboxBubbleInput",Mu=g.forwardRef(({__scopeCheckbox:e,...t},r)=>{const{control:n,hasConsumerStoppedPropagationRef:a,checked:s,defaultChecked:i,required:l,disabled:c,name:d,value:u,form:m,bubbleInput:p,setBubbleInput:f}=Ei(Lu,e),v=ke(r,f),h=na(s),x=aa(n);g.useEffect(()=>{const y=p;if(!y)return;const j=window.HTMLInputElement.prototype,w=Object.getOwnPropertyDescriptor(j,"checked").set,C=!a.current;if(h!==s&&w){const S=new Event("click",{bubbles:C});y.indeterminate=Pr(s),w.call(y,Pr(s)?!1:s),y.dispatchEvent(S)}},[p,h,s,a]);const b=g.useRef(Pr(s)?!1:s);return o.jsx(we.input,{type:"checkbox","aria-hidden":!0,defaultChecked:i??b.current,required:l,disabled:c,name:d,value:u,form:m,...t,tabIndex:-1,ref:v,style:{...t.style,...x,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Mu.displayName=Lu;function Mv(e){return typeof e=="function"}function Pr(e){return e==="indeterminate"}function Vu(e){return Pr(e)?"indeterminate":e?"checked":"unchecked"}const rt=g.forwardRef(({className:e,...t},r)=>o.jsx(Ti,{ref:r,className:K("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:o.jsx(zu,{className:K("flex items-center justify-center text-current"),children:o.jsx(I.Check,{className:"h-4 w-4"})})}));rt.displayName=Ti.displayName;function Ai(e){const t=e+"CollectionProvider",[r,n]=_t(t),[a,s]=r(t,{collectionRef:{current:null},itemMap:new Map}),i=h=>{const{scope:x,children:b}=h,y=N.useRef(null),j=N.useRef(new Map).current;return o.jsx(a,{scope:x,itemMap:j,collectionRef:y,children:b})};i.displayName=t;const l=e+"CollectionSlot",c=Cn(l),d=N.forwardRef((h,x)=>{const{scope:b,children:y}=h,j=s(l,b),w=ke(x,j.collectionRef);return o.jsx(c,{ref:w,children:y})});d.displayName=l;const u=e+"CollectionItemSlot",m="data-radix-collection-item",p=Cn(u),f=N.forwardRef((h,x)=>{const{scope:b,children:y,...j}=h,w=N.useRef(null),C=ke(x,w),S=s(u,b);return N.useEffect(()=>(S.itemMap.set(w,{ref:w,...j}),()=>void S.itemMap.delete(w))),o.jsx(p,{[m]:"",ref:C,children:y})});f.displayName=u;function v(h){const x=s(e+"CollectionConsumer",h);return N.useCallback(()=>{const b=x.collectionRef.current;if(!b)return[];const y=Array.from(b.querySelectorAll(`[${m}]`));return Array.from(x.itemMap.values()).sort((j,w)=>y.indexOf(j.ref.current)-y.indexOf(w.ref.current))},[x.collectionRef,x.itemMap])}return[{Provider:i,Slot:d,ItemSlot:f},v,n]}var Vv=g[" useId ".trim().toString()]||(()=>{}),Bv=0;function yr(e){const[t,r]=g.useState(Vv());return lt(()=>{r(n=>n??String(Bv++))},[e]),t?`radix-${t}`:""}function ft(e){const t=g.useRef(e);return g.useEffect(()=>{t.current=e}),g.useMemo(()=>(...r)=>{var n;return(n=t.current)==null?void 0:n.call(t,...r)},[])}var Uv=g.createContext(void 0);function oa(e){const t=g.useContext(Uv);return e||t||"ltr"}var ns="rovingFocusGroup.onEntryFocus",Hv={bubbles:!1,cancelable:!0},sa="RovingFocusGroup",[Vs,Bu,Wv]=Ai(sa),[qv,Uu]=_t(sa,[Wv]),[Gv,Xv]=qv(sa),Hu=g.forwardRef((e,t)=>o.jsx(Vs.Provider,{scope:e.__scopeRovingFocusGroup,children:o.jsx(Vs.Slot,{scope:e.__scopeRovingFocusGroup,children:o.jsx(Zv,{...e,ref:t})})}));Hu.displayName=sa;var Zv=g.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,orientation:n,loop:a=!1,dir:s,currentTabStopId:i,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:d,preventScrollOnEntryFocus:u=!1,...m}=e,p=g.useRef(null),f=ke(t,p),v=oa(s),[h,x]=cr({prop:i,defaultProp:l??null,onChange:c,caller:sa}),[b,y]=g.useState(!1),j=ft(d),w=Bu(r),C=g.useRef(!1),[S,$]=g.useState(0);return g.useEffect(()=>{const k=p.current;if(k)return k.addEventListener(ns,j),()=>k.removeEventListener(ns,j)},[j]),o.jsx(Gv,{scope:r,orientation:n,dir:v,loop:a,currentTabStopId:h,onItemFocus:g.useCallback(k=>x(k),[x]),onItemShiftTab:g.useCallback(()=>y(!0),[]),onFocusableItemAdd:g.useCallback(()=>$(k=>k+1),[]),onFocusableItemRemove:g.useCallback(()=>$(k=>k-1),[]),children:o.jsx(we.div,{tabIndex:b||S===0?-1:0,"data-orientation":n,...m,ref:f,style:{outline:"none",...e.style},onMouseDown:ge(e.onMouseDown,()=>{C.current=!0}),onFocus:ge(e.onFocus,k=>{const E=!C.current;if(k.target===k.currentTarget&&E&&!b){const T=new CustomEvent(ns,Hv);if(k.currentTarget.dispatchEvent(T),!T.defaultPrevented){const O=w().filter(X=>X.focusable),L=O.find(X=>X.active),A=O.find(X=>X.id===h),z=[L,A,...O].filter(Boolean).map(X=>X.ref.current);Gu(z,u)}}C.current=!1}),onBlur:ge(e.onBlur,()=>y(!1))})})}),Wu="RovingFocusGroupItem",qu=g.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:n=!0,active:a=!1,tabStopId:s,children:i,...l}=e,c=yr(),d=s||c,u=Xv(Wu,r),m=u.currentTabStopId===d,p=Bu(r),{onFocusableItemAdd:f,onFocusableItemRemove:v,currentTabStopId:h}=u;return g.useEffect(()=>{if(n)return f(),()=>v()},[n,f,v]),o.jsx(Vs.ItemSlot,{scope:r,id:d,focusable:n,active:a,children:o.jsx(we.span,{tabIndex:m?0:-1,"data-orientation":u.orientation,...l,ref:t,onMouseDown:ge(e.onMouseDown,x=>{n?u.onItemFocus(d):x.preventDefault()}),onFocus:ge(e.onFocus,()=>u.onItemFocus(d)),onKeyDown:ge(e.onKeyDown,x=>{if(x.key==="Tab"&&x.shiftKey){u.onItemShiftTab();return}if(x.target!==x.currentTarget)return;const b=Jv(x,u.orientation,u.dir);if(b!==void 0){if(x.metaKey||x.ctrlKey||x.altKey||x.shiftKey)return;x.preventDefault();let y=p().filter(j=>j.focusable).map(j=>j.ref.current);if(b==="last")y.reverse();else if(b==="prev"||b==="next"){b==="prev"&&y.reverse();const j=y.indexOf(x.currentTarget);y=u.loop?Qv(y,j+1):y.slice(j+1)}setTimeout(()=>Gu(y))}}),children:typeof i=="function"?i({isCurrentTabStop:m,hasTabStop:h!=null}):i})})});qu.displayName=Wu;var Kv={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Yv(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Jv(e,t,r){const n=Yv(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return Kv[n]}function Gu(e,t=!1){const r=document.activeElement;for(const n of e)if(n===r||(n.focus({preventScroll:t}),document.activeElement!==r))return}function Qv(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var eb=Hu,tb=qu,Di="Radio",[rb,Xu]=_t(Di),[nb,ab]=rb(Di),Zu=g.forwardRef((e,t)=>{const{__scopeRadio:r,name:n,checked:a=!1,required:s,disabled:i,value:l="on",onCheck:c,form:d,...u}=e,[m,p]=g.useState(null),f=ke(t,x=>p(x)),v=g.useRef(!1),h=m?d||!!m.closest("form"):!0;return o.jsxs(nb,{scope:r,checked:a,disabled:i,children:[o.jsx(we.button,{type:"button",role:"radio","aria-checked":a,"data-state":Qu(a),"data-disabled":i?"":void 0,disabled:i,value:l,...u,ref:f,onClick:ge(e.onClick,x=>{a||c==null||c(),h&&(v.current=x.isPropagationStopped(),v.current||x.stopPropagation())})}),h&&o.jsx(Ju,{control:m,bubbles:!v.current,name:n,value:l,checked:a,required:s,disabled:i,form:d,style:{transform:"translateX(-100%)"}})]})});Zu.displayName=Di;var Ku="RadioIndicator",Yu=g.forwardRef((e,t)=>{const{__scopeRadio:r,forceMount:n,...a}=e,s=ab(Ku,r);return o.jsx(It,{present:n||s.checked,children:o.jsx(we.span,{"data-state":Qu(s.checked),"data-disabled":s.disabled?"":void 0,...a,ref:t})})});Yu.displayName=Ku;var ob="RadioBubbleInput",Ju=g.forwardRef(({__scopeRadio:e,control:t,checked:r,bubbles:n=!0,...a},s)=>{const i=g.useRef(null),l=ke(i,s),c=na(r),d=aa(t);return g.useEffect(()=>{const u=i.current;if(!u)return;const m=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(m,"checked").set;if(c!==r&&p){const f=new Event("click",{bubbles:n});p.call(u,r),u.dispatchEvent(f)}},[c,r,n]),o.jsx(we.input,{type:"radio","aria-hidden":!0,defaultChecked:r,...a,tabIndex:-1,ref:l,style:{...a.style,...d,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});Ju.displayName=ob;function Qu(e){return e?"checked":"unchecked"}var sb=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],uo="RadioGroup",[ib]=_t(uo,[Uu,Xu]),em=Uu(),tm=Xu(),[lb,cb]=ib(uo),rm=g.forwardRef((e,t)=>{const{__scopeRadioGroup:r,name:n,defaultValue:a,value:s,required:i=!1,disabled:l=!1,orientation:c,dir:d,loop:u=!0,onValueChange:m,...p}=e,f=em(r),v=oa(d),[h,x]=cr({prop:s,defaultProp:a??null,onChange:m,caller:uo});return o.jsx(lb,{scope:r,name:n,required:i,disabled:l,value:h,onValueChange:x,children:o.jsx(eb,{asChild:!0,...f,orientation:c,dir:v,loop:u,children:o.jsx(we.div,{role:"radiogroup","aria-required":i,"aria-orientation":c,"data-disabled":l?"":void 0,dir:v,...p,ref:t})})})});rm.displayName=uo;var nm="RadioGroupItem",am=g.forwardRef((e,t)=>{const{__scopeRadioGroup:r,disabled:n,...a}=e,s=cb(nm,r),i=s.disabled||n,l=em(r),c=tm(r),d=g.useRef(null),u=ke(t,d),m=s.value===a.value,p=g.useRef(!1);return g.useEffect(()=>{const f=h=>{sb.includes(h.key)&&(p.current=!0)},v=()=>p.current=!1;return document.addEventListener("keydown",f),document.addEventListener("keyup",v),()=>{document.removeEventListener("keydown",f),document.removeEventListener("keyup",v)}},[]),o.jsx(tb,{asChild:!0,...l,focusable:!i,active:m,children:o.jsx(Zu,{disabled:i,required:s.required,checked:m,...c,...a,name:s.name,ref:u,onCheck:()=>s.onValueChange(a.value),onKeyDown:ge(f=>{f.key==="Enter"&&f.preventDefault()}),onFocus:ge(a.onFocus,()=>{var f;p.current&&((f=d.current)==null||f.click())})})})});am.displayName=nm;var db="RadioGroupIndicator",om=g.forwardRef((e,t)=>{const{__scopeRadioGroup:r,...n}=e,a=tm(r);return o.jsx(Yu,{...a,...n,ref:t})});om.displayName=db;var sm=rm,im=am,ub=om;const Ri=g.forwardRef(({className:e,...t},r)=>o.jsx(sm,{className:K("grid gap-2",e),...t,ref:r}));Ri.displayName=sm.displayName;const Pi=g.forwardRef(({className:e,...t},r)=>o.jsx(im,{ref:r,className:K("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:o.jsx(ub,{className:"flex items-center justify-center",children:o.jsx(I.Circle,{className:"h-2.5 w-2.5 fill-current text-current"})})}));Pi.displayName=im.displayName;var mo="Switch",[mb]=_t(mo),[pb,fb]=mb(mo),lm=g.forwardRef((e,t)=>{const{__scopeSwitch:r,name:n,checked:a,defaultChecked:s,required:i,disabled:l,value:c="on",onCheckedChange:d,form:u,...m}=e,[p,f]=g.useState(null),v=ke(t,j=>f(j)),h=g.useRef(!1),x=p?u||!!p.closest("form"):!0,[b,y]=cr({prop:a,defaultProp:s??!1,onChange:d,caller:mo});return o.jsxs(pb,{scope:r,checked:b,disabled:l,children:[o.jsx(we.button,{type:"button",role:"switch","aria-checked":b,"aria-required":i,"data-state":mm(b),"data-disabled":l?"":void 0,disabled:l,value:c,...m,ref:v,onClick:ge(e.onClick,j=>{y(w=>!w),x&&(h.current=j.isPropagationStopped(),h.current||j.stopPropagation())})}),x&&o.jsx(um,{control:p,bubbles:!h.current,name:n,value:c,checked:b,required:i,disabled:l,form:u,style:{transform:"translateX(-100%)"}})]})});lm.displayName=mo;var cm="SwitchThumb",dm=g.forwardRef((e,t)=>{const{__scopeSwitch:r,...n}=e,a=fb(cm,r);return o.jsx(we.span,{"data-state":mm(a.checked),"data-disabled":a.disabled?"":void 0,...n,ref:t})});dm.displayName=cm;var hb="SwitchBubbleInput",um=g.forwardRef(({__scopeSwitch:e,control:t,checked:r,bubbles:n=!0,...a},s)=>{const i=g.useRef(null),l=ke(i,s),c=na(r),d=aa(t);return g.useEffect(()=>{const u=i.current;if(!u)return;const m=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(m,"checked").set;if(c!==r&&p){const f=new Event("click",{bubbles:n});p.call(u,r),u.dispatchEvent(f)}},[c,r,n]),o.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...a,tabIndex:-1,ref:l,style:{...a.style,...d,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});um.displayName=hb;function mm(e){return e?"checked":"unchecked"}var pm=lm,xb=dm;const _i=g.forwardRef(({className:e,...t},r)=>o.jsx(pm,{ref:r,className:K("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,children:o.jsx(xb,{className:K("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));_i.displayName=pm.displayName;function Yn(e,[t,r]){return Math.min(r,Math.max(t,e))}function gb(e,t=globalThis==null?void 0:globalThis.document){const r=ft(e);g.useEffect(()=>{const n=a=>{a.key==="Escape"&&r(a)};return t.addEventListener("keydown",n,{capture:!0}),()=>t.removeEventListener("keydown",n,{capture:!0})},[r,t])}var vb="DismissableLayer",Bs="dismissableLayer.update",bb="dismissableLayer.pointerDownOutside",yb="dismissableLayer.focusOutside",sc,fm=g.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),ia=g.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:a,onFocusOutside:s,onInteractOutside:i,onDismiss:l,...c}=e,d=g.useContext(fm),[u,m]=g.useState(null),p=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,f]=g.useState({}),v=ke(t,$=>m($)),h=Array.from(d.layers),[x]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),b=h.indexOf(x),y=u?h.indexOf(u):-1,j=d.layersWithOutsidePointerEventsDisabled.size>0,w=y>=b,C=kb($=>{const k=$.target,E=[...d.branches].some(T=>T.contains(k));!w||E||(a==null||a($),i==null||i($),$.defaultPrevented||l==null||l())},p),S=Cb($=>{const k=$.target;[...d.branches].some(E=>E.contains(k))||(s==null||s($),i==null||i($),$.defaultPrevented||l==null||l())},p);return gb($=>{y===d.layers.size-1&&(n==null||n($),!$.defaultPrevented&&l&&($.preventDefault(),l()))},p),g.useEffect(()=>{if(u)return r&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(sc=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(u)),d.layers.add(u),ic(),()=>{r&&d.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=sc)}},[u,p,r,d]),g.useEffect(()=>()=>{u&&(d.layers.delete(u),d.layersWithOutsidePointerEventsDisabled.delete(u),ic())},[u,d]),g.useEffect(()=>{const $=()=>f({});return document.addEventListener(Bs,$),()=>document.removeEventListener(Bs,$)},[]),o.jsx(we.div,{...c,ref:v,style:{pointerEvents:j?w?"auto":"none":void 0,...e.style},onFocusCapture:ge(e.onFocusCapture,S.onFocusCapture),onBlurCapture:ge(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:ge(e.onPointerDownCapture,C.onPointerDownCapture)})});ia.displayName=vb;var wb="DismissableLayerBranch",jb=g.forwardRef((e,t)=>{const r=g.useContext(fm),n=g.useRef(null),a=ke(t,n);return g.useEffect(()=>{const s=n.current;if(s)return r.branches.add(s),()=>{r.branches.delete(s)}},[r.branches]),o.jsx(we.div,{...e,ref:a})});jb.displayName=wb;function kb(e,t=globalThis==null?void 0:globalThis.document){const r=ft(e),n=g.useRef(!1),a=g.useRef(()=>{});return g.useEffect(()=>{const s=l=>{if(l.target&&!n.current){let c=function(){hm(bb,r,d,{discrete:!0})};const d={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",a.current),a.current=c,t.addEventListener("click",a.current,{once:!0})):c()}else t.removeEventListener("click",a.current);n.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",s),t.removeEventListener("click",a.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function Cb(e,t=globalThis==null?void 0:globalThis.document){const r=ft(e),n=g.useRef(!1);return g.useEffect(()=>{const a=s=>{s.target&&!n.current&&hm(yb,r,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function ic(){const e=new CustomEvent(Bs);document.dispatchEvent(e)}function hm(e,t,r,{discrete:n}){const a=r.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&a.addEventListener(e,t,{once:!0}),n?Ov(a,s):a.dispatchEvent(s)}var as=0;function Ii(){g.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??lc()),document.body.insertAdjacentElement("beforeend",e[1]??lc()),as++,()=>{as===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),as--}},[])}function lc(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var os="focusScope.autoFocusOnMount",ss="focusScope.autoFocusOnUnmount",cc={bubbles:!1,cancelable:!0},Nb="FocusScope",po=g.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:a,onUnmountAutoFocus:s,...i}=e,[l,c]=g.useState(null),d=ft(a),u=ft(s),m=g.useRef(null),p=ke(t,h=>c(h)),f=g.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;g.useEffect(()=>{if(n){let h=function(j){if(f.paused||!l)return;const w=j.target;l.contains(w)?m.current=w:Ar(m.current,{select:!0})},x=function(j){if(f.paused||!l)return;const w=j.relatedTarget;w!==null&&(l.contains(w)||Ar(m.current,{select:!0}))},b=function(j){if(document.activeElement===document.body)for(const w of j)w.removedNodes.length>0&&Ar(l)};document.addEventListener("focusin",h),document.addEventListener("focusout",x);const y=new MutationObserver(b);return l&&y.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",h),document.removeEventListener("focusout",x),y.disconnect()}}},[n,l,f.paused]),g.useEffect(()=>{if(l){uc.add(f);const h=document.activeElement;if(!l.contains(h)){const x=new CustomEvent(os,cc);l.addEventListener(os,d),l.dispatchEvent(x),x.defaultPrevented||(Sb(Db(xm(l)),{select:!0}),document.activeElement===h&&Ar(l))}return()=>{l.removeEventListener(os,d),setTimeout(()=>{const x=new CustomEvent(ss,cc);l.addEventListener(ss,u),l.dispatchEvent(x),x.defaultPrevented||Ar(h??document.body,{select:!0}),l.removeEventListener(ss,u),uc.remove(f)},0)}}},[l,d,u,f]);const v=g.useCallback(h=>{if(!r&&!n||f.paused)return;const x=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,b=document.activeElement;if(x&&b){const y=h.currentTarget,[j,w]=$b(y);j&&w?!h.shiftKey&&b===w?(h.preventDefault(),r&&Ar(j,{select:!0})):h.shiftKey&&b===j&&(h.preventDefault(),r&&Ar(w,{select:!0})):b===y&&h.preventDefault()}},[r,n,f.paused]);return o.jsx(we.div,{tabIndex:-1,...i,ref:p,onKeyDown:v})});po.displayName=Nb;function Sb(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(Ar(n,{select:t}),document.activeElement!==r)return}function $b(e){const t=xm(e),r=dc(t,e),n=dc(t.reverse(),e);return[r,n]}function xm(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const a=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||a?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function dc(e,t){for(const r of e)if(!Eb(r,{upTo:t}))return r}function Eb(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function Tb(e){return e instanceof HTMLInputElement&&"select"in e}function Ar(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&Tb(e)&&t&&e.select()}}var uc=Ab();function Ab(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=mc(e,t),e.unshift(t)},remove(t){var r;e=mc(e,t),(r=e[0])==null||r.resume()}}}function mc(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function Db(e){return e.filter(t=>t.tagName!=="A")}const Rb=["top","right","bottom","left"],Or=Math.min,$t=Math.max,za=Math.round,ya=Math.floor,lr=e=>({x:e,y:e}),Pb={left:"right",right:"left",bottom:"top",top:"bottom"};function Us(e,t,r){return $t(e,Or(t,r))}function wr(e,t){return typeof e=="function"?e(t):e}function jr(e){return e.split("-")[0]}function Rn(e){return e.split("-")[1]}function Oi(e){return e==="x"?"y":"x"}function Fi(e){return e==="y"?"height":"width"}function ir(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function zi(e){return Oi(ir(e))}function _b(e,t,r){r===void 0&&(r=!1);const n=Rn(e),a=zi(e),s=Fi(a);let i=a==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=La(i)),[i,La(i)]}function Ib(e){const t=La(e);return[Hs(e),t,Hs(t)]}function Hs(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const pc=["left","right"],fc=["right","left"],Ob=["top","bottom"],Fb=["bottom","top"];function zb(e,t,r){switch(e){case"top":case"bottom":return r?t?fc:pc:t?pc:fc;case"left":case"right":return t?Ob:Fb;default:return[]}}function Lb(e,t,r,n){const a=Rn(e);let s=zb(jr(e),r==="start",n);return a&&(s=s.map(i=>i+"-"+a),t&&(s=s.concat(s.map(Hs)))),s}function La(e){const t=jr(e);return Pb[t]+e.slice(t.length)}function Mb(e){return{top:0,right:0,bottom:0,left:0,...e}}function gm(e){return typeof e!="number"?Mb(e):{top:e,right:e,bottom:e,left:e}}function Ma(e){const{x:t,y:r,width:n,height:a}=e;return{width:n,height:a,top:r,left:t,right:t+n,bottom:r+a,x:t,y:r}}function hc(e,t,r){let{reference:n,floating:a}=e;const s=ir(t),i=zi(t),l=Fi(i),c=jr(t),d=s==="y",u=n.x+n.width/2-a.width/2,m=n.y+n.height/2-a.height/2,p=n[l]/2-a[l]/2;let f;switch(c){case"top":f={x:u,y:n.y-a.height};break;case"bottom":f={x:u,y:n.y+n.height};break;case"right":f={x:n.x+n.width,y:m};break;case"left":f={x:n.x-a.width,y:m};break;default:f={x:n.x,y:n.y}}switch(Rn(t)){case"start":f[i]-=p*(r&&d?-1:1);break;case"end":f[i]+=p*(r&&d?-1:1);break}return f}async function Vb(e,t){var r;t===void 0&&(t={});const{x:n,y:a,platform:s,rects:i,elements:l,strategy:c}=e,{boundary:d="clippingAncestors",rootBoundary:u="viewport",elementContext:m="floating",altBoundary:p=!1,padding:f=0}=wr(t,e),v=gm(f),h=l[p?m==="floating"?"reference":"floating":m],x=Ma(await s.getClippingRect({element:(r=await(s.isElement==null?void 0:s.isElement(h)))==null||r?h:h.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:d,rootBoundary:u,strategy:c})),b=m==="floating"?{x:n,y:a,width:i.floating.width,height:i.floating.height}:i.reference,y=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),j=await(s.isElement==null?void 0:s.isElement(y))?await(s.getScale==null?void 0:s.getScale(y))||{x:1,y:1}:{x:1,y:1},w=Ma(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:b,offsetParent:y,strategy:c}):b);return{top:(x.top-w.top+v.top)/j.y,bottom:(w.bottom-x.bottom+v.bottom)/j.y,left:(x.left-w.left+v.left)/j.x,right:(w.right-x.right+v.right)/j.x}}const Bb=50,Ub=async(e,t,r)=>{const{placement:n="bottom",strategy:a="absolute",middleware:s=[],platform:i}=r,l=i.detectOverflow?i:{...i,detectOverflow:Vb},c=await(i.isRTL==null?void 0:i.isRTL(t));let d=await i.getElementRects({reference:e,floating:t,strategy:a}),{x:u,y:m}=hc(d,n,c),p=n,f=0;const v={};for(let h=0;h<s.length;h++){const x=s[h];if(!x)continue;const{name:b,fn:y}=x,{x:j,y:w,data:C,reset:S}=await y({x:u,y:m,initialPlacement:n,placement:p,strategy:a,middlewareData:v,rects:d,platform:l,elements:{reference:e,floating:t}});u=j??u,m=w??m,v[b]={...v[b],...C},S&&f<Bb&&(f++,typeof S=="object"&&(S.placement&&(p=S.placement),S.rects&&(d=S.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:a}):S.rects),{x:u,y:m}=hc(d,p,c)),h=-1)}return{x:u,y:m,placement:p,strategy:a,middlewareData:v}},Hb=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:n,placement:a,rects:s,platform:i,elements:l,middlewareData:c}=t,{element:d,padding:u=0}=wr(e,t)||{};if(d==null)return{};const m=gm(u),p={x:r,y:n},f=zi(a),v=Fi(f),h=await i.getDimensions(d),x=f==="y",b=x?"top":"left",y=x?"bottom":"right",j=x?"clientHeight":"clientWidth",w=s.reference[v]+s.reference[f]-p[f]-s.floating[v],C=p[f]-s.reference[f],S=await(i.getOffsetParent==null?void 0:i.getOffsetParent(d));let $=S?S[j]:0;(!$||!await(i.isElement==null?void 0:i.isElement(S)))&&($=l.floating[j]||s.floating[v]);const k=w/2-C/2,E=$/2-h[v]/2-1,T=Or(m[b],E),O=Or(m[y],E),L=T,A=$-h[v]-O,z=$/2-h[v]/2+k,X=Us(L,z,A),q=!c.arrow&&Rn(a)!=null&&z!==X&&s.reference[v]/2-(z<L?T:O)-h[v]/2<0,Z=q?z<L?z-L:z-A:0;return{[f]:p[f]+Z,data:{[f]:X,centerOffset:z-X-Z,...q&&{alignmentOffset:Z}},reset:q}}}),Wb=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,n;const{placement:a,middlewareData:s,rects:i,initialPlacement:l,platform:c,elements:d}=t,{mainAxis:u=!0,crossAxis:m=!0,fallbackPlacements:p,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:h=!0,...x}=wr(e,t);if((r=s.arrow)!=null&&r.alignmentOffset)return{};const b=jr(a),y=ir(l),j=jr(l)===l,w=await(c.isRTL==null?void 0:c.isRTL(d.floating)),C=p||(j||!h?[La(l)]:Ib(l)),S=v!=="none";!p&&S&&C.push(...Lb(l,h,v,w));const $=[l,...C],k=await c.detectOverflow(t,x),E=[];let T=((n=s.flip)==null?void 0:n.overflows)||[];if(u&&E.push(k[b]),m){const z=_b(a,i,w);E.push(k[z[0]],k[z[1]])}if(T=[...T,{placement:a,overflows:E}],!E.every(z=>z<=0)){var O,L;const z=(((O=s.flip)==null?void 0:O.index)||0)+1,X=$[z];if(X&&(!(m==="alignment"&&y!==ir(X))||T.every(Z=>ir(Z.placement)===y?Z.overflows[0]>0:!0)))return{data:{index:z,overflows:T},reset:{placement:X}};let q=(L=T.filter(Z=>Z.overflows[0]<=0).sort((Z,V)=>Z.overflows[1]-V.overflows[1])[0])==null?void 0:L.placement;if(!q)switch(f){case"bestFit":{var A;const Z=(A=T.filter(V=>{if(S){const M=ir(V.placement);return M===y||M==="y"}return!0}).map(V=>[V.placement,V.overflows.filter(M=>M>0).reduce((M,_)=>M+_,0)]).sort((V,M)=>V[1]-M[1])[0])==null?void 0:A[0];Z&&(q=Z);break}case"initialPlacement":q=l;break}if(a!==q)return{reset:{placement:q}}}return{}}}};function xc(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function gc(e){return Rb.some(t=>e[t]>=0)}const qb=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r,platform:n}=t,{strategy:a="referenceHidden",...s}=wr(e,t);switch(a){case"referenceHidden":{const i=await n.detectOverflow(t,{...s,elementContext:"reference"}),l=xc(i,r.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:gc(l)}}}case"escaped":{const i=await n.detectOverflow(t,{...s,altBoundary:!0}),l=xc(i,r.floating);return{data:{escapedOffsets:l,escaped:gc(l)}}}default:return{}}}}},vm=new Set(["left","top"]);async function Gb(e,t){const{placement:r,platform:n,elements:a}=e,s=await(n.isRTL==null?void 0:n.isRTL(a.floating)),i=jr(r),l=Rn(r),c=ir(r)==="y",d=vm.has(i)?-1:1,u=s&&c?-1:1,m=wr(t,e);let{mainAxis:p,crossAxis:f,alignmentAxis:v}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return l&&typeof v=="number"&&(f=l==="end"?v*-1:v),c?{x:f*u,y:p*d}:{x:p*d,y:f*u}}const Xb=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,n;const{x:a,y:s,placement:i,middlewareData:l}=t,c=await Gb(t,e);return i===((r=l.offset)==null?void 0:r.placement)&&(n=l.arrow)!=null&&n.alignmentOffset?{}:{x:a+c.x,y:s+c.y,data:{...c,placement:i}}}}},Zb=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:n,placement:a,platform:s}=t,{mainAxis:i=!0,crossAxis:l=!1,limiter:c={fn:b=>{let{x:y,y:j}=b;return{x:y,y:j}}},...d}=wr(e,t),u={x:r,y:n},m=await s.detectOverflow(t,d),p=ir(jr(a)),f=Oi(p);let v=u[f],h=u[p];if(i){const b=f==="y"?"top":"left",y=f==="y"?"bottom":"right",j=v+m[b],w=v-m[y];v=Us(j,v,w)}if(l){const b=p==="y"?"top":"left",y=p==="y"?"bottom":"right",j=h+m[b],w=h-m[y];h=Us(j,h,w)}const x=c.fn({...t,[f]:v,[p]:h});return{...x,data:{x:x.x-r,y:x.y-n,enabled:{[f]:i,[p]:l}}}}}},Kb=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:n,placement:a,rects:s,middlewareData:i}=t,{offset:l=0,mainAxis:c=!0,crossAxis:d=!0}=wr(e,t),u={x:r,y:n},m=ir(a),p=Oi(m);let f=u[p],v=u[m];const h=wr(l,t),x=typeof h=="number"?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){const j=p==="y"?"height":"width",w=s.reference[p]-s.floating[j]+x.mainAxis,C=s.reference[p]+s.reference[j]-x.mainAxis;f<w?f=w:f>C&&(f=C)}if(d){var b,y;const j=p==="y"?"width":"height",w=vm.has(jr(a)),C=s.reference[m]-s.floating[j]+(w&&((b=i.offset)==null?void 0:b[m])||0)+(w?0:x.crossAxis),S=s.reference[m]+s.reference[j]+(w?0:((y=i.offset)==null?void 0:y[m])||0)-(w?x.crossAxis:0);v<C?v=C:v>S&&(v=S)}return{[p]:f,[m]:v}}}},Yb=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,n;const{placement:a,rects:s,platform:i,elements:l}=t,{apply:c=()=>{},...d}=wr(e,t),u=await i.detectOverflow(t,d),m=jr(a),p=Rn(a),f=ir(a)==="y",{width:v,height:h}=s.floating;let x,b;m==="top"||m==="bottom"?(x=m,b=p===(await(i.isRTL==null?void 0:i.isRTL(l.floating))?"start":"end")?"left":"right"):(b=m,x=p==="end"?"top":"bottom");const y=h-u.top-u.bottom,j=v-u.left-u.right,w=Or(h-u[x],y),C=Or(v-u[b],j),S=!t.middlewareData.shift;let $=w,k=C;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(k=j),(n=t.middlewareData.shift)!=null&&n.enabled.y&&($=y),S&&!p){const T=$t(u.left,0),O=$t(u.right,0),L=$t(u.top,0),A=$t(u.bottom,0);f?k=v-2*(T!==0||O!==0?T+O:$t(u.left,u.right)):$=h-2*(L!==0||A!==0?L+A:$t(u.top,u.bottom))}await c({...t,availableWidth:k,availableHeight:$});const E=await i.getDimensions(l.floating);return v!==E.width||h!==E.height?{reset:{rects:!0}}:{}}}};function fo(){return typeof window<"u"}function Pn(e){return bm(e)?(e.nodeName||"").toLowerCase():"#document"}function At(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function mr(e){var t;return(t=(bm(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function bm(e){return fo()?e instanceof Node||e instanceof At(e).Node:!1}function Yt(e){return fo()?e instanceof Element||e instanceof At(e).Element:!1}function kr(e){return fo()?e instanceof HTMLElement||e instanceof At(e).HTMLElement:!1}function vc(e){return!fo()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof At(e).ShadowRoot}function la(e){const{overflow:t,overflowX:r,overflowY:n,display:a}=Jt(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&a!=="inline"&&a!=="contents"}function Jb(e){return/^(table|td|th)$/.test(Pn(e))}function ho(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Qb=/transform|translate|scale|rotate|perspective|filter/,ey=/paint|layout|strict|content/,qr=e=>!!e&&e!=="none";let is;function Li(e){const t=Yt(e)?Jt(e):e;return qr(t.transform)||qr(t.translate)||qr(t.scale)||qr(t.rotate)||qr(t.perspective)||!Mi()&&(qr(t.backdropFilter)||qr(t.filter))||Qb.test(t.willChange||"")||ey.test(t.contain||"")}function ty(e){let t=Fr(e);for(;kr(t)&&!Nn(t);){if(Li(t))return t;if(ho(t))return null;t=Fr(t)}return null}function Mi(){return is==null&&(is=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),is}function Nn(e){return/^(html|body|#document)$/.test(Pn(e))}function Jt(e){return At(e).getComputedStyle(e)}function xo(e){return Yt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Fr(e){if(Pn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||vc(e)&&e.host||mr(e);return vc(t)?t.host:t}function ym(e){const t=Fr(e);return Nn(t)?e.ownerDocument?e.ownerDocument.body:e.body:kr(t)&&la(t)?t:ym(t)}function Jn(e,t,r){var n;t===void 0&&(t=[]),r===void 0&&(r=!0);const a=ym(e),s=a===((n=e.ownerDocument)==null?void 0:n.body),i=At(a);if(s){const l=Ws(i);return t.concat(i,i.visualViewport||[],la(a)?a:[],l&&r?Jn(l):[])}else return t.concat(a,Jn(a,[],r))}function Ws(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function wm(e){const t=Jt(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const a=kr(e),s=a?e.offsetWidth:r,i=a?e.offsetHeight:n,l=za(r)!==s||za(n)!==i;return l&&(r=s,n=i),{width:r,height:n,$:l}}function Vi(e){return Yt(e)?e:e.contextElement}function wn(e){const t=Vi(e);if(!kr(t))return lr(1);const r=t.getBoundingClientRect(),{width:n,height:a,$:s}=wm(t);let i=(s?za(r.width):r.width)/n,l=(s?za(r.height):r.height)/a;return(!i||!Number.isFinite(i))&&(i=1),(!l||!Number.isFinite(l))&&(l=1),{x:i,y:l}}const ry=lr(0);function jm(e){const t=At(e);return!Mi()||!t.visualViewport?ry:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function ny(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==At(e)?!1:t}function Qr(e,t,r,n){t===void 0&&(t=!1),r===void 0&&(r=!1);const a=e.getBoundingClientRect(),s=Vi(e);let i=lr(1);t&&(n?Yt(n)&&(i=wn(n)):i=wn(e));const l=ny(s,r,n)?jm(s):lr(0);let c=(a.left+l.x)/i.x,d=(a.top+l.y)/i.y,u=a.width/i.x,m=a.height/i.y;if(s){const p=At(s),f=n&&Yt(n)?At(n):n;let v=p,h=Ws(v);for(;h&&n&&f!==v;){const x=wn(h),b=h.getBoundingClientRect(),y=Jt(h),j=b.left+(h.clientLeft+parseFloat(y.paddingLeft))*x.x,w=b.top+(h.clientTop+parseFloat(y.paddingTop))*x.y;c*=x.x,d*=x.y,u*=x.x,m*=x.y,c+=j,d+=w,v=At(h),h=Ws(v)}}return Ma({width:u,height:m,x:c,y:d})}function go(e,t){const r=xo(e).scrollLeft;return t?t.left+r:Qr(mr(e)).left+r}function km(e,t){const r=e.getBoundingClientRect(),n=r.left+t.scrollLeft-go(e,r),a=r.top+t.scrollTop;return{x:n,y:a}}function ay(e){let{elements:t,rect:r,offsetParent:n,strategy:a}=e;const s=a==="fixed",i=mr(n),l=t?ho(t.floating):!1;if(n===i||l&&s)return r;let c={scrollLeft:0,scrollTop:0},d=lr(1);const u=lr(0),m=kr(n);if((m||!m&&!s)&&((Pn(n)!=="body"||la(i))&&(c=xo(n)),m)){const f=Qr(n);d=wn(n),u.x=f.x+n.clientLeft,u.y=f.y+n.clientTop}const p=i&&!m&&!s?km(i,c):lr(0);return{width:r.width*d.x,height:r.height*d.y,x:r.x*d.x-c.scrollLeft*d.x+u.x+p.x,y:r.y*d.y-c.scrollTop*d.y+u.y+p.y}}function oy(e){return Array.from(e.getClientRects())}function sy(e){const t=mr(e),r=xo(e),n=e.ownerDocument.body,a=$t(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),s=$t(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let i=-r.scrollLeft+go(e);const l=-r.scrollTop;return Jt(n).direction==="rtl"&&(i+=$t(t.clientWidth,n.clientWidth)-a),{width:a,height:s,x:i,y:l}}const bc=25;function iy(e,t){const r=At(e),n=mr(e),a=r.visualViewport;let s=n.clientWidth,i=n.clientHeight,l=0,c=0;if(a){s=a.width,i=a.height;const u=Mi();(!u||u&&t==="fixed")&&(l=a.offsetLeft,c=a.offsetTop)}const d=go(n);if(d<=0){const u=n.ownerDocument,m=u.body,p=getComputedStyle(m),f=u.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,v=Math.abs(n.clientWidth-m.clientWidth-f);v<=bc&&(s-=v)}else d<=bc&&(s+=d);return{width:s,height:i,x:l,y:c}}function ly(e,t){const r=Qr(e,!0,t==="fixed"),n=r.top+e.clientTop,a=r.left+e.clientLeft,s=kr(e)?wn(e):lr(1),i=e.clientWidth*s.x,l=e.clientHeight*s.y,c=a*s.x,d=n*s.y;return{width:i,height:l,x:c,y:d}}function yc(e,t,r){let n;if(t==="viewport")n=iy(e,r);else if(t==="document")n=sy(mr(e));else if(Yt(t))n=ly(t,r);else{const a=jm(e);n={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return Ma(n)}function Cm(e,t){const r=Fr(e);return r===t||!Yt(r)||Nn(r)?!1:Jt(r).position==="fixed"||Cm(r,t)}function cy(e,t){const r=t.get(e);if(r)return r;let n=Jn(e,[],!1).filter(l=>Yt(l)&&Pn(l)!=="body"),a=null;const s=Jt(e).position==="fixed";let i=s?Fr(e):e;for(;Yt(i)&&!Nn(i);){const l=Jt(i),c=Li(i);!c&&l.position==="fixed"&&(a=null),(s?!c&&!a:!c&&l.position==="static"&&a&&(a.position==="absolute"||a.position==="fixed")||la(i)&&!c&&Cm(e,i))?n=n.filter(d=>d!==i):a=l,i=Fr(i)}return t.set(e,n),n}function dy(e){let{element:t,boundary:r,rootBoundary:n,strategy:a}=e;const s=[...r==="clippingAncestors"?ho(t)?[]:cy(t,this._c):[].concat(r),n],i=yc(t,s[0],a);let l=i.top,c=i.right,d=i.bottom,u=i.left;for(let m=1;m<s.length;m++){const p=yc(t,s[m],a);l=$t(p.top,l),c=Or(p.right,c),d=Or(p.bottom,d),u=$t(p.left,u)}return{width:c-u,height:d-l,x:u,y:l}}function uy(e){const{width:t,height:r}=wm(e);return{width:t,height:r}}function my(e,t,r){const n=kr(t),a=mr(t),s=r==="fixed",i=Qr(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const c=lr(0);function d(){c.x=go(a)}if(n||!n&&!s)if((Pn(t)!=="body"||la(a))&&(l=xo(t)),n){const f=Qr(t,!0,s,t);c.x=f.x+t.clientLeft,c.y=f.y+t.clientTop}else a&&d();s&&!n&&a&&d();const u=a&&!n&&!s?km(a,l):lr(0),m=i.left+l.scrollLeft-c.x-u.x,p=i.top+l.scrollTop-c.y-u.y;return{x:m,y:p,width:i.width,height:i.height}}function ls(e){return Jt(e).position==="static"}function wc(e,t){if(!kr(e)||Jt(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return mr(e)===r&&(r=r.ownerDocument.body),r}function Nm(e,t){const r=At(e);if(ho(e))return r;if(!kr(e)){let a=Fr(e);for(;a&&!Nn(a);){if(Yt(a)&&!ls(a))return a;a=Fr(a)}return r}let n=wc(e,t);for(;n&&Jb(n)&&ls(n);)n=wc(n,t);return n&&Nn(n)&&ls(n)&&!Li(n)?r:n||ty(e)||r}const py=async function(e){const t=this.getOffsetParent||Nm,r=this.getDimensions,n=await r(e.floating);return{reference:my(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function fy(e){return Jt(e).direction==="rtl"}const hy={convertOffsetParentRelativeRectToViewportRelativeRect:ay,getDocumentElement:mr,getClippingRect:dy,getOffsetParent:Nm,getElementRects:py,getClientRects:oy,getDimensions:uy,getScale:wn,isElement:Yt,isRTL:fy};function Sm(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function xy(e,t){let r=null,n;const a=mr(e);function s(){var l;clearTimeout(n),(l=r)==null||l.disconnect(),r=null}function i(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),s();const d=e.getBoundingClientRect(),{left:u,top:m,width:p,height:f}=d;if(l||t(),!p||!f)return;const v=ya(m),h=ya(a.clientWidth-(u+p)),x=ya(a.clientHeight-(m+f)),b=ya(u),y={rootMargin:-v+"px "+-h+"px "+-x+"px "+-b+"px",threshold:$t(0,Or(1,c))||1};let j=!0;function w(C){const S=C[0].intersectionRatio;if(S!==c){if(!j)return i();S?i(!1,S):n=setTimeout(()=>{i(!1,1e-7)},1e3)}S===1&&!Sm(d,e.getBoundingClientRect())&&i(),j=!1}try{r=new IntersectionObserver(w,{...y,root:a.ownerDocument})}catch{r=new IntersectionObserver(w,y)}r.observe(e)}return i(!0),s}function gy(e,t,r,n){n===void 0&&(n={});const{ancestorScroll:a=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=n,d=Vi(e),u=a||s?[...d?Jn(d):[],...t?Jn(t):[]]:[];u.forEach(b=>{a&&b.addEventListener("scroll",r,{passive:!0}),s&&b.addEventListener("resize",r)});const m=d&&l?xy(d,r):null;let p=-1,f=null;i&&(f=new ResizeObserver(b=>{let[y]=b;y&&y.target===d&&f&&t&&(f.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var j;(j=f)==null||j.observe(t)})),r()}),d&&!c&&f.observe(d),t&&f.observe(t));let v,h=c?Qr(e):null;c&&x();function x(){const b=Qr(e);h&&!Sm(h,b)&&r(),h=b,v=requestAnimationFrame(x)}return r(),()=>{var b;u.forEach(y=>{a&&y.removeEventListener("scroll",r),s&&y.removeEventListener("resize",r)}),m==null||m(),(b=f)==null||b.disconnect(),f=null,c&&cancelAnimationFrame(v)}}const vy=Xb,by=Zb,yy=Wb,wy=Yb,jy=qb,jc=Hb,ky=Kb,Cy=(e,t,r)=>{const n=new Map,a={platform:hy,...r},s={...a.platform,_c:n};return Ub(e,t,{...a,platform:s})};var Ny=typeof document<"u",Sy=function(){},Pa=Ny?N.useLayoutEffect:Sy;function Va(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let r,n,a;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(n=r;n--!==0;)if(!Va(e[n],t[n]))return!1;return!0}if(a=Object.keys(e),r=a.length,r!==Object.keys(t).length)return!1;for(n=r;n--!==0;)if(!{}.hasOwnProperty.call(t,a[n]))return!1;for(n=r;n--!==0;){const s=a[n];if(!(s==="_owner"&&e.$$typeof)&&!Va(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function $m(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function kc(e,t){const r=$m(e);return Math.round(t*r)/r}function cs(e){const t=g.useRef(e);return Pa(()=>{t.current=e}),t}function $y(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:a,elements:{reference:s,floating:i}={},transform:l=!0,whileElementsMounted:c,open:d}=e,[u,m]=g.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[p,f]=g.useState(n);Va(p,n)||f(n);const[v,h]=g.useState(null),[x,b]=g.useState(null),y=g.useCallback(V=>{V!==S.current&&(S.current=V,h(V))},[]),j=g.useCallback(V=>{V!==$.current&&($.current=V,b(V))},[]),w=s||v,C=i||x,S=g.useRef(null),$=g.useRef(null),k=g.useRef(u),E=c!=null,T=cs(c),O=cs(a),L=cs(d),A=g.useCallback(()=>{if(!S.current||!$.current)return;const V={placement:t,strategy:r,middleware:p};O.current&&(V.platform=O.current),Cy(S.current,$.current,V).then(M=>{const _={...M,isPositioned:L.current!==!1};z.current&&!Va(k.current,_)&&(k.current=_,ao.flushSync(()=>{m(_)}))})},[p,t,r,O,L]);Pa(()=>{d===!1&&k.current.isPositioned&&(k.current.isPositioned=!1,m(V=>({...V,isPositioned:!1})))},[d]);const z=g.useRef(!1);Pa(()=>(z.current=!0,()=>{z.current=!1}),[]),Pa(()=>{if(w&&(S.current=w),C&&($.current=C),w&&C){if(T.current)return T.current(w,C,A);A()}},[w,C,A,T,E]);const X=g.useMemo(()=>({reference:S,floating:$,setReference:y,setFloating:j}),[y,j]),q=g.useMemo(()=>({reference:w,floating:C}),[w,C]),Z=g.useMemo(()=>{const V={position:r,left:0,top:0};if(!q.floating)return V;const M=kc(q.floating,u.x),_=kc(q.floating,u.y);return l?{...V,transform:"translate("+M+"px, "+_+"px)",...$m(q.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:M,top:_}},[r,l,q.floating,u.x,u.y]);return g.useMemo(()=>({...u,update:A,refs:X,elements:q,floatingStyles:Z}),[u,A,X,q,Z])}const Ey=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:n,padding:a}=typeof e=="function"?e(r):e;return n&&t(n)?n.current!=null?jc({element:n.current,padding:a}).fn(r):{}:n?jc({element:n,padding:a}).fn(r):{}}}},Ty=(e,t)=>{const r=vy(e);return{name:r.name,fn:r.fn,options:[e,t]}},Ay=(e,t)=>{const r=by(e);return{name:r.name,fn:r.fn,options:[e,t]}},Dy=(e,t)=>({fn:ky(e).fn,options:[e,t]}),Ry=(e,t)=>{const r=yy(e);return{name:r.name,fn:r.fn,options:[e,t]}},Py=(e,t)=>{const r=wy(e);return{name:r.name,fn:r.fn,options:[e,t]}},_y=(e,t)=>{const r=jy(e);return{name:r.name,fn:r.fn,options:[e,t]}},Iy=(e,t)=>{const r=Ey(e);return{name:r.name,fn:r.fn,options:[e,t]}};var Oy="Arrow",Em=g.forwardRef((e,t)=>{const{children:r,width:n=10,height:a=5,...s}=e;return o.jsx(we.svg,{...s,ref:t,width:n,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:o.jsx("polygon",{points:"0,0 30,0 15,10"})})});Em.displayName=Oy;var Fy=Em,Bi="Popper",[Tm,_n]=_t(Bi),[zy,Am]=Tm(Bi),Dm=e=>{const{__scopePopper:t,children:r}=e,[n,a]=g.useState(null);return o.jsx(zy,{scope:t,anchor:n,onAnchorChange:a,children:r})};Dm.displayName=Bi;var Rm="PopperAnchor",Pm=g.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:n,...a}=e,s=Am(Rm,r),i=g.useRef(null),l=ke(t,i),c=g.useRef(null);return g.useEffect(()=>{const d=c.current;c.current=(n==null?void 0:n.current)||i.current,d!==c.current&&s.onAnchorChange(c.current)}),n?null:o.jsx(we.div,{...a,ref:l})});Pm.displayName=Rm;var Ui="PopperContent",[Ly,My]=Tm(Ui),_m=g.forwardRef((e,t)=>{var r,n,a,s,i,l;const{__scopePopper:c,side:d="bottom",sideOffset:u=0,align:m="center",alignOffset:p=0,arrowPadding:f=0,avoidCollisions:v=!0,collisionBoundary:h=[],collisionPadding:x=0,sticky:b="partial",hideWhenDetached:y=!1,updatePositionStrategy:j="optimized",onPlaced:w,...C}=e,S=Am(Ui,c),[$,k]=g.useState(null),E=ke(t,Ce=>k(Ce)),[T,O]=g.useState(null),L=aa(T),A=(L==null?void 0:L.width)??0,z=(L==null?void 0:L.height)??0,X=d+(m!=="center"?"-"+m:""),q=typeof x=="number"?x:{top:0,right:0,bottom:0,left:0,...x},Z=Array.isArray(h)?h:[h],V=Z.length>0,M={padding:q,boundary:Z.filter(By),altBoundary:V},{refs:_,floatingStyles:se,placement:U,isPositioned:Q,middlewareData:Y}=$y({strategy:"fixed",placement:X,whileElementsMounted:(...Ce)=>gy(...Ce,{animationFrame:j==="always"}),elements:{reference:S.anchor},middleware:[Ty({mainAxis:u+z,alignmentAxis:p}),v&&Ay({mainAxis:!0,crossAxis:!1,limiter:b==="partial"?Dy():void 0,...M}),v&&Ry({...M}),Py({...M,apply:({elements:Ce,rects:ve,availableWidth:me,availableHeight:Te})=>{const{width:ze,height:dt}=ve.reference,Ve=Ce.floating.style;Ve.setProperty("--radix-popper-available-width",`${me}px`),Ve.setProperty("--radix-popper-available-height",`${Te}px`),Ve.setProperty("--radix-popper-anchor-width",`${ze}px`),Ve.setProperty("--radix-popper-anchor-height",`${dt}px`)}}),T&&Iy({element:T,padding:f}),Uy({arrowWidth:A,arrowHeight:z}),y&&_y({strategy:"referenceHidden",...M})]}),[H,W]=Fm(U),G=ft(w);lt(()=>{Q&&(G==null||G())},[Q,G]);const ne=(r=Y.arrow)==null?void 0:r.x,J=(n=Y.arrow)==null?void 0:n.y,te=((a=Y.arrow)==null?void 0:a.centerOffset)!==0,[ce,be]=g.useState();return lt(()=>{$&&be(window.getComputedStyle($).zIndex)},[$]),o.jsx("div",{ref:_.setFloating,"data-radix-popper-content-wrapper":"",style:{...se,transform:Q?se.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ce,"--radix-popper-transform-origin":[(s=Y.transformOrigin)==null?void 0:s.x,(i=Y.transformOrigin)==null?void 0:i.y].join(" "),...((l=Y.hide)==null?void 0:l.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:o.jsx(Ly,{scope:c,placedSide:H,onArrowChange:O,arrowX:ne,arrowY:J,shouldHideArrow:te,children:o.jsx(we.div,{"data-side":H,"data-align":W,...C,ref:E,style:{...C.style,animation:Q?void 0:"none"}})})})});_m.displayName=Ui;var Im="PopperArrow",Vy={top:"bottom",right:"left",bottom:"top",left:"right"},Om=g.forwardRef(function(e,t){const{__scopePopper:r,...n}=e,a=My(Im,r),s=Vy[a.placedSide];return o.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:o.jsx(Fy,{...n,ref:t,style:{...n.style,display:"block"}})})});Om.displayName=Im;function By(e){return e!==null}var Uy=e=>({name:"transformOrigin",options:e,fn(t){var r,n,a;const{placement:s,rects:i,middlewareData:l}=t,c=((r=l.arrow)==null?void 0:r.centerOffset)!==0,d=c?0:e.arrowWidth,u=c?0:e.arrowHeight,[m,p]=Fm(s),f={start:"0%",center:"50%",end:"100%"}[p],v=(((n=l.arrow)==null?void 0:n.x)??0)+d/2,h=(((a=l.arrow)==null?void 0:a.y)??0)+u/2;let x="",b="";return m==="bottom"?(x=c?f:`${v}px`,b=`${-u}px`):m==="top"?(x=c?f:`${v}px`,b=`${i.floating.height+u}px`):m==="right"?(x=`${-u}px`,b=c?f:`${h}px`):m==="left"&&(x=`${i.floating.width+u}px`,b=c?f:`${h}px`),{data:{x,y:b}}}});function Fm(e){const[t,r="center"]=e.split("-");return[t,r]}var Hi=Dm,vo=Pm,Wi=_m,qi=Om,Hy="Portal",bo=g.forwardRef((e,t)=>{var r;const{container:n,...a}=e,[s,i]=g.useState(!1);lt(()=>i(!0),[]);const l=n||s&&((r=globalThis==null?void 0:globalThis.document)==null?void 0:r.body);return l?xi.createPortal(o.jsx(we.div,{...a,ref:t}),l):null});bo.displayName=Hy;var zm=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Wy="VisuallyHidden",Lm=g.forwardRef((e,t)=>o.jsx(we.span,{...e,ref:t,style:{...zm,...e.style}}));Lm.displayName=Wy;var qy=Lm,Gy=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},cn=new WeakMap,wa=new WeakMap,ja={},ds=0,Mm=function(e){return e&&(e.host||Mm(e.parentNode))},Xy=function(e,t){return t.map(function(r){if(e.contains(r))return r;var n=Mm(r);return n&&e.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},Zy=function(e,t,r,n){var a=Xy(t,Array.isArray(e)?e:[e]);ja[r]||(ja[r]=new WeakMap);var s=ja[r],i=[],l=new Set,c=new Set(a),d=function(m){!m||l.has(m)||(l.add(m),d(m.parentNode))};a.forEach(d);var u=function(m){!m||c.has(m)||Array.prototype.forEach.call(m.children,function(p){if(l.has(p))u(p);else try{var f=p.getAttribute(n),v=f!==null&&f!=="false",h=(cn.get(p)||0)+1,x=(s.get(p)||0)+1;cn.set(p,h),s.set(p,x),i.push(p),h===1&&v&&wa.set(p,!0),x===1&&p.setAttribute(r,"true"),v||p.setAttribute(n,"true")}catch(b){console.error("aria-hidden: cannot operate on ",p,b)}})};return u(t),l.clear(),ds++,function(){i.forEach(function(m){var p=cn.get(m)-1,f=s.get(m)-1;cn.set(m,p),s.set(m,f),p||(wa.has(m)||m.removeAttribute(n),wa.delete(m)),f||m.removeAttribute(r)}),ds--,ds||(cn=new WeakMap,cn=new WeakMap,wa=new WeakMap,ja={})}},Gi=function(e,t,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),a=Gy(e);return a?(n.push.apply(n,Array.from(a.querySelectorAll("[aria-live], script"))),Zy(n,a,r,"aria-hidden")):function(){return null}},sr=function(){return sr=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},sr.apply(this,arguments)};function Vm(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]]);return r}function Ky(e,t,r){for(var n=0,a=t.length,s;n<a;n++)(s||!(n in t))&&(s||(s=Array.prototype.slice.call(t,0,n)),s[n]=t[n]);return e.concat(s||Array.prototype.slice.call(t))}var _a="right-scroll-bar-position",Ia="width-before-scroll-bar",Yy="with-scroll-bars-hidden",Jy="--removed-body-scroll-bar-size";function us(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Qy(e,t){var r=N.useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(n){var a=r.value;a!==n&&(r.value=n,r.callback(n,a))}}}})[0];return r.callback=t,r.facade}var e0=typeof window<"u"?g.useLayoutEffect:g.useEffect,Cc=new WeakMap;function t0(e,t){var r=Qy(null,function(n){return e.forEach(function(a){return us(a,n)})});return e0(function(){var n=Cc.get(r);if(n){var a=new Set(n),s=new Set(e),i=r.current;a.forEach(function(l){s.has(l)||us(l,null)}),s.forEach(function(l){a.has(l)||us(l,i)})}Cc.set(r,e)},[e]),r}function r0(e){return e}function n0(e,t){t===void 0&&(t=r0);var r=[],n=!1,a={read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(s){var i=t(s,n);return r.push(i),function(){r=r.filter(function(l){return l!==i})}},assignSyncMedium:function(s){for(n=!0;r.length;){var i=r;r=[],i.forEach(s)}r={push:function(l){return s(l)},filter:function(){return r}}},assignMedium:function(s){n=!0;var i=[];if(r.length){var l=r;r=[],l.forEach(s),i=r}var c=function(){var u=i;i=[],u.forEach(s)},d=function(){return Promise.resolve().then(c)};d(),r={push:function(u){i.push(u),d()},filter:function(u){return i=i.filter(u),r}}}};return a}function a0(e){e===void 0&&(e={});var t=n0(null);return t.options=sr({async:!0,ssr:!1},e),t}var Bm=function(e){var t=e.sideCar,r=Vm(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=t.read();if(!n)throw new Error("Sidecar medium not found");return g.createElement(n,sr({},r))};Bm.isSideCarExport=!0;function o0(e,t){return e.useMedium(t),Bm}var Um=a0(),ms=function(){},yo=g.forwardRef(function(e,t){var r=g.useRef(null),n=g.useState({onScrollCapture:ms,onWheelCapture:ms,onTouchMoveCapture:ms}),a=n[0],s=n[1],i=e.forwardProps,l=e.children,c=e.className,d=e.removeScrollBar,u=e.enabled,m=e.shards,p=e.sideCar,f=e.noRelative,v=e.noIsolation,h=e.inert,x=e.allowPinchZoom,b=e.as,y=b===void 0?"div":b,j=e.gapMode,w=Vm(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=p,S=t0([r,t]),$=sr(sr({},w),a);return g.createElement(g.Fragment,null,u&&g.createElement(C,{sideCar:Um,removeScrollBar:d,shards:m,noRelative:f,noIsolation:v,inert:h,setCallbacks:s,allowPinchZoom:!!x,lockRef:r,gapMode:j}),i?g.cloneElement(g.Children.only(l),sr(sr({},$),{ref:S})):g.createElement(y,sr({},$,{className:c,ref:S}),l))});yo.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};yo.classNames={fullWidth:Ia,zeroRight:_a};var s0=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function i0(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=s0();return t&&e.setAttribute("nonce",t),e}function l0(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function c0(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var d0=function(){var e=0,t=null;return{add:function(r){e==0&&(t=i0())&&(l0(t,r),c0(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},u0=function(){var e=d0();return function(t,r){g.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},Hm=function(){var e=u0(),t=function(r){var n=r.styles,a=r.dynamic;return e(n,a),null};return t},m0={left:0,top:0,right:0,gap:0},ps=function(e){return parseInt(e||"",10)||0},p0=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],n=t[e==="padding"?"paddingTop":"marginTop"],a=t[e==="padding"?"paddingRight":"marginRight"];return[ps(r),ps(n),ps(a)]},f0=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return m0;var t=p0(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},h0=Hm(),jn="data-scroll-locked",x0=function(e,t,r,n){var a=e.left,s=e.top,i=e.right,l=e.gap;return r===void 0&&(r="margin"),`
|
|
31
|
+
.`.concat(Yy,` {
|
|
32
32
|
overflow: hidden `).concat(n,`;
|
|
33
33
|
padding-right: `).concat(l,"px ").concat(n,`;
|
|
34
34
|
}
|
|
35
|
-
body[`).concat(
|
|
35
|
+
body[`).concat(jn,`] {
|
|
36
36
|
overflow: hidden `).concat(n,`;
|
|
37
37
|
overscroll-behavior: contain;
|
|
38
38
|
`).concat([t&&"position: relative ".concat(n,";"),r==="margin"&&`
|
|
@@ -45,41 +45,41 @@ React keys must be passed directly to JSX without using spread:
|
|
|
45
45
|
`),r==="padding"&&"padding-right: ".concat(l,"px ").concat(n,";")].filter(Boolean).join(""),`
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
.`).concat(
|
|
48
|
+
.`).concat(_a,` {
|
|
49
49
|
right: `).concat(l,"px ").concat(n,`;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
.`).concat(
|
|
52
|
+
.`).concat(Ia,` {
|
|
53
53
|
margin-right: `).concat(l,"px ").concat(n,`;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
.`).concat(
|
|
56
|
+
.`).concat(_a," .").concat(_a,` {
|
|
57
57
|
right: 0 `).concat(n,`;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
.`).concat(
|
|
60
|
+
.`).concat(Ia," .").concat(Ia,` {
|
|
61
61
|
margin-right: 0 `).concat(n,`;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
body[`).concat(
|
|
65
|
-
`).concat(
|
|
64
|
+
body[`).concat(jn,`] {
|
|
65
|
+
`).concat(Jy,": ").concat(l,`px;
|
|
66
66
|
}
|
|
67
|
-
`)},Nc=function(){var e=parseInt(document.body.getAttribute(
|
|
67
|
+
`)},Nc=function(){var e=parseInt(document.body.getAttribute(jn)||"0",10);return isFinite(e)?e:0},g0=function(){g.useEffect(function(){return document.body.setAttribute(jn,(Nc()+1).toString()),function(){var e=Nc()-1;e<=0?document.body.removeAttribute(jn):document.body.setAttribute(jn,e.toString())}},[])},v0=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,a=n===void 0?"margin":n;g0();var s=g.useMemo(function(){return f0(a)},[a]);return g.createElement(h0,{styles:x0(s,!t,a,r?"":"!important")})},qs=!1;if(typeof window<"u")try{var ka=Object.defineProperty({},"passive",{get:function(){return qs=!0,!0}});window.addEventListener("test",ka,ka),window.removeEventListener("test",ka,ka)}catch{qs=!1}var dn=qs?{passive:!1}:!1,b0=function(e){return e.tagName==="TEXTAREA"},Wm=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!b0(e)&&r[t]==="visible")},y0=function(e){return Wm(e,"overflowY")},w0=function(e){return Wm(e,"overflowX")},Sc=function(e,t){var r=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var a=qm(e,n);if(a){var s=Gm(e,n),i=s[1],l=s[2];if(i>l)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},j0=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},k0=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},qm=function(e,t){return e==="v"?y0(t):w0(t)},Gm=function(e,t){return e==="v"?j0(t):k0(t)},C0=function(e,t){return e==="h"&&t==="rtl"?-1:1},N0=function(e,t,r,n,a){var s=C0(e,window.getComputedStyle(t).direction),i=s*n,l=r.target,c=t.contains(l),d=!1,u=i>0,m=0,p=0;do{if(!l)break;var f=Gm(e,l),v=f[0],h=f[1],x=f[2],b=h-x-s*v;(v||b)&&qm(e,l)&&(m+=b,p+=v);var y=l.parentNode;l=y&&y.nodeType===Node.DOCUMENT_FRAGMENT_NODE?y.host:y}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(u&&Math.abs(m)<1||!u&&Math.abs(p)<1)&&(d=!0),d},Ca=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},$c=function(e){return[e.deltaX,e.deltaY]},Ec=function(e){return e&&"current"in e?e.current:e},S0=function(e,t){return e[0]===t[0]&&e[1]===t[1]},$0=function(e){return`
|
|
68
68
|
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
69
69
|
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
70
|
-
`)},j0=0,mn=[];function k0(e){var t=g.useRef([]),r=g.useRef([0,0]),n=g.useRef(),a=g.useState(j0++)[0],s=g.useState(Lm)[0],i=g.useRef(e);g.useEffect(function(){i.current=e},[e]),g.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var h=Hy([e.lockRef.current],(e.shards||[]).map(Ec)).filter(Boolean);return h.forEach(function(x){return x.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),h.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var l=g.useCallback(function(h,x){if("touches"in h&&h.touches.length===2||h.type==="wheel"&&h.ctrlKey)return!i.current.allowPinchZoom;var y=Da(h),v=r.current,j="deltaX"in h?h.deltaX:v[0]-y[0],w="deltaY"in h?h.deltaY:v[1]-y[1],C,S=h.target,$=Math.abs(j)>Math.abs(w)?"h":"v";if("touches"in h&&$==="h"&&S.type==="range")return!1;var k=window.getSelection(),E=k&&k.anchorNode,D=E?E===S||E.contains(S):!1;if(D)return!1;var O=Sc($,S);if(!O)return!0;if(O?C=$:(C=$==="v"?"h":"v",O=Sc($,S)),!O)return!1;if(!n.current&&"changedTouches"in h&&(j||w)&&(n.current=C),!C)return!0;var L=n.current||C;return b0(L,x,h,L==="h"?j:w)},[]),c=g.useCallback(function(h){var x=h;if(!(!mn.length||mn[mn.length-1]!==s)){var y="deltaY"in x?$c(x):Da(x),v=t.current.filter(function(C){return C.name===x.type&&(C.target===x.target||x.target===C.shadowParent)&&y0(C.delta,y)})[0];if(v&&v.should){x.cancelable&&x.preventDefault();return}if(!v){var j=(i.current.shards||[]).map(Ec).filter(Boolean).filter(function(C){return C.contains(x.target)}),w=j.length>0?l(x,j[0]):!i.current.noIsolation;w&&x.cancelable&&x.preventDefault()}}},[]),d=g.useCallback(function(h,x,y,v){var j={name:h,delta:x,target:y,should:v,shadowParent:C0(y)};t.current.push(j),setTimeout(function(){t.current=t.current.filter(function(w){return w!==j})},1)},[]),u=g.useCallback(function(h){r.current=Da(h),n.current=void 0},[]),m=g.useCallback(function(h){d(h.type,$c(h),h.target,l(h,e.lockRef.current))},[]),p=g.useCallback(function(h){d(h.type,Da(h),h.target,l(h,e.lockRef.current))},[]);g.useEffect(function(){return mn.push(s),e.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:p}),document.addEventListener("wheel",c,un),document.addEventListener("touchmove",c,un),document.addEventListener("touchstart",u,un),function(){mn=mn.filter(function(h){return h!==s}),document.removeEventListener("wheel",c,un),document.removeEventListener("touchmove",c,un),document.removeEventListener("touchstart",u,un)}},[]);var f=e.removeScrollBar,b=e.inert;return g.createElement(g.Fragment,null,b?g.createElement(s,{styles:w0(a)}):null,f?g.createElement(m0,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function C0(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const N0=Qy(zm,k0);var So=g.forwardRef(function(e,t){return g.createElement(No,ir({},e,{ref:t,sideCar:N0}))});So.classNames=No.classNames;var S0=[" ","Enter","ArrowUp","ArrowDown"],$0=[" ","Enter"],tn="Select",[$o,Eo,E0]=Ri(tn),[zn]=_t(tn,[E0,Fn]),Do=Fn(),[D0,Mr]=zn(tn),[T0,A0]=zn(tn),Um=e=>{const{__scopeSelect:t,children:r,open:n,defaultOpen:a,onOpenChange:s,value:i,defaultValue:l,onValueChange:c,dir:d,name:u,autoComplete:m,disabled:p,required:f,form:b}=e,h=Do(t),[x,y]=g.useState(null),[v,j]=g.useState(null),[w,C]=g.useState(!1),S=ca(d),[$,k]=dr({prop:n,defaultProp:a??!1,onChange:s,caller:tn}),[E,D]=dr({prop:i,defaultProp:l,onChange:c,caller:tn}),O=g.useRef(null),L=x?b||!!x.closest("form"):!0,[A,z]=g.useState(new Set),X=Array.from(A).map(q=>q.props.value).join(";");return o.jsx(qi,{...h,children:o.jsxs(D0,{required:f,scope:t,trigger:x,onTriggerChange:y,valueNode:v,onValueNodeChange:j,valueNodeHasChildren:w,onValueNodeHasChildrenChange:C,contentId:wr(),value:E,onValueChange:D,open:$,onOpenChange:k,dir:S,triggerPointerDownPosRef:O,disabled:p,children:[o.jsx($o.Provider,{scope:t,children:o.jsx(T0,{scope:e.__scopeSelect,onNativeOptionAdd:g.useCallback(q=>{z(Z=>new Set(Z).add(q))},[]),onNativeOptionRemove:g.useCallback(q=>{z(Z=>{const V=new Set(Z);return V.delete(q),V})},[]),children:r})}),L?o.jsxs(pp,{"aria-hidden":!0,required:f,tabIndex:-1,name:u,autoComplete:m,value:E,onChange:q=>D(q.target.value),disabled:p,form:b,children:[E===void 0?o.jsx("option",{value:""}):null,Array.from(A)]},X):null]})})};Um.displayName=tn;var Hm="SelectTrigger",Wm=g.forwardRef((e,t)=>{const{__scopeSelect:r,disabled:n=!1,...a}=e,s=Do(r),i=Mr(Hm,r),l=i.disabled||n,c=ke(t,i.onTriggerChange),d=Eo(r),u=g.useRef("touch"),[m,p,f]=hp(h=>{const x=d().filter(j=>!j.disabled),y=x.find(j=>j.value===i.value),v=xp(x,h,y);v!==void 0&&i.onValueChange(v.value)}),b=h=>{l||(i.onOpenChange(!0),f()),h&&(i.triggerPointerDownPosRef.current={x:Math.round(h.pageX),y:Math.round(h.pageY)})};return o.jsx(ko,{asChild:!0,...s,children:o.jsx(we.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":fp(i.value)?"":void 0,...a,ref:c,onClick:ge(a.onClick,h=>{h.currentTarget.focus(),u.current!=="mouse"&&b(h)}),onPointerDown:ge(a.onPointerDown,h=>{u.current=h.pointerType;const x=h.target;x.hasPointerCapture(h.pointerId)&&x.releasePointerCapture(h.pointerId),h.button===0&&h.ctrlKey===!1&&h.pointerType==="mouse"&&(b(h),h.preventDefault())}),onKeyDown:ge(a.onKeyDown,h=>{const x=m.current!=="";!(h.ctrlKey||h.altKey||h.metaKey)&&h.key.length===1&&p(h.key),!(x&&h.key===" ")&&S0.includes(h.key)&&(b(),h.preventDefault())})})})});Wm.displayName=Hm;var qm="SelectValue",Gm=g.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:a,children:s,placeholder:i="",...l}=e,c=Mr(qm,r),{onValueNodeHasChildrenChange:d}=c,u=s!==void 0,m=ke(t,c.onValueNodeChange);return lt(()=>{d(u)},[d,u]),o.jsx(we.span,{...l,ref:m,style:{pointerEvents:"none"},children:fp(c.value)?o.jsx(o.Fragment,{children:i}):s})});Gm.displayName=qm;var R0="SelectIcon",Xm=g.forwardRef((e,t)=>{const{__scopeSelect:r,children:n,...a}=e;return o.jsx(we.span,{"aria-hidden":!0,...a,ref:t,children:n||"▼"})});Xm.displayName=R0;var I0="SelectPortal",Zm=e=>o.jsx(Co,{asChild:!0,...e});Zm.displayName=I0;var rn="SelectContent",Km=g.forwardRef((e,t)=>{const r=Mr(rn,e.__scopeSelect),[n,a]=g.useState();if(lt(()=>{a(new DocumentFragment)},[]),!r.open){const s=n;return s?co.createPortal(o.jsx(Ym,{scope:e.__scopeSelect,children:o.jsx($o.Slot,{scope:e.__scopeSelect,children:o.jsx("div",{children:e.children})})}),s):null}return o.jsx(Jm,{...e,ref:t})});Km.displayName=rn;var qt=10,[Ym,Vr]=zn(rn),P0="SelectContentImpl",_0=$n("SelectContent.RemoveScroll"),Jm=g.forwardRef((e,t)=>{const{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:s,onPointerDownOutside:i,side:l,sideOffset:c,align:d,alignOffset:u,arrowPadding:m,collisionBoundary:p,collisionPadding:f,sticky:b,hideWhenDetached:h,avoidCollisions:x,...y}=e,v=Mr(rn,r),[j,w]=g.useState(null),[C,S]=g.useState(null),$=ke(t,G=>w(G)),[k,E]=g.useState(null),[D,O]=g.useState(null),L=Eo(r),[A,z]=g.useState(!1),X=g.useRef(!1);g.useEffect(()=>{if(j)return Zi(j)},[j]),Fi();const q=g.useCallback(G=>{const[ne,...J]=L().map(be=>be.ref.current),[te]=J.slice(-1),ce=document.activeElement;for(const be of G)if(be===ce||(be==null||be.scrollIntoView({block:"nearest"}),be===ne&&C&&(C.scrollTop=0),be===te&&C&&(C.scrollTop=C.scrollHeight),be==null||be.focus(),document.activeElement!==ce))return},[L,C]),Z=g.useCallback(()=>q([k,j]),[q,k,j]);g.useEffect(()=>{A&&Z()},[A,Z]);const{onOpenChange:V,triggerPointerDownPosRef:M}=v;g.useEffect(()=>{if(j){let G={x:0,y:0};const ne=te=>{var ce,be;G={x:Math.abs(Math.round(te.pageX)-(((ce=M.current)==null?void 0:ce.x)??0)),y:Math.abs(Math.round(te.pageY)-(((be=M.current)==null?void 0:be.y)??0))}},J=te=>{G.x<=10&&G.y<=10?te.preventDefault():j.contains(te.target)||V(!1),document.removeEventListener("pointermove",ne),M.current=null};return M.current!==null&&(document.addEventListener("pointermove",ne),document.addEventListener("pointerup",J,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ne),document.removeEventListener("pointerup",J,{capture:!0})}}},[j,V,M]),g.useEffect(()=>{const G=()=>V(!1);return window.addEventListener("blur",G),window.addEventListener("resize",G),()=>{window.removeEventListener("blur",G),window.removeEventListener("resize",G)}},[V]);const[P,se]=hp(G=>{const ne=L().filter(ce=>!ce.disabled),J=ne.find(ce=>ce.ref.current===document.activeElement),te=xp(ne,G,J);te&&setTimeout(()=>te.ref.current.focus())}),U=g.useCallback((G,ne,J)=>{const te=!X.current&&!J;(v.value!==void 0&&v.value===ne||te)&&(E(G),te&&(X.current=!0))},[v.value]),Q=g.useCallback(()=>j==null?void 0:j.focus(),[j]),Y=g.useCallback((G,ne,J)=>{const te=!X.current&&!J;(v.value!==void 0&&v.value===ne||te)&&O(G)},[v.value]),H=n==="popper"?Ys:Qm,W=H===Ys?{side:l,sideOffset:c,align:d,alignOffset:u,arrowPadding:m,collisionBoundary:p,collisionPadding:f,sticky:b,hideWhenDetached:h,avoidCollisions:x}:{};return o.jsx(Ym,{scope:r,content:j,viewport:C,onViewportChange:S,itemRefCallback:U,selectedItem:k,onItemLeave:Q,itemTextRefCallback:Y,focusSelectedItem:Z,selectedItemText:D,position:n,isPositioned:A,searchRef:P,children:o.jsx(So,{as:_0,allowPinchZoom:!0,children:o.jsx(vo,{asChild:!0,trapped:v.open,onMountAutoFocus:G=>{G.preventDefault()},onUnmountAutoFocus:ge(a,G=>{var ne;(ne=v.trigger)==null||ne.focus({preventScroll:!0}),G.preventDefault()}),children:o.jsx(ua,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:G=>G.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:o.jsx(H,{role:"listbox",id:v.contentId,"data-state":v.open?"open":"closed",dir:v.dir,onContextMenu:G=>G.preventDefault(),...y,...W,onPlaced:()=>z(!0),ref:$,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:ge(y.onKeyDown,G=>{const ne=G.ctrlKey||G.altKey||G.metaKey;if(G.key==="Tab"&&G.preventDefault(),!ne&&G.key.length===1&&se(G.key),["ArrowUp","ArrowDown","Home","End"].includes(G.key)){let J=L().filter(te=>!te.disabled).map(te=>te.ref.current);if(["ArrowUp","End"].includes(G.key)&&(J=J.slice().reverse()),["ArrowUp","ArrowDown"].includes(G.key)){const te=G.target,ce=J.indexOf(te);J=J.slice(ce+1)}setTimeout(()=>q(J)),G.preventDefault()}})})})})})})});Jm.displayName=P0;var O0="SelectItemAlignedPosition",Qm=g.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:n,...a}=e,s=Mr(rn,r),i=Vr(rn,r),[l,c]=g.useState(null),[d,u]=g.useState(null),m=ke(t,$=>u($)),p=Eo(r),f=g.useRef(!1),b=g.useRef(!0),{viewport:h,selectedItem:x,selectedItemText:y,focusSelectedItem:v}=i,j=g.useCallback(()=>{if(s.trigger&&s.valueNode&&l&&d&&h&&x&&y){const $=s.trigger.getBoundingClientRect(),k=d.getBoundingClientRect(),E=s.valueNode.getBoundingClientRect(),D=y.getBoundingClientRect();if(s.dir!=="rtl"){const te=D.left-k.left,ce=E.left-te,be=$.left-ce,Ce=$.width+be,ve=Math.max(Ce,k.width),me=window.innerWidth-qt,Ee=ta(ce,[qt,Math.max(qt,me-ve)]);l.style.minWidth=Ce+"px",l.style.left=Ee+"px"}else{const te=k.right-D.right,ce=window.innerWidth-E.right-te,be=window.innerWidth-$.right-ce,Ce=$.width+be,ve=Math.max(Ce,k.width),me=window.innerWidth-qt,Ee=ta(ce,[qt,Math.max(qt,me-ve)]);l.style.minWidth=Ce+"px",l.style.right=Ee+"px"}const O=p(),L=window.innerHeight-qt*2,A=h.scrollHeight,z=window.getComputedStyle(d),X=parseInt(z.borderTopWidth,10),q=parseInt(z.paddingTop,10),Z=parseInt(z.borderBottomWidth,10),V=parseInt(z.paddingBottom,10),M=X+q+A+V+Z,P=Math.min(x.offsetHeight*5,M),se=window.getComputedStyle(h),U=parseInt(se.paddingTop,10),Q=parseInt(se.paddingBottom,10),Y=$.top+$.height/2-qt,H=L-Y,W=x.offsetHeight/2,G=x.offsetTop+W,ne=X+q+G,J=M-ne;if(ne<=Y){const te=O.length>0&&x===O[O.length-1].ref.current;l.style.bottom="0px";const ce=d.clientHeight-h.offsetTop-h.offsetHeight,be=Math.max(H,W+(te?Q:0)+ce+Z),Ce=ne+be;l.style.height=Ce+"px"}else{const te=O.length>0&&x===O[0].ref.current;l.style.top="0px";const ce=Math.max(Y,X+h.offsetTop+(te?U:0)+W)+J;l.style.height=ce+"px",h.scrollTop=ne-Y+h.offsetTop}l.style.margin=`${qt}px 0`,l.style.minHeight=P+"px",l.style.maxHeight=L+"px",n==null||n(),requestAnimationFrame(()=>f.current=!0)}},[p,s.trigger,s.valueNode,l,d,h,x,y,s.dir,n]);lt(()=>j(),[j]);const[w,C]=g.useState();lt(()=>{d&&C(window.getComputedStyle(d).zIndex)},[d]);const S=g.useCallback($=>{$&&b.current===!0&&(j(),v==null||v(),b.current=!1)},[j,v]);return o.jsx(z0,{scope:r,contentWrapper:l,shouldExpandOnScrollRef:f,onScrollButtonChange:S,children:o.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:w},children:o.jsx(we.div,{...a,ref:m,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});Qm.displayName=O0;var F0="SelectPopperPosition",Ys=g.forwardRef((e,t)=>{const{__scopeSelect:r,align:n="start",collisionPadding:a=qt,...s}=e,i=Do(r);return o.jsx(Gi,{...i,...s,ref:t,align:n,collisionPadding:a,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Ys.displayName=F0;var[z0,Ki]=zn(rn,{}),Js="SelectViewport",ep=g.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:n,...a}=e,s=Vr(Js,r),i=Ki(Js,r),l=ke(t,s.onViewportChange),c=g.useRef(0);return o.jsxs(o.Fragment,{children:[o.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:n}),o.jsx($o.Slot,{scope:r,children:o.jsx(we.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:ge(a.onScroll,d=>{const u=d.currentTarget,{contentWrapper:m,shouldExpandOnScrollRef:p}=i;if(p!=null&&p.current&&m){const f=Math.abs(c.current-u.scrollTop);if(f>0){const b=window.innerHeight-qt*2,h=parseFloat(m.style.minHeight),x=parseFloat(m.style.height),y=Math.max(h,x);if(y<b){const v=y+f,j=Math.min(b,v),w=v-j;m.style.height=j+"px",m.style.bottom==="0px"&&(u.scrollTop=w>0?w:0,m.style.justifyContent="flex-end")}}}c.current=u.scrollTop})})})]})});ep.displayName=Js;var tp="SelectGroup",[L0,M0]=zn(tp),V0=g.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,a=wr();return o.jsx(L0,{scope:r,id:a,children:o.jsx(we.div,{role:"group","aria-labelledby":a,...n,ref:t})})});V0.displayName=tp;var rp="SelectLabel",np=g.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,a=M0(rp,r);return o.jsx(we.div,{id:a.id,...n,ref:t})});np.displayName=rp;var Ga="SelectItem",[B0,ap]=zn(Ga),op=g.forwardRef((e,t)=>{const{__scopeSelect:r,value:n,disabled:a=!1,textValue:s,...i}=e,l=Mr(Ga,r),c=Vr(Ga,r),d=l.value===n,[u,m]=g.useState(s??""),[p,f]=g.useState(!1),b=ke(t,v=>{var j;return(j=c.itemRefCallback)==null?void 0:j.call(c,v,n,a)}),h=wr(),x=g.useRef("touch"),y=()=>{a||(l.onValueChange(n),l.onOpenChange(!1))};if(n==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return o.jsx(B0,{scope:r,value:n,disabled:a,textId:h,isSelected:d,onItemTextChange:g.useCallback(v=>{m(j=>j||((v==null?void 0:v.textContent)??"").trim())},[]),children:o.jsx($o.ItemSlot,{scope:r,value:n,disabled:a,textValue:u,children:o.jsx(we.div,{role:"option","aria-labelledby":h,"data-highlighted":p?"":void 0,"aria-selected":d&&p,"data-state":d?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...i,ref:b,onFocus:ge(i.onFocus,()=>f(!0)),onBlur:ge(i.onBlur,()=>f(!1)),onClick:ge(i.onClick,()=>{x.current!=="mouse"&&y()}),onPointerUp:ge(i.onPointerUp,()=>{x.current==="mouse"&&y()}),onPointerDown:ge(i.onPointerDown,v=>{x.current=v.pointerType}),onPointerMove:ge(i.onPointerMove,v=>{var j;x.current=v.pointerType,a?(j=c.onItemLeave)==null||j.call(c):x.current==="mouse"&&v.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ge(i.onPointerLeave,v=>{var j;v.currentTarget===document.activeElement&&((j=c.onItemLeave)==null||j.call(c))}),onKeyDown:ge(i.onKeyDown,v=>{var j;((j=c.searchRef)==null?void 0:j.current)!==""&&v.key===" "||($0.includes(v.key)&&y(),v.key===" "&&v.preventDefault())})})})})});op.displayName=Ga;var Zn="SelectItemText",sp=g.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:a,...s}=e,i=Mr(Zn,r),l=Vr(Zn,r),c=ap(Zn,r),d=A0(Zn,r),[u,m]=g.useState(null),p=ke(t,y=>m(y),c.onItemTextChange,y=>{var v;return(v=l.itemTextRefCallback)==null?void 0:v.call(l,y,c.value,c.disabled)}),f=u==null?void 0:u.textContent,b=g.useMemo(()=>o.jsx("option",{value:c.value,disabled:c.disabled,children:f},c.value),[c.disabled,c.value,f]),{onNativeOptionAdd:h,onNativeOptionRemove:x}=d;return lt(()=>(h(b),()=>x(b)),[h,x,b]),o.jsxs(o.Fragment,{children:[o.jsx(we.span,{id:c.textId,...s,ref:p}),c.isSelected&&i.valueNode&&!i.valueNodeHasChildren?co.createPortal(s.children,i.valueNode):null]})});sp.displayName=Zn;var ip="SelectItemIndicator",lp=g.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return ap(ip,r).isSelected?o.jsx(we.span,{"aria-hidden":!0,...n,ref:t}):null});lp.displayName=ip;var Qs="SelectScrollUpButton",cp=g.forwardRef((e,t)=>{const r=Vr(Qs,e.__scopeSelect),n=Ki(Qs,e.__scopeSelect),[a,s]=g.useState(!1),i=ke(t,n.onScrollButtonChange);return lt(()=>{if(r.viewport&&r.isPositioned){let l=function(){const d=c.scrollTop>0;s(d)};const c=r.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[r.viewport,r.isPositioned]),a?o.jsx(up,{...e,ref:i,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=r;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});cp.displayName=Qs;var ei="SelectScrollDownButton",dp=g.forwardRef((e,t)=>{const r=Vr(ei,e.__scopeSelect),n=Ki(ei,e.__scopeSelect),[a,s]=g.useState(!1),i=ke(t,n.onScrollButtonChange);return lt(()=>{if(r.viewport&&r.isPositioned){let l=function(){const d=c.scrollHeight-c.clientHeight,u=Math.ceil(c.scrollTop)<d;s(u)};const c=r.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[r.viewport,r.isPositioned]),a?o.jsx(up,{...e,ref:i,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=r;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});dp.displayName=ei;var up=g.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:n,...a}=e,s=Vr("SelectScrollButton",r),i=g.useRef(null),l=Eo(r),c=g.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return g.useEffect(()=>()=>c(),[c]),lt(()=>{var d;const u=l().find(m=>m.ref.current===document.activeElement);(d=u==null?void 0:u.ref.current)==null||d.scrollIntoView({block:"nearest"})},[l]),o.jsx(we.div,{"aria-hidden":!0,...a,ref:t,style:{flexShrink:0,...a.style},onPointerDown:ge(a.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(n,50))}),onPointerMove:ge(a.onPointerMove,()=>{var d;(d=s.onItemLeave)==null||d.call(s),i.current===null&&(i.current=window.setInterval(n,50))}),onPointerLeave:ge(a.onPointerLeave,()=>{c()})})}),U0="SelectSeparator",mp=g.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return o.jsx(we.div,{"aria-hidden":!0,...n,ref:t})});mp.displayName=U0;var ti="SelectArrow",H0=g.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,a=Do(r),s=Mr(ti,r),i=Vr(ti,r);return s.open&&i.position==="popper"?o.jsx(Xi,{...a,...n,ref:t}):null});H0.displayName=ti;var W0="SelectBubbleInput",pp=g.forwardRef(({__scopeSelect:e,value:t,...r},n)=>{const a=g.useRef(null),s=ke(n,a),i=ia(t);return g.useEffect(()=>{const l=a.current;if(!l)return;const c=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==t&&d){const u=new Event("change",{bubbles:!0});d.call(l,t),l.dispatchEvent(u)}},[i,t]),o.jsx(we.select,{...r,style:{...Im,...r.style},ref:s,defaultValue:t})});pp.displayName=W0;function fp(e){return e===""||e===void 0}function hp(e){const t=ft(e),r=g.useRef(""),n=g.useRef(0),a=g.useCallback(i=>{const l=r.current+i;t(l),function c(d){r.current=d,window.clearTimeout(n.current),d!==""&&(n.current=window.setTimeout(()=>c(""),1e3))}(l)},[t]),s=g.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return g.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,a,s]}function xp(e,t,r){const n=t.length>1&&Array.from(t).every(l=>l===t[0])?t[0]:t,a=r?e.indexOf(r):-1;let s=q0(e,Math.max(a,0));n.length===1&&(s=s.filter(l=>l!==r));const i=s.find(l=>l.textValue.toLowerCase().startsWith(n.toLowerCase()));return i!==r?i:void 0}function q0(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var G0=Um,gp=Wm,X0=Gm,Z0=Xm,K0=Zm,vp=Km,Y0=ep,bp=np,yp=op,J0=sp,Q0=lp,wp=cp,jp=dp,kp=mp;const Bt=G0,Ut=X0,Rt=g.forwardRef(({className:e,children:t,...r},n)=>o.jsxs(gp,{ref:n,className:K("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...r,children:[t,o.jsx(Z0,{asChild:!0,children:o.jsx(_.ChevronDown,{className:"h-4 w-4 opacity-50"})})]}));Rt.displayName=gp.displayName;const Cp=g.forwardRef(({className:e,...t},r)=>o.jsx(wp,{ref:r,className:K("flex cursor-default items-center justify-center py-1",e),...t,children:o.jsx(_.ChevronUp,{className:"h-4 w-4"})}));Cp.displayName=wp.displayName;const Np=g.forwardRef(({className:e,...t},r)=>o.jsx(jp,{ref:r,className:K("flex cursor-default items-center justify-center py-1",e),...t,children:o.jsx(_.ChevronDown,{className:"h-4 w-4"})}));Np.displayName=jp.displayName;const It=g.forwardRef(({className:e,children:t,position:r="popper",...n},a)=>o.jsx(K0,{children:o.jsxs(vp,{ref:a,className:K("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,...n,children:[o.jsx(Cp,{}),o.jsx(Y0,{className:K("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),o.jsx(Np,{})]})}));It.displayName=vp.displayName;const ew=g.forwardRef(({className:e,...t},r)=>o.jsx(bp,{ref:r,className:K("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));ew.displayName=bp.displayName;const qe=g.forwardRef(({className:e,children:t,...r},n)=>o.jsxs(yp,{ref:n,className:K("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[o.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:o.jsx(Q0,{children:o.jsx(_.Check,{className:"h-4 w-4"})})}),o.jsx(J0,{children:t})]}));qe.displayName=yp.displayName;const tw=g.forwardRef(({className:e,...t},r)=>o.jsx(kp,{ref:r,className:K("-mx-1 my-1 h-px bg-muted",e),...t}));tw.displayName=kp.displayName;var Sp=["PageUp","PageDown"],$p=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Ep={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Ln="Slider",[ri,rw,nw]=Ri(Ln),[Dp]=_t(Ln,[nw]),[aw,To]=Dp(Ln),Tp=g.forwardRef((e,t)=>{const{name:r,min:n=0,max:a=100,step:s=1,orientation:i="horizontal",disabled:l=!1,minStepsBetweenThumbs:c=0,defaultValue:d=[n],value:u,onValueChange:m=()=>{},onValueCommit:p=()=>{},inverted:f=!1,form:b,...h}=e,x=g.useRef(new Set),y=g.useRef(0),v=i==="horizontal"?ow:sw,[j=[],w]=dr({prop:u,defaultProp:d,onChange:D=>{var O;(O=[...x.current][y.current])==null||O.focus(),m(D)}}),C=g.useRef(j);function S(D){const O=uw(j,D);E(D,O)}function $(D){E(D,y.current)}function k(){const D=C.current[y.current];j[y.current]!==D&&p(j)}function E(D,O,{commit:L}={commit:!1}){const A=hw(s),z=xw(Math.round((D-n)/s)*s+n,A),X=ta(z,[n,a]);w((q=[])=>{const Z=cw(q,X,O);if(fw(Z,c*s)){y.current=Z.indexOf(X);const V=String(Z)!==String(q);return V&&L&&p(Z),V?Z:q}else return q})}return o.jsx(aw,{scope:e.__scopeSlider,name:r,disabled:l,min:n,max:a,valueIndexToChangeRef:y,thumbs:x.current,values:j,orientation:i,form:b,children:o.jsx(ri.Provider,{scope:e.__scopeSlider,children:o.jsx(ri.Slot,{scope:e.__scopeSlider,children:o.jsx(v,{"aria-disabled":l,"data-disabled":l?"":void 0,...h,ref:t,onPointerDown:ge(h.onPointerDown,()=>{l||(C.current=j)}),min:n,max:a,inverted:f,onSlideStart:l?void 0:S,onSlideMove:l?void 0:$,onSlideEnd:l?void 0:k,onHomeKeyDown:()=>!l&&E(n,0,{commit:!0}),onEndKeyDown:()=>!l&&E(a,j.length-1,{commit:!0}),onStepKeyDown:({event:D,direction:O})=>{if(!l){const L=Sp.includes(D.key)||D.shiftKey&&$p.includes(D.key)?10:1,A=y.current,z=j[A],X=s*L*O;E(z+X,A,{commit:!0})}}})})})})});Tp.displayName=Ln;var[Ap,Rp]=Dp(Ln,{startEdge:"left",endEdge:"right",size:"width",direction:1}),ow=g.forwardRef((e,t)=>{const{min:r,max:n,dir:a,inverted:s,onSlideStart:i,onSlideMove:l,onSlideEnd:c,onStepKeyDown:d,...u}=e,[m,p]=g.useState(null),f=ke(t,j=>p(j)),b=g.useRef(void 0),h=ca(a),x=h==="ltr",y=x&&!s||!x&&s;function v(j){const w=b.current||m.getBoundingClientRect(),C=[0,w.width],S=Yi(C,y?[r,n]:[n,r]);return b.current=w,S(j-w.left)}return o.jsx(Ap,{scope:e.__scopeSlider,startEdge:y?"left":"right",endEdge:y?"right":"left",direction:y?1:-1,size:"width",children:o.jsx(Ip,{dir:h,"data-orientation":"horizontal",...u,ref:f,style:{...u.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:j=>{const w=v(j.clientX);i==null||i(w)},onSlideMove:j=>{const w=v(j.clientX);l==null||l(w)},onSlideEnd:()=>{b.current=void 0,c==null||c()},onStepKeyDown:j=>{const w=Ep[y?"from-left":"from-right"].includes(j.key);d==null||d({event:j,direction:w?-1:1})}})})}),sw=g.forwardRef((e,t)=>{const{min:r,max:n,inverted:a,onSlideStart:s,onSlideMove:i,onSlideEnd:l,onStepKeyDown:c,...d}=e,u=g.useRef(null),m=ke(t,u),p=g.useRef(void 0),f=!a;function b(h){const x=p.current||u.current.getBoundingClientRect(),y=[0,x.height],v=Yi(y,f?[n,r]:[r,n]);return p.current=x,v(h-x.top)}return o.jsx(Ap,{scope:e.__scopeSlider,startEdge:f?"bottom":"top",endEdge:f?"top":"bottom",size:"height",direction:f?1:-1,children:o.jsx(Ip,{"data-orientation":"vertical",...d,ref:m,style:{...d.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:h=>{const x=b(h.clientY);s==null||s(x)},onSlideMove:h=>{const x=b(h.clientY);i==null||i(x)},onSlideEnd:()=>{p.current=void 0,l==null||l()},onStepKeyDown:h=>{const x=Ep[f?"from-bottom":"from-top"].includes(h.key);c==null||c({event:h,direction:x?-1:1})}})})}),Ip=g.forwardRef((e,t)=>{const{__scopeSlider:r,onSlideStart:n,onSlideMove:a,onSlideEnd:s,onHomeKeyDown:i,onEndKeyDown:l,onStepKeyDown:c,...d}=e,u=To(Ln,r);return o.jsx(we.span,{...d,ref:t,onKeyDown:ge(e.onKeyDown,m=>{m.key==="Home"?(i(m),m.preventDefault()):m.key==="End"?(l(m),m.preventDefault()):Sp.concat($p).includes(m.key)&&(c(m),m.preventDefault())}),onPointerDown:ge(e.onPointerDown,m=>{const p=m.target;p.setPointerCapture(m.pointerId),m.preventDefault(),u.thumbs.has(p)?p.focus():n(m)}),onPointerMove:ge(e.onPointerMove,m=>{m.target.hasPointerCapture(m.pointerId)&&a(m)}),onPointerUp:ge(e.onPointerUp,m=>{const p=m.target;p.hasPointerCapture(m.pointerId)&&(p.releasePointerCapture(m.pointerId),s(m))})})}),Pp="SliderTrack",_p=g.forwardRef((e,t)=>{const{__scopeSlider:r,...n}=e,a=To(Pp,r);return o.jsx(we.span,{"data-disabled":a.disabled?"":void 0,"data-orientation":a.orientation,...n,ref:t})});_p.displayName=Pp;var ni="SliderRange",Op=g.forwardRef((e,t)=>{const{__scopeSlider:r,...n}=e,a=To(ni,r),s=Rp(ni,r),i=g.useRef(null),l=ke(t,i),c=a.values.length,d=a.values.map(p=>Lp(p,a.min,a.max)),u=c>1?Math.min(...d):0,m=100-Math.max(...d);return o.jsx(we.span,{"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,...n,ref:l,style:{...e.style,[s.startEdge]:u+"%",[s.endEdge]:m+"%"}})});Op.displayName=ni;var ai="SliderThumb",Fp=g.forwardRef((e,t)=>{const r=rw(e.__scopeSlider),[n,a]=g.useState(null),s=ke(t,l=>a(l)),i=g.useMemo(()=>n?r().findIndex(l=>l.ref.current===n):-1,[r,n]);return o.jsx(iw,{...e,ref:s,index:i})}),iw=g.forwardRef((e,t)=>{const{__scopeSlider:r,index:n,name:a,...s}=e,i=To(ai,r),l=Rp(ai,r),[c,d]=g.useState(null),u=ke(t,v=>d(v)),m=c?i.form||!!c.closest("form"):!0,p=la(c),f=i.values[n],b=f===void 0?0:Lp(f,i.min,i.max),h=dw(n,i.values.length),x=p==null?void 0:p[l.size],y=x?mw(x,b,l.direction):0;return g.useEffect(()=>{if(c)return i.thumbs.add(c),()=>{i.thumbs.delete(c)}},[c,i.thumbs]),o.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[l.startEdge]:`calc(${b}% + ${y}px)`},children:[o.jsx(ri.ItemSlot,{scope:e.__scopeSlider,children:o.jsx(we.span,{role:"slider","aria-label":e["aria-label"]||h,"aria-valuemin":i.min,"aria-valuenow":f,"aria-valuemax":i.max,"aria-orientation":i.orientation,"data-orientation":i.orientation,"data-disabled":i.disabled?"":void 0,tabIndex:i.disabled?void 0:0,...s,ref:u,style:f===void 0?{display:"none"}:e.style,onFocus:ge(e.onFocus,()=>{i.valueIndexToChangeRef.current=n})})}),m&&o.jsx(zp,{name:a??(i.name?i.name+(i.values.length>1?"[]":""):void 0),form:i.form,value:f},n)]})});Fp.displayName=ai;var lw="RadioBubbleInput",zp=g.forwardRef(({__scopeSlider:e,value:t,...r},n)=>{const a=g.useRef(null),s=ke(a,n),i=ia(t);return g.useEffect(()=>{const l=a.current;if(!l)return;const c=window.HTMLInputElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==t&&d){const u=new Event("input",{bubbles:!0});d.call(l,t),l.dispatchEvent(u)}},[i,t]),o.jsx(we.input,{style:{display:"none"},...r,ref:s,defaultValue:t})});zp.displayName=lw;function cw(e=[],t,r){const n=[...e];return n[r]=t,n.sort((a,s)=>a-s)}function Lp(e,t,r){const n=100/(r-t)*(e-t);return ta(n,[0,100])}function dw(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function uw(e,t){if(e.length===1)return 0;const r=e.map(a=>Math.abs(a-t)),n=Math.min(...r);return r.indexOf(n)}function mw(e,t,r){const n=e/2,a=Yi([0,50],[0,n]);return(n-a(t)*r)*r}function pw(e){return e.slice(0,-1).map((t,r)=>e[r+1]-t)}function fw(e,t){if(t>0){const r=pw(e);return Math.min(...r)>=t}return!0}function Yi(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}function hw(e){return(String(e).split(".")[1]||"").length}function xw(e,t){const r=Math.pow(10,t);return Math.round(e*r)/r}var Mp=Tp,gw=_p,vw=Op,bw=Fp;const Ao=g.forwardRef(({className:e,...t},r)=>o.jsxs(Mp,{ref:r,className:K("relative flex w-full touch-none select-none items-center",e),...t,children:[o.jsx(gw,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:o.jsx(vw,{className:"absolute h-full bg-primary"})}),o.jsx(bw,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"})]}));Ao.displayName=Mp.displayName;const yw=g.forwardRef(({className:e,type:t="date",...r},n)=>o.jsx("input",{ref:n,type:t,className:K("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...r}));yw.displayName="DateInput";function ww(e,t=[]){let r=[];function n(s,i){const l=g.createContext(i);l.displayName=s+"Context";const c=r.length;r=[...r,i];const d=m=>{var p;const{scope:f,children:b,...h}=m,x=((p=f==null?void 0:f[e])==null?void 0:p[c])||l,y=g.useMemo(()=>h,Object.values(h));return o.jsx(x.Provider,{value:y,children:b})};d.displayName=s+"Provider";function u(m,p){var f;const b=((f=p==null?void 0:p[e])==null?void 0:f[c])||l,h=g.useContext(b);if(h)return h;if(i!==void 0)return i;throw new Error(`\`${m}\` must be used within \`${s}\``)}return[d,u]}const a=()=>{const s=r.map(i=>g.createContext(i));return function(i){const l=(i==null?void 0:i[e])||s;return g.useMemo(()=>({[`__scope${e}`]:{...i,[e]:l}}),[i,l])}};return a.scopeName=e,[n,jw(a,...t)]}function jw(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(a){const s=n.reduce((i,{useScope:l,scopeName:c})=>{const d=l(a)[`__scope${c}`];return{...i,...d}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return r.scopeName=t.scopeName,r}var Ji="Progress",Qi=100,[kw]=ww(Ji),[Cw,Nw]=kw(Ji),Vp=g.forwardRef((e,t)=>{const{__scopeProgress:r,value:n=null,max:a,getValueLabel:s=Sw,...i}=e;(a||a===0)&&!Dc(a)&&console.error($w(`${a}`,"Progress"));const l=Dc(a)?a:Qi;n!==null&&!Tc(n,l)&&console.error(Ew(`${n}`,"Progress"));const c=Tc(n,l)?n:null,d=Xa(c)?s(c,l):void 0;return o.jsx(Cw,{scope:r,value:c,max:l,children:o.jsx(fo.div,{"aria-valuemax":l,"aria-valuemin":0,"aria-valuenow":Xa(c)?c:void 0,"aria-valuetext":d,role:"progressbar","data-state":Hp(c,l),"data-value":c??void 0,"data-max":l,...i,ref:t})})});Vp.displayName=Ji;var Bp="ProgressIndicator",Up=g.forwardRef((e,t)=>{const{__scopeProgress:r,...n}=e,a=Nw(Bp,r);return o.jsx(fo.div,{"data-state":Hp(a.value,a.max),"data-value":a.value??void 0,"data-max":a.max,...n,ref:t})});Up.displayName=Bp;function Sw(e,t){return`${Math.round(e/t*100)}%`}function Hp(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function Xa(e){return typeof e=="number"}function Dc(e){return Xa(e)&&!isNaN(e)&&e>0}function Tc(e,t){return Xa(e)&&!isNaN(e)&&e<=t&&e>=0}function $w(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${Qi}\`.`}function Ew(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be:
|
|
70
|
+
`)},E0=0,un=[];function T0(e){var t=g.useRef([]),r=g.useRef([0,0]),n=g.useRef(),a=g.useState(E0++)[0],s=g.useState(Hm)[0],i=g.useRef(e);g.useEffect(function(){i.current=e},[e]),g.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var h=Ky([e.lockRef.current],(e.shards||[]).map(Ec)).filter(Boolean);return h.forEach(function(x){return x.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),h.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var l=g.useCallback(function(h,x){if("touches"in h&&h.touches.length===2||h.type==="wheel"&&h.ctrlKey)return!i.current.allowPinchZoom;var b=Ca(h),y=r.current,j="deltaX"in h?h.deltaX:y[0]-b[0],w="deltaY"in h?h.deltaY:y[1]-b[1],C,S=h.target,$=Math.abs(j)>Math.abs(w)?"h":"v";if("touches"in h&&$==="h"&&S.type==="range")return!1;var k=window.getSelection(),E=k&&k.anchorNode,T=E?E===S||E.contains(S):!1;if(T)return!1;var O=Sc($,S);if(!O)return!0;if(O?C=$:(C=$==="v"?"h":"v",O=Sc($,S)),!O)return!1;if(!n.current&&"changedTouches"in h&&(j||w)&&(n.current=C),!C)return!0;var L=n.current||C;return N0(L,x,h,L==="h"?j:w)},[]),c=g.useCallback(function(h){var x=h;if(!(!un.length||un[un.length-1]!==s)){var b="deltaY"in x?$c(x):Ca(x),y=t.current.filter(function(C){return C.name===x.type&&(C.target===x.target||x.target===C.shadowParent)&&S0(C.delta,b)})[0];if(y&&y.should){x.cancelable&&x.preventDefault();return}if(!y){var j=(i.current.shards||[]).map(Ec).filter(Boolean).filter(function(C){return C.contains(x.target)}),w=j.length>0?l(x,j[0]):!i.current.noIsolation;w&&x.cancelable&&x.preventDefault()}}},[]),d=g.useCallback(function(h,x,b,y){var j={name:h,delta:x,target:b,should:y,shadowParent:A0(b)};t.current.push(j),setTimeout(function(){t.current=t.current.filter(function(w){return w!==j})},1)},[]),u=g.useCallback(function(h){r.current=Ca(h),n.current=void 0},[]),m=g.useCallback(function(h){d(h.type,$c(h),h.target,l(h,e.lockRef.current))},[]),p=g.useCallback(function(h){d(h.type,Ca(h),h.target,l(h,e.lockRef.current))},[]);g.useEffect(function(){return un.push(s),e.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:p}),document.addEventListener("wheel",c,dn),document.addEventListener("touchmove",c,dn),document.addEventListener("touchstart",u,dn),function(){un=un.filter(function(h){return h!==s}),document.removeEventListener("wheel",c,dn),document.removeEventListener("touchmove",c,dn),document.removeEventListener("touchstart",u,dn)}},[]);var f=e.removeScrollBar,v=e.inert;return g.createElement(g.Fragment,null,v?g.createElement(s,{styles:$0(a)}):null,f?g.createElement(v0,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function A0(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const D0=o0(Um,T0);var wo=g.forwardRef(function(e,t){return g.createElement(yo,sr({},e,{ref:t,sideCar:D0}))});wo.classNames=yo.classNames;var R0=[" ","Enter","ArrowUp","ArrowDown"],P0=[" ","Enter"],en="Select",[jo,ko,_0]=Ai(en),[In]=_t(en,[_0,_n]),Co=_n(),[I0,Lr]=In(en),[O0,F0]=In(en),Xm=e=>{const{__scopeSelect:t,children:r,open:n,defaultOpen:a,onOpenChange:s,value:i,defaultValue:l,onValueChange:c,dir:d,name:u,autoComplete:m,disabled:p,required:f,form:v}=e,h=Co(t),[x,b]=g.useState(null),[y,j]=g.useState(null),[w,C]=g.useState(!1),S=oa(d),[$,k]=cr({prop:n,defaultProp:a??!1,onChange:s,caller:en}),[E,T]=cr({prop:i,defaultProp:l,onChange:c,caller:en}),O=g.useRef(null),L=x?v||!!x.closest("form"):!0,[A,z]=g.useState(new Set),X=Array.from(A).map(q=>q.props.value).join(";");return o.jsx(Hi,{...h,children:o.jsxs(I0,{required:f,scope:t,trigger:x,onTriggerChange:b,valueNode:y,onValueNodeChange:j,valueNodeHasChildren:w,onValueNodeHasChildrenChange:C,contentId:yr(),value:E,onValueChange:T,open:$,onOpenChange:k,dir:S,triggerPointerDownPosRef:O,disabled:p,children:[o.jsx(jo.Provider,{scope:t,children:o.jsx(O0,{scope:e.__scopeSelect,onNativeOptionAdd:g.useCallback(q=>{z(Z=>new Set(Z).add(q))},[]),onNativeOptionRemove:g.useCallback(q=>{z(Z=>{const V=new Set(Z);return V.delete(q),V})},[]),children:r})}),L?o.jsxs(vp,{"aria-hidden":!0,required:f,tabIndex:-1,name:u,autoComplete:m,value:E,onChange:q=>T(q.target.value),disabled:p,form:v,children:[E===void 0?o.jsx("option",{value:""}):null,Array.from(A)]},X):null]})})};Xm.displayName=en;var Zm="SelectTrigger",Km=g.forwardRef((e,t)=>{const{__scopeSelect:r,disabled:n=!1,...a}=e,s=Co(r),i=Lr(Zm,r),l=i.disabled||n,c=ke(t,i.onTriggerChange),d=ko(r),u=g.useRef("touch"),[m,p,f]=yp(h=>{const x=d().filter(j=>!j.disabled),b=x.find(j=>j.value===i.value),y=wp(x,h,b);y!==void 0&&i.onValueChange(y.value)}),v=h=>{l||(i.onOpenChange(!0),f()),h&&(i.triggerPointerDownPosRef.current={x:Math.round(h.pageX),y:Math.round(h.pageY)})};return o.jsx(vo,{asChild:!0,...s,children:o.jsx(we.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":bp(i.value)?"":void 0,...a,ref:c,onClick:ge(a.onClick,h=>{h.currentTarget.focus(),u.current!=="mouse"&&v(h)}),onPointerDown:ge(a.onPointerDown,h=>{u.current=h.pointerType;const x=h.target;x.hasPointerCapture(h.pointerId)&&x.releasePointerCapture(h.pointerId),h.button===0&&h.ctrlKey===!1&&h.pointerType==="mouse"&&(v(h),h.preventDefault())}),onKeyDown:ge(a.onKeyDown,h=>{const x=m.current!=="";!(h.ctrlKey||h.altKey||h.metaKey)&&h.key.length===1&&p(h.key),!(x&&h.key===" ")&&R0.includes(h.key)&&(v(),h.preventDefault())})})})});Km.displayName=Zm;var Ym="SelectValue",Jm=g.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:a,children:s,placeholder:i="",...l}=e,c=Lr(Ym,r),{onValueNodeHasChildrenChange:d}=c,u=s!==void 0,m=ke(t,c.onValueNodeChange);return lt(()=>{d(u)},[d,u]),o.jsx(we.span,{...l,ref:m,style:{pointerEvents:"none"},children:bp(c.value)?o.jsx(o.Fragment,{children:i}):s})});Jm.displayName=Ym;var z0="SelectIcon",Qm=g.forwardRef((e,t)=>{const{__scopeSelect:r,children:n,...a}=e;return o.jsx(we.span,{"aria-hidden":!0,...a,ref:t,children:n||"▼"})});Qm.displayName=z0;var L0="SelectPortal",ep=e=>o.jsx(bo,{asChild:!0,...e});ep.displayName=L0;var tn="SelectContent",tp=g.forwardRef((e,t)=>{const r=Lr(tn,e.__scopeSelect),[n,a]=g.useState();if(lt(()=>{a(new DocumentFragment)},[]),!r.open){const s=n;return s?ao.createPortal(o.jsx(rp,{scope:e.__scopeSelect,children:o.jsx(jo.Slot,{scope:e.__scopeSelect,children:o.jsx("div",{children:e.children})})}),s):null}return o.jsx(np,{...e,ref:t})});tp.displayName=tn;var Wt=10,[rp,Mr]=In(tn),M0="SelectContentImpl",V0=Cn("SelectContent.RemoveScroll"),np=g.forwardRef((e,t)=>{const{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:s,onPointerDownOutside:i,side:l,sideOffset:c,align:d,alignOffset:u,arrowPadding:m,collisionBoundary:p,collisionPadding:f,sticky:v,hideWhenDetached:h,avoidCollisions:x,...b}=e,y=Lr(tn,r),[j,w]=g.useState(null),[C,S]=g.useState(null),$=ke(t,G=>w(G)),[k,E]=g.useState(null),[T,O]=g.useState(null),L=ko(r),[A,z]=g.useState(!1),X=g.useRef(!1);g.useEffect(()=>{if(j)return Gi(j)},[j]),Ii();const q=g.useCallback(G=>{const[ne,...J]=L().map(be=>be.ref.current),[te]=J.slice(-1),ce=document.activeElement;for(const be of G)if(be===ce||(be==null||be.scrollIntoView({block:"nearest"}),be===ne&&C&&(C.scrollTop=0),be===te&&C&&(C.scrollTop=C.scrollHeight),be==null||be.focus(),document.activeElement!==ce))return},[L,C]),Z=g.useCallback(()=>q([k,j]),[q,k,j]);g.useEffect(()=>{A&&Z()},[A,Z]);const{onOpenChange:V,triggerPointerDownPosRef:M}=y;g.useEffect(()=>{if(j){let G={x:0,y:0};const ne=te=>{var ce,be;G={x:Math.abs(Math.round(te.pageX)-(((ce=M.current)==null?void 0:ce.x)??0)),y:Math.abs(Math.round(te.pageY)-(((be=M.current)==null?void 0:be.y)??0))}},J=te=>{G.x<=10&&G.y<=10?te.preventDefault():j.contains(te.target)||V(!1),document.removeEventListener("pointermove",ne),M.current=null};return M.current!==null&&(document.addEventListener("pointermove",ne),document.addEventListener("pointerup",J,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ne),document.removeEventListener("pointerup",J,{capture:!0})}}},[j,V,M]),g.useEffect(()=>{const G=()=>V(!1);return window.addEventListener("blur",G),window.addEventListener("resize",G),()=>{window.removeEventListener("blur",G),window.removeEventListener("resize",G)}},[V]);const[_,se]=yp(G=>{const ne=L().filter(ce=>!ce.disabled),J=ne.find(ce=>ce.ref.current===document.activeElement),te=wp(ne,G,J);te&&setTimeout(()=>te.ref.current.focus())}),U=g.useCallback((G,ne,J)=>{const te=!X.current&&!J;(y.value!==void 0&&y.value===ne||te)&&(E(G),te&&(X.current=!0))},[y.value]),Q=g.useCallback(()=>j==null?void 0:j.focus(),[j]),Y=g.useCallback((G,ne,J)=>{const te=!X.current&&!J;(y.value!==void 0&&y.value===ne||te)&&O(G)},[y.value]),H=n==="popper"?Gs:ap,W=H===Gs?{side:l,sideOffset:c,align:d,alignOffset:u,arrowPadding:m,collisionBoundary:p,collisionPadding:f,sticky:v,hideWhenDetached:h,avoidCollisions:x}:{};return o.jsx(rp,{scope:r,content:j,viewport:C,onViewportChange:S,itemRefCallback:U,selectedItem:k,onItemLeave:Q,itemTextRefCallback:Y,focusSelectedItem:Z,selectedItemText:T,position:n,isPositioned:A,searchRef:_,children:o.jsx(wo,{as:V0,allowPinchZoom:!0,children:o.jsx(po,{asChild:!0,trapped:y.open,onMountAutoFocus:G=>{G.preventDefault()},onUnmountAutoFocus:ge(a,G=>{var ne;(ne=y.trigger)==null||ne.focus({preventScroll:!0}),G.preventDefault()}),children:o.jsx(ia,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:G=>G.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:o.jsx(H,{role:"listbox",id:y.contentId,"data-state":y.open?"open":"closed",dir:y.dir,onContextMenu:G=>G.preventDefault(),...b,...W,onPlaced:()=>z(!0),ref:$,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:ge(b.onKeyDown,G=>{const ne=G.ctrlKey||G.altKey||G.metaKey;if(G.key==="Tab"&&G.preventDefault(),!ne&&G.key.length===1&&se(G.key),["ArrowUp","ArrowDown","Home","End"].includes(G.key)){let J=L().filter(te=>!te.disabled).map(te=>te.ref.current);if(["ArrowUp","End"].includes(G.key)&&(J=J.slice().reverse()),["ArrowUp","ArrowDown"].includes(G.key)){const te=G.target,ce=J.indexOf(te);J=J.slice(ce+1)}setTimeout(()=>q(J)),G.preventDefault()}})})})})})})});np.displayName=M0;var B0="SelectItemAlignedPosition",ap=g.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:n,...a}=e,s=Lr(tn,r),i=Mr(tn,r),[l,c]=g.useState(null),[d,u]=g.useState(null),m=ke(t,$=>u($)),p=ko(r),f=g.useRef(!1),v=g.useRef(!0),{viewport:h,selectedItem:x,selectedItemText:b,focusSelectedItem:y}=i,j=g.useCallback(()=>{if(s.trigger&&s.valueNode&&l&&d&&h&&x&&b){const $=s.trigger.getBoundingClientRect(),k=d.getBoundingClientRect(),E=s.valueNode.getBoundingClientRect(),T=b.getBoundingClientRect();if(s.dir!=="rtl"){const te=T.left-k.left,ce=E.left-te,be=$.left-ce,Ce=$.width+be,ve=Math.max(Ce,k.width),me=window.innerWidth-Wt,Te=Yn(ce,[Wt,Math.max(Wt,me-ve)]);l.style.minWidth=Ce+"px",l.style.left=Te+"px"}else{const te=k.right-T.right,ce=window.innerWidth-E.right-te,be=window.innerWidth-$.right-ce,Ce=$.width+be,ve=Math.max(Ce,k.width),me=window.innerWidth-Wt,Te=Yn(ce,[Wt,Math.max(Wt,me-ve)]);l.style.minWidth=Ce+"px",l.style.right=Te+"px"}const O=p(),L=window.innerHeight-Wt*2,A=h.scrollHeight,z=window.getComputedStyle(d),X=parseInt(z.borderTopWidth,10),q=parseInt(z.paddingTop,10),Z=parseInt(z.borderBottomWidth,10),V=parseInt(z.paddingBottom,10),M=X+q+A+V+Z,_=Math.min(x.offsetHeight*5,M),se=window.getComputedStyle(h),U=parseInt(se.paddingTop,10),Q=parseInt(se.paddingBottom,10),Y=$.top+$.height/2-Wt,H=L-Y,W=x.offsetHeight/2,G=x.offsetTop+W,ne=X+q+G,J=M-ne;if(ne<=Y){const te=O.length>0&&x===O[O.length-1].ref.current;l.style.bottom="0px";const ce=d.clientHeight-h.offsetTop-h.offsetHeight,be=Math.max(H,W+(te?Q:0)+ce+Z),Ce=ne+be;l.style.height=Ce+"px"}else{const te=O.length>0&&x===O[0].ref.current;l.style.top="0px";const ce=Math.max(Y,X+h.offsetTop+(te?U:0)+W)+J;l.style.height=ce+"px",h.scrollTop=ne-Y+h.offsetTop}l.style.margin=`${Wt}px 0`,l.style.minHeight=_+"px",l.style.maxHeight=L+"px",n==null||n(),requestAnimationFrame(()=>f.current=!0)}},[p,s.trigger,s.valueNode,l,d,h,x,b,s.dir,n]);lt(()=>j(),[j]);const[w,C]=g.useState();lt(()=>{d&&C(window.getComputedStyle(d).zIndex)},[d]);const S=g.useCallback($=>{$&&v.current===!0&&(j(),y==null||y(),v.current=!1)},[j,y]);return o.jsx(H0,{scope:r,contentWrapper:l,shouldExpandOnScrollRef:f,onScrollButtonChange:S,children:o.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:w},children:o.jsx(we.div,{...a,ref:m,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});ap.displayName=B0;var U0="SelectPopperPosition",Gs=g.forwardRef((e,t)=>{const{__scopeSelect:r,align:n="start",collisionPadding:a=Wt,...s}=e,i=Co(r);return o.jsx(Wi,{...i,...s,ref:t,align:n,collisionPadding:a,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Gs.displayName=U0;var[H0,Xi]=In(tn,{}),Xs="SelectViewport",op=g.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:n,...a}=e,s=Mr(Xs,r),i=Xi(Xs,r),l=ke(t,s.onViewportChange),c=g.useRef(0);return o.jsxs(o.Fragment,{children:[o.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:n}),o.jsx(jo.Slot,{scope:r,children:o.jsx(we.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:ge(a.onScroll,d=>{const u=d.currentTarget,{contentWrapper:m,shouldExpandOnScrollRef:p}=i;if(p!=null&&p.current&&m){const f=Math.abs(c.current-u.scrollTop);if(f>0){const v=window.innerHeight-Wt*2,h=parseFloat(m.style.minHeight),x=parseFloat(m.style.height),b=Math.max(h,x);if(b<v){const y=b+f,j=Math.min(v,y),w=y-j;m.style.height=j+"px",m.style.bottom==="0px"&&(u.scrollTop=w>0?w:0,m.style.justifyContent="flex-end")}}}c.current=u.scrollTop})})})]})});op.displayName=Xs;var sp="SelectGroup",[W0,q0]=In(sp),G0=g.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,a=yr();return o.jsx(W0,{scope:r,id:a,children:o.jsx(we.div,{role:"group","aria-labelledby":a,...n,ref:t})})});G0.displayName=sp;var ip="SelectLabel",lp=g.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,a=q0(ip,r);return o.jsx(we.div,{id:a.id,...n,ref:t})});lp.displayName=ip;var Ba="SelectItem",[X0,cp]=In(Ba),dp=g.forwardRef((e,t)=>{const{__scopeSelect:r,value:n,disabled:a=!1,textValue:s,...i}=e,l=Lr(Ba,r),c=Mr(Ba,r),d=l.value===n,[u,m]=g.useState(s??""),[p,f]=g.useState(!1),v=ke(t,y=>{var j;return(j=c.itemRefCallback)==null?void 0:j.call(c,y,n,a)}),h=yr(),x=g.useRef("touch"),b=()=>{a||(l.onValueChange(n),l.onOpenChange(!1))};if(n==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return o.jsx(X0,{scope:r,value:n,disabled:a,textId:h,isSelected:d,onItemTextChange:g.useCallback(y=>{m(j=>j||((y==null?void 0:y.textContent)??"").trim())},[]),children:o.jsx(jo.ItemSlot,{scope:r,value:n,disabled:a,textValue:u,children:o.jsx(we.div,{role:"option","aria-labelledby":h,"data-highlighted":p?"":void 0,"aria-selected":d&&p,"data-state":d?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...i,ref:v,onFocus:ge(i.onFocus,()=>f(!0)),onBlur:ge(i.onBlur,()=>f(!1)),onClick:ge(i.onClick,()=>{x.current!=="mouse"&&b()}),onPointerUp:ge(i.onPointerUp,()=>{x.current==="mouse"&&b()}),onPointerDown:ge(i.onPointerDown,y=>{x.current=y.pointerType}),onPointerMove:ge(i.onPointerMove,y=>{var j;x.current=y.pointerType,a?(j=c.onItemLeave)==null||j.call(c):x.current==="mouse"&&y.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ge(i.onPointerLeave,y=>{var j;y.currentTarget===document.activeElement&&((j=c.onItemLeave)==null||j.call(c))}),onKeyDown:ge(i.onKeyDown,y=>{var j;((j=c.searchRef)==null?void 0:j.current)!==""&&y.key===" "||(P0.includes(y.key)&&b(),y.key===" "&&y.preventDefault())})})})})});dp.displayName=Ba;var Wn="SelectItemText",up=g.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:a,...s}=e,i=Lr(Wn,r),l=Mr(Wn,r),c=cp(Wn,r),d=F0(Wn,r),[u,m]=g.useState(null),p=ke(t,b=>m(b),c.onItemTextChange,b=>{var y;return(y=l.itemTextRefCallback)==null?void 0:y.call(l,b,c.value,c.disabled)}),f=u==null?void 0:u.textContent,v=g.useMemo(()=>o.jsx("option",{value:c.value,disabled:c.disabled,children:f},c.value),[c.disabled,c.value,f]),{onNativeOptionAdd:h,onNativeOptionRemove:x}=d;return lt(()=>(h(v),()=>x(v)),[h,x,v]),o.jsxs(o.Fragment,{children:[o.jsx(we.span,{id:c.textId,...s,ref:p}),c.isSelected&&i.valueNode&&!i.valueNodeHasChildren?ao.createPortal(s.children,i.valueNode):null]})});up.displayName=Wn;var mp="SelectItemIndicator",pp=g.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return cp(mp,r).isSelected?o.jsx(we.span,{"aria-hidden":!0,...n,ref:t}):null});pp.displayName=mp;var Zs="SelectScrollUpButton",fp=g.forwardRef((e,t)=>{const r=Mr(Zs,e.__scopeSelect),n=Xi(Zs,e.__scopeSelect),[a,s]=g.useState(!1),i=ke(t,n.onScrollButtonChange);return lt(()=>{if(r.viewport&&r.isPositioned){let l=function(){const d=c.scrollTop>0;s(d)};const c=r.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[r.viewport,r.isPositioned]),a?o.jsx(xp,{...e,ref:i,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=r;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});fp.displayName=Zs;var Ks="SelectScrollDownButton",hp=g.forwardRef((e,t)=>{const r=Mr(Ks,e.__scopeSelect),n=Xi(Ks,e.__scopeSelect),[a,s]=g.useState(!1),i=ke(t,n.onScrollButtonChange);return lt(()=>{if(r.viewport&&r.isPositioned){let l=function(){const d=c.scrollHeight-c.clientHeight,u=Math.ceil(c.scrollTop)<d;s(u)};const c=r.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[r.viewport,r.isPositioned]),a?o.jsx(xp,{...e,ref:i,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=r;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});hp.displayName=Ks;var xp=g.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:n,...a}=e,s=Mr("SelectScrollButton",r),i=g.useRef(null),l=ko(r),c=g.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return g.useEffect(()=>()=>c(),[c]),lt(()=>{var d;const u=l().find(m=>m.ref.current===document.activeElement);(d=u==null?void 0:u.ref.current)==null||d.scrollIntoView({block:"nearest"})},[l]),o.jsx(we.div,{"aria-hidden":!0,...a,ref:t,style:{flexShrink:0,...a.style},onPointerDown:ge(a.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(n,50))}),onPointerMove:ge(a.onPointerMove,()=>{var d;(d=s.onItemLeave)==null||d.call(s),i.current===null&&(i.current=window.setInterval(n,50))}),onPointerLeave:ge(a.onPointerLeave,()=>{c()})})}),Z0="SelectSeparator",gp=g.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return o.jsx(we.div,{"aria-hidden":!0,...n,ref:t})});gp.displayName=Z0;var Ys="SelectArrow",K0=g.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,a=Co(r),s=Lr(Ys,r),i=Mr(Ys,r);return s.open&&i.position==="popper"?o.jsx(qi,{...a,...n,ref:t}):null});K0.displayName=Ys;var Y0="SelectBubbleInput",vp=g.forwardRef(({__scopeSelect:e,value:t,...r},n)=>{const a=g.useRef(null),s=ke(n,a),i=na(t);return g.useEffect(()=>{const l=a.current;if(!l)return;const c=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==t&&d){const u=new Event("change",{bubbles:!0});d.call(l,t),l.dispatchEvent(u)}},[i,t]),o.jsx(we.select,{...r,style:{...zm,...r.style},ref:s,defaultValue:t})});vp.displayName=Y0;function bp(e){return e===""||e===void 0}function yp(e){const t=ft(e),r=g.useRef(""),n=g.useRef(0),a=g.useCallback(i=>{const l=r.current+i;t(l),function c(d){r.current=d,window.clearTimeout(n.current),d!==""&&(n.current=window.setTimeout(()=>c(""),1e3))}(l)},[t]),s=g.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return g.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,a,s]}function wp(e,t,r){const n=t.length>1&&Array.from(t).every(l=>l===t[0])?t[0]:t,a=r?e.indexOf(r):-1;let s=J0(e,Math.max(a,0));n.length===1&&(s=s.filter(l=>l!==r));const i=s.find(l=>l.textValue.toLowerCase().startsWith(n.toLowerCase()));return i!==r?i:void 0}function J0(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var Q0=Xm,jp=Km,ew=Jm,tw=Qm,rw=ep,kp=tp,nw=op,Cp=lp,Np=dp,aw=up,ow=pp,Sp=fp,$p=hp,Ep=gp;const Vt=Q0,Bt=ew,Dt=g.forwardRef(({className:e,children:t,...r},n)=>o.jsxs(jp,{ref:n,className:K("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...r,children:[t,o.jsx(tw,{asChild:!0,children:o.jsx(I.ChevronDown,{className:"h-4 w-4 opacity-50"})})]}));Dt.displayName=jp.displayName;const Tp=g.forwardRef(({className:e,...t},r)=>o.jsx(Sp,{ref:r,className:K("flex cursor-default items-center justify-center py-1",e),...t,children:o.jsx(I.ChevronUp,{className:"h-4 w-4"})}));Tp.displayName=Sp.displayName;const Ap=g.forwardRef(({className:e,...t},r)=>o.jsx($p,{ref:r,className:K("flex cursor-default items-center justify-center py-1",e),...t,children:o.jsx(I.ChevronDown,{className:"h-4 w-4"})}));Ap.displayName=$p.displayName;const Rt=g.forwardRef(({className:e,children:t,position:r="popper",...n},a)=>o.jsx(rw,{children:o.jsxs(kp,{ref:a,className:K("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,...n,children:[o.jsx(Tp,{}),o.jsx(nw,{className:K("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),o.jsx(Ap,{})]})}));Rt.displayName=kp.displayName;const sw=g.forwardRef(({className:e,...t},r)=>o.jsx(Cp,{ref:r,className:K("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));sw.displayName=Cp.displayName;const Xe=g.forwardRef(({className:e,children:t,...r},n)=>o.jsxs(Np,{ref:n,className:K("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[o.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:o.jsx(ow,{children:o.jsx(I.Check,{className:"h-4 w-4"})})}),o.jsx(aw,{children:t})]}));Xe.displayName=Np.displayName;const iw=g.forwardRef(({className:e,...t},r)=>o.jsx(Ep,{ref:r,className:K("-mx-1 my-1 h-px bg-muted",e),...t}));iw.displayName=Ep.displayName;var Dp=["PageUp","PageDown"],Rp=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Pp={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},On="Slider",[Js,lw,cw]=Ai(On),[_p]=_t(On,[cw]),[dw,No]=_p(On),Ip=g.forwardRef((e,t)=>{const{name:r,min:n=0,max:a=100,step:s=1,orientation:i="horizontal",disabled:l=!1,minStepsBetweenThumbs:c=0,defaultValue:d=[n],value:u,onValueChange:m=()=>{},onValueCommit:p=()=>{},inverted:f=!1,form:v,...h}=e,x=g.useRef(new Set),b=g.useRef(0),y=i==="horizontal"?uw:mw,[j=[],w]=cr({prop:u,defaultProp:d,onChange:T=>{var O;(O=[...x.current][b.current])==null||O.focus(),m(T)}}),C=g.useRef(j);function S(T){const O=gw(j,T);E(T,O)}function $(T){E(T,b.current)}function k(){const T=C.current[b.current];j[b.current]!==T&&p(j)}function E(T,O,{commit:L}={commit:!1}){const A=ww(s),z=jw(Math.round((T-n)/s)*s+n,A),X=Yn(z,[n,a]);w((q=[])=>{const Z=hw(q,X,O);if(yw(Z,c*s)){b.current=Z.indexOf(X);const V=String(Z)!==String(q);return V&&L&&p(Z),V?Z:q}else return q})}return o.jsx(dw,{scope:e.__scopeSlider,name:r,disabled:l,min:n,max:a,valueIndexToChangeRef:b,thumbs:x.current,values:j,orientation:i,form:v,children:o.jsx(Js.Provider,{scope:e.__scopeSlider,children:o.jsx(Js.Slot,{scope:e.__scopeSlider,children:o.jsx(y,{"aria-disabled":l,"data-disabled":l?"":void 0,...h,ref:t,onPointerDown:ge(h.onPointerDown,()=>{l||(C.current=j)}),min:n,max:a,inverted:f,onSlideStart:l?void 0:S,onSlideMove:l?void 0:$,onSlideEnd:l?void 0:k,onHomeKeyDown:()=>!l&&E(n,0,{commit:!0}),onEndKeyDown:()=>!l&&E(a,j.length-1,{commit:!0}),onStepKeyDown:({event:T,direction:O})=>{if(!l){const L=Dp.includes(T.key)||T.shiftKey&&Rp.includes(T.key)?10:1,A=b.current,z=j[A],X=s*L*O;E(z+X,A,{commit:!0})}}})})})})});Ip.displayName=On;var[Op,Fp]=_p(On,{startEdge:"left",endEdge:"right",size:"width",direction:1}),uw=g.forwardRef((e,t)=>{const{min:r,max:n,dir:a,inverted:s,onSlideStart:i,onSlideMove:l,onSlideEnd:c,onStepKeyDown:d,...u}=e,[m,p]=g.useState(null),f=ke(t,j=>p(j)),v=g.useRef(void 0),h=oa(a),x=h==="ltr",b=x&&!s||!x&&s;function y(j){const w=v.current||m.getBoundingClientRect(),C=[0,w.width],S=Zi(C,b?[r,n]:[n,r]);return v.current=w,S(j-w.left)}return o.jsx(Op,{scope:e.__scopeSlider,startEdge:b?"left":"right",endEdge:b?"right":"left",direction:b?1:-1,size:"width",children:o.jsx(zp,{dir:h,"data-orientation":"horizontal",...u,ref:f,style:{...u.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:j=>{const w=y(j.clientX);i==null||i(w)},onSlideMove:j=>{const w=y(j.clientX);l==null||l(w)},onSlideEnd:()=>{v.current=void 0,c==null||c()},onStepKeyDown:j=>{const w=Pp[b?"from-left":"from-right"].includes(j.key);d==null||d({event:j,direction:w?-1:1})}})})}),mw=g.forwardRef((e,t)=>{const{min:r,max:n,inverted:a,onSlideStart:s,onSlideMove:i,onSlideEnd:l,onStepKeyDown:c,...d}=e,u=g.useRef(null),m=ke(t,u),p=g.useRef(void 0),f=!a;function v(h){const x=p.current||u.current.getBoundingClientRect(),b=[0,x.height],y=Zi(b,f?[n,r]:[r,n]);return p.current=x,y(h-x.top)}return o.jsx(Op,{scope:e.__scopeSlider,startEdge:f?"bottom":"top",endEdge:f?"top":"bottom",size:"height",direction:f?1:-1,children:o.jsx(zp,{"data-orientation":"vertical",...d,ref:m,style:{...d.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:h=>{const x=v(h.clientY);s==null||s(x)},onSlideMove:h=>{const x=v(h.clientY);i==null||i(x)},onSlideEnd:()=>{p.current=void 0,l==null||l()},onStepKeyDown:h=>{const x=Pp[f?"from-bottom":"from-top"].includes(h.key);c==null||c({event:h,direction:x?-1:1})}})})}),zp=g.forwardRef((e,t)=>{const{__scopeSlider:r,onSlideStart:n,onSlideMove:a,onSlideEnd:s,onHomeKeyDown:i,onEndKeyDown:l,onStepKeyDown:c,...d}=e,u=No(On,r);return o.jsx(we.span,{...d,ref:t,onKeyDown:ge(e.onKeyDown,m=>{m.key==="Home"?(i(m),m.preventDefault()):m.key==="End"?(l(m),m.preventDefault()):Dp.concat(Rp).includes(m.key)&&(c(m),m.preventDefault())}),onPointerDown:ge(e.onPointerDown,m=>{const p=m.target;p.setPointerCapture(m.pointerId),m.preventDefault(),u.thumbs.has(p)?p.focus():n(m)}),onPointerMove:ge(e.onPointerMove,m=>{m.target.hasPointerCapture(m.pointerId)&&a(m)}),onPointerUp:ge(e.onPointerUp,m=>{const p=m.target;p.hasPointerCapture(m.pointerId)&&(p.releasePointerCapture(m.pointerId),s(m))})})}),Lp="SliderTrack",Mp=g.forwardRef((e,t)=>{const{__scopeSlider:r,...n}=e,a=No(Lp,r);return o.jsx(we.span,{"data-disabled":a.disabled?"":void 0,"data-orientation":a.orientation,...n,ref:t})});Mp.displayName=Lp;var Qs="SliderRange",Vp=g.forwardRef((e,t)=>{const{__scopeSlider:r,...n}=e,a=No(Qs,r),s=Fp(Qs,r),i=g.useRef(null),l=ke(t,i),c=a.values.length,d=a.values.map(p=>Hp(p,a.min,a.max)),u=c>1?Math.min(...d):0,m=100-Math.max(...d);return o.jsx(we.span,{"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,...n,ref:l,style:{...e.style,[s.startEdge]:u+"%",[s.endEdge]:m+"%"}})});Vp.displayName=Qs;var ei="SliderThumb",Bp=g.forwardRef((e,t)=>{const r=lw(e.__scopeSlider),[n,a]=g.useState(null),s=ke(t,l=>a(l)),i=g.useMemo(()=>n?r().findIndex(l=>l.ref.current===n):-1,[r,n]);return o.jsx(pw,{...e,ref:s,index:i})}),pw=g.forwardRef((e,t)=>{const{__scopeSlider:r,index:n,name:a,...s}=e,i=No(ei,r),l=Fp(ei,r),[c,d]=g.useState(null),u=ke(t,y=>d(y)),m=c?i.form||!!c.closest("form"):!0,p=aa(c),f=i.values[n],v=f===void 0?0:Hp(f,i.min,i.max),h=xw(n,i.values.length),x=p==null?void 0:p[l.size],b=x?vw(x,v,l.direction):0;return g.useEffect(()=>{if(c)return i.thumbs.add(c),()=>{i.thumbs.delete(c)}},[c,i.thumbs]),o.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[l.startEdge]:`calc(${v}% + ${b}px)`},children:[o.jsx(Js.ItemSlot,{scope:e.__scopeSlider,children:o.jsx(we.span,{role:"slider","aria-label":e["aria-label"]||h,"aria-valuemin":i.min,"aria-valuenow":f,"aria-valuemax":i.max,"aria-orientation":i.orientation,"data-orientation":i.orientation,"data-disabled":i.disabled?"":void 0,tabIndex:i.disabled?void 0:0,...s,ref:u,style:f===void 0?{display:"none"}:e.style,onFocus:ge(e.onFocus,()=>{i.valueIndexToChangeRef.current=n})})}),m&&o.jsx(Up,{name:a??(i.name?i.name+(i.values.length>1?"[]":""):void 0),form:i.form,value:f},n)]})});Bp.displayName=ei;var fw="RadioBubbleInput",Up=g.forwardRef(({__scopeSlider:e,value:t,...r},n)=>{const a=g.useRef(null),s=ke(a,n),i=na(t);return g.useEffect(()=>{const l=a.current;if(!l)return;const c=window.HTMLInputElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==t&&d){const u=new Event("input",{bubbles:!0});d.call(l,t),l.dispatchEvent(u)}},[i,t]),o.jsx(we.input,{style:{display:"none"},...r,ref:s,defaultValue:t})});Up.displayName=fw;function hw(e=[],t,r){const n=[...e];return n[r]=t,n.sort((a,s)=>a-s)}function Hp(e,t,r){const n=100/(r-t)*(e-t);return Yn(n,[0,100])}function xw(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function gw(e,t){if(e.length===1)return 0;const r=e.map(a=>Math.abs(a-t)),n=Math.min(...r);return r.indexOf(n)}function vw(e,t,r){const n=e/2,a=Zi([0,50],[0,n]);return(n-a(t)*r)*r}function bw(e){return e.slice(0,-1).map((t,r)=>e[r+1]-t)}function yw(e,t){if(t>0){const r=bw(e);return Math.min(...r)>=t}return!0}function Zi(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}function ww(e){return(String(e).split(".")[1]||"").length}function jw(e,t){const r=Math.pow(10,t);return Math.round(e*r)/r}var Wp=Ip,kw=Mp,Cw=Vp,Nw=Bp;const So=g.forwardRef(({className:e,...t},r)=>o.jsxs(Wp,{ref:r,className:K("relative flex w-full touch-none select-none items-center",e),...t,children:[o.jsx(kw,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:o.jsx(Cw,{className:"absolute h-full bg-primary"})}),o.jsx(Nw,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"})]}));So.displayName=Wp.displayName;const Sw=g.forwardRef(({className:e,type:t="date",...r},n)=>o.jsx("input",{ref:n,type:t,className:K("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...r}));Sw.displayName="DateInput";function $w(e,t=[]){let r=[];function n(s,i){const l=g.createContext(i);l.displayName=s+"Context";const c=r.length;r=[...r,i];const d=m=>{var p;const{scope:f,children:v,...h}=m,x=((p=f==null?void 0:f[e])==null?void 0:p[c])||l,b=g.useMemo(()=>h,Object.values(h));return o.jsx(x.Provider,{value:b,children:v})};d.displayName=s+"Provider";function u(m,p){var f;const v=((f=p==null?void 0:p[e])==null?void 0:f[c])||l,h=g.useContext(v);if(h)return h;if(i!==void 0)return i;throw new Error(`\`${m}\` must be used within \`${s}\``)}return[d,u]}const a=()=>{const s=r.map(i=>g.createContext(i));return function(i){const l=(i==null?void 0:i[e])||s;return g.useMemo(()=>({[`__scope${e}`]:{...i,[e]:l}}),[i,l])}};return a.scopeName=e,[n,Ew(a,...t)]}function Ew(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(a){const s=n.reduce((i,{useScope:l,scopeName:c})=>{const d=l(a)[`__scope${c}`];return{...i,...d}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return r.scopeName=t.scopeName,r}var Ki="Progress",Yi=100,[Tw]=$w(Ki),[Aw,Dw]=Tw(Ki),qp=g.forwardRef((e,t)=>{const{__scopeProgress:r,value:n=null,max:a,getValueLabel:s=Rw,...i}=e;(a||a===0)&&!Tc(a)&&console.error(Pw(`${a}`,"Progress"));const l=Tc(a)?a:Yi;n!==null&&!Ac(n,l)&&console.error(_w(`${n}`,"Progress"));const c=Ac(n,l)?n:null,d=Ua(c)?s(c,l):void 0;return o.jsx(Aw,{scope:r,value:c,max:l,children:o.jsx(lo.div,{"aria-valuemax":l,"aria-valuemin":0,"aria-valuenow":Ua(c)?c:void 0,"aria-valuetext":d,role:"progressbar","data-state":Zp(c,l),"data-value":c??void 0,"data-max":l,...i,ref:t})})});qp.displayName=Ki;var Gp="ProgressIndicator",Xp=g.forwardRef((e,t)=>{const{__scopeProgress:r,...n}=e,a=Dw(Gp,r);return o.jsx(lo.div,{"data-state":Zp(a.value,a.max),"data-value":a.value??void 0,"data-max":a.max,...n,ref:t})});Xp.displayName=Gp;function Rw(e,t){return`${Math.round(e/t*100)}%`}function Zp(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function Ua(e){return typeof e=="number"}function Tc(e){return Ua(e)&&!isNaN(e)&&e>0}function Ac(e,t){return Ua(e)&&!isNaN(e)&&e<=t&&e>=0}function Pw(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${Yi}\`.`}function _w(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be:
|
|
71
71
|
- a positive number
|
|
72
|
-
- less than the value passed to \`max\` (or ${
|
|
72
|
+
- less than the value passed to \`max\` (or ${Yi} if no \`max\` prop is set)
|
|
73
73
|
- \`null\` or \`undefined\` if the progress is indeterminate.
|
|
74
74
|
|
|
75
|
-
Defaulting to \`null\`.`}var
|
|
75
|
+
Defaulting to \`null\`.`}var Kp=qp,Iw=Xp;const Ji=g.forwardRef(({className:e,value:t,...r},n)=>o.jsx(Kp,{ref:n,className:K("relative h-4 w-full overflow-hidden rounded-full bg-secondary",e),...r,children:o.jsx(Iw,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));Ji.displayName=Kp.displayName;const Ow=g.forwardRef(({value:e,onChange:t,uploadProgress:r,accept:n,disabled:a,multiple:s=!1,placeholder:i="Nenhum arquivo selecionado",className:l,buttonLabel:c="Selecionar arquivo"},d)=>{const u=g.useRef(null);g.useImperativeHandle(d,()=>u.current);const m=()=>{var h;a||(h=u.current)==null||h.click()},p=h=>{var x;const b=((x=h.target.files)==null?void 0:x[0])??null;t==null||t(b),h.target.value=""},f=h=>{h.stopPropagation(),t==null||t(null)},v=r!==void 0&&r>0&&r<100;return o.jsxs("div",{className:K("space-y-2",l),children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(Ae,{type:"button",variant:"outline",size:"sm",onClick:m,disabled:a||v,className:"shrink-0 gap-1.5",children:[o.jsx(I.Upload,{className:"h-4 w-4"}),c]}),o.jsx("span",{className:"flex-1 truncate text-sm text-muted-foreground",children:e?e.name:i}),e&&!v&&o.jsx(Ae,{type:"button",variant:"ghost",size:"icon",onClick:f,disabled:a,className:"h-7 w-7 shrink-0","aria-label":"Remover arquivo",children:o.jsx(I.X,{className:"h-4 w-4"})})]}),v&&o.jsx(Ji,{value:r,className:"h-1.5"}),o.jsx("input",{ref:u,type:"file",accept:n,multiple:s,disabled:a,onChange:p,className:"sr-only","aria-hidden":"true",tabIndex:-1})]})});Ow.displayName="FileInput";var $o="Dialog",[Yp]=_t($o),[Fw,Qt]=Yp($o),Jp=e=>{const{__scopeDialog:t,children:r,open:n,defaultOpen:a,onOpenChange:s,modal:i=!0}=e,l=g.useRef(null),c=g.useRef(null),[d,u]=cr({prop:n,defaultProp:a??!1,onChange:s,caller:$o});return o.jsx(Fw,{scope:t,triggerRef:l,contentRef:c,contentId:yr(),titleId:yr(),descriptionId:yr(),open:d,onOpenChange:u,onOpenToggle:g.useCallback(()=>u(m=>!m),[u]),modal:i,children:r})};Jp.displayName=$o;var Qp="DialogTrigger",zw=g.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,a=Qt(Qp,r),s=ke(t,a.triggerRef);return o.jsx(we.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":tl(a.open),...n,ref:s,onClick:ge(e.onClick,a.onOpenToggle)})});zw.displayName=Qp;var Qi="DialogPortal",[Lw,ef]=Yp(Qi,{forceMount:void 0}),tf=e=>{const{__scopeDialog:t,forceMount:r,children:n,container:a}=e,s=Qt(Qi,t);return o.jsx(Lw,{scope:t,forceMount:r,children:g.Children.map(n,i=>o.jsx(It,{present:r||s.open,children:o.jsx(bo,{asChild:!0,container:a,children:i})}))})};tf.displayName=Qi;var Ha="DialogOverlay",rf=g.forwardRef((e,t)=>{const r=ef(Ha,e.__scopeDialog),{forceMount:n=r.forceMount,...a}=e,s=Qt(Ha,e.__scopeDialog);return s.modal?o.jsx(It,{present:n||s.open,children:o.jsx(Vw,{...a,ref:t})}):null});rf.displayName=Ha;var Mw=Cn("DialogOverlay.RemoveScroll"),Vw=g.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,a=Qt(Ha,r);return o.jsx(wo,{as:Mw,allowPinchZoom:!0,shards:[a.contentRef],children:o.jsx(we.div,{"data-state":tl(a.open),...n,ref:t,style:{pointerEvents:"auto",...n.style}})})}),rn="DialogContent",nf=g.forwardRef((e,t)=>{const r=ef(rn,e.__scopeDialog),{forceMount:n=r.forceMount,...a}=e,s=Qt(rn,e.__scopeDialog);return o.jsx(It,{present:n||s.open,children:s.modal?o.jsx(Bw,{...a,ref:t}):o.jsx(Uw,{...a,ref:t})})});nf.displayName=rn;var Bw=g.forwardRef((e,t)=>{const r=Qt(rn,e.__scopeDialog),n=g.useRef(null),a=ke(t,r.contentRef,n);return g.useEffect(()=>{const s=n.current;if(s)return Gi(s)},[]),o.jsx(af,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ge(e.onCloseAutoFocus,s=>{var i;s.preventDefault(),(i=r.triggerRef.current)==null||i.focus()}),onPointerDownOutside:ge(e.onPointerDownOutside,s=>{const i=s.detail.originalEvent,l=i.button===0&&i.ctrlKey===!0;(i.button===2||l)&&s.preventDefault()}),onFocusOutside:ge(e.onFocusOutside,s=>s.preventDefault())})}),Uw=g.forwardRef((e,t)=>{const r=Qt(rn,e.__scopeDialog),n=g.useRef(!1),a=g.useRef(!1);return o.jsx(af,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var i,l;(i=e.onCloseAutoFocus)==null||i.call(e,s),s.defaultPrevented||(n.current||(l=r.triggerRef.current)==null||l.focus(),s.preventDefault()),n.current=!1,a.current=!1},onInteractOutside:s=>{var i,l;(i=e.onInteractOutside)==null||i.call(e,s),s.defaultPrevented||(n.current=!0,s.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const c=s.target;(l=r.triggerRef.current)!=null&&l.contains(c)&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&a.current&&s.preventDefault()}})}),af=g.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:a,onCloseAutoFocus:s,...i}=e,l=Qt(rn,r),c=g.useRef(null),d=ke(t,c);return Ii(),o.jsxs(o.Fragment,{children:[o.jsx(po,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:a,onUnmountAutoFocus:s,children:o.jsx(ia,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":tl(l.open),...i,ref:d,onDismiss:()=>l.onOpenChange(!1)})}),o.jsxs(o.Fragment,{children:[o.jsx(Hw,{titleId:l.titleId}),o.jsx(qw,{contentRef:c,descriptionId:l.descriptionId})]})]})}),el="DialogTitle",of=g.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,a=Qt(el,r);return o.jsx(we.h2,{id:a.titleId,...n,ref:t})});of.displayName=el;var sf="DialogDescription",lf=g.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,a=Qt(sf,r);return o.jsx(we.p,{id:a.descriptionId,...n,ref:t})});lf.displayName=sf;var cf="DialogClose",df=g.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,a=Qt(cf,r);return o.jsx(we.button,{type:"button",...n,ref:t,onClick:ge(e.onClick,()=>a.onOpenChange(!1))})});df.displayName=cf;function tl(e){return e?"open":"closed"}var uf="DialogTitleWarning",[e$,mf]=jv(uf,{contentName:rn,titleName:el,docsSlug:"dialog"}),Hw=({titleId:e})=>{const t=mf(uf),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
76
76
|
|
|
77
77
|
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
78
78
|
|
|
79
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return g.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},Lw="DialogDescriptionWarning",Mw=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${sf(Lw).contentName}}.`;return g.useEffect(()=>{var n;const a=(n=e.current)==null?void 0:n.getAttribute("aria-describedby");t&&a&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},Vw=Gp,Bw=Kp,lf=Yp,cf=Jp,df=ef,uf=rf,Uw=af;const Hw=Vw,Ww=Bw,mf=g.forwardRef(({className:e,...t},r)=>o.jsx(lf,{ref:r,className:K("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));mf.displayName=lf.displayName;const pf=g.forwardRef(({className:e,children:t,...r},n)=>o.jsxs(Ww,{children:[o.jsx(mf,{}),o.jsxs(cf,{ref:n,className:K("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...r,children:[t,o.jsxs(Uw,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[o.jsx(_.X,{className:"h-4 w-4"}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));pf.displayName=cf.displayName;const ff=({className:e,...t})=>o.jsx("div",{className:K("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});ff.displayName="DialogHeader";const hf=g.forwardRef(({className:e,...t},r)=>o.jsx(df,{ref:r,className:K("text-lg font-semibold leading-none tracking-tight",e),...t}));hf.displayName=df.displayName;const xf=g.forwardRef(({className:e,...t},r)=>o.jsx(uf,{ref:r,className:K("text-sm text-muted-foreground",e),...t}));xf.displayName=uf.displayName;var Io="Popover",[gf]=_t(Io,[Fn]),pa=Fn(),[qw,Br]=gf(Io),vf=e=>{const{__scopePopover:t,children:r,open:n,defaultOpen:a,onOpenChange:s,modal:i=!1}=e,l=pa(t),c=g.useRef(null),[d,u]=g.useState(!1),[m,p]=dr({prop:n,defaultProp:a??!1,onChange:s,caller:Io});return o.jsx(qi,{...l,children:o.jsx(qw,{scope:t,contentId:wr(),triggerRef:c,open:m,onOpenChange:p,onOpenToggle:g.useCallback(()=>p(f=>!f),[p]),hasCustomAnchor:d,onCustomAnchorAdd:g.useCallback(()=>u(!0),[]),onCustomAnchorRemove:g.useCallback(()=>u(!1),[]),modal:i,children:r})})};vf.displayName=Io;var bf="PopoverAnchor",Gw=g.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,a=Br(bf,r),s=pa(r),{onCustomAnchorAdd:i,onCustomAnchorRemove:l}=a;return g.useEffect(()=>(i(),()=>l()),[i,l]),o.jsx(ko,{...s,...n,ref:t})});Gw.displayName=bf;var yf="PopoverTrigger",wf=g.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,a=Br(yf,r),s=pa(r),i=ke(t,a.triggerRef),l=o.jsx(we.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":Sf(a.open),...n,ref:i,onClick:ge(e.onClick,a.onOpenToggle)});return a.hasCustomAnchor?l:o.jsx(ko,{asChild:!0,...s,children:l})});wf.displayName=yf;var al="PopoverPortal",[Xw,Zw]=gf(al,{forceMount:void 0}),jf=e=>{const{__scopePopover:t,forceMount:r,children:n,container:a}=e,s=Br(al,t);return o.jsx(Xw,{scope:t,forceMount:r,children:o.jsx(Ot,{present:r||s.open,children:o.jsx(Co,{asChild:!0,container:a,children:n})})})};jf.displayName=al;var Dn="PopoverContent",kf=g.forwardRef((e,t)=>{const r=Zw(Dn,e.__scopePopover),{forceMount:n=r.forceMount,...a}=e,s=Br(Dn,e.__scopePopover);return o.jsx(Ot,{present:n||s.open,children:s.modal?o.jsx(Yw,{...a,ref:t}):o.jsx(Jw,{...a,ref:t})})});kf.displayName=Dn;var Kw=$n("PopoverContent.RemoveScroll"),Yw=g.forwardRef((e,t)=>{const r=Br(Dn,e.__scopePopover),n=g.useRef(null),a=ke(t,n),s=g.useRef(!1);return g.useEffect(()=>{const i=n.current;if(i)return Zi(i)},[]),o.jsx(So,{as:Kw,allowPinchZoom:!0,children:o.jsx(Cf,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ge(e.onCloseAutoFocus,i=>{var l;i.preventDefault(),s.current||(l=r.triggerRef.current)==null||l.focus()}),onPointerDownOutside:ge(e.onPointerDownOutside,i=>{const l=i.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,d=l.button===2||c;s.current=d},{checkForDefaultPrevented:!1}),onFocusOutside:ge(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1})})})}),Jw=g.forwardRef((e,t)=>{const r=Br(Dn,e.__scopePopover),n=g.useRef(!1),a=g.useRef(!1);return o.jsx(Cf,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var i,l;(i=e.onCloseAutoFocus)==null||i.call(e,s),s.defaultPrevented||(n.current||(l=r.triggerRef.current)==null||l.focus(),s.preventDefault()),n.current=!1,a.current=!1},onInteractOutside:s=>{var i,l;(i=e.onInteractOutside)==null||i.call(e,s),s.defaultPrevented||(n.current=!0,s.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const c=s.target;(l=r.triggerRef.current)!=null&&l.contains(c)&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&a.current&&s.preventDefault()}})}),Cf=g.forwardRef((e,t)=>{const{__scopePopover:r,trapFocus:n,onOpenAutoFocus:a,onCloseAutoFocus:s,disableOutsidePointerEvents:i,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:u,...m}=e,p=Br(Dn,r),f=pa(r);return Fi(),o.jsx(vo,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:a,onUnmountAutoFocus:s,children:o.jsx(ua,{asChild:!0,disableOutsidePointerEvents:i,onInteractOutside:u,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onDismiss:()=>p.onOpenChange(!1),children:o.jsx(Gi,{"data-state":Sf(p.open),role:"dialog",id:p.contentId,...f,...m,ref:t,style:{...m.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),Nf="PopoverClose",Qw=g.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,a=Br(Nf,r);return o.jsx(we.button,{type:"button",...n,ref:t,onClick:ge(e.onClick,()=>a.onOpenChange(!1))})});Qw.displayName=Nf;var e1="PopoverArrow",t1=g.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,a=pa(r);return o.jsx(Xi,{...a,...n,ref:t})});t1.displayName=e1;function Sf(e){return e?"open":"closed"}var r1=vf,n1=wf,a1=jf,$f=kf;const Po=r1,_o=n1,fa=g.forwardRef(({className:e,align:t="center",sideOffset:r=4,...n},a)=>o.jsx(a1,{children:o.jsx($f,{ref:a,align:t,sideOffset:r,className:K("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));fa.displayName=$f.displayName;var[Oo]=_t("Tooltip",[Fn]),Fo=Fn(),Ef="TooltipProvider",o1=700,oi="tooltip.open",[s1,ol]=Oo(Ef),Df=e=>{const{__scopeTooltip:t,delayDuration:r=o1,skipDelayDuration:n=300,disableHoverableContent:a=!1,children:s}=e,i=g.useRef(!0),l=g.useRef(!1),c=g.useRef(0);return g.useEffect(()=>{const d=c.current;return()=>window.clearTimeout(d)},[]),o.jsx(s1,{scope:t,isOpenDelayedRef:i,delayDuration:r,onOpen:g.useCallback(()=>{window.clearTimeout(c.current),i.current=!1},[]),onClose:g.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>i.current=!0,n)},[n]),isPointerInTransitRef:l,onPointerInTransitChange:g.useCallback(d=>{l.current=d},[]),disableHoverableContent:a,children:s})};Df.displayName=Ef;var na="Tooltip",[i1,zo]=Oo(na),Tf=e=>{const{__scopeTooltip:t,children:r,open:n,defaultOpen:a,onOpenChange:s,disableHoverableContent:i,delayDuration:l}=e,c=ol(na,e.__scopeTooltip),d=Fo(t),[u,m]=g.useState(null),p=wr(),f=g.useRef(0),b=i??c.disableHoverableContent,h=l??c.delayDuration,x=g.useRef(!1),[y,v]=dr({prop:n,defaultProp:a??!1,onChange:$=>{$?(c.onOpen(),document.dispatchEvent(new CustomEvent(oi))):c.onClose(),s==null||s($)},caller:na}),j=g.useMemo(()=>y?x.current?"delayed-open":"instant-open":"closed",[y]),w=g.useCallback(()=>{window.clearTimeout(f.current),f.current=0,x.current=!1,v(!0)},[v]),C=g.useCallback(()=>{window.clearTimeout(f.current),f.current=0,v(!1)},[v]),S=g.useCallback(()=>{window.clearTimeout(f.current),f.current=window.setTimeout(()=>{x.current=!0,v(!0),f.current=0},h)},[h,v]);return g.useEffect(()=>()=>{f.current&&(window.clearTimeout(f.current),f.current=0)},[]),o.jsx(qi,{...d,children:o.jsx(i1,{scope:t,contentId:p,open:y,stateAttribute:j,trigger:u,onTriggerChange:m,onTriggerEnter:g.useCallback(()=>{c.isOpenDelayedRef.current?S():w()},[c.isOpenDelayedRef,S,w]),onTriggerLeave:g.useCallback(()=>{b?C():(window.clearTimeout(f.current),f.current=0)},[C,b]),onOpen:w,onClose:C,disableHoverableContent:b,children:r})})};Tf.displayName=na;var si="TooltipTrigger",Af=g.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,a=zo(si,r),s=ol(si,r),i=Fo(r),l=g.useRef(null),c=ke(t,l,a.onTriggerChange),d=g.useRef(!1),u=g.useRef(!1),m=g.useCallback(()=>d.current=!1,[]);return g.useEffect(()=>()=>document.removeEventListener("pointerup",m),[m]),o.jsx(ko,{asChild:!0,...i,children:o.jsx(we.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...n,ref:c,onPointerMove:ge(e.onPointerMove,p=>{p.pointerType!=="touch"&&!u.current&&!s.isPointerInTransitRef.current&&(a.onTriggerEnter(),u.current=!0)}),onPointerLeave:ge(e.onPointerLeave,()=>{a.onTriggerLeave(),u.current=!1}),onPointerDown:ge(e.onPointerDown,()=>{a.open&&a.onClose(),d.current=!0,document.addEventListener("pointerup",m,{once:!0})}),onFocus:ge(e.onFocus,()=>{d.current||a.onOpen()}),onBlur:ge(e.onBlur,a.onClose),onClick:ge(e.onClick,a.onClose)})})});Af.displayName=si;var l1="TooltipPortal",[l$,c1]=Oo(l1,{forceMount:void 0}),Tn="TooltipContent",Rf=g.forwardRef((e,t)=>{const r=c1(Tn,e.__scopeTooltip),{forceMount:n=r.forceMount,side:a="top",...s}=e,i=zo(Tn,e.__scopeTooltip);return o.jsx(Ot,{present:n||i.open,children:i.disableHoverableContent?o.jsx(If,{side:a,...s,ref:t}):o.jsx(d1,{side:a,...s,ref:t})})}),d1=g.forwardRef((e,t)=>{const r=zo(Tn,e.__scopeTooltip),n=ol(Tn,e.__scopeTooltip),a=g.useRef(null),s=ke(t,a),[i,l]=g.useState(null),{trigger:c,onClose:d}=r,u=a.current,{onPointerInTransitChange:m}=n,p=g.useCallback(()=>{l(null),m(!1)},[m]),f=g.useCallback((b,h)=>{const x=b.currentTarget,y={x:b.clientX,y:b.clientY},v=h1(y,x.getBoundingClientRect()),j=x1(y,v),w=g1(h.getBoundingClientRect()),C=b1([...j,...w]);l(C),m(!0)},[m]);return g.useEffect(()=>()=>p(),[p]),g.useEffect(()=>{if(c&&u){const b=x=>f(x,u),h=x=>f(x,c);return c.addEventListener("pointerleave",b),u.addEventListener("pointerleave",h),()=>{c.removeEventListener("pointerleave",b),u.removeEventListener("pointerleave",h)}}},[c,u,f,p]),g.useEffect(()=>{if(i){const b=h=>{const x=h.target,y={x:h.clientX,y:h.clientY},v=(c==null?void 0:c.contains(x))||(u==null?void 0:u.contains(x)),j=!v1(y,i);v?p():j&&(p(),d())};return document.addEventListener("pointermove",b),()=>document.removeEventListener("pointermove",b)}},[c,u,i,d,p]),o.jsx(If,{...e,ref:s})}),[u1,m1]=Oo(na,{isInside:!1}),p1=Nv("TooltipContent"),If=g.forwardRef((e,t)=>{const{__scopeTooltip:r,children:n,"aria-label":a,onEscapeKeyDown:s,onPointerDownOutside:i,...l}=e,c=zo(Tn,r),d=Fo(r),{onClose:u}=c;return g.useEffect(()=>(document.addEventListener(oi,u),()=>document.removeEventListener(oi,u)),[u]),g.useEffect(()=>{if(c.trigger){const m=p=>{const f=p.target;f!=null&&f.contains(c.trigger)&&u()};return window.addEventListener("scroll",m,{capture:!0}),()=>window.removeEventListener("scroll",m,{capture:!0})}},[c.trigger,u]),o.jsx(ua,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:m=>m.preventDefault(),onDismiss:u,children:o.jsxs(Gi,{"data-state":c.stateAttribute,...d,...l,ref:t,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[o.jsx(p1,{children:n}),o.jsx(u1,{scope:r,isInside:!0,children:o.jsx(My,{id:c.contentId,role:"tooltip",children:a||n})})]})})});Rf.displayName=Tn;var Pf="TooltipArrow",f1=g.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,a=Fo(r);return m1(Pf,r).isInside?null:o.jsx(Xi,{...a,...n,ref:t})});f1.displayName=Pf;function h1(e,t){const r=Math.abs(t.top-e.y),n=Math.abs(t.bottom-e.y),a=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(r,n,a,s)){case s:return"left";case a:return"right";case r:return"top";case n:return"bottom";default:throw new Error("unreachable")}}function x1(e,t,r=5){const n=[];switch(t){case"top":n.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":n.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":n.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":n.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r});break}return n}function g1(e){const{top:t,right:r,bottom:n,left:a}=e;return[{x:a,y:t},{x:r,y:t},{x:r,y:n},{x:a,y:n}]}function v1(e,t){const{x:r,y:n}=e;let a=!1;for(let s=0,i=t.length-1;s<t.length;i=s++){const l=t[s],c=t[i],d=l.x,u=l.y,m=c.x,p=c.y;u>n!=p>n&&r<(m-d)*(n-u)/(p-u)+d&&(a=!a)}return a}function b1(e){const t=e.slice();return t.sort((r,n)=>r.x<n.x?-1:r.x>n.x?1:r.y<n.y?-1:r.y>n.y?1:0),y1(t)}function y1(e){if(e.length<=1)return e.slice();const t=[];for(let n=0;n<e.length;n++){const a=e[n];for(;t.length>=2;){const s=t[t.length-1],i=t[t.length-2];if((s.x-i.x)*(a.y-i.y)>=(s.y-i.y)*(a.x-i.x))t.pop();else break}t.push(a)}t.pop();const r=[];for(let n=e.length-1;n>=0;n--){const a=e[n];for(;r.length>=2;){const s=r[r.length-1],i=r[r.length-2];if((s.x-i.x)*(a.y-i.y)>=(s.y-i.y)*(a.x-i.x))r.pop();else break}r.push(a)}return r.pop(),t.length===1&&r.length===1&&t[0].x===r[0].x&&t[0].y===r[0].y?t:t.concat(r)}var w1=Df,j1=Tf,k1=Af,_f=Rf;const C1=w1,Of=j1,Ff=k1,sl=g.forwardRef(({className:e,sideOffset:t=4,...r},n)=>o.jsx(_f,{ref:n,sideOffset:t,className:K("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r}));sl.displayName=_f.displayName;function N1(e,t){return g.useReducer((r,n)=>t[r][n]??r,e)}var il="ScrollArea",[zf]=_t(il),[S1,Wt]=zf(il),Lf=g.forwardRef((e,t)=>{const{__scopeScrollArea:r,type:n="hover",dir:a,scrollHideDelay:s=600,...i}=e,[l,c]=g.useState(null),[d,u]=g.useState(null),[m,p]=g.useState(null),[f,b]=g.useState(null),[h,x]=g.useState(null),[y,v]=g.useState(0),[j,w]=g.useState(0),[C,S]=g.useState(!1),[$,k]=g.useState(!1),E=ke(t,O=>c(O)),D=ca(a);return o.jsx(S1,{scope:r,type:n,dir:D,scrollHideDelay:s,scrollArea:l,viewport:d,onViewportChange:u,content:m,onContentChange:p,scrollbarX:f,onScrollbarXChange:b,scrollbarXEnabled:C,onScrollbarXEnabledChange:S,scrollbarY:h,onScrollbarYChange:x,scrollbarYEnabled:$,onScrollbarYEnabledChange:k,onCornerWidthChange:v,onCornerHeightChange:w,children:o.jsx(we.div,{dir:D,...i,ref:E,style:{position:"relative","--radix-scroll-area-corner-width":y+"px","--radix-scroll-area-corner-height":j+"px",...e.style}})})});Lf.displayName=il;var Mf="ScrollAreaViewport",Vf=g.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:n,nonce:a,...s}=e,i=Wt(Mf,r),l=g.useRef(null),c=ke(t,l,i.onViewportChange);return o.jsxs(o.Fragment,{children:[o.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:a}),o.jsx(we.div,{"data-radix-scroll-area-viewport":"",...s,ref:c,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...e.style},children:o.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});Vf.displayName=Mf;var fr="ScrollAreaScrollbar",ll=g.forwardRef((e,t)=>{const{forceMount:r,...n}=e,a=Wt(fr,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:i}=a,l=e.orientation==="horizontal";return g.useEffect(()=>(l?s(!0):i(!0),()=>{l?s(!1):i(!1)}),[l,s,i]),a.type==="hover"?o.jsx($1,{...n,ref:t,forceMount:r}):a.type==="scroll"?o.jsx(E1,{...n,ref:t,forceMount:r}):a.type==="auto"?o.jsx(Bf,{...n,ref:t,forceMount:r}):a.type==="always"?o.jsx(cl,{...n,ref:t}):null});ll.displayName=fr;var $1=g.forwardRef((e,t)=>{const{forceMount:r,...n}=e,a=Wt(fr,e.__scopeScrollArea),[s,i]=g.useState(!1);return g.useEffect(()=>{const l=a.scrollArea;let c=0;if(l){const d=()=>{window.clearTimeout(c),i(!0)},u=()=>{c=window.setTimeout(()=>i(!1),a.scrollHideDelay)};return l.addEventListener("pointerenter",d),l.addEventListener("pointerleave",u),()=>{window.clearTimeout(c),l.removeEventListener("pointerenter",d),l.removeEventListener("pointerleave",u)}}},[a.scrollArea,a.scrollHideDelay]),o.jsx(Ot,{present:r||s,children:o.jsx(Bf,{"data-state":s?"visible":"hidden",...n,ref:t})})}),E1=g.forwardRef((e,t)=>{const{forceMount:r,...n}=e,a=Wt(fr,e.__scopeScrollArea),s=e.orientation==="horizontal",i=Mo(()=>c("SCROLL_END"),100),[l,c]=N1("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return g.useEffect(()=>{if(l==="idle"){const d=window.setTimeout(()=>c("HIDE"),a.scrollHideDelay);return()=>window.clearTimeout(d)}},[l,a.scrollHideDelay,c]),g.useEffect(()=>{const d=a.viewport,u=s?"scrollLeft":"scrollTop";if(d){let m=d[u];const p=()=>{const f=d[u];m!==f&&(c("SCROLL"),i()),m=f};return d.addEventListener("scroll",p),()=>d.removeEventListener("scroll",p)}},[a.viewport,s,c,i]),o.jsx(Ot,{present:r||l!=="hidden",children:o.jsx(cl,{"data-state":l==="hidden"?"hidden":"visible",...n,ref:t,onPointerEnter:ge(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:ge(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),Bf=g.forwardRef((e,t)=>{const r=Wt(fr,e.__scopeScrollArea),{forceMount:n,...a}=e,[s,i]=g.useState(!1),l=e.orientation==="horizontal",c=Mo(()=>{if(r.viewport){const d=r.viewport.offsetWidth<r.viewport.scrollWidth,u=r.viewport.offsetHeight<r.viewport.scrollHeight;i(l?d:u)}},10);return An(r.viewport,c),An(r.content,c),o.jsx(Ot,{present:n||s,children:o.jsx(cl,{"data-state":s?"visible":"hidden",...a,ref:t})})}),cl=g.forwardRef((e,t)=>{const{orientation:r="vertical",...n}=e,a=Wt(fr,e.__scopeScrollArea),s=g.useRef(null),i=g.useRef(0),[l,c]=g.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),d=Gf(l.viewport,l.content),u={...n,sizes:l,onSizesChange:c,hasThumb:d>0&&d<1,onThumbChange:p=>s.current=p,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:p=>i.current=p};function m(p,f){return P1(p,i.current,l,f)}return r==="horizontal"?o.jsx(D1,{...u,ref:t,onThumbPositionChange:()=>{if(a.viewport&&s.current){const p=a.viewport.scrollLeft,f=Ac(p,l,a.dir);s.current.style.transform=`translate3d(${f}px, 0, 0)`}},onWheelScroll:p=>{a.viewport&&(a.viewport.scrollLeft=p)},onDragScroll:p=>{a.viewport&&(a.viewport.scrollLeft=m(p,a.dir))}}):r==="vertical"?o.jsx(T1,{...u,ref:t,onThumbPositionChange:()=>{if(a.viewport&&s.current){const p=a.viewport.scrollTop,f=Ac(p,l);s.current.style.transform=`translate3d(0, ${f}px, 0)`}},onWheelScroll:p=>{a.viewport&&(a.viewport.scrollTop=p)},onDragScroll:p=>{a.viewport&&(a.viewport.scrollTop=m(p))}}):null}),D1=g.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...a}=e,s=Wt(fr,e.__scopeScrollArea),[i,l]=g.useState(),c=g.useRef(null),d=ke(t,c,s.onScrollbarXChange);return g.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),o.jsx(Hf,{"data-orientation":"horizontal",...a,ref:d,sizes:r,style:{bottom:0,left:s.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:s.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Lo(r)+"px",...e.style},onThumbPointerDown:u=>e.onThumbPointerDown(u.x),onDragScroll:u=>e.onDragScroll(u.x),onWheelScroll:(u,m)=>{if(s.viewport){const p=s.viewport.scrollLeft+u.deltaX;e.onWheelScroll(p),Zf(p,m)&&u.preventDefault()}},onResize:()=>{c.current&&s.viewport&&i&&n({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:Ya(i.paddingLeft),paddingEnd:Ya(i.paddingRight)}})}})}),T1=g.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...a}=e,s=Wt(fr,e.__scopeScrollArea),[i,l]=g.useState(),c=g.useRef(null),d=ke(t,c,s.onScrollbarYChange);return g.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),o.jsx(Hf,{"data-orientation":"vertical",...a,ref:d,sizes:r,style:{top:0,right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Lo(r)+"px",...e.style},onThumbPointerDown:u=>e.onThumbPointerDown(u.y),onDragScroll:u=>e.onDragScroll(u.y),onWheelScroll:(u,m)=>{if(s.viewport){const p=s.viewport.scrollTop+u.deltaY;e.onWheelScroll(p),Zf(p,m)&&u.preventDefault()}},onResize:()=>{c.current&&s.viewport&&i&&n({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:Ya(i.paddingTop),paddingEnd:Ya(i.paddingBottom)}})}})}),[A1,Uf]=zf(fr),Hf=g.forwardRef((e,t)=>{const{__scopeScrollArea:r,sizes:n,hasThumb:a,onThumbChange:s,onThumbPointerUp:i,onThumbPointerDown:l,onThumbPositionChange:c,onDragScroll:d,onWheelScroll:u,onResize:m,...p}=e,f=Wt(fr,r),[b,h]=g.useState(null),x=ke(t,E=>h(E)),y=g.useRef(null),v=g.useRef(""),j=f.viewport,w=n.content-n.viewport,C=ft(u),S=ft(c),$=Mo(m,10);function k(E){if(y.current){const D=E.clientX-y.current.left,O=E.clientY-y.current.top;d({x:D,y:O})}}return g.useEffect(()=>{const E=D=>{const O=D.target;b!=null&&b.contains(O)&&C(D,w)};return document.addEventListener("wheel",E,{passive:!1}),()=>document.removeEventListener("wheel",E,{passive:!1})},[j,b,w,C]),g.useEffect(S,[n,S]),An(b,$),An(f.content,$),o.jsx(A1,{scope:r,scrollbar:b,hasThumb:a,onThumbChange:ft(s),onThumbPointerUp:ft(i),onThumbPositionChange:S,onThumbPointerDown:ft(l),children:o.jsx(we.div,{...p,ref:x,style:{position:"absolute",...p.style},onPointerDown:ge(e.onPointerDown,E=>{E.button===0&&(E.target.setPointerCapture(E.pointerId),y.current=b.getBoundingClientRect(),v.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",f.viewport&&(f.viewport.style.scrollBehavior="auto"),k(E))}),onPointerMove:ge(e.onPointerMove,k),onPointerUp:ge(e.onPointerUp,E=>{const D=E.target;D.hasPointerCapture(E.pointerId)&&D.releasePointerCapture(E.pointerId),document.body.style.webkitUserSelect=v.current,f.viewport&&(f.viewport.style.scrollBehavior=""),y.current=null})})})}),Ka="ScrollAreaThumb",Wf=g.forwardRef((e,t)=>{const{forceMount:r,...n}=e,a=Uf(Ka,e.__scopeScrollArea);return o.jsx(Ot,{present:r||a.hasThumb,children:o.jsx(R1,{ref:t,...n})})}),R1=g.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:n,...a}=e,s=Wt(Ka,r),i=Uf(Ka,r),{onThumbPositionChange:l}=i,c=ke(t,m=>i.onThumbChange(m)),d=g.useRef(void 0),u=Mo(()=>{d.current&&(d.current(),d.current=void 0)},100);return g.useEffect(()=>{const m=s.viewport;if(m){const p=()=>{if(u(),!d.current){const f=_1(m,l);d.current=f,l()}};return l(),m.addEventListener("scroll",p),()=>m.removeEventListener("scroll",p)}},[s.viewport,u,l]),o.jsx(we.div,{"data-state":i.hasThumb?"visible":"hidden",...a,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:ge(e.onPointerDownCapture,m=>{const p=m.target.getBoundingClientRect(),f=m.clientX-p.left,b=m.clientY-p.top;i.onThumbPointerDown({x:f,y:b})}),onPointerUp:ge(e.onPointerUp,i.onThumbPointerUp)})});Wf.displayName=Ka;var dl="ScrollAreaCorner",qf=g.forwardRef((e,t)=>{const r=Wt(dl,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?o.jsx(I1,{...e,ref:t}):null});qf.displayName=dl;var I1=g.forwardRef((e,t)=>{const{__scopeScrollArea:r,...n}=e,a=Wt(dl,r),[s,i]=g.useState(0),[l,c]=g.useState(0),d=!!(s&&l);return An(a.scrollbarX,()=>{var u;const m=((u=a.scrollbarX)==null?void 0:u.offsetHeight)||0;a.onCornerHeightChange(m),c(m)}),An(a.scrollbarY,()=>{var u;const m=((u=a.scrollbarY)==null?void 0:u.offsetWidth)||0;a.onCornerWidthChange(m),i(m)}),d?o.jsx(we.div,{...n,ref:t,style:{width:s,height:l,position:"absolute",right:a.dir==="ltr"?0:void 0,left:a.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function Ya(e){return e?parseInt(e,10):0}function Gf(e,t){const r=e/t;return isNaN(r)?0:r}function Lo(e){const t=Gf(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function P1(e,t,r,n="ltr"){const a=Lo(r),s=a/2,i=t||s,l=a-i,c=r.scrollbar.paddingStart+i,d=r.scrollbar.size-r.scrollbar.paddingEnd-l,u=r.content-r.viewport,m=n==="ltr"?[0,u]:[u*-1,0];return Xf([c,d],m)(e)}function Ac(e,t,r="ltr"){const n=Lo(t),a=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=t.scrollbar.size-a,i=t.content-t.viewport,l=s-n,c=r==="ltr"?[0,i]:[i*-1,0],d=ta(e,c);return Xf([0,i],[0,l])(d)}function Xf(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}function Zf(e,t){return e>0&&e<t}var _1=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return function a(){const s={left:e.scrollLeft,top:e.scrollTop},i=r.left!==s.left,l=r.top!==s.top;(i||l)&&t(),r=s,n=window.requestAnimationFrame(a)}(),()=>window.cancelAnimationFrame(n)};function Mo(e,t){const r=ft(e),n=g.useRef(0);return g.useEffect(()=>()=>window.clearTimeout(n.current),[]),g.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function An(e,t){const r=ft(t);lt(()=>{let n=0;if(e){const a=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(r)});return a.observe(e),()=>{window.cancelAnimationFrame(n),a.unobserve(e)}}},[e,r])}var Kf=Lf,O1=Vf,F1=qf;const Vo=g.forwardRef(({className:e,children:t,...r},n)=>o.jsxs(Kf,{ref:n,className:K("relative overflow-hidden",e),...r,children:[o.jsx(O1,{className:"h-full w-full rounded-[inherit]",children:t}),o.jsx(Yf,{}),o.jsx(F1,{})]}));Vo.displayName=Kf.displayName;const Yf=g.forwardRef(({className:e,orientation:t="vertical",...r},n)=>o.jsx(ll,{ref:n,orientation:t,className:K("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...r,children:o.jsx(Wf,{className:"relative flex-1 rounded-full bg-border"})}));Yf.displayName=ll.displayName;const Rc=Object.entries(_.icons).map(([e,t])=>({name:e,kebab:e.replace(/([A-Z])/g,(r,n,a)=>a===0?n.toLowerCase():`-${n.toLowerCase()}`),component:t})),Jf=({value:e,onChange:t,label:r="Ícone (Lucide)",hideLabel:n=!1,className:a})=>{const[s,i]=N.useState(!1),[l,c]=N.useState(""),d=N.useMemo(()=>Qg(e),[e]),u=N.useMemo(()=>{const f=l.toLowerCase();return f?Rc.filter(b=>b.name.toLowerCase().includes(f)||b.kebab.includes(f)):Rc},[l]),m=f=>{t(f),i(!1)},p=f=>{i(f),f||c("")};return o.jsxs("div",{className:`space-y-1 ${a??""}`,children:[!n&&o.jsx(ie,{className:"text-xs",children:r}),o.jsx(De,{type:"button",variant:"outline",className:"w-full h-8 justify-start text-xs font-normal gap-2",onClick:()=>i(!0),children:d?o.jsxs(o.Fragment,{children:[N.createElement(d,{className:"h-3.5 w-3.5 shrink-0"}),o.jsx("span",{className:"truncate",children:e})]}):o.jsx("span",{className:"text-muted-foreground",children:"Selecionar ícone…"})}),o.jsx(Hw,{open:s,onOpenChange:p,children:o.jsxs(pf,{className:"max-w-3xl max-h-[85vh] flex flex-col gap-0 p-0",children:[o.jsxs(ff,{className:"px-4 pt-4 pb-2 border-b",children:[o.jsx(hf,{children:"Selecionar ícone"}),o.jsx(xf,{children:"Pesquise e clique em um ícone da biblioteca Lucide."})]}),o.jsx("div",{className:"px-4 py-2 border-b",children:o.jsxs("div",{className:"relative",children:[o.jsx(_.Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),o.jsx(ue,{autoFocus:!0,placeholder:"Buscar ícones…",value:l,onChange:f=>c(f.target.value),className:"pl-8 h-9 text-sm"})]})}),o.jsx(Vo,{className:"flex-1 px-4 py-2",children:o.jsxs("div",{className:"grid grid-cols-5 gap-2 sm:grid-cols-7 md:grid-cols-8 pb-2",children:[o.jsxs(De,{type:"button",variant:e?"outline":"secondary",className:"flex flex-col items-center justify-center h-20 gap-1 p-1",onClick:()=>m(void 0),children:[o.jsx("div",{className:"h-6 w-6 rounded border-2 border-dashed border-muted-foreground/30"}),o.jsx("span",{className:"text-[10px] leading-tight text-center",children:"Nenhum"})]}),u.map(({name:f,component:b})=>o.jsxs(De,{type:"button",variant:e===f?"secondary":"outline",className:"flex flex-col items-center justify-center h-20 gap-1 p-1 overflow-hidden",onClick:()=>m(f),children:[N.createElement(b,{size:24}),o.jsx("span",{className:"text-[9px] leading-tight text-center break-all line-clamp-2",children:f})]},f))]})})]})})]})};var z1=Object.defineProperty,L1=(e,t,r)=>t in e?z1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ic=(e,t,r)=>L1(e,typeof t!="symbol"?t+"":t,r);const Ja=N.createContext({}),Nr=()=>N.useContext(Ja),at=(e,t,r={})=>{if(!e)return!0;if("and"in e||"or"in e){const d="and"in e&&Array.isArray(e.and)&&e.and.length>0,u="or"in e&&Array.isArray(e.or)&&e.or.length>0;return d&&u?(console.warn("[evaluateFieldCondition] FieldConditionGroup com `and` e `or` simultâneos — apenas `and` será avaliado."),e.and.every(m=>at(m,t,r))):d?e.and.every(m=>at(m,t,r)):u?e.or.some(m=>at(m,t,r)):!0}const n=e;if(!n.campoId)return!0;const a=n.source==="evento"?r[n.campoId]:t[n.campoId];if(Array.isArray(a)){const d=n.valor;switch(n.operador){case"contem":return a.includes(d);case"naoContem":return!a.includes(d);case"vazio":return a.length===0;case"naoVazio":return a.length>0;case"igual":return a.length===1&&a[0]===d;case"diferente":return!(a.length===1&&a[0]===d);default:return!0}}const s=a==null||a===!1?"":a===!0?"1":String(a),i=n.valor!==void 0?String(n.valor):"",l=Number(s),c=Number(i);switch(n.operador){case"igual":return s===i;case"diferente":return s!==i;case"vazio":return!s;case"naoVazio":return!!s;case"contem":return s.includes(i);case"naoContem":return!s.includes(i);case"maiorQue":return!isNaN(l)&&!isNaN(c)?l>c:s>i;case"menorQue":return!isNaN(l)&&!isNaN(c)?l<c:s<i;case"maiorOuIgual":return!isNaN(l)&&!isNaN(c)?l>=c:s>=i;case"menorOuIgual":return!isNaN(l)&&!isNaN(c)?l<=c:s<=i;default:return!0}},M1=/^\d{3}\.?\d{3}\.?\d{3}-?\d{2}$/,V1=/^\(?\d{2}\)?\s?\d{4,5}-?\d{4}$/,B1=/^\d{5}-?\d{3}$/,U1=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,H1=e=>{const t=e.replace(/\D/g,"");if(t.length!==11||/^(\d)\1{10}$/.test(t))return!1;const r=n=>{let a=0;for(let i=0;i<n;i++)a+=parseInt(t[i])*(n+1-i);const s=a*10%11;return s>=10?0:s};return r(9)===parseInt(t[9])&&r(10)===parseInt(t[10])},Wn=new Map,W1=e=>{if(Wn.has(e))return Wn.get(e);if(/^\/.*\/[gimsuy]*$/.test(e))return Wn.set(e,null),null;try{const t=new RegExp(e);return Wn.set(e,t),t}catch{return Wn.set(e,null),null}},Ta=(e,t,r={})=>{const n=e.validacao;if(e.tipo===T.CHECKBOX||e.tipo===T.SWITCH)return e.obrigatorio&&!t?"Campo obrigatório":void 0;if(e.tipo===T.SLIDER){const s=t!=null&&t!==""?Number(t):NaN;return e.obrigatorio&&isNaN(s)?"Campo obrigatório":isNaN(s)?void 0:(n==null?void 0:n.min)!==void 0&&s<n.min?`Valor mínimo: ${n.min}`:(n==null?void 0:n.max)!==void 0&&s>n.max?`Valor máximo: ${n.max}`:void 0}if(e.tipo===T.RATING){const s=t!==void 0?Number(t):0;return e.obrigatorio&&(!s||s<1)?"Avaliação obrigatória":void 0}if(e.tipo===T.DATE_RANGE){const s=t;if(e.obrigatorio){if(!(s!=null&&s.start))return"Data inicial obrigatória";if(!(s!=null&&s.end))return"Data final obrigatória"}return s!=null&&s.start&&s!=null&&s.end&&s.start>s.end?"A data inicial deve ser menor ou igual à data final":void 0}if(e.tipo===T.PARTICIPATION_TYPE){if(!e.obrigatorio)return;const s=t;return s!=null&&s.tipo?s.tipo==="por_dia"&&!s.data?"Selecione um dia para participar":"genero"in(s??{})&&!(s!=null&&s.genero)?"Selecione o sexo":void 0:"Selecione o tipo de participação"}if(e.tipo===T.CHECKBOX_GROUP){const s=Array.isArray(t)?t:[];return e.obrigatorio&&s.length===0?"Selecione pelo menos uma opção":void 0}if(e.tipo===T.FILE)return e.obrigatorio&&!t?"Arquivo obrigatório":void 0;if(e.tipo===T.TERMS)return e.obrigatorio&&t!=="accepted"?"Você precisa aceitar os termos para continuar":void 0;if(e.tipo===T.NUMBER){const s=t!=null?String(t):"";if(e.obrigatorio&&!s)return"Campo obrigatório";if(!s)return;const i=Number(s);return isNaN(i)?"Deve ser um número":(n==null?void 0:n.min)!==void 0&&i<n.min?`Valor mínimo: ${n.min}`:(n==null?void 0:n.max)!==void 0&&i>n.max?`Valor máximo: ${n.max}`:void 0}const a=t!=null?String(t):"";if(e.obrigatorio&&!a.trim())return"Campo obrigatório";if(a){if(e.tipo===T.EMAIL&&!U1.test(a))return"E-mail inválido";if(e.tipo===T.CPF&&(!M1.test(a)||!H1(a)))return"CPF inválido";if(e.tipo===T.TELEFONE&&!V1.test(a))return"Telefone inválido";if(e.tipo===T.CEP&&!B1.test(a))return"CEP inválido";if(n!=null&&n.minLength&&a.length<n.minLength)return`Mínimo ${n.minLength} caracteres`;if(n!=null&&n.maxLength&&a.length>n.maxLength)return`Máximo ${n.maxLength} caracteres`;if((e.tipo===T.DATE||e.tipo===T.DATETIME)&&a){if(n!=null&&n.minDate&&a<n.minDate)return`Data mínima: ${n.minDate}`;if(n!=null&&n.maxDate&&a>n.maxDate)return`Data máxima: ${n.maxDate}`}if((e.tipo===T.DATE||e.tipo===T.DATETIME)&&a&&((n==null?void 0:n.minAge)!=null||(n==null?void 0:n.maxAge)!=null)){const s=a.split("T")[0],i=new Date(s+"T00:00:00"),l=r["evento.dataInicioEvento"],c=l?new Date(l.split("T")[0]+"T00:00:00"):new Date;let d=c.getFullYear()-i.getFullYear();const u=c.getMonth()-i.getMonth();if((u<0||u===0&&c.getDate()<i.getDate())&&d--,n.minAge!=null&&d<n.minAge)return`Idade mínima: ${n.minAge} ano${n.minAge!==1?"s":""}`;if(n.maxAge!=null&&d>n.maxAge)return`Idade máxima: ${n.maxAge} ano${n.maxAge!==1?"s":""}`}if(n!=null&&n.regex){const s=W1(n.regex);if(s&&!s.test(a))return n.regexMessage||"Formato inválido"}}},Pc=new Set(["__proto__","constructor","prototype"]),pn=(e,t,r)=>{const n=t.split(".");let a=e;for(let i=0;i<n.length-1;i++){const l=n[i];if(Pc.has(l))return;(a[l]==null||typeof a[l]!="object")&&(a[l]={}),a=a[l]}const s=n[n.length-1];Pc.has(s)||(a[s]=r)},bn=async(e,t,r,n,a,s)=>{for(const i of e){const l=s[i.type];if(!l)continue;const c=await l(r,n,i,a);if(c)return i.message??c}},Qf=(e,t={},r={})=>async n=>{var a,s,i,l,c;const d={},u=[...e.containers].sort((m,p)=>m.ordem-p.ordem);for(const m of u){if(m.repeatable||m.condicional&&!at(m.condicional,n,t))continue;const p=[...m.campos].sort((f,b)=>f.ordem-b.ordem);for(const f of p){if(!at(f.condicional,n,t)||f.tipo===T.HIDDEN||f.isDisabled||f.isReadOnly)continue;if(f.tipo===T.FIELD_ARRAY){const h=Array.isArray(n[f.nome])?n[f.nome]:[];f.obrigatorio&&h.length===0?d[f.nome]={type:"custom",message:"Adicione pelo menos um item"}:f.minItems&&h.length<f.minItems?d[f.nome]={type:"custom",message:`Mínimo de ${f.minItems} item${f.minItems!==1?"s":""}`}:f.maxItems&&h.length>f.maxItems&&(d[f.nome]={type:"custom",message:`Máximo de ${f.maxItems} item${f.maxItems!==1?"s":""}`});for(let x=0;x<h.length;x++){const y=h[x];for(const v of f.subFields??[]){if(v.isDisabled||v.isReadOnly||!at(v.condicional,y,t))continue;const j=Ta(v,y[v.nome],t);if(j){pn(d,`${f.nome}.${x}.${v.nome}`,{type:"custom",message:j});continue}if((a=v.validate)!=null&&a.length){const w=await bn(v.validate,v.nome,y[v.nome],y,t,r);w&&pn(d,`${f.nome}.${x}.${v.nome}`,{type:"custom",message:w})}}}continue}if(f.tipo===T.SUB_FORM){const h=n[f.nome]??{};f.obrigatorio&&Object.keys(h).length===0&&(d[f.nome]={type:"custom",message:"Campo obrigatório"});for(const x of((s=f.subSchema)==null?void 0:s.fields)??[]){if(x.isDisabled||x.isReadOnly)continue;const y=Ta(x,h[x.nome],t);if(y){pn(d,`${f.nome}.${x.nome}`,{type:"custom",message:y});continue}if((i=x.validate)!=null&&i.length){const v=await bn(x.validate,x.nome,h[x.nome],h,t,r);v&&pn(d,`${f.nome}.${x.nome}`,{type:"custom",message:v})}}continue}const b=Ta(f,n[f.nome],t);if(b&&(d[f.nome]={type:"custom",message:b}),!d[f.nome]&&(l=f.validate)!=null&&l.length){const h=await bn(f.validate,f.nome,n[f.nome],n,t,r);h&&(d[f.nome]={type:"custom",message:h})}}}for(const m of u){if(!m.repeatable||!m.nome||m.condicional&&!at(m.condicional,n,t))continue;const p=Array.isArray(n[m.nome])?n[m.nome]:[];m.minItems&&p.length<m.minItems?d[m.nome]={type:"custom",message:`Mínimo de ${m.minItems} ${m.itemLabel??"item"}${m.minItems!==1?"s":""}`}:m.maxItems&&p.length>m.maxItems&&(d[m.nome]={type:"custom",message:`Máximo de ${m.maxItems} ${m.itemLabel??"item"}${m.maxItems!==1?"s":""}`});for(let f=0;f<p.length;f++){const b=p[f];for(const h of m.campos){if(!at(h.condicional,b,t)||h.tipo===T.HIDDEN||h.isDisabled||h.isReadOnly)continue;const x=Ta(h,b[h.nome],t);if(x){pn(d,`${m.nome}.${f}.${h.nome}`,{type:"custom",message:x});continue}if((c=h.validate)!=null&&c.length){const y=await bn(h.validate,h.nome,b[h.nome],b,t,r);y&&pn(d,`${m.nome}.${f}.${h.nome}`,{type:"custom",message:y})}}}}return Object.keys(d).length>0?{values:{},errors:d}:{values:n,errors:{}}},eh=(e,t={},r={})=>async n=>{var a,s;const i={},l=[...e.containers].sort((c,d)=>c.ordem-d.ordem);for(const c of l)if(!(c.condicional&&!at(c.condicional,n,t))){if(c.repeatable&&c.nome){const d=Array.isArray(n[c.nome])?n[c.nome]:[];for(let u=0;u<d.length;u++){const m=d[u];for(const p of[...c.campos].sort((f,b)=>f.ordem-b.ordem)){if(!((a=p.warn)!=null&&a.length)||!at(p.condicional,m,t))continue;const f=await bn(p.warn,p.nome,m[p.nome],m,t,r);f&&(i[`${c.nome}.${u}.${p.nome}`]=f)}}continue}for(const d of[...c.campos].sort((u,m)=>u.ordem-m.ordem)){if(!((s=d.warn)!=null&&s.length)||!at(d.condicional,n,t))continue;const u=await bn(d.warn,d.nome,n[d.nome],n,t,r);u&&(i[d.nome]=u)}}return i},q1=/\{\{\s*(?:event|evento)\.([a-zA-Z0-9_.]+)\s*\}\}/g,xt=(e,t)=>e?e.replace(q1,(r,n)=>t[`evento.${n}`]??t[n]??r):e??"",G1=(e,t)=>({...e,label:xt(e.label,t)}),th=(e,t)=>{var r;return{...e,label:xt(e.label,t),placeholder:xt(e.placeholder,t),hint:xt(e.hint,t),defaultValue:typeof e.defaultValue=="string"?xt(e.defaultValue,t):e.defaultValue,opcoes:(r=e.opcoes)==null?void 0:r.map(n=>G1(n,t))}},Bo=(e,t)=>({...e,titulo:xt(e.titulo,t),descricao:xt(e.descricao,t),campos:e.campos.map(r=>th(r,t))}),rh=(e,t)=>({...e,titulo:xt(e.titulo,t),descricao:xt(e.descricao,t),containers:e.containers.map(r=>Bo(r,t))}),nh=()=>{const e=sa(),t=e.layout.containerStyle,r=e.layout.roundness??"rounded-xl",n=K("overflow-hidden",r,t==="card"?"border":"",t==="bordered"?"border":"",t==="glassmorphism"?"backdrop-blur-sm":""),a=t==="glassmorphism"?{background:"var(--t-surface)",borderColor:"var(--t-border)",borderWidth:"1px",borderStyle:"solid"}:{},s=K("border-b px-6 py-4",t==="flat"?"border-transparent":"");return{wrapperClass:n,wrapperStyle:a,headerClass:s,headerStyle:t==="glassmorphism"?{borderColor:"var(--t-border)"}:{},tmpl:e}},Tt=({name:e,control:t,placeholder:r,type:n="text",disabled:a,readOnly:s})=>{var i;const{field:l,fieldState:c}=$e.useController({name:e,control:t}),d=!!c.error;return o.jsxs("div",{className:"space-y-1",children:[o.jsx(ue,{...l,value:l.value??"",type:n,placeholder:r,disabled:a,readOnly:s,className:K(d&&"border-destructive focus-visible:ring-destructive")}),((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})},Uo=({name:e,control:t,placeholder:r,disabled:n,readOnly:a})=>{var s;const{field:i,fieldState:l}=$e.useController({name:e,control:t});return o.jsxs("div",{className:"space-y-1",children:[o.jsx(po,{...i,value:i.value??"",placeholder:r,disabled:n,readOnly:a,rows:3,className:K(l.error&&"border-destructive focus-visible:ring-destructive")}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},Ho=({name:e,control:t,placeholder:r,options:n,disabled:a,readOnly:s})=>{var i;const{field:l,fieldState:c}=$e.useController({name:e,control:t});return o.jsxs("div",{className:"space-y-1",children:[o.jsxs(Bt,{value:l.value??"",onValueChange:d=>!s&&l.onChange(d),disabled:a||s,children:[o.jsx(Rt,{className:K(c.error&&"border-destructive focus:ring-destructive"),onBlur:l.onBlur,children:o.jsx(Ut,{placeholder:r??"Selecione..."})}),o.jsx(It,{children:n.map(d=>o.jsx(qe,{value:d.valor,disabled:d.disabled,children:d.label},d.valor))})]}),((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})},Wo=({name:e,control:t,label:r,disabled:n,readOnly:a})=>{var s;const{field:i,fieldState:l}=$e.useController({name:e,control:t});return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[o.jsx(et,{name:i.name,checked:!!i.value,onCheckedChange:c=>!a&&i.onChange(!!c),onBlur:i.onBlur,disabled:n}),r&&o.jsx("span",{className:"text-sm leading-none",children:r})]}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},ul=({name:e,control:t,options:r,disabled:n})=>{var a;const{field:s,fieldState:i}=$e.useController({name:e,control:t}),l=Array.isArray(s.value)?s.value:[],c=d=>{const u=l.includes(d)?l.filter(m=>m!==d):[...l,d];s.onChange(u)};return o.jsxs("div",{className:"space-y-1",children:[o.jsx("div",{className:"flex flex-col gap-2",onBlur:s.onBlur,children:r.map(d=>o.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[o.jsx(et,{checked:l.includes(d.valor),onCheckedChange:()=>c(d.valor),disabled:n||d.disabled}),o.jsx("span",{className:"text-sm leading-none",children:d.label})]},d.valor))}),((a=i.error)==null?void 0:a.message)&&o.jsx("p",{className:"text-sm text-destructive",children:i.error.message})]})},ml=({name:e,control:t,options:r,visualStyle:n="default",disabled:a})=>{var s;const{field:i,fieldState:l}=$e.useController({name:e,control:t}),c=n==="card";return o.jsxs("div",{className:"space-y-1",onBlur:i.onBlur,children:[o.jsx(Pi,{value:i.value??"",onValueChange:i.onChange,className:K(c?"grid grid-cols-2 gap-2 sm:grid-cols-3":"flex flex-col gap-2"),children:r.map(d=>o.jsxs("label",{className:K("flex items-center gap-2 cursor-pointer",c&&"rounded-lg border p-3 transition-colors hover:bg-accent data-[selected=true]:border-primary data-[selected=true]:bg-primary/5",(a||d.disabled)&&"cursor-not-allowed opacity-50"),"data-selected":i.value===d.valor?"true":void 0,children:[o.jsx(_i,{value:d.valor,disabled:a||d.disabled}),o.jsx("span",{className:"text-sm leading-none",children:d.label})]},d.valor))}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},ah=e=>{const t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),n=String(e.getDate()).padStart(2,"0");return`${t}-${r}-${n}`},X1=e=>{const t=new Date;return t.setFullYear(t.getFullYear()-e),ah(t)},Z1=e=>{const t=new Date;return t.setFullYear(t.getFullYear()-e),ah(t)},Rn=({name:e,control:t,isDatetime:r,disabled:n,readOnly:a,validacao:s})=>{var i;const{field:l,fieldState:c}=$e.useController({name:e,control:t}),d=r?"datetime-local":"date",u=f=>r?f+"T00:00":f,m=(s==null?void 0:s.minAge)!=null?u(X1(s.minAge)):(s==null?void 0:s.maxDate)!=null?u(s.maxDate):void 0,p=(s==null?void 0:s.maxAge)!=null?u(Z1(s.maxAge)):(s==null?void 0:s.minDate)!=null?u(s.minDate):void 0;return o.jsxs("div",{className:"space-y-1",children:[o.jsx(ue,{name:l.name,value:l.value??"",onChange:l.onChange,onBlur:l.onBlur,type:d,min:p,max:m,disabled:n,readOnly:a,className:K(c.error&&"border-destructive focus-visible:ring-destructive")}),((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})};function K1(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}const oh={128:"€",130:"‚",131:"ƒ",132:"„",133:"…",134:"†",135:"‡",136:"ˆ",137:"‰",138:"Š",139:"‹",140:"Œ",142:"Ž",145:"‘",146:"’",147:"“",148:"”",149:"•",150:"–",151:"—",152:"˜",153:"™",154:"š",155:"›",156:"œ",158:"ž",159:"Ÿ"};for(const[e,t]of Object.entries(oh));let _c;function Y1(){if(!(typeof globalThis.TextDecoder>"u"))return _c??(_c=new globalThis.TextDecoder("utf-8"))}const In=32*1024,Gt=65533;function J1(e,t="utf-8"){switch(t.toLowerCase()){case"utf-8":case"utf8":{const r=Y1();return r?r.decode(e):ej(e)}case"utf-16le":return tj(e);case"us-ascii":case"ascii":return rj(e);case"latin1":case"iso-8859-1":return nj(e);case"windows-1252":return aj(e);default:throw new RangeError(`Encoding '${t}' not supported`)}}function pl(e,t){t.length!==0&&(e.push(String.fromCharCode.apply(null,t)),t.length=0)}function Ke(e,t,r){t.push(r),t.length>=In&&pl(e,t)}function Q1(e,t,r){if(r<=65535){Ke(e,t,r);return}r-=65536,Ke(e,t,55296+(r>>10)),Ke(e,t,56320+(r&1023))}function ej(e){const t=[],r=[];let n=0;for(e.length>=3&&e[0]===239&&e[1]===187&&e[2]===191&&(n=3);n<e.length;){const a=e[n];if(a<=127){Ke(t,r,a),n++;continue}if(a<194||a>244){Ke(t,r,Gt),n++;continue}if(a<=223){if(n+1>=e.length){Ke(t,r,Gt),n++;continue}const d=e[n+1];if((d&192)!==128){Ke(t,r,Gt),n++;continue}const u=(a&31)<<6|d&63;Ke(t,r,u),n+=2;continue}if(a<=239){if(n+2>=e.length){Ke(t,r,Gt),n++;continue}const d=e[n+1],u=e[n+2];if(!((d&192)===128&&(u&192)===128&&!(a===224&&d<160)&&!(a===237&&d>=160))){Ke(t,r,Gt),n++;continue}const m=(a&15)<<12|(d&63)<<6|u&63;Ke(t,r,m),n+=3;continue}if(n+3>=e.length){Ke(t,r,Gt),n++;continue}const s=e[n+1],i=e[n+2],l=e[n+3];if(!((s&192)===128&&(i&192)===128&&(l&192)===128&&!(a===240&&s<144)&&!(a===244&&s>143))){Ke(t,r,Gt),n++;continue}const c=(a&7)<<18|(s&63)<<12|(i&63)<<6|l&63;Q1(t,r,c),n+=4}return pl(t,r),t.join("")}function tj(e){const t=[],r=[],n=e.length;let a=0;for(;a+1<n;){const s=e[a]|e[a+1]<<8;if(a+=2,s>=55296&&s<=56319){if(a+1<n){const i=e[a]|e[a+1]<<8;i>=56320&&i<=57343?(Ke(t,r,s),Ke(t,r,i),a+=2):Ke(t,r,Gt)}else Ke(t,r,Gt);continue}if(s>=56320&&s<=57343){Ke(t,r,Gt);continue}Ke(t,r,s)}return a<n&&Ke(t,r,Gt),pl(t,r),t.join("")}function rj(e){const t=[];for(let r=0;r<e.length;r+=In){const n=Math.min(e.length,r+In),a=new Array(n-r);for(let s=r,i=0;s<n;s++,i++)a[i]=e[s]&127;t.push(String.fromCharCode.apply(null,a))}return t.join("")}function nj(e){const t=[];for(let r=0;r<e.length;r+=In){const n=Math.min(e.length,r+In),a=new Array(n-r);for(let s=r,i=0;s<n;s++,i++)a[i]=e[s];t.push(String.fromCharCode.apply(null,a))}return t.join("")}function aj(e){const t=[];let r="";for(let n=0;n<e.length;n++){const a=e[n],s=a>=128&&a<=159?oh[a]:void 0;r+=s??String.fromCharCode(a),r.length>=In&&(t.push(r),r="")}return r&&t.push(r),t.join("")}function kt(e){return new DataView(e.buffer,e.byteOffset)}const oj={len:1,get(e,t){return kt(e).getUint8(t)},put(e,t,r){return kt(e).setUint8(t,r),t+1}},Ue={len:2,get(e,t){return kt(e).getUint16(t,!0)},put(e,t,r){return kt(e).setUint16(t,r,!0),t+2}},fn={len:2,get(e,t){return kt(e).getUint16(t)},put(e,t,r){return kt(e).setUint16(t,r),t+2}},Ge={len:4,get(e,t){return kt(e).getUint32(t,!0)},put(e,t,r){return kt(e).setUint32(t,r,!0),t+4}},Oc={len:4,get(e,t){return kt(e).getUint32(t)},put(e,t,r){return kt(e).setUint32(t,r),t+4}},sj={len:4,get(e,t){return kt(e).getInt32(t)},put(e,t,r){return kt(e).setInt32(t,r),t+4}},ij={len:8,get(e,t){return kt(e).getBigUint64(t,!0)},put(e,t,r){return kt(e).setBigUint64(t,r,!0),t+8}};let vr=class{constructor(t,r){this.len=t,this.encoding=r}get(t,r=0){const n=t.subarray(r,r+this.len);return J1(n,this.encoding)}};const lj="End-Of-Stream";class Je extends Error{constructor(){super(lj),this.name="EndOfStreamError"}}let cj=class extends Error{constructor(t="The operation was aborted"){super(t),this.name="AbortError"}},sh=class{constructor(){this.endOfStream=!1,this.interrupted=!1,this.peekQueue=[]}async peek(t,r=!1){const n=await this.read(t,r);return this.peekQueue.push(t.subarray(0,n)),n}async read(t,r=!1){if(t.length===0)return 0;let n=this.readFromPeekBuffer(t);if(this.endOfStream||(n+=await this.readRemainderFromStream(t.subarray(n),r)),n===0&&!r)throw new Je;return n}readFromPeekBuffer(t){let r=t.length,n=0;for(;this.peekQueue.length>0&&r>0;){const a=this.peekQueue.pop();if(!a)throw new Error("peekData should be defined");const s=Math.min(a.length,r);t.set(a.subarray(0,s),n),n+=s,r-=s,s<a.length&&this.peekQueue.push(a.subarray(s))}return n}async readRemainderFromStream(t,r){let n=0;for(;n<t.length&&!this.endOfStream;){if(this.interrupted)throw new cj;const a=await this.readFromStream(t.subarray(n),r);if(a===0)break;n+=a}if(!r&&n<t.length)throw new Je;return n}},dj=class extends sh{constructor(t){super(),this.reader=t}async abort(){return this.close()}async close(){this.reader.releaseLock()}},uj=class extends dj{async readFromStream(t,r){if(t.length===0)return 0;const n=await this.reader.read(new Uint8Array(t.length),{min:r?void 0:t.length});return n.done&&(this.endOfStream=n.done),n.value?(t.set(n.value),n.value.length):0}},Fc=class extends sh{constructor(t){super(),this.reader=t,this.buffer=null}writeChunk(t,r){const n=Math.min(r.length,t.length);return t.set(r.subarray(0,n)),n<r.length?this.buffer=r.subarray(n):this.buffer=null,n}async readFromStream(t,r){if(t.length===0)return 0;let n=0;for(this.buffer&&(n+=this.writeChunk(t,this.buffer));n<t.length&&!this.endOfStream;){const a=await this.reader.read();if(a.done){this.endOfStream=!0;break}a.value&&(n+=this.writeChunk(t.subarray(n),a.value))}if(!r&&n===0&&this.endOfStream)throw new Je;return n}abort(){return this.interrupted=!0,this.reader.cancel()}async close(){await this.abort(),this.reader.releaseLock()}};function mj(e){try{const t=e.getReader({mode:"byob"});return t instanceof ReadableStreamDefaultReader?new Fc(t):new uj(t)}catch(t){if(t instanceof TypeError)return new Fc(e.getReader());throw t}}class fl{constructor(t){this.numBuffer=new Uint8Array(8),this.position=0,this.onClose=t==null?void 0:t.onClose,t!=null&&t.abortSignal&&t.abortSignal.addEventListener("abort",()=>{this.abort()})}async readToken(t,r=this.position){const n=new Uint8Array(t.len);if(await this.readBuffer(n,{position:r})<t.len)throw new Je;return t.get(n,0)}async peekToken(t,r=this.position){const n=new Uint8Array(t.len);if(await this.peekBuffer(n,{position:r})<t.len)throw new Je;return t.get(n,0)}async readNumber(t){if(await this.readBuffer(this.numBuffer,{length:t.len})<t.len)throw new Je;return t.get(this.numBuffer,0)}async peekNumber(t){if(await this.peekBuffer(this.numBuffer,{length:t.len})<t.len)throw new Je;return t.get(this.numBuffer,0)}async ignore(t){if(t<0)throw new RangeError("ignore length must be ≥ 0 bytes");if(this.fileInfo.size!==void 0){const r=this.fileInfo.size-this.position;if(t>r)return this.position+=r,r}return this.position+=t,t}async close(){var t;await this.abort(),await((t=this.onClose)==null?void 0:t.call(this))}normalizeOptions(t,r){if(!this.supportsRandomAccess()&&r&&r.position!==void 0&&r.position<this.position)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");return{mayBeLess:!1,offset:0,length:t.length,position:this.position,...r}}abort(){return Promise.resolve()}}const pj=256e3;let fj=class extends fl{constructor(t,r){super(r),this.streamReader=t,this.fileInfo=(r==null?void 0:r.fileInfo)??{}}async readBuffer(t,r){const n=this.normalizeOptions(t,r),a=n.position-this.position;if(a>0)return await this.ignore(a),this.readBuffer(t,r);if(a<0)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");if(n.length===0)return 0;const s=await this.streamReader.read(t.subarray(0,n.length),n.mayBeLess);if(this.position+=s,(!r||!r.mayBeLess)&&s<n.length)throw new Je;return s}async peekBuffer(t,r){const n=this.normalizeOptions(t,r);let a=0;if(n.position){const s=n.position-this.position;if(s>0){const i=new Uint8Array(n.length+s);return a=await this.peekBuffer(i,{mayBeLess:n.mayBeLess}),t.set(i.subarray(s)),a-s}if(s<0)throw new Error("Cannot peek from a negative offset in a stream")}if(n.length>0){try{a=await this.streamReader.peek(t.subarray(0,n.length),n.mayBeLess)}catch(s){if(r!=null&&r.mayBeLess&&s instanceof Je)return 0;throw s}if(!n.mayBeLess&&a<n.length)throw new Je}return a}async ignore(t){if(t<0)throw new RangeError("ignore length must be ≥ 0 bytes");const r=Math.min(pj,t),n=new Uint8Array(r);let a=0;for(;a<t;){const s=t-a,i=await this.readBuffer(n,{length:Math.min(r,s)});if(i<0)return i;a+=i}return a}abort(){return this.streamReader.abort()}async close(){return this.streamReader.close()}supportsRandomAccess(){return!1}},hj=class extends fl{constructor(t,r){super(r),this.uint8Array=t,this.fileInfo={...(r==null?void 0:r.fileInfo)??{},size:t.length}}async readBuffer(t,r){r!=null&&r.position&&(this.position=r.position);const n=await this.peekBuffer(t,r);return this.position+=n,n}async peekBuffer(t,r){const n=this.normalizeOptions(t,r),a=Math.min(this.uint8Array.length-n.position,n.length);if(!n.mayBeLess&&a<n.length)throw new Je;return t.set(this.uint8Array.subarray(n.position,n.position+a)),a}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(t){this.position=t}},xj=class extends fl{constructor(t,r){super(r),this.blob=t,this.fileInfo={...(r==null?void 0:r.fileInfo)??{},size:t.size,mimeType:t.type}}async readBuffer(t,r){r!=null&&r.position&&(this.position=r.position);const n=await this.peekBuffer(t,r);return this.position+=n,n}async peekBuffer(t,r){const n=this.normalizeOptions(t,r),a=Math.min(this.blob.size-n.position,n.length);if(!n.mayBeLess&&a<n.length)throw new Je;const s=await this.blob.slice(n.position,n.position+a).arrayBuffer();return t.set(new Uint8Array(s)),a}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(t){this.position=t}};function gj(e,t){const r=mj(e),n=t??{},a=n.onClose;return n.onClose=async()=>{if(await r.close(),a)return a()},new fj(r,n)}function vj(e,t){return new hj(e,t)}function bj(e,t){return new xj(e,t)}var ii={exports:{}},vs,zc;function yj(){if(zc)return vs;zc=1;var e=1e3,t=e*60,r=t*60,n=r*24,a=n*7,s=n*365.25;vs=function(u,m){m=m||{};var p=typeof u;if(p==="string"&&u.length>0)return i(u);if(p==="number"&&isFinite(u))return m.long?c(u):l(u);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(u))};function i(u){if(u=String(u),!(u.length>100)){var m=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(u);if(m){var p=parseFloat(m[1]),f=(m[2]||"ms").toLowerCase();switch(f){case"years":case"year":case"yrs":case"yr":case"y":return p*s;case"weeks":case"week":case"w":return p*a;case"days":case"day":case"d":return p*n;case"hours":case"hour":case"hrs":case"hr":case"h":return p*r;case"minutes":case"minute":case"mins":case"min":case"m":return p*t;case"seconds":case"second":case"secs":case"sec":case"s":return p*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return p;default:return}}}}function l(u){var m=Math.abs(u);return m>=n?Math.round(u/n)+"d":m>=r?Math.round(u/r)+"h":m>=t?Math.round(u/t)+"m":m>=e?Math.round(u/e)+"s":u+"ms"}function c(u){var m=Math.abs(u);return m>=n?d(u,m,n,"day"):m>=r?d(u,m,r,"hour"):m>=t?d(u,m,t,"minute"):m>=e?d(u,m,e,"second"):u+" ms"}function d(u,m,p,f){var b=m>=p*1.5;return Math.round(u/p)+" "+f+(b?"s":"")}return vs}function wj(e){r.debug=r,r.default=r,r.coerce=c,r.disable=i,r.enable=a,r.enabled=l,r.humanize=yj(),r.destroy=d,Object.keys(e).forEach(u=>{r[u]=e[u]}),r.names=[],r.skips=[],r.formatters={};function t(u){let m=0;for(let p=0;p<u.length;p++)m=(m<<5)-m+u.charCodeAt(p),m|=0;return r.colors[Math.abs(m)%r.colors.length]}r.selectColor=t;function r(u){let m,p=null,f,b;function h(...x){if(!h.enabled)return;const y=h,v=Number(new Date),j=v-(m||v);y.diff=j,y.prev=m,y.curr=v,m=v,x[0]=r.coerce(x[0]),typeof x[0]!="string"&&x.unshift("%O");let w=0;x[0]=x[0].replace(/%([a-zA-Z%])/g,(C,S)=>{if(C==="%%")return"%";w++;const $=r.formatters[S];if(typeof $=="function"){const k=x[w];C=$.call(y,k),x.splice(w,1),w--}return C}),r.formatArgs.call(y,x),(y.log||r.log).apply(y,x)}return h.namespace=u,h.useColors=r.useColors(),h.color=r.selectColor(u),h.extend=n,h.destroy=r.destroy,Object.defineProperty(h,"enabled",{enumerable:!0,configurable:!1,get:()=>p!==null?p:(f!==r.namespaces&&(f=r.namespaces,b=r.enabled(u)),b),set:x=>{p=x}}),typeof r.init=="function"&&r.init(h),h}function n(u,m){const p=r(this.namespace+(typeof m>"u"?":":m)+u);return p.log=this.log,p}function a(u){r.save(u),r.namespaces=u,r.names=[],r.skips=[];const m=(typeof u=="string"?u:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const p of m)p[0]==="-"?r.skips.push(p.slice(1)):r.names.push(p)}function s(u,m){let p=0,f=0,b=-1,h=0;for(;p<u.length;)if(f<m.length&&(m[f]===u[p]||m[f]==="*"))m[f]==="*"?(b=f,h=p,f++):(p++,f++);else if(b!==-1)f=b+1,h++,p=h;else return!1;for(;f<m.length&&m[f]==="*";)f++;return f===m.length}function i(){const u=[...r.names,...r.skips.map(m=>"-"+m)].join(",");return r.enable(""),u}function l(u){for(const m of r.skips)if(s(u,m))return!1;for(const m of r.names)if(s(u,m))return!0;return!1}function c(u){return u instanceof Error?u.stack||u.message:u}function d(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}var jj=wj;(function(e,t){t.formatArgs=n,t.save=a,t.load=s,t.useColors=r,t.storage=i(),t.destroy=(()=>{let c=!1;return()=>{c||(c=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function r(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let c;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(c=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(c[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function n(c){if(c[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+c[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const d="color: "+this.color;c.splice(1,0,d,"color: inherit");let u=0,m=0;c[0].replace(/%[a-zA-Z%]/g,p=>{p!=="%%"&&(u++,p==="%c"&&(m=u))}),c.splice(m,0,d)}t.log=console.debug||console.log||(()=>{});function a(c){try{c?t.storage.setItem("debug",c):t.storage.removeItem("debug")}catch{}}function s(){let c;try{c=t.storage.getItem("debug")||t.storage.getItem("DEBUG")}catch{}return!c&&typeof process<"u"&&"env"in process&&(c=process.env.DEBUG),c}function i(){try{return localStorage}catch{}}e.exports=jj(t);const{formatters:l}=e.exports;l.j=function(c){try{return JSON.stringify(c)}catch(d){return"[UnexpectedJSONParseError]: "+d.message}}})(ii,ii.exports);var kj=ii.exports;const Cj=K1(kj),yn={LocalFileHeader:67324752,DataDescriptor:134695760,CentralFileHeader:33639248,EndOfCentralDirectory:101010256},Lc={get(e){return{signature:Ge.get(e,0),compressedSize:Ge.get(e,8),uncompressedSize:Ge.get(e,12)}},len:16},Nj={get(e){const t=Ue.get(e,6);return{signature:Ge.get(e,0),minVersion:Ue.get(e,4),dataDescriptor:!!(t&8),compressedMethod:Ue.get(e,8),compressedSize:Ge.get(e,18),uncompressedSize:Ge.get(e,22),filenameLength:Ue.get(e,26),extraFieldLength:Ue.get(e,28),filename:null}},len:30},Sj={get(e){return{signature:Ge.get(e,0),nrOfThisDisk:Ue.get(e,4),nrOfThisDiskWithTheStart:Ue.get(e,6),nrOfEntriesOnThisDisk:Ue.get(e,8),nrOfEntriesOfSize:Ue.get(e,10),sizeOfCd:Ge.get(e,12),offsetOfStartOfCd:Ge.get(e,16),zipFileCommentLength:Ue.get(e,20)}},len:22},$j={get(e){const t=Ue.get(e,8);return{signature:Ge.get(e,0),minVersion:Ue.get(e,6),dataDescriptor:!!(t&8),compressedMethod:Ue.get(e,10),compressedSize:Ge.get(e,20),uncompressedSize:Ge.get(e,24),filenameLength:Ue.get(e,28),extraFieldLength:Ue.get(e,30),fileCommentLength:Ue.get(e,32),relativeOffsetOfLocalHeader:Ge.get(e,42),filename:null}},len:46};function ih(e){const t=new Uint8Array(Ge.len);return Ge.put(t,0,e),t}const nr=Cj("tokenizer:inflate"),bs=256*1024,Ej=ih(yn.DataDescriptor),Aa=ih(yn.EndOfCentralDirectory);class ha{constructor(t){this.tokenizer=t,this.syncBuffer=new Uint8Array(bs)}async isZip(){return await this.peekSignature()===yn.LocalFileHeader}peekSignature(){return this.tokenizer.peekToken(Ge)}async findEndOfCentralDirectoryLocator(){const t=this.tokenizer,r=Math.min(16*1024,t.fileInfo.size),n=this.syncBuffer.subarray(0,r);await this.tokenizer.readBuffer(n,{position:t.fileInfo.size-r});for(let a=n.length-4;a>=0;a--)if(n[a]===Aa[0]&&n[a+1]===Aa[1]&&n[a+2]===Aa[2]&&n[a+3]===Aa[3])return t.fileInfo.size-r+a;return-1}async readCentralDirectory(){if(!this.tokenizer.supportsRandomAccess()){nr("Cannot reading central-directory without random-read support");return}nr("Reading central-directory...");const t=this.tokenizer.position,r=await this.findEndOfCentralDirectoryLocator();if(r>0){nr("Central-directory 32-bit signature found");const n=await this.tokenizer.readToken(Sj,r),a=[];this.tokenizer.setPosition(n.offsetOfStartOfCd);for(let s=0;s<n.nrOfEntriesOfSize;++s){const i=await this.tokenizer.readToken($j);if(i.signature!==yn.CentralFileHeader)throw new Error("Expected Central-File-Header signature");i.filename=await this.tokenizer.readToken(new vr(i.filenameLength,"utf-8")),await this.tokenizer.ignore(i.extraFieldLength),await this.tokenizer.ignore(i.fileCommentLength),a.push(i),nr(`Add central-directory file-entry: n=${s+1}/${a.length}: filename=${a[s].filename}`)}return this.tokenizer.setPosition(t),a}this.tokenizer.setPosition(t)}async unzip(t){const r=await this.readCentralDirectory();if(r)return this.iterateOverCentralDirectory(r,t);let n=!1;do{const a=await this.readLocalFileHeader();if(!a)break;const s=t(a);n=!!s.stop;let i;if(await this.tokenizer.ignore(a.extraFieldLength),a.dataDescriptor&&a.compressedSize===0){const l=[];let c=bs;nr("Compressed-file-size unknown, scanning for next data-descriptor-signature....");let d=-1;for(;d<0&&c===bs;){c=await this.tokenizer.peekBuffer(this.syncBuffer,{mayBeLess:!0}),d=Dj(this.syncBuffer.subarray(0,c),Ej);const u=d>=0?d:c;if(s.handler){const m=new Uint8Array(u);await this.tokenizer.readBuffer(m),l.push(m)}else await this.tokenizer.ignore(u)}nr(`Found data-descriptor-signature at pos=${this.tokenizer.position}`),s.handler&&await this.inflate(a,Tj(l),s.handler)}else s.handler?(nr(`Reading compressed-file-data: ${a.compressedSize} bytes`),i=new Uint8Array(a.compressedSize),await this.tokenizer.readBuffer(i),await this.inflate(a,i,s.handler)):(nr(`Ignoring compressed-file-data: ${a.compressedSize} bytes`),await this.tokenizer.ignore(a.compressedSize));if(nr(`Reading data-descriptor at pos=${this.tokenizer.position}`),a.dataDescriptor&&(await this.tokenizer.readToken(Lc)).signature!==134695760)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-Lc.len}`)}while(!n)}async iterateOverCentralDirectory(t,r){for(const n of t){const a=r(n);if(a.handler){this.tokenizer.setPosition(n.relativeOffsetOfLocalHeader);const s=await this.readLocalFileHeader();if(s){await this.tokenizer.ignore(s.extraFieldLength);const i=new Uint8Array(n.compressedSize);await this.tokenizer.readBuffer(i),await this.inflate(s,i,a.handler)}}if(a.stop)break}}async inflate(t,r,n){if(t.compressedMethod===0)return n(r);if(t.compressedMethod!==8)throw new Error(`Unsupported ZIP compression method: ${t.compressedMethod}`);nr(`Decompress filename=${t.filename}, compressed-size=${r.length}`);const a=await ha.decompressDeflateRaw(r);return n(a)}static async decompressDeflateRaw(t){const r=new ReadableStream({start(s){s.enqueue(t),s.close()}}),n=new DecompressionStream("deflate-raw"),a=r.pipeThrough(n);try{const s=await new Response(a).arrayBuffer();return new Uint8Array(s)}catch(s){const i=s instanceof Error?`Failed to deflate ZIP entry: ${s.message}`:"Unknown decompression error in ZIP entry";throw new TypeError(i)}}async readLocalFileHeader(){const t=await this.tokenizer.peekToken(Ge);if(t===yn.LocalFileHeader){const r=await this.tokenizer.readToken(Nj);return r.filename=await this.tokenizer.readToken(new vr(r.filenameLength,"utf-8")),r}if(t===yn.CentralFileHeader)return!1;throw t===3759263696?new Error("Encrypted ZIP"):new Error("Unexpected signature")}}function Dj(e,t){const r=e.length,n=t.length;if(n>r)return-1;for(let a=0;a<=r-n;a++){let s=!0;for(let i=0;i<n;i++)if(e[a+i]!==t[i]){s=!1;break}if(s)return a}return-1}function Tj(e){const t=e.reduce((a,s)=>a+s.length,0),r=new Uint8Array(t);let n=0;for(const a of e)r.set(a,n),n+=a.length;return r}let Aj=class{constructor(t){this.tokenizer=t}inflate(){const t=this.tokenizer;return new ReadableStream({async pull(r){const n=new Uint8Array(1024),a=await t.readBuffer(n,{mayBeLess:!0});if(a===0){r.close();return}r.enqueue(n.subarray(0,a))}}).pipeThrough(new DecompressionStream("gzip"))}};new globalThis.TextDecoder("utf8");new globalThis.TextEncoder;Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Mc(e){const{byteLength:t}=e;if(t===6)return e.getUint16(0)*2**32+e.getUint32(2);if(t===5)return e.getUint8(0)*2**32+e.getUint32(1);if(t===4)return e.getUint32(0);if(t===3)return e.getUint8(0)*2**16+e.getUint16(1);if(t===2)return e.getUint16(0);if(t===1)return e.getUint8(0)}function Rj(e,t){if(t==="utf-16le"){const r=[];for(let n=0;n<e.length;n++){const a=e.charCodeAt(n);r.push(a&255,a>>8&255)}return r}if(t==="utf-16be"){const r=[];for(let n=0;n<e.length;n++){const a=e.charCodeAt(n);r.push(a>>8&255,a&255)}return r}return[...e].map(r=>r.charCodeAt(0))}function Ij(e,t=0){const r=Number.parseInt(new vr(6).get(e,148).replace(/\0.*$/,"").trim(),8);if(Number.isNaN(r))return!1;let n=8*32;for(let a=t;a<t+148;a++)n+=e[a];for(let a=t+156;a<t+512;a++)n+=e[a];return r===n}const Pj={get:(e,t)=>e[t+3]&127|e[t+2]<<7|e[t+1]<<14|e[t]<<21,len:4},_j=["jpg","png","apng","gif","webp","flif","xcf","cr2","cr3","orf","arw","dng","nef","rw2","raf","tif","bmp","icns","jxr","psd","indd","zip","tar","rar","gz","bz2","7z","dmg","mp4","mid","mkv","webm","mov","avi","mpg","mp2","mp3","m4a","oga","ogg","ogv","opus","flac","wav","spx","amr","pdf","epub","elf","macho","exe","swf","rtf","wasm","woff","woff2","eot","ttf","otf","ttc","ico","flv","ps","xz","sqlite","nes","crx","xpi","cab","deb","ar","rpm","Z","lz","cfb","mxf","mts","blend","bpg","docx","pptx","xlsx","3gp","3g2","j2c","jp2","jpm","jpx","mj2","aif","qcp","odt","ods","odp","xml","mobi","heic","cur","ktx","ape","wv","dcm","ics","glb","pcap","dsf","lnk","alias","voc","ac3","m4v","m4p","m4b","f4v","f4p","f4b","f4a","mie","asf","ogm","ogx","mpc","arrow","shp","aac","mp1","it","s3m","xm","skp","avif","eps","lzh","pgp","asar","stl","chm","3mf","zst","jxl","vcf","jls","pst","dwg","parquet","class","arj","cpio","ace","avro","icc","fbx","vsdx","vtt","apk","drc","lz4","potx","xltx","dotx","xltm","ott","ots","otp","odg","otg","xlsm","docm","dotm","potm","pptm","jar","jmp","rm","sav","ppsm","ppsx","tar.gz","reg","dat"],Oj=["image/jpeg","image/png","image/gif","image/webp","image/flif","image/x-xcf","image/x-canon-cr2","image/x-canon-cr3","image/tiff","image/bmp","image/vnd.ms-photo","image/vnd.adobe.photoshop","application/x-indesign","application/epub+zip","application/x-xpinstall","application/vnd.ms-powerpoint.slideshow.macroenabled.12","application/vnd.oasis.opendocument.text","application/vnd.oasis.opendocument.spreadsheet","application/vnd.oasis.opendocument.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.presentationml.slideshow","application/zip","application/x-tar","application/x-rar-compressed","application/gzip","application/x-bzip2","application/x-7z-compressed","application/x-apple-diskimage","application/vnd.apache.arrow.file","video/mp4","audio/midi","video/matroska","video/webm","video/quicktime","video/vnd.avi","audio/wav","audio/qcelp","audio/x-ms-asf","video/x-ms-asf","application/vnd.ms-asf","video/mpeg","video/3gpp","audio/mpeg","audio/mp4","video/ogg","audio/ogg","audio/ogg; codecs=opus","application/ogg","audio/flac","audio/ape","audio/wavpack","audio/amr","application/pdf","application/x-elf","application/x-mach-binary","application/x-msdownload","application/x-shockwave-flash","application/rtf","application/wasm","font/woff","font/woff2","application/vnd.ms-fontobject","font/ttf","font/otf","font/collection","image/x-icon","video/x-flv","application/postscript","application/eps","application/x-xz","application/x-sqlite3","application/x-nintendo-nes-rom","application/x-google-chrome-extension","application/vnd.ms-cab-compressed","application/x-deb","application/x-unix-archive","application/x-rpm","application/x-compress","application/x-lzip","application/x-cfb","application/x-mie","application/mxf","video/mp2t","application/x-blender","image/bpg","image/j2c","image/jp2","image/jpx","image/jpm","image/mj2","audio/aiff","application/xml","application/x-mobipocket-ebook","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/icns","image/ktx","application/dicom","audio/x-musepack","text/calendar","text/vcard","text/vtt","model/gltf-binary","application/vnd.tcpdump.pcap","audio/x-dsf","application/x.ms.shortcut","application/x.apple.alias","audio/x-voc","audio/vnd.dolby.dd-raw","audio/x-m4a","image/apng","image/x-olympus-orf","image/x-sony-arw","image/x-adobe-dng","image/x-nikon-nef","image/x-panasonic-rw2","image/x-fujifilm-raf","video/x-m4v","video/3gpp2","application/x-esri-shape","audio/aac","audio/x-it","audio/x-s3m","audio/x-xm","video/MP1S","video/MP2P","application/vnd.sketchup.skp","image/avif","application/x-lzh-compressed","application/pgp-encrypted","application/x-asar","model/stl","application/vnd.ms-htmlhelp","model/3mf","image/jxl","application/zstd","image/jls","application/vnd.ms-outlook","image/vnd.dwg","application/vnd.apache.parquet","application/java-vm","application/x-arj","application/x-cpio","application/x-ace-compressed","application/avro","application/vnd.iccprofile","application/x.autodesk.fbx","application/vnd.visio","application/vnd.android.package-archive","application/vnd.google.draco","application/x-lz4","application/vnd.openxmlformats-officedocument.presentationml.template","application/vnd.openxmlformats-officedocument.spreadsheetml.template","application/vnd.openxmlformats-officedocument.wordprocessingml.template","application/vnd.ms-excel.template.macroenabled.12","application/vnd.oasis.opendocument.text-template","application/vnd.oasis.opendocument.spreadsheet-template","application/vnd.oasis.opendocument.presentation-template","application/vnd.oasis.opendocument.graphics","application/vnd.oasis.opendocument.graphics-template","application/vnd.ms-excel.sheet.macroenabled.12","application/vnd.ms-word.document.macroenabled.12","application/vnd.ms-word.template.macroenabled.12","application/vnd.ms-powerpoint.template.macroenabled.12","application/vnd.ms-powerpoint.presentation.macroenabled.12","application/java-archive","application/vnd.rn-realmedia","application/x-spss-sav","application/x-ms-regedit","application/x-ft-windows-registry-hive","application/x-jmp-data"],Kn=4100,Fj=Kn-2,ur=1024*1024,Vc=1024,zj=2**31-1,Lt=16*1024*1024,qo=ur,Bc=ur,Lj=Lt,Mj=1,Uc=100,ys=Lt,Hc=64,Wc=qo,Vj=256,Bj=512,Uj=Lt,Hj=512,Wj=512,qc=256,Gc=qo,Xc=qo,qj=qo,Zc=Lt,Gj=new Set(["Unexpected signature","Encrypted ZIP","Expected Central-File-Header signature"]),Xj=["ZIP entry count exceeds ","Unsupported ZIP compression method:","ZIP entry compressed data exceeds ","ZIP entry decompressed data exceeds ","Expected data-descriptor-signature at position "],Zj=new Set(["Z_BUF_ERROR","Z_DATA_ERROR","ERR_INVALID_STATE"]);class Yr extends Error{}function Kj(e){var t;const r=e==null?void 0:e.streamReader;if(((t=r==null?void 0:r.constructor)==null?void 0:t.name)!=="WebStreamByobReader")return e;const{reader:n}=r,a=async()=>{await n.cancel(),n.releaseLock()};return r.close=a,r.abort=async()=>{r.interrupted=!0,await a()},e}function hl(e,t,r){if(!Number.isFinite(e)||e<0||e>t)throw new Yr(`${r} has invalid size ${e} (maximum ${t} bytes)`);return e}async function Rr(e,t,{maximumLength:r=Lt,reason:n="skip"}={}){const a=hl(t,r,n);await e.ignore(a)}async function ws(e,t,r,{maximumLength:n=t.length,reason:a="read"}={}){const s=t.length,i=hl(s,n,a);return e.readBuffer(t,{...r,length:i})}async function Yj(e,{maximumLength:t=ur}={}){const r=new ReadableStream({start(l){l.enqueue(e),l.close()}}).pipeThrough(new DecompressionStream("deflate-raw")).getReader(),n=[];let a=0;try{for(;;){const{done:l,value:c}=await r.read();if(l)break;if(a+=c.length,a>t)throw await r.cancel(),new Error(`ZIP entry decompressed data exceeds ${t} bytes`);n.push(c)}}finally{r.releaseLock()}const s=new Uint8Array(a);let i=0;for(const l of n)s.set(l,i),i+=l.length;return s}const lh=134695760,Qa=16,Jj=Qa-1;function Qj(e,t){if(e.length<Qa)return-1;const r=e.length-Qa;for(let n=0;n<=r;n++)if(Ge.get(e,n)===lh&&Ge.get(e,n+8)===t+n)return n;return-1}function ek(e){return(e.codePointAt(0)&32)!==0}function tk(e,t){const r=new Uint8Array(t);let n=0;for(const a of e)r.set(a,n),n+=a.length;return r}async function rk(e,{shouldBuffer:t,maximumLength:r=ur}={}){const{syncBuffer:n}=e,{length:a}=n,s=[];let i=0;for(;;){const l=await e.tokenizer.peekBuffer(n,{mayBeLess:!0}),c=Qj(n.subarray(0,l),i),d=c>=0?0:l===a?Math.min(Jj,l-1):0,u=c>=0?c:l-d;if(u===0)break;if(i+=u,i>r)throw new Error(`ZIP entry compressed data exceeds ${r} bytes`);if(t){const m=new Uint8Array(u);await e.tokenizer.readBuffer(m),s.push(m)}else await e.tokenizer.ignore(u);if(c>=0)break}if(mt(e.tokenizer)||(e.knownSizeDescriptorScannedBytes+=i),!!t)return tk(s,i)}function nk(e,t){return mt(e.tokenizer)?Math.max(0,Lt-(e.tokenizer.position-t)):Math.max(0,ur-e.knownSizeDescriptorScannedBytes)}async function ak(e,t,{shouldBuffer:r,maximumDescriptorLength:n=ur}={}){if(t.dataDescriptor&&t.compressedSize===0)return rk(e,{shouldBuffer:r,maximumLength:n});if(!r){await Rr(e.tokenizer,t.compressedSize,{maximumLength:mt(e.tokenizer)?ur:e.tokenizer.fileInfo.size,reason:"ZIP entry compressed data"});return}const a=uk(e.tokenizer);if(!Number.isFinite(t.compressedSize)||t.compressedSize<0||t.compressedSize>a)throw new Error(`ZIP entry compressed data exceeds ${a} bytes`);const s=new Uint8Array(t.compressedSize);return await e.tokenizer.readBuffer(s),s}ha.prototype.inflate=async function(e,t,r){if(e.compressedMethod===0)return r(t);if(e.compressedMethod!==8)throw new Error(`Unsupported ZIP compression method: ${e.compressedMethod}`);const n=await Yj(t,{maximumLength:ur});return r(n)};ha.prototype.unzip=async function(e){let t=!1,r=0;const n=this.tokenizer.position;this.knownSizeDescriptorScannedBytes=0;do{if(Yn(this.tokenizer,n,Lt))throw new Yr(`ZIP stream probing exceeds ${Lt} bytes`);const a=await this.readLocalFileHeader();if(!a)break;if(r++,r>Vc)throw new Error(`ZIP entry count exceeds ${Vc}`);const s=e(a);t=!!s.stop,await this.tokenizer.ignore(a.extraFieldLength);const i=await ak(this,a,{shouldBuffer:!!s.handler,maximumDescriptorLength:Math.min(ur,nk(this,n))});if(s.handler&&await this.inflate(a,i,s.handler),a.dataDescriptor){const l=new Uint8Array(Qa);if(await this.tokenizer.readBuffer(l),Ge.get(l,0)!==lh)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-l.length}`)}if(Yn(this.tokenizer,n,Lt))throw new Yr(`ZIP stream probing exceeds ${Lt} bytes`)}while(!t)};function ok(e,t){const r=e.getReader();let n=0,a=!1,s=!1;const i=async l=>{a||s||(s=!0,await r.cancel(l))};return new ReadableStream({async pull(l){if(n>=t){l.close(),await i();return}const{done:c,value:d}=await r.read();if(c||!d){a=!0,l.close();return}const u=t-n;if(d.length>u){l.enqueue(d.subarray(0,u)),n+=u,l.close(),await i();return}l.enqueue(d),n+=d.length},async cancel(l){await i(l)}})}async function sk(e,t){return new xk(t).fromBlob(e)}function Kc(e){switch(e=e.toLowerCase(),e){case"application/epub+zip":return{ext:"epub",mime:e};case"application/vnd.oasis.opendocument.text":return{ext:"odt",mime:e};case"application/vnd.oasis.opendocument.text-template":return{ext:"ott",mime:e};case"application/vnd.oasis.opendocument.spreadsheet":return{ext:"ods",mime:e};case"application/vnd.oasis.opendocument.spreadsheet-template":return{ext:"ots",mime:e};case"application/vnd.oasis.opendocument.presentation":return{ext:"odp",mime:e};case"application/vnd.oasis.opendocument.presentation-template":return{ext:"otp",mime:e};case"application/vnd.oasis.opendocument.graphics":return{ext:"odg",mime:e};case"application/vnd.oasis.opendocument.graphics-template":return{ext:"otg",mime:e};case"application/vnd.openxmlformats-officedocument.presentationml.slideshow":return{ext:"ppsx",mime:e};case"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":return{ext:"xlsx",mime:e};case"application/vnd.ms-excel.sheet.macroenabled":return{ext:"xlsm",mime:"application/vnd.ms-excel.sheet.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.spreadsheetml.template":return{ext:"xltx",mime:e};case"application/vnd.ms-excel.template.macroenabled":return{ext:"xltm",mime:"application/vnd.ms-excel.template.macroenabled.12"};case"application/vnd.ms-powerpoint.slideshow.macroenabled":return{ext:"ppsm",mime:"application/vnd.ms-powerpoint.slideshow.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return{ext:"docx",mime:e};case"application/vnd.ms-word.document.macroenabled":return{ext:"docm",mime:"application/vnd.ms-word.document.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.template":return{ext:"dotx",mime:e};case"application/vnd.ms-word.template.macroenabledtemplate":return{ext:"dotm",mime:"application/vnd.ms-word.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.template":return{ext:"potx",mime:e};case"application/vnd.ms-powerpoint.template.macroenabled":return{ext:"potm",mime:"application/vnd.ms-powerpoint.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.presentation":return{ext:"pptx",mime:e};case"application/vnd.ms-powerpoint.presentation.macroenabled":return{ext:"pptm",mime:"application/vnd.ms-powerpoint.presentation.macroenabled.12"};case"application/vnd.ms-visio.drawing":return{ext:"vsdx",mime:"application/vnd.visio"};case"application/vnd.ms-package.3dmanufacturing-3dmodel+xml":return{ext:"3mf",mime:"model/3mf"}}}function ar(e,t,r){r={offset:0,...r};for(const[n,a]of t.entries())if(r.mask){if(a!==(r.mask[n]&e[n+r.offset]))return!1}else if(a!==e[n+r.offset])return!1;return!0}function ik(e){return Number.isFinite(e)?Math.max(1,Math.trunc(e)):Kn}function lk(e,t,r){return r===void 0?e.read(t):(r.throwIfAborted(),new Promise((n,a)=>{const s=()=>{r.removeEventListener("abort",i)},i=()=>{const l=r.reason;s(),(async()=>{try{await e.cancel(l)}catch{}})(),a(l)};r.addEventListener("abort",i,{once:!0}),(async()=>{try{const l=await e.read(t);s(),n(l)}catch(l){s(),a(l)}})()}))}function ck(e){return Number.isFinite(e)?Math.max(0,Math.min(Fj,Math.trunc(e))):0}function dk(e){return Number.isFinite(e)?Math.max(0,e):Number.MAX_SAFE_INTEGER}function mt(e){const t=e.fileInfo.size;return!Number.isFinite(t)||t===Number.MAX_SAFE_INTEGER}function Yn(e,t,r){return mt(e)&&e.position-t>r}function uk(e){const t=e.fileInfo.size,r=Number.isFinite(t)?Math.max(0,t-e.position):Number.MAX_SAFE_INTEGER;return Math.min(r,zj)}function mk(e){if(e instanceof Je||e instanceof Yr)return!0;if(!(e instanceof Error))return!1;if(Gj.has(e.message)||Zj.has(e.code))return!0;for(const t of Xj)if(e.message.startsWith(t))return!0;return!1}function Yc(e,t=ur){const r=[e.compressedSize,e.uncompressedSize];for(const n of r)if(!Number.isFinite(n)||n<0||n>t)return!1;return!0}function pk(){return{hasContentTypesEntry:!1,hasParsedContentTypesEntry:!1,isParsingContentTypes:!1,hasUnparseableContentTypes:!1,hasWordDirectory:!1,hasPresentationDirectory:!1,hasSpreadsheetDirectory:!1,hasThreeDimensionalModelEntry:!1}}function fk(e,t){t.startsWith("word/")&&(e.hasWordDirectory=!0),t.startsWith("ppt/")&&(e.hasPresentationDirectory=!0),t.startsWith("xl/")&&(e.hasSpreadsheetDirectory=!0),t.startsWith("3D/")&&t.endsWith(".model")&&(e.hasThreeDimensionalModelEntry=!0)}function Jc(e){if(!(!e.hasContentTypesEntry||e.hasUnparseableContentTypes||e.isParsingContentTypes||e.hasParsedContentTypesEntry)){if(e.hasWordDirectory)return{ext:"docx",mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"};if(e.hasPresentationDirectory)return{ext:"pptx",mime:"application/vnd.openxmlformats-officedocument.presentationml.presentation"};if(e.hasSpreadsheetDirectory)return{ext:"xlsx",mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"};if(e.hasThreeDimensionalModelEntry)return{ext:"3mf",mime:"model/3mf"}}}function hk(e){const t=e.indexOf('.main+xml"');if(t===-1){const a="application/vnd.ms-package.3dmanufacturing-3dmodel+xml";return e.includes(`ContentType="${a}"`)?a:void 0}const r=e.slice(0,t),n=r.lastIndexOf('"');return r.slice(n+1)}let xk=class ch{constructor(t){Ic(this,"detectConfident",async n=>{if(this.buffer=new Uint8Array(Kn),n.fileInfo.size===void 0&&(n.fileInfo.size=Number.MAX_SAFE_INTEGER),this.tokenizer=n,mt(n)&&(await n.peekBuffer(this.buffer,{length:3,mayBeLess:!0}),this.check([31,139,8])))return this.detectGzip(n);if(await n.peekBuffer(this.buffer,{length:32,mayBeLess:!0}),this.check([66,77]))return{ext:"bmp",mime:"image/bmp"};if(this.check([11,119]))return{ext:"ac3",mime:"audio/vnd.dolby.dd-raw"};if(this.check([120,1]))return{ext:"dmg",mime:"application/x-apple-diskimage"};if(this.check([77,90]))return{ext:"exe",mime:"application/x-msdownload"};if(this.check([37,33]))return await n.peekBuffer(this.buffer,{length:24,mayBeLess:!0}),this.checkString("PS-Adobe-",{offset:2})&&this.checkString(" EPSF-",{offset:14})?{ext:"eps",mime:"application/eps"}:{ext:"ps",mime:"application/postscript"};if(this.check([31,160])||this.check([31,157]))return{ext:"Z",mime:"application/x-compress"};if(this.check([199,113]))return{ext:"cpio",mime:"application/x-cpio"};if(this.check([96,234]))return{ext:"arj",mime:"application/x-arj"};if(this.check([239,187,191]))return this.detectionReentryCount>=qc?void 0:(this.detectionReentryCount++,await this.tokenizer.ignore(3),this.detectConfident(n));if(this.check([71,73,70]))return{ext:"gif",mime:"image/gif"};if(this.check([73,73,188]))return{ext:"jxr",mime:"image/vnd.ms-photo"};if(this.check([31,139,8]))return this.detectGzip(n);if(this.check([66,90,104]))return{ext:"bz2",mime:"application/x-bzip2"};if(this.checkString("ID3")){await Rr(n,6,{maximumLength:6,reason:"ID3 header prefix"});const a=await n.readToken(Pj),s=mt(n);if(!Number.isFinite(a)||a<0||s&&(a>ys||n.position+a>ys))return;if(n.position+a>n.fileInfo.size)return s?void 0:{ext:"mp3",mime:"audio/mpeg"};try{await Rr(n,a,{maximumLength:s?ys:n.fileInfo.size,reason:"ID3 payload"})}catch(i){if(i instanceof Je)return;throw i}return this.detectionReentryCount>=qc?void 0:(this.detectionReentryCount++,this.parseTokenizer(n,this.detectionReentryCount))}if(this.checkString("MP+"))return{ext:"mpc",mime:"audio/x-musepack"};if((this.buffer[0]===67||this.buffer[0]===70)&&this.check([87,83],{offset:1}))return{ext:"swf",mime:"application/x-shockwave-flash"};if(this.check([255,216,255]))return this.check([247],{offset:3})?{ext:"jls",mime:"image/jls"}:{ext:"jpg",mime:"image/jpeg"};if(this.check([79,98,106,1]))return{ext:"avro",mime:"application/avro"};if(this.checkString("FLIF"))return{ext:"flif",mime:"image/flif"};if(this.checkString("8BPS"))return{ext:"psd",mime:"image/vnd.adobe.photoshop"};if(this.checkString("MPCK"))return{ext:"mpc",mime:"audio/x-musepack"};if(this.checkString("FORM"))return{ext:"aif",mime:"audio/aiff"};if(this.checkString("icns",{offset:0}))return{ext:"icns",mime:"image/icns"};if(this.check([80,75,3,4])){let a;const s=pk();try{await new ha(n).unzip(i=>{fk(s,i.filename);const l=i.filename==="[Content_Types].xml",c=Jc(s);if(!l&&c)return a=c,{stop:!0};switch(i.filename){case"META-INF/mozilla.rsa":return a={ext:"xpi",mime:"application/x-xpinstall"},{stop:!0};case"META-INF/MANIFEST.MF":return a={ext:"jar",mime:"application/java-archive"},{stop:!0};case"mimetype":return Yc(i,Bc)?{async handler(d){const u=new TextDecoder("utf-8").decode(d).trim();a=Kc(u)},stop:!0}:{};case"[Content_Types].xml":return s.hasContentTypesEntry=!0,Yc(i,Bc)?(s.isParsingContentTypes=!0,{async handler(d){const u=new TextDecoder("utf-8").decode(d),m=hk(u);m&&(a=Kc(m)),s.hasParsedContentTypesEntry=!0,s.isParsingContentTypes=!1},stop:!0}):(s.hasUnparseableContentTypes=!0,{});default:return/classes\d*\.dex/.test(i.filename)?(a={ext:"apk",mime:"application/vnd.android.package-archive"},{stop:!0}):{}}})}catch(i){if(!mk(i))throw i;s.isParsingContentTypes&&(s.isParsingContentTypes=!1,s.hasUnparseableContentTypes=!0)}return a??Jc(s)??{ext:"zip",mime:"application/zip"}}if(this.checkString("OggS")){await n.ignore(28);const a=new Uint8Array(8);return await n.readBuffer(a),ar(a,[79,112,117,115,72,101,97,100])?{ext:"opus",mime:"audio/ogg; codecs=opus"}:ar(a,[128,116,104,101,111,114,97])?{ext:"ogv",mime:"video/ogg"}:ar(a,[1,118,105,100,101,111,0])?{ext:"ogm",mime:"video/ogg"}:ar(a,[127,70,76,65,67])?{ext:"oga",mime:"audio/ogg"}:ar(a,[83,112,101,101,120,32,32])?{ext:"spx",mime:"audio/ogg"}:ar(a,[1,118,111,114,98,105,115])?{ext:"ogg",mime:"audio/ogg"}:{ext:"ogx",mime:"application/ogg"}}if(this.check([80,75])&&(this.buffer[2]===3||this.buffer[2]===5||this.buffer[2]===7)&&(this.buffer[3]===4||this.buffer[3]===6||this.buffer[3]===8))return{ext:"zip",mime:"application/zip"};if(this.checkString("MThd"))return{ext:"mid",mime:"audio/midi"};if(this.checkString("wOFF")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff",mime:"font/woff"};if(this.checkString("wOF2")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff2",mime:"font/woff2"};if(this.check([212,195,178,161])||this.check([161,178,195,212]))return{ext:"pcap",mime:"application/vnd.tcpdump.pcap"};if(this.checkString("DSD "))return{ext:"dsf",mime:"audio/x-dsf"};if(this.checkString("LZIP"))return{ext:"lz",mime:"application/x-lzip"};if(this.checkString("fLaC"))return{ext:"flac",mime:"audio/flac"};if(this.check([66,80,71,251]))return{ext:"bpg",mime:"image/bpg"};if(this.checkString("wvpk"))return{ext:"wv",mime:"audio/wavpack"};if(this.checkString("%PDF"))return{ext:"pdf",mime:"application/pdf"};if(this.check([0,97,115,109]))return{ext:"wasm",mime:"application/wasm"};if(this.check([73,73])){const a=await this.readTiffHeader(!1);if(a)return a}if(this.check([77,77])){const a=await this.readTiffHeader(!0);if(a)return a}if(this.checkString("MAC "))return{ext:"ape",mime:"audio/ape"};if(this.check([26,69,223,163])){async function a(){const d=await n.peekNumber(oj);let u=128,m=0;for(;!(d&u)&&u!==0;)++m,u>>=1;const p=new Uint8Array(m+1);return await ws(n,p,void 0,{maximumLength:p.length,reason:"EBML field"}),p}async function s(){const d=await a(),u=await a();u[0]^=128>>u.length-1;const m=Math.min(6,u.length),p=new DataView(d.buffer),f=new DataView(u.buffer,u.length-m,m);return{id:Mc(p),len:Mc(f)}}async function i(d){let u=0;for(;d>0;){if(u++,u>Vj||Yn(n,c,Lt))return;const m=n.position,p=await s();if(p.id===17026){if(p.len>Hc)return;const f=hl(p.len,Hc,"EBML DocType");return(await n.readToken(new vr(f))).replaceAll(/\00.*$/g,"")}if(mt(n)&&(!Number.isFinite(p.len)||p.len<0||p.len>Wc)||(await Rr(n,p.len,{maximumLength:mt(n)?Wc:n.fileInfo.size,reason:"EBML payload"}),--d,n.position<=m))return}}const l=await s(),c=n.position;switch(await i(l.len)){case"webm":return{ext:"webm",mime:"video/webm"};case"matroska":return{ext:"mkv",mime:"video/matroska"};default:return}}if(this.checkString("SQLi"))return{ext:"sqlite",mime:"application/x-sqlite3"};if(this.check([78,69,83,26]))return{ext:"nes",mime:"application/x-nintendo-nes-rom"};if(this.checkString("Cr24"))return{ext:"crx",mime:"application/x-google-chrome-extension"};if(this.checkString("MSCF")||this.checkString("ISc("))return{ext:"cab",mime:"application/vnd.ms-cab-compressed"};if(this.check([237,171,238,219]))return{ext:"rpm",mime:"application/x-rpm"};if(this.check([197,208,211,198]))return{ext:"eps",mime:"application/eps"};if(this.check([40,181,47,253]))return{ext:"zst",mime:"application/zstd"};if(this.check([127,69,76,70]))return{ext:"elf",mime:"application/x-elf"};if(this.check([33,66,68,78]))return{ext:"pst",mime:"application/vnd.ms-outlook"};if(this.checkString("PAR1")||this.checkString("PARE"))return{ext:"parquet",mime:"application/vnd.apache.parquet"};if(this.checkString("ttcf"))return{ext:"ttc",mime:"font/collection"};if(this.check([254,237,250,206])||this.check([254,237,250,207])||this.check([206,250,237,254])||this.check([207,250,237,254]))return{ext:"macho",mime:"application/x-mach-binary"};if(this.check([4,34,77,24]))return{ext:"lz4",mime:"application/x-lz4"};if(this.checkString("regf"))return{ext:"dat",mime:"application/x-ft-windows-registry-hive"};if(this.checkString("$FL2")||this.checkString("$FL3"))return{ext:"sav",mime:"application/x-spss-sav"};if(this.check([79,84,84,79,0]))return{ext:"otf",mime:"font/otf"};if(this.checkString("#!AMR"))return{ext:"amr",mime:"audio/amr"};if(this.checkString("{\\rtf"))return{ext:"rtf",mime:"application/rtf"};if(this.check([70,76,86,1]))return{ext:"flv",mime:"video/x-flv"};if(this.checkString("IMPM"))return{ext:"it",mime:"audio/x-it"};if(this.checkString("-lh0-",{offset:2})||this.checkString("-lh1-",{offset:2})||this.checkString("-lh2-",{offset:2})||this.checkString("-lh3-",{offset:2})||this.checkString("-lh4-",{offset:2})||this.checkString("-lh5-",{offset:2})||this.checkString("-lh6-",{offset:2})||this.checkString("-lh7-",{offset:2})||this.checkString("-lzs-",{offset:2})||this.checkString("-lz4-",{offset:2})||this.checkString("-lz5-",{offset:2})||this.checkString("-lhd-",{offset:2}))return{ext:"lzh",mime:"application/x-lzh-compressed"};if(this.check([0,0,1,186])){if(this.check([33],{offset:4,mask:[241]}))return{ext:"mpg",mime:"video/MP1S"};if(this.check([68],{offset:4,mask:[196]}))return{ext:"mpg",mime:"video/MP2P"}}if(this.checkString("ITSF"))return{ext:"chm",mime:"application/vnd.ms-htmlhelp"};if(this.check([202,254,186,190])){const a=Oc.get(this.buffer,4),s=fn.get(this.buffer,6);if(a>0&&a<=30)return{ext:"macho",mime:"application/x-mach-binary"};if(s>30)return{ext:"class",mime:"application/java-vm"}}if(this.checkString(".RMF"))return{ext:"rm",mime:"application/vnd.rn-realmedia"};if(this.checkString("DRACO"))return{ext:"drc",mime:"application/vnd.google.draco"};if(this.check([253,55,122,88,90,0]))return{ext:"xz",mime:"application/x-xz"};if(this.checkString("<?xml "))return{ext:"xml",mime:"application/xml"};if(this.check([55,122,188,175,39,28]))return{ext:"7z",mime:"application/x-7z-compressed"};if(this.check([82,97,114,33,26,7])&&(this.buffer[6]===0||this.buffer[6]===1))return{ext:"rar",mime:"application/x-rar-compressed"};if(this.checkString("solid "))return{ext:"stl",mime:"model/stl"};if(this.checkString("AC")){const a=new vr(4,"latin1").get(this.buffer,2);if(a.match("^d*")&&a>=1e3&&a<=1050)return{ext:"dwg",mime:"image/vnd.dwg"}}if(this.checkString("070707"))return{ext:"cpio",mime:"application/x-cpio"};if(this.checkString("BLENDER"))return{ext:"blend",mime:"application/x-blender"};if(this.checkString("!<arch>"))return await n.ignore(8),await n.readToken(new vr(13,"ascii"))==="debian-binary"?{ext:"deb",mime:"application/x-deb"}:{ext:"ar",mime:"application/x-unix-archive"};if(this.checkString("WEBVTT")&&[`
|
|
80
|
-
`,"\r"," "," ","\0"].some(a=>this.checkString(a,{offset:6})))return{ext:"vtt",mime:"text/vtt"};if(this.check([137,80,78,71,13,10,26,10])){const a={ext:"png",mime:"image/png"},s={ext:"apng",mime:"image/apng"};await n.ignore(8);async function i(){return{length:await n.readToken(sj),type:await n.readToken(new
|
|
81
|
-
`))return{ext:"reg",mime:"application/x-ms-regedit"};if(this.check([82,73,70,70])){if(this.checkString("WEBP",{offset:8}))return{ext:"webp",mime:"image/webp"};if(this.check([65,86,73],{offset:8}))return{ext:"avi",mime:"video/vnd.avi"};if(this.check([87,65,86,69],{offset:8}))return{ext:"wav",mime:"audio/wav"};if(this.check([81,76,67,77],{offset:8}))return{ext:"qcp",mime:"audio/qcelp"}}if(this.check([73,73,85,0,24,0,0,0,136,231,116,216]))return{ext:"rw2",mime:"image/x-panasonic-rw2"};if(this.check([48,38,178,117,142,102,207,17,166,217])){let a=!1;try{async function s(){const d=new Uint8Array(16);return await
|
|
82
|
-
`,{offset:2,encoding:a})?{ext:"reg",mime:"application/x-ms-regedit"}:void 0}if(this.checkString("-----BEGIN PGP MESSAGE-----"))return{ext:"pgp",mime:"application/pgp-encrypted"}}),Ic(this,"detectImprecise",async n=>{this.buffer=new Uint8Array(Kn);const a=dk(n.fileInfo.size);if(await n.peekBuffer(this.buffer,{length:Math.min(8,a),mayBeLess:!0}),this.check([0,0,1,186])||this.check([0,0,1,179]))return{ext:"mpg",mime:"video/mpeg"};if(this.check([0,1,0,0,0]))return{ext:"ttf",mime:"font/ttf"};if(this.check([0,0,1,0]))return{ext:"ico",mime:"image/x-icon"};if(this.check([0,0,2,0]))return{ext:"cur",mime:"image/x-icon"};if(await n.peekBuffer(this.buffer,{length:Math.min(2+this.options.mpegOffsetTolerance,a),mayBeLess:!0}),this.buffer.length>=2+this.options.mpegOffsetTolerance)for(let s=0;s<=this.options.mpegOffsetTolerance;++s){const i=this.scanMpeg(s);if(i)return i}});const r=ck(t==null?void 0:t.mpegOffsetTolerance);this.options={...t,mpegOffsetTolerance:r},this.detectors=[...this.options.customDetectors??[],{id:"core",detect:this.detectConfident},{id:"core.imprecise",detect:this.detectImprecise}],this.tokenizerOptions={abortSignal:this.options.signal},this.gzipProbeDepth=0}getTokenizerOptions(){return{...this.tokenizerOptions}}createTokenizerFromWebStream(t){return Kj(gj(t,this.getTokenizerOptions()))}async parseTokenizer(t,r=0){this.detectionReentryCount=r;const n=t.position;for(const a of this.detectors){let s;try{s=await a.detect(t)}catch(i){if(i instanceof Je||i instanceof Yr)return;throw i}if(s)return s;if(n!==t.position)return}}async fromTokenizer(t){try{return await this.parseTokenizer(t)}finally{await t.close()}}async fromBuffer(t){if(!(t instanceof Uint8Array||t instanceof ArrayBuffer))throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof t}\``);const r=t instanceof Uint8Array?t:new Uint8Array(t);if((r==null?void 0:r.length)>1)return this.fromTokenizer(vj(r,this.getTokenizerOptions()))}async fromBlob(t){var r;(r=this.options.signal)==null||r.throwIfAborted();const n=bj(t,this.getTokenizerOptions());return this.fromTokenizer(n)}async fromStream(t){var r;(r=this.options.signal)==null||r.throwIfAborted();const n=this.createTokenizerFromWebStream(t);return this.fromTokenizer(n)}async toDetectionStream(t,r){const n=ik((r==null?void 0:r.sampleSize)??Kn);let a,s;const i=t.getReader({mode:"byob"});try{const{value:d,done:u}=await lk(i,new Uint8Array(n),this.options.signal);if(s=d,!u&&d)try{a=await this.fromBuffer(d.subarray(0,n))}catch(m){if(!(m instanceof Je))throw m;a=void 0}s=d}finally{i.releaseLock()}const l=new TransformStream({async start(d){d.enqueue(s)},transform(d,u){u.enqueue(d)}}),c=t.pipeThrough(l);return c.fileType=a,c}async detectGzip(t){var r;if(this.gzipProbeDepth>=Mj)return{ext:"gz",mime:"application/gzip"};const n=new Aj(t),a=ok(n.inflate(),Lj),s=mt(t);let i,l,c,d;if(s){const u=new AbortController;i=setTimeout(()=>{u.abort(new DOMException(`Operation timed out after ${Uc} ms`,"TimeoutError"))},Uc),l=this.options.signal===void 0?u.signal:AbortSignal.any([this.options.signal,u.signal]),c=new ch({...this.options,signal:l}),c.gzipProbeDepth=this.gzipProbeDepth+1}else this.gzipProbeDepth++;try{d=await(c??this).fromStream(a)}catch(u){if((u==null?void 0:u.name)==="AbortError"&&((r=l==null?void 0:l.reason)==null?void 0:r.name)!=="TimeoutError")throw u}finally{clearTimeout(i),s||this.gzipProbeDepth--}return(d==null?void 0:d.ext)==="tar"?{ext:"tar.gz",mime:"application/gzip"}:{ext:"gz",mime:"application/gzip"}}check(t,r){return ar(this.buffer,t,r)}checkString(t,r){return this.check(Rj(t,r==null?void 0:r.encoding),r)}async readTiffTag(t){const r=await this.tokenizer.readToken(t?fn:Ue);switch(await this.tokenizer.ignore(10),r){case 50341:return{ext:"arw",mime:"image/x-sony-arw"};case 50706:return{ext:"dng",mime:"image/x-adobe-dng"}}}async readTiffIFD(t){const r=await this.tokenizer.readToken(t?fn:Ue);if(!(r>Wj)&&!(mt(this.tokenizer)&&2+r*12>Zc))for(let n=0;n<r;++n){const a=await this.readTiffTag(t);if(a)return a}}async readTiffHeader(t){const r={ext:"tif",mime:"image/tiff"},n=(t?fn:Ue).get(this.buffer,2),a=(t?Oc:Ge).get(this.buffer,4);if(n===42){if(a>=6){if(this.checkString("CR",{offset:8}))return{ext:"cr2",mime:"image/x-canon-cr2"};if(a>=8){const l=(t?fn:Ue).get(this.buffer,8),c=(t?fn:Ue).get(this.buffer,10);if(l===28&&c===254||l===31&&c===11)return{ext:"nef",mime:"image/x-nikon-nef"}}}if(mt(this.tokenizer)&&a>qj)return r;const s=mt(this.tokenizer)?Zc:this.tokenizer.fileInfo.size;try{await Rr(this.tokenizer,a,{maximumLength:s,reason:"TIFF IFD offset"})}catch(l){if(l instanceof Je)return;throw l}let i;try{i=await this.readTiffIFD(t)}catch(l){if(l instanceof Je)return;throw l}return i??r}if(n===43)return r}scanMpeg(t){if(this.check([255,224],{offset:t,mask:[255,224]})){if(this.check([16],{offset:t+1,mask:[22]}))return this.check([8],{offset:t+1,mask:[8]})?{ext:"aac",mime:"audio/aac"}:{ext:"aac",mime:"audio/aac"};if(this.check([2],{offset:t+1,mask:[6]}))return{ext:"mp3",mime:"audio/mpeg"};if(this.check([4],{offset:t+1,mask:[6]}))return{ext:"mp2",mime:"audio/mpeg"};if(this.check([6],{offset:t+1,mask:[6]}))return{ext:"mp1",mime:"audio/mpeg"}}}};new Set(_j);new Set(Oj);const Qc=e=>e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`,xl=({name:e,control:t,disabled:r,campo:n,fileTypes:a,maxFileSize:s})=>{var i;const{field:l,fieldState:c}=$e.useController({name:e,control:t}),{uploadFile:d,deleteUploadedFile:u}=Nr(),[m,p]=N.useState({status:"idle"}),f=N.useRef(null),[b,h]=N.useState(!1),x=N.useRef(!0);N.useEffect(()=>()=>{x.current=!1},[]);const y=typeof l.value=="string"&&l.value?l.value:null,v=N.useCallback(async S=>{var $;if(a&&a.length>0){const k=await sk(S),E=(k==null?void 0:k.ext)??"",D=(k==null?void 0:k.mime)??"",O=(($=S.name.split(".").pop())==null?void 0:$.toLowerCase())??"",L=S.type.toLowerCase();if(!a.some(A=>{const z=A.toLowerCase();return!!(E&&(z===E||z===D)||D&&z.endsWith("/*")&&D.startsWith(z.slice(0,-1))||!E&&(z===O||z===L||z.endsWith("/*")&&L.startsWith(z.slice(0,-1))))})){p({status:"error",message:`Tipo de arquivo não permitido. Permitidos: ${a.join(", ")}`});return}}if(s&&S.size>s){p({status:"error",message:`Arquivo muito grande. Tamanho máximo: ${Qc(s)}`});return}if(!d){p({status:"error",message:"Preview: upload não disponível sem configuração."});return}p({status:"uploading",fileName:S.name,progress:0});try{if(y&&u)try{await u(y)}catch{}const k=await d(S,n??e,E=>{x.current&&p(D=>D.status==="uploading"?{...D,progress:Math.min(100,E)}:D)});if(!x.current)return;l.onChange(k),p({status:"done",uploadId:k,fileName:S.name,size:S.size})}catch{if(!x.current)return;p({status:"error",message:"Falha no upload. Tente novamente."})}},[d,u,y,n,e,l,a,s]),j=N.useCallback(S=>{var $;const k=($=S.target.files)==null?void 0:$[0];k&&v(k),S.target.value=""},[v]),w=N.useCallback(()=>{l.onChange(""),p({status:"idle"}),f.current&&(f.current.value="")},[l]);if(m.status==="done"||m.status==="idle"&&y){const S=m.status==="done"?m.fileName:"Arquivo enviado",$=m.status==="done"?m.size:null;return o.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-input bg-muted/20 px-4 py-3 gap-2",children:[o.jsx("span",{className:"text-sm font-medium truncate flex-1",children:S}),$!==null&&o.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:Qc($)}),!r&&o.jsx("button",{type:"button",onClick:w,className:"ml-2 shrink-0 text-muted-foreground hover:text-destructive transition-colors","aria-label":"Remover arquivo",children:"✕"})]})}if(m.status==="uploading"){const{fileName:S,progress:$}=m;return o.jsxs("div",{className:"rounded-lg border border-input px-4 py-3 space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-sm font-medium truncate flex-1",children:S}),o.jsxs("span",{className:"text-xs text-muted-foreground ml-2",children:[$,"%"]})]}),o.jsx("div",{className:"h-2 rounded-full bg-muted overflow-hidden",children:o.jsx("div",{className:"h-full bg-primary transition-all duration-200 rounded-full",style:{width:`${$}%`}})})]})}const C=m.status==="error";return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{role:"button",tabIndex:r?-1:0,"aria-label":"Selecionar arquivo",className:K("flex items-center justify-center rounded-lg border-2 border-dashed px-4 py-6 transition-colors cursor-pointer",b?"border-primary bg-primary/5":C||c.error?"border-destructive bg-destructive/5":"border-input hover:border-muted-foreground hover:bg-muted/20",r&&"opacity-50 cursor-not-allowed"),onClick:()=>{var S;return!r&&((S=f.current)==null?void 0:S.click())},onKeyDown:S=>{var $;(S.key==="Enter"||S.key===" ")&&(($=f.current)==null||$.click())},onDragOver:S=>{S.preventDefault(),r||h(!0)},onDragLeave:()=>h(!1),onDrop:r?void 0:S=>{var $;S.preventDefault(),h(!1);const k=($=S.dataTransfer.files)==null?void 0:$[0];k&&v(k)},onBlur:l.onBlur,children:[o.jsx("input",{ref:f,type:"file",onChange:j,disabled:r,className:"sr-only"}),o.jsx("span",{className:"text-sm text-muted-foreground",children:b?"Solte o arquivo aqui":"Clique ou arraste um arquivo"})]}),C&&o.jsxs("p",{className:"text-sm text-destructive",children:[m.message," · ",o.jsx("button",{type:"button",className:"underline hover:no-underline",onClick:()=>p({status:"idle"}),children:"Tentar novamente"})]}),!C&&((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})},gk={cpf:e=>e.replace(/\D/g,"").slice(0,11).replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d{1,2})$/,"$1-$2"),telefone:e=>{const t=e.replace(/\D/g,"").slice(0,11);return t.length<=10?t.replace(/(\d{2})(\d)/,"($1) $2").replace(/(\d{4})(\d)/,"$1-$2"):t.replace(/(\d{2})(\d)/,"($1) $2").replace(/(\d{5})(\d)/,"$1-$2")},cep:e=>e.replace(/\D/g,"").slice(0,8).replace(/(\d{5})(\d)/,"$1-$2")},_r=({name:e,control:t,placeholder:r,maskType:n,disabled:a,readOnly:s})=>{var i;const{field:l,fieldState:c}=$e.useController({name:e,control:t}),d=gk[n||""],u=N.useCallback(m=>{l.onChange(d?d(m.target.value):m.target.value)},[l,d]);return o.jsxs("div",{className:"space-y-1",children:[o.jsx(ue,{name:l.name,value:l.value||"",onChange:u,onBlur:l.onBlur,placeholder:r,disabled:a,readOnly:s,className:K(c.error&&"border-destructive focus-visible:ring-destructive")}),((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})},Go=({name:e,control:t})=>{const{field:r}=$e.useController({name:e,control:t});return o.jsx("input",{type:"hidden",...r,value:r.value??""})},dh=e=>e.replace(/\D/g,""),vk=e=>{const t=dh(e).slice(0,8);return t.length<=5?t:`${t.slice(0,5)}-${t.slice(5)}`},bk=async(e,t)=>{const r=await fetch(`https://viacep.com.br/ws/${e}/json/`,{signal:t});if(!r.ok)throw new Error("Falha ao consultar CEP");return r.json()},gl=({name:e,control:t,placeholder:r="00000-000",disabled:n,readOnly:a,cepFillMap:s})=>{var i,l;const{field:c,fieldState:d}=$e.useController({name:e,control:t}),{setValue:u}=$e.useFormContext(),{cepLookup:m}=Nr(),[p,f]=N.useState("idle"),[b,h]=N.useState(null),x=N.useRef(null),y=N.useRef(!0);N.useEffect(()=>()=>{var w;y.current=!1,(w=x.current)==null||w.abort()},[]);const v=N.useCallback(async()=>{var w;c.onBlur();const C=dh(c.value??"");if(C.length===8){(w=x.current)==null||w.abort(),x.current=new AbortController,f("loading"),h(null);try{let S;if(m){const E=x.current;if(S=await m(C,E.signal),E.signal.aborted||!y.current)return}else{const E=await bk(C,x.current.signal);if(!y.current)return;if(E.erro){f("error"),h("CEP não encontrado");return}S={logradouro:E.logradouro,bairro:E.bairro,cidade:E.localidade,estado:E.uf}}if(!y.current)return;if(S.erro){f("error"),h("CEP não encontrado");return}const $=e.includes(".")?`${e.substring(0,e.lastIndexOf("."))}.`:"",k=(E,D,O)=>{if(!O)return;const L=s!=null&&s[E]?`${$}${s[E]}`:`${$}${D}`;u(L,O,{shouldDirty:!0,shouldValidate:!0})};k("logradouro","_address_logradouro",S.logradouro),k("bairro","_address_bairro",S.bairro),k("cidade","_address_cidade",S.cidade),k("estado","_address_estado",S.estado),f("success")}catch(S){if(S instanceof Error&&S.name==="AbortError"||!y.current)return;f("error"),h("Erro ao buscar CEP")}}},[c,m,u,e,s]),j=N.useCallback(w=>{c.onChange(vk(w.target.value))},[c]);return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"relative",children:[o.jsx(ue,{name:c.name,value:c.value||"",onChange:j,onBlur:v,placeholder:r,disabled:n,readOnly:a,className:K("pr-9",d.error&&"border-destructive focus-visible:ring-destructive")}),o.jsxs("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none",children:[p==="loading"&&o.jsx(_.Loader2,{className:"h-4 w-4 animate-spin text-muted-foreground"}),p==="success"&&o.jsx(_.Check,{className:"h-4 w-4 text-green-500"}),p==="error"&&o.jsx(_.AlertCircle,{className:"h-4 w-4 text-destructive"})]})]}),(((i=d.error)==null?void 0:i.message)||b)&&o.jsx("p",{className:"text-sm text-destructive",children:((l=d.error)==null?void 0:l.message)||b})]})},yk=({field:e,control:t,nameOverride:r})=>{const n={name:r,control:t,placeholder:e.placeholder};switch(e.tipo){case T.TEXTO:return o.jsx(Tt,{...n,type:"text"});case T.EMAIL:return o.jsx(Tt,{...n,type:"email"});case T.NUMBER:return o.jsx(Tt,{...n,type:"number"});case T.TEXTAREA:return o.jsx(Uo,{...n});case T.SELECT:return o.jsx(Ho,{...n,options:e.opcoes??[]});case T.RADIO:return o.jsx(ml,{...n,options:e.opcoes??[]});case T.CHECKBOX:return o.jsx(Wo,{name:r,control:t,label:e.label});case T.CHECKBOX_GROUP:return o.jsx(ul,{...n,options:e.opcoes??[]});case T.DATE:return o.jsx(Rn,{...n,validacao:e.validacao});case T.DATETIME:return o.jsx(Rn,{...n,isDatetime:!0,validacao:e.validacao});case T.FILE:return o.jsx(xl,{name:r,control:t});case T.TELEFONE:return o.jsx(_r,{...n,maskType:"telefone"});case T.CPF:return o.jsx(_r,{...n,maskType:"cpf"});case T.CEP:return o.jsx(gl,{name:r,control:t,placeholder:e.placeholder});case T.HIDDEN:return o.jsx(Go,{name:r,control:t});default:return console.error(`[DFFieldArray] Tipo de sub-campo "${e.tipo}" não suportado em FIELD_ARRAY. Usando DFTextField como fallback.`),o.jsx(Tt,{...n,type:"text"})}},uh=({name:e,control:t,subFields:r=[],minItems:n=1,maxItems:a,itemLabel:s="Item",addLabel:i})=>{var l;const{fields:c,append:d,remove:u}=$e.useFieldArray({control:t,name:e}),{errors:m}=$e.useFormState({control:t}),p=(l=m[e])==null?void 0:l.message,f=N.useCallback(()=>{const y={};for(const v of r)v.initialValue!==void 0?y[v.nome]=v.initialValue:v.defaultValue!==void 0&&(y[v.nome]=v.defaultValue);return y},[r]);N.useEffect(()=>{if(c.length<n)for(let y=c.length;y<n;y++)d(f())},[n]);const b=[...r].sort((y,v)=>y.ordem-v.ordem),h=!a||c.length<a,x=i??`Adicionar ${s.toLowerCase()}`;return o.jsxs("div",{className:"space-y-3",children:[c.map((y,v)=>o.jsxs("div",{className:"rounded-lg border border-input p-4",children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-primary/10 text-xs font-bold text-primary shrink-0",children:v+1}),o.jsxs("span",{className:"text-sm font-semibold",children:[s," ",v+1]})]}),c.length>n&&o.jsx(De,{type:"button",variant:"ghost",size:"icon",onClick:()=>u(v),"aria-label":`Remover ${s.toLowerCase()} ${v+1}`,className:"text-muted-foreground hover:text-destructive",children:o.jsx(_.Trash2,{className:"w-4 h-4"})})]}),o.jsx("div",{className:"grid grid-cols-12 gap-4",children:b.map(j=>{const w=`${e}.${v}.${j.nome}`,C=`span ${j.tamanho??12}`,S=o.jsx(yk,{field:j,control:t,nameOverride:w});return j.tipo===T.CHECKBOX||j.tipo===T.HIDDEN?o.jsx("div",{className:"max-sm:!col-span-12",style:{gridColumn:C},children:S},j.id):o.jsxs("div",{className:"max-sm:!col-span-12 space-y-2",style:{gridColumn:C},children:[o.jsxs("label",{className:"font-medium flex items-center gap-1 text-sm text-foreground",children:[j.label,j.obrigatorio&&o.jsx("span",{className:"text-destructive",children:"*"})]}),S,j.hint&&o.jsx("p",{className:"text-xs text-muted-foreground",children:j.hint})]},j.id)})})]},y.id)),h&&o.jsxs(De,{type:"button",variant:"outline",className:"w-full",onClick:()=>d(f()),children:[o.jsx(_.Plus,{className:"w-4 h-4"}),x]}),a&&o.jsxs("p",{className:"text-xs text-center text-muted-foreground",children:["Máximo de ",a," ",s.toLowerCase(),a>1?"s":""]}),p&&o.jsxs("p",{className:"text-sm text-destructive flex items-center gap-1",children:[o.jsx(_.AlertCircle,{className:"w-4 h-4 shrink-0"}),p]})]})},ed=e=>`R$ ${(e/100).toFixed(2).replace(".",",")}`,wk=(e,t)=>{const r=new Date(e.slice(0,10)+"T00:00:00Z"),n=new Date(t.slice(0,10)+"T00:00:00Z");return Math.round((n.getTime()-r.getTime())/864e5)+1},jk=(e,t)=>{const r=[],n=new Date(e.slice(0,10)+"T00:00:00Z"),a=new Date(t.slice(0,10)+"T00:00:00Z");let s=0;for(;n<=a&&s<60;)r.push(n.toISOString().slice(0,10)),n.setUTCDate(n.getUTCDate()+1),s++;return r},kk=e=>{const[t,r,n]=e.split("-").map(Number),a=new Date(Date.UTC(t,r-1,n)),s=String(n).padStart(2,"0"),i=String(r).padStart(2,"0"),l=new Intl.DateTimeFormat("pt-BR",{weekday:"long",timeZone:"UTC"}).format(a),c=l.charAt(0).toUpperCase()+l.slice(1);return`${s}/${i} - ${c}`},Ck=(e,t)=>{const r=n=>{const[a,s,i]=n.slice(0,10).split("-");return`${i}/${s}/${a}`};return`${r(e)} a ${r(t)}`},mh=({name:e,control:t})=>{var r;const{field:n,fieldState:a}=$e.useController({name:e,control:t}),{externalData:s={}}=Nr(),i=n.value??null,l=(r=a.error)==null?void 0:r.message,c=V=>s[`evento.${V}`]??s[V],d=c("dataInicioEvento")??"",u=c("dataFimEvento")??"",m=Number(c("valor")??0),p=Number(c("valorPorDia")??0),f=c("vagasTotal"),b=c("vagasPorDia"),h=c("vagasMasculinas"),x=c("vagasFemininas"),y=f!=null?Number(f):null,v=b!=null?Number(b):null,j=h!=null?Number(h):null,w=x!=null?Number(x):null,C=d&&u?jk(d,u):[],S=(d&&u?wk(d,u):0)>1,$=j!=null&&j>0&&w!=null&&w>0,k=j!=null&&w==null?"masculino":w!=null&&j==null?"feminino":null,E=(i==null?void 0:i.tipo)??null,D=(i==null?void 0:i.data)??null,O=(i==null?void 0:i.genero)??null,L=N.useRef(i);L.current=i;const A=N.useRef(n.onChange);A.current=n.onChange,N.useEffect(()=>{var V,M,P;k&&((V=L.current)==null?void 0:V.genero)!==k&&A.current({tipo:((M=L.current)==null?void 0:M.tipo)??null,data:((P=L.current)==null?void 0:P.data)??null,genero:k})},[k]);const z=V=>{const M={tipo:V,data:null};($||k)&&(M.genero=O??k??void 0),n.onChange(M)},X=V=>{const M={tipo:"por_dia",data:V};($||k)&&(M.genero=O??k??void 0),n.onChange(M)},q=V=>{n.onChange({tipo:E,data:D,genero:V})},Z=V=>E===V;return o.jsxs("div",{className:"space-y-3",children:[$&&o.jsxs("div",{className:"flex items-center gap-2 px-1",children:[o.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:"Você é:"}),o.jsx("div",{className:"flex gap-2",children:["masculino","feminino"].map(V=>o.jsx("button",{type:"button",onClick:()=>q(V),className:K("px-3 py-1 rounded-full text-xs font-medium border transition-all",O===V?"border-primary bg-primary/10 text-primary":"border-input text-muted-foreground hover:border-primary/50"),children:V==="masculino"?"Masculino":"Feminino"},V))})]}),o.jsxs("button",{type:"button",onClick:()=>z("todos_os_dias"),className:K("w-full text-left flex items-start gap-3 p-4 rounded-xl border-2 transition-all",Z("todos_os_dias")?"border-primary bg-primary/5":"border-input hover:border-primary/50"),children:[o.jsx("div",{className:K("mt-0.5 p-2 rounded-lg shrink-0 transition-colors",Z("todos_os_dias")?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"),children:o.jsx(_.CalendarCheck2,{className:"w-4 h-4"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"font-semibold text-sm",children:"Participar todos os dias"}),d&&u?o.jsx("p",{className:"text-xs text-muted-foreground",children:Ck(d,u)}):o.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Datas do evento"})]}),o.jsxs("div",{className:"text-right shrink-0",children:[m>0&&o.jsx("p",{className:K("font-bold text-sm",Z("todos_os_dias")?"text-primary":"text-foreground"),children:ed(m)}),y!=null&&y>0&&o.jsxs("p",{className:"text-xs flex items-center justify-end gap-1 text-muted-foreground",children:[o.jsx(_.Users,{className:"w-3 h-3"}),y," vagas disponíveis"]})]})]}),S?o.jsxs("button",{type:"button",onClick:()=>z("por_dia"),className:K("w-full text-left flex items-start gap-3 p-4 rounded-xl border-2 transition-all",Z("por_dia")?"border-primary bg-primary/5":"border-input hover:border-primary/50"),children:[o.jsx("div",{className:K("mt-0.5 p-2 rounded-lg shrink-0 transition-colors",Z("por_dia")?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"),children:o.jsx(_.CalendarDays,{className:"w-4 h-4"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"font-semibold text-sm",children:"Participar um dia"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Escolha o dia desejado abaixo"})]}),o.jsxs("div",{className:"text-right shrink-0",children:[p>0&&o.jsx("p",{className:K("font-bold text-sm",Z("por_dia")?"text-primary":"text-foreground"),children:ed(p)}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"por dia"})]})]}):d?o.jsxs("div",{className:"flex items-start gap-2 px-3 py-2.5 rounded-lg border border-input bg-muted/30",children:[o.jsx(_.Info,{className:"w-3.5 h-3.5 mt-0.5 shrink-0 text-muted-foreground"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:'Este evento ocorre em apenas 1 dia — a opção "Participar um dia" não é necessária.'})]}):null,E==="por_dia"&&o.jsxs("div",{className:"pl-2 space-y-2",children:[o.jsx("p",{className:"text-xs font-semibold uppercase tracking-wide text-primary",children:"Selecione o dia:"}),C.length===0?o.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Nenhuma data configurada no evento"}):C.map(V=>o.jsxs("button",{type:"button",onClick:()=>X(V),className:K("w-full text-left flex items-center justify-between px-4 py-3 rounded-lg border transition-all",D===V?"border-primary bg-primary/5":"border-input hover:border-primary/50"),children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:K("w-4 h-4 rounded-full border-2 shrink-0 flex items-center justify-center transition-colors",D===V?"border-primary bg-primary":"border-input"),children:D===V&&o.jsx("span",{className:"w-2 h-2 rounded-full bg-white"})}),o.jsx("span",{className:"text-sm",children:kk(V)})]}),v!=null&&o.jsxs("span",{className:"text-xs text-muted-foreground",children:[v," vagas"]})]},V))]}),l&&o.jsx("p",{className:"text-sm text-destructive",children:l})]})},td=.0315,rd=.124,nd=7,ad=12,ph=[{id:"pix",label:"PIX",description:"Transferência instantânea (à vista)",Icon:_.Smartphone,taxa:0},{id:"dinheiro",label:"Dinheiro",description:"Pagamento em espécie",Icon:_.Banknote,taxa:0},{id:"cartao",label:"Cartão de Crédito",description:"Débito ou crédito na maquininha",Icon:_.CreditCard,taxa:td,taxaLabel:`Taxa: ${(td*100).toFixed(2).replace(".",",")}%`}],fh=[{id:"pix",label:"PIX à Vista",description:"Pagamento instantâneo sem parcelamento",Icon:_.Smartphone,taxa:0},{id:"pix_parcelado",label:"PIX Parcelado",description:`Parcelado em até ${nd}x sem juros`,Icon:_.Smartphone,taxa:0,parcelas:nd},{id:"cartao",label:"Cartão de Crédito",description:`Parcelado em até ${ad}x`,Icon:_.CreditCard,taxa:rd,parcelas:ad,taxaLabel:`Taxa: ${(rd*100).toFixed(2).replace(".",",")}%`},{id:"dinheiro",label:"Dinheiro",description:"Pagamento em espécie",Icon:_.Banknote,taxa:0}],Ra=e=>`R$ ${(e/100).toFixed(2).replace(".",",")}`,od=(e,t)=>Math.round(e*(1+t)*100)/100,Nk=(e,t)=>Math.round(e/t*100)/100,hh=({name:e,control:t,relatedFieldName:r="tipo_participacao"})=>{var n;const{field:a,fieldState:s}=$e.useController({name:e,control:t}),{externalData:i={},paymentMethodOptions:l}=Nr(),c=a.value??null,d=(n=s.error)==null?void 0:n.message,u=$e.useWatch({control:t,name:r}),m=(u==null?void 0:u.tipo)??null,p=j=>i[`evento.${j}`]??i[j],f=Number(p("valor")??0),b=Number(p("valorPorDia")??0),h=m==="por_dia"&&b>0?b:f,x=m==="por_dia"?(l==null?void 0:l.porDia)??ph:(l==null?void 0:l.todosOsDias)??fh,y=m==="por_dia"?(()=>{if(!(u!=null&&u.data))return"Um dia";const j=u.data.split("-");if(j.length===3){const[w,C,S]=j;return`${S}/${C}/${w}`}return u.data})():"Todos os dias",v=j=>{if(j.disabled)return;const w=od(h,j.taxa),C={metodo:j.id,valorTotal:w};j.parcelas&&(C.parcelas=j.parcelas),a.onChange(C)};return o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between rounded-xl border border-input px-4 py-3",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"Tipo de participação"}),o.jsx("p",{className:"font-semibold",children:y})]}),o.jsxs("div",{className:"text-right",children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"Valor base"}),o.jsx("p",{className:"text-lg font-bold text-primary",children:Ra(h)})]})]}),o.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-input bg-muted/30 px-3 py-2.5",children:[o.jsx(_.Info,{className:"h-4 w-4 mt-0.5 shrink-0 text-muted-foreground"}),o.jsxs("p",{className:"text-xs",children:[o.jsx("span",{className:"font-bold",children:"Importante:"})," Para validar a inscrição e garantir sua vaga, o pagamento deve ser realizado no ato da inscrição."]})]}),o.jsx("p",{className:"text-sm font-semibold text-primary",children:"Selecione a forma de pagamento:"}),o.jsx("div",{className:"space-y-3",children:x.map(j=>{const{Icon:w}=j,C=(c==null?void 0:c.metodo)===j.id,S=od(h,j.taxa),$=!!j.parcelas&&j.parcelas>1,k=$?Nk(S,j.parcelas):null;return o.jsxs("button",{type:"button",disabled:j.disabled,onClick:()=>v(j),className:K("w-full text-left flex items-center gap-4 px-4 py-3 rounded-xl border-2 transition-all",C?"border-primary bg-primary/5":"border-input hover:border-primary/50",j.disabled&&"opacity-50 cursor-not-allowed"),children:[o.jsx("div",{className:K("flex items-center justify-center w-10 h-10 rounded-lg shrink-0 transition-colors",C?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"),children:o.jsx(w,{className:"h-5 w-5"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"font-semibold text-sm leading-tight",children:j.label}),o.jsx("p",{className:"text-xs text-muted-foreground",children:j.description}),j.taxaLabel&&o.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:["* ",j.taxaLabel]}),j.taxa>0&&o.jsxs("p",{className:"text-xs text-muted-foreground",children:["Total com taxa: ",Ra(S)]})]}),o.jsx("div",{className:"text-right shrink-0",children:$?o.jsxs(o.Fragment,{children:[o.jsxs("p",{className:"text-xs text-muted-foreground",children:[j.parcelas,"x de"]}),o.jsx("p",{className:"text-base font-bold text-primary",children:Ra(k)})]}):o.jsx("p",{className:"text-base font-bold text-primary",children:Ra(S)})})]},j.id)})}),d&&o.jsx("p",{className:"text-xs text-destructive",children:d})]})},xh=({name:e,control:t,label:r,termoTexto:n,termoPdfUrl:a,termoPdfUploadId:s})=>{var i;const{field:l,fieldState:c}=$e.useController({name:e,control:t}),{resolveTermsUploadUrl:d}=Nr(),u=!!c.error,m=(i=c.error)==null?void 0:i.message,[p,f]=N.useState(null),[b,h]=N.useState(!1),[x,y]=N.useState(!1),v=N.useRef(null);N.useEffect(()=>{var $;x&&(($=v.current)==null||$.focus())},[x]),N.useEffect(()=>{if(!s||!d){f(null);return}let $=!1;return h(!0),d(s).then(k=>{$||f(k)}).catch(()=>{$||f(null)}).finally(()=>{$||h(!1)}),()=>{$=!0}},[s,d]);const j=l.value==="accepted",w=p||a||null,C=!!(n||w||s),S=!!w;return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:K("rounded-lg border p-4 space-y-4 transition-colors",u?"border-destructive bg-destructive/5":j?"border-green-500 bg-green-500/5":"border-input"),children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(_.ScrollText,{className:"h-4 w-4 shrink-0"}),o.jsx("span",{className:"text-sm font-medium",children:r||"Termos e condições"})]}),C?o.jsxs(De,{type:"button",variant:"outline",size:"sm",className:"h-7 px-2 text-xs",disabled:b,onClick:()=>y(!0),children:[b?o.jsx(_.Loader2,{className:"h-3 w-3 animate-spin"}):o.jsx(_.ExternalLink,{className:"h-3 w-3"}),"Ler termos"]}):o.jsx("span",{className:"text-xs text-muted-foreground italic",children:s&&b?"Carregando PDF...":"Conteúdo não configurado"})]}),o.jsxs("label",{className:"flex items-start gap-3 cursor-pointer select-none",children:[o.jsx(et,{className:"mt-0.5",checked:j,onCheckedChange:$=>l.onChange($?"accepted":"")}),o.jsxs("span",{className:"text-sm leading-snug flex-1",children:["Li e aceito ",r?`"${r}"`:"os termos e condições"]}),j&&o.jsx(_.CheckCircle2,{className:"h-4 w-4 text-green-500 shrink-0 mt-0.5"})]})]}),u&&o.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-destructive",children:[o.jsx(_.AlertCircle,{className:"h-3.5 w-3.5 shrink-0"}),m||"Você precisa aceitar os termos para continuar"]}),x&&o.jsx("div",{ref:v,role:"dialog","aria-modal":"true","aria-label":"Termos e condições",tabIndex:-1,className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/60 outline-none",onClick:()=>y(!1),onKeyDown:$=>{$.key==="Escape"&&y(!1)},children:o.jsxs("div",{className:"relative w-full max-w-2xl max-h-[90vh] rounded-xl overflow-hidden flex flex-col bg-background shadow-xl",onClick:$=>$.stopPropagation(),children:[o.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-input",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(_.ScrollText,{className:"h-4 w-4"}),o.jsx("span",{className:"font-semibold",children:"Termos e condições"})]}),o.jsx(De,{type:"button",variant:"ghost",size:"icon",onClick:()=>y(!1),children:o.jsx(_.X,{className:"h-4 w-4"})})]}),o.jsx("div",{className:"flex-1 overflow-auto p-4",children:S?o.jsx("iframe",{src:w,className:"w-full rounded border",style:{height:"62vh"},title:"Termos e condições",sandbox:"allow-scripts"}):o.jsx("p",{className:"text-sm whitespace-pre-wrap leading-relaxed",children:n})})]})})]})},Sk=({name:e,control:t,placeholder:r,disabled:n,readOnly:a})=>{var s;const{field:i,fieldState:l}=$e.useController({name:e,control:t}),[c,d]=N.useState(!1),u=!!l.error;return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"relative",children:[o.jsx(ue,{...i,value:i.value??"",type:c?"text":"password",placeholder:r,disabled:n,readOnly:a,className:K("pr-10",u&&"border-destructive focus-visible:ring-destructive")}),o.jsx("button",{type:"button",tabIndex:-1,onClick:()=>d(m=>!m),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors","aria-label":c?"Ocultar senha":"Mostrar senha",children:c?o.jsx(_.EyeOff,{size:16}):o.jsx(_.Eye,{size:16})})]}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},gh=({name:e,control:t,label:r,disabled:n,readOnly:a})=>{var s;const{field:i,fieldState:l}=$e.useController({name:e,control:t}),c=!!i.value;return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("label",{className:"flex items-center gap-3 cursor-pointer select-none",children:[o.jsx(Oi,{checked:c,onCheckedChange:d=>!a&&i.onChange(d),disabled:n||a,onBlur:i.onBlur}),o.jsx("span",{className:"text-sm leading-none",children:r})]}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},$k=({name:e,control:t,minValue:r=0,maxValue:n=100,step:a=1,disabled:s,readOnly:i})=>{var l;const{field:c,fieldState:d}=$e.useController({name:e,control:t}),u=c.value??r;return N.useEffect(()=>{(c.value===void 0||c.value===null)&&c.onChange(r)},[]),o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(Ao,{min:r,max:n,step:a,value:[u],onValueChange:m=>!i&&c.onChange(m[0]),disabled:s||i,className:"flex-1"}),o.jsx("span",{className:"text-sm font-medium text-primary min-w-[3rem] text-right tabular-nums",children:u})]}),o.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[o.jsx("span",{children:r}),o.jsx("span",{children:n})]}),((l=d.error)==null?void 0:l.message)&&o.jsx("p",{className:"text-sm text-destructive",children:d.error.message})]})},js=e=>/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(e),Ek=({name:e,control:t,disabled:r,readOnly:n})=>{var a;const{field:s,fieldState:i}=$e.useController({name:e,control:t}),l=s.value||"#000000",[c,d]=N.useState(l);return N.useEffect(()=>{d(l)},[l]),o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("input",{type:"color",value:js(l)?l:"#000000",disabled:r||n,onChange:u=>s.onChange(u.target.value),className:"h-10 w-14 cursor-pointer rounded-lg border border-input bg-transparent p-1 disabled:cursor-not-allowed disabled:opacity-50"}),o.jsx(ue,{type:"text",value:c,readOnly:n,disabled:r,onChange:u=>{const m=u.target.value;d(m),js(m)&&s.onChange(m.toUpperCase())},onBlur:()=>{js(c)||d(l),s.onBlur()},className:K("flex-1 font-mono uppercase",i.error&&"border-destructive focus-visible:ring-destructive"),maxLength:7,placeholder:"#000000"})]}),((a=i.error)==null?void 0:a.message)&&o.jsx("p",{className:"text-sm text-destructive",children:i.error.message})]})},Dk=({name:e,control:t,options:r,placeholder:n,disabled:a,readOnly:s})=>{var i,l;const{field:c,fieldState:d}=$e.useController({name:e,control:t}),[u,m]=N.useState(""),[p,f]=N.useState(!1),[b,h]=N.useState(-1),x=N.useRef(null),y=N.useRef(null),v=`autocomplete-${e}-listbox`,j=((i=r.find(D=>D.valor===c.value))==null?void 0:i.label)??"",w=u.length>0?r.filter(D=>D.label.toLowerCase().includes(u.toLowerCase())):r;N.useEffect(()=>{const D=O=>{x.current&&!x.current.contains(O.target)&&(f(!1),m(""),h(-1))};return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[]);const C=()=>{f(!1),m(""),h(-1)};N.useEffect(()=>{if(b<0||!y.current)return;const D=y.current.querySelector(`[id="${v}-option-${b}"]`);D==null||D.scrollIntoView({block:"nearest"})},[b,v]);const S=D=>{D.disabled||(c.onChange(D.valor),C())},$=()=>{c.onChange(""),m(""),h(-1)},k=D=>{if(!p){(D.key==="ArrowDown"||D.key==="ArrowUp")&&(D.preventDefault(),f(!0),h(0));return}switch(D.key){case"ArrowDown":D.preventDefault(),h(O=>O<w.length-1?O+1:O);break;case"ArrowUp":D.preventDefault(),h(O=>O>0?O-1:0);break;case"Enter":D.preventDefault(),b>=0&&w[b]&&!w[b].disabled&&S(w[b]);break;case"Escape":D.preventDefault(),C();break;case"Tab":C();break}},E=p&&b>=0?`${v}-option-${b}`:void 0;return o.jsxs("div",{className:"space-y-1",ref:x,children:[o.jsxs("div",{className:"relative",children:[o.jsx(ue,{type:"text",role:"combobox","aria-expanded":p,"aria-haspopup":"listbox","aria-autocomplete":"list","aria-controls":v,"aria-activedescendant":E,value:p?u:j,placeholder:n??"Buscar...",disabled:a,readOnly:s,onChange:D=>{m(D.target.value),h(-1),f(!0)},onFocus:()=>!s&&f(!0),onKeyDown:k,className:K("pr-8",d.error&&"border-destructive focus-visible:ring-destructive"),autoComplete:"off"}),o.jsx("div",{className:"absolute right-2 top-1/2 -translate-y-1/2 flex items-center gap-1",children:c.value?o.jsx("button",{type:"button",onClick:$,className:"text-[var(--t-text-muted)] hover:text-[var(--t-text)]",tabIndex:-1,"aria-label":"Limpar seleção",children:o.jsx(_.X,{size:14})}):o.jsx(_.ChevronDown,{size:16,className:"text-muted-foreground pointer-events-none","aria-hidden":"true"})}),p&&!a&&!s&&o.jsx("ul",{role:"listbox",id:v,ref:y,"aria-label":"Opções disponíveis",className:"absolute z-50 mt-1 max-h-60 w-full overflow-auto rounded-lg border border-input bg-popover shadow-lg",children:w.length===0?o.jsx("li",{role:"option","aria-selected":!1,className:"px-3 py-2 text-sm text-muted-foreground",children:"Nenhuma opção encontrada"}):w.map((D,O)=>o.jsx("li",{id:`${v}-option-${O}`,role:"option","aria-selected":c.value===D.valor,"aria-disabled":D.disabled,onMouseDown:()=>S(D),className:["flex cursor-pointer items-center px-3 py-2 text-sm",D.disabled?"cursor-not-allowed opacity-40":O===b?"bg-accent":"hover:bg-accent",c.value===D.valor?"font-medium text-primary":"text-foreground"].join(" "),children:D.label},D.valor))})]}),((l=d.error)==null?void 0:l.message)&&o.jsx("p",{className:"text-sm text-destructive",role:"alert",children:d.error.message})]})},vh=({name:e,control:t,placeholder:r,disabled:n,readOnly:a})=>{var s;const{field:i,fieldState:l}=$e.useController({name:e,control:t}),c=!!l.error;return o.jsxs("div",{className:"space-y-1",children:[o.jsx(ue,{...i,value:i.value??"",type:"time",placeholder:r,disabled:n,readOnly:a,className:K(c&&"border-destructive focus-visible:ring-destructive")}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},Tk=({name:e,control:t,startLabel:r="Data inicial",endLabel:n="Data final",disabled:a,readOnly:s})=>{var i;const{field:l,fieldState:c}=$e.useController({name:e,control:t}),d=l.value??{},u=(p,f)=>{l.onChange({...d,[p]:f})},m=!!c.error;return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{children:r}),o.jsx(ue,{type:"date",value:d.start??"",disabled:a,readOnly:s,onChange:p=>u("start",p.target.value),max:d.end??void 0,className:K(m&&"border-destructive focus-visible:ring-destructive")})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{children:n}),o.jsx(ue,{type:"date",value:d.end??"",disabled:a,readOnly:s,onChange:p=>u("end",p.target.value),min:d.start??void 0,className:K(m&&"border-destructive focus-visible:ring-destructive")})]})]}),((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})},Ak=({name:e,control:t,maxRating:r=5,disabled:n,readOnly:a})=>{var s;const{field:i,fieldState:l}=$e.useController({name:e,control:t}),c=i.value??0,d=Array.from({length:r},(u,m)=>m+1);return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-1",children:[d.map(u=>o.jsx("button",{type:"button",disabled:n||a,onClick:()=>i.onChange(u===c?0:u),className:"transition-transform hover:scale-110 disabled:cursor-not-allowed disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded","aria-label":`${u} estrela${u>1?"s":""}`,children:o.jsx(_.Star,{size:24,className:"transition-colors",fill:u<=c?"var(--color-primary)":"transparent",stroke:u<=c?"var(--color-primary)":"currentColor"})},u)),c>0&&o.jsxs("span",{className:"ml-2 text-sm text-muted-foreground",children:[c,"/",r]})]}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},Rk=({field:e,name:t,control:r,disabled:n,readOnly:a})=>{const s=n||e.isDisabled,i=a||e.isReadOnly;switch(e.tipo){case T.EMAIL:return o.jsx(Tt,{name:t,control:r,type:"email",placeholder:e.placeholder,disabled:s,readOnly:i});case T.NUMBER:return o.jsx(Tt,{name:t,control:r,type:"number",placeholder:e.placeholder,disabled:s,readOnly:i});case T.PASSWORD:return o.jsx(Tt,{name:t,control:r,type:"password",placeholder:e.placeholder,disabled:s,readOnly:i});case T.TELEFONE:return o.jsx(_r,{name:t,control:r,maskType:"telefone",placeholder:e.placeholder??"(00) 00000-0000",disabled:s,readOnly:i});case T.CPF:return o.jsx(_r,{name:t,control:r,maskType:"cpf",placeholder:e.placeholder??"000.000.000-00",disabled:s,readOnly:i});case T.CEP:return o.jsx(_r,{name:t,control:r,maskType:"cep",placeholder:e.placeholder??"00000-000",disabled:s,readOnly:i});case T.TEXTAREA:return o.jsx(Uo,{name:t,control:r,placeholder:e.placeholder,disabled:s,readOnly:i});case T.SELECT:return o.jsx(Ho,{name:t,control:r,options:e.opcoes??[],placeholder:e.placeholder,disabled:s,readOnly:i});case T.CHECKBOX:return o.jsx(Wo,{name:t,control:r,label:e.label??"",disabled:s,readOnly:i});case T.SWITCH:return o.jsx(gh,{name:t,control:r,label:e.label??"",disabled:s,readOnly:i});case T.DATE:return o.jsx(Rn,{name:t,control:r,disabled:s,readOnly:i});case T.TIME:return o.jsx(vh,{name:t,control:r,disabled:s,readOnly:i});case T.HIDDEN:return o.jsx(Go,{name:t,control:r});default:return o.jsx(Tt,{name:t,control:r,type:"text",placeholder:e.placeholder,disabled:s,readOnly:i})}},Ik=({name:e,control:t,subSchema:r,disabled:n,readOnly:a})=>{if(!r||r.fields.length===0)return null;const s=[...r.fields].sort((i,l)=>i.ordem-l.ordem);return o.jsxs("div",{className:"rounded-xl border border-input bg-muted/30 p-4 space-y-4",children:[r.titulo&&o.jsx("h4",{className:"text-sm font-semibold text-muted-foreground",children:r.titulo}),o.jsx("div",{className:"grid grid-cols-12 gap-4",children:s.map(i=>{const l=`${e}.${i.nome}`,c=i.tipo===T.CHECKBOX||i.tipo===T.SWITCH||i.tipo===T.HIDDEN,d=i.tamanho??6;return o.jsxs("div",{className:`col-span-${d}`,children:[!c&&o.jsxs("label",{className:"mb-1 block text-sm font-medium text-foreground",children:[i.label,i.obrigatorio&&o.jsx("span",{className:"text-destructive",children:" *"})]}),o.jsx(Rk,{field:i,name:l,control:t,disabled:n,readOnly:a})]},i.id)})})]})},bh=({field:e,control:t,nameOverride:r})=>{var n,a;const s=r??e.nome,{componentMapper:i}=Nr(),l=i==null?void 0:i[e.tipo];if(l)return o.jsx(l,{name:s,control:t,field:e});const c={name:s,control:t,placeholder:e.placeholder,disabled:e.isDisabled,readOnly:e.isReadOnly};switch(e.tipo){case T.TEXTO:return o.jsx(Tt,{...c,type:"text"});case T.EMAIL:return o.jsx(Tt,{...c,type:"email"});case T.NUMBER:return o.jsx(Tt,{...c,type:"number"});case T.PASSWORD:return o.jsx(Sk,{...c});case T.TEXTAREA:return o.jsx(Uo,{...c});case T.SELECT:return o.jsx(Ho,{...c,options:e.opcoes??[]});case T.AUTOCOMPLETE:return o.jsx(Dk,{...c,options:e.opcoes??[]});case T.SWITCH:return o.jsx(gh,{name:s,control:t,label:e.label,disabled:e.isDisabled,readOnly:e.isReadOnly});case T.SLIDER:return o.jsx($k,{name:s,control:t,minValue:e.minValue,maxValue:e.maxValue,step:e.step,disabled:e.isDisabled,readOnly:e.isReadOnly});case T.RATING:return o.jsx(Ak,{name:s,control:t,maxRating:e.maxRating,disabled:e.isDisabled,readOnly:e.isReadOnly});case T.COLOR:return o.jsx(Ek,{name:s,control:t,disabled:e.isDisabled,readOnly:e.isReadOnly});case T.TIME:return o.jsx(vh,{...c});case T.DATE_RANGE:return o.jsx(Tk,{name:s,control:t,startLabel:e.dateRangeStartLabel,endLabel:e.dateRangeEndLabel,disabled:e.isDisabled,readOnly:e.isReadOnly});case T.RADIO:return o.jsx(ml,{...c,options:e.opcoes??[]});case T.CHECKBOX:return o.jsx(Wo,{name:s,control:t,label:e.label,disabled:e.isDisabled,readOnly:e.isReadOnly});case T.CHECKBOX_GROUP:return o.jsx(ul,{...c,options:e.opcoes??[]});case T.DATE:return o.jsx(Rn,{name:s,control:t,disabled:e.isDisabled,readOnly:e.isReadOnly,validacao:e.validacao});case T.DATETIME:return o.jsx(Rn,{name:s,control:t,isDatetime:!0,disabled:e.isDisabled,readOnly:e.isReadOnly,validacao:e.validacao});case T.FILE:return o.jsx(xl,{name:s,control:t,disabled:e.isDisabled,fileTypes:(n=e.validacao)==null?void 0:n.fileTypes,maxFileSize:(a=e.validacao)==null?void 0:a.maxFileSize});case T.TELEFONE:return o.jsx(_r,{...c,maskType:"telefone"});case T.CPF:return o.jsx(_r,{...c,maskType:"cpf"});case T.CEP:return o.jsx(gl,{name:s,control:t,placeholder:e.placeholder,disabled:e.isDisabled,readOnly:e.isReadOnly,cepFillMap:e.cepFillMap});case T.HIDDEN:return o.jsx(Go,{name:s,control:t});case T.PARTICIPATION_TYPE:return o.jsx(mh,{name:s,control:t});case T.PAYMENT_METHOD:return o.jsx(hh,{name:s,control:t,relatedFieldName:e.relatedFieldName});case T.TERMS:return o.jsx(xh,{name:s,control:t,label:e.label,termoTexto:e.termoTexto,termoPdfUrl:e.termoPdfUrl,termoPdfUploadId:e.termoPdfUploadId});case T.FIELD_ARRAY:return o.jsx(uh,{name:s,control:t,subFields:e.subFields,minItems:e.minItems,maxItems:e.maxItems,itemLabel:e.itemLabel,addLabel:e.addLabel});case T.SUB_FORM:return o.jsx(Ik,{name:s,control:t,subSchema:e.subSchema,disabled:e.isDisabled,readOnly:e.isReadOnly});default:return o.jsx(Tt,{...c,type:"text"})}},Pk=({container:e,control:t})=>{var r;const{externalData:n={},fieldResolvers:a}=Nr(),s=e.icone?Pt[e.icone]:void 0,i=n,l=N.useMemo(()=>Bo(e,i),[e,JSON.stringify(i)]),c=N.useMemo(()=>[...l.campos].sort((x,y)=>x.ordem-y.ordem),[l.campos]),d=$e.useWatch({control:t}),{wrapperClass:u,wrapperStyle:m,headerClass:p,headerStyle:f,tmpl:b}=nh(),h=x=>{if(!at(x.condicional,d,n))return null;let y=x;if(x.resolvePropsKey&&a!=null&&a[x.resolvePropsKey]){const S=a[x.resolvePropsKey](x,d,n);y={...x,...S}}if(y.opcoesFromVar){const S=n[y.opcoesFromVar];Array.isArray(S)&&(y={...y,opcoes:S.map($=>typeof $=="string"?{valor:$,label:$}:$&&typeof $=="object"&&"valor"in $&&"label"in $?$:{valor:String($),label:String($)})})}const v=y.tamanho??12,j=y.inicioColuna,w=j?`${j} / span ${v}`:`span ${v}`,C=o.jsx(bh,{field:y,control:t});return y.tipo===T.CHECKBOX||y.tipo===T.HIDDEN||y.tipo===T.SWITCH?o.jsx("div",{className:"max-sm:!col-span-12",style:{gridColumn:w},children:C},y.id):o.jsxs("div",{className:"max-sm:!col-span-12 space-y-2",style:{gridColumn:w},children:[o.jsxs("label",{className:"font-medium flex items-center gap-1",style:{color:"var(--t-text)"},children:[y.label,y.obrigatorio&&o.jsx("span",{className:"text-destructive",children:"*"})]}),C,y.hint&&o.jsx("p",{className:"text-xs text-muted-foreground",children:y.hint})]},y.id)};return o.jsxs("div",{className:u,style:m,children:[(l.titulo||s)&&o.jsx("div",{className:p,style:f,children:o.jsxs("div",{className:"flex items-center gap-3",children:[s&&o.jsx("div",{className:"p-2 rounded-xl",style:{background:"color-mix(in srgb, var(--t-primary) 12%, transparent)"},children:o.jsx(s,{className:"w-5 h-5",style:{color:"var(--t-primary)"}})}),o.jsxs("div",{children:[o.jsx("h3",{className:((r=b.typography)==null?void 0:r.stepTitleClass)??"text-lg font-semibold",style:{color:"var(--t-text)"},children:l.titulo}),l.descricao&&o.jsx("p",{className:"text-sm",style:{color:"var(--t-text-muted)"},children:l.descricao})]})]})}),o.jsx("div",{className:"p-6 grid grid-cols-12 gap-4",children:c.map(h)})]})},_k=({container:e,control:t})=>{var r;const{externalData:n={}}=Nr(),a=e.nome??"__invalid__",s=e.minItems??1,i=e.maxItems,l=e.itemLabel??"Item",c=e.icone?Pt[e.icone]:void 0,d=n,u=N.useMemo(()=>Bo(e,d),[e,JSON.stringify(d)]),m=N.useMemo(()=>[...u.campos].sort((k,E)=>k.ordem-E.ordem),[u.campos]),p=N.useCallback(()=>{const k={};for(const E of m)E.initialValue!==void 0?k[E.nome]=typeof E.initialValue=="string"?xt(E.initialValue,d):E.initialValue:E.defaultValue!==void 0&&(k[E.nome]=E.defaultValue);return k},[m,d]),{fields:f,append:b,remove:h}=$e.useFieldArray({control:t,name:a});N.useEffect(()=>{if(e.nome&&f.length<s)for(let k=f.length;k<s;k++)b(p())},[s]);const x=$e.useWatch({control:t}),y=N.useMemo(()=>{const k=x[a];return Array.isArray(k)?k:[]},[x,a]),{wrapperClass:v,wrapperStyle:j,headerClass:w,headerStyle:C,tmpl:S}=nh();if(!e.nome)return console.error("[RepeatableContainerRenderer] container.nome é obrigatório para containers repetíveis. Container id:",e.id),null;const $=(k,E)=>{const D=y[E]??{};if(!at(k.condicional,D,n))return null;const O=`${a}.${E}.${k.nome}`,L=k.tamanho??12,A=k.inicioColuna,z=A?`${A} / span ${L}`:`span ${L}`,X=o.jsx(bh,{field:k,control:t,nameOverride:O});return k.tipo===T.CHECKBOX||k.tipo===T.HIDDEN?o.jsx("div",{className:"max-sm:!col-span-12",style:{gridColumn:z},children:X},`${k.id}-${E}`):o.jsxs("div",{className:"max-sm:!col-span-12 space-y-2",style:{gridColumn:z},children:[o.jsxs("label",{className:"font-medium flex items-center gap-1",style:{color:"var(--t-text)"},children:[k.label,k.obrigatorio&&o.jsx("span",{className:"text-destructive",children:"*"})]}),X,k.hint&&o.jsx("p",{className:"text-xs text-muted-foreground",children:k.hint})]},`${k.id}-${E}`)};return o.jsxs("div",{className:v,style:j,children:[(u.titulo||c)&&o.jsx("div",{className:w,style:C,children:o.jsxs("div",{className:"flex items-center gap-3",children:[c&&o.jsx("div",{className:"p-2 rounded-xl",style:{background:"color-mix(in srgb, var(--t-primary) 12%, transparent)"},children:o.jsx(c,{className:"w-5 h-5",style:{color:"var(--t-primary)"}})}),o.jsxs("div",{children:[o.jsx("h3",{className:((r=S.typography)==null?void 0:r.stepTitleClass)??"text-lg font-semibold",style:{color:"var(--t-text)"},children:u.titulo}),u.descricao&&o.jsx("p",{className:"text-sm",style:{color:"var(--t-text-muted)"},children:u.descricao})]})]})}),o.jsxs("div",{className:"p-6 space-y-4",children:[f.map((k,E)=>o.jsxs("div",{className:"border border-input rounded-lg p-4 bg-muted/30",children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs font-bold shrink-0 bg-primary text-primary-foreground",children:E+1}),o.jsxs("span",{className:"text-sm font-semibold",children:[l," ",E+1]})]}),f.length>s&&o.jsx("button",{type:"button",onClick:()=>h(E),className:"inline-flex items-center justify-center rounded-md p-1.5 text-destructive hover:bg-destructive/10 transition-colors","aria-label":"Remover item",children:o.jsx(_.Trash2,{className:"w-4 h-4"})})]}),o.jsx("div",{className:"grid grid-cols-12 gap-4",children:m.map(D=>$(D,E))})]},k.id)),(!i||f.length<i)&&o.jsxs("button",{type:"button",className:"w-full flex items-center justify-center gap-2 py-2 px-4 border border-input rounded-lg text-sm hover:bg-accent transition-colors",onClick:()=>b(p()),children:[o.jsx(_.Plus,{className:"w-4 h-4"}),"Adicionar ",l.toLowerCase()]}),i&&o.jsxs("p",{className:"text-xs text-center text-muted-foreground",children:["Máximo de ",i," ",l.toLowerCase(),i>1?"s":""]})]})]})},yh=e=>e.container.repeatable&&e.container.nome?o.jsx(_k,{...e}):o.jsx(Pk,{...e}),wh=({step:e,control:t,externalData:r={}})=>{const n=N.useMemo(()=>[...e.containers].sort((s,i)=>s.ordem-i.ordem),[e.containers]),a=$e.useWatch({control:t});return o.jsx("div",{className:"grid grid-cols-12 gap-4",children:n.map(s=>{if(s.condicional&&!at(s.condicional,a,r))return null;const i=s.tamanho??12,l=s.inicioColuna,c=l?`${l} / span ${i}`:`span ${i}`;return o.jsx("div",{className:"max-sm:!col-span-12",style:{gridColumn:c},children:o.jsx(yh,{container:s,control:t})},s.id)})})},xa=N.createContext({submitting:!1,warnings:{},requestSubmit:()=>{}}),Ok=xa.Provider,Fk=()=>{const e=kh("useFormApi"),t=N.useContext(xa);return{change:(r,n)=>e.setValue(r,n,{shouldValidate:!0,shouldDirty:!0}),reset:r=>e.reset(r),submit:t.requestSubmit,getState:()=>{const{errors:r,isDirty:n,isValid:a}=e.formState;return{values:e.getValues(),errors:Object.fromEntries(Object.entries(r).map(([s,i])=>[s,i==null?void 0:i.message])),warnings:t.warnings,dirty:n,valid:a,submitting:t.submitting}}}},jh=()=>{const e=kh("useFormState"),t=N.useContext(xa),r=$e.useWatch({control:e.control}),{errors:n,isDirty:a,isValid:s}=e.formState;return{values:r,errors:Object.fromEntries(Object.entries(n).map(([i,l])=>[i,l==null?void 0:l.message])),warnings:t.warnings,dirty:a,valid:s,submitting:t.submitting}},zk=e=>{var t;const r=$e.useFormContext(),{warnings:n}=N.useContext(xa),a=$e.useWatch({control:r.control,name:e}),s=r.getFieldState(e,r.formState);return{value:a,error:(t=s.error)==null?void 0:t.message,warning:n[e],dirty:s.isDirty,touched:s.isTouched,valid:!s.error}},Lk=e=>{var t;const{control:r}=$e.useFormContext(),{warnings:n}=N.useContext(xa),{field:a,fieldState:s}=$e.useController({name:e,control:r});return{input:{name:a.name,value:a.value,onChange:a.onChange,onBlur:a.onBlur,ref:a.ref},meta:{error:(t=s.error)==null?void 0:t.message,warning:n[e],touched:s.isTouched,dirty:s.isDirty,valid:!s.error}}},kh=e=>{const t=$e.useFormContext();if(!t)throw new Error(`[SchemaForms] O hook '${e}' foi chamado fora de um <FormRenderer />. Certifique-se de que o componente está dentro da árvore de renderização do formulário.`);return t},sd=({stepIndex:e,totalSteps:t,step:r,defaultValues:n,externalData:a,fieldErrors:s,isSubmitting:i,submitError:l,validatorMapper:c={},onWarningsChange:d,onValuesChange:u,onSubmit:m,onBack:p})=>{const f=e===t-1,b=N.useMemo(()=>JSON.stringify(a),[a]),h=N.useMemo(()=>Qf(r,a,c),[r.id,b]),x=N.useMemo(()=>eh(r,a,c),[r.id,b]),[y,v]=N.useState({}),j=N.useRef(d);j.current=d;const w=a,C=N.useMemo(()=>rh(r,w),[r,b]),S=$e.useForm({resolver:h,defaultValues:n,mode:"onTouched"}),{control:$,handleSubmit:k,setError:E,clearErrors:D,setValue:O}=S;N.useEffect(()=>{D();for(const[U,Q]of Object.entries(s))E(U,{type:"server",message:Q})},[s,E,D]);const L=N.useMemo(()=>r.containers.filter(U=>!U.repeatable).flatMap(U=>U.campos).filter(U=>!!U.condicional),[r.containers]),A=N.useMemo(()=>r.containers.filter(U=>!!U.condicional),[r.containers]),z=N.useMemo(()=>r.containers.filter(U=>!U.repeatable).flatMap(U=>U.campos).filter(U=>{var Q;return U.condicional&&((Q=U.setValues)==null?void 0:Q.length)}),[r.containers]),X=N.useMemo(()=>r.containers.filter(U=>U.repeatable&&!!U.nome).map(U=>({container:U,fields:U.campos.filter(Q=>!!Q.condicional)})).filter(U=>U.fields.length>0),[r.containers]),q=N.useRef({}),Z=N.useRef(!0),V=$e.useWatch({control:$}),M=N.useRef(u);M.current=u,N.useEffect(()=>{var U;(U=M.current)==null||U.call(M,V)},[V]),N.useEffect(()=>{let U=!1;return x(V).then(Q=>{var Y;U||(v(Q),(Y=j.current)==null||Y.call(j,Q))}).catch(Q=>{U||console.error("[StepForm] warnComputer error:",Q)}),()=>{U=!0}},[V,x]),N.useEffect(()=>{var U;if(!L.length&&!z.length&&!A.length&&!X.length)return;const Q=V;for(const H of L)if(!at(H.condicional,Q,a)){if(D(H.nome),H.tipo===T.FIELD_ARRAY){const W=Q[H.nome];Array.isArray(W)&&W.forEach((G,ne)=>{(H.subFields??[]).forEach(J=>D(`${H.nome}.${ne}.${J.nome}`))})}if(H.clearedValue!==void 0){const W=H.clearedValue??"";Q[H.nome]!==W&&O(H.nome,W,{shouldValidate:!1})}}for(const H of A)if(!at(H.condicional,Q,a))if(H.repeatable&&H.nome)(Array.isArray(Q[H.nome])?Q[H.nome]:[]).forEach((W,G)=>{for(const ne of H.campos)D(`${H.nome}.${G}.${ne.nome}`)});else for(const W of H.campos){D(W.nome);const G=W.clearedValue!==void 0?W.clearedValue:void 0;G!==void 0&&Q[W.nome]!==G&&O(W.nome,G,{shouldValidate:!1})}for(const{container:H,fields:W}of X){const G=H.nome,ne=Array.isArray(Q[G])?Q[G]:[];for(let J=0;J<ne.length;J++){const te=ne[J];for(const ce of W)if(!at(ce.condicional,te,a)&&(D(`${G}.${J}.${ce.nome}`),ce.clearedValue!==void 0)){const be=ce.clearedValue??"";te[ce.nome]!==be&&O(`${G}.${J}.${ce.nome}`,be,{shouldValidate:!1})}}}const Y=Z.current;for(const H of z){const W=at(H.condicional,Q,a),G=Y?W:q.current[H.nome]??!1;if(W&&!G&&(U=H.setValues)!=null&&U.length)for(const ne of H.setValues){const J=typeof ne.valor=="string"?xt(ne.valor,w):ne.valor;O(ne.campo,J,{shouldValidate:!1})}q.current[H.nome]=W}Z.current=!1},[V,L,z,A,X,a,O,D]);const P=C.icone?Pt[C.icone]:void 0,se=N.useMemo(()=>()=>{S.handleSubmit(m)()},[m]);return o.jsx($e.FormProvider,{...S,children:o.jsx(Ok,{value:{submitting:i,warnings:y,requestSubmit:se},children:o.jsx("form",{onSubmit:k(m),noValidate:!0,onKeyDown:U=>{U.key==="Enter"&&U.target.tagName==="INPUT"&&U.preventDefault()},children:o.jsxs("div",{className:"space-y-6",children:[C.showLabel!==!1&&o.jsxs("div",{className:"text-center space-y-2",children:[P&&o.jsx("div",{className:"w-12 h-12 mx-auto rounded-xl flex items-center justify-center",style:{background:"color-mix(in srgb, var(--t-primary) 12%, transparent)"},children:o.jsx(P,{className:"w-6 h-6",style:{color:"var(--t-primary)"}})}),o.jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--t-text)"},children:C.titulo}),C.descricao&&o.jsx("p",{className:"text-sm text-muted-foreground",children:C.descricao})]}),o.jsx(wh,{step:C,control:$,externalData:a}),o.jsxs("div",{className:"flex items-center justify-between gap-4 pt-6 pb-2",children:[o.jsxs(De,{type:"button",variant:"outline",onClick:p,disabled:e===0,className:K(e>0&&"border-primary/40 text-primary hover:bg-primary/5"),children:[o.jsx(_.ChevronLeft,{className:"w-4 h-4"}),o.jsx("span",{className:"hidden sm:inline",children:"Anterior"})]}),o.jsxs("span",{className:"text-xs font-semibold tabular-nums sm:hidden text-muted-foreground",children:[e+1,"/",t]}),o.jsxs(De,{type:"submit",disabled:i,children:[i?o.jsx(_.Loader2,{className:"w-4 h-4 animate-spin"}):f?o.jsx(_.Check,{className:"w-4 h-4"}):o.jsx(_.ChevronRight,{className:"w-4 h-4"}),o.jsx("span",{className:"hidden sm:inline",children:f?"Finalizar":"Próximo"})]})]}),l&&o.jsx("p",{className:"text-sm text-destructive mt-2 text-center",children:l})]})})})})},eo=e=>{if(e)return Pt[e]},Mk=({steps:e,currentStep:t,onStepClick:r})=>o.jsx("div",{className:"flex items-center justify-center gap-2 flex-wrap",children:e.map((n,a)=>o.jsx("div",{role:r?"button":void 0,tabIndex:r?0:void 0,onClick:()=>r==null?void 0:r(a),onKeyDown:s=>s.key==="Enter"&&(r==null?void 0:r(a)),className:K("w-8 h-8 rounded-full flex items-center justify-center text-xs font-bold transition-all shrink-0",r&&"cursor-pointer hover:opacity-80"),style:a===t?{background:"var(--t-primary)",color:"#ffffff",boxShadow:"0 0 0 3px color-mix(in srgb, var(--t-primary) 30%, transparent)"}:a<t?{background:"#22c55e",color:"#ffffff"}:{background:"hsl(var(--muted))",color:"hsl(var(--muted-foreground))"},children:a<t?o.jsx(_.Check,{className:"w-4 h-4"}):a+1},n.id))}),Vk=({steps:e,currentStep:t,onStepClick:r})=>o.jsx("div",{className:"flex items-center justify-center gap-2 flex-wrap",children:e.map((n,a)=>{const s=eo(n.icone)??_.CircleDot;return o.jsx("div",{role:r?"button":void 0,tabIndex:r?0:void 0,onClick:()=>r==null?void 0:r(a),onKeyDown:i=>i.key==="Enter"&&(r==null?void 0:r(a)),className:K("w-9 h-9 rounded-full flex items-center justify-center transition-all shrink-0",r&&"cursor-pointer hover:opacity-80"),style:a===t?{background:"var(--t-primary)",color:"#ffffff",boxShadow:"0 0 0 3px color-mix(in srgb, var(--t-primary) 30%, transparent)"}:a<t?{background:"#22c55e",color:"#ffffff"}:{background:"hsl(var(--muted))",color:"hsl(var(--muted-foreground))"},children:a<t?o.jsx(_.Check,{className:"w-4 h-4"}):o.jsx(s,{className:"w-4 h-4"})},n.id)})}),Bk=({steps:e,currentStep:t,position:r,orientation:n="horizontal",onStepClick:a})=>n==="vertical"?o.jsx("div",{className:"flex flex-col gap-0",children:e.map((s,i)=>{const l=eo(s.icone)??_.CircleDot,c=i===t,d=i<t,u=i===e.length-1;return o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsxs("div",{className:"flex flex-col items-center",children:[o.jsx("button",{type:"button",onClick:()=>a==null?void 0:a(i),className:K("w-8 h-8 rounded-full flex items-center justify-center transition-all shrink-0",a&&"cursor-pointer hover:opacity-80"),style:c?{background:"var(--t-primary)",color:"#fff",boxShadow:"0 0 10px color-mix(in srgb, var(--t-primary) 50%, transparent)"}:d?{background:"#22c55e",color:"#fff"}:{background:"color-mix(in srgb, var(--t-text) 8%, transparent)",color:"var(--t-text-muted)",border:"1.5px solid color-mix(in srgb, var(--t-border) 60%, transparent)"},children:d?o.jsx(_.Check,{className:"w-3.5 h-3.5"}):o.jsx(l,{className:"w-3.5 h-3.5"})}),!u&&o.jsx("div",{className:"w-[2px] my-1",style:{height:"24px",background:d?"#22c55e":"color-mix(in srgb, var(--t-border) 50%, transparent)"}})]}),o.jsx("span",{className:"text-sm font-medium leading-tight mt-1.5",style:c?{color:"var(--t-primary)"}:d?{color:"#16a34a"}:{color:"var(--t-text-muted)"},children:s.label??s.id})]},s.id)})}):o.jsx("div",{className:"w-full flex items-start",children:e.map((s,i)=>{const l=eo(s.icone)??_.CircleDot,c=i===t,d=i<t,u=i===e.length-1;return o.jsxs("div",{className:K("flex items-start",!u&&"flex-1"),children:[o.jsxs("div",{className:"flex flex-col items-center gap-1.5 w-[56px] shrink-0 mx-auto",children:[o.jsx("button",{type:"button",onClick:()=>a==null?void 0:a(i),className:K("w-10 h-10 rounded-full flex items-center justify-center transition-all shrink-0",a&&"cursor-pointer hover:opacity-80"),style:c?{background:"var(--t-primary)",color:"#ffffff",boxShadow:"0 0 12px color-mix(in srgb, var(--t-primary) 50%, transparent)"}:d?{background:"#22c55e",color:"#ffffff"}:{background:"color-mix(in srgb, var(--t-text) 8%, transparent)",color:"var(--t-text-muted)",border:"1.5px solid color-mix(in srgb, var(--t-border) 60%, transparent)"},children:d?o.jsx(_.Check,{className:"w-4 h-4"}):o.jsx(l,{className:"w-4 h-4"})}),o.jsx("span",{className:"text-[10px] font-medium text-center leading-tight line-clamp-2 px-0.5",style:c?{color:"var(--t-primary)"}:d?{color:"#16a34a"}:{color:"var(--t-text-muted)"},children:s.label??s.id})]}),!u&&o.jsx("div",{className:"flex-1 h-[1.5px] mt-5 mx-1",style:{background:d?"linear-gradient(90deg, var(--t-primary), color-mix(in srgb, var(--t-primary) 40%, transparent))":"color-mix(in srgb, var(--t-border) 50%, transparent)"}})]},s.id)})}),Ch=({steps:e,currentStep:t,onStepClick:r,className:n,forceShow:a})=>{const s=sa(),{layout:i}=s;if(!i.showStepIndicators||e.length<=1&&!a)return null;const l=i.stepIndicatorVariant??"numbers",c=i.stepIndicatorPosition??"top-center",d=i.stepIndicatorOrientation??"horizontal",u=(t+1)/e.length*100,m=e[t],p=eo(m==null?void 0:m.icone)??_.CircleDot,f=o.jsx("div",{className:"h-1 rounded-full overflow-hidden",style:{background:"color-mix(in srgb, var(--t-primary) 15%, transparent)"},children:o.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${u}%`,background:"linear-gradient(90deg, var(--t-primary), var(--t-accent))"}})}),b=o.jsxs("div",{className:"block sm:hidden space-y-2",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"w-10 h-10 rounded-full flex items-center justify-center shrink-0",style:{background:"var(--t-primary)",color:"#fff"},children:o.jsx(p,{className:"w-5 h-5"})}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("p",{className:"text-sm font-semibold leading-tight truncate",style:{color:"var(--t-text)"},children:(m==null?void 0:m.label)??(m==null?void 0:m.id)}),o.jsxs("p",{className:"text-xs leading-tight",style:{color:"var(--t-text-muted)"},children:["Passo ",t+1," de ",e.length]})]})]}),f]}),h=o.jsxs("div",{className:"hidden sm:block",children:[l==="numbers"&&o.jsx(Mk,{steps:e,currentStep:t,onStepClick:r}),l==="icons"&&o.jsx(Vk,{steps:e,currentStep:t,onStepClick:r}),l==="icons-labeled"&&o.jsx(Bk,{steps:e,currentStep:t,position:c,orientation:d,onStepClick:r})]}),x=i.showProgressBar?o.jsx("div",{className:"hidden sm:block",children:f}):null;return d==="vertical"?o.jsxs("div",{className:K("flex gap-6 items-start",n),children:[b,o.jsxs("div",{className:"hidden sm:flex gap-6 items-start shrink-0",children:[h,x&&o.jsx("div",{className:"flex-1 pt-4",children:x})]})]}):o.jsxs("div",{className:K("space-y-3",n),children:[b,o.jsxs("div",{className:"hidden sm:block space-y-3",children:[h,x]})]})},Uk=(e,t,r)=>{var n;const a={...t},s=r;for(const i of e.containers){for(const l of i.campos)if(a[l.nome]===void 0&&(l.initialValue!==void 0?a[l.nome]=typeof l.initialValue=="string"?xt(l.initialValue,s):l.initialValue:l.defaultValue!==void 0&&(a[l.nome]=l.defaultValue)),l.tipo===T.FIELD_ARRAY&&(n=l.subFields)!=null&&n.length){const c=a[l.nome];Array.isArray(c)&&c.length>0&&(a[l.nome]=c.map(d=>{const u={...d};for(const m of l.subFields)u[m.nome]===void 0&&(m.initialValue!==void 0?u[m.nome]=typeof m.initialValue=="string"?xt(m.initialValue,s):m.initialValue:m.defaultValue!==void 0&&(u[m.nome]=m.defaultValue));return u}))}if(i.repeatable&&i.nome){const l=a[i.nome];Array.isArray(l)&&l.length>0&&(a[i.nome]=l.map(c=>{const d={...c};for(const u of i.campos)d[u.nome]===void 0&&(u.initialValue!==void 0?d[u.nome]=typeof u.initialValue=="string"?xt(u.initialValue,s):u.initialValue:u.defaultValue!==void 0&&(d[u.nome]=u.defaultValue));return d}))}}return a},Hk=({schema:e,initialValues:t={},initialStep:r=0,onSubmitStep:n,onComplete:a,template:s,formTitle:i,externalData:l={},fieldErrors:c={},uploadFile:d,deleteUploadedFile:u,cepLookup:m,resolveTermsUploadUrl:p,fieldResolvers:f,validatorMapper:b,componentMapper:h,paymentMethodOptions:x,onValuesChange:y,className:v,StepIndicator:j=Ch})=>{const[w,C]=N.useState(()=>r),[S,$]=N.useState({...t}),[k,E]=N.useState(()=>r),[D,O]=N.useState(!1),[L,A]=N.useState(null),[z,X]=N.useState({}),q=N.useRef(p);q.current=p;const Z=N.useCallback(me=>q.current(me),[]),V=!!p,M=N.useRef(u);M.current=u;const P=N.useCallback(me=>M.current(me),[]),se=!!u,U=N.useMemo(()=>JSON.stringify(l),[l]),Q=N.useMemo(()=>JSON.stringify(e.stepConfig),[e.stepConfig]),Y=N.useMemo(()=>{const me=uo(s);return e.stepConfig?{...me,layout:{...me.layout,...e.stepConfig}}:me},[s,Q]),H=N.useMemo(()=>[...e.steps].sort((me,Ee)=>me.ordem-Ee.ordem),[e.steps]),W=H.length,G=W>0?H[Math.min(w,W-1)]:null,ne=N.useMemo(()=>G?Uk(G,S,l):{},[G,S,U]),J=N.useMemo(()=>({uploadFile:d,deleteUploadedFile:se?P:void 0,cepLookup:m,resolveTermsUploadUrl:V?Z:void 0,externalData:l,fieldResolvers:f,validatorMapper:b,fieldWarnings:z,componentMapper:h,paymentMethodOptions:x}),[d,se,P,m,Z,V,f,b,z,h,x,U]),te=N.useCallback(async me=>{if(!D){O(!0),A(null);try{const Ee={...S,...me};if($(Ee),n&&await n(w,me),w===W-1)a&&await a(Ee);else{const Fe=w+1;C(Fe),E(Nt=>Math.max(Nt,Fe))}}catch(Ee){console.error("[FormRenderer] Submit error:",Ee);const Fe=Ee instanceof Error?Ee.message:"Ocorreu um erro. Tente novamente.";A(Fe)}finally{O(!1)}}},[w,S,D,W,n,a]),ce=N.useCallback(()=>{w>0&&C(me=>me-1)},[w]);if(!G)return o.jsx(Ja.Provider,{value:J,children:o.jsx(ea,{config:Y,className:`min-h-dvh ${Y.wrapperClass??""} ${v??""}`,renderWrapper:!0,children:o.jsx("div",{className:"w-full max-w-4xl mx-auto px-4 py-6 sm:px-6 text-center text-muted-foreground",children:"Nenhum step configurado."})})});const be=Y.layout.eventTitleStyle??"bar",Ce=(Y.layout.stepIndicatorOrientation??"horizontal")==="vertical",ve=W>=1?o.jsx(j,{steps:H.map(me=>({id:me.id,label:me.titulo,icone:me.icone})),currentStep:w,onStepClick:me=>{me!==w&&me<=k&&C(me)}}):null;return o.jsx(Ja.Provider,{value:J,children:o.jsx(ea,{config:Y,className:`min-h-dvh ${Y.wrapperClass??""} ${v??""}`,renderWrapper:!0,children:o.jsxs("div",{className:"w-full max-w-4xl mx-auto px-4 py-6 sm:px-6",children:[i&&be==="bar"&&o.jsx("div",{className:"w-full text-center text-sm font-medium py-2.5 px-4 mb-6 rounded-lg border border-input text-muted-foreground bg-muted/30",children:i}),i&&be==="inline"&&o.jsxs("div",{className:"text-center mb-6",children:[o.jsx("p",{className:"text-xs font-semibold uppercase tracking-widest mb-1",style:{color:"var(--t-text-muted)"},children:"Inscrição"}),o.jsx("h1",{className:"text-2xl font-bold",style:{color:"var(--t-text)"},children:i}),o.jsx("div",{className:"h-0.5 w-12 mx-auto mt-3 rounded-full",style:{background:"var(--t-primary)"}})]}),Ce?o.jsxs("div",{className:"flex gap-6 items-start",children:[o.jsx("div",{className:"hidden sm:block shrink-0 w-44 pt-1",children:ve}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"sm:hidden mb-6",children:ve}),o.jsx(sd,{stepIndex:w,totalSteps:W,step:G,defaultValues:ne,externalData:l,fieldErrors:c,isSubmitting:D,submitError:L,validatorMapper:b,onWarningsChange:X,onValuesChange:y,onSubmit:te,onBack:ce},w)]})]}):o.jsxs(o.Fragment,{children:[ve&&o.jsx("div",{className:"mb-8",children:ve}),o.jsx(sd,{stepIndex:w,totalSteps:W,step:G,defaultValues:ne,externalData:l,fieldErrors:c,isSubmitting:D,submitError:L,validatorMapper:b,onWarningsChange:X,onValuesChange:y,onSubmit:te,onBack:ce},w)]})]})})})},Wk=({children:e,render:t,onChange:r})=>{const n=jh(),a=N.useRef(r);return a.current=r,N.useEffect(()=>{var s;(s=a.current)==null||s.call(a,n)},[n.values,n.dirty,n.valid,n.submitting,n.errors,n.warnings]),t?o.jsx(o.Fragment,{children:t(n)}):typeof e=="function"?o.jsx(o.Fragment,{children:e(n)}):e!==void 0?o.jsx(o.Fragment,{children:e}):null},Or=[{component:"texto",label:"Texto",icon:_.Type,group:"texto"},{component:"textarea",label:"Área de texto",icon:_.AlignLeft,group:"texto"},{component:"number",label:"Número",icon:_.Hash,group:"texto"},{component:"email",label:"E-mail",icon:_.Mail,group:"texto"},{component:"password",label:"Senha",icon:_.Lock,group:"texto"},{component:"select",label:"Seleção",icon:_.ChevronDown,group:"selecao"},{component:"autocomplete",label:"Autocomplete",icon:_.Search,group:"selecao"},{component:"radio",label:"Radio",icon:_.CircleDot,group:"selecao"},{component:"checkbox",label:"Checkbox",icon:_.CheckSquare,group:"selecao"},{component:"checkbox_group",label:"Grupo de checkboxes",icon:_.ListChecks,group:"selecao"},{component:"switch",label:"Switch (toggle)",icon:_.ToggleLeft,group:"selecao"},{component:"slider",label:"Slider",icon:_.SlidersHorizontal,group:"range"},{component:"rating",label:"Avaliação (estrelas)",icon:_.Star,group:"range"},{component:"color",label:"Cor",icon:_.Palette,group:"range"},{component:"date",label:"Data",icon:_.Calendar,group:"data"},{component:"datetime",label:"Data e hora",icon:_.Clock,group:"data"},{component:"time",label:"Horário",icon:_.Timer,group:"data"},{component:"date_range",label:"Período",icon:_.CalendarRange,group:"data"},{component:"telefone",label:"Telefone",icon:_.Phone,group:"contato"},{component:"cpf",label:"CPF",icon:_.CreditCard,group:"contato"},{component:"cep",label:"CEP",icon:_.MapPin,group:"contato"},{component:"file",label:"Arquivo",icon:_.Upload,group:"outros"},{component:"hidden",label:"Oculto",icon:_.EyeOff,group:"outros"},{component:"field_array",label:"Lista de itens",icon:_.List,group:"outros"},{component:"terms",label:"Termos e condições",icon:_.ScrollText,group:"outros"},{component:"sub_form",label:"Sub-formulário",icon:_.LayoutList,group:"outros"}],vl=[{component:"step",label:"Step",icon:_.Layers,color:"border-primary/40 bg-primary/5"},{component:"container",label:"Container",icon:_.BoxSelect,color:"border-blue-500/40 bg-blue-500/5"}],bl=[{key:"evento.nome",label:"Nome do evento",type:"string"},{key:"evento.descricao",label:"Descrição",type:"string"},{key:"evento.valor",label:"Valor (centavos)",type:"number"},{key:"evento.valorPorDia",label:"Valor por dia",type:"number"},{key:"evento.vagasTotal",label:"Vagas totais",type:"number"},{key:"evento.vagasPorDia",label:"Vagas por dia",type:"number"},{key:"evento.vagasMasculinas",label:"Vagas masculinas",type:"number"},{key:"evento.vagasFemininas",label:"Vagas femininas",type:"number"},{key:"evento.dataInicioEvento",label:"Data início",type:"date"},{key:"evento.dataFimEvento",label:"Data fim",type:"date"},{key:"evento.dataAberturaInscricoes",label:"Abertura inscrições",type:"date"},{key:"evento.localNome",label:"Local - Nome",type:"string"},{key:"evento.localEndereco",label:"Local - Endereço",type:"string"},{key:"evento.localTelefone",label:"Local - Telefone",type:"string"},{key:"evento.localMapUrl",label:"Local - URL do mapa",type:"string"},{key:"evento.localMapLink",label:"Local - Link do mapa",type:"string"},{key:"evento.status",label:"Status do evento",type:"string"},{key:"evento.publicId",label:"ID público (URL)",type:"string"},{key:"evento.fotoCapa",label:"URL da foto de capa",type:"string"},{key:"evento.template",label:"Template visual",type:"string"}],He=e=>e.startsWith("step-")||e==="step"?"step":e.startsWith("container-")||e==="container"?"container":"field",qk=e=>Or.find(t=>t.component===e),Nh=e=>{const t=Or.map(n=>n.component).filter(n=>n.includes("_"));for(const n of t)if(e.startsWith(n))return Or.find(a=>a.component===n);const r=e.split("-")[0];return Or.find(n=>n.component===r)},ks=e=>({when:e.campoId,operator:e.operador,value:e.valor,source:e.source}),Sh=e=>{var t;const r={campoId:e.when,operador:e.operator,valor:e.value,source:e.source};if(e.logicOperator&&(t=e.extraConditions)!=null&&t.length){const n=e.extraConditions.map(s=>({campoId:s.when,operador:s.operator,valor:s.value,source:s.source})),a=[r,...n];return e.logicOperator==="or"?{or:a}:{and:a}}return r},$h=e=>{if("campoId"in e)return ks(e);const t=("and"in e?e.and:e.or)??[];if(t.length===0)return;const r="and"in e?"and":"or",[n,...a]=t;if(!("campoId"in n)){console.warn("[formSchemaToBuilder] Condicional com grupo aninhado detectada — não suportado no editor visual. A condicional será removida.",e);return}const s=ks(n);return a.length===0?s:{...s,logicOperator:r,extraConditions:a.filter(i=>"campoId"in i).map(ks)}},to=(e,t)=>{var r;if("campoId"in e){const n=(r=t[e.campoId])==null?void 0:r.name;return n?{...e,campoId:n}:e}return"and"in e&&Array.isArray(e.and)?{and:e.and.map(n=>to(n,t))}:"or"in e&&Array.isArray(e.or)?{or:e.or.map(n=>to(n,t))}:e},yl=(e,t,r)=>{var n,a;const s=l=>t[l]||{label:l,name:l},i=(((a=(n=e==null?void 0:e.containers)==null?void 0:n.root)==null?void 0:a.children)||[]).filter(l=>He(l)==="step").map((l,c)=>{var d,u;const m=s(l),p=(((u=(d=e==null?void 0:e.containers)==null?void 0:d[l])==null?void 0:u.children)||[]).filter(f=>He(f)==="container").map((f,b)=>{var h,x;const y=s(f),v=(((x=(h=e==null?void 0:e.containers)==null?void 0:h[f])==null?void 0:x.children)||[]).filter(w=>He(w)==="field").map((w,C)=>{var S,$;const k=s(w),E=li(k,w,C);if(E.condicional&&(E.condicional=to(E.condicional,t)),E.tipo===T.FIELD_ARRAY){const D=(($=(S=e==null?void 0:e.containers)==null?void 0:S[w])==null?void 0:$.children)??[];E.subFields=D.filter(O=>He(O)==="field").map((O,L)=>li(s(O),O,L))}return E}),j={id:f,titulo:y.label||"Container",descricao:y.description,icone:y.icone,ordem:b,colunas:y.columns||2,tamanho:y.tamanho||12,inicioColuna:y.inicioColuna,showLabel:y.showLabel,showAsCard:y.showAsCard,campos:v};return y.condition&&(j.condicional=to(Sh(y.condition),t)),j});return{id:l,titulo:m.label||"Step",descricao:m.description,icone:m.icone,ordem:c,showLabel:m.showLabel,containers:p}});return{id:r.id||"",nome:r.nome,descricao:r.descricao,status:r.status,template:r.template??null,stepConfig:r.stepConfig&&Object.keys(r.stepConfig).length>0?r.stepConfig:void 0,steps:i}},li=(e,t,r)=>{var n,a,s,i;const l={id:t,nome:e.name||t,label:e.label||"",tipo:e.fieldType||"texto",obrigatorio:e.required||!1,tamanho:e.tamanho||6,inicioColuna:e.inicioColuna,ordem:r,placeholder:e.placeholder,hint:e.hint,defaultValue:e.defaultValue,mascara:e.mascara,mascaraCustom:e.mascaraCustom,locked:e.locked||void 0,visualStyle:e.visualStyle,isReadOnly:e.isReadOnly||void 0,isDisabled:e.isDisabled||void 0,clearedValue:e.clearedValue!==void 0?e.clearedValue:void 0,initialValue:e.initialValue!==void 0?e.initialValue:void 0,resolvePropsKey:e.resolvePropsKey||void 0};if((n=e.validate)!=null&&n.length&&(l.validate=e.validate),(a=e.warn)!=null&&a.length&&(l.warn=e.warn),(s=e.options)!=null&&s.length&&(l.opcoes=e.options.map(c=>({valor:c.value,label:c.label,disabled:c.disabled}))),e.validation){const c=e.validation;l.validacao={},c.minLength!==void 0&&(l.validacao.minLength=c.minLength),c.maxLength!==void 0&&(l.validacao.maxLength=c.maxLength),c.min!==void 0&&(l.validacao.min=c.min),c.max!==void 0&&(l.validacao.max=c.max),c.regex&&(l.validacao.regex=c.regex),c.regexMessage&&(l.validacao.regexMessage=c.regexMessage),c.minDate&&(l.validacao.minDate=c.minDate),c.maxDate&&(l.validacao.maxDate=c.maxDate),c.minAge!==void 0&&(l.validacao.minAge=c.minAge),c.maxAge!==void 0&&(l.validacao.maxAge=c.maxAge),(i=c.fileTypes)!=null&&i.length&&(l.validacao.fileTypes=c.fileTypes),c.maxFileSize!==void 0&&(l.validacao.maxFileSize=c.maxFileSize)}if(l.tipo===T.FIELD_ARRAY&&(e.itemLabel&&(l.itemLabel=e.itemLabel),e.minItems!==void 0&&(l.minItems=e.minItems),e.maxItems!==void 0&&(l.maxItems=e.maxItems),e.addLabel&&(l.addLabel=e.addLabel)),l.tipo===T.TERMS&&(e.termoTexto&&(l.termoTexto=e.termoTexto),e.termoPdfUrl&&(l.termoPdfUrl=e.termoPdfUrl),e.termoPdfUploadId&&(l.termoPdfUploadId=e.termoPdfUploadId)),l.tipo===T.SLIDER&&(e.step!==void 0&&(l.step=e.step),e.minValue!==void 0&&(l.minValue=e.minValue),e.maxValue!==void 0&&(l.maxValue=e.maxValue)),l.tipo===T.RATING&&e.maxRating!==void 0&&(l.maxRating=e.maxRating),l.tipo===T.DATE_RANGE&&(e.dateRangeStartLabel&&(l.dateRangeStartLabel=e.dateRangeStartLabel),e.dateRangeEndLabel&&(l.dateRangeEndLabel=e.dateRangeEndLabel)),l.tipo===T.SUB_FORM){const c=e.subSchemaFields??[];(c.length>0||e.subSchemaTitle)&&(l.subSchema={titulo:e.subSchemaTitle,fields:c.map((d,u)=>li(d,d.name??`subfield-${u}`,u))})}return e.condition&&(l.condicional=Sh(e.condition)),l},Eh=e=>{const t={},r={root:{children:[]}},n=[...e.steps].sort((a,s)=>a.ordem-s.ordem);for(const a of n){const s=a.id||`step-${St()}`;r.root.children.push(s),t[s]={label:a.titulo,name:s,fieldType:"step",description:a.descricao,icone:a.icone,showLabel:a.showLabel};const i=[],l=[...a.containers].sort((c,d)=>c.ordem-d.ordem);for(const c of l){const d=c.id||`container-${St()}`;i.push(d);const u=c.condicional?$h(c.condicional):void 0;t[d]={label:c.titulo,name:d,fieldType:"container",description:c.descricao,icone:c.icone,columns:c.colunas,tamanho:c.tamanho||12,inicioColuna:c.inicioColuna,showLabel:c.showLabel,showAsCard:c.showAsCard,...u?{condition:u}:{}};const m=[],p=[...c.campos].sort((f,b)=>f.ordem-b.ordem);for(const f of p){const b=f.id||`${f.tipo}-${St()}`;if(m.push(b),t[b]=ci(f),f.tipo===T.FIELD_ARRAY){const h=[];for(const x of f.subFields??[]){const y=x.id||`${x.tipo}-${St()}`;h.push(y),t[y]=ci(x)}r[b]={children:h}}}r[d]={children:m}}r[s]={children:i}}return{dndState:{containers:r},configs:t,templateId:e.template??null,stepConfig:e.stepConfig}},ci=(e,t)=>{var r,n,a,s;const i={label:e.label,name:e.nome,fieldType:e.tipo,required:e.obrigatorio,tamanho:e.tamanho,inicioColuna:e.inicioColuna,placeholder:e.placeholder,hint:e.hint,defaultValue:e.defaultValue,mascara:e.mascara,mascaraCustom:e.mascaraCustom,locked:e.locked||void 0,visualStyle:e.visualStyle,isReadOnly:e.isReadOnly||void 0,isDisabled:e.isDisabled||void 0,clearedValue:e.clearedValue!==void 0?String(e.clearedValue??""):void 0,initialValue:e.initialValue!==void 0?String(e.initialValue):void 0,resolvePropsKey:e.resolvePropsKey||void 0,validate:(r=e.validate)!=null&&r.length?e.validate:void 0,warn:(n=e.warn)!=null&&n.length?e.warn:void 0};if((a=e.opcoes)!=null&&a.length&&(i.options=e.opcoes.map(l=>({value:l.valor,label:l.label,disabled:l.disabled}))),e.validacao){const l=e.validacao;i.validation={},l.minLength!==void 0&&(i.validation.minLength=l.minLength),l.maxLength!==void 0&&(i.validation.maxLength=l.maxLength),l.min!==void 0&&(i.validation.min=l.min),l.max!==void 0&&(i.validation.max=l.max),l.regex&&(i.validation.regex=l.regex),l.regexMessage&&(i.validation.regexMessage=l.regexMessage),l.minDate&&(i.validation.minDate=l.minDate),l.maxDate&&(i.validation.maxDate=l.maxDate),l.minAge!==void 0&&(i.validation.minAge=l.minAge),l.maxAge!==void 0&&(i.validation.maxAge=l.maxAge),(s=l.fileTypes)!=null&&s.length&&(i.validation.fileTypes=l.fileTypes),l.maxFileSize!==void 0&&(i.validation.maxFileSize=l.maxFileSize)}if(e.tipo===T.FIELD_ARRAY&&(e.itemLabel&&(i.itemLabel=e.itemLabel),e.minItems!==void 0&&(i.minItems=e.minItems),e.maxItems!==void 0&&(i.maxItems=e.maxItems),e.addLabel&&(i.addLabel=e.addLabel)),e.tipo===T.TERMS&&(e.termoTexto&&(i.termoTexto=e.termoTexto),e.termoPdfUrl&&(i.termoPdfUrl=e.termoPdfUrl),e.termoPdfUploadId&&(i.termoPdfUploadId=e.termoPdfUploadId)),e.tipo===T.SLIDER&&(e.step!==void 0&&(i.step=e.step),e.minValue!==void 0&&(i.minValue=e.minValue),e.maxValue!==void 0&&(i.maxValue=e.maxValue)),e.tipo===T.RATING&&e.maxRating!==void 0&&(i.maxRating=e.maxRating),e.tipo===T.DATE_RANGE&&(e.dateRangeStartLabel&&(i.dateRangeStartLabel=e.dateRangeStartLabel),e.dateRangeEndLabel&&(i.dateRangeEndLabel=e.dateRangeEndLabel)),e.tipo===T.SUB_FORM&&e.subSchema&&(i.subSchemaTitle=e.subSchema.titulo,i.subSchemaFields=e.subSchema.fields.map(l=>ci(l,l.id))),e.condicional){const l=$h(e.condicional);l&&(i.condition=l)}return i},Dh=(e,t)=>{var r,n,a,s,i,l,c,d,u,m,p;const f=[],b=[],h=v=>t[v]||{label:v,name:v},x=((n=(r=e==null?void 0:e.containers)==null?void 0:r.root)==null?void 0:n.children)||[],y=new Set;for(const v of x){if(He(v)!=="step")continue;const j=h(v).label||v,w=((s=(a=e==null?void 0:e.containers)==null?void 0:a[v])==null?void 0:s.children)||[];if(w.length===0){b.push(`Step "${j}" está vazio (sem containers).`);continue}for(const C of w){if(He(C)!=="container")continue;const S=h(C).label||C,$=((l=(i=e==null?void 0:e.containers)==null?void 0:i[C])==null?void 0:l.children)||[],k=new Map;for(const E of $){if(He(E)!=="field")continue;y.add(E);const D=h(E).name;(!D||!D.trim())&&f.push(`Campo "${h(E).label||E}" (${E}) no container "${S}" não tem nome definido.`);const O=D||E;k.has(O)||k.set(O,[]),k.get(O).push(E)}for(const[E,D]of k.entries())D.length>1&&f.push(`Nome duplicado "${E}" no container "${S}" (IDs: ${D.join(", ")}).`)}}for(const[v,j]of Object.entries(t)){if(!((c=j.condition)!=null&&c.when))continue;const w=j.condition.when;if(!y.has(w)){const C=j.label||v;b.push(`Campo "${C}" referencia campo inexistente na condição (when: "${w}").`)}}for(const v of x){if(He(v)!=="step")continue;const j=h(v).label||v,w=((u=(d=e==null?void 0:e.containers)==null?void 0:d[v])==null?void 0:u.children)||[],C=new Map;for(const S of w){if(He(S)!=="container")continue;const $=((p=(m=e==null?void 0:e.containers)==null?void 0:m[S])==null?void 0:p.children)||[];for(const k of $){if(He(k)!=="field")continue;const E=h(k).name||k;C.has(E)||C.set(E,new Set),C.get(E).add(S)}}for(const[S,$]of C.entries())$.size>1&&f.push(`Nome duplicado "${S}" no step "${j}" em containers diferentes (containers: ${[...$].join(", ")}). Isso causa colisão no formulário.`)}return{errors:f,warnings:b}},Th=N.createContext(null),Gk=e=>{if(e.startsWith("step"))return"step";if(e.startsWith("container"))return"container";const t=e.match(/^([a-z_]+)-/);return t?t[1]:e.split("-")[0]},Cs=(e,t)=>{const r=t||Gk(e),n=r==="step",a=r==="container",s=r==="field_array";return{label:n?"Novo Step":a?"Novo Container":s?"Lista de itens":r||e,name:e,fieldType:r||"texto",required:!1,columns:2,tamanho:a||s?12:n?void 0:6,showLabel:a?!0:void 0,itemLabel:s?"Item":void 0}},Ns=e=>typeof structuredClone=="function"?{containers:structuredClone(e.containers),configs:structuredClone(e.configs)}:{containers:JSON.parse(JSON.stringify(e.containers)),configs:JSON.parse(JSON.stringify(e.configs))},Ah=(e,t)=>{const r=[e],n=t[e];if(n!=null&&n.children)for(const a of n.children)r.push(...Ah(a,t));return r},wl=(e,t)=>{for(const[r,n]of Object.entries(t))if(n.children.includes(e))return r;return null},Rh=({children:e,initialConfigs:t,initialContainers:r,initialTemplateId:n,initialStepConfig:a,schemaId:s,uploadTermsPdf:i,deleteTermsPdf:l})=>{const[c,d]=N.useState({selectedId:null,configs:t||{},showPreview:!1,containers:r??{root:{children:[]}},previewTemplateId:n||"moderno",stepConfig:a??{}}),[u,m]=N.useState(null),[p,f]=N.useState(null),b=N.useRef([]),h=N.useRef([]),x=M=>{b.current=[...b.current.slice(-49),Ns(M)],h.current=[]},y=N.useCallback(()=>{d(M=>(x(M),{...M}))},[]),v=N.useCallback(()=>{b.current.length!==0&&d(M=>{h.current=[...h.current,Ns(M)];const P=b.current.pop();return{...M,containers:P.containers,configs:P.configs}})},[]),j=N.useCallback(()=>{h.current.length!==0&&d(M=>{b.current=[...b.current,Ns(M)];const P=h.current.pop();return{...M,containers:P.containers,configs:P.configs}})},[]);N.useEffect(()=>{const M=P=>{const se=P.metaKey||P.ctrlKey;se&&P.key==="z"&&!P.shiftKey&&(P.preventDefault(),v()),se&&P.key==="z"&&P.shiftKey&&(P.preventDefault(),j()),se&&P.key==="y"&&(P.preventDefault(),j())};return window.addEventListener("keydown",M),()=>window.removeEventListener("keydown",M)},[v,j]);const w=N.useCallback(M=>c.configs[M]??Cs(M),[c.configs]),C=N.useCallback(()=>{const M=[],P=se=>{var U;const Q=((U=c.containers[se])==null?void 0:U.children)??[];for(const Y of Q)He(Y)==="field"?M.push(Y):c.containers[Y]&&P(Y)};return P("root"),M},[c.containers]),S=N.useCallback(M=>{d(P=>({...P,selectedId:M}))},[]),$=N.useCallback(M=>{d(P=>({...P,showPreview:M}))},[]),k=N.useCallback(M=>{d(P=>({...P,previewTemplateId:M}))},[]),E=N.useCallback(M=>{d(P=>({...P,stepConfig:{...P.stepConfig,...M}}))},[]),D=N.useCallback((M,P)=>{d(se=>({...se,configs:{...se.configs,[M]:{...se.configs[M]??Cs(M),...P}}}))},[]),O=N.useCallback((M,P,se)=>{const U=`${M}-${St()}`,Q=He(U);return d(Y=>{var H;x(Y);const W={...Y.containers};(Q==="step"||Q==="container"||M==="field_array")&&(W[U]={children:[]});const G=[...((H=W[P])==null?void 0:H.children)??[]];return se!==void 0&&se>=0?G.splice(se,0,U):G.push(U),W[P]={children:G},{...Y,containers:W,configs:{...Y.configs,[U]:Cs(U,M)},selectedId:U}}),U},[]),L=N.useCallback((M,P)=>{const se=`container-${St()}`;return d(U=>{var Q,Y,H;x(U);const W={...U.containers},G={...U.configs},ne=[];for(const te of M.containerTemplate.campos){const ce=te.locked&&te.id?te.id:`${String(te.tipo).toLowerCase()}-${St()}`;if(ne.push(ce),G[ce]={label:te.label,name:te.locked?te.id:te.nome,fieldType:te.tipo,required:te.obrigatorio||!1,placeholder:te.placeholder,hint:te.hint,tamanho:te.tamanho||6,inicioColuna:te.inicioColuna,defaultValue:te.defaultValue!=null?String(te.defaultValue):void 0,locked:te.locked||!1,options:(Q=te.opcoes)==null?void 0:Q.map(be=>({value:be.valor,label:be.label})),...te.tipo==="field_array"&&{itemLabel:te.itemLabel,minItems:te.minItems,maxItems:te.maxItems,addLabel:te.addLabel}},te.tipo==="field_array"){const be=[];for(const Ce of te.subFields??[]){const ve=`${String(Ce.tipo).toLowerCase()}-${St()}`;be.push(ve),G[ve]={label:Ce.label,name:Ce.nome,fieldType:Ce.tipo,required:Ce.obrigatorio||!1,placeholder:Ce.placeholder,hint:Ce.hint,tamanho:Ce.tamanho||6,inicioColuna:Ce.inicioColuna,options:(Y=Ce.opcoes)==null?void 0:Y.map(me=>({value:me.valor,label:me.label}))}}W[ce]={children:be}}}W[se]={children:ne},G[se]={label:M.containerTemplate.titulo||M.name,description:M.containerTemplate.descricao,icone:M.containerTemplate.icone,tamanho:M.containerTemplate.tamanho||12,inicioColuna:M.containerTemplate.inicioColuna,showLabel:!0};const J=[...((H=W[P])==null?void 0:H.children)??[]];return J.push(se),W[P]={children:J},{...U,containers:W,configs:G,selectedId:se}}),se},[]),A=N.useCallback(M=>{const P=[];return d(se=>{var U,Q,Y;x(se);const H={...se.containers},W={...se.configs};for(const G of M.steps){const ne=`step-${St()}`;P.push(ne);const J=[];for(const ce of G.containers){const be=`container-${St()}`;J.push(be);const Ce=[];for(const ve of ce.campos){const me=ve.locked&&ve.id?ve.id:`${String(ve.tipo).toLowerCase()}-${St()}`;if(Ce.push(me),W[me]={label:ve.label,name:ve.locked?ve.id:ve.nome,fieldType:ve.tipo,required:ve.obrigatorio||!1,placeholder:ve.placeholder,hint:ve.hint,tamanho:ve.tamanho||12,inicioColuna:ve.inicioColuna,defaultValue:ve.defaultValue!=null?String(ve.defaultValue):void 0,locked:ve.locked||!1,options:(U=ve.opcoes)==null?void 0:U.map(Ee=>({value:Ee.valor,label:Ee.label})),...ve.tipo==="field_array"&&{itemLabel:ve.itemLabel,minItems:ve.minItems,maxItems:ve.maxItems,addLabel:ve.addLabel}},ve.tipo==="field_array"){const Ee=[];for(const Fe of ve.subFields??[]){const Nt=`${String(Fe.tipo).toLowerCase()}-${St()}`;Ee.push(Nt),W[Nt]={label:Fe.label,name:Fe.nome,fieldType:Fe.tipo,required:Fe.obrigatorio||!1,placeholder:Fe.placeholder,hint:Fe.hint,tamanho:Fe.tamanho||6,inicioColuna:Fe.inicioColuna,options:(Q=Fe.opcoes)==null?void 0:Q.map(dt=>({value:dt.valor,label:dt.label}))}}H[me]={children:Ee}}}H[be]={children:Ce},W[be]={label:ce.titulo,description:ce.descricao,icone:ce.icone,tamanho:ce.tamanho||12,showLabel:!0}}H[ne]={children:J},W[ne]={label:G.titulo,description:G.descricao,icone:G.icone};const te=[...((Y=H.root)==null?void 0:Y.children)??[],ne];H.root={children:te}}return{...se,containers:H,configs:W,selectedId:P[0]??se.selectedId}}),P},[]),z=N.useCallback((M,P,se,U)=>{d(Q=>{var Y,H;x(Q);const W={...Q.containers},G=(((Y=W[P])==null?void 0:Y.children)??[]).filter(te=>te!==M);W[P]={children:G};const ne=[...(((H=W[se])==null?void 0:H.children)??[]).filter(te=>te!==M)],J=Math.max(0,Math.min(U,ne.length));return ne.splice(J,0,M),W[se]={children:ne},{...Q,containers:W}})},[]),X=N.useCallback((M,P)=>{d(se=>(x(se),{...se,containers:{...se.containers,[M]:{children:P}}}))},[]),q=N.useCallback(M=>{d(P=>{x(P);const se=Ah(M,P.containers),U={};for(const[Y,H]of Object.entries(P.containers))se.includes(Y)||(U[Y]={children:H.children.filter(W=>!se.includes(W))});const Q={...P.configs};for(const Y of se)delete Q[Y];return{...P,containers:U,configs:Q,selectedId:se.includes(P.selectedId??"")?null:P.selectedId}})},[]),Z=N.useCallback((M,P)=>{d(se=>{const U=wl(M,se.containers);if(!U)return se;const Q=[...se.containers[U].children],Y=Q.indexOf(M),H=P==="up"?Y-1:Y+1;return H<0||H>=Q.length?se:([Q[Y],Q[H]]=[Q[H],Q[Y]],{...se,containers:{...se.containers,[U]:{children:Q}}})})},[]),V=N.useCallback((M,P)=>{y(),Z(M,P)},[Z,y]);return o.jsx(Th.Provider,{value:{selectedId:c.selectedId,configs:c.configs,showPreview:c.showPreview,containers:c.containers,positionDrag:u,reorderDrag:p,canUndo:b.current.length>0,canRedo:h.current.length>0,schemaId:s,uploadTermsPdf:i,deleteTermsPdf:l,previewTemplateId:c.previewTemplateId,setPreviewTemplateId:k,stepConfig:c.stepConfig,updateStepConfig:E,getConfig:w,getAllFieldIds:C,setSelected:S,updateConfig:D,setShowPreview:$,addItem:O,addPresetBlock:L,addPresetStepBlock:A,moveCanvasItem:z,reorderInContainer:X,removeItem:q,moveItem:V,moveItemNoSnapshot:Z,setPositionDrag:m,setReorderDrag:f,undo:v,redo:j,pushSnapshot:y},children:e})},gt=()=>{const e=N.useContext(Th);if(!e)throw new Error("useBuilder must be inside BuilderProvider");return e},Xk=()=>{const{containers:e,configs:t,stepConfig:r}=gt(),n=N.useCallback(s=>yl({containers:e},t,{...s,stepConfig:r}),[e,t,r]),a=N.useCallback(()=>Dh({containers:e},t),[e,t]);return{buildSchema:n,validate:a}};function Ih(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(r=Ih(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function Zk(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=Ih(e))&&(n&&(n+=" "),n+=t);return n}const Kk=(e,t)=>{const r=new Array(e.length+t.length);for(let n=0;n<e.length;n++)r[n]=e[n];for(let n=0;n<t.length;n++)r[e.length+n]=t[n];return r},Yk=(e,t)=>({classGroupId:e,validator:t}),Ph=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),ro="-",id=[],Jk="arbitrary..",Qk=e=>{const t=tC(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return eC(a);const s=a.split(ro),i=s[0]===""&&s.length>1?1:0;return _h(s,i,t)},getConflictingClassGroupIds:(a,s)=>{if(s){const i=n[a],l=r[a];return i?l?Kk(l,i):i:l||id}return r[a]||id}}},_h=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const n=e[t],a=r.nextPart.get(n);if(a){const c=_h(e,t+1,a);if(c)return c}const s=r.validators;if(s===null)return;const i=t===0?e.join(ro):e.slice(t).join(ro),l=s.length;for(let c=0;c<l;c++){const d=s[c];if(d.validator(i))return d.classGroupId}},eC=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),n=t.slice(0,r);return n?Jk+n:void 0})(),tC=e=>{const{theme:t,classGroups:r}=e;return rC(r,t)},rC=(e,t)=>{const r=Ph();for(const n in e){const a=e[n];jl(a,r,n,t)}return r},jl=(e,t,r,n)=>{const a=e.length;for(let s=0;s<a;s++){const i=e[s];nC(i,t,r,n)}},nC=(e,t,r,n)=>{if(typeof e=="string"){aC(e,t,r);return}if(typeof e=="function"){oC(e,t,r,n);return}sC(e,t,r,n)},aC=(e,t,r)=>{const n=e===""?t:Oh(t,e);n.classGroupId=r},oC=(e,t,r,n)=>{if(iC(e)){jl(e(n),t,r,n);return}t.validators===null&&(t.validators=[]),t.validators.push(Yk(r,e))},sC=(e,t,r,n)=>{const a=Object.entries(e),s=a.length;for(let i=0;i<s;i++){const[l,c]=a[i];jl(c,Oh(t,l),r,n)}},Oh=(e,t)=>{let r=e;const n=t.split(ro),a=n.length;for(let s=0;s<a;s++){const i=n[s];let l=r.nextPart.get(i);l||(l=Ph(),r.nextPart.set(i,l)),r=l}return r},iC=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,lC=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null);const a=(s,i)=>{r[s]=i,t++,t>e&&(t=0,n=r,r=Object.create(null))};return{get(s){let i=r[s];if(i!==void 0)return i;if((i=n[s])!==void 0)return a(s,i),i},set(s,i){s in r?r[s]=i:a(s,i)}}},di="!",ld=":",cC=[],cd=(e,t,r,n,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:a}),dC=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=a=>{const s=[];let i=0,l=0,c=0,d;const u=a.length;for(let h=0;h<u;h++){const x=a[h];if(i===0&&l===0){if(x===ld){s.push(a.slice(c,h)),c=h+1;continue}if(x==="/"){d=h;continue}}x==="["?i++:x==="]"?i--:x==="("?l++:x===")"&&l--}const m=s.length===0?a:a.slice(c);let p=m,f=!1;m.endsWith(di)?(p=m.slice(0,-1),f=!0):m.startsWith(di)&&(p=m.slice(1),f=!0);const b=d&&d>c?d-c:void 0;return cd(s,f,p,b)};if(t){const a=t+ld,s=n;n=i=>i.startsWith(a)?s(i.slice(a.length)):cd(cC,!1,i,void 0,!0)}if(r){const a=n;n=s=>r({className:s,parseClassName:a})}return n},uC=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,n)=>{t.set(r,1e6+n)}),r=>{const n=[];let a=[];for(let s=0;s<r.length;s++){const i=r[s],l=i[0]==="[",c=t.has(i);l||c?(a.length>0&&(a.sort(),n.push(...a),a=[]),n.push(i)):a.push(i)}return a.length>0&&(a.sort(),n.push(...a)),n}},mC=e=>({cache:lC(e.cacheSize),parseClassName:dC(e),sortModifiers:uC(e),...Qk(e)}),pC=/\s+/,fC=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:s}=t,i=[],l=e.trim().split(pC);let c="";for(let d=l.length-1;d>=0;d-=1){const u=l[d],{isExternal:m,modifiers:p,hasImportantModifier:f,baseClassName:b,maybePostfixModifierPosition:h}=r(u);if(m){c=u+(c.length>0?" "+c:c);continue}let x=!!h,y=n(x?b.substring(0,h):b);if(!y){if(!x){c=u+(c.length>0?" "+c:c);continue}if(y=n(b),!y){c=u+(c.length>0?" "+c:c);continue}x=!1}const v=p.length===0?"":p.length===1?p[0]:s(p).join(":"),j=f?v+di:v,w=j+y;if(i.indexOf(w)>-1)continue;i.push(w);const C=a(y,x);for(let S=0;S<C.length;++S){const $=C[S];i.push(j+$)}c=u+(c.length>0?" "+c:c)}return c},hC=(...e)=>{let t=0,r,n,a="";for(;t<e.length;)(r=e[t++])&&(n=Fh(r))&&(a&&(a+=" "),a+=n);return a},Fh=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=Fh(e[n]))&&(r&&(r+=" "),r+=t);return r},xC=(e,...t)=>{let r,n,a,s;const i=c=>{const d=t.reduce((u,m)=>m(u),e());return r=mC(d),n=r.cache.get,a=r.cache.set,s=l,l(c)},l=c=>{const d=n(c);if(d)return d;const u=fC(c,r);return a(c,u),u};return s=i,(...c)=>s(hC(...c))},gC=[],nt=e=>{const t=r=>r[e]||gC;return t.isThemeGetter=!0,t},zh=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Lh=/^\((?:(\w[\w-]*):)?(.+)\)$/i,vC=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,bC=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,yC=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,wC=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,jC=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,kC=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Er=e=>vC.test(e),Se=e=>!!e&&!Number.isNaN(Number(e)),Dr=e=>!!e&&Number.isInteger(Number(e)),Ss=e=>e.endsWith("%")&&Se(e.slice(0,-1)),xr=e=>bC.test(e),Mh=()=>!0,CC=e=>yC.test(e)&&!wC.test(e),kl=()=>!1,NC=e=>jC.test(e),SC=e=>kC.test(e),$C=e=>!fe(e)&&!xe(e),EC=e=>Ur(e,Uh,kl),fe=e=>zh.test(e),Xr=e=>Ur(e,Hh,CC),dd=e=>Ur(e,OC,Se),DC=e=>Ur(e,qh,Mh),TC=e=>Ur(e,Wh,kl),ud=e=>Ur(e,Vh,kl),AC=e=>Ur(e,Bh,SC),Ia=e=>Ur(e,Gh,NC),xe=e=>Lh.test(e),qn=e=>on(e,Hh),RC=e=>on(e,Wh),md=e=>on(e,Vh),IC=e=>on(e,Uh),PC=e=>on(e,Bh),Pa=e=>on(e,Gh,!0),_C=e=>on(e,qh,!0),Ur=(e,t,r)=>{const n=zh.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},on=(e,t,r=!1)=>{const n=Lh.exec(e);return n?n[1]?t(n[1]):r:!1},Vh=e=>e==="position"||e==="percentage",Bh=e=>e==="image"||e==="url",Uh=e=>e==="length"||e==="size"||e==="bg-size",Hh=e=>e==="length",OC=e=>e==="number",Wh=e=>e==="family-name",qh=e=>e==="number"||e==="weight",Gh=e=>e==="shadow",FC=()=>{const e=nt("color"),t=nt("font"),r=nt("text"),n=nt("font-weight"),a=nt("tracking"),s=nt("leading"),i=nt("breakpoint"),l=nt("container"),c=nt("spacing"),d=nt("radius"),u=nt("shadow"),m=nt("inset-shadow"),p=nt("text-shadow"),f=nt("drop-shadow"),b=nt("blur"),h=nt("perspective"),x=nt("aspect"),y=nt("ease"),v=nt("animate"),j=()=>["auto","avoid","all","avoid-page","page","left","right","column"],w=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],C=()=>[...w(),xe,fe],S=()=>["auto","hidden","clip","visible","scroll"],$=()=>["auto","contain","none"],k=()=>[xe,fe,c],E=()=>[Er,"full","auto",...k()],D=()=>[Dr,"none","subgrid",xe,fe],O=()=>["auto",{span:["full",Dr,xe,fe]},Dr,xe,fe],L=()=>[Dr,"auto",xe,fe],A=()=>["auto","min","max","fr",xe,fe],z=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],X=()=>["start","end","center","stretch","center-safe","end-safe"],q=()=>["auto",...k()],Z=()=>[Er,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...k()],V=()=>[Er,"screen","full","dvw","lvw","svw","min","max","fit",...k()],M=()=>[Er,"screen","full","lh","dvh","lvh","svh","min","max","fit",...k()],P=()=>[e,xe,fe],se=()=>[...w(),md,ud,{position:[xe,fe]}],U=()=>["no-repeat",{repeat:["","x","y","space","round"]}],Q=()=>["auto","cover","contain",IC,EC,{size:[xe,fe]}],Y=()=>[Ss,qn,Xr],H=()=>["","none","full",d,xe,fe],W=()=>["",Se,qn,Xr],G=()=>["solid","dashed","dotted","double"],ne=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],J=()=>[Se,Ss,md,ud],te=()=>["","none",b,xe,fe],ce=()=>["none",Se,xe,fe],be=()=>["none",Se,xe,fe],Ce=()=>[Se,xe,fe],ve=()=>[Er,"full",...k()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[xr],breakpoint:[xr],color:[Mh],container:[xr],"drop-shadow":[xr],ease:["in","out","in-out"],font:[$C],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[xr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[xr],shadow:[xr],spacing:["px",Se],text:[xr],"text-shadow":[xr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Er,fe,xe,x]}],container:["container"],columns:[{columns:[Se,fe,xe,l]}],"break-after":[{"break-after":j()}],"break-before":[{"break-before":j()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:C()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:$()}],"overscroll-x":[{"overscroll-x":$()}],"overscroll-y":[{"overscroll-y":$()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:E()}],"inset-x":[{"inset-x":E()}],"inset-y":[{"inset-y":E()}],start:[{"inset-s":E(),start:E()}],end:[{"inset-e":E(),end:E()}],"inset-bs":[{"inset-bs":E()}],"inset-be":[{"inset-be":E()}],top:[{top:E()}],right:[{right:E()}],bottom:[{bottom:E()}],left:[{left:E()}],visibility:["visible","invisible","collapse"],z:[{z:[Dr,"auto",xe,fe]}],basis:[{basis:[Er,"full","auto",l,...k()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Se,Er,"auto","initial","none",fe]}],grow:[{grow:["",Se,xe,fe]}],shrink:[{shrink:["",Se,xe,fe]}],order:[{order:[Dr,"first","last","none",xe,fe]}],"grid-cols":[{"grid-cols":D()}],"col-start-end":[{col:O()}],"col-start":[{"col-start":L()}],"col-end":[{"col-end":L()}],"grid-rows":[{"grid-rows":D()}],"row-start-end":[{row:O()}],"row-start":[{"row-start":L()}],"row-end":[{"row-end":L()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":A()}],"auto-rows":[{"auto-rows":A()}],gap:[{gap:k()}],"gap-x":[{"gap-x":k()}],"gap-y":[{"gap-y":k()}],"justify-content":[{justify:[...z(),"normal"]}],"justify-items":[{"justify-items":[...X(),"normal"]}],"justify-self":[{"justify-self":["auto",...X()]}],"align-content":[{content:["normal",...z()]}],"align-items":[{items:[...X(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...X(),{baseline:["","last"]}]}],"place-content":[{"place-content":z()}],"place-items":[{"place-items":[...X(),"baseline"]}],"place-self":[{"place-self":["auto",...X()]}],p:[{p:k()}],px:[{px:k()}],py:[{py:k()}],ps:[{ps:k()}],pe:[{pe:k()}],pbs:[{pbs:k()}],pbe:[{pbe:k()}],pt:[{pt:k()}],pr:[{pr:k()}],pb:[{pb:k()}],pl:[{pl:k()}],m:[{m:q()}],mx:[{mx:q()}],my:[{my:q()}],ms:[{ms:q()}],me:[{me:q()}],mbs:[{mbs:q()}],mbe:[{mbe:q()}],mt:[{mt:q()}],mr:[{mr:q()}],mb:[{mb:q()}],ml:[{ml:q()}],"space-x":[{"space-x":k()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":k()}],"space-y-reverse":["space-y-reverse"],size:[{size:Z()}],"inline-size":[{inline:["auto",...V()]}],"min-inline-size":[{"min-inline":["auto",...V()]}],"max-inline-size":[{"max-inline":["none",...V()]}],"block-size":[{block:["auto",...M()]}],"min-block-size":[{"min-block":["auto",...M()]}],"max-block-size":[{"max-block":["none",...M()]}],w:[{w:[l,"screen",...Z()]}],"min-w":[{"min-w":[l,"screen","none",...Z()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[i]},...Z()]}],h:[{h:["screen","lh",...Z()]}],"min-h":[{"min-h":["screen","lh","none",...Z()]}],"max-h":[{"max-h":["screen","lh",...Z()]}],"font-size":[{text:["base",r,qn,Xr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,_C,DC]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Ss,fe]}],"font-family":[{font:[RC,TC,t]}],"font-features":[{"font-features":[fe]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,xe,fe]}],"line-clamp":[{"line-clamp":[Se,"none",xe,dd]}],leading:[{leading:[s,...k()]}],"list-image":[{"list-image":["none",xe,fe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",xe,fe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:P()}],"text-color":[{text:P()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...G(),"wavy"]}],"text-decoration-thickness":[{decoration:[Se,"from-font","auto",xe,Xr]}],"text-decoration-color":[{decoration:P()}],"underline-offset":[{"underline-offset":[Se,"auto",xe,fe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:k()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",xe,fe]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",xe,fe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:se()}],"bg-repeat":[{bg:U()}],"bg-size":[{bg:Q()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Dr,xe,fe],radial:["",xe,fe],conic:[Dr,xe,fe]},PC,AC]}],"bg-color":[{bg:P()}],"gradient-from-pos":[{from:Y()}],"gradient-via-pos":[{via:Y()}],"gradient-to-pos":[{to:Y()}],"gradient-from":[{from:P()}],"gradient-via":[{via:P()}],"gradient-to":[{to:P()}],rounded:[{rounded:H()}],"rounded-s":[{"rounded-s":H()}],"rounded-e":[{"rounded-e":H()}],"rounded-t":[{"rounded-t":H()}],"rounded-r":[{"rounded-r":H()}],"rounded-b":[{"rounded-b":H()}],"rounded-l":[{"rounded-l":H()}],"rounded-ss":[{"rounded-ss":H()}],"rounded-se":[{"rounded-se":H()}],"rounded-ee":[{"rounded-ee":H()}],"rounded-es":[{"rounded-es":H()}],"rounded-tl":[{"rounded-tl":H()}],"rounded-tr":[{"rounded-tr":H()}],"rounded-br":[{"rounded-br":H()}],"rounded-bl":[{"rounded-bl":H()}],"border-w":[{border:W()}],"border-w-x":[{"border-x":W()}],"border-w-y":[{"border-y":W()}],"border-w-s":[{"border-s":W()}],"border-w-e":[{"border-e":W()}],"border-w-bs":[{"border-bs":W()}],"border-w-be":[{"border-be":W()}],"border-w-t":[{"border-t":W()}],"border-w-r":[{"border-r":W()}],"border-w-b":[{"border-b":W()}],"border-w-l":[{"border-l":W()}],"divide-x":[{"divide-x":W()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":W()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...G(),"hidden","none"]}],"divide-style":[{divide:[...G(),"hidden","none"]}],"border-color":[{border:P()}],"border-color-x":[{"border-x":P()}],"border-color-y":[{"border-y":P()}],"border-color-s":[{"border-s":P()}],"border-color-e":[{"border-e":P()}],"border-color-bs":[{"border-bs":P()}],"border-color-be":[{"border-be":P()}],"border-color-t":[{"border-t":P()}],"border-color-r":[{"border-r":P()}],"border-color-b":[{"border-b":P()}],"border-color-l":[{"border-l":P()}],"divide-color":[{divide:P()}],"outline-style":[{outline:[...G(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Se,xe,fe]}],"outline-w":[{outline:["",Se,qn,Xr]}],"outline-color":[{outline:P()}],shadow:[{shadow:["","none",u,Pa,Ia]}],"shadow-color":[{shadow:P()}],"inset-shadow":[{"inset-shadow":["none",m,Pa,Ia]}],"inset-shadow-color":[{"inset-shadow":P()}],"ring-w":[{ring:W()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:P()}],"ring-offset-w":[{"ring-offset":[Se,Xr]}],"ring-offset-color":[{"ring-offset":P()}],"inset-ring-w":[{"inset-ring":W()}],"inset-ring-color":[{"inset-ring":P()}],"text-shadow":[{"text-shadow":["none",p,Pa,Ia]}],"text-shadow-color":[{"text-shadow":P()}],opacity:[{opacity:[Se,xe,fe]}],"mix-blend":[{"mix-blend":[...ne(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ne()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Se]}],"mask-image-linear-from-pos":[{"mask-linear-from":J()}],"mask-image-linear-to-pos":[{"mask-linear-to":J()}],"mask-image-linear-from-color":[{"mask-linear-from":P()}],"mask-image-linear-to-color":[{"mask-linear-to":P()}],"mask-image-t-from-pos":[{"mask-t-from":J()}],"mask-image-t-to-pos":[{"mask-t-to":J()}],"mask-image-t-from-color":[{"mask-t-from":P()}],"mask-image-t-to-color":[{"mask-t-to":P()}],"mask-image-r-from-pos":[{"mask-r-from":J()}],"mask-image-r-to-pos":[{"mask-r-to":J()}],"mask-image-r-from-color":[{"mask-r-from":P()}],"mask-image-r-to-color":[{"mask-r-to":P()}],"mask-image-b-from-pos":[{"mask-b-from":J()}],"mask-image-b-to-pos":[{"mask-b-to":J()}],"mask-image-b-from-color":[{"mask-b-from":P()}],"mask-image-b-to-color":[{"mask-b-to":P()}],"mask-image-l-from-pos":[{"mask-l-from":J()}],"mask-image-l-to-pos":[{"mask-l-to":J()}],"mask-image-l-from-color":[{"mask-l-from":P()}],"mask-image-l-to-color":[{"mask-l-to":P()}],"mask-image-x-from-pos":[{"mask-x-from":J()}],"mask-image-x-to-pos":[{"mask-x-to":J()}],"mask-image-x-from-color":[{"mask-x-from":P()}],"mask-image-x-to-color":[{"mask-x-to":P()}],"mask-image-y-from-pos":[{"mask-y-from":J()}],"mask-image-y-to-pos":[{"mask-y-to":J()}],"mask-image-y-from-color":[{"mask-y-from":P()}],"mask-image-y-to-color":[{"mask-y-to":P()}],"mask-image-radial":[{"mask-radial":[xe,fe]}],"mask-image-radial-from-pos":[{"mask-radial-from":J()}],"mask-image-radial-to-pos":[{"mask-radial-to":J()}],"mask-image-radial-from-color":[{"mask-radial-from":P()}],"mask-image-radial-to-color":[{"mask-radial-to":P()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":w()}],"mask-image-conic-pos":[{"mask-conic":[Se]}],"mask-image-conic-from-pos":[{"mask-conic-from":J()}],"mask-image-conic-to-pos":[{"mask-conic-to":J()}],"mask-image-conic-from-color":[{"mask-conic-from":P()}],"mask-image-conic-to-color":[{"mask-conic-to":P()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:se()}],"mask-repeat":[{mask:U()}],"mask-size":[{mask:Q()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",xe,fe]}],filter:[{filter:["","none",xe,fe]}],blur:[{blur:te()}],brightness:[{brightness:[Se,xe,fe]}],contrast:[{contrast:[Se,xe,fe]}],"drop-shadow":[{"drop-shadow":["","none",f,Pa,Ia]}],"drop-shadow-color":[{"drop-shadow":P()}],grayscale:[{grayscale:["",Se,xe,fe]}],"hue-rotate":[{"hue-rotate":[Se,xe,fe]}],invert:[{invert:["",Se,xe,fe]}],saturate:[{saturate:[Se,xe,fe]}],sepia:[{sepia:["",Se,xe,fe]}],"backdrop-filter":[{"backdrop-filter":["","none",xe,fe]}],"backdrop-blur":[{"backdrop-blur":te()}],"backdrop-brightness":[{"backdrop-brightness":[Se,xe,fe]}],"backdrop-contrast":[{"backdrop-contrast":[Se,xe,fe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Se,xe,fe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Se,xe,fe]}],"backdrop-invert":[{"backdrop-invert":["",Se,xe,fe]}],"backdrop-opacity":[{"backdrop-opacity":[Se,xe,fe]}],"backdrop-saturate":[{"backdrop-saturate":[Se,xe,fe]}],"backdrop-sepia":[{"backdrop-sepia":["",Se,xe,fe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":k()}],"border-spacing-x":[{"border-spacing-x":k()}],"border-spacing-y":[{"border-spacing-y":k()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",xe,fe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Se,"initial",xe,fe]}],ease:[{ease:["linear","initial",y,xe,fe]}],delay:[{delay:[Se,xe,fe]}],animate:[{animate:["none",v,xe,fe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[h,xe,fe]}],"perspective-origin":[{"perspective-origin":C()}],rotate:[{rotate:ce()}],"rotate-x":[{"rotate-x":ce()}],"rotate-y":[{"rotate-y":ce()}],"rotate-z":[{"rotate-z":ce()}],scale:[{scale:be()}],"scale-x":[{"scale-x":be()}],"scale-y":[{"scale-y":be()}],"scale-z":[{"scale-z":be()}],"scale-3d":["scale-3d"],skew:[{skew:Ce()}],"skew-x":[{"skew-x":Ce()}],"skew-y":[{"skew-y":Ce()}],transform:[{transform:[xe,fe,"","none","gpu","cpu"]}],"transform-origin":[{origin:C()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ve()}],"translate-x":[{"translate-x":ve()}],"translate-y":[{"translate-y":ve()}],"translate-z":[{"translate-z":ve()}],"translate-none":["translate-none"],accent:[{accent:P()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:P()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",xe,fe]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":k()}],"scroll-mx":[{"scroll-mx":k()}],"scroll-my":[{"scroll-my":k()}],"scroll-ms":[{"scroll-ms":k()}],"scroll-me":[{"scroll-me":k()}],"scroll-mbs":[{"scroll-mbs":k()}],"scroll-mbe":[{"scroll-mbe":k()}],"scroll-mt":[{"scroll-mt":k()}],"scroll-mr":[{"scroll-mr":k()}],"scroll-mb":[{"scroll-mb":k()}],"scroll-ml":[{"scroll-ml":k()}],"scroll-p":[{"scroll-p":k()}],"scroll-px":[{"scroll-px":k()}],"scroll-py":[{"scroll-py":k()}],"scroll-ps":[{"scroll-ps":k()}],"scroll-pe":[{"scroll-pe":k()}],"scroll-pbs":[{"scroll-pbs":k()}],"scroll-pbe":[{"scroll-pbe":k()}],"scroll-pt":[{"scroll-pt":k()}],"scroll-pr":[{"scroll-pr":k()}],"scroll-pb":[{"scroll-pb":k()}],"scroll-pl":[{"scroll-pl":k()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",xe,fe]}],fill:[{fill:["none",...P()]}],"stroke-w":[{stroke:[Se,qn,Xr,dd]}],stroke:[{stroke:["none",...P()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},zC=xC(FC);function Ht(...e){return zC(Zk(e))}const yr=({onInsert:e})=>{const[t,r]=N.useState(null),n=async a=>{const s=`{{${a}}}`;try{await navigator.clipboard.writeText(s)}catch{const i=document.createElement("textarea");i.value=s,i.style.position="fixed",i.style.opacity="0",document.body.appendChild(i),i.select(),document.execCommand("copy"),document.body.removeChild(i)}e&&e(s),r(a),setTimeout(()=>r(null),1500)};return o.jsxs(Po,{children:[o.jsx(_o,{asChild:!0,children:o.jsx(De,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0 text-muted-foreground hover:text-primary",title:"Inserir variável do evento",children:o.jsx(_.Braces,{className:"h-3.5 w-3.5"})})}),o.jsxs(fa,{className:"w-80 p-0",align:"end",side:"left",sideOffset:6,children:[o.jsxs("div",{className:"px-3 py-2 border-b border-border",children:[o.jsx("p",{className:"text-xs font-semibold text-foreground",children:"Variáveis do evento"}),o.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["Clique para copiar. Use"," ",o.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"{{evento.xxx}}"})," ","em labels, placeholders e hints."]})]}),o.jsx("div",{className:"max-h-64 overflow-y-auto py-1",children:bl.map(a=>{const s=t===a.key;return o.jsxs("button",{type:"button",onClick:()=>n(a.key),className:Ht("w-full flex items-center justify-between px-3 py-1.5 text-left hover:bg-accent transition-colors",s&&"bg-primary/10"),children:[o.jsxs("div",{className:"min-w-0",children:[o.jsx("p",{className:"text-xs font-medium truncate",children:a.label}),o.jsx("code",{className:"text-[10px] text-muted-foreground font-mono",children:`{{${a.key}}}`})]}),o.jsx("div",{className:"ml-2 shrink-0",children:s?o.jsx(_.Check,{className:"h-3.5 w-3.5 text-primary"}):o.jsx(_.Braces,{className:"h-3 w-3 text-muted-foreground/50"})})]},a.key)})})]})]})},LC=({config:e,onUpdate:t})=>o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(ie,{className:"text-xs",children:"Label"}),o.jsx(yr,{})]}),o.jsx(ue,{value:e.label,onChange:r=>t({label:r.target.value}),className:"h-8 text-sm"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(ie,{className:"text-xs",children:"Descrição"}),o.jsx(yr,{})]}),o.jsx(ue,{value:e.description||"",onChange:r=>t({description:r.target.value}),className:"h-8 text-sm",placeholder:"Descrição do step"})]}),o.jsx(Jf,{value:e.icone,onChange:r=>t({icone:r})}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(et,{id:"step-show-label",checked:e.showLabel!==!1,onCheckedChange:r=>t({showLabel:r===!0})}),o.jsx(ie,{htmlFor:"step-show-label",className:"text-xs cursor-pointer",children:"Exibir título no formulário"})]})]}),MC=({inicioColuna:e,tamanho:t,onSelect:r})=>o.jsxs("div",{className:"space-y-2",children:[o.jsx(ie,{className:"text-xs",children:"Posição no grid"}),o.jsx("div",{className:"flex gap-0.5",children:Array.from({length:12},(n,a)=>{const s=a+1,i=s>=e&&s<e+t;return o.jsx("button",{onClick:()=>r(s),className:Ht("flex-1 h-6 rounded-sm text-[8px] font-mono transition-all border",i?"bg-primary text-primary-foreground border-primary":"bg-muted/50 text-muted-foreground/50 border-border/50 hover:bg-muted hover:border-border"),children:s},s)})}),o.jsxs("p",{className:"text-[9px] text-muted-foreground",children:["Início: col ",e," · Span: ",t]})]}),Xh=({tamanho:e,inicioColuna:t,defaultTamanho:r=6,onTamanhoChange:n,onPositionChange:a})=>{const s=13-t;return o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsxs(ie,{className:"text-xs",children:["Tamanho (",e,"/12 colunas)"]}),o.jsx(Ao,{value:[e],onValueChange:([i])=>{const l=Math.min(i,s);n(l)},min:1,max:s,step:1,className:"py-1"}),o.jsxs("div",{className:"flex justify-between text-[9px] text-muted-foreground",children:[o.jsx("span",{children:"1"}),o.jsx("span",{children:"3"}),o.jsx("span",{children:"6"}),o.jsx("span",{children:"9"}),o.jsx("span",{children:"12"})]})]}),o.jsx(MC,{inicioColuna:t,tamanho:e,onSelect:i=>{const l=13-i,c=Math.min(e,l);a(i),c!==e&&n(c)}})]})},VC=({config:e,onUpdate:t})=>o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(ie,{className:"text-xs",children:"Label"}),o.jsx(yr,{})]}),o.jsx(ue,{value:e.label,onChange:r=>t({label:r.target.value}),className:"h-8 text-sm"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(ie,{className:"text-xs",children:"Descrição"}),o.jsx(yr,{})]}),o.jsx(ue,{value:e.description||"",onChange:r=>t({description:r.target.value}),className:"h-8 text-sm",placeholder:"Descrição do container"})]}),o.jsx(Jf,{value:e.icone,onChange:r=>t({icone:r})}),o.jsx(Xh,{tamanho:e.tamanho||12,inicioColuna:e.inicioColuna||1,defaultTamanho:12,onTamanhoChange:r=>t({tamanho:r}),onPositionChange:r=>t({inicioColuna:r})}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Colunas internas"}),o.jsxs(Bt,{value:String(e.columns||2),onValueChange:r=>t({columns:Number(r)}),children:[o.jsx(Rt,{className:"h-8 text-sm",children:o.jsx(Ut,{})}),o.jsxs(It,{children:[o.jsx(qe,{value:"1",children:"1 coluna"}),o.jsx(qe,{value:"2",children:"2 colunas"}),o.jsx(qe,{value:"3",children:"3 colunas"}),o.jsx(qe,{value:"4",children:"4 colunas"})]})]}),o.jsx("p",{className:"text-[9px] text-muted-foreground",children:"Grid interno simplificado para campos"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(et,{id:"show-label",checked:e.showLabel!==!1,onCheckedChange:r=>t({showLabel:r===!0})}),o.jsx(ie,{htmlFor:"show-label",className:"text-xs cursor-pointer",children:"Exibir label no formulário"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(et,{id:"show-as-card",checked:e.showAsCard||!1,onCheckedChange:r=>t({showAsCard:r===!0})}),o.jsx(ie,{htmlFor:"show-as-card",className:"text-xs cursor-pointer",children:"Exibir como card"})]})]}),ui=[{category:"Texto básico",presets:[{pattern:"^[A-Za-z]+$",label:"Apenas letras",description:"Aceita somente letras de A-Z (maiúsculas e minúsculas), sem espaços, números ou especiais."},{pattern:"^[a-z]+$",label:"Apenas minúsculas",description:"Aceita somente letras minúsculas de a-z."},{pattern:"^[A-Z]+$",label:"Apenas maiúsculas",description:"Aceita somente letras maiúsculas de A-Z."},{pattern:"^[A-Za-zÀ-ÿ]+$",label:"Letras com acentos",description:"Aceita letras incluindo acentuadas (é, ã, ü, etc.)."},{pattern:"^[A-Za-zÀ-ÿ\\s]+$",label:"Letras, acentos e espaços",description:"Aceita letras com acentos e espaços — ideal para nomes completos."},{pattern:"^[A-Za-z0-9]+$",label:"Alfanumérico",description:"Apenas letras e números, sem espaços ou caracteres especiais."},{pattern:"^[A-Za-z0-9\\s]+$",label:"Alfanumérico com espaços",description:"Letras, números e espaços."},{pattern:"^[A-Za-z0-9_]+$",label:"Alfanumérico + underscore",description:"Letras, números e underscore (_). Padrão para usernames."},{pattern:"^[A-Za-z0-9_-]+$",label:"Slug-friendly",description:"Letras, números, underscore e hífen. Ideal para slugs de URL."},{pattern:"^\\S+$",label:"Sem espaços",description:"Aceita qualquer caractere exceto espaços em branco."},{pattern:"^.{1,}$",label:"Não vazio",description:"Exige pelo menos 1 caractere (qualquer um)."}]},{category:"Números",presets:[{pattern:"^[0-9]+$",label:"Apenas dígitos",description:"Aceita somente dígitos numéricos (0-9)."},{pattern:"^-?[0-9]+$",label:"Inteiro (com negativo)",description:"Número inteiro, opcionalmente negativo."},{pattern:"^[0-9]+\\.?[0-9]*$",label:"Decimal positivo",description:"Número decimal positivo (ex: 3.14, 42)."},{pattern:"^-?[0-9]+\\.?[0-9]*$",label:"Decimal (com negativo)",description:"Número decimal, opcionalmente negativo."},{pattern:"^\\d{1,3}(\\.\\d{3})*(,\\d{2})?$",label:"Formato BR (1.234,56)",description:"Número no formato brasileiro com pontos de milhar e vírgula decimal."},{pattern:"^\\d{1,3}(,\\d{3})*(\\.\\d{2})?$",label:"Formato US (1,234.56)",description:"Número no formato americano com vírgulas de milhar e ponto decimal."},{pattern:"^[01]+$",label:"Binário",description:"Aceita apenas 0 e 1 — representação binária."},{pattern:"^[0-9A-Fa-f]+$",label:"Hexadecimal",description:"Aceita dígitos hexadecimais (0-9, A-F)."},{pattern:"^0[xX][0-9A-Fa-f]+$",label:"Hex com prefixo 0x",description:"Hexadecimal com prefixo 0x (ex: 0xFF)."},{pattern:"^[0-7]+$",label:"Octal",description:"Aceita apenas dígitos octais (0-7)."},{pattern:"^\\d+(\\.\\d{1,2})?$",label:"Monetário (2 casas)",description:"Número com até 2 casas decimais — ideal para valores monetários."},{pattern:"^\\d+(\\.\\d{1,4})?$",label:"Até 4 casas decimais",description:"Número com até 4 casas decimais."}]},{category:"Documentos BR",presets:[{pattern:"^\\d{3}\\.\\d{3}\\.\\d{3}-\\d{2}$",label:"CPF (com máscara)",description:"CPF formatado: 123.456.789-00."},{pattern:"^\\d{11}$",label:"CPF (sem máscara)",description:"CPF apenas dígitos: 12345678900."},{pattern:"^\\d{2}\\.\\d{3}\\.\\d{3}/\\d{4}-\\d{2}$",label:"CNPJ (com máscara)",description:"CNPJ formatado: 12.345.678/0001-00."},{pattern:"^\\d{14}$",label:"CNPJ (sem máscara)",description:"CNPJ apenas dígitos: 12345678000100."},{pattern:"^\\d{5}-?\\d{3}$",label:"CEP",description:"CEP brasileiro: 12345-678 ou 12345678."},{pattern:"^\\d{1,2}\\.\\d{3}\\.\\d{3}[-]?\\d{1}$",label:"RG (formato comum)",description:"RG no formato mais comum: 1.234.567-8."},{pattern:"^\\d{11}$",label:"PIS/PASEP",description:"PIS/PASEP com 11 dígitos."},{pattern:"^\\d{3}\\.?\\d{7}-?\\d{1}$",label:"Título de eleitor",description:"Título de eleitor com 12 dígitos."},{pattern:"^[A-Z]{2}\\d{7}$",label:"Passaporte BR",description:"Passaporte brasileiro: 2 letras + 7 dígitos (ex: AB1234567)."},{pattern:"^\\d{11}$",label:"CNH (registro)",description:"Número de registro da CNH: 11 dígitos."},{pattern:"^\\d{10}$",label:"Certidão (matrícula)",description:"Matrícula de certidão de nascimento/casamento."},{pattern:"^\\d{3}\\.\\d{3}\\.\\d{3}-\\d{2}$|^\\d{2}\\.\\d{3}\\.\\d{3}/\\d{4}-\\d{2}$",label:"CPF ou CNPJ",description:"Aceita CPF (123.456.789-00) ou CNPJ (12.345.678/0001-00)."}]},{category:"Contato",presets:[{pattern:"^[\\w.-]+@[\\w.-]+\\.[A-Za-z]{2,}$",label:"E-mail simples",description:"Validação básica de e-mail: usuario@dominio.com."},{pattern:"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$",label:"E-mail completo",description:"E-mail com mais caracteres aceitos no usuário."},{pattern:"^\\(\\d{2}\\)\\s?\\d{4,5}-\\d{4}$",label:"Telefone BR (com máscara)",description:"Telefone formatado: (11) 91234-5678 ou (11) 1234-5678."},{pattern:"^\\d{10,11}$",label:"Telefone BR (sem máscara)",description:"Telefone apenas dígitos: 11912345678."},{pattern:"^\\+\\d{1,3}\\s?\\d{2,3}\\s?\\d{4,5}[-]?\\d{4}$",label:"Telefone internacional",description:"Formato +55 11 91234-5678."},{pattern:"^\\+55\\d{10,11}$",label:"Celular BR (+55)",description:"Celular brasileiro com DDI: +5511912345678."},{pattern:"^\\d{4,5}-\\d{4}$",label:"Telefone (sem DDD)",description:"Número local: 1234-5678 ou 91234-5678."},{pattern:"^0800\\d{6,7}$",label:"0800",description:"Número 0800 (SAC): 0800XXXXXXX."}]},{category:"Internet / URLs",presets:[{pattern:"^https?://[\\w.-]+(:\\d+)?(/[\\w./-]*)*$",label:"URL HTTP/HTTPS",description:"URL completa com protocolo http ou https."},{pattern:"^(https?://)?[\\w.-]+\\.[A-Za-z]{2,}(/.*)?$",label:"URL (protocolo opcional)",description:"URL com ou sem http:// na frente."},{pattern:"^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*\\.[a-z]{2,}$",label:"Domínio",description:"Nome de domínio válido: exemplo.com.br."},{pattern:"^((25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\.){3}(25[0-5]|2[0-4]\\d|[01]?\\d\\d?)$",label:"IPv4",description:"Endereço IPv4: 192.168.0.1."},{pattern:"^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$",label:"IPv6 (completo)",description:"Endereço IPv6 completo."},{pattern:"^[a-z][a-z0-9-]*$",label:"Subdomínio",description:"Nome de subdomínio válido (letra inicial, alfanumérico + hífen)."},{pattern:"^[A-Za-z][A-Za-z0-9+.-]*://.*$",label:"URI genérica",description:"Qualquer URI com esquema (ftp://, mailto:, tel:, etc.)."},{pattern:"^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$",label:"Cor hex (#FFF)",description:"Código de cor hexadecimal: #FFF ou #FFFFFF."},{pattern:"^#[0-9A-Fa-f]{8}$",label:"Cor hex com alpha",description:"Cor hexadecimal com canal alpha: #FFFFFFFF."},{pattern:"^rgb\\(\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*\\)$",label:"Cor RGB",description:"Cor no formato rgb(255, 0, 0)."}]},{category:"Data e hora",presets:[{pattern:"^\\d{2}/\\d{2}/\\d{4}$",label:"Data DD/MM/AAAA",description:"Data no formato brasileiro: 25/12/2024."},{pattern:"^\\d{4}-\\d{2}-\\d{2}$",label:"Data ISO (AAAA-MM-DD)",description:"Data no formato ISO 8601: 2024-12-25."},{pattern:"^\\d{2}/\\d{2}/\\d{2}$",label:"Data DD/MM/AA",description:"Data com ano de 2 dígitos: 25/12/24."},{pattern:"^\\d{2}-\\d{2}-\\d{4}$",label:"Data DD-MM-AAAA",description:"Data com hífens: 25-12-2024."},{pattern:"^\\d{2}:\\d{2}$",label:"Hora HH:MM",description:"Horário 24h: 14:30."},{pattern:"^\\d{2}:\\d{2}:\\d{2}$",label:"Hora HH:MM:SS",description:"Horário com segundos: 14:30:59."},{pattern:"^(0[1-9]|1[0-2])/\\d{4}$",label:"Mês/Ano (MM/AAAA)",description:"Mês e ano: 12/2024."},{pattern:"^\\d{4}$",label:"Ano (4 dígitos)",description:"Ano com 4 dígitos: 2024."},{pattern:"^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}$",label:"DateTime ISO (sem seg)",description:"Data e hora ISO: 2024-12-25T14:30."},{pattern:"^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$",label:"DateTime ISO (com seg)",description:"Data e hora ISO com segundos."},{pattern:"^\\d{2}/\\d{2}/\\d{4}\\s\\d{2}:\\d{2}$",label:"DateTime BR",description:"Data e hora BR: 25/12/2024 14:30."}]},{category:"Senhas",presets:[{pattern:"^.{6,}$",label:"Mín. 6 caracteres",description:"Exige no mínimo 6 caracteres (qualquer tipo)."},{pattern:"^.{8,}$",label:"Mín. 8 caracteres",description:"Exige no mínimo 8 caracteres."},{pattern:"^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d).{8,}$",label:"Forte (letra+número)",description:"Mín. 8 chars com pelo menos 1 maiúscula, 1 minúscula e 1 número."},{pattern:"^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[!@#$%^&*]).{8,}$",label:"Muito forte",description:"Mín. 8 chars com maiúscula, minúscula, número e caractere especial."},{pattern:"^(?=.*[A-Z])(?=.*\\d).{6,}$",label:"Média (maiúsc+número)",description:"Mín. 6 chars com pelo menos 1 maiúscula e 1 número."},{pattern:"^(?!.*\\s).{8,}$",label:"Sem espaços (mín. 8)",description:"Mín. 8 caracteres, sem espaços."}]},{category:"Nomes e texto formatado",presets:[{pattern:"^[A-Za-zÀ-ÿ]{2,}(\\s[A-Za-zÀ-ÿ]{2,})+$",label:"Nome completo",description:"Nome e sobrenome (mínimo 2 palavras, cada com 2+ letras)."},{pattern:"^[A-Za-zÀ-ÿ]{2,}$",label:"Primeiro nome",description:"Apenas o primeiro nome (mínimo 2 letras, com acentos)."},{pattern:"^[A-Za-zÀ-ÿ'\\-\\s]+$",label:"Nome com apóstrofo/hífen",description:"Nome que aceita D'Silva, Maria-José, etc."},{pattern:"^[A-Z][a-zà-ÿ]+(\\s[A-Z][a-zà-ÿ]+)*$",label:"Nome capitalizado",description:"Cada palavra inicia com maiúscula: João Silva."},{pattern:"^@[A-Za-z0-9_]{1,30}$",label:"Username (@handle)",description:"Username no estilo @usuario (letras, números, underscore, até 30 chars)."},{pattern:"^[a-z0-9_]{3,20}$",label:"Username simples",description:"Username minúsculo: 3-20 chars, letras, números e underscore."},{pattern:"^[A-Za-z0-9._%+-]+$",label:"Parte local do e-mail",description:"Parte antes do @ em endereços de e-mail."}]},{category:"Endereço",presets:[{pattern:"^[A-Za-zÀ-ÿ0-9\\s,./-]+$",label:"Endereço genérico",description:"Aceita letras, números, espaços, vírgulas, pontos, barras e hífens."},{pattern:"^\\d{1,6}$",label:"Número residencial",description:"Número do endereço: 1 a 6 dígitos."},{pattern:"^\\d{5}-?\\d{3}$",label:"CEP",description:"CEP: 12345-678 ou 12345678."},{pattern:"^[A-Z]{2}$",label:"UF (estado)",description:"Sigla do estado brasileiro: SP, RJ, MG, etc."},{pattern:"^(Rua|Av|Avenida|Travessa|Alameda|Praça|Rod|Rodovia)\\s.+$",label:"Logradouro BR",description:"Começa com tipo de via: Rua, Avenida, Travessa, etc."},{pattern:"^(Apt|Apto|Sala|Bloco|Lote|Casa)\\s?\\d+.*$",label:"Complemento",description:"Complemento: Apto 123, Bloco B, Sala 3, etc."}]},{category:"Financeiro",presets:[{pattern:"^R\\$\\s?\\d{1,3}(\\.\\d{3})*(,\\d{2})?$",label:"Moeda BRL (R$)",description:"Valor em reais: R$ 1.234,56."},{pattern:"^\\$\\d{1,3}(,\\d{3})*(\\.\\d{2})?$",label:"Moeda USD ($)",description:"Valor em dólares: $1,234.56."},{pattern:"^\\d{4}[\\s-]?\\d{4}[\\s-]?\\d{4}[\\s-]?\\d{4}$",label:"Cartão de crédito",description:"Número de cartão: 1234 5678 9012 3456."},{pattern:"^(0[1-9]|1[0-2])/\\d{2}$",label:"Validade cartão (MM/AA)",description:"Data de validade: 12/25."},{pattern:"^\\d{3,4}$",label:"CVV",description:"Código de segurança: 3 ou 4 dígitos."},{pattern:"^\\d{1,6}(-[0-9Xx])?$",label:"Agência bancária",description:"Número da agência: 1234-5 ou 1234."},{pattern:"^\\d{1,12}(-[0-9Xx])?$",label:"Conta bancária",description:"Número da conta: até 12 dígitos com dígito verificador."},{pattern:"^\\d{1,3}(\\.\\d{3})*(,\\d{2})$",label:"Valor BR sem símbolo",description:"Valor monetário sem R$: 1.234,56."}]},{category:"Veículos",presets:[{pattern:"^[A-Z]{3}-?\\d{4}$",label:"Placa antiga (ABC-1234)",description:"Placa veicular formato antigo: ABC-1234."},{pattern:"^[A-Z]{3}\\d[A-Z]\\d{2}$",label:"Placa Mercosul (ABC1D23)",description:"Placa veicular Mercosul: ABC1D23."},{pattern:"^[A-Z]{3}-?\\d{4}$|^[A-Z]{3}\\d[A-Z]\\d{2}$",label:"Placa (ambos formatos)",description:"Aceita placa antiga (ABC-1234) ou Mercosul (ABC1D23)."},{pattern:"^\\d{11}$",label:"RENAVAM",description:"RENAVAM: 11 dígitos numéricos."},{pattern:"^[A-Z0-9]{17}$",label:"Chassi (VIN)",description:"Número de chassi/VIN: 17 caracteres alfanuméricos maiúsculos."}]},{category:"Códigos e identificadores",presets:[{pattern:"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",label:"UUID v4",description:"UUID formato padrão: 550e8400-e29b-41d4-a716-446655440000."},{pattern:"^[A-Za-z0-9+/]+={0,2}$",label:"Base64",description:"String codificada em Base64."},{pattern:"^[A-Za-z0-9-_]+$",label:"Base64 URL-safe",description:"Base64 com caracteres seguros para URL."},{pattern:"^[0-9a-f]{32}$",label:"MD5 hash",description:"Hash MD5: 32 caracteres hexadecimais."},{pattern:"^[0-9a-f]{40}$",label:"SHA-1 hash",description:"Hash SHA-1: 40 caracteres hexadecimais."},{pattern:"^[0-9a-f]{64}$",label:"SHA-256 hash",description:"Hash SHA-256: 64 caracteres hexadecimais."},{pattern:"^\\d{8,14}$",label:"Código de barras",description:"Código de barras numérico: 8-14 dígitos."},{pattern:"^\\d{44}$",label:"Linha digitável boleto",description:"Linha digitável de boleto: 44 dígitos."},{pattern:"^[A-Z]{2}\\d{2}[A-Z0-9]{4}\\d{7}([A-Z0-9]?){0,16}\\d{2}$",label:"IBAN",description:"Código bancário internacional IBAN."},{pattern:"^[A-Z]{4}[A-Z]{2}[A-Z0-9]{2}([A-Z0-9]{3})?$",label:"SWIFT/BIC",description:"Código SWIFT bancário: 8 ou 11 caracteres."}]},{category:"Saúde e governo",presets:[{pattern:"^\\d{15}$",label:"Cartão SUS",description:"Número do Cartão Nacional de Saúde: 15 dígitos."},{pattern:"^\\d{6,7}$",label:"CRM/CRO/CRP",description:"Número de registro profissional de saúde."},{pattern:"^\\d{3}\\.\\d{5}\\.\\d{2}-\\d$",label:"NIT/PIS",description:"Número de Identificação do Trabalhador."},{pattern:"^\\d{7}-?\\d{2}\\.\\d{4}\\.\\d\\.\\d{2}\\.\\d{4}$",label:"Processo judicial",description:"Número de processo judicial (formato CNJ)."},{pattern:"^\\d{12}$",label:"Inscrição estadual (genérica)",description:"Inscrição estadual genérica: 12 dígitos."},{pattern:"^\\d{11}$",label:"NIS/NIT",description:"Número de Identificação Social: 11 dígitos."}]},{category:"Redes sociais",presets:[{pattern:"^https?://(www\\.)?instagram\\.com/[A-Za-z0-9_.]+/?$",label:"Perfil Instagram",description:"URL de perfil do Instagram."},{pattern:"^https?://(www\\.)?facebook\\.com/.+$",label:"Perfil Facebook",description:"URL de perfil ou página do Facebook."},{pattern:"^https?://(www\\.)?linkedin\\.com/in/[A-Za-z0-9-]+/?$",label:"Perfil LinkedIn",description:"URL de perfil do LinkedIn."},{pattern:"^https?://(www\\.)?(twitter|x)\\.com/[A-Za-z0-9_]+/?$",label:"Perfil Twitter/X",description:"URL de perfil no Twitter/X."},{pattern:"^https?://(www\\.)?youtube\\.com/(c/|channel/|@)[A-Za-z0-9_-]+/?$",label:"Canal YouTube",description:"URL de canal do YouTube."},{pattern:"^https?://(www\\.)?github\\.com/[A-Za-z0-9_-]+/?$",label:"Perfil GitHub",description:"URL de perfil do GitHub."},{pattern:"^https?://(www\\.)?tiktok\\.com/@[A-Za-z0-9_.]+/?$",label:"Perfil TikTok",description:"URL de perfil do TikTok."}]},{category:"Programação",presets:[{pattern:"^[a-z][a-zA-Z0-9]*$",label:"camelCase",description:"Formato camelCase: minúscula inicial, sem espaços."},{pattern:"^[A-Z][a-zA-Z0-9]*$",label:"PascalCase",description:"Formato PascalCase: maiúscula inicial."},{pattern:"^[a-z]+(_[a-z]+)*$",label:"snake_case",description:"Formato snake_case: minúsculas separadas por underscore."},{pattern:"^[a-z]+(-[a-z]+)*$",label:"kebab-case",description:"Formato kebab-case: minúsculas separadas por hífen."},{pattern:"^[A-Z]+(_[A-Z]+)*$",label:"SCREAMING_SNAKE",description:"Constantes: MAIÚSCULAS_COM_UNDERSCORES."},{pattern:"^[a-zA-Z_$][a-zA-Z0-9_$]*$",label:"Variável JS válida",description:"Nome de variável JavaScript válido."},{pattern:"^v?\\d+\\.\\d+\\.\\d+(-[a-zA-Z0-9.]+)?$",label:"Semver",description:"Versionamento semântico: v1.2.3 ou 1.2.3-beta.1."},{pattern:"^[a-z][a-z0-9]*(-[a-z][a-z0-9]*)*$",label:"Nome de pacote npm",description:"Nome válido de pacote npm."}]}],BC=ui.flatMap(e=>e.presets),UC=({value:e,message:t,onChange:r})=>{const[n,a]=N.useState(!1),[s,i]=N.useState(""),l=N.useMemo(()=>{if(!s.trim())return ui;const u=s.toLowerCase();return ui.map(m=>({...m,presets:m.presets.filter(p=>p.label.toLowerCase().includes(u)||p.description.toLowerCase().includes(u)||p.pattern.toLowerCase().includes(u))})).filter(m=>m.presets.length>0)},[s]),c=N.useMemo(()=>e?BC.find(u=>u.pattern===e):void 0,[e]),d=u=>{r(u.pattern,`${u.label}: formato inválido`),a(!1),i("")};return o.jsxs("div",{className:"space-y-2",children:[o.jsx(ie,{className:"text-[10px]",children:"Regex"}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(ue,{value:e??"",onChange:u=>r(u.target.value||void 0,t),className:"h-7 text-xs font-mono flex-1",placeholder:"Clique no botão ou digite..."}),e&&o.jsx(De,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:()=>{r(void 0,void 0)},children:o.jsx(_.X,{className:"h-3 w-3"})}),o.jsxs(Po,{open:n,onOpenChange:a,children:[o.jsx(_o,{asChild:!0,children:o.jsx(De,{variant:"outline",size:"icon",className:"h-7 w-7 shrink-0",children:o.jsx(_.Regex,{className:"h-3.5 w-3.5"})})}),o.jsxs(fa,{className:"w-[360px] p-0",side:"left",align:"start",sideOffset:8,children:[o.jsx("div",{className:"p-2 border-b",children:o.jsxs("div",{className:"relative",children:[o.jsx(_.Search,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),o.jsx(ue,{value:s,onChange:u=>i(u.target.value),className:"h-8 text-xs pl-7",placeholder:"Buscar regex (ex: CPF, e-mail, senha)...",autoFocus:!0})]})}),o.jsx(Vo,{className:"h-[360px]",children:o.jsxs("div",{className:"p-1",children:[l.length===0&&o.jsx("p",{className:"text-xs text-muted-foreground text-center py-8",children:"Nenhum regex encontrado"}),l.map(u=>o.jsxs("div",{className:"mb-1",children:[o.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wide px-2 py-1.5 sticky top-0 bg-popover z-10",children:u.category}),u.presets.map(m=>o.jsxs(Of,{children:[o.jsx(Ff,{asChild:!0,children:o.jsxs("button",{onClick:()=>d(m),className:"w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left hover:bg-accent transition-colors group",children:[o.jsx(_.ChevronRight,{className:"h-3 w-3 text-muted-foreground/50 group-hover:text-primary shrink-0"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("span",{className:"text-xs font-medium block truncate",children:m.label}),o.jsx("span",{className:"text-[10px] text-muted-foreground font-mono block truncate",children:m.pattern})]})]})}),o.jsxs(sl,{side:"left",className:"max-w-[250px] text-xs",children:[o.jsx("p",{className:"font-semibold mb-1",children:m.label}),o.jsx("p",{children:m.description})]})]},m.pattern+m.label))]},u.category))]})})]})]})]}),c&&o.jsxs(Di,{variant:"secondary",className:"text-[10px] font-normal gap-1",children:[o.jsx(_.Regex,{className:"h-2.5 w-2.5"}),c.label]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-[10px]",children:"Mensagem do regex"}),o.jsx(ue,{value:t??"",onChange:u=>r(e,u.target.value||void 0),className:"h-7 text-xs",placeholder:"Formato inválido"})]})]})},mi=[{category:"Imagens",presets:[{value:"image/jpeg",label:"JPEG",description:"Imagem JPEG — formato mais comum para fotos. Boa compressão, perde qualidade."},{value:"image/png",label:"PNG",description:"Imagem PNG — suporta transparência, sem perda de qualidade. Arquivos maiores."},{value:"image/gif",label:"GIF",description:"Imagem GIF — suporta animações simples e transparência. Limitado a 256 cores."},{value:"image/webp",label:"WebP",description:"Formato moderno do Google — compressão superior ao JPEG e PNG."},{value:"image/svg+xml",label:"SVG",description:"Imagem vetorial XML — escalável sem perda. Ideal para logos e ícones."},{value:"image/bmp",label:"BMP",description:"Bitmap — sem compressão, arquivos muito grandes."},{value:"image/tiff",label:"TIFF",description:"Imagem TIFF — alta qualidade, usado em impressão profissional."},{value:"image/avif",label:"AVIF",description:"Formato moderno — melhor compressão que WebP, suporte crescente."},{value:"image/heic",label:"HEIC",description:"Formato padrão do iPhone — alta qualidade, tamanho reduzido."},{value:"image/*",label:"Qualquer imagem",description:"Aceita todos os formatos de imagem (JPEG, PNG, GIF, WebP, etc.)."}]},{category:"Documentos",presets:[{value:"application/pdf",label:"PDF",description:"Documento PDF — formato universal para documentos. Preserva formatação."},{value:"application/msword",label:"DOC (Word antigo)",description:"Microsoft Word 97-2003 (.doc)."},{value:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",label:"DOCX (Word)",description:"Microsoft Word moderno (.docx) — formato atual do Word."},{value:"application/vnd.ms-excel",label:"XLS (Excel antigo)",description:"Microsoft Excel 97-2003 (.xls)."},{value:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",label:"XLSX (Excel)",description:"Microsoft Excel moderno (.xlsx) — formato atual do Excel."},{value:"application/vnd.ms-powerpoint",label:"PPT (PowerPoint antigo)",description:"Microsoft PowerPoint 97-2003 (.ppt)."},{value:"application/vnd.openxmlformats-officedocument.presentationml.presentation",label:"PPTX (PowerPoint)",description:"Microsoft PowerPoint moderno (.pptx)."},{value:"application/vnd.oasis.opendocument.text",label:"ODT (LibreOffice)",description:"Documento de texto LibreOffice/OpenOffice (.odt)."},{value:"application/vnd.oasis.opendocument.spreadsheet",label:"ODS (LibreOffice)",description:"Planilha LibreOffice/OpenOffice (.ods)."},{value:"application/rtf",label:"RTF",description:"Rich Text Format — compatível com quase todos os editores de texto."},{value:"text/plain",label:"TXT",description:"Texto puro sem formatação (.txt)."},{value:"text/csv",label:"CSV",description:"Valores separados por vírgula — planilhas simples e dados tabulares."}]},{category:"Vídeos",presets:[{value:"video/mp4",label:"MP4",description:"Vídeo MP4 — formato mais compatível, boa compressão (H.264/H.265)."},{value:"video/webm",label:"WebM",description:"Vídeo WebM — formato aberto do Google, boa compressão."},{value:"video/quicktime",label:"MOV",description:"Vídeo QuickTime — formato padrão do macOS/iPhone."},{value:"video/x-msvideo",label:"AVI",description:"Vídeo AVI — formato antigo da Microsoft, arquivos grandes."},{value:"video/x-matroska",label:"MKV",description:"Matroska — contêiner flexível, suporta múltiplas faixas de áudio/legenda."},{value:"video/*",label:"Qualquer vídeo",description:"Aceita todos os formatos de vídeo."}]},{category:"Áudios",presets:[{value:"audio/mpeg",label:"MP3",description:"Áudio MP3 — formato mais popular, boa compressão com perda."},{value:"audio/wav",label:"WAV",description:"Áudio WAV — sem compressão, alta qualidade, arquivos grandes."},{value:"audio/ogg",label:"OGG",description:"Áudio OGG Vorbis — formato aberto, boa qualidade."},{value:"audio/aac",label:"AAC",description:"Áudio AAC — qualidade superior ao MP3 no mesmo bitrate."},{value:"audio/flac",label:"FLAC",description:"Áudio FLAC — compressão sem perda, alta fidelidade."},{value:"audio/webm",label:"WebM Áudio",description:"Áudio no contêiner WebM."},{value:"audio/*",label:"Qualquer áudio",description:"Aceita todos os formatos de áudio."}]},{category:"Compactados",presets:[{value:"application/zip",label:"ZIP",description:"Arquivo compactado ZIP — o mais universal."},{value:"application/x-rar-compressed",label:"RAR",description:"Arquivo compactado RAR — boa compressão, formato proprietário."},{value:"application/gzip",label:"GZ / GZIP",description:"Compactação GZIP — muito usado em ambientes Unix/Linux."},{value:"application/x-7z-compressed",label:"7Z",description:"Arquivo 7-Zip — excelente taxa de compressão."},{value:"application/x-tar",label:"TAR",description:"TAR — agrupa arquivos sem compressão (usado com gzip)."}]},{category:"Dados / Código",presets:[{value:"application/json",label:"JSON",description:"Dados JSON — formato leve para troca de dados."},{value:"application/xml",label:"XML",description:"Dados XML — formato de marcação extensível."},{value:"text/html",label:"HTML",description:"Página web HTML."},{value:"text/css",label:"CSS",description:"Folha de estilo CSS."},{value:"application/javascript",label:"JavaScript",description:"Código JavaScript (.js)."},{value:"application/x-yaml",label:"YAML",description:"Dados YAML — formato legível para configurações."},{value:"text/markdown",label:"Markdown",description:"Texto Markdown (.md) — formatação leve."}]},{category:"Fontes",presets:[{value:"font/ttf",label:"TTF",description:"Fonte TrueType — amplamente suportada."},{value:"font/otf",label:"OTF",description:"Fonte OpenType — recursos tipográficos avançados."},{value:"font/woff",label:"WOFF",description:"Web Open Font Format — otimizado para web."},{value:"font/woff2",label:"WOFF2",description:"WOFF2 — compressão superior ao WOFF."}]},{category:"Atalhos comuns",presets:[{value:"image/*",label:"Todas as imagens",description:"Aceita qualquer formato de imagem."},{value:"video/*",label:"Todos os vídeos",description:"Aceita qualquer formato de vídeo."},{value:"audio/*",label:"Todos os áudios",description:"Aceita qualquer formato de áudio."},{value:"_group_documentos",label:"Documentos comuns",description:"PDF + Word .doc e .docx.",group:["application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document"]},{value:"_group_imagens_web",label:"Imagens web",description:"JPEG, PNG e WebP — formatos mais usados na web.",group:["image/jpeg","image/png","image/webp"]},{value:"_group_planilhas",label:"Planilhas",description:"Excel .xls, .xlsx e CSV.",group:["application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","text/csv"]}]}],HC=mi.flatMap(e=>e.presets),WC=({value:e,onChange:t})=>{const[r,n]=N.useState(!1),[a,s]=N.useState(""),[i,l]=N.useState(""),c=N.useMemo(()=>new Set(e??[]),[e]),d=N.useMemo(()=>{if(!a.trim())return mi;const b=a.toLowerCase();return mi.map(h=>({...h,presets:h.presets.filter(x=>x.label.toLowerCase().includes(b)||x.description.toLowerCase().includes(b)||x.value.toLowerCase().includes(b))})).filter(h=>h.presets.length>0)},[a]),u=b=>{const h=new Set(e??[]);b.group?b.group.every(x=>h.has(x))?b.group.forEach(x=>h.delete(x)):b.group.forEach(x=>h.add(x)):h.has(b.value)?h.delete(b.value):h.add(b.value),t(h.size>0?Array.from(h):void 0)},m=()=>{const b=i.trim();if(!b)return;const h=new Set(e??[]);h.add(b),t(Array.from(h)),l("")},p=b=>{const h=new Set(e??[]);h.delete(b),t(h.size>0?Array.from(h):void 0)},f=b=>{const h=HC.find(x=>x.value===b);return(h==null?void 0:h.label)??b};return o.jsxs("div",{className:"space-y-2",children:[o.jsx(ie,{className:"text-[10px]",children:"Tipos de arquivo aceitos"}),((e==null?void 0:e.length)??0)>0&&o.jsx("div",{className:"flex flex-wrap gap-1",children:e.map(b=>o.jsxs(Di,{variant:"secondary",className:"text-[10px] gap-1 pr-1",children:[f(b),o.jsx("button",{onClick:()=>p(b),className:"hover:text-destructive",children:o.jsx(_.X,{className:"h-2.5 w-2.5"})})]},b))}),o.jsxs(Po,{open:r,onOpenChange:n,children:[o.jsx(_o,{asChild:!0,children:o.jsxs(De,{variant:"outline",className:"w-full h-8 text-xs justify-start gap-2",children:[o.jsx(_.FileType2,{className:"h-3.5 w-3.5"}),((e==null?void 0:e.length)??0)>0?`${e.length} tipo(s) selecionado(s)`:"Selecionar tipos de arquivo..."]})}),o.jsxs(fa,{className:"w-[360px] p-0",side:"left",align:"start",sideOffset:8,children:[o.jsx("div",{className:"p-2 border-b",children:o.jsxs("div",{className:"relative",children:[o.jsx(_.Search,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),o.jsx(ue,{value:a,onChange:b=>s(b.target.value),className:"h-8 text-xs pl-7",placeholder:"Buscar tipos (ex: PDF, imagem, vídeo)...",autoFocus:!0})]})}),o.jsxs("div",{className:"px-2 py-1.5 border-b flex gap-1",children:[o.jsx(ue,{value:i,onChange:b=>l(b.target.value),className:"h-7 text-xs font-mono flex-1",placeholder:"Tipo customizado (ex: .dwg)",onKeyDown:b=>b.key==="Enter"&&m()}),o.jsx(De,{variant:"secondary",size:"sm",className:"h-7 text-xs shrink-0",onClick:m,disabled:!i.trim(),children:"Adicionar"})]}),o.jsx(Vo,{className:"h-[320px]",children:o.jsxs("div",{className:"p-1",children:[d.length===0&&o.jsx("p",{className:"text-xs text-muted-foreground text-center py-8",children:"Nenhum tipo encontrado"}),d.map(b=>o.jsxs("div",{className:"mb-1",children:[o.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wide px-2 py-1.5 sticky top-0 bg-popover z-10",children:b.category}),b.presets.map(h=>{const x=h.group?h.group.every(v=>c.has(v)):c.has(h.value),y=h.group?h.group.some(v=>c.has(v))&&!x:!1;return o.jsxs(Of,{children:[o.jsx(Ff,{asChild:!0,children:o.jsxs("button",{onClick:()=>u(h),className:"w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left hover:bg-accent transition-colors",children:[o.jsx(et,{checked:y?"indeterminate":x,className:"h-3.5 w-3.5",tabIndex:-1}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("span",{className:"text-xs font-medium",children:h.label}),!h.group&&o.jsx("span",{className:"text-[10px] text-muted-foreground font-mono ml-2",children:h.value}),h.group&&o.jsxs("span",{className:"text-[10px] text-muted-foreground ml-2",children:[h.group.length," tipos"]})]}),o.jsx(_.Info,{className:"h-3 w-3 text-muted-foreground/40 shrink-0"})]})}),o.jsxs(sl,{side:"left",className:"max-w-[250px] text-xs",children:[o.jsx("p",{className:"font-semibold mb-1",children:h.label}),o.jsx("p",{children:h.description}),h.group&&o.jsx("ul",{className:"mt-1 space-y-0.5",children:h.group.map(v=>o.jsx("li",{className:"font-mono text-[10px] opacity-80",children:v},v))})]})]},h.value)})]},b.category))]})})]})]})]})},Zh=1048576,no=1073741824;function pd(e){return e>=no&&e%no===0?"GB":"MB"}function fd(e,t){return t==="GB"?e/no:e/Zh}function hd(e,t){return Math.round(e*(t==="GB"?no:Zh))}const qC=({value:e,onChange:t})=>{const r=N.useMemo(()=>e?pd(e):"MB",[]),[n,a]=N.useState(r),[s,i]=N.useState(e?String(fd(e,r)):"");N.useEffect(()=>{if(e===void 0){i("");return}const d=pd(e);a(d),i(String(fd(e,d)))},[e]);const l=d=>{i(d);const u=parseFloat(d);d.trim()===""||isNaN(u)||u<=0?t(void 0):t(hd(u,n))},c=d=>{a(d);const u=parseFloat(s);!isNaN(u)&&u>0&&t(hd(u,d))};return o.jsxs("div",{className:"space-y-1.5",children:[o.jsx(ie,{className:"text-[10px]",children:"Tamanho máximo do arquivo"}),o.jsxs("div",{className:"flex gap-1.5",children:[o.jsx(ue,{type:"number",min:0,step:"any",value:s,onChange:d=>l(d.target.value),placeholder:"Ex: 10",className:"h-8 text-xs flex-1"}),o.jsxs(Bt,{value:n,onValueChange:d=>c(d),children:[o.jsx(Rt,{className:"w-[72px] h-8 text-xs",children:o.jsx(Ut,{})}),o.jsxs(It,{children:[o.jsx(qe,{value:"MB",children:"MB"}),o.jsx(qe,{value:"GB",children:"GB"})]})]})]}),e!==void 0&&o.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["= ",e.toLocaleString("pt-BR")," bytes"]})]})},GC=new Set(["texto","textarea","email","password","url","phone","tel","cpf","cnpj","cep","rg"]),XC=({fieldType:e,validation:t,onChange:r})=>{const n=(i,l)=>{const c=["minLength","maxLength","min","max","maxFileSize","minAge","maxAge"].includes(i)?l?Number(l):void 0:l||void 0;r({...t,[i]:c})},a=e==="file",s=GC.has(e);return o.jsxs("div",{className:"space-y-3",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase",children:"Validação"}),s&&o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-[10px]",children:"Min caracteres"}),o.jsx(ue,{type:"number",min:0,value:(t==null?void 0:t.minLength)??"",onChange:i=>n("minLength",i.target.value),className:"h-7 text-xs"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-[10px]",children:"Max caracteres"}),o.jsx(ue,{type:"number",min:0,value:(t==null?void 0:t.maxLength)??"",onChange:i=>n("maxLength",i.target.value),className:"h-7 text-xs"})]})]}),e==="number"&&o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-[10px]",children:"Valor mínimo"}),o.jsx(ue,{type:"number",value:(t==null?void 0:t.min)??"",onChange:i=>n("min",i.target.value),className:"h-7 text-xs"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-[10px]",children:"Valor máximo"}),o.jsx(ue,{type:"number",value:(t==null?void 0:t.max)??"",onChange:i=>n("max",i.target.value),className:"h-7 text-xs"})]})]}),(e==="date"||e==="datetime")&&o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-[10px]",children:"Data mínima"}),o.jsx(ue,{type:"date",value:(t==null?void 0:t.minDate)??"",onChange:i=>n("minDate",i.target.value),className:"h-7 text-xs"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-[10px]",children:"Data máxima"}),o.jsx(ue,{type:"date",value:(t==null?void 0:t.maxDate)??"",onChange:i=>n("maxDate",i.target.value),className:"h-7 text-xs"})]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-[10px]",children:"Idade mínima (anos)"}),o.jsx(ue,{type:"number",min:0,value:(t==null?void 0:t.minAge)??"",onChange:i=>n("minAge",i.target.value),className:"h-7 text-xs",placeholder:"ex: 18"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-[10px]",children:"Idade máxima (anos)"}),o.jsx(ue,{type:"number",min:0,value:(t==null?void 0:t.maxAge)??"",onChange:i=>n("maxAge",i.target.value),className:"h-7 text-xs",placeholder:"ex: 60"})]})]})]}),a&&o.jsxs("div",{className:"space-y-3",children:[o.jsx(WC,{value:t==null?void 0:t.fileTypes,onChange:i=>r({...t,fileTypes:i})}),o.jsx(qC,{value:t==null?void 0:t.maxFileSize,onChange:i=>r({...t,maxFileSize:i})})]}),!a&&o.jsx(UC,{value:(t==null?void 0:t.regex)??"",message:(t==null?void 0:t.regexMessage)??"",onChange:(i,l)=>r({...t,regex:i,regexMessage:l})})]})},Kh=({options:e,onChange:t})=>{const r=N.useRef([]);if(r.current.length<e.length)for(let i=r.current.length;i<e.length;i++)r.current.push(`opt-${Math.random().toString(36).slice(2)}`);const n=N.useCallback((i,l,c)=>{const d=[...e];d[i]={...d[i],[l]:c},t(d)},[e,t]),a=N.useCallback(i=>{r.current.splice(i,1),t(e.filter((l,c)=>c!==i))},[e,t]),s=N.useCallback(()=>{t([...e,{value:"",label:""}])},[e,t]);return o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase",children:"Opções"}),e.map((i,l)=>o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(_.GripVertical,{className:"h-3 w-3 text-muted-foreground/40 shrink-0"}),o.jsx(ue,{value:i.value,onChange:c=>n(l,"value",c.target.value),className:"h-7 text-xs flex-1",placeholder:"Valor"}),o.jsxs("div",{className:"flex items-center gap-0.5 flex-1",children:[o.jsx(ue,{value:i.label,onChange:c=>n(l,"label",c.target.value),className:"h-7 text-xs flex-1",placeholder:"Label"}),o.jsx(yr,{})]}),o.jsx(De,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:()=>a(l),children:o.jsx(_.Trash2,{className:"h-3 w-3"})})]},r.current[l])),o.jsxs(De,{variant:"outline",size:"sm",className:"w-full h-7 text-xs",onClick:s,children:[o.jsx(_.Plus,{className:"h-3 w-3 mr-1"})," Adicionar opção"]})]})},ZC=[{value:"igual",label:"Igual a"},{value:"diferente",label:"Diferente de"},{value:"vazio",label:"Vazio"},{value:"naoVazio",label:"Não vazio"},{value:"contem",label:"Contém"},{value:"naoContem",label:"Não contém"},{value:"maiorQue",label:"Maior que"},{value:"menorQue",label:"Menor que"},{value:"maiorOuIgual",label:"Maior ou igual a"},{value:"menorOuIgual",label:"Menor ou igual a"}],KC=["vazio","naoVazio"],xd=({cond:e,selectedId:t,allFieldIds:r,getFieldLabel:n,onUpdate:a})=>o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-[10px]",children:"Fonte"}),o.jsxs(Bt,{value:e.source||"campo",onValueChange:s=>a({source:s,when:""}),children:[o.jsx(Rt,{className:"h-7 text-xs",children:o.jsx(Ut,{})}),o.jsxs(It,{children:[o.jsx(qe,{value:"campo",children:"Campo do formulário"}),o.jsx(qe,{value:"evento",children:"Variável do evento"})]})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-[10px]",children:e.source==="evento"?"Variável do evento":"Quando o campo"}),o.jsxs(Bt,{value:e.when||"",onValueChange:s=>a({when:s}),children:[o.jsx(Rt,{className:"h-7 text-xs",children:o.jsx(Ut,{placeholder:e.source==="evento"?"Selecione uma variável...":"Selecione um campo..."})}),o.jsx(It,{children:e.source==="evento"?bl.map(s=>o.jsx(qe,{value:s.key,children:s.label},s.key)):r.filter(s=>s!==t).map(s=>o.jsxs(qe,{value:s,children:[n(s),o.jsxs("span",{className:"text-muted-foreground/50 ml-1 text-[9px] font-mono",children:["(",s,")"]})]},s))})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-[10px]",children:"Operador"}),o.jsxs(Bt,{value:e.operator,onValueChange:s=>a({operator:s}),children:[o.jsx(Rt,{className:"h-7 text-xs",children:o.jsx(Ut,{})}),o.jsx(It,{children:ZC.map(s=>o.jsx(qe,{value:s.value,children:s.label},s.value))})]})]}),!KC.includes(e.operator)&&o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-[10px]",children:"Valor"}),o.jsx(ue,{value:e.value||"",onChange:s=>a({value:s.target.value}),className:"h-7 text-xs",placeholder:"Valor esperado"})]})]}),YC=({condition:e,selectedId:t,allFieldIds:r,getFieldLabel:n,onChange:a})=>{var s;const i=m=>{e&&a({...e,...m})},l=()=>{if(!e)return;const m=e.extraConditions??[];a({...e,logicOperator:e.logicOperator??"and",extraConditions:[...m,{when:"",operator:"igual",value:"",source:"campo"}]})},c=m=>{if(!e)return;const p=(e.extraConditions??[]).filter((f,b)=>b!==m);a({...e,extraConditions:p,logicOperator:p.length?e.logicOperator:void 0})},d=(m,p)=>{if(!e)return;const f=(e.extraConditions??[]).map((b,h)=>h===m?{...b,...p}:b);a({...e,extraConditions:f})},u=(((s=e==null?void 0:e.extraConditions)==null?void 0:s.length)??0)>0;return o.jsxs("div",{className:"space-y-3",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase",children:"Condicional"}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(et,{id:"has-condition",checked:!!e,onCheckedChange:m=>{a(m?{when:"",operator:"igual",value:"",source:"campo"}:void 0)}}),o.jsx(ie,{htmlFor:"has-condition",className:"text-xs cursor-pointer",children:"Exibir condicionalmente"})]}),e&&o.jsxs("div",{className:"space-y-2 pl-2 border-l-2 border-amber-500/30",children:[o.jsx(xd,{cond:e,selectedId:t,allFieldIds:r,getFieldLabel:n,onUpdate:i}),u&&o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-[10px]",children:"Lógica"}),o.jsxs(Bt,{value:e.logicOperator??"and",onValueChange:m=>i({logicOperator:m}),children:[o.jsx(Rt,{className:"h-7 text-xs",children:o.jsx(Ut,{})}),o.jsxs(It,{children:[o.jsx(qe,{value:"and",children:"E (AND) — todas devem ser verdadeiras"}),o.jsx(qe,{value:"or",children:"OU (OR) — pelo menos uma deve ser verdadeira"})]})]})]}),(e.extraConditions??[]).map((m,p)=>o.jsxs("div",{className:"space-y-2 pt-2 border-t border-border/40",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("span",{className:"text-[10px] text-muted-foreground font-medium uppercase",children:[e.logicOperator==="or"?"OU":"E"," — condição"," ",p+2]}),o.jsx(De,{variant:"ghost",size:"sm",className:"h-5 px-1 text-[10px] text-destructive hover:text-destructive",onClick:()=>c(p),children:"Remover"})]}),o.jsx(xd,{cond:m,selectedId:t,allFieldIds:r,getFieldLabel:n,onUpdate:f=>d(p,f)})]},p)),o.jsx(De,{variant:"outline",size:"sm",className:"h-6 text-[10px] w-full mt-1",onClick:l,children:"+ Adicionar condição"})]})]})},gd=[{value:"texto",label:"Texto"},{value:"textarea",label:"Área de texto"},{value:"number",label:"Número"},{value:"email",label:"E-mail"},{value:"telefone",label:"Telefone"},{value:"cpf",label:"CPF"},{value:"cep",label:"CEP"},{value:"date",label:"Data"},{value:"datetime",label:"Data e hora"},{value:"select",label:"Seleção"},{value:"radio",label:"Radio"},{value:"checkbox",label:"Checkbox"}],JC=({subFields:e,onChange:t})=>{const[r,n]=N.useState(null),a=(i,l)=>{const c=e.map((d,u)=>u===i?{...d,...l}:d);t(c)},s=i=>{t(e.filter((l,c)=>c!==i)),n(null)};return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(ie,{className:"text-xs font-semibold",children:"Sub-campos"}),o.jsxs(De,{type:"button",variant:"ghost",size:"sm",className:"h-6 px-2 text-xs gap-1",onClick:()=>{const i={label:"Novo campo",name:`campo_${e.length+1}`,fieldType:"texto",required:!1};t([...e,i]),n(e.length)},children:[o.jsx(_.Plus,{className:"w-3 h-3"}),"Adicionar"]})]}),e.length===0&&o.jsx("p",{className:"text-[11px] text-muted-foreground italic py-1",children:"Nenhum sub-campo adicionado."}),e.map((i,l)=>{var c;return o.jsxs("div",{className:"border rounded-md text-xs overflow-hidden",children:[o.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 cursor-pointer hover:bg-muted/40 select-none",onClick:()=>n(r===l?null:l),children:[o.jsx(Di,{variant:"secondary",className:"h-4 text-[9px] px-1 shrink-0",children:l+1}),o.jsx("span",{className:"flex-1 truncate font-medium",children:i.label||i.name||"Campo sem nome"}),o.jsx("span",{className:"text-muted-foreground text-[10px] shrink-0",children:((c=gd.find(d=>d.value===i.fieldType))==null?void 0:c.label)??i.fieldType}),o.jsx(De,{type:"button",variant:"ghost",size:"icon",className:"h-5 w-5 text-destructive hover:text-destructive shrink-0",onClick:d=>{d.stopPropagation(),s(l)},children:o.jsx(_.Trash2,{className:"w-3 h-3"})}),r===l?o.jsx(_.ChevronUp,{className:"w-3 h-3 text-muted-foreground shrink-0"}):o.jsx(_.ChevronDown,{className:"w-3 h-3 text-muted-foreground shrink-0"})]}),r===l&&o.jsxs("div",{className:"px-2 pb-2 space-y-2 border-t bg-muted/20",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-2 pt-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-[10px]",children:"Label"}),o.jsx(ue,{value:i.label,onChange:d=>a(l,{label:d.target.value}),className:"h-7 text-xs",placeholder:"Ex: Nome"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-[10px]",children:"Nome (campo)"}),o.jsx(ue,{value:i.name||"",onChange:d=>a(l,{name:d.target.value}),className:"h-7 text-xs",placeholder:"Ex: nome"})]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-[10px]",children:"Tipo de campo"}),o.jsxs(Bt,{value:i.fieldType,onValueChange:d=>a(l,{fieldType:d}),children:[o.jsx(Rt,{className:"h-7 text-xs",children:o.jsx(Ut,{})}),o.jsx(It,{children:gd.map(d=>o.jsx(qe,{value:d.value,className:"text-xs",children:d.label},d.value))})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-[10px]",children:"Colunas (1-12)"}),o.jsx(ue,{type:"number",min:1,max:12,value:i.tamanho??"",onChange:d=>a(l,{tamanho:d.target.value?Number(d.target.value):void 0}),className:"h-7 text-xs",placeholder:"12"})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-[10px]",children:"Placeholder"}),o.jsx(ue,{value:i.placeholder||"",onChange:d=>a(l,{placeholder:d.target.value}),className:"h-7 text-xs",placeholder:"Texto de exemplo..."})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(et,{id:`sf-req-${l}`,checked:i.required||!1,onCheckedChange:d=>a(l,{required:d===!0})}),o.jsx(ie,{htmlFor:`sf-req-${l}`,className:"text-[10px] cursor-pointer",children:"Obrigatório"})]}),["select","radio","checkbox_group"].includes(i.fieldType)&&o.jsx("div",{className:"pt-1",children:o.jsx(Kh,{options:i.options||[],onChange:d=>a(l,{options:d})})})]})]},l)}),e.length>0&&o.jsx(it,{className:"mt-1"})]})},QC=({config:e,selectedId:t,allFieldIds:r,getFieldLabel:n,onUpdate:a})=>{const s=e.fieldType||"texto",i=["select","radio","checkbox_group","autocomplete"].includes(s),l=s==="field_array",c=e.locked===!0,d=s==="participation_type",u=s==="payment_method",m=s==="terms",p=s==="file",f=s==="slider",b=!!(e.isDisabled||e.isReadOnly),h=s==="rating",x=s==="date_range",y=s==="sub_form",{schemaId:v,uploadTermsPdf:j,deleteTermsPdf:w}=gt(),[C,S]=N.useState(e.termoPdfUploadId?"upload":"link"),[$,k]=N.useState({status:"idle"}),E=N.useRef(null),D=N.useRef(!0);N.useEffect(()=>()=>{D.current=!1},[]);const O=N.useCallback(async A=>{if(a({termoPdfUploadId:void 0}),w&&v)try{await w(A,v)}catch{}},[w,v,a]),L=N.useCallback(async A=>{if(A.type!=="application/pdf"){k({status:"error",message:"Apenas arquivos PDF são permitidos."});return}if(!v){k({status:"error",message:"Salve o schema primeiro para habilitar o upload de PDF."});return}if(!j){k({status:"error",message:"Upload de PDF não configurado. Forneça a prop uploadTermsPdf ao BuilderProvider."});return}const z=e.termoPdfUploadId;k({status:"uploading",fileName:A.name,progress:0});try{const X=await j(A,v,q=>k(Z=>Z.status==="uploading"?{...Z,progress:q}:Z));if(!D.current)return;if(z&&w)try{await w(z,v)}catch{}if(!D.current)return;a({termoPdfUploadId:X,termoPdfUrl:void 0}),k({status:"idle"})}catch(X){if(!D.current)return;k({status:"error",message:X instanceof Error?X.message:"Falha no upload do PDF."})}},[v,j,w,e.termoPdfUploadId,a]);return o.jsxs("div",{className:"space-y-4",children:[c&&o.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-amber-500/10 border border-amber-500/30 px-3 py-2",children:[o.jsx(_.Lock,{className:"h-4 w-4 text-amber-500 shrink-0"}),o.jsxs("div",{children:[o.jsx("p",{className:"text-xs font-medium text-amber-600 dark:text-amber-400",children:"Campo bloqueado"}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Tipo, nome e ID são fixos (integração automática)"})]})]}),d&&o.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-primary/5 border border-primary/30 px-3 py-2",children:[o.jsx(_.Lock,{className:"h-4 w-4 text-primary shrink-0"}),o.jsxs("div",{children:[o.jsx("p",{className:"text-xs font-medium text-primary",children:"Tipo de Participação"}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Datas, preços e vagas são carregados automaticamente do evento"})]})]}),m&&o.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-primary/5 border border-primary/30 px-3 py-2",children:[o.jsx(_.ScrollText,{className:"h-4 w-4 text-primary shrink-0"}),o.jsxs("div",{children:[o.jsx("p",{className:"text-xs font-medium text-primary",children:"Termos e Condições"}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Configure o texto ou URL do PDF abaixo"})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(ie,{className:"text-xs",children:"Label"}),o.jsx(yr,{})]}),o.jsx(ue,{value:e.label,onChange:A=>a({label:A.target.value}),className:"h-8 text-sm"})]}),d||u?o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Dica (hint)"}),o.jsx(ue,{value:e.hint||"",onChange:A=>a({hint:A.target.value}),className:"h-8 text-sm",placeholder:"Texto de ajuda abaixo do campo"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(et,{id:"req",checked:e.required||!1,onCheckedChange:A=>a({required:A===!0})}),o.jsx(ie,{htmlFor:"req",className:"text-xs cursor-pointer",children:"Campo obrigatório"})]})]}):m?o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Dica (hint)"}),o.jsx(ue,{value:e.hint||"",onChange:A=>a({hint:A.target.value}),className:"h-8 text-sm",placeholder:"Ex: Leia os termos antes de continuar"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(et,{id:"req",checked:e.required||!1,onCheckedChange:A=>a({required:A===!0})}),o.jsx(ie,{htmlFor:"req",className:"text-xs cursor-pointer",children:"Campo obrigatório"})]}),o.jsx(it,{}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Conteúdo dos termos"}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Texto dos termos"}),o.jsx(po,{value:e.termoTexto||"",onChange:A=>a({termoTexto:A.target.value||void 0}),className:"text-sm min-h-[120px] resize-y",placeholder:"Escreva aqui os termos e condições que o usuário deverá ler e aceitar..."})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ie,{className:"text-xs",children:"PDF dos termos (opcional)"}),o.jsxs("div",{className:"flex gap-1 p-0.5 bg-muted rounded-md",children:[o.jsx("button",{type:"button",onClick:()=>S("link"),className:`flex-1 text-[11px] py-1 rounded transition-colors ${C==="link"?"bg-background shadow-sm font-medium":"text-muted-foreground hover:text-foreground"}`,children:"Link externo"}),o.jsx("button",{type:"button",onClick:()=>S("upload"),className:`flex-1 text-[11px] py-1 rounded transition-colors ${C==="upload"?"bg-background shadow-sm font-medium":"text-muted-foreground hover:text-foreground"}`,children:"Upload de PDF"})]}),C==="link"?o.jsxs("div",{className:"space-y-1",children:[o.jsx(ue,{value:e.termoPdfUrl||"",onChange:A=>a({termoPdfUrl:A.target.value||void 0}),className:"h-8 text-sm",placeholder:"https://exemplo.com/termos.pdf"}),o.jsx("p",{className:"text-[9px] text-muted-foreground",children:"URL pública de um PDF. Tem prioridade sobre o texto acima."})]}):o.jsxs("div",{className:"space-y-2",children:[e.termoPdfUploadId&&$.status==="idle"?o.jsxs("div",{className:"flex items-center gap-2 rounded border border-green-500/40 bg-green-500/10 px-2 py-1.5",children:[o.jsx(_.CheckCircle2,{className:"h-3.5 w-3.5 text-green-600 shrink-0"}),o.jsx("span",{className:"text-[11px] text-green-700 dark:text-green-400 flex-1",children:"PDF enviado ✓"}),o.jsx(De,{type:"button",variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>O(e.termoPdfUploadId),children:o.jsx(_.X,{className:"h-3 w-3"})})]}):null,$.status==="uploading"?o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-muted-foreground",children:[o.jsx(_.Loader2,{className:"h-3.5 w-3.5 animate-spin"}),o.jsx("span",{className:"truncate",children:$.fileName}),o.jsxs("span",{className:"ml-auto",children:[$.progress,"%"]})]}),o.jsx(el,{value:$.progress,className:"h-1"})]}):null,$.status==="error"?o.jsxs("div",{className:"flex items-center gap-2 rounded border border-destructive/40 bg-destructive/10 px-2 py-1.5",children:[o.jsx(_.AlertCircle,{className:"h-3.5 w-3.5 text-destructive shrink-0"}),o.jsx("span",{className:"text-[11px] text-destructive",children:$.message}),o.jsx(De,{type:"button",variant:"ghost",size:"icon",className:"h-5 w-5 ml-auto",onClick:()=>k({status:"idle"}),children:o.jsx(_.X,{className:"h-3 w-3"})})]}):null,$.status!=="uploading"?o.jsxs(o.Fragment,{children:[o.jsx("input",{ref:E,type:"file",accept:"application/pdf",className:"hidden",onChange:A=>{var z;const X=(z=A.target.files)==null?void 0:z[0];X&&L(X),A.target.value=""}}),o.jsxs(De,{type:"button",variant:"outline",size:"sm",className:"w-full h-8 text-xs gap-1.5",disabled:!v,onClick:()=>{var A;return(A=E.current)==null?void 0:A.click()},children:[o.jsx(_.Upload,{className:"h-3.5 w-3.5"}),e.termoPdfUploadId?"Substituir PDF":"Selecionar PDF"]}),!v&&o.jsx("p",{className:"text-[9px] text-muted-foreground",children:"Salve o schema uma vez para habilitar o upload."})]}):null]})]})]})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Nome (chave)"}),o.jsx(ue,{value:e.name||t.replace(/^field_/,""),onChange:A=>!c&&a({name:A.target.value}),className:"h-8 text-xs font-mono",placeholder:"nome_do_campo",disabled:c}),c?o.jsx("p",{className:"text-[9px] text-amber-500",children:"ID fixo — necessário para auto-preenchimento"}):o.jsx("p",{className:"text-[9px] text-muted-foreground",children:"Usado como chave no JSON do formulário"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Tipo do campo"}),o.jsxs(Bt,{value:s,onValueChange:A=>!c&&a({fieldType:A}),disabled:c,children:[o.jsx(Rt,{className:"h-8 text-sm",children:o.jsx(Ut,{})}),o.jsx(It,{children:Or.map(A=>o.jsx(qe,{value:A.component,children:A.label},A.component))})]})]}),o.jsx(Xh,{tamanho:e.tamanho||6,inicioColuna:e.inicioColuna||1,defaultTamanho:6,onTamanhoChange:A=>a({tamanho:A}),onPositionChange:A=>a({inicioColuna:A})}),s!=="file"&&!l&&o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(ie,{className:"text-xs",children:"Placeholder"}),o.jsx(yr,{})]}),o.jsx(ue,{value:e.placeholder||"",onChange:A=>a({placeholder:A.target.value}),className:"h-8 text-sm",placeholder:"Texto de exemplo..."})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(ie,{className:"text-xs",children:"Dica (hint)"}),o.jsx(yr,{})]}),o.jsx(ue,{value:e.hint||"",onChange:A=>a({hint:A.target.value}),className:"h-8 text-sm",placeholder:"Texto de ajuda abaixo do campo"})]}),s!=="file"&&!l&&!y&&o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Valor padrão"}),o.jsx(ue,{value:e.defaultValue||"",onChange:A=>a({defaultValue:A.target.value}),className:"h-8 text-sm",placeholder:"Valor inicial do campo"})]}),s!=="file"&&!l&&!y&&o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(ie,{className:"text-xs",children:"Valor inicial (runtime)"}),o.jsx(yr,{})]}),o.jsx(ue,{value:e.initialValue||"",onChange:A=>a({initialValue:A.target.value||void 0}),className:"h-8 text-sm",placeholder:"{{evento.nome}} ou valor fixo"}),o.jsxs("p",{className:"text-[9px] text-muted-foreground",children:['Sobrepõe "Valor padrão" — suporta variáveis'," ",o.jsx("code",{children:"{{evento.x}}"})]})]}),!l&&!y&&o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(et,{id:"req",checked:e.required||!1,onCheckedChange:A=>a({required:A===!0})}),o.jsx(ie,{htmlFor:"req",className:"text-xs cursor-pointer",children:"Campo obrigatório"})]}),!l&&!y&&!c&&!p&&o.jsxs("div",{className:"flex flex-col gap-1.5",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(et,{id:"readonly",checked:e.isReadOnly||!1,onCheckedChange:A=>a({isReadOnly:A===!0||void 0})}),o.jsx(ie,{htmlFor:"readonly",className:"text-xs cursor-pointer",children:"Somente leitura"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(et,{id:"disabled",checked:e.isDisabled||!1,onCheckedChange:A=>a({isDisabled:A===!0||void 0})}),o.jsx(ie,{htmlFor:"disabled",className:"text-xs cursor-pointer",children:"Desabilitado"})]})]}),f&&o.jsxs(o.Fragment,{children:[o.jsx(it,{}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase",children:"Slider"}),o.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Mínimo"}),o.jsx(ue,{type:"number",value:e.minValue??0,onChange:A=>a({minValue:Number(A.target.value)}),className:"h-8 text-sm"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Máximo"}),o.jsx(ue,{type:"number",value:e.maxValue??100,onChange:A=>a({maxValue:Number(A.target.value)}),className:"h-8 text-sm"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Passo"}),o.jsx(ue,{type:"number",min:1,value:e.step??1,onChange:A=>a({step:Number(A.target.value)}),className:"h-8 text-sm"})]})]})]})]}),h&&o.jsxs(o.Fragment,{children:[o.jsx(it,{}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase",children:"Avaliação"}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Número de estrelas"}),o.jsxs(Bt,{value:String(e.maxRating??5),onValueChange:A=>a({maxRating:Number(A)}),children:[o.jsx(Rt,{className:"h-8 text-sm",children:o.jsx(Ut,{})}),o.jsx(It,{children:[3,4,5,6,7,10].map(A=>o.jsxs(qe,{value:String(A),children:[A," estrelas"]},A))})]})]})]})]}),x&&o.jsxs(o.Fragment,{children:[o.jsx(it,{}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase",children:"Período"}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Label da data inicial"}),o.jsx(ue,{value:e.dateRangeStartLabel??"Data inicial",onChange:A=>a({dateRangeStartLabel:A.target.value}),className:"h-8 text-sm"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Label da data final"}),o.jsx(ue,{value:e.dateRangeEndLabel??"Data final",onChange:A=>a({dateRangeEndLabel:A.target.value}),className:"h-8 text-sm"})]})]})]}),!l&&o.jsx(it,{}),!l&&!m&&!b&&o.jsx(XC,{fieldType:s,validation:e.validation,onChange:A=>a({validation:A})}),i&&o.jsxs(o.Fragment,{children:[o.jsx(it,{}),s==="radio"&&o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Estilo visual"}),o.jsxs(Bt,{value:e.visualStyle||"card",onValueChange:A=>a({visualStyle:A}),children:[o.jsx(Rt,{className:"h-8 text-sm",children:o.jsx(Ut,{})}),o.jsxs(It,{children:[o.jsx(qe,{value:"card",children:"Card (padrão)"}),o.jsx(qe,{value:"default",children:"Radio simples"})]})]})]}),o.jsx(Kh,{options:e.options||[],onChange:A=>a({options:A})})]}),l&&o.jsxs(o.Fragment,{children:[o.jsx(it,{}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase",children:"Lista de itens"}),o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Mín. itens"}),o.jsx(ue,{type:"number",min:0,value:e.minItems??"",onChange:A=>a({minItems:A.target.value?Number(A.target.value):void 0}),className:"h-8 text-sm",placeholder:"0"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Máx. itens"}),o.jsx(ue,{type:"number",min:0,value:e.maxItems??"",onChange:A=>a({maxItems:A.target.value?Number(A.target.value):void 0}),className:"h-8 text-sm",placeholder:"Sem limite"})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Label do item"}),o.jsx(ue,{value:e.itemLabel||"",onChange:A=>a({itemLabel:A.target.value||void 0}),className:"h-8 text-sm",placeholder:"Ex: Contato"}),o.jsx("p",{className:"text-[9px] text-muted-foreground",children:'Prefixo exibido em cada item (ex: "Contato 1", "Contato 2")'})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Label do botão adicionar"}),o.jsx(ue,{value:e.addLabel||"",onChange:A=>a({addLabel:A.target.value||void 0}),className:"h-8 text-sm",placeholder:"Ex: Adicionar contato"})]}),o.jsx("div",{className:"rounded-md border border-amber-500/30 bg-amber-500/5 px-3 py-2",children:o.jsx("p",{className:"text-[11px] text-amber-700 dark:text-amber-400",children:"Os sub-campos são configurados visualmente no canvas: arraste campos da paleta para dentro da caixa laranja."})})]})]}),y&&o.jsxs(o.Fragment,{children:[o.jsx(it,{}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Sub-formulário"}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Título do grupo (opcional)"}),o.jsx(ue,{value:e.subSchemaTitle||"",onChange:A=>a({subSchemaTitle:A.target.value||void 0}),className:"h-8 text-sm",placeholder:"Ex: Endereço, Responsável..."})]}),o.jsx(JC,{subFields:e.subSchemaFields||[],onChange:A=>a({subSchemaFields:A})})]})]}),!b&&!m&&o.jsxs(o.Fragment,{children:[o.jsx(it,{}),o.jsx(YC,{condition:e.condition,selectedId:t,allFieldIds:r,getFieldLabel:n,onChange:A=>a({condition:A})})]}),!b&&!m&&e.condition&&o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Valor ao ocultar (clearedValue)"}),o.jsx(ue,{value:e.clearedValue??"",onChange:A=>a({clearedValue:A.target.value||void 0}),className:"h-8 text-sm",placeholder:"Deixar vazio = não limpar"}),o.jsx("p",{className:"text-[9px] text-muted-foreground",children:"Valor aplicado automaticamente quando o campo fica oculto."})]}),!l&&!y&&o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs text-muted-foreground",children:"Resolver de props (avançado)"}),o.jsx(ue,{value:e.resolvePropsKey||"",onChange:A=>a({resolvePropsKey:A.target.value||void 0}),className:"h-8 text-xs font-mono",placeholder:"chaveDoResolver"}),o.jsxs("p",{className:"text-[9px] text-muted-foreground",children:["Registre este key em"," ",o.jsx("code",{children:"RendererContext.fieldResolvers"})," para opções dinâmicas."]})]})]})]})},eN={glassmorphism:"Glass",card:"Card",flat:"Flat",bordered:"Bordered"},Yh=()=>{const{previewTemplateId:e,setPreviewTemplateId:t}=gt(),[r,n]=N.useState(!1),a=Object.values(Kr),s=Kr[e];return o.jsxs(Po,{open:r,onOpenChange:n,children:[o.jsx(_o,{asChild:!0,children:o.jsxs(De,{variant:"outline",size:"sm",className:"gap-1.5",title:"Selecionar template visual",children:[o.jsx("span",{className:"w-3.5 h-3.5 rounded-full shrink-0 border border-white/20",style:{background:(s==null?void 0:s.colors.primary)??"#3b82f6"}}),o.jsx(_.Palette,{className:"w-3.5 h-3.5"}),o.jsx("span",{className:"hidden sm:inline",children:(s==null?void 0:s.displayName)??"Template"})]})}),o.jsxs(fa,{side:"bottom",align:"end",className:"w-80 p-3",children:[o.jsx("p",{className:"text-xs font-semibold text-muted-foreground mb-2 uppercase tracking-wider",children:"Template de Preview"}),o.jsx("div",{className:"grid grid-cols-3 gap-1.5 max-h-72 overflow-y-auto pr-0.5",children:a.map(i=>{const l=i.id===e,c=su(i),d=eN[i.layout.containerStyle]??"";return o.jsxs("button",{onClick:()=>{t(i.id),n(!1)},className:Ht("relative flex flex-col items-center gap-1.5 rounded-lg p-2 border text-center transition-all hover:scale-[1.02]",l?"border-primary ring-1 ring-primary":"border-border hover:border-muted-foreground/40"),children:[o.jsxs("div",{className:"w-full h-8 rounded-md flex items-center justify-center gap-0.5",style:{background:i.colors.background.startsWith("#")||i.colors.background.startsWith("rgba")?i.colors.background:void 0},"data-muted":!i.colors.background.startsWith("#")&&!i.colors.background.startsWith("rgba")?"true":void 0,children:[o.jsx("div",{style:{width:8,height:8,borderRadius:"50%",background:i.colors.primary}}),o.jsx("div",{style:{width:8,height:8,borderRadius:"50%",background:i.colors.accent}})]}),o.jsx("span",{className:"text-[10px] font-medium leading-tight line-clamp-2",children:i.displayName}),o.jsxs("div",{className:"flex items-center gap-0.5 flex-wrap justify-center",children:[c&&o.jsx("span",{className:"text-[9px] px-1 rounded bg-zinc-800 text-zinc-300",children:"dark"}),d&&o.jsx("span",{className:"text-[9px] px-1 rounded bg-muted text-muted-foreground",children:d})]}),l&&o.jsx("div",{className:"absolute top-1 right-1",children:o.jsx(_.Check,{className:"w-3 h-3 text-primary"})})]},i.id)})})]})]})},tN=[{value:"numbers",label:"Números"},{value:"icons",label:"Ícones"},{value:"icons-labeled",label:"Ícones + rótulo"}],rN=[{value:"top-center",label:"Centralizado"},{value:"top-left",label:"Esquerda"}],nN=[{value:"horizontal",label:"Horizontal"},{value:"vertical",label:"Vertical (sidebar)"}],aN=()=>{const{stepConfig:e,updateStepConfig:t}=gt();return o.jsxs("div",{className:"space-y-5",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Template visual"}),o.jsx(Yh,{})]}),o.jsx(it,{}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Indicador de steps"}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(et,{id:"sc-show-indicators",checked:e.showStepIndicators!==!1,onCheckedChange:r=>t({showStepIndicators:r===!0})}),o.jsx(ie,{htmlFor:"sc-show-indicators",className:"text-xs cursor-pointer",children:"Exibir indicador de steps"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(et,{id:"sc-show-progress",checked:e.showProgressBar===!0,onCheckedChange:r=>t({showProgressBar:r===!0})}),o.jsx(ie,{htmlFor:"sc-show-progress",className:"text-xs cursor-pointer",children:"Exibir barra de progresso"})]})]}),o.jsx(it,{}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ie,{className:"text-xs",children:"Variante visual"}),o.jsx("div",{className:"flex flex-col gap-1.5",children:tN.map(r=>o.jsx("button",{type:"button",onClick:()=>t({stepIndicatorVariant:r.value}),className:`text-left text-xs px-3 py-1.5 rounded-md border transition-colors ${e.stepIndicatorVariant===r.value?"border-primary bg-primary/10 text-primary font-medium":"border-border bg-muted/30 text-muted-foreground hover:bg-muted/60"}`,children:r.label},r.value))}),!e.stepIndicatorVariant&&o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Herdado do template"})]}),o.jsx(it,{}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ie,{className:"text-xs",children:"Orientação"}),o.jsx("div",{className:"flex gap-2",children:nN.map(r=>o.jsx("button",{type:"button",onClick:()=>t({stepIndicatorOrientation:r.value}),className:`flex-1 text-xs px-2 py-1.5 rounded-md border transition-colors ${e.stepIndicatorOrientation===r.value?"border-primary bg-primary/10 text-primary font-medium":"border-border bg-muted/30 text-muted-foreground hover:bg-muted/60"}`,children:r.label},r.value))}),!e.stepIndicatorOrientation&&o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Herdado do template"})]}),o.jsx(it,{}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ie,{className:"text-xs",children:"Posição (desktop)"}),o.jsx("div",{className:"flex gap-2",children:rN.map(r=>o.jsx("button",{type:"button",onClick:()=>t({stepIndicatorPosition:r.value}),className:`flex-1 text-xs px-2 py-1.5 rounded-md border transition-colors ${e.stepIndicatorPosition===r.value?"border-primary bg-primary/10 text-primary font-medium":"border-border bg-muted/30 text-muted-foreground hover:bg-muted/60"}`,children:r.label},r.value))}),!e.stepIndicatorPosition&&o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Herdado do template"})]})]})},oN=()=>{const{selectedId:e,getConfig:t,updateConfig:r,getAllFieldIds:n}=gt();if(!e)return o.jsxs("div",{className:"rounded-xl border bg-card p-4 space-y-4 max-h-[calc(100vh-160px)] overflow-y-auto",children:[o.jsx("div",{className:"flex items-center justify-between",children:o.jsx("h3",{className:"text-sm font-bold text-foreground",children:"Formulário"})}),o.jsx(it,{}),o.jsx(aN,{})]});const a=t(e),s=He(e),i=c=>r(e,c),l=n().filter(c=>c!==e);return o.jsxs("div",{className:"rounded-xl border bg-card p-4 space-y-4 max-h-[calc(100vh-160px)] overflow-y-auto",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("h3",{className:"text-sm font-bold text-foreground",children:s==="step"?"Step":s==="container"?"Container":"Campo"}),o.jsx("span",{className:"text-[10px] font-mono text-muted-foreground",children:e})]}),o.jsx(it,{}),s==="step"&&o.jsx(LC,{config:a,onUpdate:i}),s==="container"&&o.jsx(VC,{config:a,onUpdate:i}),s==="field"&&o.jsx(QC,{config:a,selectedId:e,allFieldIds:l,getFieldLabel:c=>t(c).label||c,onUpdate:i})]})};var ga=e=>e.type==="checkbox",Zr=e=>e instanceof Date,bt=e=>e==null;const Jh=e=>typeof e=="object";var tt=e=>!bt(e)&&!Array.isArray(e)&&Jh(e)&&!Zr(e),Qh=e=>tt(e)&&e.target?ga(e.target)?e.target.checked:e.target.value:e,sN=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,ex=(e,t)=>e.has(sN(t)),iN=e=>{const t=e.constructor&&e.constructor.prototype;return tt(t)&&t.hasOwnProperty("isPrototypeOf")},Cl=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Le(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if(Cl&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!r&&!(tt(e)&&iN(e)))return e;const n=r?[]:Object.create(Object.getPrototypeOf(e));for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&(n[a]=Le(e[a]));return n}var Xo=e=>/^\w*$/.test(e),Oe=e=>e===void 0,Zo=e=>Array.isArray(e)?e.filter(Boolean):[],Nl=e=>Zo(e.replace(/["|']|\]/g,"").split(/\.|\[/)),ae=(e,t,r)=>{if(!t||!tt(e))return r;const n=(Xo(t)?[t]:Nl(t)).reduce((a,s)=>bt(a)?a:a[s],e);return Oe(n)||n===e?Oe(e[t])?r:e[t]:n},$t=e=>typeof e=="boolean",ht=e=>typeof e=="function",_e=(e,t,r)=>{let n=-1;const a=Xo(t)?[t]:Nl(t),s=a.length,i=s-1;for(;++n<s;){const l=a[n];let c=r;if(n!==i){const d=e[l];c=tt(d)||Array.isArray(d)?d:isNaN(+a[n+1])?{}:[]}if(l==="__proto__"||l==="constructor"||l==="prototype")return;e[l]=c,e=e[l]}};const ao={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},zt={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},gr={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Sl=N.createContext(null);Sl.displayName="HookFormControlContext";const Ko=()=>N.useContext(Sl);var tx=(e,t,r,n=!0)=>{const a={defaultValues:t._defaultValues};for(const s in e)Object.defineProperty(a,s,{get:()=>{const i=s;return t._proxyFormState[i]!==zt.all&&(t._proxyFormState[i]=!n||zt.all),r&&(r[i]=!0),e[i]}});return a};const Yo=typeof window<"u"?N.useLayoutEffect:N.useEffect;function rx(e){const t=Ko(),{control:r=t,disabled:n,name:a,exact:s}=e||{},[i,l]=N.useState(r._formState),c=N.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Yo(()=>r._subscribe({name:a,formState:c.current,exact:s,callback:d=>{!n&&l({...r._formState,...d})}}),[a,n,s]),N.useEffect(()=>{c.current.isValid&&r._setValid(!0)},[r]),N.useMemo(()=>tx(i,r,c.current,!1),[i,r])}var Dt=e=>typeof e=="string",pi=(e,t,r,n,a)=>Dt(e)?(n&&t.watch.add(e),ae(r,e,a)):Array.isArray(e)?e.map(s=>(n&&t.watch.add(s),ae(r,s))):(n&&(t.watchAll=!0),r),fi=e=>bt(e)||!Jh(e);function Kt(e,t,r=new WeakSet){if(fi(e)||fi(t))return Object.is(e,t);if(Zr(e)&&Zr(t))return Object.is(e.getTime(),t.getTime());const n=Object.keys(e),a=Object.keys(t);if(n.length!==a.length)return!1;if(r.has(e)||r.has(t))return!0;r.add(e),r.add(t);for(const s of n){const i=e[s];if(!a.includes(s))return!1;if(s!=="ref"){const l=t[s];if(Zr(i)&&Zr(l)||tt(i)&&tt(l)||Array.isArray(i)&&Array.isArray(l)?!Kt(i,l,r):!Object.is(i,l))return!1}}return!0}function Mn(e){const t=Ko(),{control:r=t,name:n,defaultValue:a,disabled:s,exact:i,compute:l}=e||{},c=N.useRef(a),d=N.useRef(l),u=N.useRef(void 0),m=N.useRef(r),p=N.useRef(n);d.current=l;const[f,b]=N.useState(()=>{const w=r._getWatch(n,c.current);return d.current?d.current(w):w}),h=N.useCallback(w=>{const C=pi(n,r._names,w||r._formValues,!1,c.current);return d.current?d.current(C):C},[r._formValues,r._names,n]),x=N.useCallback(w=>{if(!s){const C=pi(n,r._names,w||r._formValues,!1,c.current);if(d.current){const S=d.current(C);Kt(S,u.current)||(b(S),u.current=S)}else b(C)}},[r._formValues,r._names,s,n]);Yo(()=>((m.current!==r||!Kt(p.current,n))&&(m.current=r,p.current=n,x()),r._subscribe({name:n,formState:{values:!0},exact:i,callback:w=>{x(w.values)}})),[r,i,n,x]),N.useEffect(()=>r._removeUnmounted());const y=m.current!==r,v=p.current,j=N.useMemo(()=>{if(s)return null;const w=!y&&!Kt(v,n);return y||w?h():null},[s,y,n,v,h]);return j!==null?j:f}function Me(e){const t=Ko(),{name:r,disabled:n,control:a=t,shouldUnregister:s,defaultValue:i,exact:l=!0}=e,c=ex(a._names.array,r),d=N.useMemo(()=>ae(a._formValues,r,ae(a._defaultValues,r,i)),[a,r,i]),u=Mn({control:a,name:r,defaultValue:d,exact:l}),m=rx({control:a,name:r,exact:l}),p=N.useRef(e),f=N.useRef(void 0),b=N.useRef(a.register(r,{...e.rules,value:u,...$t(e.disabled)?{disabled:e.disabled}:{}}));p.current=e;const h=N.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!ae(m.errors,r)},isDirty:{enumerable:!0,get:()=>!!ae(m.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!ae(m.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!ae(m.validatingFields,r)},error:{enumerable:!0,get:()=>ae(m.errors,r)}}),[m,r]),x=N.useCallback(w=>b.current.onChange({target:{value:Qh(w),name:r},type:ao.CHANGE}),[r]),y=N.useCallback(()=>b.current.onBlur({target:{value:ae(a._formValues,r),name:r},type:ao.BLUR}),[r,a._formValues]),v=N.useCallback(w=>{const C=ae(a._fields,r);C&&C._f&&w&&(C._f.ref={focus:()=>ht(w.focus)&&w.focus(),select:()=>ht(w.select)&&w.select(),setCustomValidity:S=>ht(w.setCustomValidity)&&w.setCustomValidity(S),reportValidity:()=>ht(w.reportValidity)&&w.reportValidity()})},[a._fields,r]),j=N.useMemo(()=>({name:r,value:u,...$t(n)||m.disabled?{disabled:m.disabled||n}:{},onChange:x,onBlur:y,ref:v}),[r,n,m.disabled,x,y,v,u]);return N.useEffect(()=>{const w=a._options.shouldUnregister||s,C=f.current;C&&C!==r&&!c&&a.unregister(C),a.register(r,{...p.current.rules,...$t(p.current.disabled)?{disabled:p.current.disabled}:{}});const S=($,k)=>{const E=ae(a._fields,$);E&&E._f&&(E._f.mount=k)};if(S(r,!0),w){const $=Le(ae(a._options.defaultValues,r,p.current.defaultValue));_e(a._defaultValues,r,$),Oe(ae(a._formValues,r))&&_e(a._formValues,r,$)}return!c&&a.register(r),f.current=r,()=>{(c?w&&!a._state.action:w)?a.unregister(r):S(r,!1)}},[r,a,c,s]),N.useEffect(()=>{a._setDisabledField({disabled:n,name:r})},[n,r,a]),N.useMemo(()=>({field:j,formState:m,fieldState:h}),[j,m,h])}const $l=N.createContext(null);$l.displayName="HookFormContext";const lN=()=>N.useContext($l),cN=e=>{const{children:t,watch:r,getValues:n,getFieldState:a,setError:s,clearErrors:i,setValue:l,trigger:c,formState:d,resetField:u,reset:m,handleSubmit:p,unregister:f,control:b,register:h,setFocus:x,subscribe:y}=e;return N.createElement($l.Provider,{value:N.useMemo(()=>({watch:r,getValues:n,getFieldState:a,setError:s,clearErrors:i,setValue:l,trigger:c,formState:d,resetField:u,reset:m,handleSubmit:p,unregister:f,control:b,register:h,setFocus:x,subscribe:y}),[i,b,d,a,n,p,h,m,u,s,x,l,y,c,f,r])},N.createElement(Sl.Provider,{value:b},t))};var dN=(e,t,r,n,a)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:a||!0}}:{},yt=e=>Array.isArray(e)?e:[e],vd=()=>{let e=[];return{get observers(){return e},next:t=>{for(const r of e)r.next&&r.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter(r=>r!==t)}}),unsubscribe:()=>{e=[]}}};function nx(e,t){const r={};for(const n in e)if(e.hasOwnProperty(n)){const a=e[n],s=t[n];if(a&&tt(a)&&s){const i=nx(a,s);tt(i)&&(r[n]=i)}else e[n]&&(r[n]=s)}return r}var ct=e=>tt(e)&&!Object.keys(e).length,El=e=>e.type==="file",oo=e=>{if(!Cl)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},ax=e=>e.type==="select-multiple",Dl=e=>e.type==="radio",uN=e=>Dl(e)||ga(e),$s=e=>oo(e)&&e.isConnected;function mN(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=Oe(e)?n++:e[t[n++]];return e}function pN(e){for(const t in e)if(e.hasOwnProperty(t)&&!Oe(e[t]))return!1;return!0}function Be(e,t){const r=Array.isArray(t)?t:Xo(t)?[t]:Nl(t),n=r.length===1?e:mN(e,r),a=r.length-1,s=r[a];return n&&delete n[s],a!==0&&(tt(n)&&ct(n)||Array.isArray(n)&&pN(n))&&Be(e,r.slice(0,-1)),e}var fN=e=>{for(const t in e)if(ht(e[t]))return!0;return!1};function ox(e){return Array.isArray(e)||tt(e)&&!fN(e)}function hi(e,t={}){for(const r in e){const n=e[r];ox(n)?(t[r]=Array.isArray(n)?[]:{},hi(n,t[r])):Oe(n)||(t[r]=!0)}return t}function vn(e,t,r){r||(r=hi(t));for(const n in e){const a=e[n];if(ox(a))Oe(t)||fi(r[n])?r[n]=hi(a,Array.isArray(a)?[]:{}):vn(a,bt(t)?{}:t[n],r[n]);else{const s=t[n];r[n]=!Kt(a,s)}}return r}const bd={value:!1,isValid:!1},yd={value:!0,isValid:!0};var sx=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Oe(e[0].attributes.value)?Oe(e[0].value)||e[0].value===""?yd:{value:e[0].value,isValid:!0}:yd:bd}return bd},ix=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>Oe(e)?e:t?e===""?NaN:e&&+e:r&&Dt(e)?new Date(e):n?n(e):e;const wd={isValid:!1,value:null};var lx=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,wd):wd;function jd(e){const t=e.ref;return El(t)?t.files:Dl(t)?lx(e.refs).value:ax(t)?[...t.selectedOptions].map(({value:r})=>r):ga(t)?sx(e.refs).value:ix(Oe(t.value)?e.ref.value:t.value,e)}var hN=(e,t,r,n)=>{const a={};for(const s of e){const i=ae(t,s);i&&_e(a,s,i._f)}return{criteriaMode:r,names:[...e],fields:a,shouldUseNativeValidation:n}},so=e=>e instanceof RegExp,Gn=e=>Oe(e)?e:so(e)?e.source:tt(e)?so(e.value)?e.value.source:e.value:e,wn=e=>({isOnSubmit:!e||e===zt.onSubmit,isOnBlur:e===zt.onBlur,isOnChange:e===zt.onChange,isOnAll:e===zt.all,isOnTouch:e===zt.onTouched});const kd="AsyncFunction";var xN=e=>!!e&&!!e.validate&&!!(ht(e.validate)&&e.validate.constructor.name===kd||tt(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===kd)),gN=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),xi=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(n)&&/^\.\w+/.test(e.slice(n.length))));const Sn=(e,t,r,n)=>{for(const a of r||Object.keys(e)){const s=ae(e,a);if(s){const{_f:i,...l}=s;if(i){if(i.refs&&i.refs[0]&&t(i.refs[0],a)&&!n||i.ref&&t(i.ref,i.name)&&!n)return!0;if(Sn(l,t))break}else if(tt(l)&&Sn(l,t))break}}};function Cd(e,t,r){const n=ae(e,r);if(n||Xo(r))return{error:n,name:r};const a=r.split(".");for(;a.length;){const s=a.join("."),i=ae(t,s),l=ae(e,s);if(i&&!Array.isArray(i)&&r!==s)return{name:r};if(l&&l.type)return{name:s,error:l};if(l&&l.root&&l.root.type)return{name:`${s}.root`,error:l.root};a.pop()}return{name:r}}var vN=(e,t,r,n)=>{r(e);const{name:a,...s}=e;return ct(s)||Object.keys(s).length>=Object.keys(t).length||Object.keys(s).find(i=>t[i]===(!n||zt.all))},bN=(e,t,r)=>!e||!t||e===t||yt(e).some(n=>n&&(r?n===t:n.startsWith(t)||t.startsWith(n))),yN=(e,t,r,n,a)=>a.isOnAll?!1:!r&&a.isOnTouch?!(t||e):(r?n.isOnBlur:a.isOnBlur)?!e:(r?n.isOnChange:a.isOnChange)?e:!0,wN=(e,t)=>!Zo(ae(e,t)).length&&Be(e,t),cx=(e,t,r)=>{const n=yt(ae(e,r));return _e(n,"root",t[r]),_e(e,r,n),e};function Nd(e,t,r="validate"){if(Dt(e)||Array.isArray(e)&&e.every(Dt)||$t(e)&&!e)return{type:r,message:Dt(e)?e:"",ref:t}}var hn=e=>tt(e)&&!so(e)?e:{value:e,message:""},gi=async(e,t,r,n,a,s)=>{const{ref:i,refs:l,required:c,maxLength:d,minLength:u,min:m,max:p,pattern:f,validate:b,name:h,valueAsNumber:x,mount:y}=e._f,v=ae(r,h);if(!y||t.has(h))return{};const j=l?l[0]:i,w=L=>{a&&j.reportValidity&&(j.setCustomValidity($t(L)?"":L||""),j.reportValidity())},C={},S=Dl(i),$=ga(i),k=S||$,E=(x||El(i))&&Oe(i.value)&&Oe(v)||oo(i)&&i.value===""||v===""||Array.isArray(v)&&!v.length,D=dN.bind(null,h,n,C),O=(L,A,z,X=gr.maxLength,q=gr.minLength)=>{const Z=L?A:z;C[h]={type:L?X:q,message:Z,ref:i,...D(L?X:q,Z)}};if(s?!Array.isArray(v)||!v.length:c&&(!k&&(E||bt(v))||$t(v)&&!v||$&&!sx(l).isValid||S&&!lx(l).isValid)){const{value:L,message:A}=Dt(c)?{value:!!c,message:c}:hn(c);if(L&&(C[h]={type:gr.required,message:A,ref:j,...D(gr.required,A)},!n))return w(A),C}if(!E&&(!bt(m)||!bt(p))){let L,A;const z=hn(p),X=hn(m);if(!bt(v)&&!isNaN(v)){const q=i.valueAsNumber||v&&+v;bt(z.value)||(L=q>z.value),bt(X.value)||(A=q<X.value)}else{const q=i.valueAsDate||new Date(v),Z=P=>new Date(new Date().toDateString()+" "+P),V=i.type=="time",M=i.type=="week";Dt(z.value)&&v&&(L=V?Z(v)>Z(z.value):M?v>z.value:q>new Date(z.value)),Dt(X.value)&&v&&(A=V?Z(v)<Z(X.value):M?v<X.value:q<new Date(X.value))}if((L||A)&&(O(!!L,z.message,X.message,gr.max,gr.min),!n))return w(C[h].message),C}if((d||u)&&!E&&(Dt(v)||s&&Array.isArray(v))){const L=hn(d),A=hn(u),z=!bt(L.value)&&v.length>+L.value,X=!bt(A.value)&&v.length<+A.value;if((z||X)&&(O(z,L.message,A.message),!n))return w(C[h].message),C}if(f&&!E&&Dt(v)){const{value:L,message:A}=hn(f);if(so(L)&&!v.match(L)&&(C[h]={type:gr.pattern,message:A,ref:i,...D(gr.pattern,A)},!n))return w(A),C}if(b){if(ht(b)){const L=await b(v,r),A=Nd(L,j);if(A&&(C[h]={...A,...D(gr.validate,A.message)},!n))return w(A.message),C}else if(tt(b)){let L={};for(const A in b){if(!ct(L)&&!n)break;const z=Nd(await b[A](v,r),j,A);z&&(L={...z,...D(A,z.message)},w(z.message),n&&(C[h]=L))}if(!ct(L)&&(C[h]={ref:j,...L},!n))return C}}return w(!0),C};const jN={mode:zt.onSubmit,reValidateMode:zt.onChange,shouldFocusError:!0};function kN(e={}){let t={...jN,...e},r={submitCount:0,isDirty:!1,isReady:!1,isLoading:ht(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},n={},a=tt(t.defaultValues)||tt(t.values)?Le(t.defaultValues||t.values)||{}:{},s=t.shouldUnregister?{}:Le(a),i={action:!1,mount:!1,watch:!1,keepIsValid:!1},l={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},c,d=0;const u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},m={...u};let p={...m};const f={array:vd(),state:vd()},b=t.criteriaMode===zt.all,h=I=>F=>{clearTimeout(d),d=setTimeout(I,F)},x=async I=>{if(!i.keepIsValid&&!t.disabled&&(m.isValid||p.isValid||I)){let F;t.resolver?(F=ct((await k()).errors),y()):F=await D(n,!0),F!==r.isValid&&f.state.next({isValid:F})}},y=(I,F)=>{!t.disabled&&(m.isValidating||m.validatingFields||p.isValidating||p.validatingFields)&&((I||Array.from(l.mount)).forEach(B=>{B&&(F?_e(r.validatingFields,B,F):Be(r.validatingFields,B))}),f.state.next({validatingFields:r.validatingFields,isValidating:!ct(r.validatingFields)}))},v=(I,F=[],B,le,oe=!0,re=!0)=>{if(le&&B&&!t.disabled){if(i.action=!0,re&&Array.isArray(ae(n,I))){const ye=B(ae(n,I),le.argA,le.argB);oe&&_e(n,I,ye)}if(re&&Array.isArray(ae(r.errors,I))){const ye=B(ae(r.errors,I),le.argA,le.argB);oe&&_e(r.errors,I,ye),wN(r.errors,I)}if((m.touchedFields||p.touchedFields)&&re&&Array.isArray(ae(r.touchedFields,I))){const ye=B(ae(r.touchedFields,I),le.argA,le.argB);oe&&_e(r.touchedFields,I,ye)}(m.dirtyFields||p.dirtyFields)&&(r.dirtyFields=vn(a,s)),f.state.next({name:I,isDirty:L(I,F),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else _e(s,I,F)},j=(I,F)=>{_e(r.errors,I,F),f.state.next({errors:r.errors})},w=I=>{r.errors=I,f.state.next({errors:r.errors,isValid:!1})},C=(I,F,B,le)=>{const oe=ae(n,I);if(oe){const re=ae(s,I,Oe(B)?ae(a,I):B);Oe(re)||le&&le.defaultChecked||F?_e(s,I,F?re:jd(oe._f)):X(I,re),i.mount&&!i.action&&x()}},S=(I,F,B,le,oe)=>{let re=!1,ye=!1;const Re={name:I};if(!t.disabled){if(!B||le){(m.isDirty||p.isDirty)&&(ye=r.isDirty,r.isDirty=Re.isDirty=L(),re=ye!==Re.isDirty);const Ie=Kt(ae(a,I),F);ye=!!ae(r.dirtyFields,I),Ie?Be(r.dirtyFields,I):_e(r.dirtyFields,I,!0),Re.dirtyFields=r.dirtyFields,re=re||(m.dirtyFields||p.dirtyFields)&&ye!==!Ie}if(B){const Ie=ae(r.touchedFields,I);Ie||(_e(r.touchedFields,I,B),Re.touchedFields=r.touchedFields,re=re||(m.touchedFields||p.touchedFields)&&Ie!==B)}re&&oe&&f.state.next(Re)}return re?Re:{}},$=(I,F,B,le)=>{const oe=ae(r.errors,I),re=(m.isValid||p.isValid)&&$t(F)&&r.isValid!==F;if(t.delayError&&B?(c=h(()=>j(I,B)),c(t.delayError)):(clearTimeout(d),c=null,B?_e(r.errors,I,B):Be(r.errors,I)),(B?!Kt(oe,B):oe)||!ct(le)||re){const ye={...le,...re&&$t(F)?{isValid:F}:{},errors:r.errors,name:I};r={...r,...ye},f.state.next(ye)}},k=async I=>(y(I,!0),await t.resolver(s,t.context,hN(I||l.mount,n,t.criteriaMode,t.shouldUseNativeValidation))),E=async I=>{const{errors:F}=await k(I);if(y(I),I)for(const B of I){const le=ae(F,B);le?_e(r.errors,B,le):Be(r.errors,B)}else r.errors=F;return F},D=async(I,F,B={valid:!0})=>{for(const le in I){const oe=I[le];if(oe){const{_f:re,...ye}=oe;if(re){const Re=l.array.has(re.name),Ie=oe._f&&xN(oe._f);Ie&&m.validatingFields&&y([re.name],!0);const ot=await gi(oe,l.disabled,s,b,t.shouldUseNativeValidation&&!F,Re);if(Ie&&m.validatingFields&&y([re.name]),ot[re.name]&&(B.valid=!1,F||e.shouldUseNativeValidation))break;!F&&(ae(ot,re.name)?Re?cx(r.errors,ot,re.name):_e(r.errors,re.name,ot[re.name]):Be(r.errors,re.name))}!ct(ye)&&await D(ye,F,B)}}return B.valid},O=()=>{for(const I of l.unMount){const F=ae(n,I);F&&(F._f.refs?F._f.refs.every(B=>!$s(B)):!$s(F._f.ref))&&ne(I)}l.unMount=new Set},L=(I,F)=>!t.disabled&&(I&&F&&_e(s,I,F),!Kt(se(),a)),A=(I,F,B)=>pi(I,l,{...i.mount?s:Oe(F)?a:Dt(I)?{[I]:F}:F},B,F),z=I=>Zo(ae(i.mount?s:a,I,t.shouldUnregister?ae(a,I,[]):[])),X=(I,F,B={})=>{const le=ae(n,I);let oe=F;if(le){const re=le._f;re&&(!re.disabled&&_e(s,I,ix(F,re)),oe=oo(re.ref)&&bt(F)?"":F,ax(re.ref)?[...re.ref.options].forEach(ye=>ye.selected=oe.includes(ye.value)):re.refs?ga(re.ref)?re.refs.forEach(ye=>{(!ye.defaultChecked||!ye.disabled)&&(Array.isArray(oe)?ye.checked=!!oe.find(Re=>Re===ye.value):ye.checked=oe===ye.value||!!oe)}):re.refs.forEach(ye=>ye.checked=ye.value===oe):El(re.ref)?re.ref.value="":(re.ref.value=oe,re.ref.type||f.state.next({name:I,values:Le(s)})))}(B.shouldDirty||B.shouldTouch)&&S(I,oe,B.shouldTouch,B.shouldDirty,!0),B.shouldValidate&&P(I)},q=(I,F,B)=>{for(const le in F){if(!F.hasOwnProperty(le))return;const oe=F[le],re=I+"."+le,ye=ae(n,re);(l.array.has(I)||tt(oe)||ye&&!ye._f)&&!Zr(oe)?q(re,oe,B):X(re,oe,B)}},Z=(I,F,B={})=>{const le=ae(n,I),oe=l.array.has(I),re=Le(F);_e(s,I,re),oe?(f.array.next({name:I,values:Le(s)}),(m.isDirty||m.dirtyFields||p.isDirty||p.dirtyFields)&&B.shouldDirty&&f.state.next({name:I,dirtyFields:vn(a,s),isDirty:L(I,re)})):le&&!le._f&&!bt(re)?q(I,re,B):X(I,re,B),xi(I,l)?f.state.next({...r,name:I,values:Le(s)}):f.state.next({name:i.mount?I:void 0,values:Le(s)})},V=async I=>{i.mount=!0;const F=I.target;let B=F.name,le=!0;const oe=ae(n,B),re=Ie=>{le=Number.isNaN(Ie)||Zr(Ie)&&isNaN(Ie.getTime())||Kt(Ie,ae(s,B,Ie))},ye=wn(t.mode),Re=wn(t.reValidateMode);if(oe){let Ie,ot;const tr=F.type?jd(oe._f):Qh(I),rr=I.type===ao.BLUR||I.type===ao.FOCUS_OUT,Qo=!gN(oe._f)&&!t.resolver&&!ae(r.errors,B)&&!oe._f.deps||yN(rr,ae(r.touchedFields,B),r.isSubmitted,Re,ye),Vn=xi(B,l,rr);_e(s,B,tr),rr?(!F||!F.readOnly)&&(oe._f.onBlur&&oe._f.onBlur(I),c&&c(0)):oe._f.onChange&&oe._f.onChange(I);const Bn=S(B,tr,rr),es=!ct(Bn)||Vn;if(!rr&&f.state.next({name:B,type:I.type,values:Le(s)}),Qo)return(m.isValid||p.isValid)&&(t.mode==="onBlur"?rr&&x():rr||x()),es&&f.state.next({name:B,...Vn?{}:Bn});if(!rr&&Vn&&f.state.next({...r}),t.resolver){const{errors:ya}=await k([B]);if(y([B]),re(tr),le){const ts=Cd(r.errors,n,B),sn=Cd(ya,n,ts.name||B);Ie=sn.error,B=sn.name,ot=ct(ya)}}else y([B],!0),Ie=(await gi(oe,l.disabled,s,b,t.shouldUseNativeValidation))[B],y([B]),re(tr),le&&(Ie?ot=!1:(m.isValid||p.isValid)&&(ot=await D(n,!0)));le&&(oe._f.deps&&(!Array.isArray(oe._f.deps)||oe._f.deps.length>0)&&P(oe._f.deps),$(B,ot,Ie,Bn))}},M=(I,F)=>{if(ae(r.errors,F)&&I.focus)return I.focus(),1},P=async(I,F={})=>{let B,le;const oe=yt(I);if(t.resolver){const re=await E(Oe(I)?I:oe);B=ct(re),le=I?!oe.some(ye=>ae(re,ye)):B}else I?(le=(await Promise.all(oe.map(async re=>{const ye=ae(n,re);return await D(ye&&ye._f?{[re]:ye}:ye)}))).every(Boolean),!(!le&&!r.isValid)&&x()):le=B=await D(n);return f.state.next({...!Dt(I)||(m.isValid||p.isValid)&&B!==r.isValid?{}:{name:I},...t.resolver||!I?{isValid:B}:{},errors:r.errors}),F.shouldFocus&&!le&&Sn(n,M,I?oe:l.mount),le},se=(I,F)=>{let B={...i.mount?s:a};return F&&(B=nx(F.dirtyFields?r.dirtyFields:r.touchedFields,B)),Oe(I)?B:Dt(I)?ae(B,I):I.map(le=>ae(B,le))},U=(I,F)=>({invalid:!!ae((F||r).errors,I),isDirty:!!ae((F||r).dirtyFields,I),error:ae((F||r).errors,I),isValidating:!!ae(r.validatingFields,I),isTouched:!!ae((F||r).touchedFields,I)}),Q=I=>{const F=I?yt(I):void 0;F==null||F.forEach(B=>Be(r.errors,B)),F?F.forEach(B=>{f.state.next({name:B,errors:r.errors})}):f.state.next({errors:{}})},Y=(I,F,B)=>{const le=(ae(n,I,{_f:{}})._f||{}).ref,oe=ae(r.errors,I)||{},{ref:re,message:ye,type:Re,...Ie}=oe;_e(r.errors,I,{...Ie,...F,ref:le}),f.state.next({name:I,errors:r.errors,isValid:!1}),B&&B.shouldFocus&&le&&le.focus&&le.focus()},H=(I,F)=>ht(I)?f.state.subscribe({next:B=>"values"in B&&I(A(void 0,F),B)}):A(I,F,!0),W=I=>f.state.subscribe({next:F=>{bN(I.name,F.name,I.exact)&&vN(F,I.formState||m,Nt,I.reRenderRoot)&&I.callback({values:{...s},...r,...F,defaultValues:a})}}).unsubscribe,G=I=>(i.mount=!0,p={...p,...I.formState},W({...I,formState:{...u,...I.formState}})),ne=(I,F={})=>{for(const B of I?yt(I):l.mount)l.mount.delete(B),l.array.delete(B),F.keepValue||(Be(n,B),Be(s,B)),!F.keepError&&Be(r.errors,B),!F.keepDirty&&Be(r.dirtyFields,B),!F.keepTouched&&Be(r.touchedFields,B),!F.keepIsValidating&&Be(r.validatingFields,B),!t.shouldUnregister&&!F.keepDefaultValue&&Be(a,B);f.state.next({values:Le(s)}),f.state.next({...r,...F.keepDirty?{isDirty:L()}:{}}),!F.keepIsValid&&x()},J=({disabled:I,name:F})=>{if($t(I)&&i.mount||I||l.disabled.has(F)){const B=l.disabled.has(F)!==!!I;I?l.disabled.add(F):l.disabled.delete(F),B&&i.mount&&!i.action&&x()}},te=(I,F={})=>{let B=ae(n,I);const le=$t(F.disabled)||$t(t.disabled);return _e(n,I,{...B||{},_f:{...B&&B._f?B._f:{ref:{name:I}},name:I,mount:!0,...F}}),l.mount.add(I),B?J({disabled:$t(F.disabled)?F.disabled:t.disabled,name:I}):C(I,!0,F.value),{...le?{disabled:F.disabled||t.disabled}:{},...t.progressive?{required:!!F.required,min:Gn(F.min),max:Gn(F.max),minLength:Gn(F.minLength),maxLength:Gn(F.maxLength),pattern:Gn(F.pattern)}:{},name:I,onChange:V,onBlur:V,ref:oe=>{if(oe){te(I,F),B=ae(n,I);const re=Oe(oe.value)&&oe.querySelectorAll&&oe.querySelectorAll("input,select,textarea")[0]||oe,ye=uN(re),Re=B._f.refs||[];if(ye?Re.find(Ie=>Ie===re):re===B._f.ref)return;_e(n,I,{_f:{...B._f,...ye?{refs:[...Re.filter($s),re,...Array.isArray(ae(a,I))?[{}]:[]],ref:{type:re.type,name:I}}:{ref:re}}}),C(I,!1,void 0,re)}else B=ae(n,I,{}),B._f&&(B._f.mount=!1),(t.shouldUnregister||F.shouldUnregister)&&!(ex(l.array,I)&&i.action)&&l.unMount.add(I)}}},ce=()=>t.shouldFocusError&&Sn(n,M,l.mount),be=I=>{$t(I)&&(f.state.next({disabled:I}),Sn(n,(F,B)=>{const le=ae(n,B);le&&(F.disabled=le._f.disabled||I,Array.isArray(le._f.refs)&&le._f.refs.forEach(oe=>{oe.disabled=le._f.disabled||I}))},0,!1))},Ce=(I,F)=>async B=>{let le;B&&(B.preventDefault&&B.preventDefault(),B.persist&&B.persist());let oe=Le(s);if(f.state.next({isSubmitting:!0}),t.resolver){const{errors:re,values:ye}=await k();y(),r.errors=re,oe=Le(ye)}else await D(n);if(l.disabled.size)for(const re of l.disabled)Be(oe,re);if(Be(r.errors,"root"),ct(r.errors)){f.state.next({errors:{}});try{await I(oe,B)}catch(re){le=re}}else F&&await F({...r.errors},B),ce(),setTimeout(ce);if(f.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:ct(r.errors)&&!le,submitCount:r.submitCount+1,errors:r.errors}),le)throw le},ve=(I,F={})=>{ae(n,I)&&(Oe(F.defaultValue)?Z(I,Le(ae(a,I))):(Z(I,F.defaultValue),_e(a,I,Le(F.defaultValue))),F.keepTouched||Be(r.touchedFields,I),F.keepDirty||(Be(r.dirtyFields,I),r.isDirty=F.defaultValue?L(I,Le(ae(a,I))):L()),F.keepError||(Be(r.errors,I),m.isValid&&x()),f.state.next({...r}))},me=(I,F={})=>{const B=I?Le(I):a,le=Le(B),oe=ct(I),re=oe?a:le;if(F.keepDefaultValues||(a=B),!F.keepValues){if(F.keepDirtyValues){const ye=new Set([...l.mount,...Object.keys(vn(a,s))]);for(const Re of Array.from(ye)){const Ie=ae(r.dirtyFields,Re),ot=ae(s,Re),tr=ae(re,Re);Ie&&!Oe(ot)?_e(re,Re,ot):!Ie&&!Oe(tr)&&Z(Re,tr)}}else{if(Cl&&Oe(I))for(const ye of l.mount){const Re=ae(n,ye);if(Re&&Re._f){const Ie=Array.isArray(Re._f.refs)?Re._f.refs[0]:Re._f.ref;if(oo(Ie)){const ot=Ie.closest("form");if(ot){ot.reset();break}}}}if(F.keepFieldsRef)for(const ye of l.mount)Z(ye,ae(re,ye));else n={}}s=t.shouldUnregister?F.keepDefaultValues?Le(a):{}:Le(re),f.array.next({values:{...re}}),f.state.next({values:{...re}})}l={mount:F.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},i.mount=!m.isValid||!!F.keepIsValid||!!F.keepDirtyValues||!t.shouldUnregister&&!ct(re),i.watch=!!t.shouldUnregister,i.keepIsValid=!!F.keepIsValid,i.action=!1,F.keepErrors||(r.errors={}),f.state.next({submitCount:F.keepSubmitCount?r.submitCount:0,isDirty:oe?!1:F.keepDirty?r.isDirty:!!(F.keepDefaultValues&&!Kt(I,a)),isSubmitted:F.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:oe?{}:F.keepDirtyValues?F.keepDefaultValues&&s?vn(a,s):r.dirtyFields:F.keepDefaultValues&&I?vn(a,I):F.keepDirty?r.dirtyFields:{},touchedFields:F.keepTouched?r.touchedFields:{},errors:F.keepErrors?r.errors:{},isSubmitSuccessful:F.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:a})},Ee=(I,F)=>me(ht(I)?I(s):I,{...t.resetOptions,...F}),Fe=(I,F={})=>{const B=ae(n,I),le=B&&B._f;if(le){const oe=le.refs?le.refs[0]:le.ref;oe.focus&&setTimeout(()=>{oe.focus(),F.shouldSelect&&ht(oe.select)&&oe.select()})}},Nt=I=>{r={...r,...I}},dt={control:{register:te,unregister:ne,getFieldState:U,handleSubmit:Ce,setError:Y,_subscribe:W,_runSchema:k,_updateIsValidating:y,_focusError:ce,_getWatch:A,_getDirty:L,_setValid:x,_setFieldArray:v,_setDisabledField:J,_setErrors:w,_getFieldArray:z,_reset:me,_resetDefaultValues:()=>ht(t.defaultValues)&&t.defaultValues().then(I=>{Ee(I,t.resetOptions),f.state.next({isLoading:!1})}),_removeUnmounted:O,_disableForm:be,_subjects:f,_proxyFormState:m,get _fields(){return n},get _formValues(){return s},get _state(){return i},set _state(I){i=I},get _defaultValues(){return a},get _names(){return l},set _names(I){l=I},get _formState(){return r},get _options(){return t},set _options(I){t={...t,...I}}},subscribe:G,trigger:P,register:te,handleSubmit:Ce,watch:H,setValue:Z,getValues:se,reset:Ee,resetField:ve,clearErrors:Q,unregister:ne,setError:Y,setFocus:Fe,getFieldState:U};return{...dt,formControl:dt}}var Tr=()=>{if(typeof crypto<"u"&&crypto.randomUUID)return crypto.randomUUID();const e=typeof performance>"u"?Date.now():performance.now()*1e3;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const r=(Math.random()*16+e)%16|0;return(t=="x"?r:r&3|8).toString(16)})},Es=(e,t,r={})=>r.shouldFocus||Oe(r.shouldFocus)?r.focusName||`${e}.${Oe(r.focusIndex)?t:r.focusIndex}.`:"",Ds=(e,t)=>[...e,...yt(t)],Ts=e=>Array.isArray(e)?e.map(()=>{}):void 0;function As(e,t,r){return[...e.slice(0,t),...yt(r),...e.slice(t)]}var Rs=(e,t,r)=>Array.isArray(e)?(Oe(e[r])&&(e[r]=void 0),e.splice(r,0,e.splice(t,1)[0]),e):[],Is=(e,t)=>[...yt(t),...yt(e)];function CN(e,t){let r=0;const n=[...e];for(const a of t)n.splice(a-r,1),r++;return Zo(n).length?n:[]}var Ps=(e,t)=>Oe(t)?[]:CN(e,yt(t).sort((r,n)=>r-n)),_s=(e,t,r)=>{[e[t],e[r]]=[e[r],e[t]]},Sd=(e,t,r)=>(e[t]=r,e);function dx(e){const t=Ko(),{control:r=t,name:n,keyName:a="id",shouldUnregister:s,rules:i}=e,[l,c]=N.useState(r._getFieldArray(n)),d=N.useRef(r._getFieldArray(n).map(Tr)),u=N.useRef(!1);r._names.array.add(n),N.useMemo(()=>i&&l.length>=0&&r.register(n,i),[r,n,l.length,i]),Yo(()=>r._subjects.array.subscribe({next:({values:w,name:C})=>{if(C===n||!C){const S=ae(w,n);Array.isArray(S)&&(c(S),d.current=S.map(Tr))}}}).unsubscribe,[r,n]);const m=N.useCallback(w=>{u.current=!0,r._setFieldArray(n,w)},[r,n]),p=(w,C)=>{const S=yt(Le(w)),$=Ds(r._getFieldArray(n),S);r._names.focus=Es(n,$.length-1,C),d.current=Ds(d.current,S.map(Tr)),m($),c($),r._setFieldArray(n,$,Ds,{argA:Ts(w)})},f=(w,C)=>{const S=yt(Le(w)),$=Is(r._getFieldArray(n),S);r._names.focus=Es(n,0,C),d.current=Is(d.current,S.map(Tr)),m($),c($),r._setFieldArray(n,$,Is,{argA:Ts(w)})},b=w=>{const C=Ps(r._getFieldArray(n),w);d.current=Ps(d.current,w),m(C),c(C),!Array.isArray(ae(r._fields,n))&&_e(r._fields,n,void 0),r._setFieldArray(n,C,Ps,{argA:w})},h=(w,C,S)=>{const $=yt(Le(C)),k=As(r._getFieldArray(n),w,$);r._names.focus=Es(n,w,S),d.current=As(d.current,w,$.map(Tr)),m(k),c(k),r._setFieldArray(n,k,As,{argA:w,argB:Ts(C)})},x=(w,C)=>{const S=r._getFieldArray(n);_s(S,w,C),_s(d.current,w,C),m(S),c(S),r._setFieldArray(n,S,_s,{argA:w,argB:C},!1)},y=(w,C)=>{const S=r._getFieldArray(n);Rs(S,w,C),Rs(d.current,w,C),m(S),c(S),r._setFieldArray(n,S,Rs,{argA:w,argB:C},!1)},v=(w,C)=>{const S=Le(C),$=Sd(r._getFieldArray(n),w,S);d.current=[...$].map((k,E)=>!k||E===w?Tr():d.current[E]),m($),c([...$]),r._setFieldArray(n,$,Sd,{argA:w,argB:S},!0,!1)},j=w=>{const C=yt(Le(w));d.current=C.map(Tr),m([...C]),c([...C]),r._setFieldArray(n,[...C],S=>S,{},!0,!1)};return N.useEffect(()=>{if(r._state.action=!1,xi(n,r._names)&&r._subjects.state.next({...r._formState}),u.current&&(!wn(r._options.mode).isOnSubmit||r._formState.isSubmitted)&&!wn(r._options.reValidateMode).isOnSubmit)if(r._options.resolver)r._runSchema([n]).then(w=>{r._updateIsValidating([n]);const C=ae(w.errors,n),S=ae(r._formState.errors,n);(S?!C&&S.type||C&&(S.type!==C.type||S.message!==C.message):C&&C.type)&&(C?_e(r._formState.errors,n,C):Be(r._formState.errors,n),r._subjects.state.next({errors:r._formState.errors}))});else{const w=ae(r._fields,n);w&&w._f&&!(wn(r._options.reValidateMode).isOnSubmit&&wn(r._options.mode).isOnSubmit)&&gi(w,r._names.disabled,r._formValues,r._options.criteriaMode===zt.all,r._options.shouldUseNativeValidation,!0).then(C=>!ct(C)&&r._subjects.state.next({errors:cx(r._formState.errors,C,n)}))}r._subjects.state.next({name:n,values:Le(r._formValues)}),r._names.focus&&Sn(r._fields,(w,C)=>{if(r._names.focus&&C.startsWith(r._names.focus)&&w.focus)return w.focus(),1}),r._names.focus="",r._setValid(),u.current=!1},[l,n,r]),N.useEffect(()=>(!ae(r._formValues,n)&&r._setFieldArray(n),()=>{const w=(C,S)=>{const $=ae(r._fields,C);$&&$._f&&($._f.mount=S)};r._options.shouldUnregister||s?r.unregister(n):w(n,!1)}),[n,r,a,s]),{swap:N.useCallback(x,[m,n,r]),move:N.useCallback(y,[m,n,r]),prepend:N.useCallback(f,[m,n,r]),append:N.useCallback(p,[m,n,r]),remove:N.useCallback(b,[m,n,r]),insert:N.useCallback(h,[m,n,r]),update:N.useCallback(v,[m,n,r]),replace:N.useCallback(j,[m,n,r]),fields:N.useMemo(()=>l.map((w,C)=>({...w,[a]:d.current[C]||Tr()})),[l,a])}}function NN(e={}){const t=N.useRef(void 0),r=N.useRef(void 0),[n,a]=N.useState({isDirty:!1,isValidating:!1,isLoading:ht(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:ht(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:n},e.defaultValues&&!ht(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:i,...l}=kN(e);t.current={...l,formState:n}}const s=t.current.control;return s._options=e,Yo(()=>{const i=s._subscribe({formState:s._proxyFormState,callback:()=>a({...s._formState}),reRenderRoot:!0});return a(l=>({...l,isReady:!0})),s._formState.isReady=!0,i},[s]),N.useEffect(()=>s._disableForm(e.disabled),[s,e.disabled]),N.useEffect(()=>{e.mode&&(s._options.mode=e.mode),e.reValidateMode&&(s._options.reValidateMode=e.reValidateMode)},[s,e.mode,e.reValidateMode]),N.useEffect(()=>{e.errors&&(s._setErrors(e.errors),s._focusError())},[s,e.errors]),N.useEffect(()=>{e.shouldUnregister&&s._subjects.state.next({values:s._getWatch()})},[s,e.shouldUnregister]),N.useEffect(()=>{if(s._proxyFormState.isDirty){const i=s._getDirty();i!==n.isDirty&&s._subjects.state.next({isDirty:i})}},[s,n.isDirty]),N.useEffect(()=>{var i;e.values&&!Kt(e.values,r.current)?(s._reset(e.values,{keepFieldsRef:!0,...s._options.resetOptions}),!((i=s._options.resetOptions)===null||i===void 0)&&i.keepIsValid||s._setValid(),r.current=e.values,a(l=>({...l}))):s._resetDefaultValues()},[s,e.values]),N.useEffect(()=>{s._state.mount||(s._setValid(),s._state.mount=!0),s._state.watch&&(s._state.watch=!1,s._subjects.state.next({...s._formState})),s._removeUnmounted()}),t.current.formState=N.useMemo(()=>tx(n,s),[s,n]),t.current}var SN=Object.defineProperty,$N=(e,t,r)=>t in e?SN(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,$d=(e,t,r)=>$N(e,typeof t!="symbol"?t+"":t,r);const vi=N.createContext({}),Hr=()=>N.useContext(vi),st=(e,t,r={})=>{if(!e)return!0;if("and"in e||"or"in e){const d="and"in e&&Array.isArray(e.and)&&e.and.length>0,u="or"in e&&Array.isArray(e.or)&&e.or.length>0;return d&&u?(console.warn("[evaluateFieldCondition] FieldConditionGroup com `and` e `or` simultâneos — apenas `and` será avaliado."),e.and.every(m=>st(m,t,r))):d?e.and.every(m=>st(m,t,r)):u?e.or.some(m=>st(m,t,r)):!0}const n=e;if(!n.campoId)return!0;const a=n.source==="evento"?r[n.campoId]:t[n.campoId];if(Array.isArray(a)){const d=n.valor;switch(n.operador){case"contem":return a.includes(d);case"naoContem":return!a.includes(d);case"vazio":return a.length===0;case"naoVazio":return a.length>0;case"igual":return a.length===1&&a[0]===d;case"diferente":return!(a.length===1&&a[0]===d);default:return!0}}const s=a==null||a===!1?"":a===!0?"1":String(a),i=n.valor!==void 0?String(n.valor):"",l=Number(s),c=Number(i);switch(n.operador){case"igual":return s===i;case"diferente":return s!==i;case"vazio":return!s;case"naoVazio":return!!s;case"contem":return s.includes(i);case"naoContem":return!s.includes(i);case"maiorQue":return!isNaN(l)&&!isNaN(c)?l>c:s>i;case"menorQue":return!isNaN(l)&&!isNaN(c)?l<c:s<i;case"maiorOuIgual":return!isNaN(l)&&!isNaN(c)?l>=c:s>=i;case"menorOuIgual":return!isNaN(l)&&!isNaN(c)?l<=c:s<=i;default:return!0}},EN=/^\d{3}\.?\d{3}\.?\d{3}-?\d{2}$/,DN=/^\(?\d{2}\)?\s?\d{4,5}-?\d{4}$/,TN=/^\d{5}-?\d{3}$/,AN=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,RN=e=>{const t=e.replace(/\D/g,"");if(t.length!==11||/^(\d)\1{10}$/.test(t))return!1;const r=n=>{let a=0;for(let i=0;i<n;i++)a+=parseInt(t[i])*(n+1-i);const s=a*10%11;return s>=10?0:s};return r(9)===parseInt(t[9])&&r(10)===parseInt(t[10])},Xn=new Map,IN=e=>{if(Xn.has(e))return Xn.get(e);if(/^\/.*\/[gimsuy]*$/.test(e))return Xn.set(e,null),null;try{const t=new RegExp(e);return Xn.set(e,t),t}catch{return Xn.set(e,null),null}},_a=(e,t,r={})=>{const n=e.validacao;if(e.tipo===T.CHECKBOX||e.tipo===T.SWITCH)return e.obrigatorio&&!t?"Campo obrigatório":void 0;if(e.tipo===T.SLIDER){const s=t!=null&&t!==""?Number(t):NaN;return e.obrigatorio&&isNaN(s)?"Campo obrigatório":isNaN(s)?void 0:(n==null?void 0:n.min)!==void 0&&s<n.min?`Valor mínimo: ${n.min}`:(n==null?void 0:n.max)!==void 0&&s>n.max?`Valor máximo: ${n.max}`:void 0}if(e.tipo===T.RATING){const s=t!==void 0?Number(t):0;return e.obrigatorio&&(!s||s<1)?"Avaliação obrigatória":void 0}if(e.tipo===T.DATE_RANGE){const s=t;if(e.obrigatorio){if(!(s!=null&&s.start))return"Data inicial obrigatória";if(!(s!=null&&s.end))return"Data final obrigatória"}return s!=null&&s.start&&s!=null&&s.end&&s.start>s.end?"A data inicial deve ser menor ou igual à data final":void 0}if(e.tipo===T.PARTICIPATION_TYPE){if(!e.obrigatorio)return;const s=t;return s!=null&&s.tipo?s.tipo==="por_dia"&&!s.data?"Selecione um dia para participar":"genero"in(s??{})&&!(s!=null&&s.genero)?"Selecione o sexo":void 0:"Selecione o tipo de participação"}if(e.tipo===T.CHECKBOX_GROUP){const s=Array.isArray(t)?t:[];return e.obrigatorio&&s.length===0?"Selecione pelo menos uma opção":void 0}if(e.tipo===T.FILE)return e.obrigatorio&&!t?"Arquivo obrigatório":void 0;if(e.tipo===T.TERMS)return e.obrigatorio&&t!=="accepted"?"Você precisa aceitar os termos para continuar":void 0;if(e.tipo===T.NUMBER){const s=t!=null?String(t):"";if(e.obrigatorio&&!s)return"Campo obrigatório";if(!s)return;const i=Number(s);return isNaN(i)?"Deve ser um número":(n==null?void 0:n.min)!==void 0&&i<n.min?`Valor mínimo: ${n.min}`:(n==null?void 0:n.max)!==void 0&&i>n.max?`Valor máximo: ${n.max}`:void 0}const a=t!=null?String(t):"";if(e.obrigatorio&&!a.trim())return"Campo obrigatório";if(a){if(e.tipo===T.EMAIL&&!AN.test(a))return"E-mail inválido";if(e.tipo===T.CPF&&(!EN.test(a)||!RN(a)))return"CPF inválido";if(e.tipo===T.TELEFONE&&!DN.test(a))return"Telefone inválido";if(e.tipo===T.CEP&&!TN.test(a))return"CEP inválido";if(n!=null&&n.minLength&&a.length<n.minLength)return`Mínimo ${n.minLength} caracteres`;if(n!=null&&n.maxLength&&a.length>n.maxLength)return`Máximo ${n.maxLength} caracteres`;if((e.tipo===T.DATE||e.tipo===T.DATETIME)&&a){if(n!=null&&n.minDate&&a<n.minDate)return`Data mínima: ${n.minDate}`;if(n!=null&&n.maxDate&&a>n.maxDate)return`Data máxima: ${n.maxDate}`}if((e.tipo===T.DATE||e.tipo===T.DATETIME)&&a&&((n==null?void 0:n.minAge)!=null||(n==null?void 0:n.maxAge)!=null)){const s=a.split("T")[0],i=new Date(s+"T00:00:00"),l=r["evento.dataInicioEvento"],c=l?new Date(l.split("T")[0]+"T00:00:00"):new Date;let d=c.getFullYear()-i.getFullYear();const u=c.getMonth()-i.getMonth();if((u<0||u===0&&c.getDate()<i.getDate())&&d--,n.minAge!=null&&d<n.minAge)return`Idade mínima: ${n.minAge} ano${n.minAge!==1?"s":""}`;if(n.maxAge!=null&&d>n.maxAge)return`Idade máxima: ${n.maxAge} ano${n.maxAge!==1?"s":""}`}if(n!=null&&n.regex){const s=IN(n.regex);if(s&&!s.test(a))return n.regexMessage||"Formato inválido"}}},Ed=new Set(["__proto__","constructor","prototype"]),xn=(e,t,r)=>{const n=t.split(".");let a=e;for(let i=0;i<n.length-1;i++){const l=n[i];if(Ed.has(l))return;(a[l]==null||typeof a[l]!="object")&&(a[l]={}),a=a[l]}const s=n[n.length-1];Ed.has(s)||(a[s]=r)},jn=async(e,t,r,n,a,s)=>{for(const i of e){const l=s[i.type];if(!l)continue;const c=await l(r,n,i,a);if(c)return i.message??c}},PN=(e,t={},r={})=>async n=>{var a,s,i,l,c;const d={},u=[...e.containers].sort((m,p)=>m.ordem-p.ordem);for(const m of u){if(m.repeatable||m.condicional&&!st(m.condicional,n,t))continue;const p=[...m.campos].sort((f,b)=>f.ordem-b.ordem);for(const f of p){if(!st(f.condicional,n,t)||f.tipo===T.HIDDEN||f.isDisabled||f.isReadOnly)continue;if(f.tipo===T.FIELD_ARRAY){const h=Array.isArray(n[f.nome])?n[f.nome]:[];f.obrigatorio&&h.length===0?d[f.nome]={type:"custom",message:"Adicione pelo menos um item"}:f.minItems&&h.length<f.minItems?d[f.nome]={type:"custom",message:`Mínimo de ${f.minItems} item${f.minItems!==1?"s":""}`}:f.maxItems&&h.length>f.maxItems&&(d[f.nome]={type:"custom",message:`Máximo de ${f.maxItems} item${f.maxItems!==1?"s":""}`});for(let x=0;x<h.length;x++){const y=h[x];for(const v of f.subFields??[]){if(v.isDisabled||v.isReadOnly||!st(v.condicional,y,t))continue;const j=_a(v,y[v.nome],t);if(j){xn(d,`${f.nome}.${x}.${v.nome}`,{type:"custom",message:j});continue}if((a=v.validate)!=null&&a.length){const w=await jn(v.validate,v.nome,y[v.nome],y,t,r);w&&xn(d,`${f.nome}.${x}.${v.nome}`,{type:"custom",message:w})}}}continue}if(f.tipo===T.SUB_FORM){const h=n[f.nome]??{};f.obrigatorio&&Object.keys(h).length===0&&(d[f.nome]={type:"custom",message:"Campo obrigatório"});for(const x of((s=f.subSchema)==null?void 0:s.fields)??[]){if(x.isDisabled||x.isReadOnly)continue;const y=_a(x,h[x.nome],t);if(y){xn(d,`${f.nome}.${x.nome}`,{type:"custom",message:y});continue}if((i=x.validate)!=null&&i.length){const v=await jn(x.validate,x.nome,h[x.nome],h,t,r);v&&xn(d,`${f.nome}.${x.nome}`,{type:"custom",message:v})}}continue}const b=_a(f,n[f.nome],t);if(b&&(d[f.nome]={type:"custom",message:b}),!d[f.nome]&&(l=f.validate)!=null&&l.length){const h=await jn(f.validate,f.nome,n[f.nome],n,t,r);h&&(d[f.nome]={type:"custom",message:h})}}}for(const m of u){if(!m.repeatable||!m.nome||m.condicional&&!st(m.condicional,n,t))continue;const p=Array.isArray(n[m.nome])?n[m.nome]:[];m.minItems&&p.length<m.minItems?d[m.nome]={type:"custom",message:`Mínimo de ${m.minItems} ${m.itemLabel??"item"}${m.minItems!==1?"s":""}`}:m.maxItems&&p.length>m.maxItems&&(d[m.nome]={type:"custom",message:`Máximo de ${m.maxItems} ${m.itemLabel??"item"}${m.maxItems!==1?"s":""}`});for(let f=0;f<p.length;f++){const b=p[f];for(const h of m.campos){if(!st(h.condicional,b,t)||h.tipo===T.HIDDEN||h.isDisabled||h.isReadOnly)continue;const x=_a(h,b[h.nome],t);if(x){xn(d,`${m.nome}.${f}.${h.nome}`,{type:"custom",message:x});continue}if((c=h.validate)!=null&&c.length){const y=await jn(h.validate,h.nome,b[h.nome],b,t,r);y&&xn(d,`${m.nome}.${f}.${h.nome}`,{type:"custom",message:y})}}}}return Object.keys(d).length>0?{values:{},errors:d}:{values:n,errors:{}}},_N=(e,t={},r={})=>async n=>{var a,s;const i={},l=[...e.containers].sort((c,d)=>c.ordem-d.ordem);for(const c of l)if(!(c.condicional&&!st(c.condicional,n,t))){if(c.repeatable&&c.nome){const d=Array.isArray(n[c.nome])?n[c.nome]:[];for(let u=0;u<d.length;u++){const m=d[u];for(const p of[...c.campos].sort((f,b)=>f.ordem-b.ordem)){if(!((a=p.warn)!=null&&a.length)||!st(p.condicional,m,t))continue;const f=await jn(p.warn,p.nome,m[p.nome],m,t,r);f&&(i[`${c.nome}.${u}.${p.nome}`]=f)}}continue}for(const d of[...c.campos].sort((u,m)=>u.ordem-m.ordem)){if(!((s=d.warn)!=null&&s.length)||!st(d.condicional,n,t))continue;const u=await jn(d.warn,d.nome,n[d.nome],n,t,r);u&&(i[d.nome]=u)}}return i},ON=/\{\{\s*(?:event|evento)\.([a-zA-Z0-9_.]+)\s*\}\}/g,wt=(e,t)=>e?e.replace(ON,(r,n)=>t[`evento.${n}`]??t[n]??r):e??"",FN=(e,t)=>({...e,label:wt(e.label,t)}),zN=(e,t)=>{var r;return{...e,label:wt(e.label,t),placeholder:wt(e.placeholder,t),hint:wt(e.hint,t),defaultValue:typeof e.defaultValue=="string"?wt(e.defaultValue,t):e.defaultValue,opcoes:(r=e.opcoes)==null?void 0:r.map(n=>FN(n,t))}},Tl=(e,t)=>({...e,titulo:wt(e.titulo,t),descricao:wt(e.descricao,t),campos:e.campos.map(r=>zN(r,t))}),LN=(e,t)=>({...e,titulo:wt(e.titulo,t),descricao:wt(e.descricao,t),containers:e.containers.map(r=>Tl(r,t))}),ux=()=>{const e=sa(),t=e.layout.containerStyle,r=e.layout.roundness??"rounded-xl",n=K("overflow-hidden",r,t==="card"?"border":"",t==="bordered"?"border":"",t==="glassmorphism"?"backdrop-blur-sm":""),a=t==="glassmorphism"?{background:"var(--t-surface)",borderColor:"var(--t-border)",borderWidth:"1px",borderStyle:"solid"}:{},s=K("border-b px-6 py-4",t==="flat"?"border-transparent":"");return{wrapperClass:n,wrapperStyle:a,headerClass:s,headerStyle:t==="glassmorphism"?{borderColor:"var(--t-border)"}:{},tmpl:e}},Mt=({name:e,control:t,placeholder:r,type:n="text",disabled:a,readOnly:s})=>{var i;const{field:l,fieldState:c}=Me({name:e,control:t}),d=!!c.error;return o.jsxs("div",{className:"space-y-1",children:[o.jsx(ue,{...l,value:l.value??"",type:n,placeholder:r,disabled:a,readOnly:s,className:K(d&&"border-destructive focus-visible:ring-destructive")}),((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})},Al=({name:e,control:t,placeholder:r,disabled:n,readOnly:a})=>{var s;const{field:i,fieldState:l}=Me({name:e,control:t});return o.jsxs("div",{className:"space-y-1",children:[o.jsx(po,{...i,value:i.value??"",placeholder:r,disabled:n,readOnly:a,rows:3,className:K(l.error&&"border-destructive focus-visible:ring-destructive")}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},Rl=({name:e,control:t,placeholder:r,options:n,disabled:a,readOnly:s})=>{var i;const{field:l,fieldState:c}=Me({name:e,control:t});return o.jsxs("div",{className:"space-y-1",children:[o.jsxs(Bt,{value:l.value??"",onValueChange:d=>!s&&l.onChange(d),disabled:a||s,children:[o.jsx(Rt,{className:K(c.error&&"border-destructive focus:ring-destructive"),onBlur:l.onBlur,children:o.jsx(Ut,{placeholder:r??"Selecione..."})}),o.jsx(It,{children:n.map(d=>o.jsx(qe,{value:d.valor,disabled:d.disabled,children:d.label},d.valor))})]}),((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})},Il=({name:e,control:t,label:r,disabled:n,readOnly:a})=>{var s;const{field:i,fieldState:l}=Me({name:e,control:t});return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[o.jsx(et,{name:i.name,checked:!!i.value,onCheckedChange:c=>!a&&i.onChange(!!c),onBlur:i.onBlur,disabled:n}),r&&o.jsx("span",{className:"text-sm leading-none",children:r})]}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},mx=({name:e,control:t,options:r,disabled:n})=>{var a;const{field:s,fieldState:i}=Me({name:e,control:t}),l=Array.isArray(s.value)?s.value:[],c=d=>{const u=l.includes(d)?l.filter(m=>m!==d):[...l,d];s.onChange(u)};return o.jsxs("div",{className:"space-y-1",children:[o.jsx("div",{className:"flex flex-col gap-2",onBlur:s.onBlur,children:r.map(d=>o.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[o.jsx(et,{checked:l.includes(d.valor),onCheckedChange:()=>c(d.valor),disabled:n||d.disabled}),o.jsx("span",{className:"text-sm leading-none",children:d.label})]},d.valor))}),((a=i.error)==null?void 0:a.message)&&o.jsx("p",{className:"text-sm text-destructive",children:i.error.message})]})},px=({name:e,control:t,options:r,visualStyle:n="default",disabled:a})=>{var s;const{field:i,fieldState:l}=Me({name:e,control:t}),c=n==="card";return o.jsxs("div",{className:"space-y-1",onBlur:i.onBlur,children:[o.jsx(Pi,{value:i.value??"",onValueChange:i.onChange,className:K(c?"grid grid-cols-2 gap-2 sm:grid-cols-3":"flex flex-col gap-2"),children:r.map(d=>o.jsxs("label",{className:K("flex items-center gap-2 cursor-pointer",c&&"rounded-lg border p-3 transition-colors hover:bg-accent data-[selected=true]:border-primary data-[selected=true]:bg-primary/5",(a||d.disabled)&&"cursor-not-allowed opacity-50"),"data-selected":i.value===d.valor?"true":void 0,children:[o.jsx(_i,{value:d.valor,disabled:a||d.disabled}),o.jsx("span",{className:"text-sm leading-none",children:d.label})]},d.valor))}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},fx=e=>{const t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),n=String(e.getDate()).padStart(2,"0");return`${t}-${r}-${n}`},MN=e=>{const t=new Date;return t.setFullYear(t.getFullYear()-e),fx(t)},VN=e=>{const t=new Date;return t.setFullYear(t.getFullYear()-e),fx(t)},aa=({name:e,control:t,isDatetime:r,disabled:n,readOnly:a,validacao:s})=>{var i;const{field:l,fieldState:c}=Me({name:e,control:t}),d=r?"datetime-local":"date",u=f=>r?f+"T00:00":f,m=(s==null?void 0:s.minAge)!=null?u(MN(s.minAge)):(s==null?void 0:s.maxDate)!=null?u(s.maxDate):void 0,p=(s==null?void 0:s.maxAge)!=null?u(VN(s.maxAge)):(s==null?void 0:s.minDate)!=null?u(s.minDate):void 0;return o.jsxs("div",{className:"space-y-1",children:[o.jsx(ue,{name:l.name,value:l.value??"",onChange:l.onChange,onBlur:l.onBlur,type:d,min:p,max:m,disabled:n,readOnly:a,className:K(c.error&&"border-destructive focus-visible:ring-destructive")}),((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})};function BN(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}const hx={128:"€",130:"‚",131:"ƒ",132:"„",133:"…",134:"†",135:"‡",136:"ˆ",137:"‰",138:"Š",139:"‹",140:"Œ",142:"Ž",145:"‘",146:"’",147:"“",148:"”",149:"•",150:"–",151:"—",152:"˜",153:"™",154:"š",155:"›",156:"œ",158:"ž",159:"Ÿ"};for(const[e,t]of Object.entries(hx));let Dd;function UN(){if(!(typeof globalThis.TextDecoder>"u"))return Dd??(Dd=new globalThis.TextDecoder("utf-8"))}const Pn=32*1024,Xt=65533;function HN(e,t="utf-8"){switch(t.toLowerCase()){case"utf-8":case"utf8":{const r=UN();return r?r.decode(e):qN(e)}case"utf-16le":return GN(e);case"us-ascii":case"ascii":return XN(e);case"latin1":case"iso-8859-1":return ZN(e);case"windows-1252":return KN(e);default:throw new RangeError(`Encoding '${t}' not supported`)}}function Pl(e,t){t.length!==0&&(e.push(String.fromCharCode.apply(null,t)),t.length=0)}function Ye(e,t,r){t.push(r),t.length>=Pn&&Pl(e,t)}function WN(e,t,r){if(r<=65535){Ye(e,t,r);return}r-=65536,Ye(e,t,55296+(r>>10)),Ye(e,t,56320+(r&1023))}function qN(e){const t=[],r=[];let n=0;for(e.length>=3&&e[0]===239&&e[1]===187&&e[2]===191&&(n=3);n<e.length;){const a=e[n];if(a<=127){Ye(t,r,a),n++;continue}if(a<194||a>244){Ye(t,r,Xt),n++;continue}if(a<=223){if(n+1>=e.length){Ye(t,r,Xt),n++;continue}const d=e[n+1];if((d&192)!==128){Ye(t,r,Xt),n++;continue}const u=(a&31)<<6|d&63;Ye(t,r,u),n+=2;continue}if(a<=239){if(n+2>=e.length){Ye(t,r,Xt),n++;continue}const d=e[n+1],u=e[n+2];if(!((d&192)===128&&(u&192)===128&&!(a===224&&d<160)&&!(a===237&&d>=160))){Ye(t,r,Xt),n++;continue}const m=(a&15)<<12|(d&63)<<6|u&63;Ye(t,r,m),n+=3;continue}if(n+3>=e.length){Ye(t,r,Xt),n++;continue}const s=e[n+1],i=e[n+2],l=e[n+3];if(!((s&192)===128&&(i&192)===128&&(l&192)===128&&!(a===240&&s<144)&&!(a===244&&s>143))){Ye(t,r,Xt),n++;continue}const c=(a&7)<<18|(s&63)<<12|(i&63)<<6|l&63;WN(t,r,c),n+=4}return Pl(t,r),t.join("")}function GN(e){const t=[],r=[],n=e.length;let a=0;for(;a+1<n;){const s=e[a]|e[a+1]<<8;if(a+=2,s>=55296&&s<=56319){if(a+1<n){const i=e[a]|e[a+1]<<8;i>=56320&&i<=57343?(Ye(t,r,s),Ye(t,r,i),a+=2):Ye(t,r,Xt)}else Ye(t,r,Xt);continue}if(s>=56320&&s<=57343){Ye(t,r,Xt);continue}Ye(t,r,s)}return a<n&&Ye(t,r,Xt),Pl(t,r),t.join("")}function XN(e){const t=[];for(let r=0;r<e.length;r+=Pn){const n=Math.min(e.length,r+Pn),a=new Array(n-r);for(let s=r,i=0;s<n;s++,i++)a[i]=e[s]&127;t.push(String.fromCharCode.apply(null,a))}return t.join("")}function ZN(e){const t=[];for(let r=0;r<e.length;r+=Pn){const n=Math.min(e.length,r+Pn),a=new Array(n-r);for(let s=r,i=0;s<n;s++,i++)a[i]=e[s];t.push(String.fromCharCode.apply(null,a))}return t.join("")}function KN(e){const t=[];let r="";for(let n=0;n<e.length;n++){const a=e[n],s=a>=128&&a<=159?hx[a]:void 0;r+=s??String.fromCharCode(a),r.length>=Pn&&(t.push(r),r="")}return r&&t.push(r),t.join("")}function Ct(e){return new DataView(e.buffer,e.byteOffset)}const YN={len:1,get(e,t){return Ct(e).getUint8(t)},put(e,t,r){return Ct(e).setUint8(t,r),t+1}},We={len:2,get(e,t){return Ct(e).getUint16(t,!0)},put(e,t,r){return Ct(e).setUint16(t,r,!0),t+2}},gn={len:2,get(e,t){return Ct(e).getUint16(t)},put(e,t,r){return Ct(e).setUint16(t,r),t+2}},Xe={len:4,get(e,t){return Ct(e).getUint32(t,!0)},put(e,t,r){return Ct(e).setUint32(t,r,!0),t+4}},Td={len:4,get(e,t){return Ct(e).getUint32(t)},put(e,t,r){return Ct(e).setUint32(t,r),t+4}},JN={len:4,get(e,t){return Ct(e).getInt32(t)},put(e,t,r){return Ct(e).setInt32(t,r),t+4}},QN={len:8,get(e,t){return Ct(e).getBigUint64(t,!0)},put(e,t,r){return Ct(e).setBigUint64(t,r,!0),t+8}};class br{constructor(t,r){this.len=t,this.encoding=r}get(t,r=0){const n=t.subarray(r,r+this.len);return HN(n,this.encoding)}}const e2="End-Of-Stream";class Qe extends Error{constructor(){super(e2),this.name="EndOfStreamError"}}class t2 extends Error{constructor(t="The operation was aborted"){super(t),this.name="AbortError"}}class xx{constructor(){this.endOfStream=!1,this.interrupted=!1,this.peekQueue=[]}async peek(t,r=!1){const n=await this.read(t,r);return this.peekQueue.push(t.subarray(0,n)),n}async read(t,r=!1){if(t.length===0)return 0;let n=this.readFromPeekBuffer(t);if(this.endOfStream||(n+=await this.readRemainderFromStream(t.subarray(n),r)),n===0&&!r)throw new Qe;return n}readFromPeekBuffer(t){let r=t.length,n=0;for(;this.peekQueue.length>0&&r>0;){const a=this.peekQueue.pop();if(!a)throw new Error("peekData should be defined");const s=Math.min(a.length,r);t.set(a.subarray(0,s),n),n+=s,r-=s,s<a.length&&this.peekQueue.push(a.subarray(s))}return n}async readRemainderFromStream(t,r){let n=0;for(;n<t.length&&!this.endOfStream;){if(this.interrupted)throw new t2;const a=await this.readFromStream(t.subarray(n),r);if(a===0)break;n+=a}if(!r&&n<t.length)throw new Qe;return n}}class r2 extends xx{constructor(t){super(),this.reader=t}async abort(){return this.close()}async close(){this.reader.releaseLock()}}class n2 extends r2{async readFromStream(t,r){if(t.length===0)return 0;const n=await this.reader.read(new Uint8Array(t.length),{min:r?void 0:t.length});return n.done&&(this.endOfStream=n.done),n.value?(t.set(n.value),n.value.length):0}}class Ad extends xx{constructor(t){super(),this.reader=t,this.buffer=null}writeChunk(t,r){const n=Math.min(r.length,t.length);return t.set(r.subarray(0,n)),n<r.length?this.buffer=r.subarray(n):this.buffer=null,n}async readFromStream(t,r){if(t.length===0)return 0;let n=0;for(this.buffer&&(n+=this.writeChunk(t,this.buffer));n<t.length&&!this.endOfStream;){const a=await this.reader.read();if(a.done){this.endOfStream=!0;break}a.value&&(n+=this.writeChunk(t.subarray(n),a.value))}if(!r&&n===0&&this.endOfStream)throw new Qe;return n}abort(){return this.interrupted=!0,this.reader.cancel()}async close(){await this.abort(),this.reader.releaseLock()}}function a2(e){try{const t=e.getReader({mode:"byob"});return t instanceof ReadableStreamDefaultReader?new Ad(t):new n2(t)}catch(t){if(t instanceof TypeError)return new Ad(e.getReader());throw t}}class _l{constructor(t){this.numBuffer=new Uint8Array(8),this.position=0,this.onClose=t==null?void 0:t.onClose,t!=null&&t.abortSignal&&t.abortSignal.addEventListener("abort",()=>{this.abort()})}async readToken(t,r=this.position){const n=new Uint8Array(t.len);if(await this.readBuffer(n,{position:r})<t.len)throw new Qe;return t.get(n,0)}async peekToken(t,r=this.position){const n=new Uint8Array(t.len);if(await this.peekBuffer(n,{position:r})<t.len)throw new Qe;return t.get(n,0)}async readNumber(t){if(await this.readBuffer(this.numBuffer,{length:t.len})<t.len)throw new Qe;return t.get(this.numBuffer,0)}async peekNumber(t){if(await this.peekBuffer(this.numBuffer,{length:t.len})<t.len)throw new Qe;return t.get(this.numBuffer,0)}async ignore(t){if(t<0)throw new RangeError("ignore length must be ≥ 0 bytes");if(this.fileInfo.size!==void 0){const r=this.fileInfo.size-this.position;if(t>r)return this.position+=r,r}return this.position+=t,t}async close(){var t;await this.abort(),await((t=this.onClose)==null?void 0:t.call(this))}normalizeOptions(t,r){if(!this.supportsRandomAccess()&&r&&r.position!==void 0&&r.position<this.position)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");return{mayBeLess:!1,offset:0,length:t.length,position:this.position,...r}}abort(){return Promise.resolve()}}const o2=256e3;class s2 extends _l{constructor(t,r){super(r),this.streamReader=t,this.fileInfo=(r==null?void 0:r.fileInfo)??{}}async readBuffer(t,r){const n=this.normalizeOptions(t,r),a=n.position-this.position;if(a>0)return await this.ignore(a),this.readBuffer(t,r);if(a<0)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");if(n.length===0)return 0;const s=await this.streamReader.read(t.subarray(0,n.length),n.mayBeLess);if(this.position+=s,(!r||!r.mayBeLess)&&s<n.length)throw new Qe;return s}async peekBuffer(t,r){const n=this.normalizeOptions(t,r);let a=0;if(n.position){const s=n.position-this.position;if(s>0){const i=new Uint8Array(n.length+s);return a=await this.peekBuffer(i,{mayBeLess:n.mayBeLess}),t.set(i.subarray(s)),a-s}if(s<0)throw new Error("Cannot peek from a negative offset in a stream")}if(n.length>0){try{a=await this.streamReader.peek(t.subarray(0,n.length),n.mayBeLess)}catch(s){if(r!=null&&r.mayBeLess&&s instanceof Qe)return 0;throw s}if(!n.mayBeLess&&a<n.length)throw new Qe}return a}async ignore(t){if(t<0)throw new RangeError("ignore length must be ≥ 0 bytes");const r=Math.min(o2,t),n=new Uint8Array(r);let a=0;for(;a<t;){const s=t-a,i=await this.readBuffer(n,{length:Math.min(r,s)});if(i<0)return i;a+=i}return a}abort(){return this.streamReader.abort()}async close(){return this.streamReader.close()}supportsRandomAccess(){return!1}}class i2 extends _l{constructor(t,r){super(r),this.uint8Array=t,this.fileInfo={...(r==null?void 0:r.fileInfo)??{},size:t.length}}async readBuffer(t,r){r!=null&&r.position&&(this.position=r.position);const n=await this.peekBuffer(t,r);return this.position+=n,n}async peekBuffer(t,r){const n=this.normalizeOptions(t,r),a=Math.min(this.uint8Array.length-n.position,n.length);if(!n.mayBeLess&&a<n.length)throw new Qe;return t.set(this.uint8Array.subarray(n.position,n.position+a)),a}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(t){this.position=t}}class l2 extends _l{constructor(t,r){super(r),this.blob=t,this.fileInfo={...(r==null?void 0:r.fileInfo)??{},size:t.size,mimeType:t.type}}async readBuffer(t,r){r!=null&&r.position&&(this.position=r.position);const n=await this.peekBuffer(t,r);return this.position+=n,n}async peekBuffer(t,r){const n=this.normalizeOptions(t,r),a=Math.min(this.blob.size-n.position,n.length);if(!n.mayBeLess&&a<n.length)throw new Qe;const s=await this.blob.slice(n.position,n.position+a).arrayBuffer();return t.set(new Uint8Array(s)),a}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(t){this.position=t}}function c2(e,t){const r=a2(e),n=t??{},a=n.onClose;return n.onClose=async()=>{if(await r.close(),a)return a()},new s2(r,n)}function d2(e,t){return new i2(e,t)}function u2(e,t){return new l2(e,t)}var bi={exports:{}},Os,Rd;function m2(){if(Rd)return Os;Rd=1;var e=1e3,t=e*60,r=t*60,n=r*24,a=n*7,s=n*365.25;Os=function(u,m){m=m||{};var p=typeof u;if(p==="string"&&u.length>0)return i(u);if(p==="number"&&isFinite(u))return m.long?c(u):l(u);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(u))};function i(u){if(u=String(u),!(u.length>100)){var m=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(u);if(m){var p=parseFloat(m[1]),f=(m[2]||"ms").toLowerCase();switch(f){case"years":case"year":case"yrs":case"yr":case"y":return p*s;case"weeks":case"week":case"w":return p*a;case"days":case"day":case"d":return p*n;case"hours":case"hour":case"hrs":case"hr":case"h":return p*r;case"minutes":case"minute":case"mins":case"min":case"m":return p*t;case"seconds":case"second":case"secs":case"sec":case"s":return p*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return p;default:return}}}}function l(u){var m=Math.abs(u);return m>=n?Math.round(u/n)+"d":m>=r?Math.round(u/r)+"h":m>=t?Math.round(u/t)+"m":m>=e?Math.round(u/e)+"s":u+"ms"}function c(u){var m=Math.abs(u);return m>=n?d(u,m,n,"day"):m>=r?d(u,m,r,"hour"):m>=t?d(u,m,t,"minute"):m>=e?d(u,m,e,"second"):u+" ms"}function d(u,m,p,f){var b=m>=p*1.5;return Math.round(u/p)+" "+f+(b?"s":"")}return Os}function p2(e){r.debug=r,r.default=r,r.coerce=c,r.disable=i,r.enable=a,r.enabled=l,r.humanize=m2(),r.destroy=d,Object.keys(e).forEach(u=>{r[u]=e[u]}),r.names=[],r.skips=[],r.formatters={};function t(u){let m=0;for(let p=0;p<u.length;p++)m=(m<<5)-m+u.charCodeAt(p),m|=0;return r.colors[Math.abs(m)%r.colors.length]}r.selectColor=t;function r(u){let m,p=null,f,b;function h(...x){if(!h.enabled)return;const y=h,v=Number(new Date),j=v-(m||v);y.diff=j,y.prev=m,y.curr=v,m=v,x[0]=r.coerce(x[0]),typeof x[0]!="string"&&x.unshift("%O");let w=0;x[0]=x[0].replace(/%([a-zA-Z%])/g,(C,S)=>{if(C==="%%")return"%";w++;const $=r.formatters[S];if(typeof $=="function"){const k=x[w];C=$.call(y,k),x.splice(w,1),w--}return C}),r.formatArgs.call(y,x),(y.log||r.log).apply(y,x)}return h.namespace=u,h.useColors=r.useColors(),h.color=r.selectColor(u),h.extend=n,h.destroy=r.destroy,Object.defineProperty(h,"enabled",{enumerable:!0,configurable:!1,get:()=>p!==null?p:(f!==r.namespaces&&(f=r.namespaces,b=r.enabled(u)),b),set:x=>{p=x}}),typeof r.init=="function"&&r.init(h),h}function n(u,m){const p=r(this.namespace+(typeof m>"u"?":":m)+u);return p.log=this.log,p}function a(u){r.save(u),r.namespaces=u,r.names=[],r.skips=[];const m=(typeof u=="string"?u:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const p of m)p[0]==="-"?r.skips.push(p.slice(1)):r.names.push(p)}function s(u,m){let p=0,f=0,b=-1,h=0;for(;p<u.length;)if(f<m.length&&(m[f]===u[p]||m[f]==="*"))m[f]==="*"?(b=f,h=p,f++):(p++,f++);else if(b!==-1)f=b+1,h++,p=h;else return!1;for(;f<m.length&&m[f]==="*";)f++;return f===m.length}function i(){const u=[...r.names,...r.skips.map(m=>"-"+m)].join(",");return r.enable(""),u}function l(u){for(const m of r.skips)if(s(u,m))return!1;for(const m of r.names)if(s(u,m))return!0;return!1}function c(u){return u instanceof Error?u.stack||u.message:u}function d(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}var f2=p2;(function(e,t){t.formatArgs=n,t.save=a,t.load=s,t.useColors=r,t.storage=i(),t.destroy=(()=>{let c=!1;return()=>{c||(c=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function r(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let c;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(c=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(c[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function n(c){if(c[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+c[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const d="color: "+this.color;c.splice(1,0,d,"color: inherit");let u=0,m=0;c[0].replace(/%[a-zA-Z%]/g,p=>{p!=="%%"&&(u++,p==="%c"&&(m=u))}),c.splice(m,0,d)}t.log=console.debug||console.log||(()=>{});function a(c){try{c?t.storage.setItem("debug",c):t.storage.removeItem("debug")}catch{}}function s(){let c;try{c=t.storage.getItem("debug")||t.storage.getItem("DEBUG")}catch{}return!c&&typeof process<"u"&&"env"in process&&(c=process.env.DEBUG),c}function i(){try{return localStorage}catch{}}e.exports=f2(t);const{formatters:l}=e.exports;l.j=function(c){try{return JSON.stringify(c)}catch(d){return"[UnexpectedJSONParseError]: "+d.message}}})(bi,bi.exports);var h2=bi.exports;const x2=BN(h2),kn={LocalFileHeader:67324752,DataDescriptor:134695760,CentralFileHeader:33639248,EndOfCentralDirectory:101010256},Id={get(e){return{signature:Xe.get(e,0),compressedSize:Xe.get(e,8),uncompressedSize:Xe.get(e,12)}},len:16},g2={get(e){const t=We.get(e,6);return{signature:Xe.get(e,0),minVersion:We.get(e,4),dataDescriptor:!!(t&8),compressedMethod:We.get(e,8),compressedSize:Xe.get(e,18),uncompressedSize:Xe.get(e,22),filenameLength:We.get(e,26),extraFieldLength:We.get(e,28),filename:null}},len:30},v2={get(e){return{signature:Xe.get(e,0),nrOfThisDisk:We.get(e,4),nrOfThisDiskWithTheStart:We.get(e,6),nrOfEntriesOnThisDisk:We.get(e,8),nrOfEntriesOfSize:We.get(e,10),sizeOfCd:Xe.get(e,12),offsetOfStartOfCd:Xe.get(e,16),zipFileCommentLength:We.get(e,20)}},len:22},b2={get(e){const t=We.get(e,8);return{signature:Xe.get(e,0),minVersion:We.get(e,6),dataDescriptor:!!(t&8),compressedMethod:We.get(e,10),compressedSize:Xe.get(e,20),uncompressedSize:Xe.get(e,24),filenameLength:We.get(e,28),extraFieldLength:We.get(e,30),fileCommentLength:We.get(e,32),relativeOffsetOfLocalHeader:Xe.get(e,42),filename:null}},len:46};function gx(e){const t=new Uint8Array(Xe.len);return Xe.put(t,0,e),t}const or=x2("tokenizer:inflate"),Fs=256*1024,y2=gx(kn.DataDescriptor),Oa=gx(kn.EndOfCentralDirectory);class va{constructor(t){this.tokenizer=t,this.syncBuffer=new Uint8Array(Fs)}async isZip(){return await this.peekSignature()===kn.LocalFileHeader}peekSignature(){return this.tokenizer.peekToken(Xe)}async findEndOfCentralDirectoryLocator(){const t=this.tokenizer,r=Math.min(16*1024,t.fileInfo.size),n=this.syncBuffer.subarray(0,r);await this.tokenizer.readBuffer(n,{position:t.fileInfo.size-r});for(let a=n.length-4;a>=0;a--)if(n[a]===Oa[0]&&n[a+1]===Oa[1]&&n[a+2]===Oa[2]&&n[a+3]===Oa[3])return t.fileInfo.size-r+a;return-1}async readCentralDirectory(){if(!this.tokenizer.supportsRandomAccess()){or("Cannot reading central-directory without random-read support");return}or("Reading central-directory...");const t=this.tokenizer.position,r=await this.findEndOfCentralDirectoryLocator();if(r>0){or("Central-directory 32-bit signature found");const n=await this.tokenizer.readToken(v2,r),a=[];this.tokenizer.setPosition(n.offsetOfStartOfCd);for(let s=0;s<n.nrOfEntriesOfSize;++s){const i=await this.tokenizer.readToken(b2);if(i.signature!==kn.CentralFileHeader)throw new Error("Expected Central-File-Header signature");i.filename=await this.tokenizer.readToken(new br(i.filenameLength,"utf-8")),await this.tokenizer.ignore(i.extraFieldLength),await this.tokenizer.ignore(i.fileCommentLength),a.push(i),or(`Add central-directory file-entry: n=${s+1}/${a.length}: filename=${a[s].filename}`)}return this.tokenizer.setPosition(t),a}this.tokenizer.setPosition(t)}async unzip(t){const r=await this.readCentralDirectory();if(r)return this.iterateOverCentralDirectory(r,t);let n=!1;do{const a=await this.readLocalFileHeader();if(!a)break;const s=t(a);n=!!s.stop;let i;if(await this.tokenizer.ignore(a.extraFieldLength),a.dataDescriptor&&a.compressedSize===0){const l=[];let c=Fs;or("Compressed-file-size unknown, scanning for next data-descriptor-signature....");let d=-1;for(;d<0&&c===Fs;){c=await this.tokenizer.peekBuffer(this.syncBuffer,{mayBeLess:!0}),d=w2(this.syncBuffer.subarray(0,c),y2);const u=d>=0?d:c;if(s.handler){const m=new Uint8Array(u);await this.tokenizer.readBuffer(m),l.push(m)}else await this.tokenizer.ignore(u)}or(`Found data-descriptor-signature at pos=${this.tokenizer.position}`),s.handler&&await this.inflate(a,j2(l),s.handler)}else s.handler?(or(`Reading compressed-file-data: ${a.compressedSize} bytes`),i=new Uint8Array(a.compressedSize),await this.tokenizer.readBuffer(i),await this.inflate(a,i,s.handler)):(or(`Ignoring compressed-file-data: ${a.compressedSize} bytes`),await this.tokenizer.ignore(a.compressedSize));if(or(`Reading data-descriptor at pos=${this.tokenizer.position}`),a.dataDescriptor&&(await this.tokenizer.readToken(Id)).signature!==134695760)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-Id.len}`)}while(!n)}async iterateOverCentralDirectory(t,r){for(const n of t){const a=r(n);if(a.handler){this.tokenizer.setPosition(n.relativeOffsetOfLocalHeader);const s=await this.readLocalFileHeader();if(s){await this.tokenizer.ignore(s.extraFieldLength);const i=new Uint8Array(n.compressedSize);await this.tokenizer.readBuffer(i),await this.inflate(s,i,a.handler)}}if(a.stop)break}}async inflate(t,r,n){if(t.compressedMethod===0)return n(r);if(t.compressedMethod!==8)throw new Error(`Unsupported ZIP compression method: ${t.compressedMethod}`);or(`Decompress filename=${t.filename}, compressed-size=${r.length}`);const a=await va.decompressDeflateRaw(r);return n(a)}static async decompressDeflateRaw(t){const r=new ReadableStream({start(s){s.enqueue(t),s.close()}}),n=new DecompressionStream("deflate-raw"),a=r.pipeThrough(n);try{const s=await new Response(a).arrayBuffer();return new Uint8Array(s)}catch(s){const i=s instanceof Error?`Failed to deflate ZIP entry: ${s.message}`:"Unknown decompression error in ZIP entry";throw new TypeError(i)}}async readLocalFileHeader(){const t=await this.tokenizer.peekToken(Xe);if(t===kn.LocalFileHeader){const r=await this.tokenizer.readToken(g2);return r.filename=await this.tokenizer.readToken(new br(r.filenameLength,"utf-8")),r}if(t===kn.CentralFileHeader)return!1;throw t===3759263696?new Error("Encrypted ZIP"):new Error("Unexpected signature")}}function w2(e,t){const r=e.length,n=t.length;if(n>r)return-1;for(let a=0;a<=r-n;a++){let s=!0;for(let i=0;i<n;i++)if(e[a+i]!==t[i]){s=!1;break}if(s)return a}return-1}function j2(e){const t=e.reduce((a,s)=>a+s.length,0),r=new Uint8Array(t);let n=0;for(const a of e)r.set(a,n),n+=a.length;return r}class k2{constructor(t){this.tokenizer=t}inflate(){const t=this.tokenizer;return new ReadableStream({async pull(r){const n=new Uint8Array(1024),a=await t.readBuffer(n,{mayBeLess:!0});if(a===0){r.close();return}r.enqueue(n.subarray(0,a))}}).pipeThrough(new DecompressionStream("gzip"))}}new globalThis.TextDecoder("utf8");new globalThis.TextEncoder;Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Pd(e){const{byteLength:t}=e;if(t===6)return e.getUint16(0)*2**32+e.getUint32(2);if(t===5)return e.getUint8(0)*2**32+e.getUint32(1);if(t===4)return e.getUint32(0);if(t===3)return e.getUint8(0)*2**16+e.getUint16(1);if(t===2)return e.getUint16(0);if(t===1)return e.getUint8(0)}function C2(e,t){if(t==="utf-16le"){const r=[];for(let n=0;n<e.length;n++){const a=e.charCodeAt(n);r.push(a&255,a>>8&255)}return r}if(t==="utf-16be"){const r=[];for(let n=0;n<e.length;n++){const a=e.charCodeAt(n);r.push(a>>8&255,a&255)}return r}return[...e].map(r=>r.charCodeAt(0))}function N2(e,t=0){const r=Number.parseInt(new br(6).get(e,148).replace(/\0.*$/,"").trim(),8);if(Number.isNaN(r))return!1;let n=256;for(let a=t;a<t+148;a++)n+=e[a];for(let a=t+156;a<t+512;a++)n+=e[a];return r===n}const S2={get:(e,t)=>e[t+3]&127|e[t+2]<<7|e[t+1]<<14|e[t]<<21,len:4},$2=["jpg","png","apng","gif","webp","flif","xcf","cr2","cr3","orf","arw","dng","nef","rw2","raf","tif","bmp","icns","jxr","psd","indd","zip","tar","rar","gz","bz2","7z","dmg","mp4","mid","mkv","webm","mov","avi","mpg","mp2","mp3","m4a","oga","ogg","ogv","opus","flac","wav","spx","amr","pdf","epub","elf","macho","exe","swf","rtf","wasm","woff","woff2","eot","ttf","otf","ttc","ico","flv","ps","xz","sqlite","nes","crx","xpi","cab","deb","ar","rpm","Z","lz","cfb","mxf","mts","blend","bpg","docx","pptx","xlsx","3gp","3g2","j2c","jp2","jpm","jpx","mj2","aif","qcp","odt","ods","odp","xml","mobi","heic","cur","ktx","ape","wv","dcm","ics","glb","pcap","dsf","lnk","alias","voc","ac3","m4v","m4p","m4b","f4v","f4p","f4b","f4a","mie","asf","ogm","ogx","mpc","arrow","shp","aac","mp1","it","s3m","xm","skp","avif","eps","lzh","pgp","asar","stl","chm","3mf","zst","jxl","vcf","jls","pst","dwg","parquet","class","arj","cpio","ace","avro","icc","fbx","vsdx","vtt","apk","drc","lz4","potx","xltx","dotx","xltm","ott","ots","otp","odg","otg","xlsm","docm","dotm","potm","pptm","jar","jmp","rm","sav","ppsm","ppsx","tar.gz","reg","dat"],E2=["image/jpeg","image/png","image/gif","image/webp","image/flif","image/x-xcf","image/x-canon-cr2","image/x-canon-cr3","image/tiff","image/bmp","image/vnd.ms-photo","image/vnd.adobe.photoshop","application/x-indesign","application/epub+zip","application/x-xpinstall","application/vnd.ms-powerpoint.slideshow.macroenabled.12","application/vnd.oasis.opendocument.text","application/vnd.oasis.opendocument.spreadsheet","application/vnd.oasis.opendocument.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.presentationml.slideshow","application/zip","application/x-tar","application/x-rar-compressed","application/gzip","application/x-bzip2","application/x-7z-compressed","application/x-apple-diskimage","application/vnd.apache.arrow.file","video/mp4","audio/midi","video/matroska","video/webm","video/quicktime","video/vnd.avi","audio/wav","audio/qcelp","audio/x-ms-asf","video/x-ms-asf","application/vnd.ms-asf","video/mpeg","video/3gpp","audio/mpeg","audio/mp4","video/ogg","audio/ogg","audio/ogg; codecs=opus","application/ogg","audio/flac","audio/ape","audio/wavpack","audio/amr","application/pdf","application/x-elf","application/x-mach-binary","application/x-msdownload","application/x-shockwave-flash","application/rtf","application/wasm","font/woff","font/woff2","application/vnd.ms-fontobject","font/ttf","font/otf","font/collection","image/x-icon","video/x-flv","application/postscript","application/eps","application/x-xz","application/x-sqlite3","application/x-nintendo-nes-rom","application/x-google-chrome-extension","application/vnd.ms-cab-compressed","application/x-deb","application/x-unix-archive","application/x-rpm","application/x-compress","application/x-lzip","application/x-cfb","application/x-mie","application/mxf","video/mp2t","application/x-blender","image/bpg","image/j2c","image/jp2","image/jpx","image/jpm","image/mj2","audio/aiff","application/xml","application/x-mobipocket-ebook","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/icns","image/ktx","application/dicom","audio/x-musepack","text/calendar","text/vcard","text/vtt","model/gltf-binary","application/vnd.tcpdump.pcap","audio/x-dsf","application/x.ms.shortcut","application/x.apple.alias","audio/x-voc","audio/vnd.dolby.dd-raw","audio/x-m4a","image/apng","image/x-olympus-orf","image/x-sony-arw","image/x-adobe-dng","image/x-nikon-nef","image/x-panasonic-rw2","image/x-fujifilm-raf","video/x-m4v","video/3gpp2","application/x-esri-shape","audio/aac","audio/x-it","audio/x-s3m","audio/x-xm","video/MP1S","video/MP2P","application/vnd.sketchup.skp","image/avif","application/x-lzh-compressed","application/pgp-encrypted","application/x-asar","model/stl","application/vnd.ms-htmlhelp","model/3mf","image/jxl","application/zstd","image/jls","application/vnd.ms-outlook","image/vnd.dwg","application/vnd.apache.parquet","application/java-vm","application/x-arj","application/x-cpio","application/x-ace-compressed","application/avro","application/vnd.iccprofile","application/x.autodesk.fbx","application/vnd.visio","application/vnd.android.package-archive","application/vnd.google.draco","application/x-lz4","application/vnd.openxmlformats-officedocument.presentationml.template","application/vnd.openxmlformats-officedocument.spreadsheetml.template","application/vnd.openxmlformats-officedocument.wordprocessingml.template","application/vnd.ms-excel.template.macroenabled.12","application/vnd.oasis.opendocument.text-template","application/vnd.oasis.opendocument.spreadsheet-template","application/vnd.oasis.opendocument.presentation-template","application/vnd.oasis.opendocument.graphics","application/vnd.oasis.opendocument.graphics-template","application/vnd.ms-excel.sheet.macroenabled.12","application/vnd.ms-word.document.macroenabled.12","application/vnd.ms-word.template.macroenabled.12","application/vnd.ms-powerpoint.template.macroenabled.12","application/vnd.ms-powerpoint.presentation.macroenabled.12","application/java-archive","application/vnd.rn-realmedia","application/x-spss-sav","application/x-ms-regedit","application/x-ft-windows-registry-hive","application/x-jmp-data"],Jn=4100,D2=Jn-2,mr=1024*1024,_d=1024,T2=2**31-1,Vt=16*1024*1024,Jo=mr,Od=mr,A2=Vt,R2=1,Fd=100,zs=Vt,zd=64,Ld=Jo,I2=256,P2=512,_2=Vt,O2=512,F2=512,Md=256,Vd=Jo,Bd=Jo,z2=Jo,Ud=Vt,L2=new Set(["Unexpected signature","Encrypted ZIP","Expected Central-File-Header signature"]),M2=["ZIP entry count exceeds ","Unsupported ZIP compression method:","ZIP entry compressed data exceeds ","ZIP entry decompressed data exceeds ","Expected data-descriptor-signature at position "],V2=new Set(["Z_BUF_ERROR","Z_DATA_ERROR","ERR_INVALID_STATE"]);class Jr extends Error{}function B2(e){var t;const r=e==null?void 0:e.streamReader;if(((t=r==null?void 0:r.constructor)==null?void 0:t.name)!=="WebStreamByobReader")return e;const{reader:n}=r,a=async()=>{await n.cancel(),n.releaseLock()};return r.close=a,r.abort=async()=>{r.interrupted=!0,await a()},e}function Ol(e,t,r){if(!Number.isFinite(e)||e<0||e>t)throw new Jr(`${r} has invalid size ${e} (maximum ${t} bytes)`);return e}async function Ir(e,t,{maximumLength:r=Vt,reason:n="skip"}={}){const a=Ol(t,r,n);await e.ignore(a)}async function Ls(e,t,r,{maximumLength:n=t.length,reason:a="read"}={}){const s=t.length,i=Ol(s,n,a);return e.readBuffer(t,{...r,length:i})}async function U2(e,{maximumLength:t=mr}={}){const r=new ReadableStream({start(l){l.enqueue(e),l.close()}}).pipeThrough(new DecompressionStream("deflate-raw")).getReader(),n=[];let a=0;try{for(;;){const{done:l,value:c}=await r.read();if(l)break;if(a+=c.length,a>t)throw await r.cancel(),new Error(`ZIP entry decompressed data exceeds ${t} bytes`);n.push(c)}}finally{r.releaseLock()}const s=new Uint8Array(a);let i=0;for(const l of n)s.set(l,i),i+=l.length;return s}const vx=134695760,io=16,H2=io-1;function W2(e,t){if(e.length<io)return-1;const r=e.length-io;for(let n=0;n<=r;n++)if(Xe.get(e,n)===vx&&Xe.get(e,n+8)===t+n)return n;return-1}function q2(e){return(e.codePointAt(0)&32)!==0}function G2(e,t){const r=new Uint8Array(t);let n=0;for(const a of e)r.set(a,n),n+=a.length;return r}async function X2(e,{shouldBuffer:t,maximumLength:r=mr}={}){const{syncBuffer:n}=e,{length:a}=n,s=[];let i=0;for(;;){const l=await e.tokenizer.peekBuffer(n,{mayBeLess:!0}),c=W2(n.subarray(0,l),i),d=c>=0?0:l===a?Math.min(H2,l-1):0,u=c>=0?c:l-d;if(u===0)break;if(i+=u,i>r)throw new Error(`ZIP entry compressed data exceeds ${r} bytes`);if(t){const m=new Uint8Array(u);await e.tokenizer.readBuffer(m),s.push(m)}else await e.tokenizer.ignore(u);if(c>=0)break}if(pt(e.tokenizer)||(e.knownSizeDescriptorScannedBytes+=i),!!t)return G2(s,i)}function Z2(e,t){return pt(e.tokenizer)?Math.max(0,Vt-(e.tokenizer.position-t)):Math.max(0,mr-e.knownSizeDescriptorScannedBytes)}async function K2(e,t,{shouldBuffer:r,maximumDescriptorLength:n=mr}={}){if(t.dataDescriptor&&t.compressedSize===0)return X2(e,{shouldBuffer:r,maximumLength:n});if(!r){await Ir(e.tokenizer,t.compressedSize,{maximumLength:pt(e.tokenizer)?mr:e.tokenizer.fileInfo.size,reason:"ZIP entry compressed data"});return}const a=nS(e.tokenizer);if(!Number.isFinite(t.compressedSize)||t.compressedSize<0||t.compressedSize>a)throw new Error(`ZIP entry compressed data exceeds ${a} bytes`);const s=new Uint8Array(t.compressedSize);return await e.tokenizer.readBuffer(s),s}va.prototype.inflate=async function(e,t,r){if(e.compressedMethod===0)return r(t);if(e.compressedMethod!==8)throw new Error(`Unsupported ZIP compression method: ${e.compressedMethod}`);const n=await U2(t,{maximumLength:mr});return r(n)};va.prototype.unzip=async function(e){let t=!1,r=0;const n=this.tokenizer.position;this.knownSizeDescriptorScannedBytes=0;do{if(Qn(this.tokenizer,n,Vt))throw new Jr(`ZIP stream probing exceeds ${Vt} bytes`);const a=await this.readLocalFileHeader();if(!a)break;if(r++,r>_d)throw new Error(`ZIP entry count exceeds ${_d}`);const s=e(a);t=!!s.stop,await this.tokenizer.ignore(a.extraFieldLength);const i=await K2(this,a,{shouldBuffer:!!s.handler,maximumDescriptorLength:Math.min(mr,Z2(this,n))});if(s.handler&&await this.inflate(a,i,s.handler),a.dataDescriptor){const l=new Uint8Array(io);if(await this.tokenizer.readBuffer(l),Xe.get(l,0)!==vx)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-l.length}`)}if(Qn(this.tokenizer,n,Vt))throw new Jr(`ZIP stream probing exceeds ${Vt} bytes`)}while(!t)};function Y2(e,t){const r=e.getReader();let n=0,a=!1,s=!1;const i=async l=>{a||s||(s=!0,await r.cancel(l))};return new ReadableStream({async pull(l){if(n>=t){l.close(),await i();return}const{done:c,value:d}=await r.read();if(c||!d){a=!0,l.close();return}const u=t-n;if(d.length>u){l.enqueue(d.subarray(0,u)),n+=u,l.close(),await i();return}l.enqueue(d),n+=d.length},async cancel(l){await i(l)}})}async function J2(e,t){return new Fl(t).fromBlob(e)}function Hd(e){switch(e=e.toLowerCase(),e){case"application/epub+zip":return{ext:"epub",mime:e};case"application/vnd.oasis.opendocument.text":return{ext:"odt",mime:e};case"application/vnd.oasis.opendocument.text-template":return{ext:"ott",mime:e};case"application/vnd.oasis.opendocument.spreadsheet":return{ext:"ods",mime:e};case"application/vnd.oasis.opendocument.spreadsheet-template":return{ext:"ots",mime:e};case"application/vnd.oasis.opendocument.presentation":return{ext:"odp",mime:e};case"application/vnd.oasis.opendocument.presentation-template":return{ext:"otp",mime:e};case"application/vnd.oasis.opendocument.graphics":return{ext:"odg",mime:e};case"application/vnd.oasis.opendocument.graphics-template":return{ext:"otg",mime:e};case"application/vnd.openxmlformats-officedocument.presentationml.slideshow":return{ext:"ppsx",mime:e};case"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":return{ext:"xlsx",mime:e};case"application/vnd.ms-excel.sheet.macroenabled":return{ext:"xlsm",mime:"application/vnd.ms-excel.sheet.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.spreadsheetml.template":return{ext:"xltx",mime:e};case"application/vnd.ms-excel.template.macroenabled":return{ext:"xltm",mime:"application/vnd.ms-excel.template.macroenabled.12"};case"application/vnd.ms-powerpoint.slideshow.macroenabled":return{ext:"ppsm",mime:"application/vnd.ms-powerpoint.slideshow.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return{ext:"docx",mime:e};case"application/vnd.ms-word.document.macroenabled":return{ext:"docm",mime:"application/vnd.ms-word.document.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.template":return{ext:"dotx",mime:e};case"application/vnd.ms-word.template.macroenabledtemplate":return{ext:"dotm",mime:"application/vnd.ms-word.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.template":return{ext:"potx",mime:e};case"application/vnd.ms-powerpoint.template.macroenabled":return{ext:"potm",mime:"application/vnd.ms-powerpoint.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.presentation":return{ext:"pptx",mime:e};case"application/vnd.ms-powerpoint.presentation.macroenabled":return{ext:"pptm",mime:"application/vnd.ms-powerpoint.presentation.macroenabled.12"};case"application/vnd.ms-visio.drawing":return{ext:"vsdx",mime:"application/vnd.visio"};case"application/vnd.ms-package.3dmanufacturing-3dmodel+xml":return{ext:"3mf",mime:"model/3mf"}}}function sr(e,t,r){r={offset:0,...r};for(const[n,a]of t.entries())if(r.mask){if(a!==(r.mask[n]&e[n+r.offset]))return!1}else if(a!==e[n+r.offset])return!1;return!0}function Q2(e){return Number.isFinite(e)?Math.max(1,Math.trunc(e)):Jn}function eS(e,t,r){return r===void 0?e.read(t):(r.throwIfAborted(),new Promise((n,a)=>{const s=()=>{r.removeEventListener("abort",i)},i=()=>{const l=r.reason;s(),(async()=>{try{await e.cancel(l)}catch{}})(),a(l)};r.addEventListener("abort",i,{once:!0}),(async()=>{try{const l=await e.read(t);s(),n(l)}catch(l){s(),a(l)}})()}))}function tS(e){return Number.isFinite(e)?Math.max(0,Math.min(D2,Math.trunc(e))):0}function rS(e){return Number.isFinite(e)?Math.max(0,e):Number.MAX_SAFE_INTEGER}function pt(e){const t=e.fileInfo.size;return!Number.isFinite(t)||t===Number.MAX_SAFE_INTEGER}function Qn(e,t,r){return pt(e)&&e.position-t>r}function nS(e){const t=e.fileInfo.size,r=Number.isFinite(t)?Math.max(0,t-e.position):Number.MAX_SAFE_INTEGER;return Math.min(r,T2)}function aS(e){if(e instanceof Qe||e instanceof Jr)return!0;if(!(e instanceof Error))return!1;if(L2.has(e.message)||V2.has(e.code))return!0;for(const t of M2)if(e.message.startsWith(t))return!0;return!1}function Wd(e,t=mr){const r=[e.compressedSize,e.uncompressedSize];for(const n of r)if(!Number.isFinite(n)||n<0||n>t)return!1;return!0}function oS(){return{hasContentTypesEntry:!1,hasParsedContentTypesEntry:!1,isParsingContentTypes:!1,hasUnparseableContentTypes:!1,hasWordDirectory:!1,hasPresentationDirectory:!1,hasSpreadsheetDirectory:!1,hasThreeDimensionalModelEntry:!1}}function sS(e,t){t.startsWith("word/")&&(e.hasWordDirectory=!0),t.startsWith("ppt/")&&(e.hasPresentationDirectory=!0),t.startsWith("xl/")&&(e.hasSpreadsheetDirectory=!0),t.startsWith("3D/")&&t.endsWith(".model")&&(e.hasThreeDimensionalModelEntry=!0)}function qd(e){if(!(!e.hasContentTypesEntry||e.hasUnparseableContentTypes||e.isParsingContentTypes||e.hasParsedContentTypesEntry)){if(e.hasWordDirectory)return{ext:"docx",mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"};if(e.hasPresentationDirectory)return{ext:"pptx",mime:"application/vnd.openxmlformats-officedocument.presentationml.presentation"};if(e.hasSpreadsheetDirectory)return{ext:"xlsx",mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"};if(e.hasThreeDimensionalModelEntry)return{ext:"3mf",mime:"model/3mf"}}}function iS(e){const t=e.indexOf('.main+xml"');if(t===-1){const a="application/vnd.ms-package.3dmanufacturing-3dmodel+xml";return e.includes(`ContentType="${a}"`)?a:void 0}const r=e.slice(0,t),n=r.lastIndexOf('"');return r.slice(n+1)}class Fl{constructor(t){$d(this,"detectConfident",async n=>{if(this.buffer=new Uint8Array(Jn),n.fileInfo.size===void 0&&(n.fileInfo.size=Number.MAX_SAFE_INTEGER),this.tokenizer=n,pt(n)&&(await n.peekBuffer(this.buffer,{length:3,mayBeLess:!0}),this.check([31,139,8])))return this.detectGzip(n);if(await n.peekBuffer(this.buffer,{length:32,mayBeLess:!0}),this.check([66,77]))return{ext:"bmp",mime:"image/bmp"};if(this.check([11,119]))return{ext:"ac3",mime:"audio/vnd.dolby.dd-raw"};if(this.check([120,1]))return{ext:"dmg",mime:"application/x-apple-diskimage"};if(this.check([77,90]))return{ext:"exe",mime:"application/x-msdownload"};if(this.check([37,33]))return await n.peekBuffer(this.buffer,{length:24,mayBeLess:!0}),this.checkString("PS-Adobe-",{offset:2})&&this.checkString(" EPSF-",{offset:14})?{ext:"eps",mime:"application/eps"}:{ext:"ps",mime:"application/postscript"};if(this.check([31,160])||this.check([31,157]))return{ext:"Z",mime:"application/x-compress"};if(this.check([199,113]))return{ext:"cpio",mime:"application/x-cpio"};if(this.check([96,234]))return{ext:"arj",mime:"application/x-arj"};if(this.check([239,187,191]))return this.detectionReentryCount>=Md?void 0:(this.detectionReentryCount++,await this.tokenizer.ignore(3),this.detectConfident(n));if(this.check([71,73,70]))return{ext:"gif",mime:"image/gif"};if(this.check([73,73,188]))return{ext:"jxr",mime:"image/vnd.ms-photo"};if(this.check([31,139,8]))return this.detectGzip(n);if(this.check([66,90,104]))return{ext:"bz2",mime:"application/x-bzip2"};if(this.checkString("ID3")){await Ir(n,6,{maximumLength:6,reason:"ID3 header prefix"});const a=await n.readToken(S2),s=pt(n);if(!Number.isFinite(a)||a<0||s&&(a>zs||n.position+a>zs))return;if(n.position+a>n.fileInfo.size)return s?void 0:{ext:"mp3",mime:"audio/mpeg"};try{await Ir(n,a,{maximumLength:s?zs:n.fileInfo.size,reason:"ID3 payload"})}catch(i){if(i instanceof Qe)return;throw i}return this.detectionReentryCount>=Md?void 0:(this.detectionReentryCount++,this.parseTokenizer(n,this.detectionReentryCount))}if(this.checkString("MP+"))return{ext:"mpc",mime:"audio/x-musepack"};if((this.buffer[0]===67||this.buffer[0]===70)&&this.check([87,83],{offset:1}))return{ext:"swf",mime:"application/x-shockwave-flash"};if(this.check([255,216,255]))return this.check([247],{offset:3})?{ext:"jls",mime:"image/jls"}:{ext:"jpg",mime:"image/jpeg"};if(this.check([79,98,106,1]))return{ext:"avro",mime:"application/avro"};if(this.checkString("FLIF"))return{ext:"flif",mime:"image/flif"};if(this.checkString("8BPS"))return{ext:"psd",mime:"image/vnd.adobe.photoshop"};if(this.checkString("MPCK"))return{ext:"mpc",mime:"audio/x-musepack"};if(this.checkString("FORM"))return{ext:"aif",mime:"audio/aiff"};if(this.checkString("icns",{offset:0}))return{ext:"icns",mime:"image/icns"};if(this.check([80,75,3,4])){let a;const s=oS();try{await new va(n).unzip(i=>{sS(s,i.filename);const l=i.filename==="[Content_Types].xml",c=qd(s);if(!l&&c)return a=c,{stop:!0};switch(i.filename){case"META-INF/mozilla.rsa":return a={ext:"xpi",mime:"application/x-xpinstall"},{stop:!0};case"META-INF/MANIFEST.MF":return a={ext:"jar",mime:"application/java-archive"},{stop:!0};case"mimetype":return Wd(i,Od)?{async handler(d){const u=new TextDecoder("utf-8").decode(d).trim();a=Hd(u)},stop:!0}:{};case"[Content_Types].xml":return s.hasContentTypesEntry=!0,Wd(i,Od)?(s.isParsingContentTypes=!0,{async handler(d){const u=new TextDecoder("utf-8").decode(d),m=iS(u);m&&(a=Hd(m)),s.hasParsedContentTypesEntry=!0,s.isParsingContentTypes=!1},stop:!0}):(s.hasUnparseableContentTypes=!0,{});default:return/classes\d*\.dex/.test(i.filename)?(a={ext:"apk",mime:"application/vnd.android.package-archive"},{stop:!0}):{}}})}catch(i){if(!aS(i))throw i;s.isParsingContentTypes&&(s.isParsingContentTypes=!1,s.hasUnparseableContentTypes=!0)}return a??qd(s)??{ext:"zip",mime:"application/zip"}}if(this.checkString("OggS")){await n.ignore(28);const a=new Uint8Array(8);return await n.readBuffer(a),sr(a,[79,112,117,115,72,101,97,100])?{ext:"opus",mime:"audio/ogg; codecs=opus"}:sr(a,[128,116,104,101,111,114,97])?{ext:"ogv",mime:"video/ogg"}:sr(a,[1,118,105,100,101,111,0])?{ext:"ogm",mime:"video/ogg"}:sr(a,[127,70,76,65,67])?{ext:"oga",mime:"audio/ogg"}:sr(a,[83,112,101,101,120,32,32])?{ext:"spx",mime:"audio/ogg"}:sr(a,[1,118,111,114,98,105,115])?{ext:"ogg",mime:"audio/ogg"}:{ext:"ogx",mime:"application/ogg"}}if(this.check([80,75])&&(this.buffer[2]===3||this.buffer[2]===5||this.buffer[2]===7)&&(this.buffer[3]===4||this.buffer[3]===6||this.buffer[3]===8))return{ext:"zip",mime:"application/zip"};if(this.checkString("MThd"))return{ext:"mid",mime:"audio/midi"};if(this.checkString("wOFF")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff",mime:"font/woff"};if(this.checkString("wOF2")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff2",mime:"font/woff2"};if(this.check([212,195,178,161])||this.check([161,178,195,212]))return{ext:"pcap",mime:"application/vnd.tcpdump.pcap"};if(this.checkString("DSD "))return{ext:"dsf",mime:"audio/x-dsf"};if(this.checkString("LZIP"))return{ext:"lz",mime:"application/x-lzip"};if(this.checkString("fLaC"))return{ext:"flac",mime:"audio/flac"};if(this.check([66,80,71,251]))return{ext:"bpg",mime:"image/bpg"};if(this.checkString("wvpk"))return{ext:"wv",mime:"audio/wavpack"};if(this.checkString("%PDF"))return{ext:"pdf",mime:"application/pdf"};if(this.check([0,97,115,109]))return{ext:"wasm",mime:"application/wasm"};if(this.check([73,73])){const a=await this.readTiffHeader(!1);if(a)return a}if(this.check([77,77])){const a=await this.readTiffHeader(!0);if(a)return a}if(this.checkString("MAC "))return{ext:"ape",mime:"audio/ape"};if(this.check([26,69,223,163])){async function a(){const d=await n.peekNumber(YN);let u=128,m=0;for(;!(d&u)&&u!==0;)++m,u>>=1;const p=new Uint8Array(m+1);return await Ls(n,p,void 0,{maximumLength:p.length,reason:"EBML field"}),p}async function s(){const d=await a(),u=await a();u[0]^=128>>u.length-1;const m=Math.min(6,u.length),p=new DataView(d.buffer),f=new DataView(u.buffer,u.length-m,m);return{id:Pd(p),len:Pd(f)}}async function i(d){let u=0;for(;d>0;){if(u++,u>I2||Qn(n,c,Vt))return;const m=n.position,p=await s();if(p.id===17026){if(p.len>zd)return;const f=Ol(p.len,zd,"EBML DocType");return(await n.readToken(new br(f))).replaceAll(/\00.*$/g,"")}if(pt(n)&&(!Number.isFinite(p.len)||p.len<0||p.len>Ld)||(await Ir(n,p.len,{maximumLength:pt(n)?Ld:n.fileInfo.size,reason:"EBML payload"}),--d,n.position<=m))return}}const l=await s(),c=n.position;switch(await i(l.len)){case"webm":return{ext:"webm",mime:"video/webm"};case"matroska":return{ext:"mkv",mime:"video/matroska"};default:return}}if(this.checkString("SQLi"))return{ext:"sqlite",mime:"application/x-sqlite3"};if(this.check([78,69,83,26]))return{ext:"nes",mime:"application/x-nintendo-nes-rom"};if(this.checkString("Cr24"))return{ext:"crx",mime:"application/x-google-chrome-extension"};if(this.checkString("MSCF")||this.checkString("ISc("))return{ext:"cab",mime:"application/vnd.ms-cab-compressed"};if(this.check([237,171,238,219]))return{ext:"rpm",mime:"application/x-rpm"};if(this.check([197,208,211,198]))return{ext:"eps",mime:"application/eps"};if(this.check([40,181,47,253]))return{ext:"zst",mime:"application/zstd"};if(this.check([127,69,76,70]))return{ext:"elf",mime:"application/x-elf"};if(this.check([33,66,68,78]))return{ext:"pst",mime:"application/vnd.ms-outlook"};if(this.checkString("PAR1")||this.checkString("PARE"))return{ext:"parquet",mime:"application/vnd.apache.parquet"};if(this.checkString("ttcf"))return{ext:"ttc",mime:"font/collection"};if(this.check([254,237,250,206])||this.check([254,237,250,207])||this.check([206,250,237,254])||this.check([207,250,237,254]))return{ext:"macho",mime:"application/x-mach-binary"};if(this.check([4,34,77,24]))return{ext:"lz4",mime:"application/x-lz4"};if(this.checkString("regf"))return{ext:"dat",mime:"application/x-ft-windows-registry-hive"};if(this.checkString("$FL2")||this.checkString("$FL3"))return{ext:"sav",mime:"application/x-spss-sav"};if(this.check([79,84,84,79,0]))return{ext:"otf",mime:"font/otf"};if(this.checkString("#!AMR"))return{ext:"amr",mime:"audio/amr"};if(this.checkString("{\\rtf"))return{ext:"rtf",mime:"application/rtf"};if(this.check([70,76,86,1]))return{ext:"flv",mime:"video/x-flv"};if(this.checkString("IMPM"))return{ext:"it",mime:"audio/x-it"};if(this.checkString("-lh0-",{offset:2})||this.checkString("-lh1-",{offset:2})||this.checkString("-lh2-",{offset:2})||this.checkString("-lh3-",{offset:2})||this.checkString("-lh4-",{offset:2})||this.checkString("-lh5-",{offset:2})||this.checkString("-lh6-",{offset:2})||this.checkString("-lh7-",{offset:2})||this.checkString("-lzs-",{offset:2})||this.checkString("-lz4-",{offset:2})||this.checkString("-lz5-",{offset:2})||this.checkString("-lhd-",{offset:2}))return{ext:"lzh",mime:"application/x-lzh-compressed"};if(this.check([0,0,1,186])){if(this.check([33],{offset:4,mask:[241]}))return{ext:"mpg",mime:"video/MP1S"};if(this.check([68],{offset:4,mask:[196]}))return{ext:"mpg",mime:"video/MP2P"}}if(this.checkString("ITSF"))return{ext:"chm",mime:"application/vnd.ms-htmlhelp"};if(this.check([202,254,186,190])){const a=Td.get(this.buffer,4),s=gn.get(this.buffer,6);if(a>0&&a<=30)return{ext:"macho",mime:"application/x-mach-binary"};if(s>30)return{ext:"class",mime:"application/java-vm"}}if(this.checkString(".RMF"))return{ext:"rm",mime:"application/vnd.rn-realmedia"};if(this.checkString("DRACO"))return{ext:"drc",mime:"application/vnd.google.draco"};if(this.check([253,55,122,88,90,0]))return{ext:"xz",mime:"application/x-xz"};if(this.checkString("<?xml "))return{ext:"xml",mime:"application/xml"};if(this.check([55,122,188,175,39,28]))return{ext:"7z",mime:"application/x-7z-compressed"};if(this.check([82,97,114,33,26,7])&&(this.buffer[6]===0||this.buffer[6]===1))return{ext:"rar",mime:"application/x-rar-compressed"};if(this.checkString("solid "))return{ext:"stl",mime:"model/stl"};if(this.checkString("AC")){const a=new br(4,"latin1").get(this.buffer,2);if(a.match("^d*")&&a>=1e3&&a<=1050)return{ext:"dwg",mime:"image/vnd.dwg"}}if(this.checkString("070707"))return{ext:"cpio",mime:"application/x-cpio"};if(this.checkString("BLENDER"))return{ext:"blend",mime:"application/x-blender"};if(this.checkString("!<arch>"))return await n.ignore(8),await n.readToken(new br(13,"ascii"))==="debian-binary"?{ext:"deb",mime:"application/x-deb"}:{ext:"ar",mime:"application/x-unix-archive"};if(this.checkString("WEBVTT")&&[`
|
|
83
|
-
`,"\r"," "," ","\0"].some(a=>this.checkString(a,{offset:6})))return{ext:"vtt",mime:"text/vtt"};if(this.check([137,80,78,71,13,10,26,10])){const a={ext:"png",mime:"image/png"},s={ext:"apng",mime:"image/apng"};await n.ignore(8);async function i(){return{length:await n.readToken(
|
|
84
|
-
`))return{ext:"reg",mime:"application/x-ms-regedit"};if(this.check([82,73,70,70])){if(this.checkString("WEBP",{offset:8}))return{ext:"webp",mime:"image/webp"};if(this.check([65,86,73],{offset:8}))return{ext:"avi",mime:"video/vnd.avi"};if(this.check([87,65,86,69],{offset:8}))return{ext:"wav",mime:"audio/wav"};if(this.check([81,76,67,77],{offset:8}))return{ext:"qcp",mime:"audio/qcelp"}}if(this.check([73,73,85,0,24,0,0,0,136,231,116,216]))return{ext:"rw2",mime:"image/x-panasonic-rw2"};if(this.check([48,38,178,117,142,102,207,17,166,217])){let a=!1;try{async function s(){const d=new Uint8Array(16);return await
|
|
85
|
-
`,{offset:2,encoding:a})?{ext:"reg",mime:"application/x-ms-regedit"}:void 0}if(this.checkString("-----BEGIN PGP MESSAGE-----"))return{ext:"pgp",mime:"application/pgp-encrypted"}}),$d(this,"detectImprecise",async n=>{this.buffer=new Uint8Array(Jn);const a=rS(n.fileInfo.size);if(await n.peekBuffer(this.buffer,{length:Math.min(8,a),mayBeLess:!0}),this.check([0,0,1,186])||this.check([0,0,1,179]))return{ext:"mpg",mime:"video/mpeg"};if(this.check([0,1,0,0,0]))return{ext:"ttf",mime:"font/ttf"};if(this.check([0,0,1,0]))return{ext:"ico",mime:"image/x-icon"};if(this.check([0,0,2,0]))return{ext:"cur",mime:"image/x-icon"};if(await n.peekBuffer(this.buffer,{length:Math.min(2+this.options.mpegOffsetTolerance,a),mayBeLess:!0}),this.buffer.length>=2+this.options.mpegOffsetTolerance)for(let s=0;s<=this.options.mpegOffsetTolerance;++s){const i=this.scanMpeg(s);if(i)return i}});const r=tS(t==null?void 0:t.mpegOffsetTolerance);this.options={...t,mpegOffsetTolerance:r},this.detectors=[...this.options.customDetectors??[],{id:"core",detect:this.detectConfident},{id:"core.imprecise",detect:this.detectImprecise}],this.tokenizerOptions={abortSignal:this.options.signal},this.gzipProbeDepth=0}getTokenizerOptions(){return{...this.tokenizerOptions}}createTokenizerFromWebStream(t){return B2(c2(t,this.getTokenizerOptions()))}async parseTokenizer(t,r=0){this.detectionReentryCount=r;const n=t.position;for(const a of this.detectors){let s;try{s=await a.detect(t)}catch(i){if(i instanceof Qe||i instanceof Jr)return;throw i}if(s)return s;if(n!==t.position)return}}async fromTokenizer(t){try{return await this.parseTokenizer(t)}finally{await t.close()}}async fromBuffer(t){if(!(t instanceof Uint8Array||t instanceof ArrayBuffer))throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof t}\``);const r=t instanceof Uint8Array?t:new Uint8Array(t);if((r==null?void 0:r.length)>1)return this.fromTokenizer(d2(r,this.getTokenizerOptions()))}async fromBlob(t){var r;(r=this.options.signal)==null||r.throwIfAborted();const n=u2(t,this.getTokenizerOptions());return this.fromTokenizer(n)}async fromStream(t){var r;(r=this.options.signal)==null||r.throwIfAborted();const n=this.createTokenizerFromWebStream(t);return this.fromTokenizer(n)}async toDetectionStream(t,r){const n=Q2((r==null?void 0:r.sampleSize)??Jn);let a,s;const i=t.getReader({mode:"byob"});try{const{value:d,done:u}=await eS(i,new Uint8Array(n),this.options.signal);if(s=d,!u&&d)try{a=await this.fromBuffer(d.subarray(0,n))}catch(m){if(!(m instanceof Qe))throw m;a=void 0}s=d}finally{i.releaseLock()}const l=new TransformStream({async start(d){d.enqueue(s)},transform(d,u){u.enqueue(d)}}),c=t.pipeThrough(l);return c.fileType=a,c}async detectGzip(t){var r;if(this.gzipProbeDepth>=R2)return{ext:"gz",mime:"application/gzip"};const n=new k2(t),a=Y2(n.inflate(),A2),s=pt(t);let i,l,c,d;if(s){const u=new AbortController;i=setTimeout(()=>{u.abort(new DOMException(`Operation timed out after ${Fd} ms`,"TimeoutError"))},Fd),l=this.options.signal===void 0?u.signal:AbortSignal.any([this.options.signal,u.signal]),c=new Fl({...this.options,signal:l}),c.gzipProbeDepth=this.gzipProbeDepth+1}else this.gzipProbeDepth++;try{d=await(c??this).fromStream(a)}catch(u){if((u==null?void 0:u.name)==="AbortError"&&((r=l==null?void 0:l.reason)==null?void 0:r.name)!=="TimeoutError")throw u}finally{clearTimeout(i),s||this.gzipProbeDepth--}return(d==null?void 0:d.ext)==="tar"?{ext:"tar.gz",mime:"application/gzip"}:{ext:"gz",mime:"application/gzip"}}check(t,r){return sr(this.buffer,t,r)}checkString(t,r){return this.check(C2(t,r==null?void 0:r.encoding),r)}async readTiffTag(t){const r=await this.tokenizer.readToken(t?gn:We);switch(await this.tokenizer.ignore(10),r){case 50341:return{ext:"arw",mime:"image/x-sony-arw"};case 50706:return{ext:"dng",mime:"image/x-adobe-dng"}}}async readTiffIFD(t){const r=await this.tokenizer.readToken(t?gn:We);if(!(r>F2)&&!(pt(this.tokenizer)&&2+r*12>Ud))for(let n=0;n<r;++n){const a=await this.readTiffTag(t);if(a)return a}}async readTiffHeader(t){const r={ext:"tif",mime:"image/tiff"},n=(t?gn:We).get(this.buffer,2),a=(t?Td:Xe).get(this.buffer,4);if(n===42){if(a>=6){if(this.checkString("CR",{offset:8}))return{ext:"cr2",mime:"image/x-canon-cr2"};if(a>=8){const l=(t?gn:We).get(this.buffer,8),c=(t?gn:We).get(this.buffer,10);if(l===28&&c===254||l===31&&c===11)return{ext:"nef",mime:"image/x-nikon-nef"}}}if(pt(this.tokenizer)&&a>z2)return r;const s=pt(this.tokenizer)?Ud:this.tokenizer.fileInfo.size;try{await Ir(this.tokenizer,a,{maximumLength:s,reason:"TIFF IFD offset"})}catch(l){if(l instanceof Qe)return;throw l}let i;try{i=await this.readTiffIFD(t)}catch(l){if(l instanceof Qe)return;throw l}return i??r}if(n===43)return r}scanMpeg(t){if(this.check([255,224],{offset:t,mask:[255,224]})){if(this.check([16],{offset:t+1,mask:[22]}))return this.check([8],{offset:t+1,mask:[8]})?{ext:"aac",mime:"audio/aac"}:{ext:"aac",mime:"audio/aac"};if(this.check([2],{offset:t+1,mask:[6]}))return{ext:"mp3",mime:"audio/mpeg"};if(this.check([4],{offset:t+1,mask:[6]}))return{ext:"mp2",mime:"audio/mpeg"};if(this.check([6],{offset:t+1,mask:[6]}))return{ext:"mp1",mime:"audio/mpeg"}}}}new Set($2);new Set(E2);const Gd=e=>e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`,bx=({name:e,control:t,disabled:r,campo:n,fileTypes:a,maxFileSize:s})=>{var i;const{field:l,fieldState:c}=Me({name:e,control:t}),{uploadFile:d,deleteUploadedFile:u}=Hr(),[m,p]=N.useState({status:"idle"}),f=N.useRef(null),[b,h]=N.useState(!1),x=N.useRef(!0);N.useEffect(()=>()=>{x.current=!1},[]);const y=typeof l.value=="string"&&l.value?l.value:null,v=N.useCallback(async S=>{var $;if(a&&a.length>0){const k=await J2(S),E=(k==null?void 0:k.ext)??"",D=(k==null?void 0:k.mime)??"",O=(($=S.name.split(".").pop())==null?void 0:$.toLowerCase())??"",L=S.type.toLowerCase();if(!a.some(A=>{const z=A.toLowerCase();return!!(E&&(z===E||z===D)||D&&z.endsWith("/*")&&D.startsWith(z.slice(0,-1))||!E&&(z===O||z===L||z.endsWith("/*")&&L.startsWith(z.slice(0,-1))))})){p({status:"error",message:`Tipo de arquivo não permitido. Permitidos: ${a.join(", ")}`});return}}if(s&&S.size>s){p({status:"error",message:`Arquivo muito grande. Tamanho máximo: ${Gd(s)}`});return}if(!d){p({status:"error",message:"Preview: upload não disponível sem configuração."});return}p({status:"uploading",fileName:S.name,progress:0});try{if(y&&u)try{await u(y)}catch{}const k=await d(S,n??e,E=>{x.current&&p(D=>D.status==="uploading"?{...D,progress:Math.min(100,E)}:D)});if(!x.current)return;l.onChange(k),p({status:"done",uploadId:k,fileName:S.name,size:S.size})}catch{if(!x.current)return;p({status:"error",message:"Falha no upload. Tente novamente."})}},[d,u,y,n,e,l,a,s]),j=N.useCallback(S=>{var $;const k=($=S.target.files)==null?void 0:$[0];k&&v(k),S.target.value=""},[v]),w=N.useCallback(()=>{l.onChange(""),p({status:"idle"}),f.current&&(f.current.value="")},[l]);if(m.status==="done"||m.status==="idle"&&y){const S=m.status==="done"?m.fileName:"Arquivo enviado",$=m.status==="done"?m.size:null;return o.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-input bg-muted/20 px-4 py-3 gap-2",children:[o.jsx("span",{className:"text-sm font-medium truncate flex-1",children:S}),$!==null&&o.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:Gd($)}),!r&&o.jsx("button",{type:"button",onClick:w,className:"ml-2 shrink-0 text-muted-foreground hover:text-destructive transition-colors","aria-label":"Remover arquivo",children:"✕"})]})}if(m.status==="uploading"){const{fileName:S,progress:$}=m;return o.jsxs("div",{className:"rounded-lg border border-input px-4 py-3 space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-sm font-medium truncate flex-1",children:S}),o.jsxs("span",{className:"text-xs text-muted-foreground ml-2",children:[$,"%"]})]}),o.jsx("div",{className:"h-2 rounded-full bg-muted overflow-hidden",children:o.jsx("div",{className:"h-full bg-primary transition-all duration-200 rounded-full",style:{width:`${$}%`}})})]})}const C=m.status==="error";return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{role:"button",tabIndex:r?-1:0,"aria-label":"Selecionar arquivo",className:K("flex items-center justify-center rounded-lg border-2 border-dashed px-4 py-6 transition-colors cursor-pointer",b?"border-primary bg-primary/5":C||c.error?"border-destructive bg-destructive/5":"border-input hover:border-muted-foreground hover:bg-muted/20",r&&"opacity-50 cursor-not-allowed"),onClick:()=>{var S;return!r&&((S=f.current)==null?void 0:S.click())},onKeyDown:S=>{var $;(S.key==="Enter"||S.key===" ")&&(($=f.current)==null||$.click())},onDragOver:S=>{S.preventDefault(),r||h(!0)},onDragLeave:()=>h(!1),onDrop:r?void 0:S=>{var $;S.preventDefault(),h(!1);const k=($=S.dataTransfer.files)==null?void 0:$[0];k&&v(k)},onBlur:l.onBlur,children:[o.jsx("input",{ref:f,type:"file",onChange:j,disabled:r,className:"sr-only"}),o.jsx("span",{className:"text-sm text-muted-foreground",children:b?"Solte o arquivo aqui":"Clique ou arraste um arquivo"})]}),C&&o.jsxs("p",{className:"text-sm text-destructive",children:[m.message," · ",o.jsx("button",{type:"button",className:"underline hover:no-underline",onClick:()=>p({status:"idle"}),children:"Tentar novamente"})]}),!C&&((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})},lS={cpf:e=>e.replace(/\D/g,"").slice(0,11).replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d{1,2})$/,"$1-$2"),telefone:e=>{const t=e.replace(/\D/g,"").slice(0,11);return t.length<=10?t.replace(/(\d{2})(\d)/,"($1) $2").replace(/(\d{4})(\d)/,"$1-$2"):t.replace(/(\d{2})(\d)/,"($1) $2").replace(/(\d{5})(\d)/,"$1-$2")},cep:e=>e.replace(/\D/g,"").slice(0,8).replace(/(\d{5})(\d)/,"$1-$2")},Qr=({name:e,control:t,placeholder:r,maskType:n,disabled:a,readOnly:s})=>{var i;const{field:l,fieldState:c}=Me({name:e,control:t}),d=lS[n||""],u=N.useCallback(m=>{l.onChange(d?d(m.target.value):m.target.value)},[l,d]);return o.jsxs("div",{className:"space-y-1",children:[o.jsx(ue,{name:l.name,value:l.value||"",onChange:u,onBlur:l.onBlur,placeholder:r,disabled:a,readOnly:s,className:K(c.error&&"border-destructive focus-visible:ring-destructive")}),((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})},zl=({name:e,control:t})=>{const{field:r}=Me({name:e,control:t});return o.jsx("input",{type:"hidden",...r,value:r.value??""})},yx=e=>e.replace(/\D/g,""),cS=e=>{const t=yx(e).slice(0,8);return t.length<=5?t:`${t.slice(0,5)}-${t.slice(5)}`},dS=async(e,t)=>{const r=await fetch(`https://viacep.com.br/ws/${e}/json/`,{signal:t});if(!r.ok)throw new Error("Falha ao consultar CEP");return r.json()},wx=({name:e,control:t,placeholder:r="00000-000",disabled:n,readOnly:a,cepFillMap:s})=>{var i,l;const{field:c,fieldState:d}=Me({name:e,control:t}),{setValue:u}=lN(),{cepLookup:m}=Hr(),[p,f]=N.useState("idle"),[b,h]=N.useState(null),x=N.useRef(null),y=N.useRef(!0);N.useEffect(()=>()=>{var w;y.current=!1,(w=x.current)==null||w.abort()},[]);const v=N.useCallback(async()=>{var w;c.onBlur();const C=yx(c.value??"");if(C.length===8){(w=x.current)==null||w.abort(),x.current=new AbortController,f("loading"),h(null);try{let S;if(m){const E=x.current;if(S=await m(C,E.signal),E.signal.aborted||!y.current)return}else{const E=await dS(C,x.current.signal);if(!y.current)return;if(E.erro){f("error"),h("CEP não encontrado");return}S={logradouro:E.logradouro,bairro:E.bairro,cidade:E.localidade,estado:E.uf}}if(!y.current)return;if(S.erro){f("error"),h("CEP não encontrado");return}const $=e.includes(".")?`${e.substring(0,e.lastIndexOf("."))}.`:"",k=(E,D,O)=>{if(!O)return;const L=s!=null&&s[E]?`${$}${s[E]}`:`${$}${D}`;u(L,O,{shouldDirty:!0,shouldValidate:!0})};k("logradouro","_address_logradouro",S.logradouro),k("bairro","_address_bairro",S.bairro),k("cidade","_address_cidade",S.cidade),k("estado","_address_estado",S.estado),f("success")}catch(S){if(S instanceof Error&&S.name==="AbortError"||!y.current)return;f("error"),h("Erro ao buscar CEP")}}},[c,m,u,e,s]),j=N.useCallback(w=>{c.onChange(cS(w.target.value))},[c]);return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"relative",children:[o.jsx(ue,{name:c.name,value:c.value||"",onChange:j,onBlur:v,placeholder:r,disabled:n,readOnly:a,className:K("pr-9",d.error&&"border-destructive focus-visible:ring-destructive")}),o.jsxs("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none",children:[p==="loading"&&o.jsx(_.Loader2,{className:"h-4 w-4 animate-spin text-muted-foreground"}),p==="success"&&o.jsx(_.Check,{className:"h-4 w-4 text-green-500"}),p==="error"&&o.jsx(_.AlertCircle,{className:"h-4 w-4 text-destructive"})]})]}),(((i=d.error)==null?void 0:i.message)||b)&&o.jsx("p",{className:"text-sm text-destructive",children:((l=d.error)==null?void 0:l.message)||b})]})},uS=({field:e,control:t,nameOverride:r})=>{const n={name:r,control:t,placeholder:e.placeholder};switch(e.tipo){case T.TEXTO:return o.jsx(Mt,{...n,type:"text"});case T.EMAIL:return o.jsx(Mt,{...n,type:"email"});case T.NUMBER:return o.jsx(Mt,{...n,type:"number"});case T.TEXTAREA:return o.jsx(Al,{...n});case T.SELECT:return o.jsx(Rl,{...n,options:e.opcoes??[]});case T.RADIO:return o.jsx(px,{...n,options:e.opcoes??[]});case T.CHECKBOX:return o.jsx(Il,{name:r,control:t,label:e.label});case T.CHECKBOX_GROUP:return o.jsx(mx,{...n,options:e.opcoes??[]});case T.DATE:return o.jsx(aa,{...n,validacao:e.validacao});case T.DATETIME:return o.jsx(aa,{...n,isDatetime:!0,validacao:e.validacao});case T.FILE:return o.jsx(bx,{name:r,control:t});case T.TELEFONE:return o.jsx(Qr,{...n,maskType:"telefone"});case T.CPF:return o.jsx(Qr,{...n,maskType:"cpf"});case T.CEP:return o.jsx(wx,{name:r,control:t,placeholder:e.placeholder});case T.HIDDEN:return o.jsx(zl,{name:r,control:t});default:return console.error(`[DFFieldArray] Tipo de sub-campo "${e.tipo}" não suportado em FIELD_ARRAY. Usando DFTextField como fallback.`),o.jsx(Mt,{...n,type:"text"})}},mS=({name:e,control:t,subFields:r=[],minItems:n=1,maxItems:a,itemLabel:s="Item",addLabel:i})=>{var l;const{fields:c,append:d,remove:u}=dx({control:t,name:e}),{errors:m}=rx({control:t}),p=(l=m[e])==null?void 0:l.message,f=N.useCallback(()=>{const y={};for(const v of r)v.initialValue!==void 0?y[v.nome]=v.initialValue:v.defaultValue!==void 0&&(y[v.nome]=v.defaultValue);return y},[r]);N.useEffect(()=>{if(c.length<n)for(let y=c.length;y<n;y++)d(f())},[n]);const b=[...r].sort((y,v)=>y.ordem-v.ordem),h=!a||c.length<a,x=i??`Adicionar ${s.toLowerCase()}`;return o.jsxs("div",{className:"space-y-3",children:[c.map((y,v)=>o.jsxs("div",{className:"rounded-lg border border-input p-4",children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-primary/10 text-xs font-bold text-primary shrink-0",children:v+1}),o.jsxs("span",{className:"text-sm font-semibold",children:[s," ",v+1]})]}),c.length>n&&o.jsx(De,{type:"button",variant:"ghost",size:"icon",onClick:()=>u(v),"aria-label":`Remover ${s.toLowerCase()} ${v+1}`,className:"text-muted-foreground hover:text-destructive",children:o.jsx(_.Trash2,{className:"w-4 h-4"})})]}),o.jsx("div",{className:"grid grid-cols-12 gap-4",children:b.map(j=>{const w=`${e}.${v}.${j.nome}`,C=`span ${j.tamanho??12}`,S=o.jsx(uS,{field:j,control:t,nameOverride:w});return j.tipo===T.CHECKBOX||j.tipo===T.HIDDEN?o.jsx("div",{className:"max-sm:!col-span-12",style:{gridColumn:C},children:S},j.id):o.jsxs("div",{className:"max-sm:!col-span-12 space-y-2",style:{gridColumn:C},children:[o.jsxs("label",{className:"font-medium flex items-center gap-1 text-sm text-foreground",children:[j.label,j.obrigatorio&&o.jsx("span",{className:"text-destructive",children:"*"})]}),S,j.hint&&o.jsx("p",{className:"text-xs text-muted-foreground",children:j.hint})]},j.id)})})]},y.id)),h&&o.jsxs(De,{type:"button",variant:"outline",className:"w-full",onClick:()=>d(f()),children:[o.jsx(_.Plus,{className:"w-4 h-4"}),x]}),a&&o.jsxs("p",{className:"text-xs text-center text-muted-foreground",children:["Máximo de ",a," ",s.toLowerCase(),a>1?"s":""]}),p&&o.jsxs("p",{className:"text-sm text-destructive flex items-center gap-1",children:[o.jsx(_.AlertCircle,{className:"w-4 h-4 shrink-0"}),p]})]})},Xd=e=>`R$ ${(e/100).toFixed(2).replace(".",",")}`,pS=(e,t)=>{const r=new Date(e.slice(0,10)+"T00:00:00Z"),n=new Date(t.slice(0,10)+"T00:00:00Z");return Math.round((n.getTime()-r.getTime())/864e5)+1},fS=(e,t)=>{const r=[],n=new Date(e.slice(0,10)+"T00:00:00Z"),a=new Date(t.slice(0,10)+"T00:00:00Z");let s=0;for(;n<=a&&s<60;)r.push(n.toISOString().slice(0,10)),n.setUTCDate(n.getUTCDate()+1),s++;return r},hS=e=>{const[t,r,n]=e.split("-").map(Number),a=new Date(Date.UTC(t,r-1,n)),s=String(n).padStart(2,"0"),i=String(r).padStart(2,"0"),l=new Intl.DateTimeFormat("pt-BR",{weekday:"long",timeZone:"UTC"}).format(a),c=l.charAt(0).toUpperCase()+l.slice(1);return`${s}/${i} - ${c}`},xS=(e,t)=>{const r=n=>{const[a,s,i]=n.slice(0,10).split("-");return`${i}/${s}/${a}`};return`${r(e)} a ${r(t)}`},gS=({name:e,control:t})=>{var r;const{field:n,fieldState:a}=Me({name:e,control:t}),{externalData:s={}}=Hr(),i=n.value??null,l=(r=a.error)==null?void 0:r.message,c=V=>s[`evento.${V}`]??s[V],d=c("dataInicioEvento")??"",u=c("dataFimEvento")??"",m=Number(c("valor")??0),p=Number(c("valorPorDia")??0),f=c("vagasTotal"),b=c("vagasPorDia"),h=c("vagasMasculinas"),x=c("vagasFemininas"),y=f!=null?Number(f):null,v=b!=null?Number(b):null,j=h!=null?Number(h):null,w=x!=null?Number(x):null,C=d&&u?fS(d,u):[],S=(d&&u?pS(d,u):0)>1,$=j!=null&&j>0&&w!=null&&w>0,k=j!=null&&w==null?"masculino":w!=null&&j==null?"feminino":null,E=(i==null?void 0:i.tipo)??null,D=(i==null?void 0:i.data)??null,O=(i==null?void 0:i.genero)??null,L=N.useRef(i);L.current=i;const A=N.useRef(n.onChange);A.current=n.onChange,N.useEffect(()=>{var V,M,P;k&&((V=L.current)==null?void 0:V.genero)!==k&&A.current({tipo:((M=L.current)==null?void 0:M.tipo)??null,data:((P=L.current)==null?void 0:P.data)??null,genero:k})},[k]);const z=V=>{const M={tipo:V,data:null};($||k)&&(M.genero=O??k??void 0),n.onChange(M)},X=V=>{const M={tipo:"por_dia",data:V};($||k)&&(M.genero=O??k??void 0),n.onChange(M)},q=V=>{n.onChange({tipo:E,data:D,genero:V})},Z=V=>E===V;return o.jsxs("div",{className:"space-y-3",children:[$&&o.jsxs("div",{className:"flex items-center gap-2 px-1",children:[o.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:"Você é:"}),o.jsx("div",{className:"flex gap-2",children:["masculino","feminino"].map(V=>o.jsx("button",{type:"button",onClick:()=>q(V),className:K("px-3 py-1 rounded-full text-xs font-medium border transition-all",O===V?"border-primary bg-primary/10 text-primary":"border-input text-muted-foreground hover:border-primary/50"),children:V==="masculino"?"Masculino":"Feminino"},V))})]}),o.jsxs("button",{type:"button",onClick:()=>z("todos_os_dias"),className:K("w-full text-left flex items-start gap-3 p-4 rounded-xl border-2 transition-all",Z("todos_os_dias")?"border-primary bg-primary/5":"border-input hover:border-primary/50"),children:[o.jsx("div",{className:K("mt-0.5 p-2 rounded-lg shrink-0 transition-colors",Z("todos_os_dias")?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"),children:o.jsx(_.CalendarCheck2,{className:"w-4 h-4"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"font-semibold text-sm",children:"Participar todos os dias"}),d&&u?o.jsx("p",{className:"text-xs text-muted-foreground",children:xS(d,u)}):o.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Datas do evento"})]}),o.jsxs("div",{className:"text-right shrink-0",children:[m>0&&o.jsx("p",{className:K("font-bold text-sm",Z("todos_os_dias")?"text-primary":"text-foreground"),children:Xd(m)}),y!=null&&y>0&&o.jsxs("p",{className:"text-xs flex items-center justify-end gap-1 text-muted-foreground",children:[o.jsx(_.Users,{className:"w-3 h-3"}),y," vagas disponíveis"]})]})]}),S?o.jsxs("button",{type:"button",onClick:()=>z("por_dia"),className:K("w-full text-left flex items-start gap-3 p-4 rounded-xl border-2 transition-all",Z("por_dia")?"border-primary bg-primary/5":"border-input hover:border-primary/50"),children:[o.jsx("div",{className:K("mt-0.5 p-2 rounded-lg shrink-0 transition-colors",Z("por_dia")?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"),children:o.jsx(_.CalendarDays,{className:"w-4 h-4"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"font-semibold text-sm",children:"Participar um dia"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Escolha o dia desejado abaixo"})]}),o.jsxs("div",{className:"text-right shrink-0",children:[p>0&&o.jsx("p",{className:K("font-bold text-sm",Z("por_dia")?"text-primary":"text-foreground"),children:Xd(p)}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"por dia"})]})]}):d?o.jsxs("div",{className:"flex items-start gap-2 px-3 py-2.5 rounded-lg border border-input bg-muted/30",children:[o.jsx(_.Info,{className:"w-3.5 h-3.5 mt-0.5 shrink-0 text-muted-foreground"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:'Este evento ocorre em apenas 1 dia — a opção "Participar um dia" não é necessária.'})]}):null,E==="por_dia"&&o.jsxs("div",{className:"pl-2 space-y-2",children:[o.jsx("p",{className:"text-xs font-semibold uppercase tracking-wide text-primary",children:"Selecione o dia:"}),C.length===0?o.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Nenhuma data configurada no evento"}):C.map(V=>o.jsxs("button",{type:"button",onClick:()=>X(V),className:K("w-full text-left flex items-center justify-between px-4 py-3 rounded-lg border transition-all",D===V?"border-primary bg-primary/5":"border-input hover:border-primary/50"),children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:K("w-4 h-4 rounded-full border-2 shrink-0 flex items-center justify-center transition-colors",D===V?"border-primary bg-primary":"border-input"),children:D===V&&o.jsx("span",{className:"w-2 h-2 rounded-full bg-white"})}),o.jsx("span",{className:"text-sm",children:hS(V)})]}),v!=null&&o.jsxs("span",{className:"text-xs text-muted-foreground",children:[v," vagas"]})]},V))]}),l&&o.jsx("p",{className:"text-sm text-destructive",children:l})]})},Zd=.0315,Kd=.124,Yd=7,Jd=12,vS=[{id:"pix",label:"PIX",description:"Transferência instantânea (à vista)",Icon:_.Smartphone,taxa:0},{id:"dinheiro",label:"Dinheiro",description:"Pagamento em espécie",Icon:_.Banknote,taxa:0},{id:"cartao",label:"Cartão de Crédito",description:"Débito ou crédito na maquininha",Icon:_.CreditCard,taxa:Zd,taxaLabel:`Taxa: ${(Zd*100).toFixed(2).replace(".",",")}%`}],bS=[{id:"pix",label:"PIX à Vista",description:"Pagamento instantâneo sem parcelamento",Icon:_.Smartphone,taxa:0},{id:"pix_parcelado",label:"PIX Parcelado",description:`Parcelado em até ${Yd}x sem juros`,Icon:_.Smartphone,taxa:0,parcelas:Yd},{id:"cartao",label:"Cartão de Crédito",description:`Parcelado em até ${Jd}x`,Icon:_.CreditCard,taxa:Kd,parcelas:Jd,taxaLabel:`Taxa: ${(Kd*100).toFixed(2).replace(".",",")}%`},{id:"dinheiro",label:"Dinheiro",description:"Pagamento em espécie",Icon:_.Banknote,taxa:0}],Fa=e=>`R$ ${(e/100).toFixed(2).replace(".",",")}`,Qd=(e,t)=>Math.round(e*(1+t)*100)/100,yS=(e,t)=>Math.round(e/t*100)/100,wS=({name:e,control:t,relatedFieldName:r="tipo_participacao"})=>{var n;const{field:a,fieldState:s}=Me({name:e,control:t}),{externalData:i={},paymentMethodOptions:l}=Hr(),c=a.value??null,d=(n=s.error)==null?void 0:n.message,u=Mn({control:t,name:r}),m=(u==null?void 0:u.tipo)??null,p=j=>i[`evento.${j}`]??i[j],f=Number(p("valor")??0),b=Number(p("valorPorDia")??0),h=m==="por_dia"&&b>0?b:f,x=m==="por_dia"?(l==null?void 0:l.porDia)??vS:(l==null?void 0:l.todosOsDias)??bS,y=m==="por_dia"?(()=>{if(!(u!=null&&u.data))return"Um dia";const j=u.data.split("-");if(j.length===3){const[w,C,S]=j;return`${S}/${C}/${w}`}return u.data})():"Todos os dias",v=j=>{if(j.disabled)return;const w=Qd(h,j.taxa),C={metodo:j.id,valorTotal:w};j.parcelas&&(C.parcelas=j.parcelas),a.onChange(C)};return o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between rounded-xl border border-input px-4 py-3",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"Tipo de participação"}),o.jsx("p",{className:"font-semibold",children:y})]}),o.jsxs("div",{className:"text-right",children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"Valor base"}),o.jsx("p",{className:"text-lg font-bold text-primary",children:Fa(h)})]})]}),o.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-input bg-muted/30 px-3 py-2.5",children:[o.jsx(_.Info,{className:"h-4 w-4 mt-0.5 shrink-0 text-muted-foreground"}),o.jsxs("p",{className:"text-xs",children:[o.jsx("span",{className:"font-bold",children:"Importante:"})," Para validar a inscrição e garantir sua vaga, o pagamento deve ser realizado no ato da inscrição."]})]}),o.jsx("p",{className:"text-sm font-semibold text-primary",children:"Selecione a forma de pagamento:"}),o.jsx("div",{className:"space-y-3",children:x.map(j=>{const{Icon:w}=j,C=(c==null?void 0:c.metodo)===j.id,S=Qd(h,j.taxa),$=!!j.parcelas&&j.parcelas>1,k=$?yS(S,j.parcelas):null;return o.jsxs("button",{type:"button",disabled:j.disabled,onClick:()=>v(j),className:K("w-full text-left flex items-center gap-4 px-4 py-3 rounded-xl border-2 transition-all",C?"border-primary bg-primary/5":"border-input hover:border-primary/50",j.disabled&&"opacity-50 cursor-not-allowed"),children:[o.jsx("div",{className:K("flex items-center justify-center w-10 h-10 rounded-lg shrink-0 transition-colors",C?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"),children:o.jsx(w,{className:"h-5 w-5"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"font-semibold text-sm leading-tight",children:j.label}),o.jsx("p",{className:"text-xs text-muted-foreground",children:j.description}),j.taxaLabel&&o.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:["* ",j.taxaLabel]}),j.taxa>0&&o.jsxs("p",{className:"text-xs text-muted-foreground",children:["Total com taxa: ",Fa(S)]})]}),o.jsx("div",{className:"text-right shrink-0",children:$?o.jsxs(o.Fragment,{children:[o.jsxs("p",{className:"text-xs text-muted-foreground",children:[j.parcelas,"x de"]}),o.jsx("p",{className:"text-base font-bold text-primary",children:Fa(k)})]}):o.jsx("p",{className:"text-base font-bold text-primary",children:Fa(S)})})]},j.id)})}),d&&o.jsx("p",{className:"text-xs text-destructive",children:d})]})},jS=({name:e,control:t,label:r,termoTexto:n,termoPdfUrl:a,termoPdfUploadId:s})=>{var i;const{field:l,fieldState:c}=Me({name:e,control:t}),{resolveTermsUploadUrl:d}=Hr(),u=!!c.error,m=(i=c.error)==null?void 0:i.message,[p,f]=N.useState(null),[b,h]=N.useState(!1),[x,y]=N.useState(!1),v=N.useRef(null);N.useEffect(()=>{var $;x&&(($=v.current)==null||$.focus())},[x]),N.useEffect(()=>{if(!s||!d){f(null);return}let $=!1;return h(!0),d(s).then(k=>{$||f(k)}).catch(()=>{$||f(null)}).finally(()=>{$||h(!1)}),()=>{$=!0}},[s,d]);const j=l.value==="accepted",w=p||a||null,C=!!(n||w||s),S=!!w;return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:K("rounded-lg border p-4 space-y-4 transition-colors",u?"border-destructive bg-destructive/5":j?"border-green-500 bg-green-500/5":"border-input"),children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(_.ScrollText,{className:"h-4 w-4 shrink-0"}),o.jsx("span",{className:"text-sm font-medium",children:r||"Termos e condições"})]}),C?o.jsxs(De,{type:"button",variant:"outline",size:"sm",className:"h-7 px-2 text-xs",disabled:b,onClick:()=>y(!0),children:[b?o.jsx(_.Loader2,{className:"h-3 w-3 animate-spin"}):o.jsx(_.ExternalLink,{className:"h-3 w-3"}),"Ler termos"]}):o.jsx("span",{className:"text-xs text-muted-foreground italic",children:s&&b?"Carregando PDF...":"Conteúdo não configurado"})]}),o.jsxs("label",{className:"flex items-start gap-3 cursor-pointer select-none",children:[o.jsx(et,{className:"mt-0.5",checked:j,onCheckedChange:$=>l.onChange($?"accepted":"")}),o.jsxs("span",{className:"text-sm leading-snug flex-1",children:["Li e aceito ",r?`"${r}"`:"os termos e condições"]}),j&&o.jsx(_.CheckCircle2,{className:"h-4 w-4 text-green-500 shrink-0 mt-0.5"})]})]}),u&&o.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-destructive",children:[o.jsx(_.AlertCircle,{className:"h-3.5 w-3.5 shrink-0"}),m||"Você precisa aceitar os termos para continuar"]}),x&&o.jsx("div",{ref:v,role:"dialog","aria-modal":"true","aria-label":"Termos e condições",tabIndex:-1,className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/60 outline-none",onClick:()=>y(!1),onKeyDown:$=>{$.key==="Escape"&&y(!1)},children:o.jsxs("div",{className:"relative w-full max-w-2xl max-h-[90vh] rounded-xl overflow-hidden flex flex-col bg-background shadow-xl",onClick:$=>$.stopPropagation(),children:[o.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-input",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(_.ScrollText,{className:"h-4 w-4"}),o.jsx("span",{className:"font-semibold",children:"Termos e condições"})]}),o.jsx(De,{type:"button",variant:"ghost",size:"icon",onClick:()=>y(!1),children:o.jsx(_.X,{className:"h-4 w-4"})})]}),o.jsx("div",{className:"flex-1 overflow-auto p-4",children:S?o.jsx("iframe",{src:w,className:"w-full rounded border",style:{height:"62vh"},title:"Termos e condições",sandbox:"allow-scripts"}):o.jsx("p",{className:"text-sm whitespace-pre-wrap leading-relaxed",children:n})})]})})]})},kS=({name:e,control:t,placeholder:r,disabled:n,readOnly:a})=>{var s;const{field:i,fieldState:l}=Me({name:e,control:t}),[c,d]=N.useState(!1),u=!!l.error;return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"relative",children:[o.jsx(ue,{...i,value:i.value??"",type:c?"text":"password",placeholder:r,disabled:n,readOnly:a,className:K("pr-10",u&&"border-destructive focus-visible:ring-destructive")}),o.jsx("button",{type:"button",tabIndex:-1,onClick:()=>d(m=>!m),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors","aria-label":c?"Ocultar senha":"Mostrar senha",children:c?o.jsx(_.EyeOff,{size:16}):o.jsx(_.Eye,{size:16})})]}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},jx=({name:e,control:t,label:r,disabled:n,readOnly:a})=>{var s;const{field:i,fieldState:l}=Me({name:e,control:t}),c=!!i.value;return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("label",{className:"flex items-center gap-3 cursor-pointer select-none",children:[o.jsx(Oi,{checked:c,onCheckedChange:d=>!a&&i.onChange(d),disabled:n||a,onBlur:i.onBlur}),o.jsx("span",{className:"text-sm leading-none",children:r})]}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},CS=({name:e,control:t,minValue:r=0,maxValue:n=100,step:a=1,disabled:s,readOnly:i})=>{var l;const{field:c,fieldState:d}=Me({name:e,control:t}),u=c.value??r;return N.useEffect(()=>{(c.value===void 0||c.value===null)&&c.onChange(r)},[]),o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(Ao,{min:r,max:n,step:a,value:[u],onValueChange:m=>!i&&c.onChange(m[0]),disabled:s||i,className:"flex-1"}),o.jsx("span",{className:"text-sm font-medium text-primary min-w-[3rem] text-right tabular-nums",children:u})]}),o.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[o.jsx("span",{children:r}),o.jsx("span",{children:n})]}),((l=d.error)==null?void 0:l.message)&&o.jsx("p",{className:"text-sm text-destructive",children:d.error.message})]})},Ms=e=>/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(e),NS=({name:e,control:t,disabled:r,readOnly:n})=>{var a;const{field:s,fieldState:i}=Me({name:e,control:t}),l=s.value||"#000000",[c,d]=N.useState(l);return N.useEffect(()=>{d(l)},[l]),o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("input",{type:"color",value:Ms(l)?l:"#000000",disabled:r||n,onChange:u=>s.onChange(u.target.value),className:"h-10 w-14 cursor-pointer rounded-lg border border-input bg-transparent p-1 disabled:cursor-not-allowed disabled:opacity-50"}),o.jsx(ue,{type:"text",value:c,readOnly:n,disabled:r,onChange:u=>{const m=u.target.value;d(m),Ms(m)&&s.onChange(m.toUpperCase())},onBlur:()=>{Ms(c)||d(l),s.onBlur()},className:K("flex-1 font-mono uppercase",i.error&&"border-destructive focus-visible:ring-destructive"),maxLength:7,placeholder:"#000000"})]}),((a=i.error)==null?void 0:a.message)&&o.jsx("p",{className:"text-sm text-destructive",children:i.error.message})]})},SS=({name:e,control:t,options:r,placeholder:n,disabled:a,readOnly:s})=>{var i,l;const{field:c,fieldState:d}=Me({name:e,control:t}),[u,m]=N.useState(""),[p,f]=N.useState(!1),[b,h]=N.useState(-1),x=N.useRef(null),y=N.useRef(null),v=`autocomplete-${e}-listbox`,j=((i=r.find(D=>D.valor===c.value))==null?void 0:i.label)??"",w=u.length>0?r.filter(D=>D.label.toLowerCase().includes(u.toLowerCase())):r;N.useEffect(()=>{const D=O=>{x.current&&!x.current.contains(O.target)&&(f(!1),m(""),h(-1))};return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[]);const C=()=>{f(!1),m(""),h(-1)};N.useEffect(()=>{if(b<0||!y.current)return;const D=y.current.querySelector(`[id="${v}-option-${b}"]`);D==null||D.scrollIntoView({block:"nearest"})},[b,v]);const S=D=>{D.disabled||(c.onChange(D.valor),C())},$=()=>{c.onChange(""),m(""),h(-1)},k=D=>{if(!p){(D.key==="ArrowDown"||D.key==="ArrowUp")&&(D.preventDefault(),f(!0),h(0));return}switch(D.key){case"ArrowDown":D.preventDefault(),h(O=>O<w.length-1?O+1:O);break;case"ArrowUp":D.preventDefault(),h(O=>O>0?O-1:0);break;case"Enter":D.preventDefault(),b>=0&&w[b]&&!w[b].disabled&&S(w[b]);break;case"Escape":D.preventDefault(),C();break;case"Tab":C();break}},E=p&&b>=0?`${v}-option-${b}`:void 0;return o.jsxs("div",{className:"space-y-1",ref:x,children:[o.jsxs("div",{className:"relative",children:[o.jsx(ue,{type:"text",role:"combobox","aria-expanded":p,"aria-haspopup":"listbox","aria-autocomplete":"list","aria-controls":v,"aria-activedescendant":E,value:p?u:j,placeholder:n??"Buscar...",disabled:a,readOnly:s,onChange:D=>{m(D.target.value),h(-1),f(!0)},onFocus:()=>!s&&f(!0),onKeyDown:k,className:K("pr-8",d.error&&"border-destructive focus-visible:ring-destructive"),autoComplete:"off"}),o.jsx("div",{className:"absolute right-2 top-1/2 -translate-y-1/2 flex items-center gap-1",children:c.value?o.jsx("button",{type:"button",onClick:$,className:"text-[var(--t-text-muted)] hover:text-[var(--t-text)]",tabIndex:-1,"aria-label":"Limpar seleção",children:o.jsx(_.X,{size:14})}):o.jsx(_.ChevronDown,{size:16,className:"text-muted-foreground pointer-events-none","aria-hidden":"true"})}),p&&!a&&!s&&o.jsx("ul",{role:"listbox",id:v,ref:y,"aria-label":"Opções disponíveis",className:"absolute z-50 mt-1 max-h-60 w-full overflow-auto rounded-lg border border-input bg-popover shadow-lg",children:w.length===0?o.jsx("li",{role:"option","aria-selected":!1,className:"px-3 py-2 text-sm text-muted-foreground",children:"Nenhuma opção encontrada"}):w.map((D,O)=>o.jsx("li",{id:`${v}-option-${O}`,role:"option","aria-selected":c.value===D.valor,"aria-disabled":D.disabled,onMouseDown:()=>S(D),className:["flex cursor-pointer items-center px-3 py-2 text-sm",D.disabled?"cursor-not-allowed opacity-40":O===b?"bg-accent":"hover:bg-accent",c.value===D.valor?"font-medium text-primary":"text-foreground"].join(" "),children:D.label},D.valor))})]}),((l=d.error)==null?void 0:l.message)&&o.jsx("p",{className:"text-sm text-destructive",role:"alert",children:d.error.message})]})},kx=({name:e,control:t,placeholder:r,disabled:n,readOnly:a})=>{var s;const{field:i,fieldState:l}=Me({name:e,control:t}),c=!!l.error;return o.jsxs("div",{className:"space-y-1",children:[o.jsx(ue,{...i,value:i.value??"",type:"time",placeholder:r,disabled:n,readOnly:a,className:K(c&&"border-destructive focus-visible:ring-destructive")}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},$S=({name:e,control:t,startLabel:r="Data inicial",endLabel:n="Data final",disabled:a,readOnly:s})=>{var i;const{field:l,fieldState:c}=Me({name:e,control:t}),d=l.value??{},u=(p,f)=>{l.onChange({...d,[p]:f})},m=!!c.error;return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{children:r}),o.jsx(ue,{type:"date",value:d.start??"",disabled:a,readOnly:s,onChange:p=>u("start",p.target.value),max:d.end??void 0,className:K(m&&"border-destructive focus-visible:ring-destructive")})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{children:n}),o.jsx(ue,{type:"date",value:d.end??"",disabled:a,readOnly:s,onChange:p=>u("end",p.target.value),min:d.start??void 0,className:K(m&&"border-destructive focus-visible:ring-destructive")})]})]}),((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})},ES=({name:e,control:t,maxRating:r=5,disabled:n,readOnly:a})=>{var s;const{field:i,fieldState:l}=Me({name:e,control:t}),c=i.value??0,d=Array.from({length:r},(u,m)=>m+1);return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-1",children:[d.map(u=>o.jsx("button",{type:"button",disabled:n||a,onClick:()=>i.onChange(u===c?0:u),className:"transition-transform hover:scale-110 disabled:cursor-not-allowed disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded","aria-label":`${u} estrela${u>1?"s":""}`,children:o.jsx(_.Star,{size:24,className:"transition-colors",fill:u<=c?"var(--color-primary)":"transparent",stroke:u<=c?"var(--color-primary)":"currentColor"})},u)),c>0&&o.jsxs("span",{className:"ml-2 text-sm text-muted-foreground",children:[c,"/",r]})]}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},DS=({field:e,name:t,control:r,disabled:n,readOnly:a})=>{const s=n||e.isDisabled,i=a||e.isReadOnly;switch(e.tipo){case T.EMAIL:return o.jsx(Mt,{name:t,control:r,type:"email",placeholder:e.placeholder,disabled:s,readOnly:i});case T.NUMBER:return o.jsx(Mt,{name:t,control:r,type:"number",placeholder:e.placeholder,disabled:s,readOnly:i});case T.PASSWORD:return o.jsx(Mt,{name:t,control:r,type:"password",placeholder:e.placeholder,disabled:s,readOnly:i});case T.TELEFONE:return o.jsx(Qr,{name:t,control:r,maskType:"telefone",placeholder:e.placeholder??"(00) 00000-0000",disabled:s,readOnly:i});case T.CPF:return o.jsx(Qr,{name:t,control:r,maskType:"cpf",placeholder:e.placeholder??"000.000.000-00",disabled:s,readOnly:i});case T.CEP:return o.jsx(Qr,{name:t,control:r,maskType:"cep",placeholder:e.placeholder??"00000-000",disabled:s,readOnly:i});case T.TEXTAREA:return o.jsx(Al,{name:t,control:r,placeholder:e.placeholder,disabled:s,readOnly:i});case T.SELECT:return o.jsx(Rl,{name:t,control:r,options:e.opcoes??[],placeholder:e.placeholder,disabled:s,readOnly:i});case T.CHECKBOX:return o.jsx(Il,{name:t,control:r,label:e.label??"",disabled:s,readOnly:i});case T.SWITCH:return o.jsx(jx,{name:t,control:r,label:e.label??"",disabled:s,readOnly:i});case T.DATE:return o.jsx(aa,{name:t,control:r,disabled:s,readOnly:i});case T.TIME:return o.jsx(kx,{name:t,control:r,disabled:s,readOnly:i});case T.HIDDEN:return o.jsx(zl,{name:t,control:r});default:return o.jsx(Mt,{name:t,control:r,type:"text",placeholder:e.placeholder,disabled:s,readOnly:i})}},TS=({name:e,control:t,subSchema:r,disabled:n,readOnly:a})=>{if(!r||r.fields.length===0)return null;const s=[...r.fields].sort((i,l)=>i.ordem-l.ordem);return o.jsxs("div",{className:"rounded-xl border border-input bg-muted/30 p-4 space-y-4",children:[r.titulo&&o.jsx("h4",{className:"text-sm font-semibold text-muted-foreground",children:r.titulo}),o.jsx("div",{className:"grid grid-cols-12 gap-4",children:s.map(i=>{const l=`${e}.${i.nome}`,c=i.tipo===T.CHECKBOX||i.tipo===T.SWITCH||i.tipo===T.HIDDEN,d=i.tamanho??6;return o.jsxs("div",{className:`col-span-${d}`,children:[!c&&o.jsxs("label",{className:"mb-1 block text-sm font-medium text-foreground",children:[i.label,i.obrigatorio&&o.jsx("span",{className:"text-destructive",children:" *"})]}),o.jsx(DS,{field:i,name:l,control:t,disabled:n,readOnly:a})]},i.id)})})]})},Cx=({field:e,control:t,nameOverride:r})=>{var n,a;const s=r??e.nome,{componentMapper:i}=Hr(),l=i==null?void 0:i[e.tipo];if(l)return o.jsx(l,{name:s,control:t,field:e});const c={name:s,control:t,placeholder:e.placeholder,disabled:e.isDisabled,readOnly:e.isReadOnly};switch(e.tipo){case T.TEXTO:return o.jsx(Mt,{...c,type:"text"});case T.EMAIL:return o.jsx(Mt,{...c,type:"email"});case T.NUMBER:return o.jsx(Mt,{...c,type:"number"});case T.PASSWORD:return o.jsx(kS,{...c});case T.TEXTAREA:return o.jsx(Al,{...c});case T.SELECT:return o.jsx(Rl,{...c,options:e.opcoes??[]});case T.AUTOCOMPLETE:return o.jsx(SS,{...c,options:e.opcoes??[]});case T.SWITCH:return o.jsx(jx,{name:s,control:t,label:e.label,disabled:e.isDisabled,readOnly:e.isReadOnly});case T.SLIDER:return o.jsx(CS,{name:s,control:t,minValue:e.minValue,maxValue:e.maxValue,step:e.step,disabled:e.isDisabled,readOnly:e.isReadOnly});case T.RATING:return o.jsx(ES,{name:s,control:t,maxRating:e.maxRating,disabled:e.isDisabled,readOnly:e.isReadOnly});case T.COLOR:return o.jsx(NS,{name:s,control:t,disabled:e.isDisabled,readOnly:e.isReadOnly});case T.TIME:return o.jsx(kx,{...c});case T.DATE_RANGE:return o.jsx($S,{name:s,control:t,startLabel:e.dateRangeStartLabel,endLabel:e.dateRangeEndLabel,disabled:e.isDisabled,readOnly:e.isReadOnly});case T.RADIO:return o.jsx(px,{...c,options:e.opcoes??[]});case T.CHECKBOX:return o.jsx(Il,{name:s,control:t,label:e.label,disabled:e.isDisabled,readOnly:e.isReadOnly});case T.CHECKBOX_GROUP:return o.jsx(mx,{...c,options:e.opcoes??[]});case T.DATE:return o.jsx(aa,{name:s,control:t,disabled:e.isDisabled,readOnly:e.isReadOnly,validacao:e.validacao});case T.DATETIME:return o.jsx(aa,{name:s,control:t,isDatetime:!0,disabled:e.isDisabled,readOnly:e.isReadOnly,validacao:e.validacao});case T.FILE:return o.jsx(bx,{name:s,control:t,disabled:e.isDisabled,fileTypes:(n=e.validacao)==null?void 0:n.fileTypes,maxFileSize:(a=e.validacao)==null?void 0:a.maxFileSize});case T.TELEFONE:return o.jsx(Qr,{...c,maskType:"telefone"});case T.CPF:return o.jsx(Qr,{...c,maskType:"cpf"});case T.CEP:return o.jsx(wx,{name:s,control:t,placeholder:e.placeholder,disabled:e.isDisabled,readOnly:e.isReadOnly,cepFillMap:e.cepFillMap});case T.HIDDEN:return o.jsx(zl,{name:s,control:t});case T.PARTICIPATION_TYPE:return o.jsx(gS,{name:s,control:t});case T.PAYMENT_METHOD:return o.jsx(wS,{name:s,control:t,relatedFieldName:e.relatedFieldName});case T.TERMS:return o.jsx(jS,{name:s,control:t,label:e.label,termoTexto:e.termoTexto,termoPdfUrl:e.termoPdfUrl,termoPdfUploadId:e.termoPdfUploadId});case T.FIELD_ARRAY:return o.jsx(mS,{name:s,control:t,subFields:e.subFields,minItems:e.minItems,maxItems:e.maxItems,itemLabel:e.itemLabel,addLabel:e.addLabel});case T.SUB_FORM:return o.jsx(TS,{name:s,control:t,subSchema:e.subSchema,disabled:e.isDisabled,readOnly:e.isReadOnly});default:return o.jsx(Mt,{...c,type:"text"})}},AS=({container:e,control:t})=>{var r;const{externalData:n={},fieldResolvers:a}=Hr(),s=e.icone?Pt[e.icone]:void 0,i=n,l=N.useMemo(()=>Tl(e,i),[e,JSON.stringify(i)]),c=N.useMemo(()=>[...l.campos].sort((x,y)=>x.ordem-y.ordem),[l.campos]),d=Mn({control:t}),{wrapperClass:u,wrapperStyle:m,headerClass:p,headerStyle:f,tmpl:b}=ux(),h=x=>{if(!st(x.condicional,d,n))return null;let y=x;if(x.resolvePropsKey&&a!=null&&a[x.resolvePropsKey]){const S=a[x.resolvePropsKey](x,d,n);y={...x,...S}}if(y.opcoesFromVar){const S=n[y.opcoesFromVar];Array.isArray(S)&&(y={...y,opcoes:S.map($=>typeof $=="string"?{valor:$,label:$}:$&&typeof $=="object"&&"valor"in $&&"label"in $?$:{valor:String($),label:String($)})})}const v=y.tamanho??12,j=y.inicioColuna,w=j?`${j} / span ${v}`:`span ${v}`,C=o.jsx(Cx,{field:y,control:t});return y.tipo===T.CHECKBOX||y.tipo===T.HIDDEN||y.tipo===T.SWITCH?o.jsx("div",{className:"max-sm:!col-span-12",style:{gridColumn:w},children:C},y.id):o.jsxs("div",{className:"max-sm:!col-span-12 space-y-2",style:{gridColumn:w},children:[o.jsxs("label",{className:"font-medium flex items-center gap-1",style:{color:"var(--t-text)"},children:[y.label,y.obrigatorio&&o.jsx("span",{className:"text-destructive",children:"*"})]}),C,y.hint&&o.jsx("p",{className:"text-xs text-muted-foreground",children:y.hint})]},y.id)};return o.jsxs("div",{className:u,style:m,children:[(l.titulo||s)&&o.jsx("div",{className:p,style:f,children:o.jsxs("div",{className:"flex items-center gap-3",children:[s&&o.jsx("div",{className:"p-2 rounded-xl",style:{background:"color-mix(in srgb, var(--t-primary) 12%, transparent)"},children:o.jsx(s,{className:"w-5 h-5",style:{color:"var(--t-primary)"}})}),o.jsxs("div",{children:[o.jsx("h3",{className:((r=b.typography)==null?void 0:r.stepTitleClass)??"text-lg font-semibold",style:{color:"var(--t-text)"},children:l.titulo}),l.descricao&&o.jsx("p",{className:"text-sm",style:{color:"var(--t-text-muted)"},children:l.descricao})]})]})}),o.jsx("div",{className:"p-6 grid grid-cols-12 gap-4",children:c.map(h)})]})},RS=({container:e,control:t})=>{var r;const{externalData:n={}}=Hr(),a=e.nome??"__invalid__",s=e.minItems??1,i=e.maxItems,l=e.itemLabel??"Item",c=e.icone?Pt[e.icone]:void 0,d=n,u=N.useMemo(()=>Tl(e,d),[e,JSON.stringify(d)]),m=N.useMemo(()=>[...u.campos].sort((k,E)=>k.ordem-E.ordem),[u.campos]),p=N.useCallback(()=>{const k={};for(const E of m)E.initialValue!==void 0?k[E.nome]=typeof E.initialValue=="string"?wt(E.initialValue,d):E.initialValue:E.defaultValue!==void 0&&(k[E.nome]=E.defaultValue);return k},[m,d]),{fields:f,append:b,remove:h}=dx({control:t,name:a});N.useEffect(()=>{if(e.nome&&f.length<s)for(let k=f.length;k<s;k++)b(p())},[s]);const x=Mn({control:t}),y=N.useMemo(()=>{const k=x[a];return Array.isArray(k)?k:[]},[x,a]),{wrapperClass:v,wrapperStyle:j,headerClass:w,headerStyle:C,tmpl:S}=ux();if(!e.nome)return console.error("[RepeatableContainerRenderer] container.nome é obrigatório para containers repetíveis. Container id:",e.id),null;const $=(k,E)=>{const D=y[E]??{};if(!st(k.condicional,D,n))return null;const O=`${a}.${E}.${k.nome}`,L=k.tamanho??12,A=k.inicioColuna,z=A?`${A} / span ${L}`:`span ${L}`,X=o.jsx(Cx,{field:k,control:t,nameOverride:O});return k.tipo===T.CHECKBOX||k.tipo===T.HIDDEN?o.jsx("div",{className:"max-sm:!col-span-12",style:{gridColumn:z},children:X},`${k.id}-${E}`):o.jsxs("div",{className:"max-sm:!col-span-12 space-y-2",style:{gridColumn:z},children:[o.jsxs("label",{className:"font-medium flex items-center gap-1",style:{color:"var(--t-text)"},children:[k.label,k.obrigatorio&&o.jsx("span",{className:"text-destructive",children:"*"})]}),X,k.hint&&o.jsx("p",{className:"text-xs text-muted-foreground",children:k.hint})]},`${k.id}-${E}`)};return o.jsxs("div",{className:v,style:j,children:[(u.titulo||c)&&o.jsx("div",{className:w,style:C,children:o.jsxs("div",{className:"flex items-center gap-3",children:[c&&o.jsx("div",{className:"p-2 rounded-xl",style:{background:"color-mix(in srgb, var(--t-primary) 12%, transparent)"},children:o.jsx(c,{className:"w-5 h-5",style:{color:"var(--t-primary)"}})}),o.jsxs("div",{children:[o.jsx("h3",{className:((r=S.typography)==null?void 0:r.stepTitleClass)??"text-lg font-semibold",style:{color:"var(--t-text)"},children:u.titulo}),u.descricao&&o.jsx("p",{className:"text-sm",style:{color:"var(--t-text-muted)"},children:u.descricao})]})]})}),o.jsxs("div",{className:"p-6 space-y-4",children:[f.map((k,E)=>o.jsxs("div",{className:"border border-input rounded-lg p-4 bg-muted/30",children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs font-bold shrink-0 bg-primary text-primary-foreground",children:E+1}),o.jsxs("span",{className:"text-sm font-semibold",children:[l," ",E+1]})]}),f.length>s&&o.jsx("button",{type:"button",onClick:()=>h(E),className:"inline-flex items-center justify-center rounded-md p-1.5 text-destructive hover:bg-destructive/10 transition-colors","aria-label":"Remover item",children:o.jsx(_.Trash2,{className:"w-4 h-4"})})]}),o.jsx("div",{className:"grid grid-cols-12 gap-4",children:m.map(D=>$(D,E))})]},k.id)),(!i||f.length<i)&&o.jsxs("button",{type:"button",className:"w-full flex items-center justify-center gap-2 py-2 px-4 border border-input rounded-lg text-sm hover:bg-accent transition-colors",onClick:()=>b(p()),children:[o.jsx(_.Plus,{className:"w-4 h-4"}),"Adicionar ",l.toLowerCase()]}),i&&o.jsxs("p",{className:"text-xs text-center text-muted-foreground",children:["Máximo de ",i," ",l.toLowerCase(),i>1?"s":""]})]})]})},IS=e=>e.container.repeatable&&e.container.nome?o.jsx(RS,{...e}):o.jsx(AS,{...e}),PS=({step:e,control:t,externalData:r={}})=>{const n=N.useMemo(()=>[...e.containers].sort((s,i)=>s.ordem-i.ordem),[e.containers]),a=Mn({control:t});return o.jsx("div",{className:"grid grid-cols-12 gap-4",children:n.map(s=>{if(s.condicional&&!st(s.condicional,a,r))return null;const i=s.tamanho??12,l=s.inicioColuna,c=l?`${l} / span ${i}`:`span ${i}`;return o.jsx("div",{className:"max-sm:!col-span-12",style:{gridColumn:c},children:o.jsx(IS,{container:s,control:t})},s.id)})})},_S=N.createContext({submitting:!1,warnings:{},requestSubmit:()=>{}}),OS=_S.Provider,eu=({stepIndex:e,totalSteps:t,step:r,defaultValues:n,externalData:a,fieldErrors:s,isSubmitting:i,submitError:l,validatorMapper:c={},onWarningsChange:d,onValuesChange:u,onSubmit:m,onBack:p})=>{const f=e===t-1,b=N.useMemo(()=>JSON.stringify(a),[a]),h=N.useMemo(()=>PN(r,a,c),[r.id,b]),x=N.useMemo(()=>_N(r,a,c),[r.id,b]),[y,v]=N.useState({}),j=N.useRef(d);j.current=d;const w=a,C=N.useMemo(()=>LN(r,w),[r,b]),S=NN({resolver:h,defaultValues:n,mode:"onTouched"}),{control:$,handleSubmit:k,setError:E,clearErrors:D,setValue:O}=S;N.useEffect(()=>{D();for(const[U,Q]of Object.entries(s))E(U,{type:"server",message:Q})},[s,E,D]);const L=N.useMemo(()=>r.containers.filter(U=>!U.repeatable).flatMap(U=>U.campos).filter(U=>!!U.condicional),[r.containers]),A=N.useMemo(()=>r.containers.filter(U=>!!U.condicional),[r.containers]),z=N.useMemo(()=>r.containers.filter(U=>!U.repeatable).flatMap(U=>U.campos).filter(U=>{var Q;return U.condicional&&((Q=U.setValues)==null?void 0:Q.length)}),[r.containers]),X=N.useMemo(()=>r.containers.filter(U=>U.repeatable&&!!U.nome).map(U=>({container:U,fields:U.campos.filter(Q=>!!Q.condicional)})).filter(U=>U.fields.length>0),[r.containers]),q=N.useRef({}),Z=N.useRef(!0),V=Mn({control:$}),M=N.useRef(u);M.current=u,N.useEffect(()=>{var U;(U=M.current)==null||U.call(M,V)},[V]),N.useEffect(()=>{let U=!1;return x(V).then(Q=>{var Y;U||(v(Q),(Y=j.current)==null||Y.call(j,Q))}).catch(Q=>{U||console.error("[StepForm] warnComputer error:",Q)}),()=>{U=!0}},[V,x]),N.useEffect(()=>{var U;if(!L.length&&!z.length&&!A.length&&!X.length)return;const Q=V;for(const H of L)if(!st(H.condicional,Q,a)){if(D(H.nome),H.tipo===T.FIELD_ARRAY){const W=Q[H.nome];Array.isArray(W)&&W.forEach((G,ne)=>{(H.subFields??[]).forEach(J=>D(`${H.nome}.${ne}.${J.nome}`))})}if(H.clearedValue!==void 0){const W=H.clearedValue??"";Q[H.nome]!==W&&O(H.nome,W,{shouldValidate:!1})}}for(const H of A)if(!st(H.condicional,Q,a))if(H.repeatable&&H.nome)(Array.isArray(Q[H.nome])?Q[H.nome]:[]).forEach((W,G)=>{for(const ne of H.campos)D(`${H.nome}.${G}.${ne.nome}`)});else for(const W of H.campos){D(W.nome);const G=W.clearedValue!==void 0?W.clearedValue:void 0;G!==void 0&&Q[W.nome]!==G&&O(W.nome,G,{shouldValidate:!1})}for(const{container:H,fields:W}of X){const G=H.nome,ne=Array.isArray(Q[G])?Q[G]:[];for(let J=0;J<ne.length;J++){const te=ne[J];for(const ce of W)if(!st(ce.condicional,te,a)&&(D(`${G}.${J}.${ce.nome}`),ce.clearedValue!==void 0)){const be=ce.clearedValue??"";te[ce.nome]!==be&&O(`${G}.${J}.${ce.nome}`,be,{shouldValidate:!1})}}}const Y=Z.current;for(const H of z){const W=st(H.condicional,Q,a),G=Y?W:q.current[H.nome]??!1;if(W&&!G&&(U=H.setValues)!=null&&U.length)for(const ne of H.setValues){const J=typeof ne.valor=="string"?wt(ne.valor,w):ne.valor;O(ne.campo,J,{shouldValidate:!1})}q.current[H.nome]=W}Z.current=!1},[V,L,z,A,X,a,O,D]);const P=C.icone?Pt[C.icone]:void 0,se=N.useMemo(()=>()=>{S.handleSubmit(m)()},[m]);return o.jsx(cN,{...S,children:o.jsx(OS,{value:{submitting:i,warnings:y,requestSubmit:se},children:o.jsx("form",{onSubmit:k(m),noValidate:!0,onKeyDown:U=>{U.key==="Enter"&&U.target.tagName==="INPUT"&&U.preventDefault()},children:o.jsxs("div",{className:"space-y-6",children:[C.showLabel!==!1&&o.jsxs("div",{className:"text-center space-y-2",children:[P&&o.jsx("div",{className:"w-12 h-12 mx-auto rounded-xl flex items-center justify-center",style:{background:"color-mix(in srgb, var(--t-primary) 12%, transparent)"},children:o.jsx(P,{className:"w-6 h-6",style:{color:"var(--t-primary)"}})}),o.jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--t-text)"},children:C.titulo}),C.descricao&&o.jsx("p",{className:"text-sm text-muted-foreground",children:C.descricao})]}),o.jsx(PS,{step:C,control:$,externalData:a}),o.jsxs("div",{className:"flex items-center justify-between gap-4 pt-6 pb-2",children:[o.jsxs(De,{type:"button",variant:"outline",onClick:p,disabled:e===0,className:K(e>0&&"border-primary/40 text-primary hover:bg-primary/5"),children:[o.jsx(_.ChevronLeft,{className:"w-4 h-4"}),o.jsx("span",{className:"hidden sm:inline",children:"Anterior"})]}),o.jsxs("span",{className:"text-xs font-semibold tabular-nums sm:hidden text-muted-foreground",children:[e+1,"/",t]}),o.jsxs(De,{type:"submit",disabled:i,children:[i?o.jsx(_.Loader2,{className:"w-4 h-4 animate-spin"}):f?o.jsx(_.Check,{className:"w-4 h-4"}):o.jsx(_.ChevronRight,{className:"w-4 h-4"}),o.jsx("span",{className:"hidden sm:inline",children:f?"Finalizar":"Próximo"})]})]}),l&&o.jsx("p",{className:"text-sm text-destructive mt-2 text-center",children:l})]})})})})},lo=e=>{if(e)return Pt[e]},FS=({steps:e,currentStep:t,onStepClick:r})=>o.jsx("div",{className:"flex items-center justify-center gap-2 flex-wrap",children:e.map((n,a)=>o.jsx("div",{role:r?"button":void 0,tabIndex:r?0:void 0,onClick:()=>r==null?void 0:r(a),onKeyDown:s=>s.key==="Enter"&&(r==null?void 0:r(a)),className:K("w-8 h-8 rounded-full flex items-center justify-center text-xs font-bold transition-all shrink-0",r&&"cursor-pointer hover:opacity-80"),style:a===t?{background:"var(--t-primary)",color:"#ffffff",boxShadow:"0 0 0 3px color-mix(in srgb, var(--t-primary) 30%, transparent)"}:a<t?{background:"#22c55e",color:"#ffffff"}:{background:"hsl(var(--muted))",color:"hsl(var(--muted-foreground))"},children:a<t?o.jsx(_.Check,{className:"w-4 h-4"}):a+1},n.id))}),zS=({steps:e,currentStep:t,onStepClick:r})=>o.jsx("div",{className:"flex items-center justify-center gap-2 flex-wrap",children:e.map((n,a)=>{const s=lo(n.icone)??_.CircleDot;return o.jsx("div",{role:r?"button":void 0,tabIndex:r?0:void 0,onClick:()=>r==null?void 0:r(a),onKeyDown:i=>i.key==="Enter"&&(r==null?void 0:r(a)),className:K("w-9 h-9 rounded-full flex items-center justify-center transition-all shrink-0",r&&"cursor-pointer hover:opacity-80"),style:a===t?{background:"var(--t-primary)",color:"#ffffff",boxShadow:"0 0 0 3px color-mix(in srgb, var(--t-primary) 30%, transparent)"}:a<t?{background:"#22c55e",color:"#ffffff"}:{background:"hsl(var(--muted))",color:"hsl(var(--muted-foreground))"},children:a<t?o.jsx(_.Check,{className:"w-4 h-4"}):o.jsx(s,{className:"w-4 h-4"})},n.id)})}),LS=({steps:e,currentStep:t,position:r,orientation:n="horizontal",onStepClick:a})=>n==="vertical"?o.jsx("div",{className:"flex flex-col gap-0",children:e.map((s,i)=>{const l=lo(s.icone)??_.CircleDot,c=i===t,d=i<t,u=i===e.length-1;return o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsxs("div",{className:"flex flex-col items-center",children:[o.jsx("button",{type:"button",onClick:()=>a==null?void 0:a(i),className:K("w-8 h-8 rounded-full flex items-center justify-center transition-all shrink-0",a&&"cursor-pointer hover:opacity-80"),style:c?{background:"var(--t-primary)",color:"#fff",boxShadow:"0 0 10px color-mix(in srgb, var(--t-primary) 50%, transparent)"}:d?{background:"#22c55e",color:"#fff"}:{background:"color-mix(in srgb, var(--t-text) 8%, transparent)",color:"var(--t-text-muted)",border:"1.5px solid color-mix(in srgb, var(--t-border) 60%, transparent)"},children:d?o.jsx(_.Check,{className:"w-3.5 h-3.5"}):o.jsx(l,{className:"w-3.5 h-3.5"})}),!u&&o.jsx("div",{className:"w-[2px] my-1",style:{height:"24px",background:d?"#22c55e":"color-mix(in srgb, var(--t-border) 50%, transparent)"}})]}),o.jsx("span",{className:"text-sm font-medium leading-tight mt-1.5",style:c?{color:"var(--t-primary)"}:d?{color:"#16a34a"}:{color:"var(--t-text-muted)"},children:s.label??s.id})]},s.id)})}):o.jsx("div",{className:"w-full flex items-start",children:e.map((s,i)=>{const l=lo(s.icone)??_.CircleDot,c=i===t,d=i<t,u=i===e.length-1;return o.jsxs("div",{className:K("flex items-start",!u&&"flex-1"),children:[o.jsxs("div",{className:"flex flex-col items-center gap-1.5 w-[56px] shrink-0 mx-auto",children:[o.jsx("button",{type:"button",onClick:()=>a==null?void 0:a(i),className:K("w-10 h-10 rounded-full flex items-center justify-center transition-all shrink-0",a&&"cursor-pointer hover:opacity-80"),style:c?{background:"var(--t-primary)",color:"#ffffff",boxShadow:"0 0 12px color-mix(in srgb, var(--t-primary) 50%, transparent)"}:d?{background:"#22c55e",color:"#ffffff"}:{background:"color-mix(in srgb, var(--t-text) 8%, transparent)",color:"var(--t-text-muted)",border:"1.5px solid color-mix(in srgb, var(--t-border) 60%, transparent)"},children:d?o.jsx(_.Check,{className:"w-4 h-4"}):o.jsx(l,{className:"w-4 h-4"})}),o.jsx("span",{className:"text-[10px] font-medium text-center leading-tight line-clamp-2 px-0.5",style:c?{color:"var(--t-primary)"}:d?{color:"#16a34a"}:{color:"var(--t-text-muted)"},children:s.label??s.id})]}),!u&&o.jsx("div",{className:"flex-1 h-[1.5px] mt-5 mx-1",style:{background:d?"linear-gradient(90deg, var(--t-primary), color-mix(in srgb, var(--t-primary) 40%, transparent))":"color-mix(in srgb, var(--t-border) 50%, transparent)"}})]},s.id)})}),Nx=({steps:e,currentStep:t,onStepClick:r,className:n,forceShow:a})=>{const s=sa(),{layout:i}=s;if(!i.showStepIndicators||e.length<=1&&!a)return null;const l=i.stepIndicatorVariant??"numbers",c=i.stepIndicatorPosition??"top-center",d=i.stepIndicatorOrientation??"horizontal",u=(t+1)/e.length*100,m=e[t],p=lo(m==null?void 0:m.icone)??_.CircleDot,f=o.jsx("div",{className:"h-1 rounded-full overflow-hidden",style:{background:"color-mix(in srgb, var(--t-primary) 15%, transparent)"},children:o.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${u}%`,background:"linear-gradient(90deg, var(--t-primary), var(--t-accent))"}})}),b=o.jsxs("div",{className:"block sm:hidden space-y-2",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"w-10 h-10 rounded-full flex items-center justify-center shrink-0",style:{background:"var(--t-primary)",color:"#fff"},children:o.jsx(p,{className:"w-5 h-5"})}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("p",{className:"text-sm font-semibold leading-tight truncate",style:{color:"var(--t-text)"},children:(m==null?void 0:m.label)??(m==null?void 0:m.id)}),o.jsxs("p",{className:"text-xs leading-tight",style:{color:"var(--t-text-muted)"},children:["Passo ",t+1," de ",e.length]})]})]}),f]}),h=o.jsxs("div",{className:"hidden sm:block",children:[l==="numbers"&&o.jsx(FS,{steps:e,currentStep:t,onStepClick:r}),l==="icons"&&o.jsx(zS,{steps:e,currentStep:t,onStepClick:r}),l==="icons-labeled"&&o.jsx(LS,{steps:e,currentStep:t,position:c,orientation:d,onStepClick:r})]}),x=i.showProgressBar?o.jsx("div",{className:"hidden sm:block",children:f}):null;return d==="vertical"?o.jsxs("div",{className:K("flex gap-6 items-start",n),children:[b,o.jsxs("div",{className:"hidden sm:flex gap-6 items-start shrink-0",children:[h,x&&o.jsx("div",{className:"flex-1 pt-4",children:x})]})]}):o.jsxs("div",{className:K("space-y-3",n),children:[b,o.jsxs("div",{className:"hidden sm:block space-y-3",children:[h,x]})]})},MS=(e,t,r)=>{var n;const a={...t},s=r;for(const i of e.containers){for(const l of i.campos)if(a[l.nome]===void 0&&(l.initialValue!==void 0?a[l.nome]=typeof l.initialValue=="string"?wt(l.initialValue,s):l.initialValue:l.defaultValue!==void 0&&(a[l.nome]=l.defaultValue)),l.tipo===T.FIELD_ARRAY&&(n=l.subFields)!=null&&n.length){const c=a[l.nome];Array.isArray(c)&&c.length>0&&(a[l.nome]=c.map(d=>{const u={...d};for(const m of l.subFields)u[m.nome]===void 0&&(m.initialValue!==void 0?u[m.nome]=typeof m.initialValue=="string"?wt(m.initialValue,s):m.initialValue:m.defaultValue!==void 0&&(u[m.nome]=m.defaultValue));return u}))}if(i.repeatable&&i.nome){const l=a[i.nome];Array.isArray(l)&&l.length>0&&(a[i.nome]=l.map(c=>{const d={...c};for(const u of i.campos)d[u.nome]===void 0&&(u.initialValue!==void 0?d[u.nome]=typeof u.initialValue=="string"?wt(u.initialValue,s):u.initialValue:u.defaultValue!==void 0&&(d[u.nome]=u.defaultValue));return d}))}}return a},VS=({schema:e,initialValues:t={},initialStep:r=0,onSubmitStep:n,onComplete:a,template:s,formTitle:i,externalData:l={},fieldErrors:c={},uploadFile:d,deleteUploadedFile:u,cepLookup:m,resolveTermsUploadUrl:p,fieldResolvers:f,validatorMapper:b,componentMapper:h,paymentMethodOptions:x,onValuesChange:y,className:v,StepIndicator:j=Nx})=>{const[w,C]=N.useState(()=>r),[S,$]=N.useState({...t}),[k,E]=N.useState(()=>r),[D,O]=N.useState(!1),[L,A]=N.useState(null),[z,X]=N.useState({}),q=N.useRef(p);q.current=p;const Z=N.useCallback(me=>q.current(me),[]),V=!!p,M=N.useRef(u);M.current=u;const P=N.useCallback(me=>M.current(me),[]),se=!!u,U=N.useMemo(()=>JSON.stringify(l),[l]),Q=N.useMemo(()=>JSON.stringify(e.stepConfig),[e.stepConfig]),Y=N.useMemo(()=>{const me=uo(s);return e.stepConfig?{...me,layout:{...me.layout,...e.stepConfig}}:me},[s,Q]),H=N.useMemo(()=>[...e.steps].sort((me,Ee)=>me.ordem-Ee.ordem),[e.steps]),W=H.length,G=W>0?H[Math.min(w,W-1)]:null,ne=N.useMemo(()=>G?MS(G,S,l):{},[G,S,U]),J=N.useMemo(()=>({uploadFile:d,deleteUploadedFile:se?P:void 0,cepLookup:m,resolveTermsUploadUrl:V?Z:void 0,externalData:l,fieldResolvers:f,validatorMapper:b,fieldWarnings:z,componentMapper:h,paymentMethodOptions:x}),[d,se,P,m,Z,V,f,b,z,h,x,U]),te=N.useCallback(async me=>{if(!D){O(!0),A(null);try{const Ee={...S,...me};if($(Ee),n&&await n(w,me),w===W-1)a&&await a(Ee);else{const Fe=w+1;C(Fe),E(Nt=>Math.max(Nt,Fe))}}catch(Ee){console.error("[FormRenderer] Submit error:",Ee);const Fe=Ee instanceof Error?Ee.message:"Ocorreu um erro. Tente novamente.";A(Fe)}finally{O(!1)}}},[w,S,D,W,n,a]),ce=N.useCallback(()=>{w>0&&C(me=>me-1)},[w]);if(!G)return o.jsx(vi.Provider,{value:J,children:o.jsx(ea,{config:Y,className:`min-h-dvh ${Y.wrapperClass??""} ${v??""}`,renderWrapper:!0,children:o.jsx("div",{className:"w-full max-w-4xl mx-auto px-4 py-6 sm:px-6 text-center text-muted-foreground",children:"Nenhum step configurado."})})});const be=Y.layout.eventTitleStyle??"bar",Ce=(Y.layout.stepIndicatorOrientation??"horizontal")==="vertical",ve=W>=1?o.jsx(j,{steps:H.map(me=>({id:me.id,label:me.titulo,icone:me.icone})),currentStep:w,onStepClick:me=>{me!==w&&me<=k&&C(me)}}):null;return o.jsx(vi.Provider,{value:J,children:o.jsx(ea,{config:Y,className:`min-h-dvh ${Y.wrapperClass??""} ${v??""}`,renderWrapper:!0,children:o.jsxs("div",{className:"w-full max-w-4xl mx-auto px-4 py-6 sm:px-6",children:[i&&be==="bar"&&o.jsx("div",{className:"w-full text-center text-sm font-medium py-2.5 px-4 mb-6 rounded-lg border border-input text-muted-foreground bg-muted/30",children:i}),i&&be==="inline"&&o.jsxs("div",{className:"text-center mb-6",children:[o.jsx("p",{className:"text-xs font-semibold uppercase tracking-widest mb-1",style:{color:"var(--t-text-muted)"},children:"Inscrição"}),o.jsx("h1",{className:"text-2xl font-bold",style:{color:"var(--t-text)"},children:i}),o.jsx("div",{className:"h-0.5 w-12 mx-auto mt-3 rounded-full",style:{background:"var(--t-primary)"}})]}),Ce?o.jsxs("div",{className:"flex gap-6 items-start",children:[o.jsx("div",{className:"hidden sm:block shrink-0 w-44 pt-1",children:ve}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"sm:hidden mb-6",children:ve}),o.jsx(eu,{stepIndex:w,totalSteps:W,step:G,defaultValues:ne,externalData:l,fieldErrors:c,isSubmitting:D,submitError:L,validatorMapper:b,onWarningsChange:X,onValuesChange:y,onSubmit:te,onBack:ce},w)]})]}):o.jsxs(o.Fragment,{children:[ve&&o.jsx("div",{className:"mb-8",children:ve}),o.jsx(eu,{stepIndex:w,totalSteps:W,step:G,defaultValues:ne,externalData:l,fieldErrors:c,isSubmitting:D,submitError:L,validatorMapper:b,onWarningsChange:X,onValuesChange:y,onSubmit:te,onBack:ce},w)]})]})})})},BS=({onFillMock:e,onClear:t})=>o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx(Yh,{}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(De,{variant:"outline",size:"sm",onClick:e,children:[o.jsx(_.FlaskConical,{className:"w-3.5 h-3.5 mr-1"}),"Preencher mock"]}),o.jsxs(De,{variant:"ghost",size:"sm",onClick:t,children:[o.jsx(_.Eraser,{className:"w-3.5 h-3.5 mr-1"}),"Limpar"]})]})]}),US=({onRestart:e})=>o.jsxs("div",{className:"max-w-4xl mx-auto flex flex-col items-center justify-center py-16 space-y-4",children:[o.jsx("div",{className:"w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center",children:o.jsx(_.PartyPopper,{className:"w-8 h-8 text-primary"})}),o.jsx("h2",{className:"text-xl font-bold text-foreground",children:"Formulário enviado!"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Este é um preview simulado. Nenhum dado foi enviado."}),o.jsxs(De,{variant:"outline",onClick:e,children:[o.jsx(_.RotateCcw,{className:"w-4 h-4 mr-1"}),"Recomeçar"]})]}),HS=e=>o.jsx(Nx,{...e,forceShow:!0}),WS=async(e,t,r)=>{for(let n=20;n<=100;n+=20)await new Promise(a=>setTimeout(a,80)),r==null||r(n);return`mock-upload-${Date.now()}`},qS=async e=>({}),tu={texto:"Texto de teste",textarea:"Texto longo de exemplo para preview do formulário.",email:"teste@email.com",number:42,telefone:"(11) 99999-9999",cpf:"123.456.789-00",cep:"01001-000",date:new Date().toISOString().slice(0,10),datetime:new Date().toISOString().slice(0,10),time:"10:30",password:"Senha123!",masked:"123456",checkbox:!0,switch:!0,slider:50,rating:4,color:"#3B82F6",participation_type:{tipo:"todos_os_dias",data:null,genero:null},payment_method:{metodo:"pix",valorTotal:0},date_range:{start:new Date().toISOString().slice(0,10),end:new Date().toISOString().slice(0,10)},file:"mock-upload-preview"};function GS(e){var t,r;const n=e.tipo;if(!(n==="hidden"||n==="terms"||n==="field_array"))return tu[n]!==void 0?tu[n]:(n==="select"||n==="radio"||n==="autocomplete")&&(t=e.opcoes)!=null&&t.length?e.opcoes[0].valor:n==="checkbox_group"&&(r=e.opcoes)!=null&&r.length?[e.opcoes[0].valor]:"Teste"}function XS(e){const t={};for(const r of e.steps)for(const n of r.containers)for(const a of n.campos){const s=GS(a);s!==void 0&&(t[a.nome]=s)}return t}const ZS=({eventoData:e})=>{const{containers:t,configs:r,previewTemplateId:n,stepConfig:a}=gt(),s=N.useMemo(()=>yl({containers:t},r,{nome:"Preview",status:ji.RASCUNHO,template:n,stepConfig:a}),[t,r,n,a]),[i,l]=N.useState(0),[c,d]=N.useState({}),[u,m]=N.useState(!1),p=N.useCallback(()=>{d(XS(s)),l(h=>h+1),m(!1)},[s]),f=N.useCallback(()=>{d({}),l(h=>h+1),m(!1)},[]),b=N.useCallback(()=>{d({}),l(h=>h+1),m(!1)},[]);return s.steps.length===0?o.jsx("div",{className:"rounded-lg border border-dashed border-border/40 p-6 text-center text-xs text-muted-foreground/50",children:"Adicione steps, containers e campos para ver o preview ao vivo"}):u?o.jsx(US,{onRestart:b}):o.jsxs("div",{className:"space-y-3",children:[o.jsx("div",{className:"px-1",children:o.jsx(BS,{onFillMock:p,onClear:f})}),o.jsx(VS,{schema:s,initialValues:c,template:n,externalData:e,uploadFile:WS,cepLookup:qS,onComplete:async()=>m(!0),StepIndicator:HS},i)]})},Sx=({id:e,currentTamanho:t,inicioColuna:r,onResize:n,pushSnapshot:a})=>{const s=N.useRef(null),[i,l]=N.useState(!1),[c,d]=N.useState(null),u=N.useRef(null);N.useEffect(()=>()=>{var p;(p=u.current)==null||p.call(u)},[]);const m=N.useCallback(p=>{p.preventDefault(),p.stopPropagation(),a==null||a();const f=s.current;if(!f)return;const b=f.parentElement;if(!b)return;const h=b.getBoundingClientRect().width,x=f.getBoundingClientRect().width,y=p.clientX,v=r?13-r:12;l(!0);const j=C=>{const S=C.clientX-y,$=(x+S)/h,k=Math.max(1,Math.min(v,Math.round($*12)));d(k),n(k)},w=()=>{l(!1),d(null),u.current=null,window.removeEventListener("mousemove",j),window.removeEventListener("mouseup",w)};u.current=()=>{l(!1),d(null),window.removeEventListener("mousemove",j),window.removeEventListener("mouseup",w)},window.addEventListener("mousemove",j),window.addEventListener("mouseup",w)},[r,n,a]);return{resizeRef:s,resizing:i,resizePreview:c,handleResizeStart:m}},KS=({id:e,elementRef:t,onPositionApply:r,setPositionDrag:n,setSelected:a,pushSnapshot:s})=>{const i=N.useRef(null);return N.useEffect(()=>()=>{var l;(l=i.current)==null||l.call(i)},[]),{handlePositionMouseDown:N.useCallback(l=>{l.preventDefault(),l.stopPropagation(),s==null||s(),a(e);const c=t.current;if(!c)return;const d=c.parentElement;if(!d)return;const u=d.getBoundingClientRect(),m=u.width/12,p=c.getBoundingClientRect(),f=Math.max(1,Math.round(p.width/m)),b=p.left-u.left,h=l.clientX-p.left,x=w=>{const C=w-u.left-h,S=Math.round(C/m)+1;return Math.max(1,Math.min(13-f,S))},y=Math.max(1,Math.min(12,Math.round(b/m)+1));n({itemId:e,ghostStart:y,ghostSpan:f,cursorX:l.clientX,cursorY:l.clientY});const v=w=>{n({itemId:e,ghostStart:x(w.clientX),ghostSpan:f,cursorX:w.clientX,cursorY:w.clientY})},j=w=>{r(x(w.clientX)),n(null),i.current=null,window.removeEventListener("mousemove",v),window.removeEventListener("mouseup",j)};i.current=()=>{n(null),window.removeEventListener("mousemove",v),window.removeEventListener("mouseup",j)},window.addEventListener("mousemove",v),window.addEventListener("mouseup",j)},[e,t,r,n,a,s])}},ba=({id:e,container:t})=>{const{attributes:r,listeners:n,setNodeRef:a,transform:s,transition:i,isDragging:l}=Yt.useSortable({id:e,data:{isCanvasItem:!0,type:"field",id:e,fromContainer:t}}),{selectedId:c,setSelected:d,getConfig:u,updateConfig:m,removeItem:p,setPositionDrag:f,positionDrag:b,pushSnapshot:h}=gt(),x=u(e),y=Nh(e),v=(y==null?void 0:y.icon)||_.Type,j=c===e,w=x.tamanho||6,C=(b==null?void 0:b.itemId)===e,[S,$]=N.useState(!1),k="var(--t-primary, hsl(var(--primary)))",E=j?k:S?`color-mix(in srgb, ${k} 60%, transparent)`:`color-mix(in srgb, ${k} 25%, transparent)`,D=j?`0 0 0 2px color-mix(in srgb, ${k} 30%, transparent)`:void 0,{resizeRef:O,resizing:L,resizePreview:A,handleResizeStart:z}=Sx({id:e,currentTamanho:w,inicioColuna:x.inicioColuna,onResize:q=>m(e,{tamanho:q}),pushSnapshot:h}),{handlePositionMouseDown:X}=KS({id:e,elementRef:O,onPositionApply:q=>m(e,{inicioColuna:q}),setPositionDrag:f,setSelected:d,pushSnapshot:h});return o.jsxs("div",{ref:q=>{a(q),O.current=q},onClick:q=>{q.stopPropagation(),d(e)},"data-field-id":e,onMouseEnter:()=>$(!0),onMouseLeave:()=>$(!1),className:Ht("relative flex items-center gap-2 rounded border bg-card/80 backdrop-blur-sm px-2.5 pt-1.5 pb-3.5 cursor-pointer transition-all text-xs",L&&"ring-2 ring-blue-400/50",C&&"opacity-0 pointer-events-none"),style:{gridColumn:x.inicioColuna?`${x.inicioColuna} / span ${w}`:`span ${w}`,transform:oa.CSS.Transform.toString(s),transition:i,opacity:l?0:1,borderColor:E,boxShadow:D},children:[o.jsx("div",{onMouseDown:X,onClick:q=>q.stopPropagation(),className:"cursor-ew-resize shrink-0 p-0.5 rounded hover:bg-primary/20 transition-colors",title:"Arrastar para mudar coluna",children:o.jsx(_.ArrowLeftRight,{className:"h-3 w-3 text-primary/60"})}),o.jsx("div",{...n,...r,className:"cursor-grab shrink-0",onClick:q=>q.stopPropagation(),children:o.jsx(_.GripVertical,{className:"h-3 w-3 text-primary"})}),o.jsx(v,{className:"h-3.5 w-3.5 text-primary shrink-0"}),o.jsx("span",{className:"font-medium truncate flex-1",children:x.label}),x.condition&&o.jsx(_.Zap,{className:"h-3 w-3 text-amber-500 shrink-0"}),x.required&&o.jsx("span",{className:"text-destructive font-bold",children:"*"}),o.jsxs("span",{className:"text-[9px] text-muted-foreground shrink-0",children:[A??w,"/12"]}),o.jsx("button",{onClick:q=>{q.stopPropagation(),p(e)},className:"transition-opacity shrink-0 p-0.5 rounded hover:bg-destructive/10",style:{opacity:S?1:0},children:o.jsx(_.Trash2,{className:"h-3 w-3 text-destructive"})}),o.jsx("div",{className:"absolute left-2 -bottom-0.5 font-mono truncate max-w-[90%] pointer-events-none text-[8px] text-muted-foreground/30",children:e}),o.jsx("div",{"data-resize":!0,onMouseDown:z,className:"cursor-col-resize absolute right-0 top-0 bottom-0 w-2 hover:bg-primary/20 transition-colors flex items-center justify-center",children:o.jsx(_.GripHorizontal,{className:"h-3 w-3 text-primary/40 rotate-90"})})]})},YS=({id:e,container:t})=>{var r;const{attributes:n,listeners:a,setNodeRef:s,transform:i,transition:l,isDragging:c}=Yt.useSortable({id:e,data:{isCanvasItem:!0,type:"field",id:e,fromContainer:t}}),{setNodeRef:d,isOver:u}=Zt.useDroppable({id:`zone-${e}`}),{selectedId:m,setSelected:p,getConfig:f,removeItem:b,moveItem:h,containers:x}=gt(),y=f(e),v=(((r=x[e])==null?void 0:r.children)??[]).filter(C=>He(C)==="field"),j=m===e,w=y.tamanho||12;return o.jsxs("div",{ref:s,onClick:C=>{C.stopPropagation(),p(e)},className:Ht("group/fa relative rounded-lg border overflow-hidden transition-all",c&&"opacity-0 pointer-events-none",j?"border-amber-500 ring-2 ring-amber-500/20 shadow-lg":"border-amber-500/30 hover:border-amber-500/55"),style:{gridColumn:y.inicioColuna?`${y.inicioColuna} / span ${w}`:`span ${w}`,transform:oa.CSS.Transform.toString(i),transition:l},children:[o.jsxs("div",{className:Ht("flex items-center gap-1.5 border-b px-2 py-1.5 transition-colors",j?"bg-amber-500/15 border-amber-500/30":"bg-amber-500/10 border-amber-500/20"),children:[o.jsx("div",{...a,...n,className:"cursor-grab shrink-0 p-1 -ml-1 rounded hover:bg-amber-500/20 transition-colors",onClick:C=>C.stopPropagation(),children:o.jsx(_.GripVertical,{className:"h-3.5 w-3.5 text-amber-500"})}),o.jsxs("div",{className:"flex flex-col -my-1 shrink-0",children:[o.jsx("button",{onClick:C=>{C.stopPropagation(),h(e,"up")},className:"p-0 hover:bg-amber-500/10 rounded transition-colors",title:"Mover para cima",children:o.jsx(_.ChevronUp,{className:"h-3 w-3 text-muted-foreground hover:text-amber-500"})}),o.jsx("button",{onClick:C=>{C.stopPropagation(),h(e,"down")},className:"p-0 hover:bg-amber-500/10 rounded transition-colors",title:"Mover para baixo",children:o.jsx(_.ChevronDown,{className:"h-3 w-3 text-muted-foreground hover:text-amber-500"})})]}),o.jsx(_.List,{className:"h-3.5 w-3.5 text-amber-500 shrink-0"}),o.jsx("span",{className:"text-xs font-semibold truncate flex-1 text-amber-700 dark:text-amber-300",children:y.label}),o.jsxs("span",{className:"text-[10px] text-muted-foreground shrink-0 bg-amber-500/10 px-1.5 rounded",children:[y.itemLabel||"Item"," · ",v.length," campo",v.length!==1?"s":""]}),o.jsx("button",{onClick:C=>{C.stopPropagation(),b(e)},className:"opacity-0 group-hover/fa:opacity-100 transition-opacity shrink-0 p-0.5 rounded hover:bg-destructive/10",children:o.jsx(_.Trash2,{className:"h-3 w-3 text-destructive"})})]}),o.jsx("div",{className:"px-2 -mt-0.5 mb-0.5",children:o.jsx("span",{className:"text-[8px] text-muted-foreground/30 font-mono",children:e})}),o.jsxs("div",{ref:d,className:Ht("relative p-2 min-h-[40px] gap-1.5 transition-all duration-150",u?"bg-amber-500/10 ring-2 ring-inset ring-amber-500/40":""),style:{display:"grid",gridTemplateColumns:"repeat(12, minmax(0, 1fr))",gridAutoRows:"min-content"},children:[v.length===0&&o.jsx("p",{className:"text-[10px] text-muted-foreground/60 text-center py-2 italic",style:{gridColumn:"span 12"},children:"Arraste campos aqui"}),o.jsx(Yt.SortableContext,{items:v,strategy:Yt.rectSortingStrategy,children:v.map(C=>o.jsx(ba,{id:C,container:e},C))})]})]})},ru=5,JS=({id:e,elementRef:t,tamanho:r,inicioColuna:n,onPositionApply:a,setPositionDrag:s,setSelected:i,reorderStrategy:l})=>{const c=N.useRef({inicioColuna:n,tamanho:r});c.current={inicioColuna:n,tamanho:r};const d=N.useRef(null);return N.useEffect(()=>()=>{var u;(u=d.current)==null||u.call(d)},[]),{handleGripMouseDown:N.useCallback(u=>{u.preventDefault(),u.stopPropagation(),i(e);const m=u.clientX,p=u.clientY;let f=!1;const b=()=>{d.current=null,window.removeEventListener("mousemove",h),window.removeEventListener("mouseup",x)},h=j=>{const w=Math.abs(j.clientX-m),C=Math.abs(j.clientY-p);w<ru&&C<ru||(f=!0,b(),w>=C?y(j):v(j))},x=()=>{f||b()};window.addEventListener("mousemove",h),window.addEventListener("mouseup",x),d.current=b;const y=j=>{const w=t.current;if(!w)return;const C=w.parentElement;if(!C)return;const S=C.getBoundingClientRect(),$=S.width/12,{tamanho:k}=c.current,E=w.getBoundingClientRect(),D=E.left-S.left,O=Math.max(1,Math.min(12,Math.round(D/$)+1)),L=E.left;s({itemId:e,ghostStart:O,ghostSpan:k,cursorX:j.clientX,cursorY:j.clientY});const A=q=>{const Z=q-L,V=Math.round(Z/$)+1;return Math.max(1,Math.min(13-k,V))};s({itemId:e,ghostStart:A(j.clientX),ghostSpan:k,cursorX:j.clientX,cursorY:j.clientY});const z=q=>{s({itemId:e,ghostStart:A(q.clientX),ghostSpan:k,cursorX:q.clientX,cursorY:q.clientY})},X=q=>{a(A(q.clientX)),s(null),d.current=null,window.removeEventListener("mousemove",z),window.removeEventListener("mouseup",X)};window.addEventListener("mousemove",z),window.addEventListener("mouseup",X),d.current=()=>{s(null),window.removeEventListener("mousemove",z),window.removeEventListener("mouseup",X)}},v=j=>{const w=l,C=t.current;if(!C)return;const S=C.parentElement;if(!S)return;const $=w.dataAttribute||"data-container-id";w.pushSnapshot(),w.setReorderDrag({draggingId:e});let k=j.clientY;const E=O=>{const L=Array.from(S.children).filter(A=>A!==C&&A.getAttribute($));for(const A of L){const z=A.getBoundingClientRect(),X=z.top+z.height/2;if(O.clientY<X&&O.clientY>z.top&&O.clientY<k){w.moveItemNoSnapshot(e,"up"),k=O.clientY;break}else if(O.clientY>X&&O.clientY<z.bottom&&O.clientY>k){w.moveItemNoSnapshot(e,"down"),k=O.clientY;break}}},D=()=>{w.setReorderDrag(null),d.current=null,window.removeEventListener("mousemove",E),window.removeEventListener("mouseup",D)};window.addEventListener("mousemove",E),window.addEventListener("mouseup",D),d.current=()=>{w.setReorderDrag(null),window.removeEventListener("mousemove",E),window.removeEventListener("mouseup",D)}}},[e,t,a,s,i,l])}},Ll=({showGuides:e,positionDrag:t})=>!e&&!t?null:o.jsxs(o.Fragment,{children:[e&&o.jsx("div",{className:"absolute inset-0 pointer-events-none z-10",style:{display:"grid",gridTemplateColumns:"repeat(12, 1fr)",padding:"inherit",gap:"inherit"},children:Array.from({length:12},(r,n)=>o.jsx("div",{className:"border border-dashed border-muted-foreground/20 rounded-sm flex items-end justify-center pb-1",children:o.jsx("span",{className:"text-[8px] text-muted-foreground/40 font-mono",children:n+1})},n))}),t&&o.jsx("div",{className:"absolute pointer-events-none z-20 rounded-lg border-2 border-dashed border-destructive/60 bg-destructive/10",style:{top:"12px",bottom:"12px",left:`calc(${(t.ghostStart-1)/12*100}% + 12px)`,width:`calc(${t.ghostSpan/12*100}% - 8px)`,transition:"left 0.1s ease-out, width 0.1s ease-out"},children:o.jsxs("div",{className:"absolute -top-5 left-1/2 -translate-x-1/2 bg-destructive text-destructive-foreground text-[10px] font-bold px-2 py-0.5 rounded whitespace-nowrap",children:[t.ghostStart," →"," ",t.ghostStart+t.ghostSpan-1]})})]}),Ml=({id:e,container:t})=>{var r;const{setNodeRef:n,isOver:a}=Zt.useDroppable({id:`zone-${e}`}),{selectedId:s,setSelected:i,getConfig:l,updateConfig:c,removeItem:d,moveItem:u,moveItemNoSnapshot:m,setPositionDrag:p,positionDrag:f,reorderDrag:b,setReorderDrag:h,pushSnapshot:x,containers:y}=gt(),v=l(e),j=((r=y[e])==null?void 0:r.children)??[],w=j.filter(Y=>He(Y)==="field"),C=s===e,S=v.tamanho||12,$=(f==null?void 0:f.itemId)===e,k=(b==null?void 0:b.draggingId)===e,E=f&&j.includes(f.itemId),D=s&&j.includes(s)&&He(s)==="field",[O,L]=N.useState(!1),A="var(--t-primary, hsl(var(--primary)))",z=C?A:O?"rgba(59,130,246,0.55)":"rgba(59,130,246,0.3)",X=C?`color-mix(in srgb, ${A} 15%, transparent)`:O?"rgba(59,130,246,0.12)":"rgba(59,130,246,0.07)",q=C?`color-mix(in srgb, ${A} 30%, transparent)`:O?"rgba(59,130,246,0.28)":"rgba(59,130,246,0.18)",Z=C?`0 0 0 3px color-mix(in srgb, ${A} 20%, transparent)`:O?"0 0 0 2px rgba(59,130,246,0.25)":void 0,{resizeRef:V,resizing:M,resizePreview:P,handleResizeStart:se}=Sx({id:e,currentTamanho:S,inicioColuna:v.inicioColuna,onResize:Y=>c(e,{tamanho:Y}),pushSnapshot:x}),U=N.useMemo(()=>({kind:"custom",moveItemNoSnapshot:m,pushSnapshot:x,setReorderDrag:h,dataAttribute:"data-container-id"}),[m,x,h]),{handleGripMouseDown:Q}=JS({id:e,elementRef:V,tamanho:S,inicioColuna:v.inicioColuna||1,onPositionApply:Y=>c(e,{inicioColuna:Y}),setPositionDrag:p,setSelected:i,reorderStrategy:U});return o.jsxs(o.Fragment,{children:[o.jsxs("div",{ref:Y=>{V.current=Y},onClick:Y=>{Y.stopPropagation(),i(e)},onMouseEnter:()=>L(!0),onMouseLeave:()=>L(!1),className:Ht("relative rounded-lg border overflow-hidden transition-all",M&&"ring-2 ring-blue-400/50",$&&"opacity-0 pointer-events-none",k&&"opacity-50"),"data-container-id":e,style:{gridColumn:v.inicioColuna?`${v.inicioColuna} / span ${S}`:`span ${S}`,minWidth:"80px",borderColor:z,boxShadow:Z},children:[o.jsxs("div",{className:"flex items-center gap-1.5 border-b px-2 py-1.5 transition-colors",style:{backgroundColor:X,borderColor:q},children:[o.jsx("div",{"data-grip":!0,onMouseDown:Q,className:"cursor-grab shrink-0 p-1 -ml-1 rounded hover:bg-primary/20 transition-colors",children:o.jsx(_.GripVertical,{className:"h-3.5 w-3.5 text-blue-500"})}),o.jsxs("div",{className:"flex flex-col -my-1 shrink-0",children:[o.jsx("button",{onClick:Y=>{Y.stopPropagation(),u(e,"up")},className:"p-0 hover:bg-primary/10 rounded transition-colors",title:"Mover para cima",children:o.jsx(_.ChevronUp,{className:"h-3 w-3 text-muted-foreground hover:text-primary"})}),o.jsx("button",{onClick:Y=>{Y.stopPropagation(),u(e,"down")},className:"p-0 hover:bg-primary/10 rounded transition-colors",title:"Mover para baixo",children:o.jsx(_.ChevronDown,{className:"h-3 w-3 text-muted-foreground hover:text-primary"})})]}),o.jsx(_.BoxSelect,{className:"h-3.5 w-3.5 text-blue-500 shrink-0"}),o.jsx("span",{className:Ht("text-xs font-semibold truncate flex-1",v.showLabel===!1?"text-blue-500/50 italic":"text-blue-700 dark:text-blue-300"),children:v.label}),v.showAsCard&&o.jsx(_.SquareStack,{className:"h-3 w-3 text-blue-400 shrink-0"}),v.showLabel===!1&&o.jsx(_.EyeOff,{className:"h-3 w-3 text-muted-foreground/50 shrink-0"}),o.jsxs("span",{className:"text-[10px] text-muted-foreground shrink-0 bg-blue-500/10 px-1.5 rounded",children:[P??S,"/12"]}),o.jsx("button",{onClick:Y=>{Y.stopPropagation(),d(e)},className:"transition-opacity shrink-0 p-0.5 rounded hover:bg-destructive/10",style:{opacity:O?1:0},children:o.jsx(_.Trash2,{className:"h-3 w-3 text-destructive"})})]}),o.jsx("div",{className:"px-2 -mt-0.5 mb-0.5",children:o.jsx("span",{className:"text-[8px] text-muted-foreground/30 font-mono",children:e})}),o.jsxs("div",{ref:n,className:Ht("relative p-2 min-h-[40px] gap-1.5 transition-all duration-150",a?"bg-primary/15 ring-2 ring-inset ring-primary/50":(E||D)&&"bg-muted/30"),style:{display:"grid",gridTemplateColumns:"repeat(12, minmax(0, 1fr))",gridAutoRows:"min-content"},children:[o.jsx(Ll,{showGuides:!!E||!!D,positionDrag:E?f:null}),j.length===0&&o.jsx("p",{className:"text-[10px] text-muted-foreground/60 text-center py-2 italic",style:{gridColumn:"span 12"},children:"Arraste campos aqui"}),o.jsx(Yt.SortableContext,{items:w,strategy:Yt.rectSortingStrategy,children:j.filter(Y=>He(Y)==="field").map(Y=>l(Y).fieldType==="field_array"?o.jsx(YS,{id:Y,container:e},Y):o.jsx(ba,{id:Y,container:e},Y))})]}),o.jsx("div",{onMouseDown:se,className:"cursor-col-resize absolute right-0 top-0 bottom-0 w-2 hover:bg-blue-500/20 transition-colors flex items-center justify-center",children:o.jsx(_.GripHorizontal,{className:"h-3 w-3 text-blue-500/40 rotate-90"})})]}),$&&f&&yi.createPortal(o.jsxs("div",{style:{position:"fixed",left:f.cursorX+14,top:f.cursorY-18,zIndex:9999,pointerEvents:"none"},className:"flex items-center gap-1 bg-foreground text-background text-[10px] font-mono px-2 py-0.5 rounded shadow-xl border border-border/20",children:[o.jsx(_.BoxSelect,{className:"h-2.5 w-2.5"}),"col ",f.ghostStart,"–",f.ghostStart+f.ghostSpan-1]}),document.body)," "]})},$x=({id:e,container:t,index:r})=>{var n;const{attributes:a,listeners:s,setNodeRef:i,transform:l,transition:c,isDragging:d}=Yt.useSortable({id:e,data:{isCanvasItem:!0,type:"step",id:e}}),{setNodeRef:u,isOver:m}=Zt.useDroppable({id:`zone-${e}`}),{selectedId:p,setSelected:f,getConfig:b,removeItem:h,containers:x,positionDrag:y}=gt(),v=b(e),j=((n=x[e])==null?void 0:n.children)??[],w=p===e,C=y&&j.includes(y.itemId),[S,$]=N.useState(!1),k="var(--t-primary, hsl(var(--primary)))",E=w?k:S?`color-mix(in srgb, ${k} 60%, transparent)`:`color-mix(in srgb, ${k} 25%, transparent)`,D=w?`color-mix(in srgb, ${k} 14%, transparent)`:S?`color-mix(in srgb, ${k} 10%, transparent)`:`color-mix(in srgb, ${k} 6%, transparent)`,O=w?`color-mix(in srgb, ${k} 28%, transparent)`:`color-mix(in srgb, ${k} 15%, transparent)`,L=w?`0 0 0 3px color-mix(in srgb, ${k} 20%, transparent)`:void 0,A={transform:oa.CSS.Transform.toString(l),transition:c,opacity:d?0:1};return o.jsxs("div",{ref:i,style:{...A,borderWidth:"2px",borderStyle:"solid",borderColor:E,boxShadow:L},onMouseEnter:()=>$(!0),onMouseLeave:()=>$(!1),onClick:z=>{z.stopPropagation(),f(e)},className:"group/step rounded-xl overflow-hidden transition-all",children:[o.jsxs("div",{className:"flex items-center gap-2 border-b px-3 py-2",style:{backgroundColor:D,borderColor:O},children:[o.jsx("div",{...s,...a,className:"cursor-grab shrink-0",onClick:z=>z.stopPropagation(),children:o.jsx(_.GripVertical,{className:"h-3.5 w-3.5 text-primary"})}),o.jsx(_.Layers,{className:"h-4 w-4 text-primary shrink-0"}),o.jsxs("span",{className:"text-sm font-bold truncate flex-1 text-primary",children:["Step ",r+1," — ",v.label]}),v.description&&o.jsx("span",{className:"text-[10px] text-muted-foreground truncate hidden md:block",children:v.description}),o.jsx("button",{onClick:z=>{z.stopPropagation(),h(e)},className:"transition-opacity shrink-0 p-1 rounded hover:bg-destructive/10",style:{opacity:S?1:0},children:o.jsx(_.Trash2,{className:"h-3.5 w-3.5 text-destructive"})})]}),o.jsxs("div",{ref:u,className:Ht("relative p-3 min-h-[80px] gap-2 items-start transition-all duration-150",m?"bg-blue-500/20 ring-2 ring-inset ring-blue-400/70 shadow-[inset_0_0_0_2px_theme(colors.blue.400/50%)]":""),style:{display:"grid",gridTemplateColumns:"repeat(12, minmax(0, 1fr))",gridAutoRows:"min-content",backgroundImage:"radial-gradient(circle, hsl(var(--muted-foreground) / 0.15) 1px, transparent 1px)",backgroundSize:"16px 16px"},children:[o.jsx(Ll,{showGuides:!!C,positionDrag:C?y:null}),j.length===0&&o.jsx("p",{className:"text-xs text-muted-foreground/50 text-center py-6 italic w-full",style:{gridColumn:"span 12"},children:"Arraste containers aqui"}),j.map(z=>He(z)==="container"?o.jsx(Ml,{id:z,container:e},z):o.jsx(ba,{id:z,container:e},z))]})]})},QS=()=>{var e;const{containers:t,setSelected:r}=gt(),n=((e=t.root)==null?void 0:e.children)??[],a=n.filter(l=>He(l)==="step"),{setNodeRef:s,isOver:i}=Zt.useDroppable({id:"root"});return o.jsxs("div",{ref:s,onClick:()=>r(null),className:`min-h-[500px] rounded-xl border p-4 space-y-4 transition-all duration-150 ${i?"bg-primary/10 border-primary/60 ring-2 ring-primary/30 shadow-[0_0_0_4px_theme(colors.primary/10%)]":"border-border/40"}`,style:{backgroundImage:"radial-gradient(circle, hsl(var(--muted-foreground) / 0.12) 1px, transparent 1px)",backgroundSize:"20px 20px",backgroundColor:i?void 0:"hsl(var(--muted) / 0.3)"},children:[n.length===0&&o.jsx("div",{className:"flex items-center justify-center h-[400px]",children:o.jsxs("div",{className:"text-center space-y-2",children:[o.jsx(_.Layers,{className:"h-10 w-10 text-muted-foreground/30 mx-auto"}),o.jsxs("p",{className:"text-sm text-muted-foreground/50",children:["Arraste ",o.jsx("strong",{children:"Steps"})," da paleta para cá"]})]})}),o.jsx(Yt.SortableContext,{items:a,strategy:Yt.verticalListSortingStrategy,children:n.map((l,c)=>{const d=He(l);return d==="step"?o.jsx($x,{id:l,container:"root",index:c},l):d==="container"?o.jsx(Ml,{id:l,container:"root"},l):o.jsx(ba,{id:l,container:"root"},l)})})]})},e$={personal:"Pessoal",address:"Endereço",health:"Saúde",event:"Evento",payment:"Pagamento",emergency:"Emergência"},t$={texto:"Texto",selecao:"Seleção",range:"Numérico / Visual",data:"Data e Hora",contato:"Contato / Endereço",outros:"Arquivo / Outros"},r$=()=>{const e=Or.reduce((t,r)=>{const n=r.group??"outros";return t[n]||(t[n]=[]),t[n].push(r),t},{});return o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("h2",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Estrutura"}),vl.map(t=>o.jsx(nu,{component:t.component,label:t.label,icon:t.icon,color:t.color},t.component))]}),Object.entries(e).map(([t,r])=>o.jsx(Vs,{label:t$[t]??t,children:r.map(n=>o.jsx(nu,{component:n.component,label:n.label,icon:n.icon,color:"border-border"},n.component))},t)),o.jsx(Vs,{label:"Blocos pré-configurados",defaultOpen:!1,children:mo.map(t=>o.jsx(n$,{block:t},t.id))}),o.jsx(Vs,{label:"Blocos de steps",defaultOpen:!1,children:Ci.map(t=>o.jsx(a$,{block:t},t.id))})]})},Vs=({label:e,children:t,defaultOpen:r=!0})=>{const[n,a]=N.useState(r);return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("button",{type:"button",onClick:()=>a(s=>!s),className:"flex w-full items-center justify-between text-xs font-semibold text-muted-foreground uppercase tracking-wide hover:text-foreground transition-colors",children:[e,o.jsx(_.ChevronDown,{className:`h-3.5 w-3.5 transition-transform ${n?"":"-rotate-90"}`})]}),n&&o.jsx("div",{className:"space-y-1.5",children:t})]})},nu=({component:e,label:t,icon:r,color:n})=>{const{attributes:a,listeners:s,setNodeRef:i,transform:l,isDragging:c}=Zt.useDraggable({id:`palette-${e}`,data:{isPaletteItem:!0,componentType:e}});return o.jsxs("div",{ref:i,...s,...a,className:`cursor-grab flex items-center gap-2 rounded-lg border px-3 py-2 select-none hover:bg-accent transition-colors ${n} ${c?"opacity-50":""}`,style:{transform:c?void 0:oa.CSS.Translate.toString(l)},children:[o.jsx(_.GripVertical,{className:"h-4 w-4 text-muted-foreground"}),o.jsx(r,{className:"h-4 w-4"}),o.jsx("span",{className:"text-sm font-medium",children:t})]})},n$=({block:e})=>{const{attributes:t,listeners:r,setNodeRef:n,transform:a,isDragging:s}=Zt.useDraggable({id:`preset-${e.id}`,data:{isPalettePreset:!0,presetId:e.id}}),i=e.icon?Pt[e.icon]:void 0,l=e$[e.category]??e.category;return o.jsxs("div",{ref:n,...r,...t,className:`cursor-grab flex items-center gap-2 rounded-lg border border-primary/30 bg-primary/5 px-3 py-2 select-none hover:bg-primary/10 transition-colors ${s?"opacity-50":""}`,style:{transform:s?void 0:oa.CSS.Translate.toString(a)},title:e.description,children:[o.jsx(_.GripVertical,{className:"h-4 w-4 text-muted-foreground shrink-0"}),i?o.jsx(i,{className:"h-4 w-4 text-primary shrink-0"}):o.jsx(Pt.Blocks,{className:"h-4 w-4 text-primary shrink-0"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("span",{className:"text-sm font-medium block truncate",children:e.name}),o.jsx("span",{className:"text-[10px] text-muted-foreground",children:l})]})]})},a$=({block:e})=>{const{addPresetStepBlock:t}=gt(),r=e.icon?Pt[e.icon]:void 0;return o.jsxs("button",{type:"button",onClick:()=>t(e),className:"w-full flex items-center gap-2 rounded-lg border border-amber-500/30 bg-amber-500/5 px-3 py-2 cursor-pointer select-none hover:bg-amber-500/15 transition-colors text-left",title:e.description,children:[r?o.jsx(r,{className:"h-4 w-4 text-amber-400 shrink-0"}):o.jsx(Pt.Layers,{className:"h-4 w-4 text-amber-400 shrink-0"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("span",{className:"text-sm font-medium block truncate",children:e.name}),o.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[e.steps.length," steps"]})]}),o.jsxs("span",{className:"text-[10px] text-amber-400 border border-amber-500/30 rounded px-1.5 py-0.5 shrink-0",children:["+",e.steps.length," steps"]})]})},o$=[...vl,...Or],Ex=({data:e})=>{const{getConfig:t}=gt();if(!e)return null;const r=e;if(r.isPalettePreset){const n=ki(r.presetId);return o.jsxs("div",{className:"flex items-center gap-2 rounded-full bg-primary text-primary-foreground px-3 py-1.5 shadow-2xl text-xs font-semibold cursor-grabbing pointer-events-none",children:[o.jsx(Pt.Blocks,{className:"h-3.5 w-3.5 shrink-0"}),(n==null?void 0:n.name)??"Bloco"]})}if(r.isPaletteItem){const n=o$.find(s=>s.component===r.componentType),a=n==null?void 0:n.icon;return o.jsxs("div",{className:"flex items-center gap-2 rounded-full bg-primary text-primary-foreground px-3 py-1.5 shadow-2xl text-xs font-semibold cursor-grabbing pointer-events-none",children:[a&&o.jsx(a,{className:"h-3.5 w-3.5 shrink-0"}),(n==null?void 0:n.label)??r.componentType]})}if(r.isCanvasItem){const{type:n,id:a}=r,s=t(a),i={step:"border-primary/80 bg-primary text-primary-foreground",container:"border-blue-600 bg-blue-600 text-white",field:"border-primary/80 bg-primary text-primary-foreground"},l={step:"Step",container:"Container",field:"Campo"};return o.jsxs("div",{className:Ht("flex items-center gap-2 rounded-full px-3 py-1.5 shadow-2xl text-xs font-semibold cursor-grabbing pointer-events-none min-w-[100px] max-w-[200px]",i[n]??"border-border bg-card"),children:[o.jsx(_.GripVertical,{className:"h-3 w-3 opacity-60 shrink-0"}),o.jsxs("span",{className:"opacity-70 shrink-0",children:[l[n]??n,":"]}),o.jsx("span",{className:"truncate",children:s.label||a})]})}return null},Dx=({schema:e,children:t,uploadTermsPdf:r,deleteTermsPdf:n})=>{var a;const s=N.useMemo(()=>{var i;return(i=e==null?void 0:e.steps)!=null&&i.length?Eh(e):null},[e]);return o.jsx(C1,{children:o.jsx(Rh,{initialConfigs:s==null?void 0:s.configs,initialContainers:(a=s==null?void 0:s.dndState)==null?void 0:a.containers,initialTemplateId:(s==null?void 0:s.templateId)??void 0,initialStepConfig:s==null?void 0:s.stepConfig,schemaId:(e==null?void 0:e.id)??void 0,uploadTermsPdf:r,deleteTermsPdf:n,children:t})})},Tx=({children:e,onError:t})=>{const{containers:r,addItem:n,addPresetBlock:a,moveCanvasItem:s,reorderInContainer:i}=gt(),l=Zt.useSensors(Zt.useSensor(Zt.PointerSensor,{activationConstraint:{distance:5}})),[c,d]=N.useState(null);return o.jsxs(Zt.DndContext,{sensors:l,onDragStart:u=>{d({data:u.active.data.current})},onDragEnd:u=>{var m,p,f,b,h;d(null);const{active:x,over:y}=u;if(!y)return;const v=x.data.current,j=String(y.id);if(v!=null&&v.isPalettePreset){const{presetId:w}=v,C=ki(w);if(!C)return;if(j.startsWith("zone-")){const S=j.slice(5);a(C,S)}else j==="root"&&(t==null||t("Arraste o bloco sobre um step existente."));return}if(v!=null&&v.isPaletteItem){const{componentType:w}=v;j==="root"?n(w,"root"):j.startsWith("zone-")&&n(w,j.slice(5));return}if(v!=null&&v.isCanvasItem){const{type:w,id:C}=v;if(w==="step"){const S=((m=r.root)==null?void 0:m.children)??[],$=S.indexOf(C),k=S.indexOf(j);$!==-1&&k!==-1&&$!==k&&i("root",Yt.arrayMove(S,$,k));return}if(w==="field"){const S=v.fromContainer;let $=S,k=null;if(j.startsWith("zone-"))$=j.slice(5);else{const E=wl(j,r);E&&($=E,k=j)}if($===S&&k){const E=((p=r[S])==null?void 0:p.children)??[],D=E.indexOf(C),O=E.indexOf(k);D!==-1&&O!==-1&&D!==O&&i(S,Yt.arrayMove(E,D,O))}else if($!==S){const E=k?(((f=r[$])==null?void 0:f.children)??[]).indexOf(k):-1;s(C,S,$,E>=0?E:((h=(b=r[$])==null?void 0:b.children)==null?void 0:h.length)??0)}}}},children:[e,o.jsx(Zt.DragOverlay,{dropAnimation:null,children:c?o.jsx(Ex,{data:c.data}):null})]})},s$=({schema:e,children:t,onError:r,uploadTermsPdf:n,deleteTermsPdf:a})=>o.jsx(Dx,{schema:e,uploadTermsPdf:n,deleteTermsPdf:a,children:o.jsx(Tx,{onError:r,children:t})});exports.BuilderDndContext=Tx;exports.BuilderProvider=Rh;exports.BuilderShell=s$;exports.BuilderWrapper=Dx;exports.Canvas=QS;exports.ConfigPanel=oN;exports.ContainerRenderer=yh;exports.DFCepField=gl;exports.DFCheckbox=Wo;exports.DFCheckboxGroup=ul;exports.DFDateField=Rn;exports.DFFieldArray=uh;exports.DFFileUpload=xl;exports.DFHidden=Go;exports.DFMaskedInput=_r;exports.DFParticipationType=mh;exports.DFPaymentMethod=hh;exports.DFRadioGroup=ml;exports.DFSelect=Ho;exports.DFTerms=xh;exports.DFTextField=Tt;exports.DFTextarea=Uo;exports.DefaultStepIndicator=Ch;exports.DragGhost=Ex;exports.DroppedContainer=Ml;exports.DroppedField=ba;exports.DroppedStep=$x;exports.EVENT_VARIABLES=bl;exports.FIELD_TYPES=Or;exports.FIELD_TYPE_ICONS=Bx;exports.FIELD_TYPE_LABELS=Vx;exports.FieldType=T;exports.FormRenderer=Hk;exports.FormSchemaStatus=ji;exports.FormSpy=Wk;exports.GridOverlay=Ll;exports.LivePreview=ZS;exports.MaskType=au;exports.OPCOES_POR_DIA=ph;exports.OPCOES_TODOS_OS_DIAS=fh;exports.PRESET_BLOCKS=mo;exports.PRESET_STEP_BLOCKS=Ci;exports.Palette=r$;exports.RendererContext=Ja;exports.STRUCTURE_TYPES=vl;exports.StepRenderer=wh;exports.TEMPLATE_REGISTRY=Kr;exports.TemplateProvider=ea;exports.builderToFormSchema=yl;exports.evaluateFieldCondition=at;exports.findParentContainer=wl;exports.formSchemaToBuilder=Eh;exports.generateId=ou;exports.getAllTemplates=ag;exports.getFieldMeta=qk;exports.getFieldMetaById=Nh;exports.getItemType=He;exports.getPresetById=ki;exports.getPresetStepBlockById=cg;exports.getPresetsByCategory=lg;exports.getTemplateConfig=uo;exports.interpolate=xt;exports.interpolateContainer=Bo;exports.interpolateField=th;exports.interpolateStep=rh;exports.isDarkTemplate=su;exports.isGlassmorphism=og;exports.makeStepResolver=Qf;exports.makeStepWarnComputer=eh;exports.useBuilder=gt;exports.useBuilderExport=Xk;exports.useField=zk;exports.useFieldApi=Lk;exports.useFormApi=Fk;exports.useFormState=jh;exports.useRendererContext=Nr;exports.useTemplate=sa;exports.v4Fallback=St;exports.validateBuilderIntegrity=Dh;
|
|
79
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return g.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},Ww="DialogDescriptionWarning",qw=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${mf(Ww).contentName}}.`;return g.useEffect(()=>{var n;const a=(n=e.current)==null?void 0:n.getAttribute("aria-describedby");t&&a&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},Gw=Jp,Xw=tf,pf=rf,ff=nf,hf=of,xf=lf,Zw=df;const Kw=Gw,Yw=Xw,gf=g.forwardRef(({className:e,...t},r)=>o.jsx(pf,{ref:r,className:K("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));gf.displayName=pf.displayName;const vf=g.forwardRef(({className:e,children:t,...r},n)=>o.jsxs(Yw,{children:[o.jsx(gf,{}),o.jsxs(ff,{ref:n,className:K("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...r,children:[t,o.jsxs(Zw,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[o.jsx(I.X,{className:"h-4 w-4"}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));vf.displayName=ff.displayName;const bf=({className:e,...t})=>o.jsx("div",{className:K("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});bf.displayName="DialogHeader";const yf=g.forwardRef(({className:e,...t},r)=>o.jsx(hf,{ref:r,className:K("text-lg font-semibold leading-none tracking-tight",e),...t}));yf.displayName=hf.displayName;const wf=g.forwardRef(({className:e,...t},r)=>o.jsx(xf,{ref:r,className:K("text-sm text-muted-foreground",e),...t}));wf.displayName=xf.displayName;var Eo="Popover",[jf]=_t(Eo,[_n]),ca=_n(),[Jw,Vr]=jf(Eo),kf=e=>{const{__scopePopover:t,children:r,open:n,defaultOpen:a,onOpenChange:s,modal:i=!1}=e,l=ca(t),c=g.useRef(null),[d,u]=g.useState(!1),[m,p]=cr({prop:n,defaultProp:a??!1,onChange:s,caller:Eo});return o.jsx(Hi,{...l,children:o.jsx(Jw,{scope:t,contentId:yr(),triggerRef:c,open:m,onOpenChange:p,onOpenToggle:g.useCallback(()=>p(f=>!f),[p]),hasCustomAnchor:d,onCustomAnchorAdd:g.useCallback(()=>u(!0),[]),onCustomAnchorRemove:g.useCallback(()=>u(!1),[]),modal:i,children:r})})};kf.displayName=Eo;var Cf="PopoverAnchor",Qw=g.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,a=Vr(Cf,r),s=ca(r),{onCustomAnchorAdd:i,onCustomAnchorRemove:l}=a;return g.useEffect(()=>(i(),()=>l()),[i,l]),o.jsx(vo,{...s,...n,ref:t})});Qw.displayName=Cf;var Nf="PopoverTrigger",Sf=g.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,a=Vr(Nf,r),s=ca(r),i=ke(t,a.triggerRef),l=o.jsx(we.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":Df(a.open),...n,ref:i,onClick:ge(e.onClick,a.onOpenToggle)});return a.hasCustomAnchor?l:o.jsx(vo,{asChild:!0,...s,children:l})});Sf.displayName=Nf;var rl="PopoverPortal",[e1,t1]=jf(rl,{forceMount:void 0}),$f=e=>{const{__scopePopover:t,forceMount:r,children:n,container:a}=e,s=Vr(rl,t);return o.jsx(e1,{scope:t,forceMount:r,children:o.jsx(It,{present:r||s.open,children:o.jsx(bo,{asChild:!0,container:a,children:n})})})};$f.displayName=rl;var Sn="PopoverContent",Ef=g.forwardRef((e,t)=>{const r=t1(Sn,e.__scopePopover),{forceMount:n=r.forceMount,...a}=e,s=Vr(Sn,e.__scopePopover);return o.jsx(It,{present:n||s.open,children:s.modal?o.jsx(n1,{...a,ref:t}):o.jsx(a1,{...a,ref:t})})});Ef.displayName=Sn;var r1=Cn("PopoverContent.RemoveScroll"),n1=g.forwardRef((e,t)=>{const r=Vr(Sn,e.__scopePopover),n=g.useRef(null),a=ke(t,n),s=g.useRef(!1);return g.useEffect(()=>{const i=n.current;if(i)return Gi(i)},[]),o.jsx(wo,{as:r1,allowPinchZoom:!0,children:o.jsx(Tf,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ge(e.onCloseAutoFocus,i=>{var l;i.preventDefault(),s.current||(l=r.triggerRef.current)==null||l.focus()}),onPointerDownOutside:ge(e.onPointerDownOutside,i=>{const l=i.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,d=l.button===2||c;s.current=d},{checkForDefaultPrevented:!1}),onFocusOutside:ge(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1})})})}),a1=g.forwardRef((e,t)=>{const r=Vr(Sn,e.__scopePopover),n=g.useRef(!1),a=g.useRef(!1);return o.jsx(Tf,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var i,l;(i=e.onCloseAutoFocus)==null||i.call(e,s),s.defaultPrevented||(n.current||(l=r.triggerRef.current)==null||l.focus(),s.preventDefault()),n.current=!1,a.current=!1},onInteractOutside:s=>{var i,l;(i=e.onInteractOutside)==null||i.call(e,s),s.defaultPrevented||(n.current=!0,s.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const c=s.target;(l=r.triggerRef.current)!=null&&l.contains(c)&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&a.current&&s.preventDefault()}})}),Tf=g.forwardRef((e,t)=>{const{__scopePopover:r,trapFocus:n,onOpenAutoFocus:a,onCloseAutoFocus:s,disableOutsidePointerEvents:i,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:u,...m}=e,p=Vr(Sn,r),f=ca(r);return Ii(),o.jsx(po,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:a,onUnmountAutoFocus:s,children:o.jsx(ia,{asChild:!0,disableOutsidePointerEvents:i,onInteractOutside:u,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onDismiss:()=>p.onOpenChange(!1),children:o.jsx(Wi,{"data-state":Df(p.open),role:"dialog",id:p.contentId,...f,...m,ref:t,style:{...m.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),Af="PopoverClose",o1=g.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,a=Vr(Af,r);return o.jsx(we.button,{type:"button",...n,ref:t,onClick:ge(e.onClick,()=>a.onOpenChange(!1))})});o1.displayName=Af;var s1="PopoverArrow",i1=g.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,a=ca(r);return o.jsx(qi,{...a,...n,ref:t})});i1.displayName=s1;function Df(e){return e?"open":"closed"}var l1=kf,c1=Sf,d1=$f,Rf=Ef;const To=l1,Ao=c1,da=g.forwardRef(({className:e,align:t="center",sideOffset:r=4,...n},a)=>o.jsx(d1,{children:o.jsx(Rf,{ref:a,align:t,sideOffset:r,className:K("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));da.displayName=Rf.displayName;var[Do]=_t("Tooltip",[_n]),Ro=_n(),Pf="TooltipProvider",u1=700,ti="tooltip.open",[m1,nl]=Do(Pf),_f=e=>{const{__scopeTooltip:t,delayDuration:r=u1,skipDelayDuration:n=300,disableHoverableContent:a=!1,children:s}=e,i=g.useRef(!0),l=g.useRef(!1),c=g.useRef(0);return g.useEffect(()=>{const d=c.current;return()=>window.clearTimeout(d)},[]),o.jsx(m1,{scope:t,isOpenDelayedRef:i,delayDuration:r,onOpen:g.useCallback(()=>{window.clearTimeout(c.current),i.current=!1},[]),onClose:g.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>i.current=!0,n)},[n]),isPointerInTransitRef:l,onPointerInTransitChange:g.useCallback(d=>{l.current=d},[]),disableHoverableContent:a,children:s})};_f.displayName=Pf;var Qn="Tooltip",[p1,Po]=Do(Qn),If=e=>{const{__scopeTooltip:t,children:r,open:n,defaultOpen:a,onOpenChange:s,disableHoverableContent:i,delayDuration:l}=e,c=nl(Qn,e.__scopeTooltip),d=Ro(t),[u,m]=g.useState(null),p=yr(),f=g.useRef(0),v=i??c.disableHoverableContent,h=l??c.delayDuration,x=g.useRef(!1),[b,y]=cr({prop:n,defaultProp:a??!1,onChange:$=>{$?(c.onOpen(),document.dispatchEvent(new CustomEvent(ti))):c.onClose(),s==null||s($)},caller:Qn}),j=g.useMemo(()=>b?x.current?"delayed-open":"instant-open":"closed",[b]),w=g.useCallback(()=>{window.clearTimeout(f.current),f.current=0,x.current=!1,y(!0)},[y]),C=g.useCallback(()=>{window.clearTimeout(f.current),f.current=0,y(!1)},[y]),S=g.useCallback(()=>{window.clearTimeout(f.current),f.current=window.setTimeout(()=>{x.current=!0,y(!0),f.current=0},h)},[h,y]);return g.useEffect(()=>()=>{f.current&&(window.clearTimeout(f.current),f.current=0)},[]),o.jsx(Hi,{...d,children:o.jsx(p1,{scope:t,contentId:p,open:b,stateAttribute:j,trigger:u,onTriggerChange:m,onTriggerEnter:g.useCallback(()=>{c.isOpenDelayedRef.current?S():w()},[c.isOpenDelayedRef,S,w]),onTriggerLeave:g.useCallback(()=>{v?C():(window.clearTimeout(f.current),f.current=0)},[C,v]),onOpen:w,onClose:C,disableHoverableContent:v,children:r})})};If.displayName=Qn;var ri="TooltipTrigger",Of=g.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,a=Po(ri,r),s=nl(ri,r),i=Ro(r),l=g.useRef(null),c=ke(t,l,a.onTriggerChange),d=g.useRef(!1),u=g.useRef(!1),m=g.useCallback(()=>d.current=!1,[]);return g.useEffect(()=>()=>document.removeEventListener("pointerup",m),[m]),o.jsx(vo,{asChild:!0,...i,children:o.jsx(we.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...n,ref:c,onPointerMove:ge(e.onPointerMove,p=>{p.pointerType!=="touch"&&!u.current&&!s.isPointerInTransitRef.current&&(a.onTriggerEnter(),u.current=!0)}),onPointerLeave:ge(e.onPointerLeave,()=>{a.onTriggerLeave(),u.current=!1}),onPointerDown:ge(e.onPointerDown,()=>{a.open&&a.onClose(),d.current=!0,document.addEventListener("pointerup",m,{once:!0})}),onFocus:ge(e.onFocus,()=>{d.current||a.onOpen()}),onBlur:ge(e.onBlur,a.onClose),onClick:ge(e.onClick,a.onClose)})})});Of.displayName=ri;var f1="TooltipPortal",[t$,h1]=Do(f1,{forceMount:void 0}),$n="TooltipContent",Ff=g.forwardRef((e,t)=>{const r=h1($n,e.__scopeTooltip),{forceMount:n=r.forceMount,side:a="top",...s}=e,i=Po($n,e.__scopeTooltip);return o.jsx(It,{present:n||i.open,children:i.disableHoverableContent?o.jsx(zf,{side:a,...s,ref:t}):o.jsx(x1,{side:a,...s,ref:t})})}),x1=g.forwardRef((e,t)=>{const r=Po($n,e.__scopeTooltip),n=nl($n,e.__scopeTooltip),a=g.useRef(null),s=ke(t,a),[i,l]=g.useState(null),{trigger:c,onClose:d}=r,u=a.current,{onPointerInTransitChange:m}=n,p=g.useCallback(()=>{l(null),m(!1)},[m]),f=g.useCallback((v,h)=>{const x=v.currentTarget,b={x:v.clientX,y:v.clientY},y=w1(b,x.getBoundingClientRect()),j=j1(b,y),w=k1(h.getBoundingClientRect()),C=N1([...j,...w]);l(C),m(!0)},[m]);return g.useEffect(()=>()=>p(),[p]),g.useEffect(()=>{if(c&&u){const v=x=>f(x,u),h=x=>f(x,c);return c.addEventListener("pointerleave",v),u.addEventListener("pointerleave",h),()=>{c.removeEventListener("pointerleave",v),u.removeEventListener("pointerleave",h)}}},[c,u,f,p]),g.useEffect(()=>{if(i){const v=h=>{const x=h.target,b={x:h.clientX,y:h.clientY},y=(c==null?void 0:c.contains(x))||(u==null?void 0:u.contains(x)),j=!C1(b,i);y?p():j&&(p(),d())};return document.addEventListener("pointermove",v),()=>document.removeEventListener("pointermove",v)}},[c,u,i,d,p]),o.jsx(zf,{...e,ref:s})}),[g1,v1]=Do(Qn,{isInside:!1}),b1=Dv("TooltipContent"),zf=g.forwardRef((e,t)=>{const{__scopeTooltip:r,children:n,"aria-label":a,onEscapeKeyDown:s,onPointerDownOutside:i,...l}=e,c=Po($n,r),d=Ro(r),{onClose:u}=c;return g.useEffect(()=>(document.addEventListener(ti,u),()=>document.removeEventListener(ti,u)),[u]),g.useEffect(()=>{if(c.trigger){const m=p=>{const f=p.target;f!=null&&f.contains(c.trigger)&&u()};return window.addEventListener("scroll",m,{capture:!0}),()=>window.removeEventListener("scroll",m,{capture:!0})}},[c.trigger,u]),o.jsx(ia,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:m=>m.preventDefault(),onDismiss:u,children:o.jsxs(Wi,{"data-state":c.stateAttribute,...d,...l,ref:t,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[o.jsx(b1,{children:n}),o.jsx(g1,{scope:r,isInside:!0,children:o.jsx(qy,{id:c.contentId,role:"tooltip",children:a||n})})]})})});Ff.displayName=$n;var Lf="TooltipArrow",y1=g.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,a=Ro(r);return v1(Lf,r).isInside?null:o.jsx(qi,{...a,...n,ref:t})});y1.displayName=Lf;function w1(e,t){const r=Math.abs(t.top-e.y),n=Math.abs(t.bottom-e.y),a=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(r,n,a,s)){case s:return"left";case a:return"right";case r:return"top";case n:return"bottom";default:throw new Error("unreachable")}}function j1(e,t,r=5){const n=[];switch(t){case"top":n.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":n.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":n.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":n.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r});break}return n}function k1(e){const{top:t,right:r,bottom:n,left:a}=e;return[{x:a,y:t},{x:r,y:t},{x:r,y:n},{x:a,y:n}]}function C1(e,t){const{x:r,y:n}=e;let a=!1;for(let s=0,i=t.length-1;s<t.length;i=s++){const l=t[s],c=t[i],d=l.x,u=l.y,m=c.x,p=c.y;u>n!=p>n&&r<(m-d)*(n-u)/(p-u)+d&&(a=!a)}return a}function N1(e){const t=e.slice();return t.sort((r,n)=>r.x<n.x?-1:r.x>n.x?1:r.y<n.y?-1:r.y>n.y?1:0),S1(t)}function S1(e){if(e.length<=1)return e.slice();const t=[];for(let n=0;n<e.length;n++){const a=e[n];for(;t.length>=2;){const s=t[t.length-1],i=t[t.length-2];if((s.x-i.x)*(a.y-i.y)>=(s.y-i.y)*(a.x-i.x))t.pop();else break}t.push(a)}t.pop();const r=[];for(let n=e.length-1;n>=0;n--){const a=e[n];for(;r.length>=2;){const s=r[r.length-1],i=r[r.length-2];if((s.x-i.x)*(a.y-i.y)>=(s.y-i.y)*(a.x-i.x))r.pop();else break}r.push(a)}return r.pop(),t.length===1&&r.length===1&&t[0].x===r[0].x&&t[0].y===r[0].y?t:t.concat(r)}var $1=_f,E1=If,T1=Of,Mf=Ff;const A1=$1,Vf=E1,Bf=T1,al=g.forwardRef(({className:e,sideOffset:t=4,...r},n)=>o.jsx(Mf,{ref:n,sideOffset:t,className:K("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r}));al.displayName=Mf.displayName;function D1(e,t){return g.useReducer((r,n)=>t[r][n]??r,e)}var ol="ScrollArea",[Uf]=_t(ol),[R1,Ht]=Uf(ol),Hf=g.forwardRef((e,t)=>{const{__scopeScrollArea:r,type:n="hover",dir:a,scrollHideDelay:s=600,...i}=e,[l,c]=g.useState(null),[d,u]=g.useState(null),[m,p]=g.useState(null),[f,v]=g.useState(null),[h,x]=g.useState(null),[b,y]=g.useState(0),[j,w]=g.useState(0),[C,S]=g.useState(!1),[$,k]=g.useState(!1),E=ke(t,O=>c(O)),T=oa(a);return o.jsx(R1,{scope:r,type:n,dir:T,scrollHideDelay:s,scrollArea:l,viewport:d,onViewportChange:u,content:m,onContentChange:p,scrollbarX:f,onScrollbarXChange:v,scrollbarXEnabled:C,onScrollbarXEnabledChange:S,scrollbarY:h,onScrollbarYChange:x,scrollbarYEnabled:$,onScrollbarYEnabledChange:k,onCornerWidthChange:y,onCornerHeightChange:w,children:o.jsx(we.div,{dir:T,...i,ref:E,style:{position:"relative","--radix-scroll-area-corner-width":b+"px","--radix-scroll-area-corner-height":j+"px",...e.style}})})});Hf.displayName=ol;var Wf="ScrollAreaViewport",qf=g.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:n,nonce:a,...s}=e,i=Ht(Wf,r),l=g.useRef(null),c=ke(t,l,i.onViewportChange);return o.jsxs(o.Fragment,{children:[o.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:a}),o.jsx(we.div,{"data-radix-scroll-area-viewport":"",...s,ref:c,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...e.style},children:o.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});qf.displayName=Wf;var pr="ScrollAreaScrollbar",sl=g.forwardRef((e,t)=>{const{forceMount:r,...n}=e,a=Ht(pr,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:i}=a,l=e.orientation==="horizontal";return g.useEffect(()=>(l?s(!0):i(!0),()=>{l?s(!1):i(!1)}),[l,s,i]),a.type==="hover"?o.jsx(P1,{...n,ref:t,forceMount:r}):a.type==="scroll"?o.jsx(_1,{...n,ref:t,forceMount:r}):a.type==="auto"?o.jsx(Gf,{...n,ref:t,forceMount:r}):a.type==="always"?o.jsx(il,{...n,ref:t}):null});sl.displayName=pr;var P1=g.forwardRef((e,t)=>{const{forceMount:r,...n}=e,a=Ht(pr,e.__scopeScrollArea),[s,i]=g.useState(!1);return g.useEffect(()=>{const l=a.scrollArea;let c=0;if(l){const d=()=>{window.clearTimeout(c),i(!0)},u=()=>{c=window.setTimeout(()=>i(!1),a.scrollHideDelay)};return l.addEventListener("pointerenter",d),l.addEventListener("pointerleave",u),()=>{window.clearTimeout(c),l.removeEventListener("pointerenter",d),l.removeEventListener("pointerleave",u)}}},[a.scrollArea,a.scrollHideDelay]),o.jsx(It,{present:r||s,children:o.jsx(Gf,{"data-state":s?"visible":"hidden",...n,ref:t})})}),_1=g.forwardRef((e,t)=>{const{forceMount:r,...n}=e,a=Ht(pr,e.__scopeScrollArea),s=e.orientation==="horizontal",i=Io(()=>c("SCROLL_END"),100),[l,c]=D1("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return g.useEffect(()=>{if(l==="idle"){const d=window.setTimeout(()=>c("HIDE"),a.scrollHideDelay);return()=>window.clearTimeout(d)}},[l,a.scrollHideDelay,c]),g.useEffect(()=>{const d=a.viewport,u=s?"scrollLeft":"scrollTop";if(d){let m=d[u];const p=()=>{const f=d[u];m!==f&&(c("SCROLL"),i()),m=f};return d.addEventListener("scroll",p),()=>d.removeEventListener("scroll",p)}},[a.viewport,s,c,i]),o.jsx(It,{present:r||l!=="hidden",children:o.jsx(il,{"data-state":l==="hidden"?"hidden":"visible",...n,ref:t,onPointerEnter:ge(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:ge(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),Gf=g.forwardRef((e,t)=>{const r=Ht(pr,e.__scopeScrollArea),{forceMount:n,...a}=e,[s,i]=g.useState(!1),l=e.orientation==="horizontal",c=Io(()=>{if(r.viewport){const d=r.viewport.offsetWidth<r.viewport.scrollWidth,u=r.viewport.offsetHeight<r.viewport.scrollHeight;i(l?d:u)}},10);return En(r.viewport,c),En(r.content,c),o.jsx(It,{present:n||s,children:o.jsx(il,{"data-state":s?"visible":"hidden",...a,ref:t})})}),il=g.forwardRef((e,t)=>{const{orientation:r="vertical",...n}=e,a=Ht(pr,e.__scopeScrollArea),s=g.useRef(null),i=g.useRef(0),[l,c]=g.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),d=Jf(l.viewport,l.content),u={...n,sizes:l,onSizesChange:c,hasThumb:d>0&&d<1,onThumbChange:p=>s.current=p,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:p=>i.current=p};function m(p,f){return M1(p,i.current,l,f)}return r==="horizontal"?o.jsx(I1,{...u,ref:t,onThumbPositionChange:()=>{if(a.viewport&&s.current){const p=a.viewport.scrollLeft,f=Dc(p,l,a.dir);s.current.style.transform=`translate3d(${f}px, 0, 0)`}},onWheelScroll:p=>{a.viewport&&(a.viewport.scrollLeft=p)},onDragScroll:p=>{a.viewport&&(a.viewport.scrollLeft=m(p,a.dir))}}):r==="vertical"?o.jsx(O1,{...u,ref:t,onThumbPositionChange:()=>{if(a.viewport&&s.current){const p=a.viewport.scrollTop,f=Dc(p,l);s.current.style.transform=`translate3d(0, ${f}px, 0)`}},onWheelScroll:p=>{a.viewport&&(a.viewport.scrollTop=p)},onDragScroll:p=>{a.viewport&&(a.viewport.scrollTop=m(p))}}):null}),I1=g.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...a}=e,s=Ht(pr,e.__scopeScrollArea),[i,l]=g.useState(),c=g.useRef(null),d=ke(t,c,s.onScrollbarXChange);return g.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),o.jsx(Zf,{"data-orientation":"horizontal",...a,ref:d,sizes:r,style:{bottom:0,left:s.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:s.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":_o(r)+"px",...e.style},onThumbPointerDown:u=>e.onThumbPointerDown(u.x),onDragScroll:u=>e.onDragScroll(u.x),onWheelScroll:(u,m)=>{if(s.viewport){const p=s.viewport.scrollLeft+u.deltaX;e.onWheelScroll(p),eh(p,m)&&u.preventDefault()}},onResize:()=>{c.current&&s.viewport&&i&&n({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:qa(i.paddingLeft),paddingEnd:qa(i.paddingRight)}})}})}),O1=g.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...a}=e,s=Ht(pr,e.__scopeScrollArea),[i,l]=g.useState(),c=g.useRef(null),d=ke(t,c,s.onScrollbarYChange);return g.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),o.jsx(Zf,{"data-orientation":"vertical",...a,ref:d,sizes:r,style:{top:0,right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":_o(r)+"px",...e.style},onThumbPointerDown:u=>e.onThumbPointerDown(u.y),onDragScroll:u=>e.onDragScroll(u.y),onWheelScroll:(u,m)=>{if(s.viewport){const p=s.viewport.scrollTop+u.deltaY;e.onWheelScroll(p),eh(p,m)&&u.preventDefault()}},onResize:()=>{c.current&&s.viewport&&i&&n({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:qa(i.paddingTop),paddingEnd:qa(i.paddingBottom)}})}})}),[F1,Xf]=Uf(pr),Zf=g.forwardRef((e,t)=>{const{__scopeScrollArea:r,sizes:n,hasThumb:a,onThumbChange:s,onThumbPointerUp:i,onThumbPointerDown:l,onThumbPositionChange:c,onDragScroll:d,onWheelScroll:u,onResize:m,...p}=e,f=Ht(pr,r),[v,h]=g.useState(null),x=ke(t,E=>h(E)),b=g.useRef(null),y=g.useRef(""),j=f.viewport,w=n.content-n.viewport,C=ft(u),S=ft(c),$=Io(m,10);function k(E){if(b.current){const T=E.clientX-b.current.left,O=E.clientY-b.current.top;d({x:T,y:O})}}return g.useEffect(()=>{const E=T=>{const O=T.target;v!=null&&v.contains(O)&&C(T,w)};return document.addEventListener("wheel",E,{passive:!1}),()=>document.removeEventListener("wheel",E,{passive:!1})},[j,v,w,C]),g.useEffect(S,[n,S]),En(v,$),En(f.content,$),o.jsx(F1,{scope:r,scrollbar:v,hasThumb:a,onThumbChange:ft(s),onThumbPointerUp:ft(i),onThumbPositionChange:S,onThumbPointerDown:ft(l),children:o.jsx(we.div,{...p,ref:x,style:{position:"absolute",...p.style},onPointerDown:ge(e.onPointerDown,E=>{E.button===0&&(E.target.setPointerCapture(E.pointerId),b.current=v.getBoundingClientRect(),y.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",f.viewport&&(f.viewport.style.scrollBehavior="auto"),k(E))}),onPointerMove:ge(e.onPointerMove,k),onPointerUp:ge(e.onPointerUp,E=>{const T=E.target;T.hasPointerCapture(E.pointerId)&&T.releasePointerCapture(E.pointerId),document.body.style.webkitUserSelect=y.current,f.viewport&&(f.viewport.style.scrollBehavior=""),b.current=null})})})}),Wa="ScrollAreaThumb",Kf=g.forwardRef((e,t)=>{const{forceMount:r,...n}=e,a=Xf(Wa,e.__scopeScrollArea);return o.jsx(It,{present:r||a.hasThumb,children:o.jsx(z1,{ref:t,...n})})}),z1=g.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:n,...a}=e,s=Ht(Wa,r),i=Xf(Wa,r),{onThumbPositionChange:l}=i,c=ke(t,m=>i.onThumbChange(m)),d=g.useRef(void 0),u=Io(()=>{d.current&&(d.current(),d.current=void 0)},100);return g.useEffect(()=>{const m=s.viewport;if(m){const p=()=>{if(u(),!d.current){const f=V1(m,l);d.current=f,l()}};return l(),m.addEventListener("scroll",p),()=>m.removeEventListener("scroll",p)}},[s.viewport,u,l]),o.jsx(we.div,{"data-state":i.hasThumb?"visible":"hidden",...a,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:ge(e.onPointerDownCapture,m=>{const p=m.target.getBoundingClientRect(),f=m.clientX-p.left,v=m.clientY-p.top;i.onThumbPointerDown({x:f,y:v})}),onPointerUp:ge(e.onPointerUp,i.onThumbPointerUp)})});Kf.displayName=Wa;var ll="ScrollAreaCorner",Yf=g.forwardRef((e,t)=>{const r=Ht(ll,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?o.jsx(L1,{...e,ref:t}):null});Yf.displayName=ll;var L1=g.forwardRef((e,t)=>{const{__scopeScrollArea:r,...n}=e,a=Ht(ll,r),[s,i]=g.useState(0),[l,c]=g.useState(0),d=!!(s&&l);return En(a.scrollbarX,()=>{var u;const m=((u=a.scrollbarX)==null?void 0:u.offsetHeight)||0;a.onCornerHeightChange(m),c(m)}),En(a.scrollbarY,()=>{var u;const m=((u=a.scrollbarY)==null?void 0:u.offsetWidth)||0;a.onCornerWidthChange(m),i(m)}),d?o.jsx(we.div,{...n,ref:t,style:{width:s,height:l,position:"absolute",right:a.dir==="ltr"?0:void 0,left:a.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function qa(e){return e?parseInt(e,10):0}function Jf(e,t){const r=e/t;return isNaN(r)?0:r}function _o(e){const t=Jf(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function M1(e,t,r,n="ltr"){const a=_o(r),s=a/2,i=t||s,l=a-i,c=r.scrollbar.paddingStart+i,d=r.scrollbar.size-r.scrollbar.paddingEnd-l,u=r.content-r.viewport,m=n==="ltr"?[0,u]:[u*-1,0];return Qf([c,d],m)(e)}function Dc(e,t,r="ltr"){const n=_o(t),a=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=t.scrollbar.size-a,i=t.content-t.viewport,l=s-n,c=r==="ltr"?[0,i]:[i*-1,0],d=Yn(e,c);return Qf([0,i],[0,l])(d)}function Qf(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}function eh(e,t){return e>0&&e<t}var V1=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return function a(){const s={left:e.scrollLeft,top:e.scrollTop},i=r.left!==s.left,l=r.top!==s.top;(i||l)&&t(),r=s,n=window.requestAnimationFrame(a)}(),()=>window.cancelAnimationFrame(n)};function Io(e,t){const r=ft(e),n=g.useRef(0);return g.useEffect(()=>()=>window.clearTimeout(n.current),[]),g.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function En(e,t){const r=ft(t);lt(()=>{let n=0;if(e){const a=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(r)});return a.observe(e),()=>{window.cancelAnimationFrame(n),a.unobserve(e)}}},[e,r])}var th=Hf,B1=qf,U1=Yf;const Oo=g.forwardRef(({className:e,children:t,...r},n)=>o.jsxs(th,{ref:n,className:K("relative overflow-hidden",e),...r,children:[o.jsx(B1,{className:"h-full w-full rounded-[inherit]",children:t}),o.jsx(rh,{}),o.jsx(U1,{})]}));Oo.displayName=th.displayName;const rh=g.forwardRef(({className:e,orientation:t="vertical",...r},n)=>o.jsx(sl,{ref:n,orientation:t,className:K("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...r,children:o.jsx(Kf,{className:"relative flex-1 rounded-full bg-border"})}));rh.displayName=sl.displayName;const Rc=Object.entries(I.icons).map(([e,t])=>({name:e,kebab:e.replace(/([A-Z])/g,(r,n,a)=>a===0?n.toLowerCase():`-${n.toLowerCase()}`),component:t})),nh=({value:e,onChange:t,label:r="Ícone (Lucide)",hideLabel:n=!1,className:a})=>{const[s,i]=N.useState(!1),[l,c]=N.useState(""),d=N.useMemo(()=>ov(e),[e]),u=N.useMemo(()=>{const f=l.toLowerCase();return f?Rc.filter(v=>v.name.toLowerCase().includes(f)||v.kebab.includes(f)):Rc},[l]),m=f=>{t(f),i(!1)},p=f=>{i(f),f||c("")};return o.jsxs("div",{className:`space-y-1 ${a??""}`,children:[!n&&o.jsx(ie,{className:"text-xs",children:r}),o.jsx(Ae,{type:"button",variant:"outline",className:"w-full h-8 justify-start text-xs font-normal gap-2",onClick:()=>i(!0),children:d?o.jsxs(o.Fragment,{children:[N.createElement(d,{className:"h-3.5 w-3.5 shrink-0"}),o.jsx("span",{className:"truncate",children:e})]}):o.jsx("span",{className:"text-muted-foreground",children:"Selecionar ícone…"})}),o.jsx(Kw,{open:s,onOpenChange:p,children:o.jsxs(vf,{className:"max-w-3xl max-h-[85vh] flex flex-col gap-0 p-0",children:[o.jsxs(bf,{className:"px-4 pt-4 pb-2 border-b",children:[o.jsx(yf,{children:"Selecionar ícone"}),o.jsx(wf,{children:"Pesquise e clique em um ícone da biblioteca Lucide."})]}),o.jsx("div",{className:"px-4 py-2 border-b",children:o.jsxs("div",{className:"relative",children:[o.jsx(I.Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),o.jsx(ue,{autoFocus:!0,placeholder:"Buscar ícones…",value:l,onChange:f=>c(f.target.value),className:"pl-8 h-9 text-sm"})]})}),o.jsx(Oo,{className:"flex-1 px-4 py-2",children:o.jsxs("div",{className:"grid grid-cols-5 gap-2 sm:grid-cols-7 md:grid-cols-8 pb-2",children:[o.jsxs(Ae,{type:"button",variant:e?"outline":"secondary",className:"flex flex-col items-center justify-center h-20 gap-1 p-1",onClick:()=>m(void 0),children:[o.jsx("div",{className:"h-6 w-6 rounded border-2 border-dashed border-muted-foreground/30"}),o.jsx("span",{className:"text-[10px] leading-tight text-center",children:"Nenhum"})]}),u.map(({name:f,component:v})=>o.jsxs(Ae,{type:"button",variant:e===f?"secondary":"outline",className:"flex flex-col items-center justify-center h-20 gap-1 p-1 overflow-hidden",onClick:()=>m(f),children:[N.createElement(v,{size:24}),o.jsx("span",{className:"text-[9px] leading-tight text-center break-all line-clamp-2",children:f})]},f))]})})]})})]})};var H1=Object.defineProperty,W1=(e,t,r)=>t in e?H1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Pc=(e,t,r)=>W1(e,typeof t!="symbol"?t+"":t,r);const Ga=N.createContext({}),Cr=()=>N.useContext(Ga),_c=new Set(["__proto__","constructor","prototype"]),Na=(e,t,r)=>{const n=t.split(".");let a=e;for(let i=0;i<n.length-1;i++){const l=n[i];if(_c.has(l))return;(a[l]==null||typeof a[l]!="object")&&(a[l]={}),a=a[l]}const s=n[n.length-1];_c.has(s)||(a[s]=r)},xn=async(e,t,r,n,a,s)=>{for(const i of e){const l=s[i.type];if(!l)continue;const c=await l(r,n,i,a);if(c)return i.message??c}},ah=(e,t={},r={})=>async n=>{var a,s,i,l,c;const d={},{errors:u}=yi(e,n,t);for(const p of u){const f=p.campo.replace(/\[(\d+)\]/g,".$1");Na(d,f,{type:"custom",message:p.message})}const m=[...e.containers].sort((p,f)=>p.ordem-f.ordem);for(const p of m)if(!p.repeatable&&$e(p.condicional,n,t))for(const f of p.campos){if(f.tipo===D.HIDDEN||f.isDisabled||f.isReadOnly||!$e(f.condicional,n,t))continue;if(f.tipo===D.FIELD_ARRAY){const h=Array.isArray(n[f.nome])?n[f.nome]:[];for(let x=0;x<h.length;x++){const b=h[x];for(const y of f.subFields??[]){if(y.isDisabled||y.isReadOnly||!$e(y.condicional,b,t)||!((a=y.validate)!=null&&a.length)||d[`${f.nome}.${x}.${y.nome}`])continue;const j=await xn(y.validate,y.nome,b[y.nome],b,t,r);j&&Na(d,`${f.nome}.${x}.${y.nome}`,{type:"custom",message:j})}}continue}if(f.tipo===D.SUB_FORM){const h=n[f.nome]??{};for(const x of((s=f.subSchema)==null?void 0:s.fields)??[]){if(x.isDisabled||x.isReadOnly||!((i=x.validate)!=null&&i.length)||d[`${f.nome}.${x.nome}`])continue;const b=await xn(x.validate,x.nome,h[x.nome],h,t,r);b&&Na(d,`${f.nome}.${x.nome}`,{type:"custom",message:b})}continue}if(!((l=f.validate)!=null&&l.length)||d[f.nome])continue;const v=await xn(f.validate,f.nome,n[f.nome],n,t,r);v&&(d[f.nome]={type:"custom",message:v})}for(const p of m){if(!p.repeatable||!p.nome||!$e(p.condicional,n,t))continue;const f=Array.isArray(n[p.nome])?n[p.nome]:[];for(let v=0;v<f.length;v++){const h=f[v];for(const x of p.campos){if(x.tipo===D.HIDDEN||x.isDisabled||x.isReadOnly||!$e(x.condicional,h,t)||!((c=x.validate)!=null&&c.length)||d[`${p.nome}.${v}.${x.nome}`])continue;const b=await xn(x.validate,x.nome,h[x.nome],h,t,r);b&&Na(d,`${p.nome}.${v}.${x.nome}`,{type:"custom",message:b})}}}return Object.keys(d).length>0?{values:{},errors:d}:{values:n,errors:{}}},oh=(e,t={},r={})=>async n=>{var a,s;const i={},l=[...e.containers].sort((c,d)=>c.ordem-d.ordem);for(const c of l)if(!(c.condicional&&!$e(c.condicional,n,t))){if(c.repeatable&&c.nome){const d=Array.isArray(n[c.nome])?n[c.nome]:[];for(let u=0;u<d.length;u++){const m=d[u];for(const p of[...c.campos].sort((f,v)=>f.ordem-v.ordem)){if(!((a=p.warn)!=null&&a.length)||!$e(p.condicional,m,t))continue;const f=await xn(p.warn,p.nome,m[p.nome],m,t,r);f&&(i[`${c.nome}.${u}.${p.nome}`]=f)}}continue}for(const d of[...c.campos].sort((u,m)=>u.ordem-m.ordem)){if(!((s=d.warn)!=null&&s.length)||!$e(d.condicional,n,t))continue;const u=await xn(d.warn,d.nome,n[d.nome],n,t,r);u&&(i[d.nome]=u)}}return i},q1=/\{\{\s*(?:event|evento)\.([a-zA-Z0-9_.]+)\s*\}\}/g,xt=(e,t)=>e?e.replace(q1,(r,n)=>t[`evento.${n}`]??t[n]??r):e??"",G1=(e,t)=>({...e,label:xt(e.label,t)}),sh=(e,t)=>{var r;return{...e,label:xt(e.label,t),placeholder:xt(e.placeholder,t),hint:xt(e.hint,t),defaultValue:typeof e.defaultValue=="string"?xt(e.defaultValue,t):e.defaultValue,opcoes:(r=e.opcoes)==null?void 0:r.map(n=>G1(n,t))}},Fo=(e,t)=>({...e,titulo:xt(e.titulo,t),descricao:xt(e.descricao,t),campos:e.campos.map(r=>sh(r,t))}),ih=(e,t)=>({...e,titulo:xt(e.titulo,t),descricao:xt(e.descricao,t),containers:e.containers.map(r=>Fo(r,t))}),lh=()=>{const e=ra(),t=e.layout.containerStyle,r=e.layout.roundness??"rounded-xl",n=K("overflow-hidden",r,t==="card"?"border":"",t==="bordered"?"border":"",t==="glassmorphism"?"backdrop-blur-sm":""),a=t==="glassmorphism"?{background:"var(--t-surface)",borderColor:"var(--t-border)",borderWidth:"1px",borderStyle:"solid"}:{},s=K("border-b px-6 py-4",t==="flat"?"border-transparent":"");return{wrapperClass:n,wrapperStyle:a,headerClass:s,headerStyle:t==="glassmorphism"?{borderColor:"var(--t-border)"}:{},tmpl:e}},Tt=({name:e,control:t,placeholder:r,type:n="text",disabled:a,readOnly:s})=>{var i;const{field:l,fieldState:c}=Ee.useController({name:e,control:t}),d=!!c.error;return o.jsxs("div",{className:"space-y-1",children:[o.jsx(ue,{...l,value:l.value??"",type:n,placeholder:r,disabled:a,readOnly:s,className:K(d&&"border-destructive focus-visible:ring-destructive")}),((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})},zo=({name:e,control:t,placeholder:r,disabled:n,readOnly:a})=>{var s;const{field:i,fieldState:l}=Ee.useController({name:e,control:t});return o.jsxs("div",{className:"space-y-1",children:[o.jsx(io,{...i,value:i.value??"",placeholder:r,disabled:n,readOnly:a,rows:3,className:K(l.error&&"border-destructive focus-visible:ring-destructive")}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},Lo=({name:e,control:t,placeholder:r,options:n,disabled:a,readOnly:s})=>{var i;const{field:l,fieldState:c}=Ee.useController({name:e,control:t});return o.jsxs("div",{className:"space-y-1",children:[o.jsxs(Vt,{value:l.value??"",onValueChange:d=>!s&&l.onChange(d),disabled:a||s,children:[o.jsx(Dt,{className:K(c.error&&"border-destructive focus:ring-destructive"),onBlur:l.onBlur,children:o.jsx(Bt,{placeholder:r??"Selecione..."})}),o.jsx(Rt,{children:n.map(d=>o.jsx(Xe,{value:d.valor,disabled:d.disabled,children:d.label},d.valor))})]}),((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})},Mo=({name:e,control:t,label:r,disabled:n,readOnly:a})=>{var s;const{field:i,fieldState:l}=Ee.useController({name:e,control:t});return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[o.jsx(rt,{name:i.name,checked:!!i.value,onCheckedChange:c=>!a&&i.onChange(!!c),onBlur:i.onBlur,disabled:n}),r&&o.jsx("span",{className:"text-sm leading-none",children:r})]}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},cl=({name:e,control:t,options:r,disabled:n})=>{var a;const{field:s,fieldState:i}=Ee.useController({name:e,control:t}),l=Array.isArray(s.value)?s.value:[],c=d=>{const u=l.includes(d)?l.filter(m=>m!==d):[...l,d];s.onChange(u)};return o.jsxs("div",{className:"space-y-1",children:[o.jsx("div",{className:"flex flex-col gap-2",onBlur:s.onBlur,children:r.map(d=>o.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[o.jsx(rt,{checked:l.includes(d.valor),onCheckedChange:()=>c(d.valor),disabled:n||d.disabled}),o.jsx("span",{className:"text-sm leading-none",children:d.label})]},d.valor))}),((a=i.error)==null?void 0:a.message)&&o.jsx("p",{className:"text-sm text-destructive",children:i.error.message})]})},dl=({name:e,control:t,options:r,visualStyle:n="default",disabled:a})=>{var s;const{field:i,fieldState:l}=Ee.useController({name:e,control:t}),c=n==="card";return o.jsxs("div",{className:"space-y-1",onBlur:i.onBlur,children:[o.jsx(Ri,{value:i.value??"",onValueChange:i.onChange,className:K(c?"grid grid-cols-2 gap-2 sm:grid-cols-3":"flex flex-col gap-2"),children:r.map(d=>o.jsxs("label",{className:K("flex items-center gap-2 cursor-pointer",c&&"rounded-lg border p-3 transition-colors hover:bg-accent data-[selected=true]:border-primary data-[selected=true]:bg-primary/5",(a||d.disabled)&&"cursor-not-allowed opacity-50"),"data-selected":i.value===d.valor?"true":void 0,children:[o.jsx(Pi,{value:d.valor,disabled:a||d.disabled}),o.jsx("span",{className:"text-sm leading-none",children:d.label})]},d.valor))}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},ch=e=>{const t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),n=String(e.getDate()).padStart(2,"0");return`${t}-${r}-${n}`},X1=e=>{const t=new Date;return t.setFullYear(t.getFullYear()-e),ch(t)},Z1=e=>{const t=new Date;return t.setFullYear(t.getFullYear()-e),ch(t)},Tn=({name:e,control:t,isDatetime:r,disabled:n,readOnly:a,validacao:s})=>{var i;const{field:l,fieldState:c}=Ee.useController({name:e,control:t}),d=r?"datetime-local":"date",u=f=>r?f+"T00:00":f,m=(s==null?void 0:s.minAge)!=null?u(X1(s.minAge)):(s==null?void 0:s.maxDate)!=null?u(s.maxDate):void 0,p=(s==null?void 0:s.maxAge)!=null?u(Z1(s.maxAge)):(s==null?void 0:s.minDate)!=null?u(s.minDate):void 0;return o.jsxs("div",{className:"space-y-1",children:[o.jsx(ue,{name:l.name,value:l.value??"",onChange:l.onChange,onBlur:l.onBlur,type:d,min:p,max:m,disabled:n,readOnly:a,className:K(c.error&&"border-destructive focus-visible:ring-destructive")}),((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})};function K1(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}const dh={128:"€",130:"‚",131:"ƒ",132:"„",133:"…",134:"†",135:"‡",136:"ˆ",137:"‰",138:"Š",139:"‹",140:"Œ",142:"Ž",145:"‘",146:"’",147:"“",148:"”",149:"•",150:"–",151:"—",152:"˜",153:"™",154:"š",155:"›",156:"œ",158:"ž",159:"Ÿ"};for(const[e,t]of Object.entries(dh));let Ic;function Y1(){if(!(typeof globalThis.TextDecoder>"u"))return Ic??(Ic=new globalThis.TextDecoder("utf-8"))}const An=32*1024,qt=65533;function J1(e,t="utf-8"){switch(t.toLowerCase()){case"utf-8":case"utf8":{const r=Y1();return r?r.decode(e):ej(e)}case"utf-16le":return tj(e);case"us-ascii":case"ascii":return rj(e);case"latin1":case"iso-8859-1":return nj(e);case"windows-1252":return aj(e);default:throw new RangeError(`Encoding '${t}' not supported`)}}function ul(e,t){t.length!==0&&(e.push(String.fromCharCode.apply(null,t)),t.length=0)}function Je(e,t,r){t.push(r),t.length>=An&&ul(e,t)}function Q1(e,t,r){if(r<=65535){Je(e,t,r);return}r-=65536,Je(e,t,55296+(r>>10)),Je(e,t,56320+(r&1023))}function ej(e){const t=[],r=[];let n=0;for(e.length>=3&&e[0]===239&&e[1]===187&&e[2]===191&&(n=3);n<e.length;){const a=e[n];if(a<=127){Je(t,r,a),n++;continue}if(a<194||a>244){Je(t,r,qt),n++;continue}if(a<=223){if(n+1>=e.length){Je(t,r,qt),n++;continue}const d=e[n+1];if((d&192)!==128){Je(t,r,qt),n++;continue}const u=(a&31)<<6|d&63;Je(t,r,u),n+=2;continue}if(a<=239){if(n+2>=e.length){Je(t,r,qt),n++;continue}const d=e[n+1],u=e[n+2];if(!((d&192)===128&&(u&192)===128&&!(a===224&&d<160)&&!(a===237&&d>=160))){Je(t,r,qt),n++;continue}const m=(a&15)<<12|(d&63)<<6|u&63;Je(t,r,m),n+=3;continue}if(n+3>=e.length){Je(t,r,qt),n++;continue}const s=e[n+1],i=e[n+2],l=e[n+3];if(!((s&192)===128&&(i&192)===128&&(l&192)===128&&!(a===240&&s<144)&&!(a===244&&s>143))){Je(t,r,qt),n++;continue}const c=(a&7)<<18|(s&63)<<12|(i&63)<<6|l&63;Q1(t,r,c),n+=4}return ul(t,r),t.join("")}function tj(e){const t=[],r=[],n=e.length;let a=0;for(;a+1<n;){const s=e[a]|e[a+1]<<8;if(a+=2,s>=55296&&s<=56319){if(a+1<n){const i=e[a]|e[a+1]<<8;i>=56320&&i<=57343?(Je(t,r,s),Je(t,r,i),a+=2):Je(t,r,qt)}else Je(t,r,qt);continue}if(s>=56320&&s<=57343){Je(t,r,qt);continue}Je(t,r,s)}return a<n&&Je(t,r,qt),ul(t,r),t.join("")}function rj(e){const t=[];for(let r=0;r<e.length;r+=An){const n=Math.min(e.length,r+An),a=new Array(n-r);for(let s=r,i=0;s<n;s++,i++)a[i]=e[s]&127;t.push(String.fromCharCode.apply(null,a))}return t.join("")}function nj(e){const t=[];for(let r=0;r<e.length;r+=An){const n=Math.min(e.length,r+An),a=new Array(n-r);for(let s=r,i=0;s<n;s++,i++)a[i]=e[s];t.push(String.fromCharCode.apply(null,a))}return t.join("")}function aj(e){const t=[];let r="";for(let n=0;n<e.length;n++){const a=e[n],s=a>=128&&a<=159?dh[a]:void 0;r+=s??String.fromCharCode(a),r.length>=An&&(t.push(r),r="")}return r&&t.push(r),t.join("")}function kt(e){return new DataView(e.buffer,e.byteOffset)}const oj={len:1,get(e,t){return kt(e).getUint8(t)},put(e,t,r){return kt(e).setUint8(t,r),t+1}},We={len:2,get(e,t){return kt(e).getUint16(t,!0)},put(e,t,r){return kt(e).setUint16(t,r,!0),t+2}},mn={len:2,get(e,t){return kt(e).getUint16(t)},put(e,t,r){return kt(e).setUint16(t,r),t+2}},Ze={len:4,get(e,t){return kt(e).getUint32(t,!0)},put(e,t,r){return kt(e).setUint32(t,r,!0),t+4}},Oc={len:4,get(e,t){return kt(e).getUint32(t)},put(e,t,r){return kt(e).setUint32(t,r),t+4}},sj={len:4,get(e,t){return kt(e).getInt32(t)},put(e,t,r){return kt(e).setInt32(t,r),t+4}},ij={len:8,get(e,t){return kt(e).getBigUint64(t,!0)},put(e,t,r){return kt(e).setBigUint64(t,r,!0),t+8}};let gr=class{constructor(t,r){this.len=t,this.encoding=r}get(t,r=0){const n=t.subarray(r,r+this.len);return J1(n,this.encoding)}};const lj="End-Of-Stream";class et extends Error{constructor(){super(lj),this.name="EndOfStreamError"}}let cj=class extends Error{constructor(t="The operation was aborted"){super(t),this.name="AbortError"}},uh=class{constructor(){this.endOfStream=!1,this.interrupted=!1,this.peekQueue=[]}async peek(t,r=!1){const n=await this.read(t,r);return this.peekQueue.push(t.subarray(0,n)),n}async read(t,r=!1){if(t.length===0)return 0;let n=this.readFromPeekBuffer(t);if(this.endOfStream||(n+=await this.readRemainderFromStream(t.subarray(n),r)),n===0&&!r)throw new et;return n}readFromPeekBuffer(t){let r=t.length,n=0;for(;this.peekQueue.length>0&&r>0;){const a=this.peekQueue.pop();if(!a)throw new Error("peekData should be defined");const s=Math.min(a.length,r);t.set(a.subarray(0,s),n),n+=s,r-=s,s<a.length&&this.peekQueue.push(a.subarray(s))}return n}async readRemainderFromStream(t,r){let n=0;for(;n<t.length&&!this.endOfStream;){if(this.interrupted)throw new cj;const a=await this.readFromStream(t.subarray(n),r);if(a===0)break;n+=a}if(!r&&n<t.length)throw new et;return n}},dj=class extends uh{constructor(t){super(),this.reader=t}async abort(){return this.close()}async close(){this.reader.releaseLock()}},uj=class extends dj{async readFromStream(t,r){if(t.length===0)return 0;const n=await this.reader.read(new Uint8Array(t.length),{min:r?void 0:t.length});return n.done&&(this.endOfStream=n.done),n.value?(t.set(n.value),n.value.length):0}};class Fc extends uh{constructor(t){super(),this.reader=t,this.buffer=null}writeChunk(t,r){const n=Math.min(r.length,t.length);return t.set(r.subarray(0,n)),n<r.length?this.buffer=r.subarray(n):this.buffer=null,n}async readFromStream(t,r){if(t.length===0)return 0;let n=0;for(this.buffer&&(n+=this.writeChunk(t,this.buffer));n<t.length&&!this.endOfStream;){const a=await this.reader.read();if(a.done){this.endOfStream=!0;break}a.value&&(n+=this.writeChunk(t.subarray(n),a.value))}if(!r&&n===0&&this.endOfStream)throw new et;return n}abort(){return this.interrupted=!0,this.reader.cancel()}async close(){await this.abort(),this.reader.releaseLock()}}function mj(e){try{const t=e.getReader({mode:"byob"});return t instanceof ReadableStreamDefaultReader?new Fc(t):new uj(t)}catch(t){if(t instanceof TypeError)return new Fc(e.getReader());throw t}}class ml{constructor(t){this.numBuffer=new Uint8Array(8),this.position=0,this.onClose=t==null?void 0:t.onClose,t!=null&&t.abortSignal&&t.abortSignal.addEventListener("abort",()=>{this.abort()})}async readToken(t,r=this.position){const n=new Uint8Array(t.len);if(await this.readBuffer(n,{position:r})<t.len)throw new et;return t.get(n,0)}async peekToken(t,r=this.position){const n=new Uint8Array(t.len);if(await this.peekBuffer(n,{position:r})<t.len)throw new et;return t.get(n,0)}async readNumber(t){if(await this.readBuffer(this.numBuffer,{length:t.len})<t.len)throw new et;return t.get(this.numBuffer,0)}async peekNumber(t){if(await this.peekBuffer(this.numBuffer,{length:t.len})<t.len)throw new et;return t.get(this.numBuffer,0)}async ignore(t){if(t<0)throw new RangeError("ignore length must be ≥ 0 bytes");if(this.fileInfo.size!==void 0){const r=this.fileInfo.size-this.position;if(t>r)return this.position+=r,r}return this.position+=t,t}async close(){var t;await this.abort(),await((t=this.onClose)==null?void 0:t.call(this))}normalizeOptions(t,r){if(!this.supportsRandomAccess()&&r&&r.position!==void 0&&r.position<this.position)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");return{mayBeLess:!1,offset:0,length:t.length,position:this.position,...r}}abort(){return Promise.resolve()}}const pj=256e3;let fj=class extends ml{constructor(t,r){super(r),this.streamReader=t,this.fileInfo=(r==null?void 0:r.fileInfo)??{}}async readBuffer(t,r){const n=this.normalizeOptions(t,r),a=n.position-this.position;if(a>0)return await this.ignore(a),this.readBuffer(t,r);if(a<0)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");if(n.length===0)return 0;const s=await this.streamReader.read(t.subarray(0,n.length),n.mayBeLess);if(this.position+=s,(!r||!r.mayBeLess)&&s<n.length)throw new et;return s}async peekBuffer(t,r){const n=this.normalizeOptions(t,r);let a=0;if(n.position){const s=n.position-this.position;if(s>0){const i=new Uint8Array(n.length+s);return a=await this.peekBuffer(i,{mayBeLess:n.mayBeLess}),t.set(i.subarray(s)),a-s}if(s<0)throw new Error("Cannot peek from a negative offset in a stream")}if(n.length>0){try{a=await this.streamReader.peek(t.subarray(0,n.length),n.mayBeLess)}catch(s){if(r!=null&&r.mayBeLess&&s instanceof et)return 0;throw s}if(!n.mayBeLess&&a<n.length)throw new et}return a}async ignore(t){if(t<0)throw new RangeError("ignore length must be ≥ 0 bytes");const r=Math.min(pj,t),n=new Uint8Array(r);let a=0;for(;a<t;){const s=t-a,i=await this.readBuffer(n,{length:Math.min(r,s)});if(i<0)return i;a+=i}return a}abort(){return this.streamReader.abort()}async close(){return this.streamReader.close()}supportsRandomAccess(){return!1}},hj=class extends ml{constructor(t,r){super(r),this.uint8Array=t,this.fileInfo={...(r==null?void 0:r.fileInfo)??{},size:t.length}}async readBuffer(t,r){r!=null&&r.position&&(this.position=r.position);const n=await this.peekBuffer(t,r);return this.position+=n,n}async peekBuffer(t,r){const n=this.normalizeOptions(t,r),a=Math.min(this.uint8Array.length-n.position,n.length);if(!n.mayBeLess&&a<n.length)throw new et;return t.set(this.uint8Array.subarray(n.position,n.position+a)),a}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(t){this.position=t}},xj=class extends ml{constructor(t,r){super(r),this.blob=t,this.fileInfo={...(r==null?void 0:r.fileInfo)??{},size:t.size,mimeType:t.type}}async readBuffer(t,r){r!=null&&r.position&&(this.position=r.position);const n=await this.peekBuffer(t,r);return this.position+=n,n}async peekBuffer(t,r){const n=this.normalizeOptions(t,r),a=Math.min(this.blob.size-n.position,n.length);if(!n.mayBeLess&&a<n.length)throw new et;const s=await this.blob.slice(n.position,n.position+a).arrayBuffer();return t.set(new Uint8Array(s)),a}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(t){this.position=t}};function gj(e,t){const r=mj(e),n=t??{},a=n.onClose;return n.onClose=async()=>{if(await r.close(),a)return a()},new fj(r,n)}function vj(e,t){return new hj(e,t)}function bj(e,t){return new xj(e,t)}var ni={exports:{}},fs,zc;function yj(){if(zc)return fs;zc=1;var e=1e3,t=e*60,r=t*60,n=r*24,a=n*7,s=n*365.25;fs=function(u,m){m=m||{};var p=typeof u;if(p==="string"&&u.length>0)return i(u);if(p==="number"&&isFinite(u))return m.long?c(u):l(u);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(u))};function i(u){if(u=String(u),!(u.length>100)){var m=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(u);if(m){var p=parseFloat(m[1]),f=(m[2]||"ms").toLowerCase();switch(f){case"years":case"year":case"yrs":case"yr":case"y":return p*s;case"weeks":case"week":case"w":return p*a;case"days":case"day":case"d":return p*n;case"hours":case"hour":case"hrs":case"hr":case"h":return p*r;case"minutes":case"minute":case"mins":case"min":case"m":return p*t;case"seconds":case"second":case"secs":case"sec":case"s":return p*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return p;default:return}}}}function l(u){var m=Math.abs(u);return m>=n?Math.round(u/n)+"d":m>=r?Math.round(u/r)+"h":m>=t?Math.round(u/t)+"m":m>=e?Math.round(u/e)+"s":u+"ms"}function c(u){var m=Math.abs(u);return m>=n?d(u,m,n,"day"):m>=r?d(u,m,r,"hour"):m>=t?d(u,m,t,"minute"):m>=e?d(u,m,e,"second"):u+" ms"}function d(u,m,p,f){var v=m>=p*1.5;return Math.round(u/p)+" "+f+(v?"s":"")}return fs}function wj(e){r.debug=r,r.default=r,r.coerce=c,r.disable=i,r.enable=a,r.enabled=l,r.humanize=yj(),r.destroy=d,Object.keys(e).forEach(u=>{r[u]=e[u]}),r.names=[],r.skips=[],r.formatters={};function t(u){let m=0;for(let p=0;p<u.length;p++)m=(m<<5)-m+u.charCodeAt(p),m|=0;return r.colors[Math.abs(m)%r.colors.length]}r.selectColor=t;function r(u){let m,p=null,f,v;function h(...x){if(!h.enabled)return;const b=h,y=Number(new Date),j=y-(m||y);b.diff=j,b.prev=m,b.curr=y,m=y,x[0]=r.coerce(x[0]),typeof x[0]!="string"&&x.unshift("%O");let w=0;x[0]=x[0].replace(/%([a-zA-Z%])/g,(C,S)=>{if(C==="%%")return"%";w++;const $=r.formatters[S];if(typeof $=="function"){const k=x[w];C=$.call(b,k),x.splice(w,1),w--}return C}),r.formatArgs.call(b,x),(b.log||r.log).apply(b,x)}return h.namespace=u,h.useColors=r.useColors(),h.color=r.selectColor(u),h.extend=n,h.destroy=r.destroy,Object.defineProperty(h,"enabled",{enumerable:!0,configurable:!1,get:()=>p!==null?p:(f!==r.namespaces&&(f=r.namespaces,v=r.enabled(u)),v),set:x=>{p=x}}),typeof r.init=="function"&&r.init(h),h}function n(u,m){const p=r(this.namespace+(typeof m>"u"?":":m)+u);return p.log=this.log,p}function a(u){r.save(u),r.namespaces=u,r.names=[],r.skips=[];const m=(typeof u=="string"?u:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const p of m)p[0]==="-"?r.skips.push(p.slice(1)):r.names.push(p)}function s(u,m){let p=0,f=0,v=-1,h=0;for(;p<u.length;)if(f<m.length&&(m[f]===u[p]||m[f]==="*"))m[f]==="*"?(v=f,h=p,f++):(p++,f++);else if(v!==-1)f=v+1,h++,p=h;else return!1;for(;f<m.length&&m[f]==="*";)f++;return f===m.length}function i(){const u=[...r.names,...r.skips.map(m=>"-"+m)].join(",");return r.enable(""),u}function l(u){for(const m of r.skips)if(s(u,m))return!1;for(const m of r.names)if(s(u,m))return!0;return!1}function c(u){return u instanceof Error?u.stack||u.message:u}function d(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}var jj=wj;(function(e,t){t.formatArgs=n,t.save=a,t.load=s,t.useColors=r,t.storage=i(),t.destroy=(()=>{let c=!1;return()=>{c||(c=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function r(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let c;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(c=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(c[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function n(c){if(c[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+c[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const d="color: "+this.color;c.splice(1,0,d,"color: inherit");let u=0,m=0;c[0].replace(/%[a-zA-Z%]/g,p=>{p!=="%%"&&(u++,p==="%c"&&(m=u))}),c.splice(m,0,d)}t.log=console.debug||console.log||(()=>{});function a(c){try{c?t.storage.setItem("debug",c):t.storage.removeItem("debug")}catch{}}function s(){let c;try{c=t.storage.getItem("debug")||t.storage.getItem("DEBUG")}catch{}return!c&&typeof process<"u"&&"env"in process&&(c=process.env.DEBUG),c}function i(){try{return localStorage}catch{}}e.exports=jj(t);const{formatters:l}=e.exports;l.j=function(c){try{return JSON.stringify(c)}catch(d){return"[UnexpectedJSONParseError]: "+d.message}}})(ni,ni.exports);var kj=ni.exports;const Cj=K1(kj),gn={LocalFileHeader:67324752,DataDescriptor:134695760,CentralFileHeader:33639248,EndOfCentralDirectory:101010256},Lc={get(e){return{signature:Ze.get(e,0),compressedSize:Ze.get(e,8),uncompressedSize:Ze.get(e,12)}},len:16},Nj={get(e){const t=We.get(e,6);return{signature:Ze.get(e,0),minVersion:We.get(e,4),dataDescriptor:!!(t&8),compressedMethod:We.get(e,8),compressedSize:Ze.get(e,18),uncompressedSize:Ze.get(e,22),filenameLength:We.get(e,26),extraFieldLength:We.get(e,28),filename:null}},len:30},Sj={get(e){return{signature:Ze.get(e,0),nrOfThisDisk:We.get(e,4),nrOfThisDiskWithTheStart:We.get(e,6),nrOfEntriesOnThisDisk:We.get(e,8),nrOfEntriesOfSize:We.get(e,10),sizeOfCd:Ze.get(e,12),offsetOfStartOfCd:Ze.get(e,16),zipFileCommentLength:We.get(e,20)}},len:22},$j={get(e){const t=We.get(e,8);return{signature:Ze.get(e,0),minVersion:We.get(e,6),dataDescriptor:!!(t&8),compressedMethod:We.get(e,10),compressedSize:Ze.get(e,20),uncompressedSize:Ze.get(e,24),filenameLength:We.get(e,28),extraFieldLength:We.get(e,30),fileCommentLength:We.get(e,32),relativeOffsetOfLocalHeader:Ze.get(e,42),filename:null}},len:46};function mh(e){const t=new Uint8Array(Ze.len);return Ze.put(t,0,e),t}const rr=Cj("tokenizer:inflate"),hs=256*1024,Ej=mh(gn.DataDescriptor),Sa=mh(gn.EndOfCentralDirectory);let pl=class ph{constructor(t){this.tokenizer=t,this.syncBuffer=new Uint8Array(hs)}async isZip(){return await this.peekSignature()===gn.LocalFileHeader}peekSignature(){return this.tokenizer.peekToken(Ze)}async findEndOfCentralDirectoryLocator(){const t=this.tokenizer,r=Math.min(16*1024,t.fileInfo.size),n=this.syncBuffer.subarray(0,r);await this.tokenizer.readBuffer(n,{position:t.fileInfo.size-r});for(let a=n.length-4;a>=0;a--)if(n[a]===Sa[0]&&n[a+1]===Sa[1]&&n[a+2]===Sa[2]&&n[a+3]===Sa[3])return t.fileInfo.size-r+a;return-1}async readCentralDirectory(){if(!this.tokenizer.supportsRandomAccess()){rr("Cannot reading central-directory without random-read support");return}rr("Reading central-directory...");const t=this.tokenizer.position,r=await this.findEndOfCentralDirectoryLocator();if(r>0){rr("Central-directory 32-bit signature found");const n=await this.tokenizer.readToken(Sj,r),a=[];this.tokenizer.setPosition(n.offsetOfStartOfCd);for(let s=0;s<n.nrOfEntriesOfSize;++s){const i=await this.tokenizer.readToken($j);if(i.signature!==gn.CentralFileHeader)throw new Error("Expected Central-File-Header signature");i.filename=await this.tokenizer.readToken(new gr(i.filenameLength,"utf-8")),await this.tokenizer.ignore(i.extraFieldLength),await this.tokenizer.ignore(i.fileCommentLength),a.push(i),rr(`Add central-directory file-entry: n=${s+1}/${a.length}: filename=${a[s].filename}`)}return this.tokenizer.setPosition(t),a}this.tokenizer.setPosition(t)}async unzip(t){const r=await this.readCentralDirectory();if(r)return this.iterateOverCentralDirectory(r,t);let n=!1;do{const a=await this.readLocalFileHeader();if(!a)break;const s=t(a);n=!!s.stop;let i;if(await this.tokenizer.ignore(a.extraFieldLength),a.dataDescriptor&&a.compressedSize===0){const l=[];let c=hs;rr("Compressed-file-size unknown, scanning for next data-descriptor-signature....");let d=-1;for(;d<0&&c===hs;){c=await this.tokenizer.peekBuffer(this.syncBuffer,{mayBeLess:!0}),d=Tj(this.syncBuffer.subarray(0,c),Ej);const u=d>=0?d:c;if(s.handler){const m=new Uint8Array(u);await this.tokenizer.readBuffer(m),l.push(m)}else await this.tokenizer.ignore(u)}rr(`Found data-descriptor-signature at pos=${this.tokenizer.position}`),s.handler&&await this.inflate(a,Aj(l),s.handler)}else s.handler?(rr(`Reading compressed-file-data: ${a.compressedSize} bytes`),i=new Uint8Array(a.compressedSize),await this.tokenizer.readBuffer(i),await this.inflate(a,i,s.handler)):(rr(`Ignoring compressed-file-data: ${a.compressedSize} bytes`),await this.tokenizer.ignore(a.compressedSize));if(rr(`Reading data-descriptor at pos=${this.tokenizer.position}`),a.dataDescriptor&&(await this.tokenizer.readToken(Lc)).signature!==134695760)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-Lc.len}`)}while(!n)}async iterateOverCentralDirectory(t,r){for(const n of t){const a=r(n);if(a.handler){this.tokenizer.setPosition(n.relativeOffsetOfLocalHeader);const s=await this.readLocalFileHeader();if(s){await this.tokenizer.ignore(s.extraFieldLength);const i=new Uint8Array(n.compressedSize);await this.tokenizer.readBuffer(i),await this.inflate(s,i,a.handler)}}if(a.stop)break}}async inflate(t,r,n){if(t.compressedMethod===0)return n(r);if(t.compressedMethod!==8)throw new Error(`Unsupported ZIP compression method: ${t.compressedMethod}`);rr(`Decompress filename=${t.filename}, compressed-size=${r.length}`);const a=await ph.decompressDeflateRaw(r);return n(a)}static async decompressDeflateRaw(t){const r=new ReadableStream({start(s){s.enqueue(t),s.close()}}),n=new DecompressionStream("deflate-raw"),a=r.pipeThrough(n);try{const s=await new Response(a).arrayBuffer();return new Uint8Array(s)}catch(s){const i=s instanceof Error?`Failed to deflate ZIP entry: ${s.message}`:"Unknown decompression error in ZIP entry";throw new TypeError(i)}}async readLocalFileHeader(){const t=await this.tokenizer.peekToken(Ze);if(t===gn.LocalFileHeader){const r=await this.tokenizer.readToken(Nj);return r.filename=await this.tokenizer.readToken(new gr(r.filenameLength,"utf-8")),r}if(t===gn.CentralFileHeader)return!1;throw t===3759263696?new Error("Encrypted ZIP"):new Error("Unexpected signature")}};function Tj(e,t){const r=e.length,n=t.length;if(n>r)return-1;for(let a=0;a<=r-n;a++){let s=!0;for(let i=0;i<n;i++)if(e[a+i]!==t[i]){s=!1;break}if(s)return a}return-1}function Aj(e){const t=e.reduce((a,s)=>a+s.length,0),r=new Uint8Array(t);let n=0;for(const a of e)r.set(a,n),n+=a.length;return r}let Dj=class{constructor(t){this.tokenizer=t}inflate(){const t=this.tokenizer;return new ReadableStream({async pull(r){const n=new Uint8Array(1024),a=await t.readBuffer(n,{mayBeLess:!0});if(a===0){r.close();return}r.enqueue(n.subarray(0,a))}}).pipeThrough(new DecompressionStream("gzip"))}};new globalThis.TextDecoder("utf8");new globalThis.TextEncoder;Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Mc(e){const{byteLength:t}=e;if(t===6)return e.getUint16(0)*2**32+e.getUint32(2);if(t===5)return e.getUint8(0)*2**32+e.getUint32(1);if(t===4)return e.getUint32(0);if(t===3)return e.getUint8(0)*2**16+e.getUint16(1);if(t===2)return e.getUint16(0);if(t===1)return e.getUint8(0)}function Rj(e,t){if(t==="utf-16le"){const r=[];for(let n=0;n<e.length;n++){const a=e.charCodeAt(n);r.push(a&255,a>>8&255)}return r}if(t==="utf-16be"){const r=[];for(let n=0;n<e.length;n++){const a=e.charCodeAt(n);r.push(a>>8&255,a&255)}return r}return[...e].map(r=>r.charCodeAt(0))}function Pj(e,t=0){const r=Number.parseInt(new gr(6).get(e,148).replace(/\0.*$/,"").trim(),8);if(Number.isNaN(r))return!1;let n=8*32;for(let a=t;a<t+148;a++)n+=e[a];for(let a=t+156;a<t+512;a++)n+=e[a];return r===n}const _j={get:(e,t)=>e[t+3]&127|e[t+2]<<7|e[t+1]<<14|e[t]<<21,len:4},Ij=["jpg","png","apng","gif","webp","flif","xcf","cr2","cr3","orf","arw","dng","nef","rw2","raf","tif","bmp","icns","jxr","psd","indd","zip","tar","rar","gz","bz2","7z","dmg","mp4","mid","mkv","webm","mov","avi","mpg","mp2","mp3","m4a","oga","ogg","ogv","opus","flac","wav","spx","amr","pdf","epub","elf","macho","exe","swf","rtf","wasm","woff","woff2","eot","ttf","otf","ttc","ico","flv","ps","xz","sqlite","nes","crx","xpi","cab","deb","ar","rpm","Z","lz","cfb","mxf","mts","blend","bpg","docx","pptx","xlsx","3gp","3g2","j2c","jp2","jpm","jpx","mj2","aif","qcp","odt","ods","odp","xml","mobi","heic","cur","ktx","ape","wv","dcm","ics","glb","pcap","dsf","lnk","alias","voc","ac3","m4v","m4p","m4b","f4v","f4p","f4b","f4a","mie","asf","ogm","ogx","mpc","arrow","shp","aac","mp1","it","s3m","xm","skp","avif","eps","lzh","pgp","asar","stl","chm","3mf","zst","jxl","vcf","jls","pst","dwg","parquet","class","arj","cpio","ace","avro","icc","fbx","vsdx","vtt","apk","drc","lz4","potx","xltx","dotx","xltm","ott","ots","otp","odg","otg","xlsm","docm","dotm","potm","pptm","jar","jmp","rm","sav","ppsm","ppsx","tar.gz","reg","dat"],Oj=["image/jpeg","image/png","image/gif","image/webp","image/flif","image/x-xcf","image/x-canon-cr2","image/x-canon-cr3","image/tiff","image/bmp","image/vnd.ms-photo","image/vnd.adobe.photoshop","application/x-indesign","application/epub+zip","application/x-xpinstall","application/vnd.ms-powerpoint.slideshow.macroenabled.12","application/vnd.oasis.opendocument.text","application/vnd.oasis.opendocument.spreadsheet","application/vnd.oasis.opendocument.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.presentationml.slideshow","application/zip","application/x-tar","application/x-rar-compressed","application/gzip","application/x-bzip2","application/x-7z-compressed","application/x-apple-diskimage","application/vnd.apache.arrow.file","video/mp4","audio/midi","video/matroska","video/webm","video/quicktime","video/vnd.avi","audio/wav","audio/qcelp","audio/x-ms-asf","video/x-ms-asf","application/vnd.ms-asf","video/mpeg","video/3gpp","audio/mpeg","audio/mp4","video/ogg","audio/ogg","audio/ogg; codecs=opus","application/ogg","audio/flac","audio/ape","audio/wavpack","audio/amr","application/pdf","application/x-elf","application/x-mach-binary","application/x-msdownload","application/x-shockwave-flash","application/rtf","application/wasm","font/woff","font/woff2","application/vnd.ms-fontobject","font/ttf","font/otf","font/collection","image/x-icon","video/x-flv","application/postscript","application/eps","application/x-xz","application/x-sqlite3","application/x-nintendo-nes-rom","application/x-google-chrome-extension","application/vnd.ms-cab-compressed","application/x-deb","application/x-unix-archive","application/x-rpm","application/x-compress","application/x-lzip","application/x-cfb","application/x-mie","application/mxf","video/mp2t","application/x-blender","image/bpg","image/j2c","image/jp2","image/jpx","image/jpm","image/mj2","audio/aiff","application/xml","application/x-mobipocket-ebook","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/icns","image/ktx","application/dicom","audio/x-musepack","text/calendar","text/vcard","text/vtt","model/gltf-binary","application/vnd.tcpdump.pcap","audio/x-dsf","application/x.ms.shortcut","application/x.apple.alias","audio/x-voc","audio/vnd.dolby.dd-raw","audio/x-m4a","image/apng","image/x-olympus-orf","image/x-sony-arw","image/x-adobe-dng","image/x-nikon-nef","image/x-panasonic-rw2","image/x-fujifilm-raf","video/x-m4v","video/3gpp2","application/x-esri-shape","audio/aac","audio/x-it","audio/x-s3m","audio/x-xm","video/MP1S","video/MP2P","application/vnd.sketchup.skp","image/avif","application/x-lzh-compressed","application/pgp-encrypted","application/x-asar","model/stl","application/vnd.ms-htmlhelp","model/3mf","image/jxl","application/zstd","image/jls","application/vnd.ms-outlook","image/vnd.dwg","application/vnd.apache.parquet","application/java-vm","application/x-arj","application/x-cpio","application/x-ace-compressed","application/avro","application/vnd.iccprofile","application/x.autodesk.fbx","application/vnd.visio","application/vnd.android.package-archive","application/vnd.google.draco","application/x-lz4","application/vnd.openxmlformats-officedocument.presentationml.template","application/vnd.openxmlformats-officedocument.spreadsheetml.template","application/vnd.openxmlformats-officedocument.wordprocessingml.template","application/vnd.ms-excel.template.macroenabled.12","application/vnd.oasis.opendocument.text-template","application/vnd.oasis.opendocument.spreadsheet-template","application/vnd.oasis.opendocument.presentation-template","application/vnd.oasis.opendocument.graphics","application/vnd.oasis.opendocument.graphics-template","application/vnd.ms-excel.sheet.macroenabled.12","application/vnd.ms-word.document.macroenabled.12","application/vnd.ms-word.template.macroenabled.12","application/vnd.ms-powerpoint.template.macroenabled.12","application/vnd.ms-powerpoint.presentation.macroenabled.12","application/java-archive","application/vnd.rn-realmedia","application/x-spss-sav","application/x-ms-regedit","application/x-ft-windows-registry-hive","application/x-jmp-data"],qn=4100,Fj=qn-2,dr=1024*1024,Vc=1024,zj=2**31-1,zt=16*1024*1024,Vo=dr,Bc=dr,Lj=zt,Mj=1,Uc=100,xs=zt,Hc=64,Wc=Vo,Vj=256,Bj=512,Uj=zt,Hj=512,Wj=512,qc=256,Gc=Vo,Xc=Vo,qj=Vo,Zc=zt,Gj=new Set(["Unexpected signature","Encrypted ZIP","Expected Central-File-Header signature"]),Xj=["ZIP entry count exceeds ","Unsupported ZIP compression method:","ZIP entry compressed data exceeds ","ZIP entry decompressed data exceeds ","Expected data-descriptor-signature at position "],Zj=new Set(["Z_BUF_ERROR","Z_DATA_ERROR","ERR_INVALID_STATE"]);class Kr extends Error{}function Kj(e){var t;const r=e==null?void 0:e.streamReader;if(((t=r==null?void 0:r.constructor)==null?void 0:t.name)!=="WebStreamByobReader")return e;const{reader:n}=r,a=async()=>{await n.cancel(),n.releaseLock()};return r.close=a,r.abort=async()=>{r.interrupted=!0,await a()},e}function fl(e,t,r){if(!Number.isFinite(e)||e<0||e>t)throw new Kr(`${r} has invalid size ${e} (maximum ${t} bytes)`);return e}async function Dr(e,t,{maximumLength:r=zt,reason:n="skip"}={}){const a=fl(t,r,n);await e.ignore(a)}async function gs(e,t,r,{maximumLength:n=t.length,reason:a="read"}={}){const s=t.length,i=fl(s,n,a);return e.readBuffer(t,{...r,length:i})}async function Yj(e,{maximumLength:t=dr}={}){const r=new ReadableStream({start(l){l.enqueue(e),l.close()}}).pipeThrough(new DecompressionStream("deflate-raw")).getReader(),n=[];let a=0;try{for(;;){const{done:l,value:c}=await r.read();if(l)break;if(a+=c.length,a>t)throw await r.cancel(),new Error(`ZIP entry decompressed data exceeds ${t} bytes`);n.push(c)}}finally{r.releaseLock()}const s=new Uint8Array(a);let i=0;for(const l of n)s.set(l,i),i+=l.length;return s}const fh=134695760,Xa=16,Jj=Xa-1;function Qj(e,t){if(e.length<Xa)return-1;const r=e.length-Xa;for(let n=0;n<=r;n++)if(Ze.get(e,n)===fh&&Ze.get(e,n+8)===t+n)return n;return-1}function ek(e){return(e.codePointAt(0)&32)!==0}function tk(e,t){const r=new Uint8Array(t);let n=0;for(const a of e)r.set(a,n),n+=a.length;return r}async function rk(e,{shouldBuffer:t,maximumLength:r=dr}={}){const{syncBuffer:n}=e,{length:a}=n,s=[];let i=0;for(;;){const l=await e.tokenizer.peekBuffer(n,{mayBeLess:!0}),c=Qj(n.subarray(0,l),i),d=c>=0?0:l===a?Math.min(Jj,l-1):0,u=c>=0?c:l-d;if(u===0)break;if(i+=u,i>r)throw new Error(`ZIP entry compressed data exceeds ${r} bytes`);if(t){const m=new Uint8Array(u);await e.tokenizer.readBuffer(m),s.push(m)}else await e.tokenizer.ignore(u);if(c>=0)break}if(mt(e.tokenizer)||(e.knownSizeDescriptorScannedBytes+=i),!!t)return tk(s,i)}function nk(e,t){return mt(e.tokenizer)?Math.max(0,zt-(e.tokenizer.position-t)):Math.max(0,dr-e.knownSizeDescriptorScannedBytes)}async function ak(e,t,{shouldBuffer:r,maximumDescriptorLength:n=dr}={}){if(t.dataDescriptor&&t.compressedSize===0)return rk(e,{shouldBuffer:r,maximumLength:n});if(!r){await Dr(e.tokenizer,t.compressedSize,{maximumLength:mt(e.tokenizer)?dr:e.tokenizer.fileInfo.size,reason:"ZIP entry compressed data"});return}const a=uk(e.tokenizer);if(!Number.isFinite(t.compressedSize)||t.compressedSize<0||t.compressedSize>a)throw new Error(`ZIP entry compressed data exceeds ${a} bytes`);const s=new Uint8Array(t.compressedSize);return await e.tokenizer.readBuffer(s),s}pl.prototype.inflate=async function(e,t,r){if(e.compressedMethod===0)return r(t);if(e.compressedMethod!==8)throw new Error(`Unsupported ZIP compression method: ${e.compressedMethod}`);const n=await Yj(t,{maximumLength:dr});return r(n)};pl.prototype.unzip=async function(e){let t=!1,r=0;const n=this.tokenizer.position;this.knownSizeDescriptorScannedBytes=0;do{if(Gn(this.tokenizer,n,zt))throw new Kr(`ZIP stream probing exceeds ${zt} bytes`);const a=await this.readLocalFileHeader();if(!a)break;if(r++,r>Vc)throw new Error(`ZIP entry count exceeds ${Vc}`);const s=e(a);t=!!s.stop,await this.tokenizer.ignore(a.extraFieldLength);const i=await ak(this,a,{shouldBuffer:!!s.handler,maximumDescriptorLength:Math.min(dr,nk(this,n))});if(s.handler&&await this.inflate(a,i,s.handler),a.dataDescriptor){const l=new Uint8Array(Xa);if(await this.tokenizer.readBuffer(l),Ze.get(l,0)!==fh)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-l.length}`)}if(Gn(this.tokenizer,n,zt))throw new Kr(`ZIP stream probing exceeds ${zt} bytes`)}while(!t)};function ok(e,t){const r=e.getReader();let n=0,a=!1,s=!1;const i=async l=>{a||s||(s=!0,await r.cancel(l))};return new ReadableStream({async pull(l){if(n>=t){l.close(),await i();return}const{done:c,value:d}=await r.read();if(c||!d){a=!0,l.close();return}const u=t-n;if(d.length>u){l.enqueue(d.subarray(0,u)),n+=u,l.close(),await i();return}l.enqueue(d),n+=d.length},async cancel(l){await i(l)}})}async function sk(e,t){return new hl(t).fromBlob(e)}function Kc(e){switch(e=e.toLowerCase(),e){case"application/epub+zip":return{ext:"epub",mime:e};case"application/vnd.oasis.opendocument.text":return{ext:"odt",mime:e};case"application/vnd.oasis.opendocument.text-template":return{ext:"ott",mime:e};case"application/vnd.oasis.opendocument.spreadsheet":return{ext:"ods",mime:e};case"application/vnd.oasis.opendocument.spreadsheet-template":return{ext:"ots",mime:e};case"application/vnd.oasis.opendocument.presentation":return{ext:"odp",mime:e};case"application/vnd.oasis.opendocument.presentation-template":return{ext:"otp",mime:e};case"application/vnd.oasis.opendocument.graphics":return{ext:"odg",mime:e};case"application/vnd.oasis.opendocument.graphics-template":return{ext:"otg",mime:e};case"application/vnd.openxmlformats-officedocument.presentationml.slideshow":return{ext:"ppsx",mime:e};case"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":return{ext:"xlsx",mime:e};case"application/vnd.ms-excel.sheet.macroenabled":return{ext:"xlsm",mime:"application/vnd.ms-excel.sheet.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.spreadsheetml.template":return{ext:"xltx",mime:e};case"application/vnd.ms-excel.template.macroenabled":return{ext:"xltm",mime:"application/vnd.ms-excel.template.macroenabled.12"};case"application/vnd.ms-powerpoint.slideshow.macroenabled":return{ext:"ppsm",mime:"application/vnd.ms-powerpoint.slideshow.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return{ext:"docx",mime:e};case"application/vnd.ms-word.document.macroenabled":return{ext:"docm",mime:"application/vnd.ms-word.document.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.template":return{ext:"dotx",mime:e};case"application/vnd.ms-word.template.macroenabledtemplate":return{ext:"dotm",mime:"application/vnd.ms-word.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.template":return{ext:"potx",mime:e};case"application/vnd.ms-powerpoint.template.macroenabled":return{ext:"potm",mime:"application/vnd.ms-powerpoint.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.presentation":return{ext:"pptx",mime:e};case"application/vnd.ms-powerpoint.presentation.macroenabled":return{ext:"pptm",mime:"application/vnd.ms-powerpoint.presentation.macroenabled.12"};case"application/vnd.ms-visio.drawing":return{ext:"vsdx",mime:"application/vnd.visio"};case"application/vnd.ms-package.3dmanufacturing-3dmodel+xml":return{ext:"3mf",mime:"model/3mf"}}}function nr(e,t,r){r={offset:0,...r};for(const[n,a]of t.entries())if(r.mask){if(a!==(r.mask[n]&e[n+r.offset]))return!1}else if(a!==e[n+r.offset])return!1;return!0}function ik(e){return Number.isFinite(e)?Math.max(1,Math.trunc(e)):qn}function lk(e,t,r){return r===void 0?e.read(t):(r.throwIfAborted(),new Promise((n,a)=>{const s=()=>{r.removeEventListener("abort",i)},i=()=>{const l=r.reason;s(),(async()=>{try{await e.cancel(l)}catch{}})(),a(l)};r.addEventListener("abort",i,{once:!0}),(async()=>{try{const l=await e.read(t);s(),n(l)}catch(l){s(),a(l)}})()}))}function ck(e){return Number.isFinite(e)?Math.max(0,Math.min(Fj,Math.trunc(e))):0}function dk(e){return Number.isFinite(e)?Math.max(0,e):Number.MAX_SAFE_INTEGER}function mt(e){const t=e.fileInfo.size;return!Number.isFinite(t)||t===Number.MAX_SAFE_INTEGER}function Gn(e,t,r){return mt(e)&&e.position-t>r}function uk(e){const t=e.fileInfo.size,r=Number.isFinite(t)?Math.max(0,t-e.position):Number.MAX_SAFE_INTEGER;return Math.min(r,zj)}function mk(e){if(e instanceof et||e instanceof Kr)return!0;if(!(e instanceof Error))return!1;if(Gj.has(e.message)||Zj.has(e.code))return!0;for(const t of Xj)if(e.message.startsWith(t))return!0;return!1}function Yc(e,t=dr){const r=[e.compressedSize,e.uncompressedSize];for(const n of r)if(!Number.isFinite(n)||n<0||n>t)return!1;return!0}function pk(){return{hasContentTypesEntry:!1,hasParsedContentTypesEntry:!1,isParsingContentTypes:!1,hasUnparseableContentTypes:!1,hasWordDirectory:!1,hasPresentationDirectory:!1,hasSpreadsheetDirectory:!1,hasThreeDimensionalModelEntry:!1}}function fk(e,t){t.startsWith("word/")&&(e.hasWordDirectory=!0),t.startsWith("ppt/")&&(e.hasPresentationDirectory=!0),t.startsWith("xl/")&&(e.hasSpreadsheetDirectory=!0),t.startsWith("3D/")&&t.endsWith(".model")&&(e.hasThreeDimensionalModelEntry=!0)}function Jc(e){if(!(!e.hasContentTypesEntry||e.hasUnparseableContentTypes||e.isParsingContentTypes||e.hasParsedContentTypesEntry)){if(e.hasWordDirectory)return{ext:"docx",mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"};if(e.hasPresentationDirectory)return{ext:"pptx",mime:"application/vnd.openxmlformats-officedocument.presentationml.presentation"};if(e.hasSpreadsheetDirectory)return{ext:"xlsx",mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"};if(e.hasThreeDimensionalModelEntry)return{ext:"3mf",mime:"model/3mf"}}}function hk(e){const t=e.indexOf('.main+xml"');if(t===-1){const a="application/vnd.ms-package.3dmanufacturing-3dmodel+xml";return e.includes(`ContentType="${a}"`)?a:void 0}const r=e.slice(0,t),n=r.lastIndexOf('"');return r.slice(n+1)}class hl{constructor(t){Pc(this,"detectConfident",async n=>{if(this.buffer=new Uint8Array(qn),n.fileInfo.size===void 0&&(n.fileInfo.size=Number.MAX_SAFE_INTEGER),this.tokenizer=n,mt(n)&&(await n.peekBuffer(this.buffer,{length:3,mayBeLess:!0}),this.check([31,139,8])))return this.detectGzip(n);if(await n.peekBuffer(this.buffer,{length:32,mayBeLess:!0}),this.check([66,77]))return{ext:"bmp",mime:"image/bmp"};if(this.check([11,119]))return{ext:"ac3",mime:"audio/vnd.dolby.dd-raw"};if(this.check([120,1]))return{ext:"dmg",mime:"application/x-apple-diskimage"};if(this.check([77,90]))return{ext:"exe",mime:"application/x-msdownload"};if(this.check([37,33]))return await n.peekBuffer(this.buffer,{length:24,mayBeLess:!0}),this.checkString("PS-Adobe-",{offset:2})&&this.checkString(" EPSF-",{offset:14})?{ext:"eps",mime:"application/eps"}:{ext:"ps",mime:"application/postscript"};if(this.check([31,160])||this.check([31,157]))return{ext:"Z",mime:"application/x-compress"};if(this.check([199,113]))return{ext:"cpio",mime:"application/x-cpio"};if(this.check([96,234]))return{ext:"arj",mime:"application/x-arj"};if(this.check([239,187,191]))return this.detectionReentryCount>=qc?void 0:(this.detectionReentryCount++,await this.tokenizer.ignore(3),this.detectConfident(n));if(this.check([71,73,70]))return{ext:"gif",mime:"image/gif"};if(this.check([73,73,188]))return{ext:"jxr",mime:"image/vnd.ms-photo"};if(this.check([31,139,8]))return this.detectGzip(n);if(this.check([66,90,104]))return{ext:"bz2",mime:"application/x-bzip2"};if(this.checkString("ID3")){await Dr(n,6,{maximumLength:6,reason:"ID3 header prefix"});const a=await n.readToken(_j),s=mt(n);if(!Number.isFinite(a)||a<0||s&&(a>xs||n.position+a>xs))return;if(n.position+a>n.fileInfo.size)return s?void 0:{ext:"mp3",mime:"audio/mpeg"};try{await Dr(n,a,{maximumLength:s?xs:n.fileInfo.size,reason:"ID3 payload"})}catch(i){if(i instanceof et)return;throw i}return this.detectionReentryCount>=qc?void 0:(this.detectionReentryCount++,this.parseTokenizer(n,this.detectionReentryCount))}if(this.checkString("MP+"))return{ext:"mpc",mime:"audio/x-musepack"};if((this.buffer[0]===67||this.buffer[0]===70)&&this.check([87,83],{offset:1}))return{ext:"swf",mime:"application/x-shockwave-flash"};if(this.check([255,216,255]))return this.check([247],{offset:3})?{ext:"jls",mime:"image/jls"}:{ext:"jpg",mime:"image/jpeg"};if(this.check([79,98,106,1]))return{ext:"avro",mime:"application/avro"};if(this.checkString("FLIF"))return{ext:"flif",mime:"image/flif"};if(this.checkString("8BPS"))return{ext:"psd",mime:"image/vnd.adobe.photoshop"};if(this.checkString("MPCK"))return{ext:"mpc",mime:"audio/x-musepack"};if(this.checkString("FORM"))return{ext:"aif",mime:"audio/aiff"};if(this.checkString("icns",{offset:0}))return{ext:"icns",mime:"image/icns"};if(this.check([80,75,3,4])){let a;const s=pk();try{await new pl(n).unzip(i=>{fk(s,i.filename);const l=i.filename==="[Content_Types].xml",c=Jc(s);if(!l&&c)return a=c,{stop:!0};switch(i.filename){case"META-INF/mozilla.rsa":return a={ext:"xpi",mime:"application/x-xpinstall"},{stop:!0};case"META-INF/MANIFEST.MF":return a={ext:"jar",mime:"application/java-archive"},{stop:!0};case"mimetype":return Yc(i,Bc)?{async handler(d){const u=new TextDecoder("utf-8").decode(d).trim();a=Kc(u)},stop:!0}:{};case"[Content_Types].xml":return s.hasContentTypesEntry=!0,Yc(i,Bc)?(s.isParsingContentTypes=!0,{async handler(d){const u=new TextDecoder("utf-8").decode(d),m=hk(u);m&&(a=Kc(m)),s.hasParsedContentTypesEntry=!0,s.isParsingContentTypes=!1},stop:!0}):(s.hasUnparseableContentTypes=!0,{});default:return/classes\d*\.dex/.test(i.filename)?(a={ext:"apk",mime:"application/vnd.android.package-archive"},{stop:!0}):{}}})}catch(i){if(!mk(i))throw i;s.isParsingContentTypes&&(s.isParsingContentTypes=!1,s.hasUnparseableContentTypes=!0)}return a??Jc(s)??{ext:"zip",mime:"application/zip"}}if(this.checkString("OggS")){await n.ignore(28);const a=new Uint8Array(8);return await n.readBuffer(a),nr(a,[79,112,117,115,72,101,97,100])?{ext:"opus",mime:"audio/ogg; codecs=opus"}:nr(a,[128,116,104,101,111,114,97])?{ext:"ogv",mime:"video/ogg"}:nr(a,[1,118,105,100,101,111,0])?{ext:"ogm",mime:"video/ogg"}:nr(a,[127,70,76,65,67])?{ext:"oga",mime:"audio/ogg"}:nr(a,[83,112,101,101,120,32,32])?{ext:"spx",mime:"audio/ogg"}:nr(a,[1,118,111,114,98,105,115])?{ext:"ogg",mime:"audio/ogg"}:{ext:"ogx",mime:"application/ogg"}}if(this.check([80,75])&&(this.buffer[2]===3||this.buffer[2]===5||this.buffer[2]===7)&&(this.buffer[3]===4||this.buffer[3]===6||this.buffer[3]===8))return{ext:"zip",mime:"application/zip"};if(this.checkString("MThd"))return{ext:"mid",mime:"audio/midi"};if(this.checkString("wOFF")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff",mime:"font/woff"};if(this.checkString("wOF2")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff2",mime:"font/woff2"};if(this.check([212,195,178,161])||this.check([161,178,195,212]))return{ext:"pcap",mime:"application/vnd.tcpdump.pcap"};if(this.checkString("DSD "))return{ext:"dsf",mime:"audio/x-dsf"};if(this.checkString("LZIP"))return{ext:"lz",mime:"application/x-lzip"};if(this.checkString("fLaC"))return{ext:"flac",mime:"audio/flac"};if(this.check([66,80,71,251]))return{ext:"bpg",mime:"image/bpg"};if(this.checkString("wvpk"))return{ext:"wv",mime:"audio/wavpack"};if(this.checkString("%PDF"))return{ext:"pdf",mime:"application/pdf"};if(this.check([0,97,115,109]))return{ext:"wasm",mime:"application/wasm"};if(this.check([73,73])){const a=await this.readTiffHeader(!1);if(a)return a}if(this.check([77,77])){const a=await this.readTiffHeader(!0);if(a)return a}if(this.checkString("MAC "))return{ext:"ape",mime:"audio/ape"};if(this.check([26,69,223,163])){async function a(){const d=await n.peekNumber(oj);let u=128,m=0;for(;!(d&u)&&u!==0;)++m,u>>=1;const p=new Uint8Array(m+1);return await gs(n,p,void 0,{maximumLength:p.length,reason:"EBML field"}),p}async function s(){const d=await a(),u=await a();u[0]^=128>>u.length-1;const m=Math.min(6,u.length),p=new DataView(d.buffer),f=new DataView(u.buffer,u.length-m,m);return{id:Mc(p),len:Mc(f)}}async function i(d){let u=0;for(;d>0;){if(u++,u>Vj||Gn(n,c,zt))return;const m=n.position,p=await s();if(p.id===17026){if(p.len>Hc)return;const f=fl(p.len,Hc,"EBML DocType");return(await n.readToken(new gr(f))).replaceAll(/\00.*$/g,"")}if(mt(n)&&(!Number.isFinite(p.len)||p.len<0||p.len>Wc)||(await Dr(n,p.len,{maximumLength:mt(n)?Wc:n.fileInfo.size,reason:"EBML payload"}),--d,n.position<=m))return}}const l=await s(),c=n.position;switch(await i(l.len)){case"webm":return{ext:"webm",mime:"video/webm"};case"matroska":return{ext:"mkv",mime:"video/matroska"};default:return}}if(this.checkString("SQLi"))return{ext:"sqlite",mime:"application/x-sqlite3"};if(this.check([78,69,83,26]))return{ext:"nes",mime:"application/x-nintendo-nes-rom"};if(this.checkString("Cr24"))return{ext:"crx",mime:"application/x-google-chrome-extension"};if(this.checkString("MSCF")||this.checkString("ISc("))return{ext:"cab",mime:"application/vnd.ms-cab-compressed"};if(this.check([237,171,238,219]))return{ext:"rpm",mime:"application/x-rpm"};if(this.check([197,208,211,198]))return{ext:"eps",mime:"application/eps"};if(this.check([40,181,47,253]))return{ext:"zst",mime:"application/zstd"};if(this.check([127,69,76,70]))return{ext:"elf",mime:"application/x-elf"};if(this.check([33,66,68,78]))return{ext:"pst",mime:"application/vnd.ms-outlook"};if(this.checkString("PAR1")||this.checkString("PARE"))return{ext:"parquet",mime:"application/vnd.apache.parquet"};if(this.checkString("ttcf"))return{ext:"ttc",mime:"font/collection"};if(this.check([254,237,250,206])||this.check([254,237,250,207])||this.check([206,250,237,254])||this.check([207,250,237,254]))return{ext:"macho",mime:"application/x-mach-binary"};if(this.check([4,34,77,24]))return{ext:"lz4",mime:"application/x-lz4"};if(this.checkString("regf"))return{ext:"dat",mime:"application/x-ft-windows-registry-hive"};if(this.checkString("$FL2")||this.checkString("$FL3"))return{ext:"sav",mime:"application/x-spss-sav"};if(this.check([79,84,84,79,0]))return{ext:"otf",mime:"font/otf"};if(this.checkString("#!AMR"))return{ext:"amr",mime:"audio/amr"};if(this.checkString("{\\rtf"))return{ext:"rtf",mime:"application/rtf"};if(this.check([70,76,86,1]))return{ext:"flv",mime:"video/x-flv"};if(this.checkString("IMPM"))return{ext:"it",mime:"audio/x-it"};if(this.checkString("-lh0-",{offset:2})||this.checkString("-lh1-",{offset:2})||this.checkString("-lh2-",{offset:2})||this.checkString("-lh3-",{offset:2})||this.checkString("-lh4-",{offset:2})||this.checkString("-lh5-",{offset:2})||this.checkString("-lh6-",{offset:2})||this.checkString("-lh7-",{offset:2})||this.checkString("-lzs-",{offset:2})||this.checkString("-lz4-",{offset:2})||this.checkString("-lz5-",{offset:2})||this.checkString("-lhd-",{offset:2}))return{ext:"lzh",mime:"application/x-lzh-compressed"};if(this.check([0,0,1,186])){if(this.check([33],{offset:4,mask:[241]}))return{ext:"mpg",mime:"video/MP1S"};if(this.check([68],{offset:4,mask:[196]}))return{ext:"mpg",mime:"video/MP2P"}}if(this.checkString("ITSF"))return{ext:"chm",mime:"application/vnd.ms-htmlhelp"};if(this.check([202,254,186,190])){const a=Oc.get(this.buffer,4),s=mn.get(this.buffer,6);if(a>0&&a<=30)return{ext:"macho",mime:"application/x-mach-binary"};if(s>30)return{ext:"class",mime:"application/java-vm"}}if(this.checkString(".RMF"))return{ext:"rm",mime:"application/vnd.rn-realmedia"};if(this.checkString("DRACO"))return{ext:"drc",mime:"application/vnd.google.draco"};if(this.check([253,55,122,88,90,0]))return{ext:"xz",mime:"application/x-xz"};if(this.checkString("<?xml "))return{ext:"xml",mime:"application/xml"};if(this.check([55,122,188,175,39,28]))return{ext:"7z",mime:"application/x-7z-compressed"};if(this.check([82,97,114,33,26,7])&&(this.buffer[6]===0||this.buffer[6]===1))return{ext:"rar",mime:"application/x-rar-compressed"};if(this.checkString("solid "))return{ext:"stl",mime:"model/stl"};if(this.checkString("AC")){const a=new gr(4,"latin1").get(this.buffer,2);if(a.match("^d*")&&a>=1e3&&a<=1050)return{ext:"dwg",mime:"image/vnd.dwg"}}if(this.checkString("070707"))return{ext:"cpio",mime:"application/x-cpio"};if(this.checkString("BLENDER"))return{ext:"blend",mime:"application/x-blender"};if(this.checkString("!<arch>"))return await n.ignore(8),await n.readToken(new gr(13,"ascii"))==="debian-binary"?{ext:"deb",mime:"application/x-deb"}:{ext:"ar",mime:"application/x-unix-archive"};if(this.checkString("WEBVTT")&&[`
|
|
80
|
+
`,"\r"," "," ","\0"].some(a=>this.checkString(a,{offset:6})))return{ext:"vtt",mime:"text/vtt"};if(this.check([137,80,78,71,13,10,26,10])){const a={ext:"png",mime:"image/png"},s={ext:"apng",mime:"image/apng"};await n.ignore(8);async function i(){return{length:await n.readToken(sj),type:await n.readToken(new gr(4,"latin1"))}}const l=mt(n),c=n.position;let d=0,u=!1;do{if(d++,d>Bj||Gn(n,c,Uj))break;const m=n.position,p=await i();if(p.length<0)return;if(p.type==="IHDR"){if(p.length!==13)return;u=!0}switch(p.type){case"IDAT":return a;case"acTL":return s;default:if(!u&&p.type!=="CgBI")return;if(l&&p.length>Gc)return u&&ek(p.type)?a:void 0;try{await Dr(n,p.length+4,{maximumLength:l?Gc+4:n.fileInfo.size,reason:"PNG chunk payload"})}catch(f){if(!l&&(f instanceof Kr||f instanceof et))return a;throw f}}if(n.position<=m)break}while(n.position+8<n.fileInfo.size);return a}if(this.check([65,82,82,79,87,49,0,0]))return{ext:"arrow",mime:"application/vnd.apache.arrow.file"};if(this.check([103,108,84,70,2,0,0,0]))return{ext:"glb",mime:"model/gltf-binary"};if(this.check([102,114,101,101],{offset:4})||this.check([109,100,97,116],{offset:4})||this.check([109,111,111,118],{offset:4})||this.check([119,105,100,101],{offset:4}))return{ext:"mov",mime:"video/quicktime"};if(this.check([73,73,82,79,8,0,0,0,24]))return{ext:"orf",mime:"image/x-olympus-orf"};if(this.checkString("gimp xcf "))return{ext:"xcf",mime:"image/x-xcf"};if(this.checkString("ftyp",{offset:4})&&this.buffer[8]&96){const a=new gr(4,"latin1").get(this.buffer,8).replace("\0"," ").trim();switch(a){case"avif":case"avis":return{ext:"avif",mime:"image/avif"};case"mif1":return{ext:"heic",mime:"image/heif"};case"msf1":return{ext:"heic",mime:"image/heif-sequence"};case"heic":case"heix":return{ext:"heic",mime:"image/heic"};case"hevc":case"hevx":return{ext:"heic",mime:"image/heic-sequence"};case"qt":return{ext:"mov",mime:"video/quicktime"};case"M4V":case"M4VH":case"M4VP":return{ext:"m4v",mime:"video/x-m4v"};case"M4P":return{ext:"m4p",mime:"video/mp4"};case"M4B":return{ext:"m4b",mime:"audio/mp4"};case"M4A":return{ext:"m4a",mime:"audio/x-m4a"};case"F4V":return{ext:"f4v",mime:"video/mp4"};case"F4P":return{ext:"f4p",mime:"video/mp4"};case"F4A":return{ext:"f4a",mime:"audio/mp4"};case"F4B":return{ext:"f4b",mime:"audio/mp4"};case"crx":return{ext:"cr3",mime:"image/x-canon-cr3"};default:return a.startsWith("3g")?a.startsWith("3g2")?{ext:"3g2",mime:"video/3gpp2"}:{ext:"3gp",mime:"video/3gpp"}:{ext:"mp4",mime:"video/mp4"}}}if(this.checkString(`REGEDIT4\r
|
|
81
|
+
`))return{ext:"reg",mime:"application/x-ms-regedit"};if(this.check([82,73,70,70])){if(this.checkString("WEBP",{offset:8}))return{ext:"webp",mime:"image/webp"};if(this.check([65,86,73],{offset:8}))return{ext:"avi",mime:"video/vnd.avi"};if(this.check([87,65,86,69],{offset:8}))return{ext:"wav",mime:"audio/wav"};if(this.check([81,76,67,77],{offset:8}))return{ext:"qcp",mime:"audio/qcelp"}}if(this.check([73,73,85,0,24,0,0,0,136,231,116,216]))return{ext:"rw2",mime:"image/x-panasonic-rw2"};if(this.check([48,38,178,117,142,102,207,17,166,217])){let a=!1;try{async function s(){const d=new Uint8Array(16);return await gs(n,d,void 0,{maximumLength:d.length,reason:"ASF header GUID"}),{id:d,size:Number(await n.readToken(ij))}}await Dr(n,30,{maximumLength:30,reason:"ASF header prelude"});const i=mt(n),l=n.position;let c=0;for(;n.position+24<n.fileInfo.size&&(c++,!(c>Hj||Gn(n,l,zt)));){const d=n.position,u=await s();let m=u.size-24;if(!Number.isFinite(m)||m<0){a=!0;break}if(nr(u.id,[145,7,220,183,183,169,207,17,142,230,0,192,12,32,83,101])){const p=new Uint8Array(16);if(m-=await gs(n,p,void 0,{maximumLength:p.length,reason:"ASF stream type GUID"}),nr(p,[64,158,105,248,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"audio/x-ms-asf"};if(nr(p,[192,239,25,188,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"video/x-ms-asf"};break}if(i&&m>Xc){a=!0;break}if(await Dr(n,m,{maximumLength:i?Xc:n.fileInfo.size,reason:"ASF header payload"}),n.position<=d){a=!0;break}}}catch(s){if(s instanceof et||s instanceof Kr)mt(n)&&(a=!0);else throw s}return a?void 0:{ext:"asf",mime:"application/vnd.ms-asf"}}if(this.check([171,75,84,88,32,49,49,187,13,10,26,10]))return{ext:"ktx",mime:"image/ktx"};if((this.check([126,16,4])||this.check([126,24,4]))&&this.check([48,77,73,69],{offset:4}))return{ext:"mie",mime:"application/x-mie"};if(this.check([39,10,0,0,0,0,0,0,0,0,0,0],{offset:2}))return{ext:"shp",mime:"application/x-esri-shape"};if(this.check([255,79,255,81]))return{ext:"j2c",mime:"image/j2c"};if(this.check([0,0,0,12,106,80,32,32,13,10,135,10]))switch(await n.ignore(20),await n.readToken(new gr(4,"ascii"))){case"jp2 ":return{ext:"jp2",mime:"image/jp2"};case"jpx ":return{ext:"jpx",mime:"image/jpx"};case"jpm ":return{ext:"jpm",mime:"image/jpm"};case"mjp2":return{ext:"mj2",mime:"image/mj2"};default:return}if(this.check([255,10])||this.check([0,0,0,12,74,88,76,32,13,10,135,10]))return{ext:"jxl",mime:"image/jxl"};if(this.check([254,255]))return this.checkString("<?xml ",{offset:2,encoding:"utf-16be"})?{ext:"xml",mime:"application/xml"}:void 0;if(this.check([208,207,17,224,161,177,26,225]))return{ext:"cfb",mime:"application/x-cfb"};if(await n.peekBuffer(this.buffer,{length:Math.min(256,n.fileInfo.size),mayBeLess:!0}),this.check([97,99,115,112],{offset:36}))return{ext:"icc",mime:"application/vnd.iccprofile"};if(this.checkString("**ACE",{offset:7})&&this.checkString("**",{offset:12}))return{ext:"ace",mime:"application/x-ace-compressed"};if(this.checkString("BEGIN:")){if(this.checkString("VCARD",{offset:6}))return{ext:"vcf",mime:"text/vcard"};if(this.checkString("VCALENDAR",{offset:6}))return{ext:"ics",mime:"text/calendar"}}if(this.checkString("FUJIFILMCCD-RAW"))return{ext:"raf",mime:"image/x-fujifilm-raf"};if(this.checkString("Extended Module:"))return{ext:"xm",mime:"audio/x-xm"};if(this.checkString("Creative Voice File"))return{ext:"voc",mime:"audio/x-voc"};if(this.check([4,0,0,0])&&this.buffer.length>=16){const a=new DataView(this.buffer.buffer).getUint32(12,!0);if(a>12&&this.buffer.length>=a+16)try{const s=new TextDecoder().decode(this.buffer.subarray(16,a+16));if(JSON.parse(s).files)return{ext:"asar",mime:"application/x-asar"}}catch{}}if(this.check([6,14,43,52,2,5,1,1,13,1,2,1,1,2]))return{ext:"mxf",mime:"application/mxf"};if(this.checkString("SCRM",{offset:44}))return{ext:"s3m",mime:"audio/x-s3m"};if(this.check([71])&&this.check([71],{offset:188}))return{ext:"mts",mime:"video/mp2t"};if(this.check([71],{offset:4})&&this.check([71],{offset:196}))return{ext:"mts",mime:"video/mp2t"};if(this.check([66,79,79,75,77,79,66,73],{offset:60}))return{ext:"mobi",mime:"application/x-mobipocket-ebook"};if(this.check([68,73,67,77],{offset:128}))return{ext:"dcm",mime:"application/dicom"};if(this.check([76,0,0,0,1,20,2,0,0,0,0,0,192,0,0,0,0,0,0,70]))return{ext:"lnk",mime:"application/x.ms.shortcut"};if(this.check([98,111,111,107,0,0,0,0,109,97,114,107,0,0,0,0]))return{ext:"alias",mime:"application/x.apple.alias"};if(this.checkString("Kaydara FBX Binary \0"))return{ext:"fbx",mime:"application/x.autodesk.fbx"};if(this.check([76,80],{offset:34})&&(this.check([0,0,1],{offset:8})||this.check([1,0,2],{offset:8})||this.check([2,0,2],{offset:8})))return{ext:"eot",mime:"application/vnd.ms-fontobject"};if(this.check([6,6,237,245,216,29,70,229,189,49,239,231,254,116,183,29]))return{ext:"indd",mime:"application/x-indesign"};if(this.check([255,255,0,0,7,0,0,0,4,0,0,0,1,0,1,0])||this.check([0,0,255,255,0,0,0,7,0,0,0,4,0,1,0,1]))return{ext:"jmp",mime:"application/x-jmp-data"};if(await n.peekBuffer(this.buffer,{length:Math.min(512,n.fileInfo.size),mayBeLess:!0}),this.checkString("ustar",{offset:257})&&(this.checkString("\0",{offset:262})||this.checkString(" ",{offset:262}))||this.check([0,0,0,0,0,0],{offset:257})&&Pj(this.buffer))return{ext:"tar",mime:"application/x-tar"};if(this.check([255,254])){const a="utf-16le";return this.checkString("<?xml ",{offset:2,encoding:a})?{ext:"xml",mime:"application/xml"}:this.check([255,14],{offset:2})&&this.checkString("SketchUp Model",{offset:4,encoding:a})?{ext:"skp",mime:"application/vnd.sketchup.skp"}:this.checkString(`Windows Registry Editor Version 5.00\r
|
|
82
|
+
`,{offset:2,encoding:a})?{ext:"reg",mime:"application/x-ms-regedit"}:void 0}if(this.checkString("-----BEGIN PGP MESSAGE-----"))return{ext:"pgp",mime:"application/pgp-encrypted"}}),Pc(this,"detectImprecise",async n=>{this.buffer=new Uint8Array(qn);const a=dk(n.fileInfo.size);if(await n.peekBuffer(this.buffer,{length:Math.min(8,a),mayBeLess:!0}),this.check([0,0,1,186])||this.check([0,0,1,179]))return{ext:"mpg",mime:"video/mpeg"};if(this.check([0,1,0,0,0]))return{ext:"ttf",mime:"font/ttf"};if(this.check([0,0,1,0]))return{ext:"ico",mime:"image/x-icon"};if(this.check([0,0,2,0]))return{ext:"cur",mime:"image/x-icon"};if(await n.peekBuffer(this.buffer,{length:Math.min(2+this.options.mpegOffsetTolerance,a),mayBeLess:!0}),this.buffer.length>=2+this.options.mpegOffsetTolerance)for(let s=0;s<=this.options.mpegOffsetTolerance;++s){const i=this.scanMpeg(s);if(i)return i}});const r=ck(t==null?void 0:t.mpegOffsetTolerance);this.options={...t,mpegOffsetTolerance:r},this.detectors=[...this.options.customDetectors??[],{id:"core",detect:this.detectConfident},{id:"core.imprecise",detect:this.detectImprecise}],this.tokenizerOptions={abortSignal:this.options.signal},this.gzipProbeDepth=0}getTokenizerOptions(){return{...this.tokenizerOptions}}createTokenizerFromWebStream(t){return Kj(gj(t,this.getTokenizerOptions()))}async parseTokenizer(t,r=0){this.detectionReentryCount=r;const n=t.position;for(const a of this.detectors){let s;try{s=await a.detect(t)}catch(i){if(i instanceof et||i instanceof Kr)return;throw i}if(s)return s;if(n!==t.position)return}}async fromTokenizer(t){try{return await this.parseTokenizer(t)}finally{await t.close()}}async fromBuffer(t){if(!(t instanceof Uint8Array||t instanceof ArrayBuffer))throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof t}\``);const r=t instanceof Uint8Array?t:new Uint8Array(t);if((r==null?void 0:r.length)>1)return this.fromTokenizer(vj(r,this.getTokenizerOptions()))}async fromBlob(t){var r;(r=this.options.signal)==null||r.throwIfAborted();const n=bj(t,this.getTokenizerOptions());return this.fromTokenizer(n)}async fromStream(t){var r;(r=this.options.signal)==null||r.throwIfAborted();const n=this.createTokenizerFromWebStream(t);return this.fromTokenizer(n)}async toDetectionStream(t,r){const n=ik((r==null?void 0:r.sampleSize)??qn);let a,s;const i=t.getReader({mode:"byob"});try{const{value:d,done:u}=await lk(i,new Uint8Array(n),this.options.signal);if(s=d,!u&&d)try{a=await this.fromBuffer(d.subarray(0,n))}catch(m){if(!(m instanceof et))throw m;a=void 0}s=d}finally{i.releaseLock()}const l=new TransformStream({async start(d){d.enqueue(s)},transform(d,u){u.enqueue(d)}}),c=t.pipeThrough(l);return c.fileType=a,c}async detectGzip(t){var r;if(this.gzipProbeDepth>=Mj)return{ext:"gz",mime:"application/gzip"};const n=new Dj(t),a=ok(n.inflate(),Lj),s=mt(t);let i,l,c,d;if(s){const u=new AbortController;i=setTimeout(()=>{u.abort(new DOMException(`Operation timed out after ${Uc} ms`,"TimeoutError"))},Uc),l=this.options.signal===void 0?u.signal:AbortSignal.any([this.options.signal,u.signal]),c=new hl({...this.options,signal:l}),c.gzipProbeDepth=this.gzipProbeDepth+1}else this.gzipProbeDepth++;try{d=await(c??this).fromStream(a)}catch(u){if((u==null?void 0:u.name)==="AbortError"&&((r=l==null?void 0:l.reason)==null?void 0:r.name)!=="TimeoutError")throw u}finally{clearTimeout(i),s||this.gzipProbeDepth--}return(d==null?void 0:d.ext)==="tar"?{ext:"tar.gz",mime:"application/gzip"}:{ext:"gz",mime:"application/gzip"}}check(t,r){return nr(this.buffer,t,r)}checkString(t,r){return this.check(Rj(t,r==null?void 0:r.encoding),r)}async readTiffTag(t){const r=await this.tokenizer.readToken(t?mn:We);switch(await this.tokenizer.ignore(10),r){case 50341:return{ext:"arw",mime:"image/x-sony-arw"};case 50706:return{ext:"dng",mime:"image/x-adobe-dng"}}}async readTiffIFD(t){const r=await this.tokenizer.readToken(t?mn:We);if(!(r>Wj)&&!(mt(this.tokenizer)&&2+r*12>Zc))for(let n=0;n<r;++n){const a=await this.readTiffTag(t);if(a)return a}}async readTiffHeader(t){const r={ext:"tif",mime:"image/tiff"},n=(t?mn:We).get(this.buffer,2),a=(t?Oc:Ze).get(this.buffer,4);if(n===42){if(a>=6){if(this.checkString("CR",{offset:8}))return{ext:"cr2",mime:"image/x-canon-cr2"};if(a>=8){const l=(t?mn:We).get(this.buffer,8),c=(t?mn:We).get(this.buffer,10);if(l===28&&c===254||l===31&&c===11)return{ext:"nef",mime:"image/x-nikon-nef"}}}if(mt(this.tokenizer)&&a>qj)return r;const s=mt(this.tokenizer)?Zc:this.tokenizer.fileInfo.size;try{await Dr(this.tokenizer,a,{maximumLength:s,reason:"TIFF IFD offset"})}catch(l){if(l instanceof et)return;throw l}let i;try{i=await this.readTiffIFD(t)}catch(l){if(l instanceof et)return;throw l}return i??r}if(n===43)return r}scanMpeg(t){if(this.check([255,224],{offset:t,mask:[255,224]})){if(this.check([16],{offset:t+1,mask:[22]}))return this.check([8],{offset:t+1,mask:[8]})?{ext:"aac",mime:"audio/aac"}:{ext:"aac",mime:"audio/aac"};if(this.check([2],{offset:t+1,mask:[6]}))return{ext:"mp3",mime:"audio/mpeg"};if(this.check([4],{offset:t+1,mask:[6]}))return{ext:"mp2",mime:"audio/mpeg"};if(this.check([6],{offset:t+1,mask:[6]}))return{ext:"mp1",mime:"audio/mpeg"}}}}new Set(Ij);new Set(Oj);const Qc=e=>e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`,xl=({name:e,control:t,disabled:r,campo:n,fileTypes:a,maxFileSize:s})=>{var i;const{field:l,fieldState:c}=Ee.useController({name:e,control:t}),{uploadFile:d,deleteUploadedFile:u}=Cr(),[m,p]=N.useState({status:"idle"}),f=N.useRef(null),[v,h]=N.useState(!1),x=N.useRef(!0);N.useEffect(()=>()=>{x.current=!1},[]);const b=typeof l.value=="string"&&l.value?l.value:null,y=N.useCallback(async S=>{var $;if(a&&a.length>0){const k=await sk(S),E=(k==null?void 0:k.ext)??"",T=(k==null?void 0:k.mime)??"",O=(($=S.name.split(".").pop())==null?void 0:$.toLowerCase())??"",L=S.type.toLowerCase();if(!a.some(A=>{const z=A.toLowerCase();return!!(E&&(z===E||z===T)||T&&z.endsWith("/*")&&T.startsWith(z.slice(0,-1))||!E&&(z===O||z===L||z.endsWith("/*")&&L.startsWith(z.slice(0,-1))))})){p({status:"error",message:`Tipo de arquivo não permitido. Permitidos: ${a.join(", ")}`});return}}if(s&&S.size>s){p({status:"error",message:`Arquivo muito grande. Tamanho máximo: ${Qc(s)}`});return}if(!d){p({status:"error",message:"Preview: upload não disponível sem configuração."});return}p({status:"uploading",fileName:S.name,progress:0});try{if(b&&u)try{await u(b)}catch{}const k=await d(S,n??e,E=>{x.current&&p(T=>T.status==="uploading"?{...T,progress:Math.min(100,E)}:T)});if(!x.current)return;l.onChange(k),p({status:"done",uploadId:k,fileName:S.name,size:S.size})}catch{if(!x.current)return;p({status:"error",message:"Falha no upload. Tente novamente."})}},[d,u,b,n,e,l,a,s]),j=N.useCallback(S=>{var $;const k=($=S.target.files)==null?void 0:$[0];k&&y(k),S.target.value=""},[y]),w=N.useCallback(()=>{b&&u&&u(b).catch(()=>{}),l.onChange(""),p({status:"idle"}),f.current&&(f.current.value="")},[l,b,u]);if(m.status==="done"||m.status==="idle"&&b){const S=m.status==="done"?m.fileName:"Arquivo enviado",$=m.status==="done"?m.size:null;return o.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-green-500 bg-green-500/5 px-4 py-3 gap-2",children:[o.jsxs("svg",{className:"shrink-0 text-green-500",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[o.jsx("rect",{width:"20",height:"20",rx:"4",fill:"currentColor",fillOpacity:"0.15"}),o.jsx("path",{d:"M5 10.5L8.5 14L15 7",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),o.jsx("span",{className:"text-sm font-medium truncate flex-1",children:S}),$!==null&&o.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:Qc($)}),!r&&o.jsx("button",{type:"button",onClick:w,className:"ml-2 shrink-0 text-muted-foreground hover:text-destructive transition-colors","aria-label":"Remover arquivo",children:"✕"})]})}if(m.status==="uploading"){const{fileName:S,progress:$}=m;return o.jsxs("div",{className:"rounded-lg border border-input px-4 py-3 space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-sm font-medium truncate flex-1",children:S}),o.jsxs("span",{className:"text-xs text-muted-foreground ml-2",children:[$,"%"]})]}),o.jsx("div",{className:"h-2 rounded-full bg-muted overflow-hidden",children:o.jsx("div",{className:"h-full bg-primary transition-all duration-200 rounded-full",style:{width:`${$}%`}})})]})}const C=m.status==="error";return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{role:"button",tabIndex:r?-1:0,"aria-label":"Selecionar arquivo",className:K("flex items-center justify-center rounded-lg border-2 border-dashed px-4 py-6 transition-colors cursor-pointer",v?"border-primary bg-primary/5":C||c.error?"border-destructive bg-destructive/5":"border-input hover:border-muted-foreground hover:bg-muted/20",r&&"opacity-50 cursor-not-allowed"),onClick:()=>{var S;return!r&&((S=f.current)==null?void 0:S.click())},onKeyDown:S=>{var $;(S.key==="Enter"||S.key===" ")&&(($=f.current)==null||$.click())},onDragOver:S=>{S.preventDefault(),r||h(!0)},onDragLeave:()=>h(!1),onDrop:r?void 0:S=>{var $;S.preventDefault(),h(!1);const k=($=S.dataTransfer.files)==null?void 0:$[0];k&&y(k)},onBlur:l.onBlur,children:[o.jsx("input",{ref:f,type:"file",onChange:j,disabled:r,className:"sr-only"}),o.jsx("span",{className:"text-sm text-muted-foreground",children:v?"Solte o arquivo aqui":"Clique ou arraste um arquivo"})]}),C&&o.jsxs("p",{className:"text-sm text-destructive",children:[m.message," · ",o.jsx("button",{type:"button",className:"underline hover:no-underline",onClick:()=>p({status:"idle"}),children:"Tentar novamente"})]}),!C&&((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})},xk={cpf:e=>e.replace(/\D/g,"").slice(0,11).replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d{1,2})$/,"$1-$2"),telefone:e=>{const t=e.replace(/\D/g,"").slice(0,11);return t.length<=10?t.replace(/(\d{2})(\d)/,"($1) $2").replace(/(\d{4})(\d)/,"$1-$2"):t.replace(/(\d{2})(\d)/,"($1) $2").replace(/(\d{5})(\d)/,"$1-$2")},cep:e=>e.replace(/\D/g,"").slice(0,8).replace(/(\d{5})(\d)/,"$1-$2")},_r=({name:e,control:t,placeholder:r,maskType:n,disabled:a,readOnly:s})=>{var i;const{field:l,fieldState:c}=Ee.useController({name:e,control:t}),d=xk[n||""],u=N.useCallback(m=>{l.onChange(d?d(m.target.value):m.target.value)},[l,d]);return o.jsxs("div",{className:"space-y-1",children:[o.jsx(ue,{name:l.name,value:l.value||"",onChange:u,onBlur:l.onBlur,placeholder:r,disabled:a,readOnly:s,className:K(c.error&&"border-destructive focus-visible:ring-destructive")}),((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})},Bo=({name:e,control:t})=>{const{field:r}=Ee.useController({name:e,control:t});return o.jsx("input",{type:"hidden",...r,value:r.value??""})},hh=e=>e.replace(/\D/g,""),gk=e=>{const t=hh(e).slice(0,8);return t.length<=5?t:`${t.slice(0,5)}-${t.slice(5)}`},vk=async(e,t)=>{const r=await fetch(`https://viacep.com.br/ws/${e}/json/`,{signal:t});if(!r.ok)throw new Error("Falha ao consultar CEP");return r.json()},gl=({name:e,control:t,placeholder:r="00000-000",disabled:n,readOnly:a,cepFillMap:s})=>{var i,l;const{field:c,fieldState:d}=Ee.useController({name:e,control:t}),{setValue:u}=Ee.useFormContext(),{cepLookup:m}=Cr(),[p,f]=N.useState("idle"),[v,h]=N.useState(null),x=N.useRef(null),b=N.useRef(!0);N.useEffect(()=>()=>{var w;b.current=!1,(w=x.current)==null||w.abort()},[]);const y=N.useCallback(async()=>{var w;c.onBlur();const C=hh(c.value??"");if(C.length===8){(w=x.current)==null||w.abort(),x.current=new AbortController,f("loading"),h(null);try{let S;if(m){const E=x.current;if(S=await m(C,E.signal),E.signal.aborted||!b.current)return}else{const E=await vk(C,x.current.signal);if(!b.current)return;if(E.erro){f("error"),h("CEP não encontrado");return}S={logradouro:E.logradouro,bairro:E.bairro,cidade:E.localidade,estado:E.uf}}if(!b.current)return;if(S.erro){f("error"),h("CEP não encontrado");return}const $=e.includes(".")?`${e.substring(0,e.lastIndexOf("."))}.`:"",k=(E,T,O)=>{if(!O)return;const L=s!=null&&s[E]?`${$}${s[E]}`:`${$}${T}`;u(L,O,{shouldDirty:!0,shouldValidate:!0})};k("logradouro","_address_logradouro",S.logradouro),k("bairro","_address_bairro",S.bairro),k("cidade","_address_cidade",S.cidade),k("estado","_address_estado",S.estado),f("success")}catch(S){if(S instanceof Error&&S.name==="AbortError"||!b.current)return;f("error"),h("Erro ao buscar CEP")}}},[c,m,u,e,s]),j=N.useCallback(w=>{c.onChange(gk(w.target.value))},[c]);return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"relative",children:[o.jsx(ue,{name:c.name,value:c.value||"",onChange:j,onBlur:y,placeholder:r,disabled:n,readOnly:a,className:K("pr-9",d.error&&"border-destructive focus-visible:ring-destructive")}),o.jsxs("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none",children:[p==="loading"&&o.jsx(I.Loader2,{className:"h-4 w-4 animate-spin text-muted-foreground"}),p==="success"&&o.jsx(I.Check,{className:"h-4 w-4 text-green-500"}),p==="error"&&o.jsx(I.AlertCircle,{className:"h-4 w-4 text-destructive"})]})]}),(((i=d.error)==null?void 0:i.message)||v)&&o.jsx("p",{className:"text-sm text-destructive",children:((l=d.error)==null?void 0:l.message)||v})]})},bk=({field:e,control:t,nameOverride:r})=>{const n={name:r,control:t,placeholder:e.placeholder};switch(e.tipo){case D.TEXTO:return o.jsx(Tt,{...n,type:"text"});case D.EMAIL:return o.jsx(Tt,{...n,type:"email"});case D.NUMBER:return o.jsx(Tt,{...n,type:"number"});case D.TEXTAREA:return o.jsx(zo,{...n});case D.SELECT:return o.jsx(Lo,{...n,options:e.opcoes??[]});case D.RADIO:return o.jsx(dl,{...n,options:e.opcoes??[]});case D.CHECKBOX:return o.jsx(Mo,{name:r,control:t,label:e.label});case D.CHECKBOX_GROUP:return o.jsx(cl,{...n,options:e.opcoes??[]});case D.DATE:return o.jsx(Tn,{...n,validacao:e.validacao});case D.DATETIME:return o.jsx(Tn,{...n,isDatetime:!0,validacao:e.validacao});case D.FILE:return o.jsx(xl,{name:r,control:t});case D.TELEFONE:return o.jsx(_r,{...n,maskType:"telefone"});case D.CPF:return o.jsx(_r,{...n,maskType:"cpf"});case D.CEP:return o.jsx(gl,{name:r,control:t,placeholder:e.placeholder});case D.HIDDEN:return o.jsx(Bo,{name:r,control:t});default:return console.error(`[DFFieldArray] Tipo de sub-campo "${e.tipo}" não suportado em FIELD_ARRAY. Usando DFTextField como fallback.`),o.jsx(Tt,{...n,type:"text"})}},xh=({name:e,control:t,subFields:r=[],minItems:n=1,maxItems:a,itemLabel:s="Item",addLabel:i})=>{var l;const{fields:c,append:d,remove:u}=Ee.useFieldArray({control:t,name:e}),{errors:m}=Ee.useFormState({control:t}),p=(l=m[e])==null?void 0:l.message,f=N.useCallback(()=>{const b={};for(const y of r)y.initialValue!==void 0?b[y.nome]=y.initialValue:y.defaultValue!==void 0&&(b[y.nome]=y.defaultValue);return b},[r]);N.useEffect(()=>{if(c.length<n)for(let b=c.length;b<n;b++)d(f())},[n]);const v=[...r].sort((b,y)=>b.ordem-y.ordem),h=!a||c.length<a,x=i??`Adicionar ${s.toLowerCase()}`;return o.jsxs("div",{className:"space-y-3",children:[c.map((b,y)=>o.jsxs("div",{className:"rounded-lg border border-input p-4",children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-primary/10 text-xs font-bold text-primary shrink-0",children:y+1}),o.jsxs("span",{className:"text-sm font-semibold",children:[s," ",y+1]})]}),c.length>n&&o.jsx(Ae,{type:"button",variant:"ghost",size:"icon",onClick:()=>u(y),"aria-label":`Remover ${s.toLowerCase()} ${y+1}`,className:"text-muted-foreground hover:text-destructive",children:o.jsx(I.Trash2,{className:"w-4 h-4"})})]}),o.jsx("div",{className:"grid grid-cols-12 gap-4",children:v.map(j=>{const w=`${e}.${y}.${j.nome}`,C=`span ${j.tamanho??12}`,S=o.jsx(bk,{field:j,control:t,nameOverride:w});return j.tipo===D.CHECKBOX||j.tipo===D.HIDDEN?o.jsx("div",{className:"max-sm:!col-span-12",style:{gridColumn:C},children:S},j.id):o.jsxs("div",{className:"max-sm:!col-span-12 space-y-2",style:{gridColumn:C},children:[o.jsxs("label",{className:"font-medium flex items-center gap-1 text-sm text-foreground",children:[j.label,j.obrigatorio&&o.jsx("span",{className:"text-destructive",children:"*"})]}),S,j.hint&&o.jsx("p",{className:"text-xs text-muted-foreground",children:j.hint})]},j.id)})})]},b.id)),h&&o.jsxs(Ae,{type:"button",variant:"outline",className:"w-full",onClick:()=>d(f()),children:[o.jsx(I.Plus,{className:"w-4 h-4"}),x]}),a&&o.jsxs("p",{className:"text-xs text-center text-muted-foreground",children:["Máximo de ",a," ",s.toLowerCase(),a>1?"s":""]}),p&&o.jsxs("p",{className:"text-sm text-destructive flex items-center gap-1",children:[o.jsx(I.AlertCircle,{className:"w-4 h-4 shrink-0"}),p]})]})},ed=e=>`R$ ${(e/100).toFixed(2).replace(".",",")}`,yk=(e,t)=>{const r=new Date(e.slice(0,10)+"T00:00:00Z"),n=new Date(t.slice(0,10)+"T00:00:00Z");return Math.round((n.getTime()-r.getTime())/864e5)+1},wk=(e,t)=>{const r=[],n=new Date(e.slice(0,10)+"T00:00:00Z"),a=new Date(t.slice(0,10)+"T00:00:00Z");let s=0;for(;n<=a&&s<60;)r.push(n.toISOString().slice(0,10)),n.setUTCDate(n.getUTCDate()+1),s++;return r},jk=e=>{const[t,r,n]=e.split("-").map(Number),a=new Date(Date.UTC(t,r-1,n)),s=String(n).padStart(2,"0"),i=String(r).padStart(2,"0"),l=new Intl.DateTimeFormat("pt-BR",{weekday:"long",timeZone:"UTC"}).format(a),c=l.charAt(0).toUpperCase()+l.slice(1);return`${s}/${i} - ${c}`},kk=(e,t)=>{const r=n=>{const[a,s,i]=n.slice(0,10).split("-");return`${i}/${s}/${a}`};return`${r(e)} a ${r(t)}`},gh=({name:e,control:t})=>{var r;const{field:n,fieldState:a}=Ee.useController({name:e,control:t}),{externalData:s={}}=Cr(),i=n.value??null,l=(r=a.error)==null?void 0:r.message,c=V=>s[`evento.${V}`]??s[V],d=c("dataInicioEvento")??"",u=c("dataFimEvento")??"",m=Number(c("valor")??0),p=Number(c("valorPorDia")??0),f=c("vagasTotal"),v=c("vagasPorDia"),h=c("vagasMasculinas"),x=c("vagasFemininas"),b=f!=null?Number(f):null,y=v!=null?Number(v):null,j=h!=null?Number(h):null,w=x!=null?Number(x):null,C=d&&u?wk(d,u):[],S=(d&&u?yk(d,u):0)>1,$=j!=null&&j>0&&w!=null&&w>0,k=j!=null&&w==null?"masculino":w!=null&&j==null?"feminino":null,E=(i==null?void 0:i.tipo)??null,T=(i==null?void 0:i.data)??null,O=(i==null?void 0:i.genero)??null,L=N.useRef(i);L.current=i;const A=N.useRef(n.onChange);A.current=n.onChange,N.useEffect(()=>{var V,M,_;k&&((V=L.current)==null?void 0:V.genero)!==k&&A.current({tipo:((M=L.current)==null?void 0:M.tipo)??null,data:((_=L.current)==null?void 0:_.data)??null,genero:k})},[k]);const z=V=>{const M={tipo:V,data:null};($||k)&&(M.genero=O??k??void 0),n.onChange(M)},X=V=>{const M={tipo:"por_dia",data:V};($||k)&&(M.genero=O??k??void 0),n.onChange(M)},q=V=>{n.onChange({tipo:E,data:T,genero:V})},Z=V=>E===V;return o.jsxs("div",{className:"space-y-3",children:[$&&o.jsxs("div",{className:"flex items-center gap-2 px-1",children:[o.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:"Você é:"}),o.jsx("div",{className:"flex gap-2",children:["masculino","feminino"].map(V=>o.jsx("button",{type:"button",onClick:()=>q(V),className:K("px-3 py-1 rounded-full text-xs font-medium border transition-all",O===V?"border-primary bg-primary/10 text-primary":"border-input text-muted-foreground hover:border-primary/50"),children:V==="masculino"?"Masculino":"Feminino"},V))})]}),o.jsxs("button",{type:"button",onClick:()=>z("todos_os_dias"),className:K("w-full text-left flex items-start gap-3 p-4 rounded-xl border-2 transition-all",Z("todos_os_dias")?"border-primary bg-primary/5":"border-input hover:border-primary/50"),children:[o.jsx("div",{className:K("mt-0.5 p-2 rounded-lg shrink-0 transition-colors",Z("todos_os_dias")?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"),children:o.jsx(I.CalendarCheck2,{className:"w-4 h-4"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"font-semibold text-sm",children:"Participar todos os dias"}),d&&u?o.jsx("p",{className:"text-xs text-muted-foreground",children:kk(d,u)}):o.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Datas do evento"})]}),o.jsxs("div",{className:"text-right shrink-0",children:[m>0&&o.jsx("p",{className:K("font-bold text-sm",Z("todos_os_dias")?"text-primary":"text-foreground"),children:ed(m)}),b!=null&&b>0&&o.jsxs("p",{className:"text-xs flex items-center justify-end gap-1 text-muted-foreground",children:[o.jsx(I.Users,{className:"w-3 h-3"}),b," vagas disponíveis"]})]})]}),S?o.jsxs("button",{type:"button",onClick:()=>z("por_dia"),className:K("w-full text-left flex items-start gap-3 p-4 rounded-xl border-2 transition-all",Z("por_dia")?"border-primary bg-primary/5":"border-input hover:border-primary/50"),children:[o.jsx("div",{className:K("mt-0.5 p-2 rounded-lg shrink-0 transition-colors",Z("por_dia")?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"),children:o.jsx(I.CalendarDays,{className:"w-4 h-4"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"font-semibold text-sm",children:"Participar um dia"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Escolha o dia desejado abaixo"})]}),o.jsxs("div",{className:"text-right shrink-0",children:[p>0&&o.jsx("p",{className:K("font-bold text-sm",Z("por_dia")?"text-primary":"text-foreground"),children:ed(p)}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"por dia"})]})]}):d?o.jsxs("div",{className:"flex items-start gap-2 px-3 py-2.5 rounded-lg border border-input bg-muted/30",children:[o.jsx(I.Info,{className:"w-3.5 h-3.5 mt-0.5 shrink-0 text-muted-foreground"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:'Este evento ocorre em apenas 1 dia — a opção "Participar um dia" não é necessária.'})]}):null,E==="por_dia"&&o.jsxs("div",{className:"pl-2 space-y-2",children:[o.jsx("p",{className:"text-xs font-semibold uppercase tracking-wide text-primary",children:"Selecione o dia:"}),C.length===0?o.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Nenhuma data configurada no evento"}):C.map(V=>o.jsxs("button",{type:"button",onClick:()=>X(V),className:K("w-full text-left flex items-center justify-between px-4 py-3 rounded-lg border transition-all",T===V?"border-primary bg-primary/5":"border-input hover:border-primary/50"),children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:K("w-4 h-4 rounded-full border-2 shrink-0 flex items-center justify-center transition-colors",T===V?"border-primary bg-primary":"border-input"),children:T===V&&o.jsx("span",{className:"w-2 h-2 rounded-full bg-white"})}),o.jsx("span",{className:"text-sm",children:jk(V)})]}),y!=null&&o.jsxs("span",{className:"text-xs text-muted-foreground",children:[y," vagas"]})]},V))]}),l&&o.jsx("p",{className:"text-sm text-destructive",children:l})]})},td=.0315,rd=.124,nd=7,ad=12,vh=[{id:"pix",label:"PIX",description:"Transferência instantânea (à vista)",Icon:I.Smartphone,taxa:0},{id:"dinheiro",label:"Dinheiro",description:"Pagamento em espécie",Icon:I.Banknote,taxa:0},{id:"cartao",label:"Cartão de Crédito",description:"Débito ou crédito na maquininha",Icon:I.CreditCard,taxa:td,taxaLabel:`Taxa: ${(td*100).toFixed(2).replace(".",",")}%`}],bh=[{id:"pix",label:"PIX à Vista",description:"Pagamento instantâneo sem parcelamento",Icon:I.Smartphone,taxa:0},{id:"pix_parcelado",label:"PIX Parcelado",description:`Parcelado em até ${nd}x sem juros`,Icon:I.Smartphone,taxa:0,parcelas:nd},{id:"cartao",label:"Cartão de Crédito",description:`Parcelado em até ${ad}x`,Icon:I.CreditCard,taxa:rd,parcelas:ad,taxaLabel:`Taxa: ${(rd*100).toFixed(2).replace(".",",")}%`},{id:"dinheiro",label:"Dinheiro",description:"Pagamento em espécie",Icon:I.Banknote,taxa:0}],$a=e=>`R$ ${(e/100).toFixed(2).replace(".",",")}`,od=(e,t)=>Math.round(e*(1+t)*100)/100,Ck=(e,t)=>Math.round(e/t*100)/100,yh=({name:e,control:t,relatedFieldName:r="tipo_participacao"})=>{var n;const{field:a,fieldState:s}=Ee.useController({name:e,control:t}),{externalData:i={},paymentMethodOptions:l}=Cr(),c=a.value??null,d=(n=s.error)==null?void 0:n.message,u=Ee.useWatch({control:t,name:r}),m=(u==null?void 0:u.tipo)??null,p=j=>i[`evento.${j}`]??i[j],f=Number(p("valor")??0),v=Number(p("valorPorDia")??0),h=m==="por_dia"&&v>0?v:f,x=m==="por_dia"?(l==null?void 0:l.porDia)??vh:(l==null?void 0:l.todosOsDias)??bh,b=m==="por_dia"?(()=>{if(!(u!=null&&u.data))return"Um dia";const j=u.data.split("-");if(j.length===3){const[w,C,S]=j;return`${S}/${C}/${w}`}return u.data})():"Todos os dias",y=j=>{if(j.disabled)return;const w=od(h,j.taxa),C={metodo:j.id,valorTotal:w};j.parcelas&&(C.parcelas=j.parcelas),a.onChange(C)};return o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between rounded-xl border border-input px-4 py-3",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"Tipo de participação"}),o.jsx("p",{className:"font-semibold",children:b})]}),o.jsxs("div",{className:"text-right",children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"Valor base"}),o.jsx("p",{className:"text-lg font-bold text-primary",children:$a(h)})]})]}),o.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-input bg-muted/30 px-3 py-2.5",children:[o.jsx(I.Info,{className:"h-4 w-4 mt-0.5 shrink-0 text-muted-foreground"}),o.jsxs("p",{className:"text-xs",children:[o.jsx("span",{className:"font-bold",children:"Importante:"})," Para validar a inscrição e garantir sua vaga, o pagamento deve ser realizado no ato da inscrição."]})]}),o.jsx("p",{className:"text-sm font-semibold text-primary",children:"Selecione a forma de pagamento:"}),o.jsx("div",{className:"space-y-3",children:x.map(j=>{const{Icon:w}=j,C=(c==null?void 0:c.metodo)===j.id,S=od(h,j.taxa),$=!!j.parcelas&&j.parcelas>1,k=$?Ck(S,j.parcelas):null;return o.jsxs("button",{type:"button",disabled:j.disabled,onClick:()=>y(j),className:K("w-full text-left flex items-center gap-4 px-4 py-3 rounded-xl border-2 transition-all",C?"border-primary bg-primary/5":"border-input hover:border-primary/50",j.disabled&&"opacity-50 cursor-not-allowed"),children:[o.jsx("div",{className:K("flex items-center justify-center w-10 h-10 rounded-lg shrink-0 transition-colors",C?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"),children:o.jsx(w,{className:"h-5 w-5"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"font-semibold text-sm leading-tight",children:j.label}),o.jsx("p",{className:"text-xs text-muted-foreground",children:j.description}),j.taxaLabel&&o.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:["* ",j.taxaLabel]}),j.taxa>0&&o.jsxs("p",{className:"text-xs text-muted-foreground",children:["Total com taxa: ",$a(S)]})]}),o.jsx("div",{className:"text-right shrink-0",children:$?o.jsxs(o.Fragment,{children:[o.jsxs("p",{className:"text-xs text-muted-foreground",children:[j.parcelas,"x de"]}),o.jsx("p",{className:"text-base font-bold text-primary",children:$a(k)})]}):o.jsx("p",{className:"text-base font-bold text-primary",children:$a(S)})})]},j.id)})}),d&&o.jsx("p",{className:"text-xs text-destructive",children:d})]})},wh=({name:e,control:t,label:r,termoTexto:n,termoPdfUrl:a,termoPdfUploadId:s})=>{var i;const{field:l,fieldState:c}=Ee.useController({name:e,control:t}),{resolveTermsUploadUrl:d}=Cr(),u=!!c.error,m=(i=c.error)==null?void 0:i.message,[p,f]=N.useState(null),[v,h]=N.useState(!1),[x,b]=N.useState(!1),y=N.useRef(null);N.useEffect(()=>{var $;x&&(($=y.current)==null||$.focus())},[x]),N.useEffect(()=>{if(!s||!d){f(null);return}let $=!1;return h(!0),d(s).then(k=>{$||f(k)}).catch(()=>{$||f(null)}).finally(()=>{$||h(!1)}),()=>{$=!0}},[s,d]);const j=l.value==="accepted",w=p||a||null,C=!!(n||w||s),S=!!w;return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:K("rounded-lg border p-4 space-y-4 transition-colors",u?"border-destructive bg-destructive/5":j?"border-green-500 bg-green-500/5":"border-input"),children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(I.ScrollText,{className:"h-4 w-4 shrink-0"}),o.jsx("span",{className:"text-sm font-medium",children:r||"Termos e condições"})]}),C?o.jsxs(Ae,{type:"button",variant:"outline",size:"sm",className:"h-7 px-2 text-xs",disabled:v,onClick:()=>b(!0),children:[v?o.jsx(I.Loader2,{className:"h-3 w-3 animate-spin"}):o.jsx(I.ExternalLink,{className:"h-3 w-3"}),"Ler termos"]}):o.jsx("span",{className:"text-xs text-muted-foreground italic",children:s&&v?"Carregando PDF...":"Conteúdo não configurado"})]}),o.jsxs("label",{className:"flex items-start gap-3 cursor-pointer select-none",children:[o.jsx(rt,{className:"mt-0.5",checked:j,onCheckedChange:$=>l.onChange($?"accepted":"")}),o.jsxs("span",{className:"text-sm leading-snug flex-1",children:["Li e aceito ",r?`"${r}"`:"os termos e condições"]}),j&&o.jsx(I.CheckCircle2,{className:"h-4 w-4 text-green-500 shrink-0 mt-0.5"})]})]}),u&&o.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-destructive",children:[o.jsx(I.AlertCircle,{className:"h-3.5 w-3.5 shrink-0"}),m||"Você precisa aceitar os termos para continuar"]}),x&&o.jsx("div",{ref:y,role:"dialog","aria-modal":"true","aria-label":"Termos e condições",tabIndex:-1,className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/60 outline-none",onClick:()=>b(!1),onKeyDown:$=>{$.key==="Escape"&&b(!1)},children:o.jsxs("div",{className:"relative w-full max-w-2xl max-h-[90vh] rounded-xl overflow-hidden flex flex-col bg-background shadow-xl",onClick:$=>$.stopPropagation(),children:[o.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-input",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(I.ScrollText,{className:"h-4 w-4"}),o.jsx("span",{className:"font-semibold",children:"Termos e condições"})]}),o.jsx(Ae,{type:"button",variant:"ghost",size:"icon",onClick:()=>b(!1),children:o.jsx(I.X,{className:"h-4 w-4"})})]}),o.jsx("div",{className:"flex-1 overflow-auto p-4",children:S?o.jsx("iframe",{src:w,className:"w-full rounded border",style:{height:"62vh"},title:"Termos e condições",sandbox:"allow-scripts"}):o.jsx("p",{className:"text-sm whitespace-pre-wrap leading-relaxed",children:n})})]})})]})},Nk=({name:e,control:t,placeholder:r,disabled:n,readOnly:a})=>{var s;const{field:i,fieldState:l}=Ee.useController({name:e,control:t}),[c,d]=N.useState(!1),u=!!l.error;return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"relative",children:[o.jsx(ue,{...i,value:i.value??"",type:c?"text":"password",placeholder:r,disabled:n,readOnly:a,className:K("pr-10",u&&"border-destructive focus-visible:ring-destructive")}),o.jsx("button",{type:"button",tabIndex:-1,onClick:()=>d(m=>!m),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors","aria-label":c?"Ocultar senha":"Mostrar senha",children:c?o.jsx(I.EyeOff,{size:16}):o.jsx(I.Eye,{size:16})})]}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},jh=({name:e,control:t,label:r,disabled:n,readOnly:a})=>{var s;const{field:i,fieldState:l}=Ee.useController({name:e,control:t}),c=!!i.value;return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("label",{className:"flex items-center gap-3 cursor-pointer select-none",children:[o.jsx(_i,{checked:c,onCheckedChange:d=>!a&&i.onChange(d),disabled:n||a,onBlur:i.onBlur}),o.jsx("span",{className:"text-sm leading-none",children:r})]}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},Sk=({name:e,control:t,minValue:r=0,maxValue:n=100,step:a=1,disabled:s,readOnly:i})=>{var l;const{field:c,fieldState:d}=Ee.useController({name:e,control:t}),u=c.value??r;return N.useEffect(()=>{(c.value===void 0||c.value===null)&&c.onChange(r)},[]),o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(So,{min:r,max:n,step:a,value:[u],onValueChange:m=>!i&&c.onChange(m[0]),disabled:s||i,className:"flex-1"}),o.jsx("span",{className:"text-sm font-medium text-primary min-w-[3rem] text-right tabular-nums",children:u})]}),o.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[o.jsx("span",{children:r}),o.jsx("span",{children:n})]}),((l=d.error)==null?void 0:l.message)&&o.jsx("p",{className:"text-sm text-destructive",children:d.error.message})]})},vs=e=>/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(e),$k=({name:e,control:t,disabled:r,readOnly:n})=>{var a;const{field:s,fieldState:i}=Ee.useController({name:e,control:t}),l=s.value||"#000000",[c,d]=N.useState(l);return N.useEffect(()=>{d(l)},[l]),o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("input",{type:"color",value:vs(l)?l:"#000000",disabled:r||n,onChange:u=>s.onChange(u.target.value),className:"h-10 w-14 cursor-pointer rounded-lg border border-input bg-transparent p-1 disabled:cursor-not-allowed disabled:opacity-50"}),o.jsx(ue,{type:"text",value:c,readOnly:n,disabled:r,onChange:u=>{const m=u.target.value;d(m),vs(m)&&s.onChange(m.toUpperCase())},onBlur:()=>{vs(c)||d(l),s.onBlur()},className:K("flex-1 font-mono uppercase",i.error&&"border-destructive focus-visible:ring-destructive"),maxLength:7,placeholder:"#000000"})]}),((a=i.error)==null?void 0:a.message)&&o.jsx("p",{className:"text-sm text-destructive",children:i.error.message})]})},Ek=({name:e,control:t,options:r,placeholder:n,disabled:a,readOnly:s})=>{var i,l;const{field:c,fieldState:d}=Ee.useController({name:e,control:t}),[u,m]=N.useState(""),[p,f]=N.useState(!1),[v,h]=N.useState(-1),x=N.useRef(null),b=N.useRef(null),y=`autocomplete-${e}-listbox`,j=((i=r.find(T=>T.valor===c.value))==null?void 0:i.label)??"",w=u.length>0?r.filter(T=>T.label.toLowerCase().includes(u.toLowerCase())):r;N.useEffect(()=>{const T=O=>{x.current&&!x.current.contains(O.target)&&(f(!1),m(""),h(-1))};return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[]);const C=()=>{f(!1),m(""),h(-1)};N.useEffect(()=>{if(v<0||!b.current)return;const T=b.current.querySelector(`[id="${y}-option-${v}"]`);T==null||T.scrollIntoView({block:"nearest"})},[v,y]);const S=T=>{T.disabled||(c.onChange(T.valor),C())},$=()=>{c.onChange(""),m(""),h(-1)},k=T=>{if(!p){(T.key==="ArrowDown"||T.key==="ArrowUp")&&(T.preventDefault(),f(!0),h(0));return}switch(T.key){case"ArrowDown":T.preventDefault(),h(O=>O<w.length-1?O+1:O);break;case"ArrowUp":T.preventDefault(),h(O=>O>0?O-1:0);break;case"Enter":T.preventDefault(),v>=0&&w[v]&&!w[v].disabled&&S(w[v]);break;case"Escape":T.preventDefault(),C();break;case"Tab":C();break}},E=p&&v>=0?`${y}-option-${v}`:void 0;return o.jsxs("div",{className:"space-y-1",ref:x,children:[o.jsxs("div",{className:"relative",children:[o.jsx(ue,{type:"text",role:"combobox","aria-expanded":p,"aria-haspopup":"listbox","aria-autocomplete":"list","aria-controls":y,"aria-activedescendant":E,value:p?u:j,placeholder:n??"Buscar...",disabled:a,readOnly:s,onChange:T=>{m(T.target.value),h(-1),f(!0)},onFocus:()=>!s&&f(!0),onKeyDown:k,className:K("pr-8",d.error&&"border-destructive focus-visible:ring-destructive"),autoComplete:"off"}),o.jsx("div",{className:"absolute right-2 top-1/2 -translate-y-1/2 flex items-center gap-1",children:c.value?o.jsx("button",{type:"button",onClick:$,className:"text-[var(--t-text-muted)] hover:text-[var(--t-text)]",tabIndex:-1,"aria-label":"Limpar seleção",children:o.jsx(I.X,{size:14})}):o.jsx(I.ChevronDown,{size:16,className:"text-muted-foreground pointer-events-none","aria-hidden":"true"})}),p&&!a&&!s&&o.jsx("ul",{role:"listbox",id:y,ref:b,"aria-label":"Opções disponíveis",className:"absolute z-50 mt-1 max-h-60 w-full overflow-auto rounded-lg border border-input bg-popover shadow-lg",children:w.length===0?o.jsx("li",{role:"option","aria-selected":!1,className:"px-3 py-2 text-sm text-muted-foreground",children:"Nenhuma opção encontrada"}):w.map((T,O)=>o.jsx("li",{id:`${y}-option-${O}`,role:"option","aria-selected":c.value===T.valor,"aria-disabled":T.disabled,onMouseDown:()=>S(T),className:["flex cursor-pointer items-center px-3 py-2 text-sm",T.disabled?"cursor-not-allowed opacity-40":O===v?"bg-accent":"hover:bg-accent",c.value===T.valor?"font-medium text-primary":"text-foreground"].join(" "),children:T.label},T.valor))})]}),((l=d.error)==null?void 0:l.message)&&o.jsx("p",{className:"text-sm text-destructive",role:"alert",children:d.error.message})]})},kh=({name:e,control:t,placeholder:r,disabled:n,readOnly:a})=>{var s;const{field:i,fieldState:l}=Ee.useController({name:e,control:t}),c=!!l.error;return o.jsxs("div",{className:"space-y-1",children:[o.jsx(ue,{...i,value:i.value??"",type:"time",placeholder:r,disabled:n,readOnly:a,className:K(c&&"border-destructive focus-visible:ring-destructive")}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},Tk=({name:e,control:t,startLabel:r="Data inicial",endLabel:n="Data final",disabled:a,readOnly:s})=>{var i;const{field:l,fieldState:c}=Ee.useController({name:e,control:t}),d=l.value??{},u=(p,f)=>{l.onChange({...d,[p]:f})},m=!!c.error;return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{children:r}),o.jsx(ue,{type:"date",value:d.start??"",disabled:a,readOnly:s,onChange:p=>u("start",p.target.value),max:d.end??void 0,className:K(m&&"border-destructive focus-visible:ring-destructive")})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{children:n}),o.jsx(ue,{type:"date",value:d.end??"",disabled:a,readOnly:s,onChange:p=>u("end",p.target.value),min:d.start??void 0,className:K(m&&"border-destructive focus-visible:ring-destructive")})]})]}),((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})},Ak=({name:e,control:t,maxRating:r=5,disabled:n,readOnly:a})=>{var s;const{field:i,fieldState:l}=Ee.useController({name:e,control:t}),c=i.value??0,d=Array.from({length:r},(u,m)=>m+1);return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-1",children:[d.map(u=>o.jsx("button",{type:"button",disabled:n||a,onClick:()=>i.onChange(u===c?0:u),className:"transition-transform hover:scale-110 disabled:cursor-not-allowed disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded","aria-label":`${u} estrela${u>1?"s":""}`,children:o.jsx(I.Star,{size:24,className:"transition-colors",fill:u<=c?"var(--color-primary)":"transparent",stroke:u<=c?"var(--color-primary)":"currentColor"})},u)),c>0&&o.jsxs("span",{className:"ml-2 text-sm text-muted-foreground",children:[c,"/",r]})]}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},Dk=({field:e,name:t,control:r,disabled:n,readOnly:a})=>{const s=n||e.isDisabled,i=a||e.isReadOnly;switch(e.tipo){case D.EMAIL:return o.jsx(Tt,{name:t,control:r,type:"email",placeholder:e.placeholder,disabled:s,readOnly:i});case D.NUMBER:return o.jsx(Tt,{name:t,control:r,type:"number",placeholder:e.placeholder,disabled:s,readOnly:i});case D.PASSWORD:return o.jsx(Tt,{name:t,control:r,type:"password",placeholder:e.placeholder,disabled:s,readOnly:i});case D.TELEFONE:return o.jsx(_r,{name:t,control:r,maskType:"telefone",placeholder:e.placeholder??"(00) 00000-0000",disabled:s,readOnly:i});case D.CPF:return o.jsx(_r,{name:t,control:r,maskType:"cpf",placeholder:e.placeholder??"000.000.000-00",disabled:s,readOnly:i});case D.CEP:return o.jsx(_r,{name:t,control:r,maskType:"cep",placeholder:e.placeholder??"00000-000",disabled:s,readOnly:i});case D.TEXTAREA:return o.jsx(zo,{name:t,control:r,placeholder:e.placeholder,disabled:s,readOnly:i});case D.SELECT:return o.jsx(Lo,{name:t,control:r,options:e.opcoes??[],placeholder:e.placeholder,disabled:s,readOnly:i});case D.CHECKBOX:return o.jsx(Mo,{name:t,control:r,label:e.label??"",disabled:s,readOnly:i});case D.SWITCH:return o.jsx(jh,{name:t,control:r,label:e.label??"",disabled:s,readOnly:i});case D.DATE:return o.jsx(Tn,{name:t,control:r,disabled:s,readOnly:i});case D.TIME:return o.jsx(kh,{name:t,control:r,disabled:s,readOnly:i});case D.HIDDEN:return o.jsx(Bo,{name:t,control:r});default:return o.jsx(Tt,{name:t,control:r,type:"text",placeholder:e.placeholder,disabled:s,readOnly:i})}},Rk=({name:e,control:t,subSchema:r,disabled:n,readOnly:a})=>{if(!r||r.fields.length===0)return null;const s=[...r.fields].sort((i,l)=>i.ordem-l.ordem);return o.jsxs("div",{className:"rounded-xl border border-input bg-muted/30 p-4 space-y-4",children:[r.titulo&&o.jsx("h4",{className:"text-sm font-semibold text-muted-foreground",children:r.titulo}),o.jsx("div",{className:"grid grid-cols-12 gap-4",children:s.map(i=>{const l=`${e}.${i.nome}`,c=i.tipo===D.CHECKBOX||i.tipo===D.SWITCH||i.tipo===D.HIDDEN,d=i.tamanho??6;return o.jsxs("div",{className:`col-span-${d}`,children:[!c&&o.jsxs("label",{className:"mb-1 block text-sm font-medium text-foreground",children:[i.label,i.obrigatorio&&o.jsx("span",{className:"text-destructive",children:" *"})]}),o.jsx(Dk,{field:i,name:l,control:t,disabled:n,readOnly:a})]},i.id)})})]})},Ch=({field:e,control:t,nameOverride:r})=>{var n,a;const s=r??e.nome,{componentMapper:i}=Cr(),l=i==null?void 0:i[e.tipo];if(l)return o.jsx(l,{name:s,control:t,field:e});const c={name:s,control:t,placeholder:e.placeholder,disabled:e.isDisabled,readOnly:e.isReadOnly};switch(e.tipo){case D.TEXTO:return o.jsx(Tt,{...c,type:"text"});case D.EMAIL:return o.jsx(Tt,{...c,type:"email"});case D.NUMBER:return o.jsx(Tt,{...c,type:"number"});case D.PASSWORD:return o.jsx(Nk,{...c});case D.TEXTAREA:return o.jsx(zo,{...c});case D.SELECT:return o.jsx(Lo,{...c,options:e.opcoes??[]});case D.AUTOCOMPLETE:return o.jsx(Ek,{...c,options:e.opcoes??[]});case D.SWITCH:return o.jsx(jh,{name:s,control:t,label:e.label,disabled:e.isDisabled,readOnly:e.isReadOnly});case D.SLIDER:return o.jsx(Sk,{name:s,control:t,minValue:e.minValue,maxValue:e.maxValue,step:e.step,disabled:e.isDisabled,readOnly:e.isReadOnly});case D.RATING:return o.jsx(Ak,{name:s,control:t,maxRating:e.maxRating,disabled:e.isDisabled,readOnly:e.isReadOnly});case D.COLOR:return o.jsx($k,{name:s,control:t,disabled:e.isDisabled,readOnly:e.isReadOnly});case D.TIME:return o.jsx(kh,{...c});case D.DATE_RANGE:return o.jsx(Tk,{name:s,control:t,startLabel:e.dateRangeStartLabel,endLabel:e.dateRangeEndLabel,disabled:e.isDisabled,readOnly:e.isReadOnly});case D.RADIO:return o.jsx(dl,{...c,options:e.opcoes??[]});case D.CHECKBOX:return o.jsx(Mo,{name:s,control:t,label:e.label,disabled:e.isDisabled,readOnly:e.isReadOnly});case D.CHECKBOX_GROUP:return o.jsx(cl,{...c,options:e.opcoes??[]});case D.DATE:return o.jsx(Tn,{name:s,control:t,disabled:e.isDisabled,readOnly:e.isReadOnly,validacao:e.validacao});case D.DATETIME:return o.jsx(Tn,{name:s,control:t,isDatetime:!0,disabled:e.isDisabled,readOnly:e.isReadOnly,validacao:e.validacao});case D.FILE:return o.jsx(xl,{name:s,control:t,disabled:e.isDisabled,fileTypes:(n=e.validacao)==null?void 0:n.fileTypes,maxFileSize:(a=e.validacao)==null?void 0:a.maxFileSize});case D.TELEFONE:return o.jsx(_r,{...c,maskType:"telefone"});case D.CPF:return o.jsx(_r,{...c,maskType:"cpf"});case D.CEP:return o.jsx(gl,{name:s,control:t,placeholder:e.placeholder,disabled:e.isDisabled,readOnly:e.isReadOnly,cepFillMap:e.cepFillMap});case D.HIDDEN:return o.jsx(Bo,{name:s,control:t});case D.PARTICIPATION_TYPE:return o.jsx(gh,{name:s,control:t});case D.PAYMENT_METHOD:return o.jsx(yh,{name:s,control:t,relatedFieldName:e.relatedFieldName});case D.TERMS:return o.jsx(wh,{name:s,control:t,label:e.label,termoTexto:e.termoTexto,termoPdfUrl:e.termoPdfUrl,termoPdfUploadId:e.termoPdfUploadId});case D.FIELD_ARRAY:return o.jsx(xh,{name:s,control:t,subFields:e.subFields,minItems:e.minItems,maxItems:e.maxItems,itemLabel:e.itemLabel,addLabel:e.addLabel});case D.SUB_FORM:return o.jsx(Rk,{name:s,control:t,subSchema:e.subSchema,disabled:e.isDisabled,readOnly:e.isReadOnly});default:return o.jsx(Tt,{...c,type:"text"})}},Pk=({container:e,control:t})=>{var r;const{externalData:n={},fieldResolvers:a}=Cr(),s=e.icone?Pt[e.icone]:void 0,i=n,l=N.useMemo(()=>Fo(e,i),[e,JSON.stringify(i)]),c=N.useMemo(()=>[...l.campos].sort((x,b)=>x.ordem-b.ordem),[l.campos]),d=Ee.useWatch({control:t}),{wrapperClass:u,wrapperStyle:m,headerClass:p,headerStyle:f,tmpl:v}=lh(),h=x=>{if(!$e(x.condicional,d,n))return null;let b=x;if(x.resolvePropsKey&&a!=null&&a[x.resolvePropsKey]){const S=a[x.resolvePropsKey](x,d,n);b={...x,...S}}if(b.opcoesFromVar){const S=n[b.opcoesFromVar];Array.isArray(S)&&(b={...b,opcoes:S.map($=>typeof $=="string"?{valor:$,label:$}:$&&typeof $=="object"&&"valor"in $&&"label"in $?$:{valor:String($),label:String($)})})}const y=b.tamanho??12,j=b.inicioColuna,w=j?`${j} / span ${y}`:`span ${y}`,C=o.jsx(Ch,{field:b,control:t});return b.tipo===D.CHECKBOX||b.tipo===D.HIDDEN||b.tipo===D.SWITCH?o.jsx("div",{className:"max-sm:!col-span-12",style:{gridColumn:w},children:C},b.id):o.jsxs("div",{className:"max-sm:!col-span-12 space-y-2",style:{gridColumn:w},children:[o.jsxs("label",{className:"font-medium flex items-center gap-1",style:{color:"var(--t-text)"},children:[b.label,b.obrigatorio&&o.jsx("span",{className:"text-destructive",children:"*"})]}),C,b.hint&&o.jsx("p",{className:"text-xs text-muted-foreground",children:b.hint})]},b.id)};return o.jsxs("div",{className:u,style:m,children:[(l.titulo||s)&&o.jsx("div",{className:p,style:f,children:o.jsxs("div",{className:"flex items-center gap-3",children:[s&&o.jsx("div",{className:"p-2 rounded-xl",style:{background:"color-mix(in srgb, var(--t-primary) 12%, transparent)"},children:o.jsx(s,{className:"w-5 h-5",style:{color:"var(--t-primary)"}})}),o.jsxs("div",{children:[o.jsx("h3",{className:((r=v.typography)==null?void 0:r.stepTitleClass)??"text-lg font-semibold",style:{color:"var(--t-text)"},children:l.titulo}),l.descricao&&o.jsx("p",{className:"text-sm",style:{color:"var(--t-text-muted)"},children:l.descricao})]})]})}),o.jsx("div",{className:"p-6 grid grid-cols-12 gap-4",children:c.map(h)})]})},_k=({container:e,control:t})=>{var r;const{externalData:n={}}=Cr(),a=e.nome??"__invalid__",s=e.minItems??1,i=e.maxItems,l=e.itemLabel??"Item",c=e.icone?Pt[e.icone]:void 0,d=n,u=N.useMemo(()=>Fo(e,d),[e,JSON.stringify(d)]),m=N.useMemo(()=>[...u.campos].sort((k,E)=>k.ordem-E.ordem),[u.campos]),p=N.useCallback(()=>{const k={};for(const E of m)E.initialValue!==void 0?k[E.nome]=typeof E.initialValue=="string"?xt(E.initialValue,d):E.initialValue:E.defaultValue!==void 0&&(k[E.nome]=E.defaultValue);return k},[m,d]),{fields:f,append:v,remove:h}=Ee.useFieldArray({control:t,name:a});N.useEffect(()=>{if(e.nome&&f.length<s)for(let k=f.length;k<s;k++)v(p())},[s]);const x=Ee.useWatch({control:t}),b=N.useMemo(()=>{const k=x[a];return Array.isArray(k)?k:[]},[x,a]),{wrapperClass:y,wrapperStyle:j,headerClass:w,headerStyle:C,tmpl:S}=lh();if(!e.nome)return console.error("[RepeatableContainerRenderer] container.nome é obrigatório para containers repetíveis. Container id:",e.id),null;const $=(k,E)=>{const T=b[E]??{};if(!$e(k.condicional,T,n))return null;const O=`${a}.${E}.${k.nome}`,L=k.tamanho??12,A=k.inicioColuna,z=A?`${A} / span ${L}`:`span ${L}`,X=o.jsx(Ch,{field:k,control:t,nameOverride:O});return k.tipo===D.CHECKBOX||k.tipo===D.HIDDEN?o.jsx("div",{className:"max-sm:!col-span-12",style:{gridColumn:z},children:X},`${k.id}-${E}`):o.jsxs("div",{className:"max-sm:!col-span-12 space-y-2",style:{gridColumn:z},children:[o.jsxs("label",{className:"font-medium flex items-center gap-1",style:{color:"var(--t-text)"},children:[k.label,k.obrigatorio&&o.jsx("span",{className:"text-destructive",children:"*"})]}),X,k.hint&&o.jsx("p",{className:"text-xs text-muted-foreground",children:k.hint})]},`${k.id}-${E}`)};return o.jsxs("div",{className:y,style:j,children:[(u.titulo||c)&&o.jsx("div",{className:w,style:C,children:o.jsxs("div",{className:"flex items-center gap-3",children:[c&&o.jsx("div",{className:"p-2 rounded-xl",style:{background:"color-mix(in srgb, var(--t-primary) 12%, transparent)"},children:o.jsx(c,{className:"w-5 h-5",style:{color:"var(--t-primary)"}})}),o.jsxs("div",{children:[o.jsx("h3",{className:((r=S.typography)==null?void 0:r.stepTitleClass)??"text-lg font-semibold",style:{color:"var(--t-text)"},children:u.titulo}),u.descricao&&o.jsx("p",{className:"text-sm",style:{color:"var(--t-text-muted)"},children:u.descricao})]})]})}),o.jsxs("div",{className:"p-6 space-y-4",children:[f.map((k,E)=>o.jsxs("div",{className:"border border-input rounded-lg p-4 bg-muted/30",children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs font-bold shrink-0 bg-primary text-primary-foreground",children:E+1}),o.jsxs("span",{className:"text-sm font-semibold",children:[l," ",E+1]})]}),f.length>s&&o.jsx("button",{type:"button",onClick:()=>h(E),className:"inline-flex items-center justify-center rounded-md p-1.5 text-destructive hover:bg-destructive/10 transition-colors","aria-label":"Remover item",children:o.jsx(I.Trash2,{className:"w-4 h-4"})})]}),o.jsx("div",{className:"grid grid-cols-12 gap-4",children:m.map(T=>$(T,E))})]},k.id)),(!i||f.length<i)&&o.jsxs("button",{type:"button",className:"w-full flex items-center justify-center gap-2 py-2 px-4 border border-input rounded-lg text-sm hover:bg-accent transition-colors",onClick:()=>v(p()),children:[o.jsx(I.Plus,{className:"w-4 h-4"}),"Adicionar ",l.toLowerCase()]}),i&&o.jsxs("p",{className:"text-xs text-center text-muted-foreground",children:["Máximo de ",i," ",l.toLowerCase(),i>1?"s":""]})]})]})},Nh=e=>e.container.repeatable&&e.container.nome?o.jsx(_k,{...e}):o.jsx(Pk,{...e}),Sh=({step:e,control:t,externalData:r={}})=>{const n=N.useMemo(()=>[...e.containers].sort((s,i)=>s.ordem-i.ordem),[e.containers]),a=Ee.useWatch({control:t});return o.jsx("div",{className:"grid grid-cols-12 gap-4",children:n.map(s=>{if(s.condicional&&!$e(s.condicional,a,r))return null;const i=s.tamanho??12,l=s.inicioColuna,c=l?`${l} / span ${i}`:`span ${i}`;return o.jsx("div",{className:"max-sm:!col-span-12",style:{gridColumn:c},children:o.jsx(Nh,{container:s,control:t})},s.id)})})},ua=N.createContext({submitting:!1,warnings:{},requestSubmit:()=>{}}),Ik=ua.Provider,Ok=()=>{const e=Eh("useFormApi"),t=N.useContext(ua);return{change:(r,n)=>e.setValue(r,n,{shouldValidate:!0,shouldDirty:!0}),reset:r=>e.reset(r),submit:t.requestSubmit,getState:()=>{const{errors:r,isDirty:n,isValid:a}=e.formState;return{values:e.getValues(),errors:Object.fromEntries(Object.entries(r).map(([s,i])=>[s,i==null?void 0:i.message])),warnings:t.warnings,dirty:n,valid:a,submitting:t.submitting}}}},$h=()=>{const e=Eh("useFormState"),t=N.useContext(ua),r=Ee.useWatch({control:e.control}),{errors:n,isDirty:a,isValid:s}=e.formState;return{values:r,errors:Object.fromEntries(Object.entries(n).map(([i,l])=>[i,l==null?void 0:l.message])),warnings:t.warnings,dirty:a,valid:s,submitting:t.submitting}},Fk=e=>{var t;const r=Ee.useFormContext(),{warnings:n}=N.useContext(ua),a=Ee.useWatch({control:r.control,name:e}),s=r.getFieldState(e,r.formState);return{value:a,error:(t=s.error)==null?void 0:t.message,warning:n[e],dirty:s.isDirty,touched:s.isTouched,valid:!s.error}},zk=e=>{var t;const{control:r}=Ee.useFormContext(),{warnings:n}=N.useContext(ua),{field:a,fieldState:s}=Ee.useController({name:e,control:r});return{input:{name:a.name,value:a.value,onChange:a.onChange,onBlur:a.onBlur,ref:a.ref},meta:{error:(t=s.error)==null?void 0:t.message,warning:n[e],touched:s.isTouched,dirty:s.isDirty,valid:!s.error}}},Eh=e=>{const t=Ee.useFormContext();if(!t)throw new Error(`[SchemaForms] O hook '${e}' foi chamado fora de um <FormRenderer />. Certifique-se de que o componente está dentro da árvore de renderização do formulário.`);return t},sd=({stepIndex:e,totalSteps:t,step:r,defaultValues:n,externalData:a,fieldErrors:s,isSubmitting:i,submitError:l,validatorMapper:c={},onWarningsChange:d,onValuesChange:u,onSubmit:m,onBack:p})=>{const f=e===t-1,v=N.useMemo(()=>JSON.stringify(a),[a]),h=N.useMemo(()=>ah(r,a,c),[r.id,v]),x=N.useMemo(()=>oh(r,a,c),[r.id,v]),[b,y]=N.useState({}),j=N.useRef(d);j.current=d;const w=a,C=N.useMemo(()=>ih(r,w),[r,v]),S=Ee.useForm({resolver:h,defaultValues:n,mode:"onTouched"}),{control:$,handleSubmit:k,setError:E,clearErrors:T,setValue:O}=S;N.useEffect(()=>{T();for(const[U,Q]of Object.entries(s))E(U,{type:"server",message:Q})},[s,E,T]);const L=N.useMemo(()=>r.containers.filter(U=>!U.repeatable).flatMap(U=>U.campos).filter(U=>!!U.condicional),[r.containers]),A=N.useMemo(()=>r.containers.filter(U=>!!U.condicional),[r.containers]),z=N.useMemo(()=>r.containers.filter(U=>!U.repeatable).flatMap(U=>U.campos).filter(U=>{var Q;return U.condicional&&((Q=U.setValues)==null?void 0:Q.length)}),[r.containers]),X=N.useMemo(()=>r.containers.filter(U=>U.repeatable&&!!U.nome).map(U=>({container:U,fields:U.campos.filter(Q=>!!Q.condicional)})).filter(U=>U.fields.length>0),[r.containers]),q=N.useRef({}),Z=N.useRef(!0),V=Ee.useWatch({control:$}),M=N.useRef(u);M.current=u,N.useEffect(()=>{var U;(U=M.current)==null||U.call(M,V)},[V]),N.useEffect(()=>{let U=!1;return x(V).then(Q=>{var Y;U||(y(Q),(Y=j.current)==null||Y.call(j,Q))}).catch(Q=>{U||console.error("[StepForm] warnComputer error:",Q)}),()=>{U=!0}},[V,x]),N.useEffect(()=>{var U;if(!L.length&&!z.length&&!A.length&&!X.length)return;const Q=V;for(const H of L)if(!$e(H.condicional,Q,a)){if(T(H.nome),H.tipo===D.FIELD_ARRAY){const W=Q[H.nome];Array.isArray(W)&&W.forEach((G,ne)=>{(H.subFields??[]).forEach(J=>T(`${H.nome}.${ne}.${J.nome}`))})}if(H.clearedValue!==void 0){const W=H.clearedValue??"";Q[H.nome]!==W&&O(H.nome,W,{shouldValidate:!1})}}for(const H of A)if(!$e(H.condicional,Q,a))if(H.repeatable&&H.nome)(Array.isArray(Q[H.nome])?Q[H.nome]:[]).forEach((W,G)=>{for(const ne of H.campos)T(`${H.nome}.${G}.${ne.nome}`)});else for(const W of H.campos){T(W.nome);const G=W.clearedValue!==void 0?W.clearedValue:void 0;G!==void 0&&Q[W.nome]!==G&&O(W.nome,G,{shouldValidate:!1})}for(const{container:H,fields:W}of X){const G=H.nome,ne=Array.isArray(Q[G])?Q[G]:[];for(let J=0;J<ne.length;J++){const te=ne[J];for(const ce of W)if(!$e(ce.condicional,te,a)&&(T(`${G}.${J}.${ce.nome}`),ce.clearedValue!==void 0)){const be=ce.clearedValue??"";te[ce.nome]!==be&&O(`${G}.${J}.${ce.nome}`,be,{shouldValidate:!1})}}}const Y=Z.current;for(const H of z){const W=$e(H.condicional,Q,a),G=Y?W:q.current[H.nome]??!1;if(W&&!G&&(U=H.setValues)!=null&&U.length)for(const ne of H.setValues){const J=typeof ne.valor=="string"?xt(ne.valor,w):ne.valor;O(ne.campo,J,{shouldValidate:!1})}q.current[H.nome]=W}Z.current=!1},[V,L,z,A,X,a,O,T]);const _=C.icone?Pt[C.icone]:void 0,se=N.useMemo(()=>()=>{S.handleSubmit(m)()},[m]);return o.jsx(Ee.FormProvider,{...S,children:o.jsx(Ik,{value:{submitting:i,warnings:b,requestSubmit:se},children:o.jsx("form",{onSubmit:k(m),noValidate:!0,onKeyDown:U=>{U.key==="Enter"&&U.target.tagName==="INPUT"&&U.preventDefault()},children:o.jsxs("div",{className:"space-y-6",children:[C.showLabel!==!1&&o.jsxs("div",{className:"text-center space-y-2",children:[_&&o.jsx("div",{className:"w-12 h-12 mx-auto rounded-xl flex items-center justify-center",style:{background:"color-mix(in srgb, var(--t-primary) 12%, transparent)"},children:o.jsx(_,{className:"w-6 h-6",style:{color:"var(--t-primary)"}})}),o.jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--t-text)"},children:C.titulo}),C.descricao&&o.jsx("p",{className:"text-sm text-muted-foreground",children:C.descricao})]}),o.jsx(Sh,{step:C,control:$,externalData:a}),o.jsxs("div",{className:"flex items-center justify-between gap-4 pt-6 pb-2",children:[o.jsxs(Ae,{type:"button",variant:"outline",onClick:p,disabled:e===0,className:K(e>0&&"border-primary/40 text-primary hover:bg-primary/5"),children:[o.jsx(I.ChevronLeft,{className:"w-4 h-4"}),o.jsx("span",{className:"hidden sm:inline",children:"Anterior"})]}),o.jsxs("span",{className:"text-xs font-semibold tabular-nums sm:hidden text-muted-foreground",children:[e+1,"/",t]}),o.jsxs(Ae,{type:"submit",disabled:i,children:[i?o.jsx(I.Loader2,{className:"w-4 h-4 animate-spin"}):f?o.jsx(I.Check,{className:"w-4 h-4"}):o.jsx(I.ChevronRight,{className:"w-4 h-4"}),o.jsx("span",{className:"hidden sm:inline",children:f?"Finalizar":"Próximo"})]})]}),l&&o.jsx("p",{className:"text-sm text-destructive mt-2 text-center",children:l})]})})})})},Za=e=>{if(e)return Pt[e]},Lk=({steps:e,currentStep:t,onStepClick:r})=>o.jsx("div",{className:"flex items-center justify-center gap-2 flex-wrap",children:e.map((n,a)=>o.jsx("div",{role:r?"button":void 0,tabIndex:r?0:void 0,onClick:()=>r==null?void 0:r(a),onKeyDown:s=>s.key==="Enter"&&(r==null?void 0:r(a)),className:K("w-8 h-8 rounded-full flex items-center justify-center text-xs font-bold transition-all shrink-0",r&&"cursor-pointer hover:opacity-80"),style:a===t?{background:"var(--t-primary)",color:"#ffffff",boxShadow:"0 0 0 3px color-mix(in srgb, var(--t-primary) 30%, transparent)"}:a<t?{background:"#22c55e",color:"#ffffff"}:{background:"hsl(var(--muted))",color:"hsl(var(--muted-foreground))"},children:a<t?o.jsx(I.Check,{className:"w-4 h-4"}):a+1},n.id))}),Mk=({steps:e,currentStep:t,onStepClick:r})=>o.jsx("div",{className:"flex items-center justify-center gap-2 flex-wrap",children:e.map((n,a)=>{const s=Za(n.icone)??I.CircleDot;return o.jsx("div",{role:r?"button":void 0,tabIndex:r?0:void 0,onClick:()=>r==null?void 0:r(a),onKeyDown:i=>i.key==="Enter"&&(r==null?void 0:r(a)),className:K("w-9 h-9 rounded-full flex items-center justify-center transition-all shrink-0",r&&"cursor-pointer hover:opacity-80"),style:a===t?{background:"var(--t-primary)",color:"#ffffff",boxShadow:"0 0 0 3px color-mix(in srgb, var(--t-primary) 30%, transparent)"}:a<t?{background:"#22c55e",color:"#ffffff"}:{background:"hsl(var(--muted))",color:"hsl(var(--muted-foreground))"},children:a<t?o.jsx(I.Check,{className:"w-4 h-4"}):o.jsx(s,{className:"w-4 h-4"})},n.id)})}),Vk=({steps:e,currentStep:t,position:r,orientation:n="horizontal",onStepClick:a})=>n==="vertical"?o.jsx("div",{className:"flex flex-col gap-0",children:e.map((s,i)=>{const l=Za(s.icone)??I.CircleDot,c=i===t,d=i<t,u=i===e.length-1;return o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsxs("div",{className:"flex flex-col items-center",children:[o.jsx("button",{type:"button",onClick:()=>a==null?void 0:a(i),className:K("w-8 h-8 rounded-full flex items-center justify-center transition-all shrink-0",a&&"cursor-pointer hover:opacity-80"),style:c?{background:"var(--t-primary)",color:"#fff",boxShadow:"0 0 10px color-mix(in srgb, var(--t-primary) 50%, transparent)"}:d?{background:"#22c55e",color:"#fff"}:{background:"color-mix(in srgb, var(--t-text) 8%, transparent)",color:"var(--t-text-muted)",border:"1.5px solid color-mix(in srgb, var(--t-border) 60%, transparent)"},children:d?o.jsx(I.Check,{className:"w-3.5 h-3.5"}):o.jsx(l,{className:"w-3.5 h-3.5"})}),!u&&o.jsx("div",{className:"w-[2px] my-1",style:{height:"24px",background:d?"#22c55e":"color-mix(in srgb, var(--t-border) 50%, transparent)"}})]}),o.jsx("span",{className:"text-sm font-medium leading-tight mt-1.5",style:c?{color:"var(--t-primary)"}:d?{color:"#16a34a"}:{color:"var(--t-text-muted)"},children:s.label??s.id})]},s.id)})}):o.jsx("div",{className:"w-full flex items-start",children:e.map((s,i)=>{const l=Za(s.icone)??I.CircleDot,c=i===t,d=i<t,u=i===e.length-1;return o.jsxs("div",{className:K("flex items-start",!u&&"flex-1"),children:[o.jsxs("div",{className:"flex flex-col items-center gap-1.5 w-[56px] shrink-0 mx-auto",children:[o.jsx("button",{type:"button",onClick:()=>a==null?void 0:a(i),className:K("w-10 h-10 rounded-full flex items-center justify-center transition-all shrink-0",a&&"cursor-pointer hover:opacity-80"),style:c?{background:"var(--t-primary)",color:"#ffffff",boxShadow:"0 0 12px color-mix(in srgb, var(--t-primary) 50%, transparent)"}:d?{background:"#22c55e",color:"#ffffff"}:{background:"color-mix(in srgb, var(--t-text) 8%, transparent)",color:"var(--t-text-muted)",border:"1.5px solid color-mix(in srgb, var(--t-border) 60%, transparent)"},children:d?o.jsx(I.Check,{className:"w-4 h-4"}):o.jsx(l,{className:"w-4 h-4"})}),o.jsx("span",{className:"text-[10px] font-medium text-center leading-tight line-clamp-2 px-0.5",style:c?{color:"var(--t-primary)"}:d?{color:"#16a34a"}:{color:"var(--t-text-muted)"},children:s.label??s.id})]}),!u&&o.jsx("div",{className:"flex-1 h-[1.5px] mt-5 mx-1",style:{background:d?"linear-gradient(90deg, var(--t-primary), color-mix(in srgb, var(--t-primary) 40%, transparent))":"color-mix(in srgb, var(--t-border) 50%, transparent)"}})]},s.id)})}),Th=({steps:e,currentStep:t,onStepClick:r,className:n,forceShow:a})=>{const s=ra(),{layout:i}=s;if(!i.showStepIndicators||e.length<=1&&!a)return null;const l=i.stepIndicatorVariant??"numbers",c=i.stepIndicatorPosition??"top-center",d=i.stepIndicatorOrientation??"horizontal",u=(t+1)/e.length*100,m=e[t],p=Za(m==null?void 0:m.icone)??I.CircleDot,f=o.jsx("div",{className:"h-1 rounded-full overflow-hidden",style:{background:"color-mix(in srgb, var(--t-primary) 15%, transparent)"},children:o.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${u}%`,background:"linear-gradient(90deg, var(--t-primary), var(--t-accent))"}})}),v=o.jsxs("div",{className:"block sm:hidden space-y-2",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"w-10 h-10 rounded-full flex items-center justify-center shrink-0",style:{background:"var(--t-primary)",color:"#fff"},children:o.jsx(p,{className:"w-5 h-5"})}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("p",{className:"text-sm font-semibold leading-tight truncate",style:{color:"var(--t-text)"},children:(m==null?void 0:m.label)??(m==null?void 0:m.id)}),o.jsxs("p",{className:"text-xs leading-tight",style:{color:"var(--t-text-muted)"},children:["Passo ",t+1," de ",e.length]})]})]}),f]}),h=o.jsxs("div",{className:"hidden sm:block",children:[l==="numbers"&&o.jsx(Lk,{steps:e,currentStep:t,onStepClick:r}),l==="icons"&&o.jsx(Mk,{steps:e,currentStep:t,onStepClick:r}),l==="icons-labeled"&&o.jsx(Vk,{steps:e,currentStep:t,position:c,orientation:d,onStepClick:r})]}),x=i.showProgressBar?o.jsx("div",{className:"hidden sm:block",children:f}):null;return d==="vertical"?o.jsxs("div",{className:K("flex gap-6 items-start",n),children:[v,o.jsxs("div",{className:"hidden sm:flex gap-6 items-start shrink-0",children:[h,x&&o.jsx("div",{className:"flex-1 pt-4",children:x})]})]}):o.jsxs("div",{className:K("space-y-3",n),children:[v,o.jsxs("div",{className:"hidden sm:block space-y-3",children:[h,x]})]})},Bk=(e,t,r)=>{var n;const a={...t},s=r;for(const i of e.containers){for(const l of i.campos)if(a[l.nome]===void 0&&(l.initialValue!==void 0?a[l.nome]=typeof l.initialValue=="string"?xt(l.initialValue,s):l.initialValue:l.defaultValue!==void 0&&(a[l.nome]=l.defaultValue)),l.tipo===D.FIELD_ARRAY&&(n=l.subFields)!=null&&n.length){const c=a[l.nome];Array.isArray(c)&&c.length>0&&(a[l.nome]=c.map(d=>{const u={...d};for(const m of l.subFields)u[m.nome]===void 0&&(m.initialValue!==void 0?u[m.nome]=typeof m.initialValue=="string"?xt(m.initialValue,s):m.initialValue:m.defaultValue!==void 0&&(u[m.nome]=m.defaultValue));return u}))}if(i.repeatable&&i.nome){const l=a[i.nome];Array.isArray(l)&&l.length>0&&(a[i.nome]=l.map(c=>{const d={...c};for(const u of i.campos)d[u.nome]===void 0&&(u.initialValue!==void 0?d[u.nome]=typeof u.initialValue=="string"?xt(u.initialValue,s):u.initialValue:u.defaultValue!==void 0&&(d[u.nome]=u.defaultValue));return d}))}}return a},Uk=({schema:e,initialValues:t={},initialStep:r=0,onSubmitStep:n,onComplete:a,template:s,formTitle:i,externalData:l={},fieldErrors:c={},uploadFile:d,deleteUploadedFile:u,cepLookup:m,resolveTermsUploadUrl:p,fieldResolvers:f,validatorMapper:v,componentMapper:h,paymentMethodOptions:x,onValuesChange:b,className:y,StepIndicator:j=Th})=>{const[w,C]=N.useState(()=>r),[S,$]=N.useState({...t}),[k,E]=N.useState(()=>r),[T,O]=N.useState(!1),[L,A]=N.useState(null),[z,X]=N.useState({}),q=N.useRef(p);q.current=p;const Z=N.useCallback(me=>q.current(me),[]),V=!!p,M=N.useRef(u);M.current=u;const _=N.useCallback(me=>M.current(me),[]),se=!!u,U=N.useMemo(()=>JSON.stringify(l),[l]),Q=N.useMemo(()=>JSON.stringify(e.stepConfig),[e.stepConfig]),Y=N.useMemo(()=>{const me=oo(s);return e.stepConfig?{...me,layout:{...me.layout,...e.stepConfig}}:me},[s,Q]),H=N.useMemo(()=>[...e.steps].sort((me,Te)=>me.ordem-Te.ordem),[e.steps]),W=H.length,G=W>0?H[Math.min(w,W-1)]:null,ne=N.useMemo(()=>G?Bk(G,S,l):{},[G,S,U]),J=N.useMemo(()=>({uploadFile:d,deleteUploadedFile:se?_:void 0,cepLookup:m,resolveTermsUploadUrl:V?Z:void 0,externalData:l,fieldResolvers:f,validatorMapper:v,fieldWarnings:z,componentMapper:h,paymentMethodOptions:x}),[d,se,_,m,Z,V,f,v,z,h,x,U]),te=N.useCallback(async me=>{if(!T){O(!0),A(null);try{const{cleaned:Te,fileIdsToDelete:ze}=bi(G,me,l);ze.length&&u&&await Promise.allSettled(ze.map(Ve=>u(Ve)));const dt={...S,...Te};if($(dt),n&&await n(w,Te),w===W-1)a&&await a(dt);else{const Ve=w+1;C(Ve),E(P=>Math.max(P,Ve))}}catch(Te){console.error("[FormRenderer] Submit error:",Te);const ze=Te instanceof Error?Te.message:"Ocorreu um erro. Tente novamente.";A(ze)}finally{O(!1)}}},[w,S,T,W,n,a,G,l,u]),ce=N.useCallback(()=>{w>0&&C(me=>me-1)},[w]);if(!G)return o.jsx(Ga.Provider,{value:J,children:o.jsx(Kn,{config:Y,className:`min-h-dvh ${Y.wrapperClass??""} ${y??""}`,renderWrapper:!0,children:o.jsx("div",{className:"w-full max-w-4xl mx-auto px-4 py-6 sm:px-6 text-center text-muted-foreground",children:"Nenhum step configurado."})})});const be=Y.layout.eventTitleStyle??"bar",Ce=(Y.layout.stepIndicatorOrientation??"horizontal")==="vertical",ve=W>=1?o.jsx(j,{steps:H.map(me=>({id:me.id,label:me.titulo,icone:me.icone})),currentStep:w,onStepClick:me=>{me!==w&&me<=k&&C(me)}}):null;return o.jsx(Ga.Provider,{value:J,children:o.jsx(Kn,{config:Y,className:`min-h-dvh ${Y.wrapperClass??""} ${y??""}`,renderWrapper:!0,children:o.jsxs("div",{className:"w-full max-w-4xl mx-auto px-4 py-6 sm:px-6",children:[i&&be==="bar"&&o.jsx("div",{className:"w-full text-center text-sm font-medium py-2.5 px-4 mb-6 rounded-lg border border-input text-muted-foreground bg-muted/30",children:i}),i&&be==="inline"&&o.jsxs("div",{className:"text-center mb-6",children:[o.jsx("p",{className:"text-xs font-semibold uppercase tracking-widest mb-1",style:{color:"var(--t-text-muted)"},children:"Inscrição"}),o.jsx("h1",{className:"text-2xl font-bold",style:{color:"var(--t-text)"},children:i}),o.jsx("div",{className:"h-0.5 w-12 mx-auto mt-3 rounded-full",style:{background:"var(--t-primary)"}})]}),Ce?o.jsxs("div",{className:"flex gap-6 items-start",children:[o.jsx("div",{className:"hidden sm:block shrink-0 w-44 pt-1",children:ve}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"sm:hidden mb-6",children:ve}),o.jsx(sd,{stepIndex:w,totalSteps:W,step:G,defaultValues:ne,externalData:l,fieldErrors:c,isSubmitting:T,submitError:L,validatorMapper:v,onWarningsChange:X,onValuesChange:b,onSubmit:te,onBack:ce},w)]})]}):o.jsxs(o.Fragment,{children:[ve&&o.jsx("div",{className:"mb-8",children:ve}),o.jsx(sd,{stepIndex:w,totalSteps:W,step:G,defaultValues:ne,externalData:l,fieldErrors:c,isSubmitting:T,submitError:L,validatorMapper:v,onWarningsChange:X,onValuesChange:b,onSubmit:te,onBack:ce},w)]})]})})})},Hk=({children:e,render:t,onChange:r})=>{const n=$h(),a=N.useRef(r);return a.current=r,N.useEffect(()=>{var s;(s=a.current)==null||s.call(a,n)},[n.values,n.dirty,n.valid,n.submitting,n.errors,n.warnings]),t?o.jsx(o.Fragment,{children:t(n)}):typeof e=="function"?o.jsx(o.Fragment,{children:e(n)}):e!==void 0?o.jsx(o.Fragment,{children:e}):null},Ir=[{component:"texto",label:"Texto",icon:I.Type,group:"texto"},{component:"textarea",label:"Área de texto",icon:I.AlignLeft,group:"texto"},{component:"number",label:"Número",icon:I.Hash,group:"texto"},{component:"email",label:"E-mail",icon:I.Mail,group:"texto"},{component:"password",label:"Senha",icon:I.Lock,group:"texto"},{component:"select",label:"Seleção",icon:I.ChevronDown,group:"selecao"},{component:"autocomplete",label:"Autocomplete",icon:I.Search,group:"selecao"},{component:"radio",label:"Radio",icon:I.CircleDot,group:"selecao"},{component:"checkbox",label:"Checkbox",icon:I.CheckSquare,group:"selecao"},{component:"checkbox_group",label:"Grupo de checkboxes",icon:I.ListChecks,group:"selecao"},{component:"switch",label:"Switch (toggle)",icon:I.ToggleLeft,group:"selecao"},{component:"slider",label:"Slider",icon:I.SlidersHorizontal,group:"range"},{component:"rating",label:"Avaliação (estrelas)",icon:I.Star,group:"range"},{component:"color",label:"Cor",icon:I.Palette,group:"range"},{component:"date",label:"Data",icon:I.Calendar,group:"data"},{component:"datetime",label:"Data e hora",icon:I.Clock,group:"data"},{component:"time",label:"Horário",icon:I.Timer,group:"data"},{component:"date_range",label:"Período",icon:I.CalendarRange,group:"data"},{component:"telefone",label:"Telefone",icon:I.Phone,group:"contato"},{component:"cpf",label:"CPF",icon:I.CreditCard,group:"contato"},{component:"cep",label:"CEP",icon:I.MapPin,group:"contato"},{component:"file",label:"Arquivo",icon:I.Upload,group:"outros"},{component:"hidden",label:"Oculto",icon:I.EyeOff,group:"outros"},{component:"field_array",label:"Lista de itens",icon:I.List,group:"outros"},{component:"terms",label:"Termos e condições",icon:I.ScrollText,group:"outros"},{component:"sub_form",label:"Sub-formulário",icon:I.LayoutList,group:"outros"}],vl=[{component:"step",label:"Step",icon:I.Layers,color:"border-primary/40 bg-primary/5"},{component:"container",label:"Container",icon:I.BoxSelect,color:"border-blue-500/40 bg-blue-500/5"}],bl=[{key:"evento.nome",label:"Nome do evento",type:"string"},{key:"evento.descricao",label:"Descrição",type:"string"},{key:"evento.valor",label:"Valor (centavos)",type:"number"},{key:"evento.valorPorDia",label:"Valor por dia",type:"number"},{key:"evento.vagasTotal",label:"Vagas totais",type:"number"},{key:"evento.vagasPorDia",label:"Vagas por dia",type:"number"},{key:"evento.vagasMasculinas",label:"Vagas masculinas",type:"number"},{key:"evento.vagasFemininas",label:"Vagas femininas",type:"number"},{key:"evento.dataInicioEvento",label:"Data início",type:"date"},{key:"evento.dataFimEvento",label:"Data fim",type:"date"},{key:"evento.dataAberturaInscricoes",label:"Abertura inscrições",type:"date"},{key:"evento.localNome",label:"Local - Nome",type:"string"},{key:"evento.localEndereco",label:"Local - Endereço",type:"string"},{key:"evento.localTelefone",label:"Local - Telefone",type:"string"},{key:"evento.localMapUrl",label:"Local - URL do mapa",type:"string"},{key:"evento.localMapLink",label:"Local - Link do mapa",type:"string"},{key:"evento.status",label:"Status do evento",type:"string"},{key:"evento.publicId",label:"ID público (URL)",type:"string"},{key:"evento.fotoCapa",label:"URL da foto de capa",type:"string"},{key:"evento.template",label:"Template visual",type:"string"}],qe=e=>e.startsWith("step-")||e==="step"?"step":e.startsWith("container-")||e==="container"?"container":"field",Wk=e=>Ir.find(t=>t.component===e),Ah=e=>{const t=Ir.map(n=>n.component).filter(n=>n.includes("_"));for(const n of t)if(e.startsWith(n))return Ir.find(a=>a.component===n);const r=e.split("-")[0];return Ir.find(n=>n.component===r)},bs=e=>({when:e.campoId,operator:e.operador,value:e.valor,source:e.source}),Dh=e=>{var t;const r={campoId:e.when,operador:e.operator,valor:e.value,source:e.source};if(e.logicOperator&&(t=e.extraConditions)!=null&&t.length){const n=e.extraConditions.map(s=>({campoId:s.when,operador:s.operator,valor:s.value,source:s.source})),a=[r,...n];return e.logicOperator==="or"?{or:a}:{and:a}}return r},Rh=e=>{if("campoId"in e)return bs(e);const t=("and"in e?e.and:e.or)??[];if(t.length===0)return;const r="and"in e?"and":"or",[n,...a]=t;if(!("campoId"in n)){console.warn("[formSchemaToBuilder] Condicional com grupo aninhado detectada — não suportado no editor visual. A condicional será removida.",e);return}const s=bs(n);return a.length===0?s:{...s,logicOperator:r,extraConditions:a.filter(i=>"campoId"in i).map(bs)}},Ka=(e,t)=>{var r;if("campoId"in e){const n=(r=t[e.campoId])==null?void 0:r.name;return n?{...e,campoId:n}:e}return"and"in e&&Array.isArray(e.and)?{and:e.and.map(n=>Ka(n,t))}:"or"in e&&Array.isArray(e.or)?{or:e.or.map(n=>Ka(n,t))}:e},yl=(e,t,r)=>{var n,a;const s=l=>t[l]||{label:l,name:l},i=(((a=(n=e==null?void 0:e.containers)==null?void 0:n.root)==null?void 0:a.children)||[]).filter(l=>qe(l)==="step").map((l,c)=>{var d,u;const m=s(l),p=(((u=(d=e==null?void 0:e.containers)==null?void 0:d[l])==null?void 0:u.children)||[]).filter(f=>qe(f)==="container").map((f,v)=>{var h,x;const b=s(f),y=(((x=(h=e==null?void 0:e.containers)==null?void 0:h[f])==null?void 0:x.children)||[]).filter(w=>qe(w)==="field").map((w,C)=>{var S,$;const k=s(w),E=ai(k,w,C);if(E.condicional&&(E.condicional=Ka(E.condicional,t)),E.tipo===D.FIELD_ARRAY){const T=(($=(S=e==null?void 0:e.containers)==null?void 0:S[w])==null?void 0:$.children)??[];E.subFields=T.filter(O=>qe(O)==="field").map((O,L)=>ai(s(O),O,L))}return E}),j={id:f,titulo:b.label||"Container",descricao:b.description,icone:b.icone,ordem:v,colunas:b.columns||2,tamanho:b.tamanho||12,inicioColuna:b.inicioColuna,showLabel:b.showLabel,showAsCard:b.showAsCard,campos:y};return b.condition&&(j.condicional=Ka(Dh(b.condition),t)),j});return{id:l,titulo:m.label||"Step",descricao:m.description,icone:m.icone,ordem:c,showLabel:m.showLabel,containers:p}});return{id:r.id||"",nome:r.nome,descricao:r.descricao,status:r.status,template:r.template??null,stepConfig:r.stepConfig&&Object.keys(r.stepConfig).length>0?r.stepConfig:void 0,steps:i}},ai=(e,t,r)=>{var n,a,s,i;const l={id:t,nome:e.name||t,label:e.label||"",tipo:e.fieldType||"texto",obrigatorio:e.required||!1,tamanho:e.tamanho||6,inicioColuna:e.inicioColuna,ordem:r,placeholder:e.placeholder,hint:e.hint,defaultValue:e.defaultValue,mascara:e.mascara,mascaraCustom:e.mascaraCustom,locked:e.locked||void 0,visualStyle:e.visualStyle,isReadOnly:e.isReadOnly||void 0,isDisabled:e.isDisabled||void 0,clearedValue:e.clearedValue!==void 0?e.clearedValue:void 0,initialValue:e.initialValue!==void 0?e.initialValue:void 0,resolvePropsKey:e.resolvePropsKey||void 0};if((n=e.validate)!=null&&n.length&&(l.validate=e.validate),(a=e.warn)!=null&&a.length&&(l.warn=e.warn),(s=e.options)!=null&&s.length&&(l.opcoes=e.options.map(c=>({valor:c.value,label:c.label,disabled:c.disabled}))),e.validation){const c=e.validation;l.validacao={},c.minLength!==void 0&&(l.validacao.minLength=c.minLength),c.maxLength!==void 0&&(l.validacao.maxLength=c.maxLength),c.min!==void 0&&(l.validacao.min=c.min),c.max!==void 0&&(l.validacao.max=c.max),c.regex&&(l.validacao.regex=c.regex),c.regexMessage&&(l.validacao.regexMessage=c.regexMessage),c.minDate&&(l.validacao.minDate=c.minDate),c.maxDate&&(l.validacao.maxDate=c.maxDate),c.minAge!==void 0&&(l.validacao.minAge=c.minAge),c.maxAge!==void 0&&(l.validacao.maxAge=c.maxAge),(i=c.fileTypes)!=null&&i.length&&(l.validacao.fileTypes=c.fileTypes),c.maxFileSize!==void 0&&(l.validacao.maxFileSize=c.maxFileSize)}if(l.tipo===D.FIELD_ARRAY&&(e.itemLabel&&(l.itemLabel=e.itemLabel),e.minItems!==void 0&&(l.minItems=e.minItems),e.maxItems!==void 0&&(l.maxItems=e.maxItems),e.addLabel&&(l.addLabel=e.addLabel)),l.tipo===D.TERMS&&(e.termoTexto&&(l.termoTexto=e.termoTexto),e.termoPdfUrl&&(l.termoPdfUrl=e.termoPdfUrl),e.termoPdfUploadId&&(l.termoPdfUploadId=e.termoPdfUploadId)),l.tipo===D.SLIDER&&(e.step!==void 0&&(l.step=e.step),e.minValue!==void 0&&(l.minValue=e.minValue),e.maxValue!==void 0&&(l.maxValue=e.maxValue)),l.tipo===D.RATING&&e.maxRating!==void 0&&(l.maxRating=e.maxRating),l.tipo===D.DATE_RANGE&&(e.dateRangeStartLabel&&(l.dateRangeStartLabel=e.dateRangeStartLabel),e.dateRangeEndLabel&&(l.dateRangeEndLabel=e.dateRangeEndLabel)),l.tipo===D.SUB_FORM){const c=e.subSchemaFields??[];(c.length>0||e.subSchemaTitle)&&(l.subSchema={titulo:e.subSchemaTitle,fields:c.map((d,u)=>ai(d,d.name??`subfield-${u}`,u))})}return e.condition&&(l.condicional=Dh(e.condition)),l},Ph=e=>{const t={},r={root:{children:[]}},n=[...e.steps].sort((a,s)=>a.ordem-s.ordem);for(const a of n){const s=a.id||`step-${Nt()}`;r.root.children.push(s),t[s]={label:a.titulo,name:s,fieldType:"step",description:a.descricao,icone:a.icone,showLabel:a.showLabel};const i=[],l=[...a.containers].sort((c,d)=>c.ordem-d.ordem);for(const c of l){const d=c.id||`container-${Nt()}`;i.push(d);const u=c.condicional?Rh(c.condicional):void 0;t[d]={label:c.titulo,name:d,fieldType:"container",description:c.descricao,icone:c.icone,columns:c.colunas,tamanho:c.tamanho||12,inicioColuna:c.inicioColuna,showLabel:c.showLabel,showAsCard:c.showAsCard,...u?{condition:u}:{}};const m=[],p=[...c.campos].sort((f,v)=>f.ordem-v.ordem);for(const f of p){const v=f.id||`${f.tipo}-${Nt()}`;if(m.push(v),t[v]=oi(f),f.tipo===D.FIELD_ARRAY){const h=[];for(const x of f.subFields??[]){const b=x.id||`${x.tipo}-${Nt()}`;h.push(b),t[b]=oi(x)}r[v]={children:h}}}r[d]={children:m}}r[s]={children:i}}return{dndState:{containers:r},configs:t,templateId:e.template??null,stepConfig:e.stepConfig}},oi=(e,t)=>{var r,n,a,s;const i={label:e.label,name:e.nome,fieldType:e.tipo,required:e.obrigatorio,tamanho:e.tamanho,inicioColuna:e.inicioColuna,placeholder:e.placeholder,hint:e.hint,defaultValue:e.defaultValue,mascara:e.mascara,mascaraCustom:e.mascaraCustom,locked:e.locked||void 0,visualStyle:e.visualStyle,isReadOnly:e.isReadOnly||void 0,isDisabled:e.isDisabled||void 0,clearedValue:e.clearedValue!==void 0?String(e.clearedValue??""):void 0,initialValue:e.initialValue!==void 0?String(e.initialValue):void 0,resolvePropsKey:e.resolvePropsKey||void 0,validate:(r=e.validate)!=null&&r.length?e.validate:void 0,warn:(n=e.warn)!=null&&n.length?e.warn:void 0};if((a=e.opcoes)!=null&&a.length&&(i.options=e.opcoes.map(l=>({value:l.valor,label:l.label,disabled:l.disabled}))),e.validacao){const l=e.validacao;i.validation={},l.minLength!==void 0&&(i.validation.minLength=l.minLength),l.maxLength!==void 0&&(i.validation.maxLength=l.maxLength),l.min!==void 0&&(i.validation.min=l.min),l.max!==void 0&&(i.validation.max=l.max),l.regex&&(i.validation.regex=l.regex),l.regexMessage&&(i.validation.regexMessage=l.regexMessage),l.minDate&&(i.validation.minDate=l.minDate),l.maxDate&&(i.validation.maxDate=l.maxDate),l.minAge!==void 0&&(i.validation.minAge=l.minAge),l.maxAge!==void 0&&(i.validation.maxAge=l.maxAge),(s=l.fileTypes)!=null&&s.length&&(i.validation.fileTypes=l.fileTypes),l.maxFileSize!==void 0&&(i.validation.maxFileSize=l.maxFileSize)}if(e.tipo===D.FIELD_ARRAY&&(e.itemLabel&&(i.itemLabel=e.itemLabel),e.minItems!==void 0&&(i.minItems=e.minItems),e.maxItems!==void 0&&(i.maxItems=e.maxItems),e.addLabel&&(i.addLabel=e.addLabel)),e.tipo===D.TERMS&&(e.termoTexto&&(i.termoTexto=e.termoTexto),e.termoPdfUrl&&(i.termoPdfUrl=e.termoPdfUrl),e.termoPdfUploadId&&(i.termoPdfUploadId=e.termoPdfUploadId)),e.tipo===D.SLIDER&&(e.step!==void 0&&(i.step=e.step),e.minValue!==void 0&&(i.minValue=e.minValue),e.maxValue!==void 0&&(i.maxValue=e.maxValue)),e.tipo===D.RATING&&e.maxRating!==void 0&&(i.maxRating=e.maxRating),e.tipo===D.DATE_RANGE&&(e.dateRangeStartLabel&&(i.dateRangeStartLabel=e.dateRangeStartLabel),e.dateRangeEndLabel&&(i.dateRangeEndLabel=e.dateRangeEndLabel)),e.tipo===D.SUB_FORM&&e.subSchema&&(i.subSchemaTitle=e.subSchema.titulo,i.subSchemaFields=e.subSchema.fields.map(l=>oi(l,l.id))),e.condicional){const l=Rh(e.condicional);l&&(i.condition=l)}return i},_h=(e,t)=>{var r,n,a,s,i,l,c,d,u,m,p;const f=[],v=[],h=y=>t[y]||{label:y,name:y},x=((n=(r=e==null?void 0:e.containers)==null?void 0:r.root)==null?void 0:n.children)||[],b=new Set;for(const y of x){if(qe(y)!=="step")continue;const j=h(y).label||y,w=((s=(a=e==null?void 0:e.containers)==null?void 0:a[y])==null?void 0:s.children)||[];if(w.length===0){v.push(`Step "${j}" está vazio (sem containers).`);continue}for(const C of w){if(qe(C)!=="container")continue;const S=h(C).label||C,$=((l=(i=e==null?void 0:e.containers)==null?void 0:i[C])==null?void 0:l.children)||[],k=new Map;for(const E of $){if(qe(E)!=="field")continue;b.add(E);const T=h(E).name;(!T||!T.trim())&&f.push(`Campo "${h(E).label||E}" (${E}) no container "${S}" não tem nome definido.`);const O=T||E;k.has(O)||k.set(O,[]),k.get(O).push(E)}for(const[E,T]of k.entries())T.length>1&&f.push(`Nome duplicado "${E}" no container "${S}" (IDs: ${T.join(", ")}).`)}}for(const[y,j]of Object.entries(t)){if(!((c=j.condition)!=null&&c.when))continue;const w=j.condition.when;if(!b.has(w)){const C=j.label||y;v.push(`Campo "${C}" referencia campo inexistente na condição (when: "${w}").`)}}for(const y of x){if(qe(y)!=="step")continue;const j=h(y).label||y,w=((u=(d=e==null?void 0:e.containers)==null?void 0:d[y])==null?void 0:u.children)||[],C=new Map;for(const S of w){if(qe(S)!=="container")continue;const $=((p=(m=e==null?void 0:e.containers)==null?void 0:m[S])==null?void 0:p.children)||[];for(const k of $){if(qe(k)!=="field")continue;const E=h(k).name||k;C.has(E)||C.set(E,new Set),C.get(E).add(S)}}for(const[S,$]of C.entries())$.size>1&&f.push(`Nome duplicado "${S}" no step "${j}" em containers diferentes (containers: ${[...$].join(", ")}). Isso causa colisão no formulário.`)}return{errors:f,warnings:v}},Ih=N.createContext(null),qk=e=>{if(e.startsWith("step"))return"step";if(e.startsWith("container"))return"container";const t=e.match(/^([a-z_]+)-/);return t?t[1]:e.split("-")[0]},ys=(e,t)=>{const r=t||qk(e),n=r==="step",a=r==="container",s=r==="field_array";return{label:n?"Novo Step":a?"Novo Container":s?"Lista de itens":r||e,name:e,fieldType:r||"texto",required:!1,columns:2,tamanho:a||s?12:n?void 0:6,showLabel:a?!0:void 0,itemLabel:s?"Item":void 0}},ws=e=>typeof structuredClone=="function"?{containers:structuredClone(e.containers),configs:structuredClone(e.configs)}:{containers:JSON.parse(JSON.stringify(e.containers)),configs:JSON.parse(JSON.stringify(e.configs))},Oh=(e,t)=>{const r=[e],n=t[e];if(n!=null&&n.children)for(const a of n.children)r.push(...Oh(a,t));return r},wl=(e,t)=>{for(const[r,n]of Object.entries(t))if(n.children.includes(e))return r;return null},Fh=({children:e,initialConfigs:t,initialContainers:r,initialTemplateId:n,initialStepConfig:a,schemaId:s,uploadTermsPdf:i,deleteTermsPdf:l})=>{const[c,d]=N.useState({selectedId:null,configs:t||{},showPreview:!1,containers:r??{root:{children:[]}},previewTemplateId:n||"moderno",stepConfig:a??{}}),[u,m]=N.useState(null),[p,f]=N.useState(null),v=N.useRef([]),h=N.useRef([]),x=M=>{v.current=[...v.current.slice(-49),ws(M)],h.current=[]},b=N.useCallback(()=>{d(M=>(x(M),{...M}))},[]),y=N.useCallback(()=>{v.current.length!==0&&d(M=>{h.current=[...h.current,ws(M)];const _=v.current.pop();return{...M,containers:_.containers,configs:_.configs}})},[]),j=N.useCallback(()=>{h.current.length!==0&&d(M=>{v.current=[...v.current,ws(M)];const _=h.current.pop();return{...M,containers:_.containers,configs:_.configs}})},[]);N.useEffect(()=>{const M=_=>{const se=_.metaKey||_.ctrlKey;se&&_.key==="z"&&!_.shiftKey&&(_.preventDefault(),y()),se&&_.key==="z"&&_.shiftKey&&(_.preventDefault(),j()),se&&_.key==="y"&&(_.preventDefault(),j())};return window.addEventListener("keydown",M),()=>window.removeEventListener("keydown",M)},[y,j]);const w=N.useCallback(M=>c.configs[M]??ys(M),[c.configs]),C=N.useCallback(()=>{const M=[],_=se=>{var U;const Q=((U=c.containers[se])==null?void 0:U.children)??[];for(const Y of Q)qe(Y)==="field"?M.push(Y):c.containers[Y]&&_(Y)};return _("root"),M},[c.containers]),S=N.useCallback(M=>{d(_=>({..._,selectedId:M}))},[]),$=N.useCallback(M=>{d(_=>({..._,showPreview:M}))},[]),k=N.useCallback(M=>{d(_=>({..._,previewTemplateId:M}))},[]),E=N.useCallback(M=>{d(_=>({..._,stepConfig:{..._.stepConfig,...M}}))},[]),T=N.useCallback((M,_)=>{d(se=>({...se,configs:{...se.configs,[M]:{...se.configs[M]??ys(M),..._}}}))},[]),O=N.useCallback((M,_,se)=>{const U=`${M}-${Nt()}`,Q=qe(U);return d(Y=>{var H;x(Y);const W={...Y.containers};(Q==="step"||Q==="container"||M==="field_array")&&(W[U]={children:[]});const G=[...((H=W[_])==null?void 0:H.children)??[]];return se!==void 0&&se>=0?G.splice(se,0,U):G.push(U),W[_]={children:G},{...Y,containers:W,configs:{...Y.configs,[U]:ys(U,M)},selectedId:U}}),U},[]),L=N.useCallback((M,_)=>{const se=`container-${Nt()}`;return d(U=>{var Q,Y,H;x(U);const W={...U.containers},G={...U.configs},ne=[];for(const te of M.containerTemplate.campos){const ce=te.locked&&te.id?te.id:`${String(te.tipo).toLowerCase()}-${Nt()}`;if(ne.push(ce),G[ce]={label:te.label,name:te.locked?te.id:te.nome,fieldType:te.tipo,required:te.obrigatorio||!1,placeholder:te.placeholder,hint:te.hint,tamanho:te.tamanho||6,inicioColuna:te.inicioColuna,defaultValue:te.defaultValue!=null?String(te.defaultValue):void 0,locked:te.locked||!1,options:(Q=te.opcoes)==null?void 0:Q.map(be=>({value:be.valor,label:be.label})),...te.tipo==="field_array"&&{itemLabel:te.itemLabel,minItems:te.minItems,maxItems:te.maxItems,addLabel:te.addLabel}},te.tipo==="field_array"){const be=[];for(const Ce of te.subFields??[]){const ve=`${String(Ce.tipo).toLowerCase()}-${Nt()}`;be.push(ve),G[ve]={label:Ce.label,name:Ce.nome,fieldType:Ce.tipo,required:Ce.obrigatorio||!1,placeholder:Ce.placeholder,hint:Ce.hint,tamanho:Ce.tamanho||6,inicioColuna:Ce.inicioColuna,options:(Y=Ce.opcoes)==null?void 0:Y.map(me=>({value:me.valor,label:me.label}))}}W[ce]={children:be}}}W[se]={children:ne},G[se]={label:M.containerTemplate.titulo||M.name,description:M.containerTemplate.descricao,icone:M.containerTemplate.icone,tamanho:M.containerTemplate.tamanho||12,inicioColuna:M.containerTemplate.inicioColuna,showLabel:!0};const J=[...((H=W[_])==null?void 0:H.children)??[]];return J.push(se),W[_]={children:J},{...U,containers:W,configs:G,selectedId:se}}),se},[]),A=N.useCallback(M=>{const _=[];return d(se=>{var U,Q,Y;x(se);const H={...se.containers},W={...se.configs};for(const G of M.steps){const ne=`step-${Nt()}`;_.push(ne);const J=[];for(const ce of G.containers){const be=`container-${Nt()}`;J.push(be);const Ce=[];for(const ve of ce.campos){const me=ve.locked&&ve.id?ve.id:`${String(ve.tipo).toLowerCase()}-${Nt()}`;if(Ce.push(me),W[me]={label:ve.label,name:ve.locked?ve.id:ve.nome,fieldType:ve.tipo,required:ve.obrigatorio||!1,placeholder:ve.placeholder,hint:ve.hint,tamanho:ve.tamanho||12,inicioColuna:ve.inicioColuna,defaultValue:ve.defaultValue!=null?String(ve.defaultValue):void 0,locked:ve.locked||!1,options:(U=ve.opcoes)==null?void 0:U.map(Te=>({value:Te.valor,label:Te.label})),...ve.tipo==="field_array"&&{itemLabel:ve.itemLabel,minItems:ve.minItems,maxItems:ve.maxItems,addLabel:ve.addLabel}},ve.tipo==="field_array"){const Te=[];for(const ze of ve.subFields??[]){const dt=`${String(ze.tipo).toLowerCase()}-${Nt()}`;Te.push(dt),W[dt]={label:ze.label,name:ze.nome,fieldType:ze.tipo,required:ze.obrigatorio||!1,placeholder:ze.placeholder,hint:ze.hint,tamanho:ze.tamanho||6,inicioColuna:ze.inicioColuna,options:(Q=ze.opcoes)==null?void 0:Q.map(Ve=>({value:Ve.valor,label:Ve.label}))}}H[me]={children:Te}}}H[be]={children:Ce},W[be]={label:ce.titulo,description:ce.descricao,icone:ce.icone,tamanho:ce.tamanho||12,showLabel:!0}}H[ne]={children:J},W[ne]={label:G.titulo,description:G.descricao,icone:G.icone};const te=[...((Y=H.root)==null?void 0:Y.children)??[],ne];H.root={children:te}}return{...se,containers:H,configs:W,selectedId:_[0]??se.selectedId}}),_},[]),z=N.useCallback((M,_,se,U)=>{d(Q=>{var Y,H;x(Q);const W={...Q.containers},G=(((Y=W[_])==null?void 0:Y.children)??[]).filter(te=>te!==M);W[_]={children:G};const ne=[...(((H=W[se])==null?void 0:H.children)??[]).filter(te=>te!==M)],J=Math.max(0,Math.min(U,ne.length));return ne.splice(J,0,M),W[se]={children:ne},{...Q,containers:W}})},[]),X=N.useCallback((M,_)=>{d(se=>(x(se),{...se,containers:{...se.containers,[M]:{children:_}}}))},[]),q=N.useCallback(M=>{d(_=>{x(_);const se=Oh(M,_.containers),U={};for(const[Y,H]of Object.entries(_.containers))se.includes(Y)||(U[Y]={children:H.children.filter(W=>!se.includes(W))});const Q={..._.configs};for(const Y of se)delete Q[Y];return{..._,containers:U,configs:Q,selectedId:se.includes(_.selectedId??"")?null:_.selectedId}})},[]),Z=N.useCallback((M,_)=>{d(se=>{const U=wl(M,se.containers);if(!U)return se;const Q=[...se.containers[U].children],Y=Q.indexOf(M),H=_==="up"?Y-1:Y+1;return H<0||H>=Q.length?se:([Q[Y],Q[H]]=[Q[H],Q[Y]],{...se,containers:{...se.containers,[U]:{children:Q}}})})},[]),V=N.useCallback((M,_)=>{b(),Z(M,_)},[Z,b]);return o.jsx(Ih.Provider,{value:{selectedId:c.selectedId,configs:c.configs,showPreview:c.showPreview,containers:c.containers,positionDrag:u,reorderDrag:p,canUndo:v.current.length>0,canRedo:h.current.length>0,schemaId:s,uploadTermsPdf:i,deleteTermsPdf:l,previewTemplateId:c.previewTemplateId,setPreviewTemplateId:k,stepConfig:c.stepConfig,updateStepConfig:E,getConfig:w,getAllFieldIds:C,setSelected:S,updateConfig:T,setShowPreview:$,addItem:O,addPresetBlock:L,addPresetStepBlock:A,moveCanvasItem:z,reorderInContainer:X,removeItem:q,moveItem:V,moveItemNoSnapshot:Z,setPositionDrag:m,setReorderDrag:f,undo:y,redo:j,pushSnapshot:b},children:e})},gt=()=>{const e=N.useContext(Ih);if(!e)throw new Error("useBuilder must be inside BuilderProvider");return e},Gk=()=>{const{containers:e,configs:t,stepConfig:r}=gt(),n=N.useCallback(s=>yl({containers:e},t,{...s,stepConfig:r}),[e,t,r]),a=N.useCallback(()=>_h({containers:e},t),[e,t]);return{buildSchema:n,validate:a}};function zh(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(r=zh(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function Xk(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=zh(e))&&(n&&(n+=" "),n+=t);return n}const Zk=(e,t)=>{const r=new Array(e.length+t.length);for(let n=0;n<e.length;n++)r[n]=e[n];for(let n=0;n<t.length;n++)r[e.length+n]=t[n];return r},Kk=(e,t)=>({classGroupId:e,validator:t}),Lh=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),Ya="-",id=[],Yk="arbitrary..",Jk=e=>{const t=eC(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return Qk(a);const s=a.split(Ya),i=s[0]===""&&s.length>1?1:0;return Mh(s,i,t)},getConflictingClassGroupIds:(a,s)=>{if(s){const i=n[a],l=r[a];return i?l?Zk(l,i):i:l||id}return r[a]||id}}},Mh=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const n=e[t],a=r.nextPart.get(n);if(a){const c=Mh(e,t+1,a);if(c)return c}const s=r.validators;if(s===null)return;const i=t===0?e.join(Ya):e.slice(t).join(Ya),l=s.length;for(let c=0;c<l;c++){const d=s[c];if(d.validator(i))return d.classGroupId}},Qk=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),n=t.slice(0,r);return n?Yk+n:void 0})(),eC=e=>{const{theme:t,classGroups:r}=e;return tC(r,t)},tC=(e,t)=>{const r=Lh();for(const n in e){const a=e[n];jl(a,r,n,t)}return r},jl=(e,t,r,n)=>{const a=e.length;for(let s=0;s<a;s++){const i=e[s];rC(i,t,r,n)}},rC=(e,t,r,n)=>{if(typeof e=="string"){nC(e,t,r);return}if(typeof e=="function"){aC(e,t,r,n);return}oC(e,t,r,n)},nC=(e,t,r)=>{const n=e===""?t:Vh(t,e);n.classGroupId=r},aC=(e,t,r,n)=>{if(sC(e)){jl(e(n),t,r,n);return}t.validators===null&&(t.validators=[]),t.validators.push(Kk(r,e))},oC=(e,t,r,n)=>{const a=Object.entries(e),s=a.length;for(let i=0;i<s;i++){const[l,c]=a[i];jl(c,Vh(t,l),r,n)}},Vh=(e,t)=>{let r=e;const n=t.split(Ya),a=n.length;for(let s=0;s<a;s++){const i=n[s];let l=r.nextPart.get(i);l||(l=Lh(),r.nextPart.set(i,l)),r=l}return r},sC=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,iC=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null);const a=(s,i)=>{r[s]=i,t++,t>e&&(t=0,n=r,r=Object.create(null))};return{get(s){let i=r[s];if(i!==void 0)return i;if((i=n[s])!==void 0)return a(s,i),i},set(s,i){s in r?r[s]=i:a(s,i)}}},si="!",ld=":",lC=[],cd=(e,t,r,n,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:a}),cC=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=a=>{const s=[];let i=0,l=0,c=0,d;const u=a.length;for(let h=0;h<u;h++){const x=a[h];if(i===0&&l===0){if(x===ld){s.push(a.slice(c,h)),c=h+1;continue}if(x==="/"){d=h;continue}}x==="["?i++:x==="]"?i--:x==="("?l++:x===")"&&l--}const m=s.length===0?a:a.slice(c);let p=m,f=!1;m.endsWith(si)?(p=m.slice(0,-1),f=!0):m.startsWith(si)&&(p=m.slice(1),f=!0);const v=d&&d>c?d-c:void 0;return cd(s,f,p,v)};if(t){const a=t+ld,s=n;n=i=>i.startsWith(a)?s(i.slice(a.length)):cd(lC,!1,i,void 0,!0)}if(r){const a=n;n=s=>r({className:s,parseClassName:a})}return n},dC=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,n)=>{t.set(r,1e6+n)}),r=>{const n=[];let a=[];for(let s=0;s<r.length;s++){const i=r[s],l=i[0]==="[",c=t.has(i);l||c?(a.length>0&&(a.sort(),n.push(...a),a=[]),n.push(i)):a.push(i)}return a.length>0&&(a.sort(),n.push(...a)),n}},uC=e=>({cache:iC(e.cacheSize),parseClassName:cC(e),sortModifiers:dC(e),...Jk(e)}),mC=/\s+/,pC=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:s}=t,i=[],l=e.trim().split(mC);let c="";for(let d=l.length-1;d>=0;d-=1){const u=l[d],{isExternal:m,modifiers:p,hasImportantModifier:f,baseClassName:v,maybePostfixModifierPosition:h}=r(u);if(m){c=u+(c.length>0?" "+c:c);continue}let x=!!h,b=n(x?v.substring(0,h):v);if(!b){if(!x){c=u+(c.length>0?" "+c:c);continue}if(b=n(v),!b){c=u+(c.length>0?" "+c:c);continue}x=!1}const y=p.length===0?"":p.length===1?p[0]:s(p).join(":"),j=f?y+si:y,w=j+b;if(i.indexOf(w)>-1)continue;i.push(w);const C=a(b,x);for(let S=0;S<C.length;++S){const $=C[S];i.push(j+$)}c=u+(c.length>0?" "+c:c)}return c},fC=(...e)=>{let t=0,r,n,a="";for(;t<e.length;)(r=e[t++])&&(n=Bh(r))&&(a&&(a+=" "),a+=n);return a},Bh=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=Bh(e[n]))&&(r&&(r+=" "),r+=t);return r},hC=(e,...t)=>{let r,n,a,s;const i=c=>{const d=t.reduce((u,m)=>m(u),e());return r=uC(d),n=r.cache.get,a=r.cache.set,s=l,l(c)},l=c=>{const d=n(c);if(d)return d;const u=pC(c,r);return a(c,u),u};return s=i,(...c)=>s(fC(...c))},xC=[],ot=e=>{const t=r=>r[e]||xC;return t.isThemeGetter=!0,t},Uh=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Hh=/^\((?:(\w[\w-]*):)?(.+)\)$/i,gC=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,vC=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,bC=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,yC=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,wC=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,jC=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,$r=e=>gC.test(e),Se=e=>!!e&&!Number.isNaN(Number(e)),Er=e=>!!e&&Number.isInteger(Number(e)),js=e=>e.endsWith("%")&&Se(e.slice(0,-1)),hr=e=>vC.test(e),Wh=()=>!0,kC=e=>bC.test(e)&&!yC.test(e),kl=()=>!1,CC=e=>wC.test(e),NC=e=>jC.test(e),SC=e=>!fe(e)&&!xe(e),$C=e=>Br(e,Xh,kl),fe=e=>Uh.test(e),Gr=e=>Br(e,Zh,kC),dd=e=>Br(e,IC,Se),EC=e=>Br(e,Yh,Wh),TC=e=>Br(e,Kh,kl),ud=e=>Br(e,qh,kl),AC=e=>Br(e,Gh,NC),Ea=e=>Br(e,Jh,CC),xe=e=>Hh.test(e),Un=e=>an(e,Zh),DC=e=>an(e,Kh),md=e=>an(e,qh),RC=e=>an(e,Xh),PC=e=>an(e,Gh),Ta=e=>an(e,Jh,!0),_C=e=>an(e,Yh,!0),Br=(e,t,r)=>{const n=Uh.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},an=(e,t,r=!1)=>{const n=Hh.exec(e);return n?n[1]?t(n[1]):r:!1},qh=e=>e==="position"||e==="percentage",Gh=e=>e==="image"||e==="url",Xh=e=>e==="length"||e==="size"||e==="bg-size",Zh=e=>e==="length",IC=e=>e==="number",Kh=e=>e==="family-name",Yh=e=>e==="number"||e==="weight",Jh=e=>e==="shadow",OC=()=>{const e=ot("color"),t=ot("font"),r=ot("text"),n=ot("font-weight"),a=ot("tracking"),s=ot("leading"),i=ot("breakpoint"),l=ot("container"),c=ot("spacing"),d=ot("radius"),u=ot("shadow"),m=ot("inset-shadow"),p=ot("text-shadow"),f=ot("drop-shadow"),v=ot("blur"),h=ot("perspective"),x=ot("aspect"),b=ot("ease"),y=ot("animate"),j=()=>["auto","avoid","all","avoid-page","page","left","right","column"],w=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],C=()=>[...w(),xe,fe],S=()=>["auto","hidden","clip","visible","scroll"],$=()=>["auto","contain","none"],k=()=>[xe,fe,c],E=()=>[$r,"full","auto",...k()],T=()=>[Er,"none","subgrid",xe,fe],O=()=>["auto",{span:["full",Er,xe,fe]},Er,xe,fe],L=()=>[Er,"auto",xe,fe],A=()=>["auto","min","max","fr",xe,fe],z=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],X=()=>["start","end","center","stretch","center-safe","end-safe"],q=()=>["auto",...k()],Z=()=>[$r,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...k()],V=()=>[$r,"screen","full","dvw","lvw","svw","min","max","fit",...k()],M=()=>[$r,"screen","full","lh","dvh","lvh","svh","min","max","fit",...k()],_=()=>[e,xe,fe],se=()=>[...w(),md,ud,{position:[xe,fe]}],U=()=>["no-repeat",{repeat:["","x","y","space","round"]}],Q=()=>["auto","cover","contain",RC,$C,{size:[xe,fe]}],Y=()=>[js,Un,Gr],H=()=>["","none","full",d,xe,fe],W=()=>["",Se,Un,Gr],G=()=>["solid","dashed","dotted","double"],ne=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],J=()=>[Se,js,md,ud],te=()=>["","none",v,xe,fe],ce=()=>["none",Se,xe,fe],be=()=>["none",Se,xe,fe],Ce=()=>[Se,xe,fe],ve=()=>[$r,"full",...k()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[hr],breakpoint:[hr],color:[Wh],container:[hr],"drop-shadow":[hr],ease:["in","out","in-out"],font:[SC],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[hr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[hr],shadow:[hr],spacing:["px",Se],text:[hr],"text-shadow":[hr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",$r,fe,xe,x]}],container:["container"],columns:[{columns:[Se,fe,xe,l]}],"break-after":[{"break-after":j()}],"break-before":[{"break-before":j()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:C()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:$()}],"overscroll-x":[{"overscroll-x":$()}],"overscroll-y":[{"overscroll-y":$()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:E()}],"inset-x":[{"inset-x":E()}],"inset-y":[{"inset-y":E()}],start:[{"inset-s":E(),start:E()}],end:[{"inset-e":E(),end:E()}],"inset-bs":[{"inset-bs":E()}],"inset-be":[{"inset-be":E()}],top:[{top:E()}],right:[{right:E()}],bottom:[{bottom:E()}],left:[{left:E()}],visibility:["visible","invisible","collapse"],z:[{z:[Er,"auto",xe,fe]}],basis:[{basis:[$r,"full","auto",l,...k()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Se,$r,"auto","initial","none",fe]}],grow:[{grow:["",Se,xe,fe]}],shrink:[{shrink:["",Se,xe,fe]}],order:[{order:[Er,"first","last","none",xe,fe]}],"grid-cols":[{"grid-cols":T()}],"col-start-end":[{col:O()}],"col-start":[{"col-start":L()}],"col-end":[{"col-end":L()}],"grid-rows":[{"grid-rows":T()}],"row-start-end":[{row:O()}],"row-start":[{"row-start":L()}],"row-end":[{"row-end":L()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":A()}],"auto-rows":[{"auto-rows":A()}],gap:[{gap:k()}],"gap-x":[{"gap-x":k()}],"gap-y":[{"gap-y":k()}],"justify-content":[{justify:[...z(),"normal"]}],"justify-items":[{"justify-items":[...X(),"normal"]}],"justify-self":[{"justify-self":["auto",...X()]}],"align-content":[{content:["normal",...z()]}],"align-items":[{items:[...X(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...X(),{baseline:["","last"]}]}],"place-content":[{"place-content":z()}],"place-items":[{"place-items":[...X(),"baseline"]}],"place-self":[{"place-self":["auto",...X()]}],p:[{p:k()}],px:[{px:k()}],py:[{py:k()}],ps:[{ps:k()}],pe:[{pe:k()}],pbs:[{pbs:k()}],pbe:[{pbe:k()}],pt:[{pt:k()}],pr:[{pr:k()}],pb:[{pb:k()}],pl:[{pl:k()}],m:[{m:q()}],mx:[{mx:q()}],my:[{my:q()}],ms:[{ms:q()}],me:[{me:q()}],mbs:[{mbs:q()}],mbe:[{mbe:q()}],mt:[{mt:q()}],mr:[{mr:q()}],mb:[{mb:q()}],ml:[{ml:q()}],"space-x":[{"space-x":k()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":k()}],"space-y-reverse":["space-y-reverse"],size:[{size:Z()}],"inline-size":[{inline:["auto",...V()]}],"min-inline-size":[{"min-inline":["auto",...V()]}],"max-inline-size":[{"max-inline":["none",...V()]}],"block-size":[{block:["auto",...M()]}],"min-block-size":[{"min-block":["auto",...M()]}],"max-block-size":[{"max-block":["none",...M()]}],w:[{w:[l,"screen",...Z()]}],"min-w":[{"min-w":[l,"screen","none",...Z()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[i]},...Z()]}],h:[{h:["screen","lh",...Z()]}],"min-h":[{"min-h":["screen","lh","none",...Z()]}],"max-h":[{"max-h":["screen","lh",...Z()]}],"font-size":[{text:["base",r,Un,Gr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,_C,EC]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",js,fe]}],"font-family":[{font:[DC,TC,t]}],"font-features":[{"font-features":[fe]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,xe,fe]}],"line-clamp":[{"line-clamp":[Se,"none",xe,dd]}],leading:[{leading:[s,...k()]}],"list-image":[{"list-image":["none",xe,fe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",xe,fe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:_()}],"text-color":[{text:_()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...G(),"wavy"]}],"text-decoration-thickness":[{decoration:[Se,"from-font","auto",xe,Gr]}],"text-decoration-color":[{decoration:_()}],"underline-offset":[{"underline-offset":[Se,"auto",xe,fe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:k()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",xe,fe]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",xe,fe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:se()}],"bg-repeat":[{bg:U()}],"bg-size":[{bg:Q()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Er,xe,fe],radial:["",xe,fe],conic:[Er,xe,fe]},PC,AC]}],"bg-color":[{bg:_()}],"gradient-from-pos":[{from:Y()}],"gradient-via-pos":[{via:Y()}],"gradient-to-pos":[{to:Y()}],"gradient-from":[{from:_()}],"gradient-via":[{via:_()}],"gradient-to":[{to:_()}],rounded:[{rounded:H()}],"rounded-s":[{"rounded-s":H()}],"rounded-e":[{"rounded-e":H()}],"rounded-t":[{"rounded-t":H()}],"rounded-r":[{"rounded-r":H()}],"rounded-b":[{"rounded-b":H()}],"rounded-l":[{"rounded-l":H()}],"rounded-ss":[{"rounded-ss":H()}],"rounded-se":[{"rounded-se":H()}],"rounded-ee":[{"rounded-ee":H()}],"rounded-es":[{"rounded-es":H()}],"rounded-tl":[{"rounded-tl":H()}],"rounded-tr":[{"rounded-tr":H()}],"rounded-br":[{"rounded-br":H()}],"rounded-bl":[{"rounded-bl":H()}],"border-w":[{border:W()}],"border-w-x":[{"border-x":W()}],"border-w-y":[{"border-y":W()}],"border-w-s":[{"border-s":W()}],"border-w-e":[{"border-e":W()}],"border-w-bs":[{"border-bs":W()}],"border-w-be":[{"border-be":W()}],"border-w-t":[{"border-t":W()}],"border-w-r":[{"border-r":W()}],"border-w-b":[{"border-b":W()}],"border-w-l":[{"border-l":W()}],"divide-x":[{"divide-x":W()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":W()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...G(),"hidden","none"]}],"divide-style":[{divide:[...G(),"hidden","none"]}],"border-color":[{border:_()}],"border-color-x":[{"border-x":_()}],"border-color-y":[{"border-y":_()}],"border-color-s":[{"border-s":_()}],"border-color-e":[{"border-e":_()}],"border-color-bs":[{"border-bs":_()}],"border-color-be":[{"border-be":_()}],"border-color-t":[{"border-t":_()}],"border-color-r":[{"border-r":_()}],"border-color-b":[{"border-b":_()}],"border-color-l":[{"border-l":_()}],"divide-color":[{divide:_()}],"outline-style":[{outline:[...G(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Se,xe,fe]}],"outline-w":[{outline:["",Se,Un,Gr]}],"outline-color":[{outline:_()}],shadow:[{shadow:["","none",u,Ta,Ea]}],"shadow-color":[{shadow:_()}],"inset-shadow":[{"inset-shadow":["none",m,Ta,Ea]}],"inset-shadow-color":[{"inset-shadow":_()}],"ring-w":[{ring:W()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:_()}],"ring-offset-w":[{"ring-offset":[Se,Gr]}],"ring-offset-color":[{"ring-offset":_()}],"inset-ring-w":[{"inset-ring":W()}],"inset-ring-color":[{"inset-ring":_()}],"text-shadow":[{"text-shadow":["none",p,Ta,Ea]}],"text-shadow-color":[{"text-shadow":_()}],opacity:[{opacity:[Se,xe,fe]}],"mix-blend":[{"mix-blend":[...ne(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ne()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Se]}],"mask-image-linear-from-pos":[{"mask-linear-from":J()}],"mask-image-linear-to-pos":[{"mask-linear-to":J()}],"mask-image-linear-from-color":[{"mask-linear-from":_()}],"mask-image-linear-to-color":[{"mask-linear-to":_()}],"mask-image-t-from-pos":[{"mask-t-from":J()}],"mask-image-t-to-pos":[{"mask-t-to":J()}],"mask-image-t-from-color":[{"mask-t-from":_()}],"mask-image-t-to-color":[{"mask-t-to":_()}],"mask-image-r-from-pos":[{"mask-r-from":J()}],"mask-image-r-to-pos":[{"mask-r-to":J()}],"mask-image-r-from-color":[{"mask-r-from":_()}],"mask-image-r-to-color":[{"mask-r-to":_()}],"mask-image-b-from-pos":[{"mask-b-from":J()}],"mask-image-b-to-pos":[{"mask-b-to":J()}],"mask-image-b-from-color":[{"mask-b-from":_()}],"mask-image-b-to-color":[{"mask-b-to":_()}],"mask-image-l-from-pos":[{"mask-l-from":J()}],"mask-image-l-to-pos":[{"mask-l-to":J()}],"mask-image-l-from-color":[{"mask-l-from":_()}],"mask-image-l-to-color":[{"mask-l-to":_()}],"mask-image-x-from-pos":[{"mask-x-from":J()}],"mask-image-x-to-pos":[{"mask-x-to":J()}],"mask-image-x-from-color":[{"mask-x-from":_()}],"mask-image-x-to-color":[{"mask-x-to":_()}],"mask-image-y-from-pos":[{"mask-y-from":J()}],"mask-image-y-to-pos":[{"mask-y-to":J()}],"mask-image-y-from-color":[{"mask-y-from":_()}],"mask-image-y-to-color":[{"mask-y-to":_()}],"mask-image-radial":[{"mask-radial":[xe,fe]}],"mask-image-radial-from-pos":[{"mask-radial-from":J()}],"mask-image-radial-to-pos":[{"mask-radial-to":J()}],"mask-image-radial-from-color":[{"mask-radial-from":_()}],"mask-image-radial-to-color":[{"mask-radial-to":_()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":w()}],"mask-image-conic-pos":[{"mask-conic":[Se]}],"mask-image-conic-from-pos":[{"mask-conic-from":J()}],"mask-image-conic-to-pos":[{"mask-conic-to":J()}],"mask-image-conic-from-color":[{"mask-conic-from":_()}],"mask-image-conic-to-color":[{"mask-conic-to":_()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:se()}],"mask-repeat":[{mask:U()}],"mask-size":[{mask:Q()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",xe,fe]}],filter:[{filter:["","none",xe,fe]}],blur:[{blur:te()}],brightness:[{brightness:[Se,xe,fe]}],contrast:[{contrast:[Se,xe,fe]}],"drop-shadow":[{"drop-shadow":["","none",f,Ta,Ea]}],"drop-shadow-color":[{"drop-shadow":_()}],grayscale:[{grayscale:["",Se,xe,fe]}],"hue-rotate":[{"hue-rotate":[Se,xe,fe]}],invert:[{invert:["",Se,xe,fe]}],saturate:[{saturate:[Se,xe,fe]}],sepia:[{sepia:["",Se,xe,fe]}],"backdrop-filter":[{"backdrop-filter":["","none",xe,fe]}],"backdrop-blur":[{"backdrop-blur":te()}],"backdrop-brightness":[{"backdrop-brightness":[Se,xe,fe]}],"backdrop-contrast":[{"backdrop-contrast":[Se,xe,fe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Se,xe,fe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Se,xe,fe]}],"backdrop-invert":[{"backdrop-invert":["",Se,xe,fe]}],"backdrop-opacity":[{"backdrop-opacity":[Se,xe,fe]}],"backdrop-saturate":[{"backdrop-saturate":[Se,xe,fe]}],"backdrop-sepia":[{"backdrop-sepia":["",Se,xe,fe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":k()}],"border-spacing-x":[{"border-spacing-x":k()}],"border-spacing-y":[{"border-spacing-y":k()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",xe,fe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Se,"initial",xe,fe]}],ease:[{ease:["linear","initial",b,xe,fe]}],delay:[{delay:[Se,xe,fe]}],animate:[{animate:["none",y,xe,fe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[h,xe,fe]}],"perspective-origin":[{"perspective-origin":C()}],rotate:[{rotate:ce()}],"rotate-x":[{"rotate-x":ce()}],"rotate-y":[{"rotate-y":ce()}],"rotate-z":[{"rotate-z":ce()}],scale:[{scale:be()}],"scale-x":[{"scale-x":be()}],"scale-y":[{"scale-y":be()}],"scale-z":[{"scale-z":be()}],"scale-3d":["scale-3d"],skew:[{skew:Ce()}],"skew-x":[{"skew-x":Ce()}],"skew-y":[{"skew-y":Ce()}],transform:[{transform:[xe,fe,"","none","gpu","cpu"]}],"transform-origin":[{origin:C()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ve()}],"translate-x":[{"translate-x":ve()}],"translate-y":[{"translate-y":ve()}],"translate-z":[{"translate-z":ve()}],"translate-none":["translate-none"],accent:[{accent:_()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:_()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",xe,fe]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":k()}],"scroll-mx":[{"scroll-mx":k()}],"scroll-my":[{"scroll-my":k()}],"scroll-ms":[{"scroll-ms":k()}],"scroll-me":[{"scroll-me":k()}],"scroll-mbs":[{"scroll-mbs":k()}],"scroll-mbe":[{"scroll-mbe":k()}],"scroll-mt":[{"scroll-mt":k()}],"scroll-mr":[{"scroll-mr":k()}],"scroll-mb":[{"scroll-mb":k()}],"scroll-ml":[{"scroll-ml":k()}],"scroll-p":[{"scroll-p":k()}],"scroll-px":[{"scroll-px":k()}],"scroll-py":[{"scroll-py":k()}],"scroll-ps":[{"scroll-ps":k()}],"scroll-pe":[{"scroll-pe":k()}],"scroll-pbs":[{"scroll-pbs":k()}],"scroll-pbe":[{"scroll-pbe":k()}],"scroll-pt":[{"scroll-pt":k()}],"scroll-pr":[{"scroll-pr":k()}],"scroll-pb":[{"scroll-pb":k()}],"scroll-pl":[{"scroll-pl":k()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",xe,fe]}],fill:[{fill:["none",..._()]}],"stroke-w":[{stroke:[Se,Un,Gr,dd]}],stroke:[{stroke:["none",..._()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},FC=hC(OC);function Ut(...e){return FC(Xk(e))}const br=({onInsert:e})=>{const[t,r]=N.useState(null),n=async a=>{const s=`{{${a}}}`;try{await navigator.clipboard.writeText(s)}catch{const i=document.createElement("textarea");i.value=s,i.style.position="fixed",i.style.opacity="0",document.body.appendChild(i),i.select(),document.execCommand("copy"),document.body.removeChild(i)}e&&e(s),r(a),setTimeout(()=>r(null),1500)};return o.jsxs(To,{children:[o.jsx(Ao,{asChild:!0,children:o.jsx(Ae,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0 text-muted-foreground hover:text-primary",title:"Inserir variável do evento",children:o.jsx(I.Braces,{className:"h-3.5 w-3.5"})})}),o.jsxs(da,{className:"w-80 p-0",align:"end",side:"left",sideOffset:6,children:[o.jsxs("div",{className:"px-3 py-2 border-b border-border",children:[o.jsx("p",{className:"text-xs font-semibold text-foreground",children:"Variáveis do evento"}),o.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["Clique para copiar. Use"," ",o.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"{{evento.xxx}}"})," ","em labels, placeholders e hints."]})]}),o.jsx("div",{className:"max-h-64 overflow-y-auto py-1",children:bl.map(a=>{const s=t===a.key;return o.jsxs("button",{type:"button",onClick:()=>n(a.key),className:Ut("w-full flex items-center justify-between px-3 py-1.5 text-left hover:bg-accent transition-colors",s&&"bg-primary/10"),children:[o.jsxs("div",{className:"min-w-0",children:[o.jsx("p",{className:"text-xs font-medium truncate",children:a.label}),o.jsx("code",{className:"text-[10px] text-muted-foreground font-mono",children:`{{${a.key}}}`})]}),o.jsx("div",{className:"ml-2 shrink-0",children:s?o.jsx(I.Check,{className:"h-3.5 w-3.5 text-primary"}):o.jsx(I.Braces,{className:"h-3 w-3 text-muted-foreground/50"})})]},a.key)})})]})]})},zC=({config:e,onUpdate:t})=>o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(ie,{className:"text-xs",children:"Label"}),o.jsx(br,{})]}),o.jsx(ue,{value:e.label,onChange:r=>t({label:r.target.value}),className:"h-8 text-sm"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(ie,{className:"text-xs",children:"Descrição"}),o.jsx(br,{})]}),o.jsx(ue,{value:e.description||"",onChange:r=>t({description:r.target.value}),className:"h-8 text-sm",placeholder:"Descrição do step"})]}),o.jsx(nh,{value:e.icone,onChange:r=>t({icone:r})}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(rt,{id:"step-show-label",checked:e.showLabel!==!1,onCheckedChange:r=>t({showLabel:r===!0})}),o.jsx(ie,{htmlFor:"step-show-label",className:"text-xs cursor-pointer",children:"Exibir título no formulário"})]})]}),LC=({inicioColuna:e,tamanho:t,onSelect:r})=>o.jsxs("div",{className:"space-y-2",children:[o.jsx(ie,{className:"text-xs",children:"Posição no grid"}),o.jsx("div",{className:"flex gap-0.5",children:Array.from({length:12},(n,a)=>{const s=a+1,i=s>=e&&s<e+t;return o.jsx("button",{onClick:()=>r(s),className:Ut("flex-1 h-6 rounded-sm text-[8px] font-mono transition-all border",i?"bg-primary text-primary-foreground border-primary":"bg-muted/50 text-muted-foreground/50 border-border/50 hover:bg-muted hover:border-border"),children:s},s)})}),o.jsxs("p",{className:"text-[9px] text-muted-foreground",children:["Início: col ",e," · Span: ",t]})]}),Qh=({tamanho:e,inicioColuna:t,defaultTamanho:r=6,onTamanhoChange:n,onPositionChange:a})=>{const s=13-t;return o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsxs(ie,{className:"text-xs",children:["Tamanho (",e,"/12 colunas)"]}),o.jsx(So,{value:[e],onValueChange:([i])=>{const l=Math.min(i,s);n(l)},min:1,max:s,step:1,className:"py-1"}),o.jsxs("div",{className:"flex justify-between text-[9px] text-muted-foreground",children:[o.jsx("span",{children:"1"}),o.jsx("span",{children:"3"}),o.jsx("span",{children:"6"}),o.jsx("span",{children:"9"}),o.jsx("span",{children:"12"})]})]}),o.jsx(LC,{inicioColuna:t,tamanho:e,onSelect:i=>{const l=13-i,c=Math.min(e,l);a(i),c!==e&&n(c)}})]})},MC=({config:e,onUpdate:t})=>o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(ie,{className:"text-xs",children:"Label"}),o.jsx(br,{})]}),o.jsx(ue,{value:e.label,onChange:r=>t({label:r.target.value}),className:"h-8 text-sm"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(ie,{className:"text-xs",children:"Descrição"}),o.jsx(br,{})]}),o.jsx(ue,{value:e.description||"",onChange:r=>t({description:r.target.value}),className:"h-8 text-sm",placeholder:"Descrição do container"})]}),o.jsx(nh,{value:e.icone,onChange:r=>t({icone:r})}),o.jsx(Qh,{tamanho:e.tamanho||12,inicioColuna:e.inicioColuna||1,defaultTamanho:12,onTamanhoChange:r=>t({tamanho:r}),onPositionChange:r=>t({inicioColuna:r})}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Colunas internas"}),o.jsxs(Vt,{value:String(e.columns||2),onValueChange:r=>t({columns:Number(r)}),children:[o.jsx(Dt,{className:"h-8 text-sm",children:o.jsx(Bt,{})}),o.jsxs(Rt,{children:[o.jsx(Xe,{value:"1",children:"1 coluna"}),o.jsx(Xe,{value:"2",children:"2 colunas"}),o.jsx(Xe,{value:"3",children:"3 colunas"}),o.jsx(Xe,{value:"4",children:"4 colunas"})]})]}),o.jsx("p",{className:"text-[9px] text-muted-foreground",children:"Grid interno simplificado para campos"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(rt,{id:"show-label",checked:e.showLabel!==!1,onCheckedChange:r=>t({showLabel:r===!0})}),o.jsx(ie,{htmlFor:"show-label",className:"text-xs cursor-pointer",children:"Exibir label no formulário"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(rt,{id:"show-as-card",checked:e.showAsCard||!1,onCheckedChange:r=>t({showAsCard:r===!0})}),o.jsx(ie,{htmlFor:"show-as-card",className:"text-xs cursor-pointer",children:"Exibir como card"})]})]}),ii=[{category:"Texto básico",presets:[{pattern:"^[A-Za-z]+$",label:"Apenas letras",description:"Aceita somente letras de A-Z (maiúsculas e minúsculas), sem espaços, números ou especiais."},{pattern:"^[a-z]+$",label:"Apenas minúsculas",description:"Aceita somente letras minúsculas de a-z."},{pattern:"^[A-Z]+$",label:"Apenas maiúsculas",description:"Aceita somente letras maiúsculas de A-Z."},{pattern:"^[A-Za-zÀ-ÿ]+$",label:"Letras com acentos",description:"Aceita letras incluindo acentuadas (é, ã, ü, etc.)."},{pattern:"^[A-Za-zÀ-ÿ\\s]+$",label:"Letras, acentos e espaços",description:"Aceita letras com acentos e espaços — ideal para nomes completos."},{pattern:"^[A-Za-z0-9]+$",label:"Alfanumérico",description:"Apenas letras e números, sem espaços ou caracteres especiais."},{pattern:"^[A-Za-z0-9\\s]+$",label:"Alfanumérico com espaços",description:"Letras, números e espaços."},{pattern:"^[A-Za-z0-9_]+$",label:"Alfanumérico + underscore",description:"Letras, números e underscore (_). Padrão para usernames."},{pattern:"^[A-Za-z0-9_-]+$",label:"Slug-friendly",description:"Letras, números, underscore e hífen. Ideal para slugs de URL."},{pattern:"^\\S+$",label:"Sem espaços",description:"Aceita qualquer caractere exceto espaços em branco."},{pattern:"^.{1,}$",label:"Não vazio",description:"Exige pelo menos 1 caractere (qualquer um)."}]},{category:"Números",presets:[{pattern:"^[0-9]+$",label:"Apenas dígitos",description:"Aceita somente dígitos numéricos (0-9)."},{pattern:"^-?[0-9]+$",label:"Inteiro (com negativo)",description:"Número inteiro, opcionalmente negativo."},{pattern:"^[0-9]+\\.?[0-9]*$",label:"Decimal positivo",description:"Número decimal positivo (ex: 3.14, 42)."},{pattern:"^-?[0-9]+\\.?[0-9]*$",label:"Decimal (com negativo)",description:"Número decimal, opcionalmente negativo."},{pattern:"^\\d{1,3}(\\.\\d{3})*(,\\d{2})?$",label:"Formato BR (1.234,56)",description:"Número no formato brasileiro com pontos de milhar e vírgula decimal."},{pattern:"^\\d{1,3}(,\\d{3})*(\\.\\d{2})?$",label:"Formato US (1,234.56)",description:"Número no formato americano com vírgulas de milhar e ponto decimal."},{pattern:"^[01]+$",label:"Binário",description:"Aceita apenas 0 e 1 — representação binária."},{pattern:"^[0-9A-Fa-f]+$",label:"Hexadecimal",description:"Aceita dígitos hexadecimais (0-9, A-F)."},{pattern:"^0[xX][0-9A-Fa-f]+$",label:"Hex com prefixo 0x",description:"Hexadecimal com prefixo 0x (ex: 0xFF)."},{pattern:"^[0-7]+$",label:"Octal",description:"Aceita apenas dígitos octais (0-7)."},{pattern:"^\\d+(\\.\\d{1,2})?$",label:"Monetário (2 casas)",description:"Número com até 2 casas decimais — ideal para valores monetários."},{pattern:"^\\d+(\\.\\d{1,4})?$",label:"Até 4 casas decimais",description:"Número com até 4 casas decimais."}]},{category:"Documentos BR",presets:[{pattern:"^\\d{3}\\.\\d{3}\\.\\d{3}-\\d{2}$",label:"CPF (com máscara)",description:"CPF formatado: 123.456.789-00."},{pattern:"^\\d{11}$",label:"CPF (sem máscara)",description:"CPF apenas dígitos: 12345678900."},{pattern:"^\\d{2}\\.\\d{3}\\.\\d{3}/\\d{4}-\\d{2}$",label:"CNPJ (com máscara)",description:"CNPJ formatado: 12.345.678/0001-00."},{pattern:"^\\d{14}$",label:"CNPJ (sem máscara)",description:"CNPJ apenas dígitos: 12345678000100."},{pattern:"^\\d{5}-?\\d{3}$",label:"CEP",description:"CEP brasileiro: 12345-678 ou 12345678."},{pattern:"^\\d{1,2}\\.\\d{3}\\.\\d{3}[-]?\\d{1}$",label:"RG (formato comum)",description:"RG no formato mais comum: 1.234.567-8."},{pattern:"^\\d{11}$",label:"PIS/PASEP",description:"PIS/PASEP com 11 dígitos."},{pattern:"^\\d{3}\\.?\\d{7}-?\\d{1}$",label:"Título de eleitor",description:"Título de eleitor com 12 dígitos."},{pattern:"^[A-Z]{2}\\d{7}$",label:"Passaporte BR",description:"Passaporte brasileiro: 2 letras + 7 dígitos (ex: AB1234567)."},{pattern:"^\\d{11}$",label:"CNH (registro)",description:"Número de registro da CNH: 11 dígitos."},{pattern:"^\\d{10}$",label:"Certidão (matrícula)",description:"Matrícula de certidão de nascimento/casamento."},{pattern:"^\\d{3}\\.\\d{3}\\.\\d{3}-\\d{2}$|^\\d{2}\\.\\d{3}\\.\\d{3}/\\d{4}-\\d{2}$",label:"CPF ou CNPJ",description:"Aceita CPF (123.456.789-00) ou CNPJ (12.345.678/0001-00)."}]},{category:"Contato",presets:[{pattern:"^[\\w.-]+@[\\w.-]+\\.[A-Za-z]{2,}$",label:"E-mail simples",description:"Validação básica de e-mail: usuario@dominio.com."},{pattern:"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$",label:"E-mail completo",description:"E-mail com mais caracteres aceitos no usuário."},{pattern:"^\\(\\d{2}\\)\\s?\\d{4,5}-\\d{4}$",label:"Telefone BR (com máscara)",description:"Telefone formatado: (11) 91234-5678 ou (11) 1234-5678."},{pattern:"^\\d{10,11}$",label:"Telefone BR (sem máscara)",description:"Telefone apenas dígitos: 11912345678."},{pattern:"^\\+\\d{1,3}\\s?\\d{2,3}\\s?\\d{4,5}[-]?\\d{4}$",label:"Telefone internacional",description:"Formato +55 11 91234-5678."},{pattern:"^\\+55\\d{10,11}$",label:"Celular BR (+55)",description:"Celular brasileiro com DDI: +5511912345678."},{pattern:"^\\d{4,5}-\\d{4}$",label:"Telefone (sem DDD)",description:"Número local: 1234-5678 ou 91234-5678."},{pattern:"^0800\\d{6,7}$",label:"0800",description:"Número 0800 (SAC): 0800XXXXXXX."}]},{category:"Internet / URLs",presets:[{pattern:"^https?://[\\w.-]+(:\\d+)?(/[\\w./-]*)*$",label:"URL HTTP/HTTPS",description:"URL completa com protocolo http ou https."},{pattern:"^(https?://)?[\\w.-]+\\.[A-Za-z]{2,}(/.*)?$",label:"URL (protocolo opcional)",description:"URL com ou sem http:// na frente."},{pattern:"^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*\\.[a-z]{2,}$",label:"Domínio",description:"Nome de domínio válido: exemplo.com.br."},{pattern:"^((25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\.){3}(25[0-5]|2[0-4]\\d|[01]?\\d\\d?)$",label:"IPv4",description:"Endereço IPv4: 192.168.0.1."},{pattern:"^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$",label:"IPv6 (completo)",description:"Endereço IPv6 completo."},{pattern:"^[a-z][a-z0-9-]*$",label:"Subdomínio",description:"Nome de subdomínio válido (letra inicial, alfanumérico + hífen)."},{pattern:"^[A-Za-z][A-Za-z0-9+.-]*://.*$",label:"URI genérica",description:"Qualquer URI com esquema (ftp://, mailto:, tel:, etc.)."},{pattern:"^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$",label:"Cor hex (#FFF)",description:"Código de cor hexadecimal: #FFF ou #FFFFFF."},{pattern:"^#[0-9A-Fa-f]{8}$",label:"Cor hex com alpha",description:"Cor hexadecimal com canal alpha: #FFFFFFFF."},{pattern:"^rgb\\(\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*\\)$",label:"Cor RGB",description:"Cor no formato rgb(255, 0, 0)."}]},{category:"Data e hora",presets:[{pattern:"^\\d{2}/\\d{2}/\\d{4}$",label:"Data DD/MM/AAAA",description:"Data no formato brasileiro: 25/12/2024."},{pattern:"^\\d{4}-\\d{2}-\\d{2}$",label:"Data ISO (AAAA-MM-DD)",description:"Data no formato ISO 8601: 2024-12-25."},{pattern:"^\\d{2}/\\d{2}/\\d{2}$",label:"Data DD/MM/AA",description:"Data com ano de 2 dígitos: 25/12/24."},{pattern:"^\\d{2}-\\d{2}-\\d{4}$",label:"Data DD-MM-AAAA",description:"Data com hífens: 25-12-2024."},{pattern:"^\\d{2}:\\d{2}$",label:"Hora HH:MM",description:"Horário 24h: 14:30."},{pattern:"^\\d{2}:\\d{2}:\\d{2}$",label:"Hora HH:MM:SS",description:"Horário com segundos: 14:30:59."},{pattern:"^(0[1-9]|1[0-2])/\\d{4}$",label:"Mês/Ano (MM/AAAA)",description:"Mês e ano: 12/2024."},{pattern:"^\\d{4}$",label:"Ano (4 dígitos)",description:"Ano com 4 dígitos: 2024."},{pattern:"^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}$",label:"DateTime ISO (sem seg)",description:"Data e hora ISO: 2024-12-25T14:30."},{pattern:"^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$",label:"DateTime ISO (com seg)",description:"Data e hora ISO com segundos."},{pattern:"^\\d{2}/\\d{2}/\\d{4}\\s\\d{2}:\\d{2}$",label:"DateTime BR",description:"Data e hora BR: 25/12/2024 14:30."}]},{category:"Senhas",presets:[{pattern:"^.{6,}$",label:"Mín. 6 caracteres",description:"Exige no mínimo 6 caracteres (qualquer tipo)."},{pattern:"^.{8,}$",label:"Mín. 8 caracteres",description:"Exige no mínimo 8 caracteres."},{pattern:"^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d).{8,}$",label:"Forte (letra+número)",description:"Mín. 8 chars com pelo menos 1 maiúscula, 1 minúscula e 1 número."},{pattern:"^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[!@#$%^&*]).{8,}$",label:"Muito forte",description:"Mín. 8 chars com maiúscula, minúscula, número e caractere especial."},{pattern:"^(?=.*[A-Z])(?=.*\\d).{6,}$",label:"Média (maiúsc+número)",description:"Mín. 6 chars com pelo menos 1 maiúscula e 1 número."},{pattern:"^(?!.*\\s).{8,}$",label:"Sem espaços (mín. 8)",description:"Mín. 8 caracteres, sem espaços."}]},{category:"Nomes e texto formatado",presets:[{pattern:"^[A-Za-zÀ-ÿ]{2,}(\\s[A-Za-zÀ-ÿ]{2,})+$",label:"Nome completo",description:"Nome e sobrenome (mínimo 2 palavras, cada com 2+ letras)."},{pattern:"^[A-Za-zÀ-ÿ]{2,}$",label:"Primeiro nome",description:"Apenas o primeiro nome (mínimo 2 letras, com acentos)."},{pattern:"^[A-Za-zÀ-ÿ'\\-\\s]+$",label:"Nome com apóstrofo/hífen",description:"Nome que aceita D'Silva, Maria-José, etc."},{pattern:"^[A-Z][a-zà-ÿ]+(\\s[A-Z][a-zà-ÿ]+)*$",label:"Nome capitalizado",description:"Cada palavra inicia com maiúscula: João Silva."},{pattern:"^@[A-Za-z0-9_]{1,30}$",label:"Username (@handle)",description:"Username no estilo @usuario (letras, números, underscore, até 30 chars)."},{pattern:"^[a-z0-9_]{3,20}$",label:"Username simples",description:"Username minúsculo: 3-20 chars, letras, números e underscore."},{pattern:"^[A-Za-z0-9._%+-]+$",label:"Parte local do e-mail",description:"Parte antes do @ em endereços de e-mail."}]},{category:"Endereço",presets:[{pattern:"^[A-Za-zÀ-ÿ0-9\\s,./-]+$",label:"Endereço genérico",description:"Aceita letras, números, espaços, vírgulas, pontos, barras e hífens."},{pattern:"^\\d{1,6}$",label:"Número residencial",description:"Número do endereço: 1 a 6 dígitos."},{pattern:"^\\d{5}-?\\d{3}$",label:"CEP",description:"CEP: 12345-678 ou 12345678."},{pattern:"^[A-Z]{2}$",label:"UF (estado)",description:"Sigla do estado brasileiro: SP, RJ, MG, etc."},{pattern:"^(Rua|Av|Avenida|Travessa|Alameda|Praça|Rod|Rodovia)\\s.+$",label:"Logradouro BR",description:"Começa com tipo de via: Rua, Avenida, Travessa, etc."},{pattern:"^(Apt|Apto|Sala|Bloco|Lote|Casa)\\s?\\d+.*$",label:"Complemento",description:"Complemento: Apto 123, Bloco B, Sala 3, etc."}]},{category:"Financeiro",presets:[{pattern:"^R\\$\\s?\\d{1,3}(\\.\\d{3})*(,\\d{2})?$",label:"Moeda BRL (R$)",description:"Valor em reais: R$ 1.234,56."},{pattern:"^\\$\\d{1,3}(,\\d{3})*(\\.\\d{2})?$",label:"Moeda USD ($)",description:"Valor em dólares: $1,234.56."},{pattern:"^\\d{4}[\\s-]?\\d{4}[\\s-]?\\d{4}[\\s-]?\\d{4}$",label:"Cartão de crédito",description:"Número de cartão: 1234 5678 9012 3456."},{pattern:"^(0[1-9]|1[0-2])/\\d{2}$",label:"Validade cartão (MM/AA)",description:"Data de validade: 12/25."},{pattern:"^\\d{3,4}$",label:"CVV",description:"Código de segurança: 3 ou 4 dígitos."},{pattern:"^\\d{1,6}(-[0-9Xx])?$",label:"Agência bancária",description:"Número da agência: 1234-5 ou 1234."},{pattern:"^\\d{1,12}(-[0-9Xx])?$",label:"Conta bancária",description:"Número da conta: até 12 dígitos com dígito verificador."},{pattern:"^\\d{1,3}(\\.\\d{3})*(,\\d{2})$",label:"Valor BR sem símbolo",description:"Valor monetário sem R$: 1.234,56."}]},{category:"Veículos",presets:[{pattern:"^[A-Z]{3}-?\\d{4}$",label:"Placa antiga (ABC-1234)",description:"Placa veicular formato antigo: ABC-1234."},{pattern:"^[A-Z]{3}\\d[A-Z]\\d{2}$",label:"Placa Mercosul (ABC1D23)",description:"Placa veicular Mercosul: ABC1D23."},{pattern:"^[A-Z]{3}-?\\d{4}$|^[A-Z]{3}\\d[A-Z]\\d{2}$",label:"Placa (ambos formatos)",description:"Aceita placa antiga (ABC-1234) ou Mercosul (ABC1D23)."},{pattern:"^\\d{11}$",label:"RENAVAM",description:"RENAVAM: 11 dígitos numéricos."},{pattern:"^[A-Z0-9]{17}$",label:"Chassi (VIN)",description:"Número de chassi/VIN: 17 caracteres alfanuméricos maiúsculos."}]},{category:"Códigos e identificadores",presets:[{pattern:"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",label:"UUID v4",description:"UUID formato padrão: 550e8400-e29b-41d4-a716-446655440000."},{pattern:"^[A-Za-z0-9+/]+={0,2}$",label:"Base64",description:"String codificada em Base64."},{pattern:"^[A-Za-z0-9-_]+$",label:"Base64 URL-safe",description:"Base64 com caracteres seguros para URL."},{pattern:"^[0-9a-f]{32}$",label:"MD5 hash",description:"Hash MD5: 32 caracteres hexadecimais."},{pattern:"^[0-9a-f]{40}$",label:"SHA-1 hash",description:"Hash SHA-1: 40 caracteres hexadecimais."},{pattern:"^[0-9a-f]{64}$",label:"SHA-256 hash",description:"Hash SHA-256: 64 caracteres hexadecimais."},{pattern:"^\\d{8,14}$",label:"Código de barras",description:"Código de barras numérico: 8-14 dígitos."},{pattern:"^\\d{44}$",label:"Linha digitável boleto",description:"Linha digitável de boleto: 44 dígitos."},{pattern:"^[A-Z]{2}\\d{2}[A-Z0-9]{4}\\d{7}([A-Z0-9]?){0,16}\\d{2}$",label:"IBAN",description:"Código bancário internacional IBAN."},{pattern:"^[A-Z]{4}[A-Z]{2}[A-Z0-9]{2}([A-Z0-9]{3})?$",label:"SWIFT/BIC",description:"Código SWIFT bancário: 8 ou 11 caracteres."}]},{category:"Saúde e governo",presets:[{pattern:"^\\d{15}$",label:"Cartão SUS",description:"Número do Cartão Nacional de Saúde: 15 dígitos."},{pattern:"^\\d{6,7}$",label:"CRM/CRO/CRP",description:"Número de registro profissional de saúde."},{pattern:"^\\d{3}\\.\\d{5}\\.\\d{2}-\\d$",label:"NIT/PIS",description:"Número de Identificação do Trabalhador."},{pattern:"^\\d{7}-?\\d{2}\\.\\d{4}\\.\\d\\.\\d{2}\\.\\d{4}$",label:"Processo judicial",description:"Número de processo judicial (formato CNJ)."},{pattern:"^\\d{12}$",label:"Inscrição estadual (genérica)",description:"Inscrição estadual genérica: 12 dígitos."},{pattern:"^\\d{11}$",label:"NIS/NIT",description:"Número de Identificação Social: 11 dígitos."}]},{category:"Redes sociais",presets:[{pattern:"^https?://(www\\.)?instagram\\.com/[A-Za-z0-9_.]+/?$",label:"Perfil Instagram",description:"URL de perfil do Instagram."},{pattern:"^https?://(www\\.)?facebook\\.com/.+$",label:"Perfil Facebook",description:"URL de perfil ou página do Facebook."},{pattern:"^https?://(www\\.)?linkedin\\.com/in/[A-Za-z0-9-]+/?$",label:"Perfil LinkedIn",description:"URL de perfil do LinkedIn."},{pattern:"^https?://(www\\.)?(twitter|x)\\.com/[A-Za-z0-9_]+/?$",label:"Perfil Twitter/X",description:"URL de perfil no Twitter/X."},{pattern:"^https?://(www\\.)?youtube\\.com/(c/|channel/|@)[A-Za-z0-9_-]+/?$",label:"Canal YouTube",description:"URL de canal do YouTube."},{pattern:"^https?://(www\\.)?github\\.com/[A-Za-z0-9_-]+/?$",label:"Perfil GitHub",description:"URL de perfil do GitHub."},{pattern:"^https?://(www\\.)?tiktok\\.com/@[A-Za-z0-9_.]+/?$",label:"Perfil TikTok",description:"URL de perfil do TikTok."}]},{category:"Programação",presets:[{pattern:"^[a-z][a-zA-Z0-9]*$",label:"camelCase",description:"Formato camelCase: minúscula inicial, sem espaços."},{pattern:"^[A-Z][a-zA-Z0-9]*$",label:"PascalCase",description:"Formato PascalCase: maiúscula inicial."},{pattern:"^[a-z]+(_[a-z]+)*$",label:"snake_case",description:"Formato snake_case: minúsculas separadas por underscore."},{pattern:"^[a-z]+(-[a-z]+)*$",label:"kebab-case",description:"Formato kebab-case: minúsculas separadas por hífen."},{pattern:"^[A-Z]+(_[A-Z]+)*$",label:"SCREAMING_SNAKE",description:"Constantes: MAIÚSCULAS_COM_UNDERSCORES."},{pattern:"^[a-zA-Z_$][a-zA-Z0-9_$]*$",label:"Variável JS válida",description:"Nome de variável JavaScript válido."},{pattern:"^v?\\d+\\.\\d+\\.\\d+(-[a-zA-Z0-9.]+)?$",label:"Semver",description:"Versionamento semântico: v1.2.3 ou 1.2.3-beta.1."},{pattern:"^[a-z][a-z0-9]*(-[a-z][a-z0-9]*)*$",label:"Nome de pacote npm",description:"Nome válido de pacote npm."}]}],VC=ii.flatMap(e=>e.presets),BC=({value:e,message:t,onChange:r})=>{const[n,a]=N.useState(!1),[s,i]=N.useState(""),l=N.useMemo(()=>{if(!s.trim())return ii;const u=s.toLowerCase();return ii.map(m=>({...m,presets:m.presets.filter(p=>p.label.toLowerCase().includes(u)||p.description.toLowerCase().includes(u)||p.pattern.toLowerCase().includes(u))})).filter(m=>m.presets.length>0)},[s]),c=N.useMemo(()=>e?VC.find(u=>u.pattern===e):void 0,[e]),d=u=>{r(u.pattern,`${u.label}: formato inválido`),a(!1),i("")};return o.jsxs("div",{className:"space-y-2",children:[o.jsx(ie,{className:"text-[10px]",children:"Regex"}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(ue,{value:e??"",onChange:u=>r(u.target.value||void 0,t),className:"h-7 text-xs font-mono flex-1",placeholder:"Clique no botão ou digite..."}),e&&o.jsx(Ae,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:()=>{r(void 0,void 0)},children:o.jsx(I.X,{className:"h-3 w-3"})}),o.jsxs(To,{open:n,onOpenChange:a,children:[o.jsx(Ao,{asChild:!0,children:o.jsx(Ae,{variant:"outline",size:"icon",className:"h-7 w-7 shrink-0",children:o.jsx(I.Regex,{className:"h-3.5 w-3.5"})})}),o.jsxs(da,{className:"w-[360px] p-0",side:"left",align:"start",sideOffset:8,children:[o.jsx("div",{className:"p-2 border-b",children:o.jsxs("div",{className:"relative",children:[o.jsx(I.Search,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),o.jsx(ue,{value:s,onChange:u=>i(u.target.value),className:"h-8 text-xs pl-7",placeholder:"Buscar regex (ex: CPF, e-mail, senha)...",autoFocus:!0})]})}),o.jsx(Oo,{className:"h-[360px]",children:o.jsxs("div",{className:"p-1",children:[l.length===0&&o.jsx("p",{className:"text-xs text-muted-foreground text-center py-8",children:"Nenhum regex encontrado"}),l.map(u=>o.jsxs("div",{className:"mb-1",children:[o.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wide px-2 py-1.5 sticky top-0 bg-popover z-10",children:u.category}),u.presets.map(m=>o.jsxs(Vf,{children:[o.jsx(Bf,{asChild:!0,children:o.jsxs("button",{onClick:()=>d(m),className:"w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left hover:bg-accent transition-colors group",children:[o.jsx(I.ChevronRight,{className:"h-3 w-3 text-muted-foreground/50 group-hover:text-primary shrink-0"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("span",{className:"text-xs font-medium block truncate",children:m.label}),o.jsx("span",{className:"text-[10px] text-muted-foreground font-mono block truncate",children:m.pattern})]})]})}),o.jsxs(al,{side:"left",className:"max-w-[250px] text-xs",children:[o.jsx("p",{className:"font-semibold mb-1",children:m.label}),o.jsx("p",{children:m.description})]})]},m.pattern+m.label))]},u.category))]})})]})]})]}),c&&o.jsxs($i,{variant:"secondary",className:"text-[10px] font-normal gap-1",children:[o.jsx(I.Regex,{className:"h-2.5 w-2.5"}),c.label]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-[10px]",children:"Mensagem do regex"}),o.jsx(ue,{value:t??"",onChange:u=>r(e,u.target.value||void 0),className:"h-7 text-xs",placeholder:"Formato inválido"})]})]})},li=[{category:"Imagens",presets:[{value:"image/jpeg",label:"JPEG",description:"Imagem JPEG — formato mais comum para fotos. Boa compressão, perde qualidade."},{value:"image/png",label:"PNG",description:"Imagem PNG — suporta transparência, sem perda de qualidade. Arquivos maiores."},{value:"image/gif",label:"GIF",description:"Imagem GIF — suporta animações simples e transparência. Limitado a 256 cores."},{value:"image/webp",label:"WebP",description:"Formato moderno do Google — compressão superior ao JPEG e PNG."},{value:"image/svg+xml",label:"SVG",description:"Imagem vetorial XML — escalável sem perda. Ideal para logos e ícones."},{value:"image/bmp",label:"BMP",description:"Bitmap — sem compressão, arquivos muito grandes."},{value:"image/tiff",label:"TIFF",description:"Imagem TIFF — alta qualidade, usado em impressão profissional."},{value:"image/avif",label:"AVIF",description:"Formato moderno — melhor compressão que WebP, suporte crescente."},{value:"image/heic",label:"HEIC",description:"Formato padrão do iPhone — alta qualidade, tamanho reduzido."},{value:"image/*",label:"Qualquer imagem",description:"Aceita todos os formatos de imagem (JPEG, PNG, GIF, WebP, etc.)."}]},{category:"Documentos",presets:[{value:"application/pdf",label:"PDF",description:"Documento PDF — formato universal para documentos. Preserva formatação."},{value:"application/msword",label:"DOC (Word antigo)",description:"Microsoft Word 97-2003 (.doc)."},{value:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",label:"DOCX (Word)",description:"Microsoft Word moderno (.docx) — formato atual do Word."},{value:"application/vnd.ms-excel",label:"XLS (Excel antigo)",description:"Microsoft Excel 97-2003 (.xls)."},{value:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",label:"XLSX (Excel)",description:"Microsoft Excel moderno (.xlsx) — formato atual do Excel."},{value:"application/vnd.ms-powerpoint",label:"PPT (PowerPoint antigo)",description:"Microsoft PowerPoint 97-2003 (.ppt)."},{value:"application/vnd.openxmlformats-officedocument.presentationml.presentation",label:"PPTX (PowerPoint)",description:"Microsoft PowerPoint moderno (.pptx)."},{value:"application/vnd.oasis.opendocument.text",label:"ODT (LibreOffice)",description:"Documento de texto LibreOffice/OpenOffice (.odt)."},{value:"application/vnd.oasis.opendocument.spreadsheet",label:"ODS (LibreOffice)",description:"Planilha LibreOffice/OpenOffice (.ods)."},{value:"application/rtf",label:"RTF",description:"Rich Text Format — compatível com quase todos os editores de texto."},{value:"text/plain",label:"TXT",description:"Texto puro sem formatação (.txt)."},{value:"text/csv",label:"CSV",description:"Valores separados por vírgula — planilhas simples e dados tabulares."}]},{category:"Vídeos",presets:[{value:"video/mp4",label:"MP4",description:"Vídeo MP4 — formato mais compatível, boa compressão (H.264/H.265)."},{value:"video/webm",label:"WebM",description:"Vídeo WebM — formato aberto do Google, boa compressão."},{value:"video/quicktime",label:"MOV",description:"Vídeo QuickTime — formato padrão do macOS/iPhone."},{value:"video/x-msvideo",label:"AVI",description:"Vídeo AVI — formato antigo da Microsoft, arquivos grandes."},{value:"video/x-matroska",label:"MKV",description:"Matroska — contêiner flexível, suporta múltiplas faixas de áudio/legenda."},{value:"video/*",label:"Qualquer vídeo",description:"Aceita todos os formatos de vídeo."}]},{category:"Áudios",presets:[{value:"audio/mpeg",label:"MP3",description:"Áudio MP3 — formato mais popular, boa compressão com perda."},{value:"audio/wav",label:"WAV",description:"Áudio WAV — sem compressão, alta qualidade, arquivos grandes."},{value:"audio/ogg",label:"OGG",description:"Áudio OGG Vorbis — formato aberto, boa qualidade."},{value:"audio/aac",label:"AAC",description:"Áudio AAC — qualidade superior ao MP3 no mesmo bitrate."},{value:"audio/flac",label:"FLAC",description:"Áudio FLAC — compressão sem perda, alta fidelidade."},{value:"audio/webm",label:"WebM Áudio",description:"Áudio no contêiner WebM."},{value:"audio/*",label:"Qualquer áudio",description:"Aceita todos os formatos de áudio."}]},{category:"Compactados",presets:[{value:"application/zip",label:"ZIP",description:"Arquivo compactado ZIP — o mais universal."},{value:"application/x-rar-compressed",label:"RAR",description:"Arquivo compactado RAR — boa compressão, formato proprietário."},{value:"application/gzip",label:"GZ / GZIP",description:"Compactação GZIP — muito usado em ambientes Unix/Linux."},{value:"application/x-7z-compressed",label:"7Z",description:"Arquivo 7-Zip — excelente taxa de compressão."},{value:"application/x-tar",label:"TAR",description:"TAR — agrupa arquivos sem compressão (usado com gzip)."}]},{category:"Dados / Código",presets:[{value:"application/json",label:"JSON",description:"Dados JSON — formato leve para troca de dados."},{value:"application/xml",label:"XML",description:"Dados XML — formato de marcação extensível."},{value:"text/html",label:"HTML",description:"Página web HTML."},{value:"text/css",label:"CSS",description:"Folha de estilo CSS."},{value:"application/javascript",label:"JavaScript",description:"Código JavaScript (.js)."},{value:"application/x-yaml",label:"YAML",description:"Dados YAML — formato legível para configurações."},{value:"text/markdown",label:"Markdown",description:"Texto Markdown (.md) — formatação leve."}]},{category:"Fontes",presets:[{value:"font/ttf",label:"TTF",description:"Fonte TrueType — amplamente suportada."},{value:"font/otf",label:"OTF",description:"Fonte OpenType — recursos tipográficos avançados."},{value:"font/woff",label:"WOFF",description:"Web Open Font Format — otimizado para web."},{value:"font/woff2",label:"WOFF2",description:"WOFF2 — compressão superior ao WOFF."}]},{category:"Atalhos comuns",presets:[{value:"image/*",label:"Todas as imagens",description:"Aceita qualquer formato de imagem."},{value:"video/*",label:"Todos os vídeos",description:"Aceita qualquer formato de vídeo."},{value:"audio/*",label:"Todos os áudios",description:"Aceita qualquer formato de áudio."},{value:"_group_documentos",label:"Documentos comuns",description:"PDF + Word .doc e .docx.",group:["application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document"]},{value:"_group_imagens_web",label:"Imagens web",description:"JPEG, PNG e WebP — formatos mais usados na web.",group:["image/jpeg","image/png","image/webp"]},{value:"_group_planilhas",label:"Planilhas",description:"Excel .xls, .xlsx e CSV.",group:["application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","text/csv"]}]}],UC=li.flatMap(e=>e.presets),HC=({value:e,onChange:t})=>{const[r,n]=N.useState(!1),[a,s]=N.useState(""),[i,l]=N.useState(""),c=N.useMemo(()=>new Set(e??[]),[e]),d=N.useMemo(()=>{if(!a.trim())return li;const v=a.toLowerCase();return li.map(h=>({...h,presets:h.presets.filter(x=>x.label.toLowerCase().includes(v)||x.description.toLowerCase().includes(v)||x.value.toLowerCase().includes(v))})).filter(h=>h.presets.length>0)},[a]),u=v=>{const h=new Set(e??[]);v.group?v.group.every(x=>h.has(x))?v.group.forEach(x=>h.delete(x)):v.group.forEach(x=>h.add(x)):h.has(v.value)?h.delete(v.value):h.add(v.value),t(h.size>0?Array.from(h):void 0)},m=()=>{const v=i.trim();if(!v)return;const h=new Set(e??[]);h.add(v),t(Array.from(h)),l("")},p=v=>{const h=new Set(e??[]);h.delete(v),t(h.size>0?Array.from(h):void 0)},f=v=>{const h=UC.find(x=>x.value===v);return(h==null?void 0:h.label)??v};return o.jsxs("div",{className:"space-y-2",children:[o.jsx(ie,{className:"text-[10px]",children:"Tipos de arquivo aceitos"}),((e==null?void 0:e.length)??0)>0&&o.jsx("div",{className:"flex flex-wrap gap-1",children:e.map(v=>o.jsxs($i,{variant:"secondary",className:"text-[10px] gap-1 pr-1",children:[f(v),o.jsx("button",{onClick:()=>p(v),className:"hover:text-destructive",children:o.jsx(I.X,{className:"h-2.5 w-2.5"})})]},v))}),o.jsxs(To,{open:r,onOpenChange:n,children:[o.jsx(Ao,{asChild:!0,children:o.jsxs(Ae,{variant:"outline",className:"w-full h-8 text-xs justify-start gap-2",children:[o.jsx(I.FileType2,{className:"h-3.5 w-3.5"}),((e==null?void 0:e.length)??0)>0?`${e.length} tipo(s) selecionado(s)`:"Selecionar tipos de arquivo..."]})}),o.jsxs(da,{className:"w-[360px] p-0",side:"left",align:"start",sideOffset:8,children:[o.jsx("div",{className:"p-2 border-b",children:o.jsxs("div",{className:"relative",children:[o.jsx(I.Search,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),o.jsx(ue,{value:a,onChange:v=>s(v.target.value),className:"h-8 text-xs pl-7",placeholder:"Buscar tipos (ex: PDF, imagem, vídeo)...",autoFocus:!0})]})}),o.jsxs("div",{className:"px-2 py-1.5 border-b flex gap-1",children:[o.jsx(ue,{value:i,onChange:v=>l(v.target.value),className:"h-7 text-xs font-mono flex-1",placeholder:"Tipo customizado (ex: .dwg)",onKeyDown:v=>v.key==="Enter"&&m()}),o.jsx(Ae,{variant:"secondary",size:"sm",className:"h-7 text-xs shrink-0",onClick:m,disabled:!i.trim(),children:"Adicionar"})]}),o.jsx(Oo,{className:"h-[320px]",children:o.jsxs("div",{className:"p-1",children:[d.length===0&&o.jsx("p",{className:"text-xs text-muted-foreground text-center py-8",children:"Nenhum tipo encontrado"}),d.map(v=>o.jsxs("div",{className:"mb-1",children:[o.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wide px-2 py-1.5 sticky top-0 bg-popover z-10",children:v.category}),v.presets.map(h=>{const x=h.group?h.group.every(y=>c.has(y)):c.has(h.value),b=h.group?h.group.some(y=>c.has(y))&&!x:!1;return o.jsxs(Vf,{children:[o.jsx(Bf,{asChild:!0,children:o.jsxs("button",{onClick:()=>u(h),className:"w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left hover:bg-accent transition-colors",children:[o.jsx(rt,{checked:b?"indeterminate":x,className:"h-3.5 w-3.5",tabIndex:-1}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("span",{className:"text-xs font-medium",children:h.label}),!h.group&&o.jsx("span",{className:"text-[10px] text-muted-foreground font-mono ml-2",children:h.value}),h.group&&o.jsxs("span",{className:"text-[10px] text-muted-foreground ml-2",children:[h.group.length," tipos"]})]}),o.jsx(I.Info,{className:"h-3 w-3 text-muted-foreground/40 shrink-0"})]})}),o.jsxs(al,{side:"left",className:"max-w-[250px] text-xs",children:[o.jsx("p",{className:"font-semibold mb-1",children:h.label}),o.jsx("p",{children:h.description}),h.group&&o.jsx("ul",{className:"mt-1 space-y-0.5",children:h.group.map(y=>o.jsx("li",{className:"font-mono text-[10px] opacity-80",children:y},y))})]})]},h.value)})]},v.category))]})})]})]})]})},ex=1048576,Ja=1073741824;function pd(e){return e>=Ja&&e%Ja===0?"GB":"MB"}function fd(e,t){return t==="GB"?e/Ja:e/ex}function hd(e,t){return Math.round(e*(t==="GB"?Ja:ex))}const WC=({value:e,onChange:t})=>{const r=N.useMemo(()=>e?pd(e):"MB",[]),[n,a]=N.useState(r),[s,i]=N.useState(e?String(fd(e,r)):"");N.useEffect(()=>{if(e===void 0){i("");return}const d=pd(e);a(d),i(String(fd(e,d)))},[e]);const l=d=>{i(d);const u=parseFloat(d);d.trim()===""||isNaN(u)||u<=0?t(void 0):t(hd(u,n))},c=d=>{a(d);const u=parseFloat(s);!isNaN(u)&&u>0&&t(hd(u,d))};return o.jsxs("div",{className:"space-y-1.5",children:[o.jsx(ie,{className:"text-[10px]",children:"Tamanho máximo do arquivo"}),o.jsxs("div",{className:"flex gap-1.5",children:[o.jsx(ue,{type:"number",min:0,step:"any",value:s,onChange:d=>l(d.target.value),placeholder:"Ex: 10",className:"h-8 text-xs flex-1"}),o.jsxs(Vt,{value:n,onValueChange:d=>c(d),children:[o.jsx(Dt,{className:"w-[72px] h-8 text-xs",children:o.jsx(Bt,{})}),o.jsxs(Rt,{children:[o.jsx(Xe,{value:"MB",children:"MB"}),o.jsx(Xe,{value:"GB",children:"GB"})]})]})]}),e!==void 0&&o.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["= ",e.toLocaleString("pt-BR")," bytes"]})]})},qC=new Set(["texto","textarea","email","password","url","phone","tel","cpf","cnpj","cep","rg"]),GC=({fieldType:e,validation:t,onChange:r})=>{const n=(i,l)=>{const c=["minLength","maxLength","min","max","maxFileSize","minAge","maxAge"].includes(i)?l?Number(l):void 0:l||void 0;r({...t,[i]:c})},a=e==="file",s=qC.has(e);return o.jsxs("div",{className:"space-y-3",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase",children:"Validação"}),s&&o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-[10px]",children:"Min caracteres"}),o.jsx(ue,{type:"number",min:0,value:(t==null?void 0:t.minLength)??"",onChange:i=>n("minLength",i.target.value),className:"h-7 text-xs"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-[10px]",children:"Max caracteres"}),o.jsx(ue,{type:"number",min:0,value:(t==null?void 0:t.maxLength)??"",onChange:i=>n("maxLength",i.target.value),className:"h-7 text-xs"})]})]}),e==="number"&&o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-[10px]",children:"Valor mínimo"}),o.jsx(ue,{type:"number",value:(t==null?void 0:t.min)??"",onChange:i=>n("min",i.target.value),className:"h-7 text-xs"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-[10px]",children:"Valor máximo"}),o.jsx(ue,{type:"number",value:(t==null?void 0:t.max)??"",onChange:i=>n("max",i.target.value),className:"h-7 text-xs"})]})]}),(e==="date"||e==="datetime")&&o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-[10px]",children:"Data mínima"}),o.jsx(ue,{type:"date",value:(t==null?void 0:t.minDate)??"",onChange:i=>n("minDate",i.target.value),className:"h-7 text-xs"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-[10px]",children:"Data máxima"}),o.jsx(ue,{type:"date",value:(t==null?void 0:t.maxDate)??"",onChange:i=>n("maxDate",i.target.value),className:"h-7 text-xs"})]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-[10px]",children:"Idade mínima (anos)"}),o.jsx(ue,{type:"number",min:0,value:(t==null?void 0:t.minAge)??"",onChange:i=>n("minAge",i.target.value),className:"h-7 text-xs",placeholder:"ex: 18"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-[10px]",children:"Idade máxima (anos)"}),o.jsx(ue,{type:"number",min:0,value:(t==null?void 0:t.maxAge)??"",onChange:i=>n("maxAge",i.target.value),className:"h-7 text-xs",placeholder:"ex: 60"})]})]})]}),a&&o.jsxs("div",{className:"space-y-3",children:[o.jsx(HC,{value:t==null?void 0:t.fileTypes,onChange:i=>r({...t,fileTypes:i})}),o.jsx(WC,{value:t==null?void 0:t.maxFileSize,onChange:i=>r({...t,maxFileSize:i})})]}),!a&&o.jsx(BC,{value:(t==null?void 0:t.regex)??"",message:(t==null?void 0:t.regexMessage)??"",onChange:(i,l)=>r({...t,regex:i,regexMessage:l})})]})},tx=({options:e,onChange:t})=>{const r=N.useRef([]);if(r.current.length<e.length)for(let i=r.current.length;i<e.length;i++)r.current.push(`opt-${Math.random().toString(36).slice(2)}`);const n=N.useCallback((i,l,c)=>{const d=[...e];d[i]={...d[i],[l]:c},t(d)},[e,t]),a=N.useCallback(i=>{r.current.splice(i,1),t(e.filter((l,c)=>c!==i))},[e,t]),s=N.useCallback(()=>{t([...e,{value:"",label:""}])},[e,t]);return o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase",children:"Opções"}),e.map((i,l)=>o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(I.GripVertical,{className:"h-3 w-3 text-muted-foreground/40 shrink-0"}),o.jsx(ue,{value:i.value,onChange:c=>n(l,"value",c.target.value),className:"h-7 text-xs flex-1",placeholder:"Valor"}),o.jsxs("div",{className:"flex items-center gap-0.5 flex-1",children:[o.jsx(ue,{value:i.label,onChange:c=>n(l,"label",c.target.value),className:"h-7 text-xs flex-1",placeholder:"Label"}),o.jsx(br,{})]}),o.jsx(Ae,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:()=>a(l),children:o.jsx(I.Trash2,{className:"h-3 w-3"})})]},r.current[l])),o.jsxs(Ae,{variant:"outline",size:"sm",className:"w-full h-7 text-xs",onClick:s,children:[o.jsx(I.Plus,{className:"h-3 w-3 mr-1"})," Adicionar opção"]})]})},XC=[{value:"igual",label:"Igual a"},{value:"diferente",label:"Diferente de"},{value:"vazio",label:"Vazio"},{value:"naoVazio",label:"Não vazio"},{value:"contem",label:"Contém"},{value:"naoContem",label:"Não contém"},{value:"maiorQue",label:"Maior que"},{value:"menorQue",label:"Menor que"},{value:"maiorOuIgual",label:"Maior ou igual a"},{value:"menorOuIgual",label:"Menor ou igual a"}],ZC=["vazio","naoVazio"],xd=({cond:e,selectedId:t,allFieldIds:r,getFieldLabel:n,onUpdate:a})=>o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-[10px]",children:"Fonte"}),o.jsxs(Vt,{value:e.source||"campo",onValueChange:s=>a({source:s,when:""}),children:[o.jsx(Dt,{className:"h-7 text-xs",children:o.jsx(Bt,{})}),o.jsxs(Rt,{children:[o.jsx(Xe,{value:"campo",children:"Campo do formulário"}),o.jsx(Xe,{value:"evento",children:"Variável do evento"})]})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-[10px]",children:e.source==="evento"?"Variável do evento":"Quando o campo"}),o.jsxs(Vt,{value:e.when||"",onValueChange:s=>a({when:s}),children:[o.jsx(Dt,{className:"h-7 text-xs",children:o.jsx(Bt,{placeholder:e.source==="evento"?"Selecione uma variável...":"Selecione um campo..."})}),o.jsx(Rt,{children:e.source==="evento"?bl.map(s=>o.jsx(Xe,{value:s.key,children:s.label},s.key)):r.filter(s=>s!==t).map(s=>o.jsxs(Xe,{value:s,children:[n(s),o.jsxs("span",{className:"text-muted-foreground/50 ml-1 text-[9px] font-mono",children:["(",s,")"]})]},s))})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-[10px]",children:"Operador"}),o.jsxs(Vt,{value:e.operator,onValueChange:s=>a({operator:s}),children:[o.jsx(Dt,{className:"h-7 text-xs",children:o.jsx(Bt,{})}),o.jsx(Rt,{children:XC.map(s=>o.jsx(Xe,{value:s.value,children:s.label},s.value))})]})]}),!ZC.includes(e.operator)&&o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-[10px]",children:"Valor"}),o.jsx(ue,{value:e.value||"",onChange:s=>a({value:s.target.value}),className:"h-7 text-xs",placeholder:"Valor esperado"})]})]}),KC=({condition:e,selectedId:t,allFieldIds:r,getFieldLabel:n,onChange:a})=>{var s;const i=m=>{e&&a({...e,...m})},l=()=>{if(!e)return;const m=e.extraConditions??[];a({...e,logicOperator:e.logicOperator??"and",extraConditions:[...m,{when:"",operator:"igual",value:"",source:"campo"}]})},c=m=>{if(!e)return;const p=(e.extraConditions??[]).filter((f,v)=>v!==m);a({...e,extraConditions:p,logicOperator:p.length?e.logicOperator:void 0})},d=(m,p)=>{if(!e)return;const f=(e.extraConditions??[]).map((v,h)=>h===m?{...v,...p}:v);a({...e,extraConditions:f})},u=(((s=e==null?void 0:e.extraConditions)==null?void 0:s.length)??0)>0;return o.jsxs("div",{className:"space-y-3",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase",children:"Condicional"}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(rt,{id:"has-condition",checked:!!e,onCheckedChange:m=>{a(m?{when:"",operator:"igual",value:"",source:"campo"}:void 0)}}),o.jsx(ie,{htmlFor:"has-condition",className:"text-xs cursor-pointer",children:"Exibir condicionalmente"})]}),e&&o.jsxs("div",{className:"space-y-2 pl-2 border-l-2 border-amber-500/30",children:[o.jsx(xd,{cond:e,selectedId:t,allFieldIds:r,getFieldLabel:n,onUpdate:i}),u&&o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-[10px]",children:"Lógica"}),o.jsxs(Vt,{value:e.logicOperator??"and",onValueChange:m=>i({logicOperator:m}),children:[o.jsx(Dt,{className:"h-7 text-xs",children:o.jsx(Bt,{})}),o.jsxs(Rt,{children:[o.jsx(Xe,{value:"and",children:"E (AND) — todas devem ser verdadeiras"}),o.jsx(Xe,{value:"or",children:"OU (OR) — pelo menos uma deve ser verdadeira"})]})]})]}),(e.extraConditions??[]).map((m,p)=>o.jsxs("div",{className:"space-y-2 pt-2 border-t border-border/40",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("span",{className:"text-[10px] text-muted-foreground font-medium uppercase",children:[e.logicOperator==="or"?"OU":"E"," — condição"," ",p+2]}),o.jsx(Ae,{variant:"ghost",size:"sm",className:"h-5 px-1 text-[10px] text-destructive hover:text-destructive",onClick:()=>c(p),children:"Remover"})]}),o.jsx(xd,{cond:m,selectedId:t,allFieldIds:r,getFieldLabel:n,onUpdate:f=>d(p,f)})]},p)),o.jsx(Ae,{variant:"outline",size:"sm",className:"h-6 text-[10px] w-full mt-1",onClick:l,children:"+ Adicionar condição"})]})]})},gd=[{value:"texto",label:"Texto"},{value:"textarea",label:"Área de texto"},{value:"number",label:"Número"},{value:"email",label:"E-mail"},{value:"telefone",label:"Telefone"},{value:"cpf",label:"CPF"},{value:"cep",label:"CEP"},{value:"date",label:"Data"},{value:"datetime",label:"Data e hora"},{value:"select",label:"Seleção"},{value:"radio",label:"Radio"},{value:"checkbox",label:"Checkbox"}],YC=({subFields:e,onChange:t})=>{const[r,n]=N.useState(null),a=(i,l)=>{const c=e.map((d,u)=>u===i?{...d,...l}:d);t(c)},s=i=>{t(e.filter((l,c)=>c!==i)),n(null)};return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(ie,{className:"text-xs font-semibold",children:"Sub-campos"}),o.jsxs(Ae,{type:"button",variant:"ghost",size:"sm",className:"h-6 px-2 text-xs gap-1",onClick:()=>{const i={label:"Novo campo",name:`campo_${e.length+1}`,fieldType:"texto",required:!1};t([...e,i]),n(e.length)},children:[o.jsx(I.Plus,{className:"w-3 h-3"}),"Adicionar"]})]}),e.length===0&&o.jsx("p",{className:"text-[11px] text-muted-foreground italic py-1",children:"Nenhum sub-campo adicionado."}),e.map((i,l)=>{var c;return o.jsxs("div",{className:"border rounded-md text-xs overflow-hidden",children:[o.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 cursor-pointer hover:bg-muted/40 select-none",onClick:()=>n(r===l?null:l),children:[o.jsx($i,{variant:"secondary",className:"h-4 text-[9px] px-1 shrink-0",children:l+1}),o.jsx("span",{className:"flex-1 truncate font-medium",children:i.label||i.name||"Campo sem nome"}),o.jsx("span",{className:"text-muted-foreground text-[10px] shrink-0",children:((c=gd.find(d=>d.value===i.fieldType))==null?void 0:c.label)??i.fieldType}),o.jsx(Ae,{type:"button",variant:"ghost",size:"icon",className:"h-5 w-5 text-destructive hover:text-destructive shrink-0",onClick:d=>{d.stopPropagation(),s(l)},children:o.jsx(I.Trash2,{className:"w-3 h-3"})}),r===l?o.jsx(I.ChevronUp,{className:"w-3 h-3 text-muted-foreground shrink-0"}):o.jsx(I.ChevronDown,{className:"w-3 h-3 text-muted-foreground shrink-0"})]}),r===l&&o.jsxs("div",{className:"px-2 pb-2 space-y-2 border-t bg-muted/20",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-2 pt-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-[10px]",children:"Label"}),o.jsx(ue,{value:i.label,onChange:d=>a(l,{label:d.target.value}),className:"h-7 text-xs",placeholder:"Ex: Nome"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-[10px]",children:"Nome (campo)"}),o.jsx(ue,{value:i.name||"",onChange:d=>a(l,{name:d.target.value}),className:"h-7 text-xs",placeholder:"Ex: nome"})]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-[10px]",children:"Tipo de campo"}),o.jsxs(Vt,{value:i.fieldType,onValueChange:d=>a(l,{fieldType:d}),children:[o.jsx(Dt,{className:"h-7 text-xs",children:o.jsx(Bt,{})}),o.jsx(Rt,{children:gd.map(d=>o.jsx(Xe,{value:d.value,className:"text-xs",children:d.label},d.value))})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-[10px]",children:"Colunas (1-12)"}),o.jsx(ue,{type:"number",min:1,max:12,value:i.tamanho??"",onChange:d=>a(l,{tamanho:d.target.value?Number(d.target.value):void 0}),className:"h-7 text-xs",placeholder:"12"})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-[10px]",children:"Placeholder"}),o.jsx(ue,{value:i.placeholder||"",onChange:d=>a(l,{placeholder:d.target.value}),className:"h-7 text-xs",placeholder:"Texto de exemplo..."})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(rt,{id:`sf-req-${l}`,checked:i.required||!1,onCheckedChange:d=>a(l,{required:d===!0})}),o.jsx(ie,{htmlFor:`sf-req-${l}`,className:"text-[10px] cursor-pointer",children:"Obrigatório"})]}),["select","radio","checkbox_group"].includes(i.fieldType)&&o.jsx("div",{className:"pt-1",children:o.jsx(tx,{options:i.options||[],onChange:d=>a(l,{options:d})})})]})]},l)}),e.length>0&&o.jsx(it,{className:"mt-1"})]})},JC=({config:e,selectedId:t,allFieldIds:r,getFieldLabel:n,onUpdate:a})=>{const s=e.fieldType||"texto",i=["select","radio","checkbox_group","autocomplete"].includes(s),l=s==="field_array",c=e.locked===!0,d=s==="participation_type",u=s==="payment_method",m=s==="terms",p=s==="file",f=s==="slider",v=!!(e.isDisabled||e.isReadOnly),h=s==="rating",x=s==="date_range",b=s==="sub_form",{schemaId:y,uploadTermsPdf:j,deleteTermsPdf:w}=gt(),[C,S]=N.useState(e.termoPdfUploadId?"upload":"link"),[$,k]=N.useState({status:"idle"}),E=N.useRef(null),T=N.useRef(!0);N.useEffect(()=>()=>{T.current=!1},[]);const O=N.useCallback(async A=>{if(a({termoPdfUploadId:void 0}),w&&y)try{await w(A,y)}catch{}},[w,y,a]),L=N.useCallback(async A=>{if(A.type!=="application/pdf"){k({status:"error",message:"Apenas arquivos PDF são permitidos."});return}if(!y){k({status:"error",message:"Salve o schema primeiro para habilitar o upload de PDF."});return}if(!j){k({status:"error",message:"Upload de PDF não configurado. Forneça a prop uploadTermsPdf ao BuilderProvider."});return}const z=e.termoPdfUploadId;k({status:"uploading",fileName:A.name,progress:0});try{const X=await j(A,y,q=>k(Z=>Z.status==="uploading"?{...Z,progress:q}:Z));if(!T.current)return;if(z&&w)try{await w(z,y)}catch{}if(!T.current)return;a({termoPdfUploadId:X,termoPdfUrl:void 0}),k({status:"idle"})}catch(X){if(!T.current)return;k({status:"error",message:X instanceof Error?X.message:"Falha no upload do PDF."})}},[y,j,w,e.termoPdfUploadId,a]);return o.jsxs("div",{className:"space-y-4",children:[c&&o.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-amber-500/10 border border-amber-500/30 px-3 py-2",children:[o.jsx(I.Lock,{className:"h-4 w-4 text-amber-500 shrink-0"}),o.jsxs("div",{children:[o.jsx("p",{className:"text-xs font-medium text-amber-600 dark:text-amber-400",children:"Campo bloqueado"}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Tipo, nome e ID são fixos (integração automática)"})]})]}),d&&o.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-primary/5 border border-primary/30 px-3 py-2",children:[o.jsx(I.Lock,{className:"h-4 w-4 text-primary shrink-0"}),o.jsxs("div",{children:[o.jsx("p",{className:"text-xs font-medium text-primary",children:"Tipo de Participação"}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Datas, preços e vagas são carregados automaticamente do evento"})]})]}),m&&o.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-primary/5 border border-primary/30 px-3 py-2",children:[o.jsx(I.ScrollText,{className:"h-4 w-4 text-primary shrink-0"}),o.jsxs("div",{children:[o.jsx("p",{className:"text-xs font-medium text-primary",children:"Termos e Condições"}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Configure o texto ou URL do PDF abaixo"})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(ie,{className:"text-xs",children:"Label"}),o.jsx(br,{})]}),o.jsx(ue,{value:e.label,onChange:A=>a({label:A.target.value}),className:"h-8 text-sm"})]}),d||u?o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Dica (hint)"}),o.jsx(ue,{value:e.hint||"",onChange:A=>a({hint:A.target.value}),className:"h-8 text-sm",placeholder:"Texto de ajuda abaixo do campo"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(rt,{id:"req",checked:e.required||!1,onCheckedChange:A=>a({required:A===!0})}),o.jsx(ie,{htmlFor:"req",className:"text-xs cursor-pointer",children:"Campo obrigatório"})]})]}):m?o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Dica (hint)"}),o.jsx(ue,{value:e.hint||"",onChange:A=>a({hint:A.target.value}),className:"h-8 text-sm",placeholder:"Ex: Leia os termos antes de continuar"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(rt,{id:"req",checked:e.required||!1,onCheckedChange:A=>a({required:A===!0})}),o.jsx(ie,{htmlFor:"req",className:"text-xs cursor-pointer",children:"Campo obrigatório"})]}),o.jsx(it,{}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Conteúdo dos termos"}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Texto dos termos"}),o.jsx(io,{value:e.termoTexto||"",onChange:A=>a({termoTexto:A.target.value||void 0}),className:"text-sm min-h-[120px] resize-y",placeholder:"Escreva aqui os termos e condições que o usuário deverá ler e aceitar..."})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ie,{className:"text-xs",children:"PDF dos termos (opcional)"}),o.jsxs("div",{className:"flex gap-1 p-0.5 bg-muted rounded-md",children:[o.jsx("button",{type:"button",onClick:()=>S("link"),className:`flex-1 text-[11px] py-1 rounded transition-colors ${C==="link"?"bg-background shadow-sm font-medium":"text-muted-foreground hover:text-foreground"}`,children:"Link externo"}),o.jsx("button",{type:"button",onClick:()=>S("upload"),className:`flex-1 text-[11px] py-1 rounded transition-colors ${C==="upload"?"bg-background shadow-sm font-medium":"text-muted-foreground hover:text-foreground"}`,children:"Upload de PDF"})]}),C==="link"?o.jsxs("div",{className:"space-y-1",children:[o.jsx(ue,{value:e.termoPdfUrl||"",onChange:A=>a({termoPdfUrl:A.target.value||void 0}),className:"h-8 text-sm",placeholder:"https://exemplo.com/termos.pdf"}),o.jsx("p",{className:"text-[9px] text-muted-foreground",children:"URL pública de um PDF. Tem prioridade sobre o texto acima."})]}):o.jsxs("div",{className:"space-y-2",children:[e.termoPdfUploadId&&$.status==="idle"?o.jsxs("div",{className:"flex items-center gap-2 rounded border border-green-500/40 bg-green-500/10 px-2 py-1.5",children:[o.jsx(I.CheckCircle2,{className:"h-3.5 w-3.5 text-green-600 shrink-0"}),o.jsx("span",{className:"text-[11px] text-green-700 dark:text-green-400 flex-1",children:"PDF enviado ✓"}),o.jsx(Ae,{type:"button",variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>O(e.termoPdfUploadId),children:o.jsx(I.X,{className:"h-3 w-3"})})]}):null,$.status==="uploading"?o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-muted-foreground",children:[o.jsx(I.Loader2,{className:"h-3.5 w-3.5 animate-spin"}),o.jsx("span",{className:"truncate",children:$.fileName}),o.jsxs("span",{className:"ml-auto",children:[$.progress,"%"]})]}),o.jsx(Ji,{value:$.progress,className:"h-1"})]}):null,$.status==="error"?o.jsxs("div",{className:"flex items-center gap-2 rounded border border-destructive/40 bg-destructive/10 px-2 py-1.5",children:[o.jsx(I.AlertCircle,{className:"h-3.5 w-3.5 text-destructive shrink-0"}),o.jsx("span",{className:"text-[11px] text-destructive",children:$.message}),o.jsx(Ae,{type:"button",variant:"ghost",size:"icon",className:"h-5 w-5 ml-auto",onClick:()=>k({status:"idle"}),children:o.jsx(I.X,{className:"h-3 w-3"})})]}):null,$.status!=="uploading"?o.jsxs(o.Fragment,{children:[o.jsx("input",{ref:E,type:"file",accept:"application/pdf",className:"hidden",onChange:A=>{var z;const X=(z=A.target.files)==null?void 0:z[0];X&&L(X),A.target.value=""}}),o.jsxs(Ae,{type:"button",variant:"outline",size:"sm",className:"w-full h-8 text-xs gap-1.5",disabled:!y,onClick:()=>{var A;return(A=E.current)==null?void 0:A.click()},children:[o.jsx(I.Upload,{className:"h-3.5 w-3.5"}),e.termoPdfUploadId?"Substituir PDF":"Selecionar PDF"]}),!y&&o.jsx("p",{className:"text-[9px] text-muted-foreground",children:"Salve o schema uma vez para habilitar o upload."})]}):null]})]})]})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Nome (chave)"}),o.jsx(ue,{value:e.name||t.replace(/^field_/,""),onChange:A=>!c&&a({name:A.target.value}),className:"h-8 text-xs font-mono",placeholder:"nome_do_campo",disabled:c}),c?o.jsx("p",{className:"text-[9px] text-amber-500",children:"ID fixo — necessário para auto-preenchimento"}):o.jsx("p",{className:"text-[9px] text-muted-foreground",children:"Usado como chave no JSON do formulário"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Tipo do campo"}),o.jsxs(Vt,{value:s,onValueChange:A=>!c&&a({fieldType:A}),disabled:c,children:[o.jsx(Dt,{className:"h-8 text-sm",children:o.jsx(Bt,{})}),o.jsx(Rt,{children:Ir.map(A=>o.jsx(Xe,{value:A.component,children:A.label},A.component))})]})]}),o.jsx(Qh,{tamanho:e.tamanho||6,inicioColuna:e.inicioColuna||1,defaultTamanho:6,onTamanhoChange:A=>a({tamanho:A}),onPositionChange:A=>a({inicioColuna:A})}),s!=="file"&&!l&&o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(ie,{className:"text-xs",children:"Placeholder"}),o.jsx(br,{})]}),o.jsx(ue,{value:e.placeholder||"",onChange:A=>a({placeholder:A.target.value}),className:"h-8 text-sm",placeholder:"Texto de exemplo..."})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(ie,{className:"text-xs",children:"Dica (hint)"}),o.jsx(br,{})]}),o.jsx(ue,{value:e.hint||"",onChange:A=>a({hint:A.target.value}),className:"h-8 text-sm",placeholder:"Texto de ajuda abaixo do campo"})]}),s!=="file"&&!l&&!b&&o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Valor padrão"}),o.jsx(ue,{value:e.defaultValue||"",onChange:A=>a({defaultValue:A.target.value}),className:"h-8 text-sm",placeholder:"Valor inicial do campo"})]}),s!=="file"&&!l&&!b&&o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(ie,{className:"text-xs",children:"Valor inicial (runtime)"}),o.jsx(br,{})]}),o.jsx(ue,{value:e.initialValue||"",onChange:A=>a({initialValue:A.target.value||void 0}),className:"h-8 text-sm",placeholder:"{{evento.nome}} ou valor fixo"}),o.jsxs("p",{className:"text-[9px] text-muted-foreground",children:['Sobrepõe "Valor padrão" — suporta variáveis'," ",o.jsx("code",{children:"{{evento.x}}"})]})]}),!l&&!b&&o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(rt,{id:"req",checked:e.required||!1,onCheckedChange:A=>a({required:A===!0})}),o.jsx(ie,{htmlFor:"req",className:"text-xs cursor-pointer",children:"Campo obrigatório"})]}),!l&&!b&&!c&&!p&&o.jsxs("div",{className:"flex flex-col gap-1.5",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(rt,{id:"readonly",checked:e.isReadOnly||!1,onCheckedChange:A=>a({isReadOnly:A===!0||void 0})}),o.jsx(ie,{htmlFor:"readonly",className:"text-xs cursor-pointer",children:"Somente leitura"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(rt,{id:"disabled",checked:e.isDisabled||!1,onCheckedChange:A=>a({isDisabled:A===!0||void 0})}),o.jsx(ie,{htmlFor:"disabled",className:"text-xs cursor-pointer",children:"Desabilitado"})]})]}),f&&o.jsxs(o.Fragment,{children:[o.jsx(it,{}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase",children:"Slider"}),o.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Mínimo"}),o.jsx(ue,{type:"number",value:e.minValue??0,onChange:A=>a({minValue:Number(A.target.value)}),className:"h-8 text-sm"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Máximo"}),o.jsx(ue,{type:"number",value:e.maxValue??100,onChange:A=>a({maxValue:Number(A.target.value)}),className:"h-8 text-sm"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Passo"}),o.jsx(ue,{type:"number",min:1,value:e.step??1,onChange:A=>a({step:Number(A.target.value)}),className:"h-8 text-sm"})]})]})]})]}),h&&o.jsxs(o.Fragment,{children:[o.jsx(it,{}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase",children:"Avaliação"}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Número de estrelas"}),o.jsxs(Vt,{value:String(e.maxRating??5),onValueChange:A=>a({maxRating:Number(A)}),children:[o.jsx(Dt,{className:"h-8 text-sm",children:o.jsx(Bt,{})}),o.jsx(Rt,{children:[3,4,5,6,7,10].map(A=>o.jsxs(Xe,{value:String(A),children:[A," estrelas"]},A))})]})]})]})]}),x&&o.jsxs(o.Fragment,{children:[o.jsx(it,{}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase",children:"Período"}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Label da data inicial"}),o.jsx(ue,{value:e.dateRangeStartLabel??"Data inicial",onChange:A=>a({dateRangeStartLabel:A.target.value}),className:"h-8 text-sm"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Label da data final"}),o.jsx(ue,{value:e.dateRangeEndLabel??"Data final",onChange:A=>a({dateRangeEndLabel:A.target.value}),className:"h-8 text-sm"})]})]})]}),!l&&o.jsx(it,{}),!l&&!m&&!v&&o.jsx(GC,{fieldType:s,validation:e.validation,onChange:A=>a({validation:A})}),i&&o.jsxs(o.Fragment,{children:[o.jsx(it,{}),s==="radio"&&o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Estilo visual"}),o.jsxs(Vt,{value:e.visualStyle||"card",onValueChange:A=>a({visualStyle:A}),children:[o.jsx(Dt,{className:"h-8 text-sm",children:o.jsx(Bt,{})}),o.jsxs(Rt,{children:[o.jsx(Xe,{value:"card",children:"Card (padrão)"}),o.jsx(Xe,{value:"default",children:"Radio simples"})]})]})]}),o.jsx(tx,{options:e.options||[],onChange:A=>a({options:A})})]}),l&&o.jsxs(o.Fragment,{children:[o.jsx(it,{}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase",children:"Lista de itens"}),o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Mín. itens"}),o.jsx(ue,{type:"number",min:0,value:e.minItems??"",onChange:A=>a({minItems:A.target.value?Number(A.target.value):void 0}),className:"h-8 text-sm",placeholder:"0"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Máx. itens"}),o.jsx(ue,{type:"number",min:0,value:e.maxItems??"",onChange:A=>a({maxItems:A.target.value?Number(A.target.value):void 0}),className:"h-8 text-sm",placeholder:"Sem limite"})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Label do item"}),o.jsx(ue,{value:e.itemLabel||"",onChange:A=>a({itemLabel:A.target.value||void 0}),className:"h-8 text-sm",placeholder:"Ex: Contato"}),o.jsx("p",{className:"text-[9px] text-muted-foreground",children:'Prefixo exibido em cada item (ex: "Contato 1", "Contato 2")'})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Label do botão adicionar"}),o.jsx(ue,{value:e.addLabel||"",onChange:A=>a({addLabel:A.target.value||void 0}),className:"h-8 text-sm",placeholder:"Ex: Adicionar contato"})]}),o.jsx("div",{className:"rounded-md border border-amber-500/30 bg-amber-500/5 px-3 py-2",children:o.jsx("p",{className:"text-[11px] text-amber-700 dark:text-amber-400",children:"Os sub-campos são configurados visualmente no canvas: arraste campos da paleta para dentro da caixa laranja."})})]})]}),b&&o.jsxs(o.Fragment,{children:[o.jsx(it,{}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Sub-formulário"}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Título do grupo (opcional)"}),o.jsx(ue,{value:e.subSchemaTitle||"",onChange:A=>a({subSchemaTitle:A.target.value||void 0}),className:"h-8 text-sm",placeholder:"Ex: Endereço, Responsável..."})]}),o.jsx(YC,{subFields:e.subSchemaFields||[],onChange:A=>a({subSchemaFields:A})})]})]}),!v&&!m&&o.jsxs(o.Fragment,{children:[o.jsx(it,{}),o.jsx(KC,{condition:e.condition,selectedId:t,allFieldIds:r,getFieldLabel:n,onChange:A=>a({condition:A})})]}),!v&&!m&&e.condition&&o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Valor ao ocultar (clearedValue)"}),o.jsx(ue,{value:e.clearedValue??"",onChange:A=>a({clearedValue:A.target.value||void 0}),className:"h-8 text-sm",placeholder:"Deixar vazio = não limpar"}),o.jsx("p",{className:"text-[9px] text-muted-foreground",children:"Valor aplicado automaticamente quando o campo fica oculto."})]}),!l&&!b&&o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs text-muted-foreground",children:"Resolver de props (avançado)"}),o.jsx(ue,{value:e.resolvePropsKey||"",onChange:A=>a({resolvePropsKey:A.target.value||void 0}),className:"h-8 text-xs font-mono",placeholder:"chaveDoResolver"}),o.jsxs("p",{className:"text-[9px] text-muted-foreground",children:["Registre este key em"," ",o.jsx("code",{children:"RendererContext.fieldResolvers"})," para opções dinâmicas."]})]})]})]})},QC={glassmorphism:"Glass",card:"Card",flat:"Flat",bordered:"Bordered"},rx=()=>{const{previewTemplateId:e,setPreviewTemplateId:t}=gt(),[r,n]=N.useState(!1),a=Object.values(Zr),s=Zr[e];return o.jsxs(To,{open:r,onOpenChange:n,children:[o.jsx(Ao,{asChild:!0,children:o.jsxs(Ae,{variant:"outline",size:"sm",className:"gap-1.5",title:"Selecionar template visual",children:[o.jsx("span",{className:"w-3.5 h-3.5 rounded-full shrink-0 border border-white/20",style:{background:(s==null?void 0:s.colors.primary)??"#3b82f6"}}),o.jsx(I.Palette,{className:"w-3.5 h-3.5"}),o.jsx("span",{className:"hidden sm:inline",children:(s==null?void 0:s.displayName)??"Template"})]})}),o.jsxs(da,{side:"bottom",align:"end",className:"w-80 p-3",children:[o.jsx("p",{className:"text-xs font-semibold text-muted-foreground mb-2 uppercase tracking-wider",children:"Template de Preview"}),o.jsx("div",{className:"grid grid-cols-3 gap-1.5 max-h-72 overflow-y-auto pr-0.5",children:a.map(i=>{const l=i.id===e,c=uu(i),d=QC[i.layout.containerStyle]??"";return o.jsxs("button",{onClick:()=>{t(i.id),n(!1)},className:Ut("relative flex flex-col items-center gap-1.5 rounded-lg p-2 border text-center transition-all hover:scale-[1.02]",l?"border-primary ring-1 ring-primary":"border-border hover:border-muted-foreground/40"),children:[o.jsxs("div",{className:"w-full h-8 rounded-md flex items-center justify-center gap-0.5",style:{background:i.colors.background.startsWith("#")||i.colors.background.startsWith("rgba")?i.colors.background:void 0},"data-muted":!i.colors.background.startsWith("#")&&!i.colors.background.startsWith("rgba")?"true":void 0,children:[o.jsx("div",{style:{width:8,height:8,borderRadius:"50%",background:i.colors.primary}}),o.jsx("div",{style:{width:8,height:8,borderRadius:"50%",background:i.colors.accent}})]}),o.jsx("span",{className:"text-[10px] font-medium leading-tight line-clamp-2",children:i.displayName}),o.jsxs("div",{className:"flex items-center gap-0.5 flex-wrap justify-center",children:[c&&o.jsx("span",{className:"text-[9px] px-1 rounded bg-zinc-800 text-zinc-300",children:"dark"}),d&&o.jsx("span",{className:"text-[9px] px-1 rounded bg-muted text-muted-foreground",children:d})]}),l&&o.jsx("div",{className:"absolute top-1 right-1",children:o.jsx(I.Check,{className:"w-3 h-3 text-primary"})})]},i.id)})})]})]})},eN=[{value:"numbers",label:"Números"},{value:"icons",label:"Ícones"},{value:"icons-labeled",label:"Ícones + rótulo"}],tN=[{value:"top-center",label:"Centralizado"},{value:"top-left",label:"Esquerda"}],rN=[{value:"horizontal",label:"Horizontal"},{value:"vertical",label:"Vertical (sidebar)"}],nN=()=>{const{stepConfig:e,updateStepConfig:t}=gt();return o.jsxs("div",{className:"space-y-5",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Template visual"}),o.jsx(rx,{})]}),o.jsx(it,{}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Indicador de steps"}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(rt,{id:"sc-show-indicators",checked:e.showStepIndicators!==!1,onCheckedChange:r=>t({showStepIndicators:r===!0})}),o.jsx(ie,{htmlFor:"sc-show-indicators",className:"text-xs cursor-pointer",children:"Exibir indicador de steps"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(rt,{id:"sc-show-progress",checked:e.showProgressBar===!0,onCheckedChange:r=>t({showProgressBar:r===!0})}),o.jsx(ie,{htmlFor:"sc-show-progress",className:"text-xs cursor-pointer",children:"Exibir barra de progresso"})]})]}),o.jsx(it,{}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ie,{className:"text-xs",children:"Variante visual"}),o.jsx("div",{className:"flex flex-col gap-1.5",children:eN.map(r=>o.jsx("button",{type:"button",onClick:()=>t({stepIndicatorVariant:r.value}),className:`text-left text-xs px-3 py-1.5 rounded-md border transition-colors ${e.stepIndicatorVariant===r.value?"border-primary bg-primary/10 text-primary font-medium":"border-border bg-muted/30 text-muted-foreground hover:bg-muted/60"}`,children:r.label},r.value))}),!e.stepIndicatorVariant&&o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Herdado do template"})]}),o.jsx(it,{}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ie,{className:"text-xs",children:"Orientação"}),o.jsx("div",{className:"flex gap-2",children:rN.map(r=>o.jsx("button",{type:"button",onClick:()=>t({stepIndicatorOrientation:r.value}),className:`flex-1 text-xs px-2 py-1.5 rounded-md border transition-colors ${e.stepIndicatorOrientation===r.value?"border-primary bg-primary/10 text-primary font-medium":"border-border bg-muted/30 text-muted-foreground hover:bg-muted/60"}`,children:r.label},r.value))}),!e.stepIndicatorOrientation&&o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Herdado do template"})]}),o.jsx(it,{}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ie,{className:"text-xs",children:"Posição (desktop)"}),o.jsx("div",{className:"flex gap-2",children:tN.map(r=>o.jsx("button",{type:"button",onClick:()=>t({stepIndicatorPosition:r.value}),className:`flex-1 text-xs px-2 py-1.5 rounded-md border transition-colors ${e.stepIndicatorPosition===r.value?"border-primary bg-primary/10 text-primary font-medium":"border-border bg-muted/30 text-muted-foreground hover:bg-muted/60"}`,children:r.label},r.value))}),!e.stepIndicatorPosition&&o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Herdado do template"})]})]})},aN=()=>{const{selectedId:e,getConfig:t,updateConfig:r,getAllFieldIds:n}=gt();if(!e)return o.jsxs("div",{className:"rounded-xl border bg-card p-4 space-y-4 max-h-[calc(100vh-160px)] overflow-y-auto",children:[o.jsx("div",{className:"flex items-center justify-between",children:o.jsx("h3",{className:"text-sm font-bold text-foreground",children:"Formulário"})}),o.jsx(it,{}),o.jsx(nN,{})]});const a=t(e),s=qe(e),i=c=>r(e,c),l=n().filter(c=>c!==e);return o.jsxs("div",{className:"rounded-xl border bg-card p-4 space-y-4 max-h-[calc(100vh-160px)] overflow-y-auto",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("h3",{className:"text-sm font-bold text-foreground",children:s==="step"?"Step":s==="container"?"Container":"Campo"}),o.jsx("span",{className:"text-[10px] font-mono text-muted-foreground",children:e})]}),o.jsx(it,{}),s==="step"&&o.jsx(zC,{config:a,onUpdate:i}),s==="container"&&o.jsx(MC,{config:a,onUpdate:i}),s==="field"&&o.jsx(JC,{config:a,selectedId:e,allFieldIds:l,getFieldLabel:c=>t(c).label||c,onUpdate:i})]})};var ma=e=>e.type==="checkbox",Xr=e=>e instanceof Date,bt=e=>e==null;const nx=e=>typeof e=="object";var nt=e=>!bt(e)&&!Array.isArray(e)&&nx(e)&&!Xr(e),ax=e=>nt(e)&&e.target?ma(e.target)?e.target.checked:e.target.value:e,oN=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,ox=(e,t)=>e.has(oN(t)),sN=e=>{const t=e.constructor&&e.constructor.prototype;return nt(t)&&t.hasOwnProperty("isPrototypeOf")},Cl=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Me(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if(Cl&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!r&&!(nt(e)&&sN(e)))return e;const n=r?[]:Object.create(Object.getPrototypeOf(e));for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&(n[a]=Me(e[a]));return n}var Uo=e=>/^\w*$/.test(e),Fe=e=>e===void 0,Ho=e=>Array.isArray(e)?e.filter(Boolean):[],Nl=e=>Ho(e.replace(/["|']|\]/g,"").split(/\.|\[/)),ae=(e,t,r)=>{if(!t||!nt(e))return r;const n=(Uo(t)?[t]:Nl(t)).reduce((a,s)=>bt(a)?a:a[s],e);return Fe(n)||n===e?Fe(e[t])?r:e[t]:n},St=e=>typeof e=="boolean",ht=e=>typeof e=="function",Oe=(e,t,r)=>{let n=-1;const a=Uo(t)?[t]:Nl(t),s=a.length,i=s-1;for(;++n<s;){const l=a[n];let c=r;if(n!==i){const d=e[l];c=nt(d)||Array.isArray(d)?d:isNaN(+a[n+1])?{}:[]}if(l==="__proto__"||l==="constructor"||l==="prototype")return;e[l]=c,e=e[l]}};const Qa={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Ft={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},xr={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Sl=N.createContext(null);Sl.displayName="HookFormControlContext";const Wo=()=>N.useContext(Sl);var sx=(e,t,r,n=!0)=>{const a={defaultValues:t._defaultValues};for(const s in e)Object.defineProperty(a,s,{get:()=>{const i=s;return t._proxyFormState[i]!==Ft.all&&(t._proxyFormState[i]=!n||Ft.all),r&&(r[i]=!0),e[i]}});return a};const qo=typeof window<"u"?N.useLayoutEffect:N.useEffect;function ix(e){const t=Wo(),{control:r=t,disabled:n,name:a,exact:s}=e||{},[i,l]=N.useState(r._formState),c=N.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return qo(()=>r._subscribe({name:a,formState:c.current,exact:s,callback:d=>{!n&&l({...r._formState,...d})}}),[a,n,s]),N.useEffect(()=>{c.current.isValid&&r._setValid(!0)},[r]),N.useMemo(()=>sx(i,r,c.current,!1),[i,r])}var Et=e=>typeof e=="string",ci=(e,t,r,n,a)=>Et(e)?(n&&t.watch.add(e),ae(r,e,a)):Array.isArray(e)?e.map(s=>(n&&t.watch.add(s),ae(r,s))):(n&&(t.watchAll=!0),r),di=e=>bt(e)||!nx(e);function Zt(e,t,r=new WeakSet){if(di(e)||di(t))return Object.is(e,t);if(Xr(e)&&Xr(t))return Object.is(e.getTime(),t.getTime());const n=Object.keys(e),a=Object.keys(t);if(n.length!==a.length)return!1;if(r.has(e)||r.has(t))return!0;r.add(e),r.add(t);for(const s of n){const i=e[s];if(!a.includes(s))return!1;if(s!=="ref"){const l=t[s];if(Xr(i)&&Xr(l)||nt(i)&&nt(l)||Array.isArray(i)&&Array.isArray(l)?!Zt(i,l,r):!Object.is(i,l))return!1}}return!0}function Fn(e){const t=Wo(),{control:r=t,name:n,defaultValue:a,disabled:s,exact:i,compute:l}=e||{},c=N.useRef(a),d=N.useRef(l),u=N.useRef(void 0),m=N.useRef(r),p=N.useRef(n);d.current=l;const[f,v]=N.useState(()=>{const w=r._getWatch(n,c.current);return d.current?d.current(w):w}),h=N.useCallback(w=>{const C=ci(n,r._names,w||r._formValues,!1,c.current);return d.current?d.current(C):C},[r._formValues,r._names,n]),x=N.useCallback(w=>{if(!s){const C=ci(n,r._names,w||r._formValues,!1,c.current);if(d.current){const S=d.current(C);Zt(S,u.current)||(v(S),u.current=S)}else v(C)}},[r._formValues,r._names,s,n]);qo(()=>((m.current!==r||!Zt(p.current,n))&&(m.current=r,p.current=n,x()),r._subscribe({name:n,formState:{values:!0},exact:i,callback:w=>{x(w.values)}})),[r,i,n,x]),N.useEffect(()=>r._removeUnmounted());const b=m.current!==r,y=p.current,j=N.useMemo(()=>{if(s)return null;const w=!b&&!Zt(y,n);return b||w?h():null},[s,b,n,y,h]);return j!==null?j:f}function Be(e){const t=Wo(),{name:r,disabled:n,control:a=t,shouldUnregister:s,defaultValue:i,exact:l=!0}=e,c=ox(a._names.array,r),d=N.useMemo(()=>ae(a._formValues,r,ae(a._defaultValues,r,i)),[a,r,i]),u=Fn({control:a,name:r,defaultValue:d,exact:l}),m=ix({control:a,name:r,exact:l}),p=N.useRef(e),f=N.useRef(void 0),v=N.useRef(a.register(r,{...e.rules,value:u,...St(e.disabled)?{disabled:e.disabled}:{}}));p.current=e;const h=N.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!ae(m.errors,r)},isDirty:{enumerable:!0,get:()=>!!ae(m.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!ae(m.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!ae(m.validatingFields,r)},error:{enumerable:!0,get:()=>ae(m.errors,r)}}),[m,r]),x=N.useCallback(w=>v.current.onChange({target:{value:ax(w),name:r},type:Qa.CHANGE}),[r]),b=N.useCallback(()=>v.current.onBlur({target:{value:ae(a._formValues,r),name:r},type:Qa.BLUR}),[r,a._formValues]),y=N.useCallback(w=>{const C=ae(a._fields,r);C&&C._f&&w&&(C._f.ref={focus:()=>ht(w.focus)&&w.focus(),select:()=>ht(w.select)&&w.select(),setCustomValidity:S=>ht(w.setCustomValidity)&&w.setCustomValidity(S),reportValidity:()=>ht(w.reportValidity)&&w.reportValidity()})},[a._fields,r]),j=N.useMemo(()=>({name:r,value:u,...St(n)||m.disabled?{disabled:m.disabled||n}:{},onChange:x,onBlur:b,ref:y}),[r,n,m.disabled,x,b,y,u]);return N.useEffect(()=>{const w=a._options.shouldUnregister||s,C=f.current;C&&C!==r&&!c&&a.unregister(C),a.register(r,{...p.current.rules,...St(p.current.disabled)?{disabled:p.current.disabled}:{}});const S=($,k)=>{const E=ae(a._fields,$);E&&E._f&&(E._f.mount=k)};if(S(r,!0),w){const $=Me(ae(a._options.defaultValues,r,p.current.defaultValue));Oe(a._defaultValues,r,$),Fe(ae(a._formValues,r))&&Oe(a._formValues,r,$)}return!c&&a.register(r),f.current=r,()=>{(c?w&&!a._state.action:w)?a.unregister(r):S(r,!1)}},[r,a,c,s]),N.useEffect(()=>{a._setDisabledField({disabled:n,name:r})},[n,r,a]),N.useMemo(()=>({field:j,formState:m,fieldState:h}),[j,m,h])}const $l=N.createContext(null);$l.displayName="HookFormContext";const iN=()=>N.useContext($l),lN=e=>{const{children:t,watch:r,getValues:n,getFieldState:a,setError:s,clearErrors:i,setValue:l,trigger:c,formState:d,resetField:u,reset:m,handleSubmit:p,unregister:f,control:v,register:h,setFocus:x,subscribe:b}=e;return N.createElement($l.Provider,{value:N.useMemo(()=>({watch:r,getValues:n,getFieldState:a,setError:s,clearErrors:i,setValue:l,trigger:c,formState:d,resetField:u,reset:m,handleSubmit:p,unregister:f,control:v,register:h,setFocus:x,subscribe:b}),[i,v,d,a,n,p,h,m,u,s,x,l,b,c,f,r])},N.createElement(Sl.Provider,{value:v},t))};var cN=(e,t,r,n,a)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:a||!0}}:{},yt=e=>Array.isArray(e)?e:[e],vd=()=>{let e=[];return{get observers(){return e},next:t=>{for(const r of e)r.next&&r.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter(r=>r!==t)}}),unsubscribe:()=>{e=[]}}};function lx(e,t){const r={};for(const n in e)if(e.hasOwnProperty(n)){const a=e[n],s=t[n];if(a&&nt(a)&&s){const i=lx(a,s);nt(i)&&(r[n]=i)}else e[n]&&(r[n]=s)}return r}var ct=e=>nt(e)&&!Object.keys(e).length,El=e=>e.type==="file",eo=e=>{if(!Cl)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},cx=e=>e.type==="select-multiple",Tl=e=>e.type==="radio",dN=e=>Tl(e)||ma(e),ks=e=>eo(e)&&e.isConnected;function uN(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=Fe(e)?n++:e[t[n++]];return e}function mN(e){for(const t in e)if(e.hasOwnProperty(t)&&!Fe(e[t]))return!1;return!0}function He(e,t){const r=Array.isArray(t)?t:Uo(t)?[t]:Nl(t),n=r.length===1?e:uN(e,r),a=r.length-1,s=r[a];return n&&delete n[s],a!==0&&(nt(n)&&ct(n)||Array.isArray(n)&&mN(n))&&He(e,r.slice(0,-1)),e}var pN=e=>{for(const t in e)if(ht(e[t]))return!0;return!1};function dx(e){return Array.isArray(e)||nt(e)&&!pN(e)}function ui(e,t={}){for(const r in e){const n=e[r];dx(n)?(t[r]=Array.isArray(n)?[]:{},ui(n,t[r])):Fe(n)||(t[r]=!0)}return t}function hn(e,t,r){r||(r=ui(t));for(const n in e){const a=e[n];if(dx(a))Fe(t)||di(r[n])?r[n]=ui(a,Array.isArray(a)?[]:{}):hn(a,bt(t)?{}:t[n],r[n]);else{const s=t[n];r[n]=!Zt(a,s)}}return r}const bd={value:!1,isValid:!1},yd={value:!0,isValid:!0};var ux=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Fe(e[0].attributes.value)?Fe(e[0].value)||e[0].value===""?yd:{value:e[0].value,isValid:!0}:yd:bd}return bd},mx=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>Fe(e)?e:t?e===""?NaN:e&&+e:r&&Et(e)?new Date(e):n?n(e):e;const wd={isValid:!1,value:null};var px=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,wd):wd;function jd(e){const t=e.ref;return El(t)?t.files:Tl(t)?px(e.refs).value:cx(t)?[...t.selectedOptions].map(({value:r})=>r):ma(t)?ux(e.refs).value:mx(Fe(t.value)?e.ref.value:t.value,e)}var fN=(e,t,r,n)=>{const a={};for(const s of e){const i=ae(t,s);i&&Oe(a,s,i._f)}return{criteriaMode:r,names:[...e],fields:a,shouldUseNativeValidation:n}},to=e=>e instanceof RegExp,Hn=e=>Fe(e)?e:to(e)?e.source:nt(e)?to(e.value)?e.value.source:e.value:e,vn=e=>({isOnSubmit:!e||e===Ft.onSubmit,isOnBlur:e===Ft.onBlur,isOnChange:e===Ft.onChange,isOnAll:e===Ft.all,isOnTouch:e===Ft.onTouched});const kd="AsyncFunction";var hN=e=>!!e&&!!e.validate&&!!(ht(e.validate)&&e.validate.constructor.name===kd||nt(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===kd)),xN=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),mi=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(n)&&/^\.\w+/.test(e.slice(n.length))));const kn=(e,t,r,n)=>{for(const a of r||Object.keys(e)){const s=ae(e,a);if(s){const{_f:i,...l}=s;if(i){if(i.refs&&i.refs[0]&&t(i.refs[0],a)&&!n||i.ref&&t(i.ref,i.name)&&!n)return!0;if(kn(l,t))break}else if(nt(l)&&kn(l,t))break}}};function Cd(e,t,r){const n=ae(e,r);if(n||Uo(r))return{error:n,name:r};const a=r.split(".");for(;a.length;){const s=a.join("."),i=ae(t,s),l=ae(e,s);if(i&&!Array.isArray(i)&&r!==s)return{name:r};if(l&&l.type)return{name:s,error:l};if(l&&l.root&&l.root.type)return{name:`${s}.root`,error:l.root};a.pop()}return{name:r}}var gN=(e,t,r,n)=>{r(e);const{name:a,...s}=e;return ct(s)||Object.keys(s).length>=Object.keys(t).length||Object.keys(s).find(i=>t[i]===(!n||Ft.all))},vN=(e,t,r)=>!e||!t||e===t||yt(e).some(n=>n&&(r?n===t:n.startsWith(t)||t.startsWith(n))),bN=(e,t,r,n,a)=>a.isOnAll?!1:!r&&a.isOnTouch?!(t||e):(r?n.isOnBlur:a.isOnBlur)?!e:(r?n.isOnChange:a.isOnChange)?e:!0,yN=(e,t)=>!Ho(ae(e,t)).length&&He(e,t),fx=(e,t,r)=>{const n=yt(ae(e,r));return Oe(n,"root",t[r]),Oe(e,r,n),e};function Nd(e,t,r="validate"){if(Et(e)||Array.isArray(e)&&e.every(Et)||St(e)&&!e)return{type:r,message:Et(e)?e:"",ref:t}}var pn=e=>nt(e)&&!to(e)?e:{value:e,message:""},pi=async(e,t,r,n,a,s)=>{const{ref:i,refs:l,required:c,maxLength:d,minLength:u,min:m,max:p,pattern:f,validate:v,name:h,valueAsNumber:x,mount:b}=e._f,y=ae(r,h);if(!b||t.has(h))return{};const j=l?l[0]:i,w=L=>{a&&j.reportValidity&&(j.setCustomValidity(St(L)?"":L||""),j.reportValidity())},C={},S=Tl(i),$=ma(i),k=S||$,E=(x||El(i))&&Fe(i.value)&&Fe(y)||eo(i)&&i.value===""||y===""||Array.isArray(y)&&!y.length,T=cN.bind(null,h,n,C),O=(L,A,z,X=xr.maxLength,q=xr.minLength)=>{const Z=L?A:z;C[h]={type:L?X:q,message:Z,ref:i,...T(L?X:q,Z)}};if(s?!Array.isArray(y)||!y.length:c&&(!k&&(E||bt(y))||St(y)&&!y||$&&!ux(l).isValid||S&&!px(l).isValid)){const{value:L,message:A}=Et(c)?{value:!!c,message:c}:pn(c);if(L&&(C[h]={type:xr.required,message:A,ref:j,...T(xr.required,A)},!n))return w(A),C}if(!E&&(!bt(m)||!bt(p))){let L,A;const z=pn(p),X=pn(m);if(!bt(y)&&!isNaN(y)){const q=i.valueAsNumber||y&&+y;bt(z.value)||(L=q>z.value),bt(X.value)||(A=q<X.value)}else{const q=i.valueAsDate||new Date(y),Z=_=>new Date(new Date().toDateString()+" "+_),V=i.type=="time",M=i.type=="week";Et(z.value)&&y&&(L=V?Z(y)>Z(z.value):M?y>z.value:q>new Date(z.value)),Et(X.value)&&y&&(A=V?Z(y)<Z(X.value):M?y<X.value:q<new Date(X.value))}if((L||A)&&(O(!!L,z.message,X.message,xr.max,xr.min),!n))return w(C[h].message),C}if((d||u)&&!E&&(Et(y)||s&&Array.isArray(y))){const L=pn(d),A=pn(u),z=!bt(L.value)&&y.length>+L.value,X=!bt(A.value)&&y.length<+A.value;if((z||X)&&(O(z,L.message,A.message),!n))return w(C[h].message),C}if(f&&!E&&Et(y)){const{value:L,message:A}=pn(f);if(to(L)&&!y.match(L)&&(C[h]={type:xr.pattern,message:A,ref:i,...T(xr.pattern,A)},!n))return w(A),C}if(v){if(ht(v)){const L=await v(y,r),A=Nd(L,j);if(A&&(C[h]={...A,...T(xr.validate,A.message)},!n))return w(A.message),C}else if(nt(v)){let L={};for(const A in v){if(!ct(L)&&!n)break;const z=Nd(await v[A](y,r),j,A);z&&(L={...z,...T(A,z.message)},w(z.message),n&&(C[h]=L))}if(!ct(L)&&(C[h]={ref:j,...L},!n))return C}}return w(!0),C};const wN={mode:Ft.onSubmit,reValidateMode:Ft.onChange,shouldFocusError:!0};function jN(e={}){let t={...wN,...e},r={submitCount:0,isDirty:!1,isReady:!1,isLoading:ht(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},n={},a=nt(t.defaultValues)||nt(t.values)?Me(t.defaultValues||t.values)||{}:{},s=t.shouldUnregister?{}:Me(a),i={action:!1,mount:!1,watch:!1,keepIsValid:!1},l={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},c,d=0;const u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},m={...u};let p={...m};const f={array:vd(),state:vd()},v=t.criteriaMode===Ft.all,h=P=>F=>{clearTimeout(d),d=setTimeout(P,F)},x=async P=>{if(!i.keepIsValid&&!t.disabled&&(m.isValid||p.isValid||P)){let F;t.resolver?(F=ct((await k()).errors),b()):F=await T(n,!0),F!==r.isValid&&f.state.next({isValid:F})}},b=(P,F)=>{!t.disabled&&(m.isValidating||m.validatingFields||p.isValidating||p.validatingFields)&&((P||Array.from(l.mount)).forEach(B=>{B&&(F?Oe(r.validatingFields,B,F):He(r.validatingFields,B))}),f.state.next({validatingFields:r.validatingFields,isValidating:!ct(r.validatingFields)}))},y=(P,F=[],B,le,oe=!0,re=!0)=>{if(le&&B&&!t.disabled){if(i.action=!0,re&&Array.isArray(ae(n,P))){const ye=B(ae(n,P),le.argA,le.argB);oe&&Oe(n,P,ye)}if(re&&Array.isArray(ae(r.errors,P))){const ye=B(ae(r.errors,P),le.argA,le.argB);oe&&Oe(r.errors,P,ye),yN(r.errors,P)}if((m.touchedFields||p.touchedFields)&&re&&Array.isArray(ae(r.touchedFields,P))){const ye=B(ae(r.touchedFields,P),le.argA,le.argB);oe&&Oe(r.touchedFields,P,ye)}(m.dirtyFields||p.dirtyFields)&&(r.dirtyFields=hn(a,s)),f.state.next({name:P,isDirty:L(P,F),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else Oe(s,P,F)},j=(P,F)=>{Oe(r.errors,P,F),f.state.next({errors:r.errors})},w=P=>{r.errors=P,f.state.next({errors:r.errors,isValid:!1})},C=(P,F,B,le)=>{const oe=ae(n,P);if(oe){const re=ae(s,P,Fe(B)?ae(a,P):B);Fe(re)||le&&le.defaultChecked||F?Oe(s,P,F?re:jd(oe._f)):X(P,re),i.mount&&!i.action&&x()}},S=(P,F,B,le,oe)=>{let re=!1,ye=!1;const Pe={name:P};if(!t.disabled){if(!B||le){(m.isDirty||p.isDirty)&&(ye=r.isDirty,r.isDirty=Pe.isDirty=L(),re=ye!==Pe.isDirty);const _e=Zt(ae(a,P),F);ye=!!ae(r.dirtyFields,P),_e?He(r.dirtyFields,P):Oe(r.dirtyFields,P,!0),Pe.dirtyFields=r.dirtyFields,re=re||(m.dirtyFields||p.dirtyFields)&&ye!==!_e}if(B){const _e=ae(r.touchedFields,P);_e||(Oe(r.touchedFields,P,B),Pe.touchedFields=r.touchedFields,re=re||(m.touchedFields||p.touchedFields)&&_e!==B)}re&&oe&&f.state.next(Pe)}return re?Pe:{}},$=(P,F,B,le)=>{const oe=ae(r.errors,P),re=(m.isValid||p.isValid)&&St(F)&&r.isValid!==F;if(t.delayError&&B?(c=h(()=>j(P,B)),c(t.delayError)):(clearTimeout(d),c=null,B?Oe(r.errors,P,B):He(r.errors,P)),(B?!Zt(oe,B):oe)||!ct(le)||re){const ye={...le,...re&&St(F)?{isValid:F}:{},errors:r.errors,name:P};r={...r,...ye},f.state.next(ye)}},k=async P=>(b(P,!0),await t.resolver(s,t.context,fN(P||l.mount,n,t.criteriaMode,t.shouldUseNativeValidation))),E=async P=>{const{errors:F}=await k(P);if(b(P),P)for(const B of P){const le=ae(F,B);le?Oe(r.errors,B,le):He(r.errors,B)}else r.errors=F;return F},T=async(P,F,B={valid:!0})=>{for(const le in P){const oe=P[le];if(oe){const{_f:re,...ye}=oe;if(re){const Pe=l.array.has(re.name),_e=oe._f&&hN(oe._f);_e&&m.validatingFields&&b([re.name],!0);const st=await pi(oe,l.disabled,s,v,t.shouldUseNativeValidation&&!F,Pe);if(_e&&m.validatingFields&&b([re.name]),st[re.name]&&(B.valid=!1,F||e.shouldUseNativeValidation))break;!F&&(ae(st,re.name)?Pe?fx(r.errors,st,re.name):Oe(r.errors,re.name,st[re.name]):He(r.errors,re.name))}!ct(ye)&&await T(ye,F,B)}}return B.valid},O=()=>{for(const P of l.unMount){const F=ae(n,P);F&&(F._f.refs?F._f.refs.every(B=>!ks(B)):!ks(F._f.ref))&&ne(P)}l.unMount=new Set},L=(P,F)=>!t.disabled&&(P&&F&&Oe(s,P,F),!Zt(se(),a)),A=(P,F,B)=>ci(P,l,{...i.mount?s:Fe(F)?a:Et(P)?{[P]:F}:F},B,F),z=P=>Ho(ae(i.mount?s:a,P,t.shouldUnregister?ae(a,P,[]):[])),X=(P,F,B={})=>{const le=ae(n,P);let oe=F;if(le){const re=le._f;re&&(!re.disabled&&Oe(s,P,mx(F,re)),oe=eo(re.ref)&&bt(F)?"":F,cx(re.ref)?[...re.ref.options].forEach(ye=>ye.selected=oe.includes(ye.value)):re.refs?ma(re.ref)?re.refs.forEach(ye=>{(!ye.defaultChecked||!ye.disabled)&&(Array.isArray(oe)?ye.checked=!!oe.find(Pe=>Pe===ye.value):ye.checked=oe===ye.value||!!oe)}):re.refs.forEach(ye=>ye.checked=ye.value===oe):El(re.ref)?re.ref.value="":(re.ref.value=oe,re.ref.type||f.state.next({name:P,values:Me(s)})))}(B.shouldDirty||B.shouldTouch)&&S(P,oe,B.shouldTouch,B.shouldDirty,!0),B.shouldValidate&&_(P)},q=(P,F,B)=>{for(const le in F){if(!F.hasOwnProperty(le))return;const oe=F[le],re=P+"."+le,ye=ae(n,re);(l.array.has(P)||nt(oe)||ye&&!ye._f)&&!Xr(oe)?q(re,oe,B):X(re,oe,B)}},Z=(P,F,B={})=>{const le=ae(n,P),oe=l.array.has(P),re=Me(F);Oe(s,P,re),oe?(f.array.next({name:P,values:Me(s)}),(m.isDirty||m.dirtyFields||p.isDirty||p.dirtyFields)&&B.shouldDirty&&f.state.next({name:P,dirtyFields:hn(a,s),isDirty:L(P,re)})):le&&!le._f&&!bt(re)?q(P,re,B):X(P,re,B),mi(P,l)?f.state.next({...r,name:P,values:Me(s)}):f.state.next({name:i.mount?P:void 0,values:Me(s)})},V=async P=>{i.mount=!0;const F=P.target;let B=F.name,le=!0;const oe=ae(n,B),re=_e=>{le=Number.isNaN(_e)||Xr(_e)&&isNaN(_e.getTime())||Zt(_e,ae(s,B,_e))},ye=vn(t.mode),Pe=vn(t.reValidateMode);if(oe){let _e,st;const er=F.type?jd(oe._f):ax(P),tr=P.type===Qa.BLUR||P.type===Qa.FOCUS_OUT,Xo=!xN(oe._f)&&!t.resolver&&!ae(r.errors,B)&&!oe._f.deps||bN(tr,ae(r.touchedFields,B),r.isSubmitted,Pe,ye),zn=mi(B,l,tr);Oe(s,B,er),tr?(!F||!F.readOnly)&&(oe._f.onBlur&&oe._f.onBlur(P),c&&c(0)):oe._f.onChange&&oe._f.onChange(P);const Ln=S(B,er,tr),Zo=!ct(Ln)||zn;if(!tr&&f.state.next({name:B,type:P.type,values:Me(s)}),Xo)return(m.isValid||p.isValid)&&(t.mode==="onBlur"?tr&&x():tr||x()),Zo&&f.state.next({name:B,...zn?{}:Ln});if(!tr&&zn&&f.state.next({...r}),t.resolver){const{errors:ha}=await k([B]);if(b([B]),re(er),le){const Ko=Cd(r.errors,n,B),on=Cd(ha,n,Ko.name||B);_e=on.error,B=on.name,st=ct(ha)}}else b([B],!0),_e=(await pi(oe,l.disabled,s,v,t.shouldUseNativeValidation))[B],b([B]),re(er),le&&(_e?st=!1:(m.isValid||p.isValid)&&(st=await T(n,!0)));le&&(oe._f.deps&&(!Array.isArray(oe._f.deps)||oe._f.deps.length>0)&&_(oe._f.deps),$(B,st,_e,Ln))}},M=(P,F)=>{if(ae(r.errors,F)&&P.focus)return P.focus(),1},_=async(P,F={})=>{let B,le;const oe=yt(P);if(t.resolver){const re=await E(Fe(P)?P:oe);B=ct(re),le=P?!oe.some(ye=>ae(re,ye)):B}else P?(le=(await Promise.all(oe.map(async re=>{const ye=ae(n,re);return await T(ye&&ye._f?{[re]:ye}:ye)}))).every(Boolean),!(!le&&!r.isValid)&&x()):le=B=await T(n);return f.state.next({...!Et(P)||(m.isValid||p.isValid)&&B!==r.isValid?{}:{name:P},...t.resolver||!P?{isValid:B}:{},errors:r.errors}),F.shouldFocus&&!le&&kn(n,M,P?oe:l.mount),le},se=(P,F)=>{let B={...i.mount?s:a};return F&&(B=lx(F.dirtyFields?r.dirtyFields:r.touchedFields,B)),Fe(P)?B:Et(P)?ae(B,P):P.map(le=>ae(B,le))},U=(P,F)=>({invalid:!!ae((F||r).errors,P),isDirty:!!ae((F||r).dirtyFields,P),error:ae((F||r).errors,P),isValidating:!!ae(r.validatingFields,P),isTouched:!!ae((F||r).touchedFields,P)}),Q=P=>{const F=P?yt(P):void 0;F==null||F.forEach(B=>He(r.errors,B)),F?F.forEach(B=>{f.state.next({name:B,errors:r.errors})}):f.state.next({errors:{}})},Y=(P,F,B)=>{const le=(ae(n,P,{_f:{}})._f||{}).ref,oe=ae(r.errors,P)||{},{ref:re,message:ye,type:Pe,..._e}=oe;Oe(r.errors,P,{..._e,...F,ref:le}),f.state.next({name:P,errors:r.errors,isValid:!1}),B&&B.shouldFocus&&le&&le.focus&&le.focus()},H=(P,F)=>ht(P)?f.state.subscribe({next:B=>"values"in B&&P(A(void 0,F),B)}):A(P,F,!0),W=P=>f.state.subscribe({next:F=>{vN(P.name,F.name,P.exact)&&gN(F,P.formState||m,dt,P.reRenderRoot)&&P.callback({values:{...s},...r,...F,defaultValues:a})}}).unsubscribe,G=P=>(i.mount=!0,p={...p,...P.formState},W({...P,formState:{...u,...P.formState}})),ne=(P,F={})=>{for(const B of P?yt(P):l.mount)l.mount.delete(B),l.array.delete(B),F.keepValue||(He(n,B),He(s,B)),!F.keepError&&He(r.errors,B),!F.keepDirty&&He(r.dirtyFields,B),!F.keepTouched&&He(r.touchedFields,B),!F.keepIsValidating&&He(r.validatingFields,B),!t.shouldUnregister&&!F.keepDefaultValue&&He(a,B);f.state.next({values:Me(s)}),f.state.next({...r,...F.keepDirty?{isDirty:L()}:{}}),!F.keepIsValid&&x()},J=({disabled:P,name:F})=>{if(St(P)&&i.mount||P||l.disabled.has(F)){const B=l.disabled.has(F)!==!!P;P?l.disabled.add(F):l.disabled.delete(F),B&&i.mount&&!i.action&&x()}},te=(P,F={})=>{let B=ae(n,P);const le=St(F.disabled)||St(t.disabled);return Oe(n,P,{...B||{},_f:{...B&&B._f?B._f:{ref:{name:P}},name:P,mount:!0,...F}}),l.mount.add(P),B?J({disabled:St(F.disabled)?F.disabled:t.disabled,name:P}):C(P,!0,F.value),{...le?{disabled:F.disabled||t.disabled}:{},...t.progressive?{required:!!F.required,min:Hn(F.min),max:Hn(F.max),minLength:Hn(F.minLength),maxLength:Hn(F.maxLength),pattern:Hn(F.pattern)}:{},name:P,onChange:V,onBlur:V,ref:oe=>{if(oe){te(P,F),B=ae(n,P);const re=Fe(oe.value)&&oe.querySelectorAll&&oe.querySelectorAll("input,select,textarea")[0]||oe,ye=dN(re),Pe=B._f.refs||[];if(ye?Pe.find(_e=>_e===re):re===B._f.ref)return;Oe(n,P,{_f:{...B._f,...ye?{refs:[...Pe.filter(ks),re,...Array.isArray(ae(a,P))?[{}]:[]],ref:{type:re.type,name:P}}:{ref:re}}}),C(P,!1,void 0,re)}else B=ae(n,P,{}),B._f&&(B._f.mount=!1),(t.shouldUnregister||F.shouldUnregister)&&!(ox(l.array,P)&&i.action)&&l.unMount.add(P)}}},ce=()=>t.shouldFocusError&&kn(n,M,l.mount),be=P=>{St(P)&&(f.state.next({disabled:P}),kn(n,(F,B)=>{const le=ae(n,B);le&&(F.disabled=le._f.disabled||P,Array.isArray(le._f.refs)&&le._f.refs.forEach(oe=>{oe.disabled=le._f.disabled||P}))},0,!1))},Ce=(P,F)=>async B=>{let le;B&&(B.preventDefault&&B.preventDefault(),B.persist&&B.persist());let oe=Me(s);if(f.state.next({isSubmitting:!0}),t.resolver){const{errors:re,values:ye}=await k();b(),r.errors=re,oe=Me(ye)}else await T(n);if(l.disabled.size)for(const re of l.disabled)He(oe,re);if(He(r.errors,"root"),ct(r.errors)){f.state.next({errors:{}});try{await P(oe,B)}catch(re){le=re}}else F&&await F({...r.errors},B),ce(),setTimeout(ce);if(f.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:ct(r.errors)&&!le,submitCount:r.submitCount+1,errors:r.errors}),le)throw le},ve=(P,F={})=>{ae(n,P)&&(Fe(F.defaultValue)?Z(P,Me(ae(a,P))):(Z(P,F.defaultValue),Oe(a,P,Me(F.defaultValue))),F.keepTouched||He(r.touchedFields,P),F.keepDirty||(He(r.dirtyFields,P),r.isDirty=F.defaultValue?L(P,Me(ae(a,P))):L()),F.keepError||(He(r.errors,P),m.isValid&&x()),f.state.next({...r}))},me=(P,F={})=>{const B=P?Me(P):a,le=Me(B),oe=ct(P),re=oe?a:le;if(F.keepDefaultValues||(a=B),!F.keepValues){if(F.keepDirtyValues){const ye=new Set([...l.mount,...Object.keys(hn(a,s))]);for(const Pe of Array.from(ye)){const _e=ae(r.dirtyFields,Pe),st=ae(s,Pe),er=ae(re,Pe);_e&&!Fe(st)?Oe(re,Pe,st):!_e&&!Fe(er)&&Z(Pe,er)}}else{if(Cl&&Fe(P))for(const ye of l.mount){const Pe=ae(n,ye);if(Pe&&Pe._f){const _e=Array.isArray(Pe._f.refs)?Pe._f.refs[0]:Pe._f.ref;if(eo(_e)){const st=_e.closest("form");if(st){st.reset();break}}}}if(F.keepFieldsRef)for(const ye of l.mount)Z(ye,ae(re,ye));else n={}}s=t.shouldUnregister?F.keepDefaultValues?Me(a):{}:Me(re),f.array.next({values:{...re}}),f.state.next({values:{...re}})}l={mount:F.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},i.mount=!m.isValid||!!F.keepIsValid||!!F.keepDirtyValues||!t.shouldUnregister&&!ct(re),i.watch=!!t.shouldUnregister,i.keepIsValid=!!F.keepIsValid,i.action=!1,F.keepErrors||(r.errors={}),f.state.next({submitCount:F.keepSubmitCount?r.submitCount:0,isDirty:oe?!1:F.keepDirty?r.isDirty:!!(F.keepDefaultValues&&!Zt(P,a)),isSubmitted:F.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:oe?{}:F.keepDirtyValues?F.keepDefaultValues&&s?hn(a,s):r.dirtyFields:F.keepDefaultValues&&P?hn(a,P):F.keepDirty?r.dirtyFields:{},touchedFields:F.keepTouched?r.touchedFields:{},errors:F.keepErrors?r.errors:{},isSubmitSuccessful:F.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:a})},Te=(P,F)=>me(ht(P)?P(s):P,{...t.resetOptions,...F}),ze=(P,F={})=>{const B=ae(n,P),le=B&&B._f;if(le){const oe=le.refs?le.refs[0]:le.ref;oe.focus&&setTimeout(()=>{oe.focus(),F.shouldSelect&&ht(oe.select)&&oe.select()})}},dt=P=>{r={...r,...P}},Ve={control:{register:te,unregister:ne,getFieldState:U,handleSubmit:Ce,setError:Y,_subscribe:W,_runSchema:k,_updateIsValidating:b,_focusError:ce,_getWatch:A,_getDirty:L,_setValid:x,_setFieldArray:y,_setDisabledField:J,_setErrors:w,_getFieldArray:z,_reset:me,_resetDefaultValues:()=>ht(t.defaultValues)&&t.defaultValues().then(P=>{Te(P,t.resetOptions),f.state.next({isLoading:!1})}),_removeUnmounted:O,_disableForm:be,_subjects:f,_proxyFormState:m,get _fields(){return n},get _formValues(){return s},get _state(){return i},set _state(P){i=P},get _defaultValues(){return a},get _names(){return l},set _names(P){l=P},get _formState(){return r},get _options(){return t},set _options(P){t={...t,...P}}},subscribe:G,trigger:_,register:te,handleSubmit:Ce,watch:H,setValue:Z,getValues:se,reset:Te,resetField:ve,clearErrors:Q,unregister:ne,setError:Y,setFocus:ze,getFieldState:U};return{...Ve,formControl:Ve}}var Tr=()=>{if(typeof crypto<"u"&&crypto.randomUUID)return crypto.randomUUID();const e=typeof performance>"u"?Date.now():performance.now()*1e3;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const r=(Math.random()*16+e)%16|0;return(t=="x"?r:r&3|8).toString(16)})},Cs=(e,t,r={})=>r.shouldFocus||Fe(r.shouldFocus)?r.focusName||`${e}.${Fe(r.focusIndex)?t:r.focusIndex}.`:"",Ns=(e,t)=>[...e,...yt(t)],Ss=e=>Array.isArray(e)?e.map(()=>{}):void 0;function $s(e,t,r){return[...e.slice(0,t),...yt(r),...e.slice(t)]}var Es=(e,t,r)=>Array.isArray(e)?(Fe(e[r])&&(e[r]=void 0),e.splice(r,0,e.splice(t,1)[0]),e):[],Ts=(e,t)=>[...yt(t),...yt(e)];function kN(e,t){let r=0;const n=[...e];for(const a of t)n.splice(a-r,1),r++;return Ho(n).length?n:[]}var As=(e,t)=>Fe(t)?[]:kN(e,yt(t).sort((r,n)=>r-n)),Ds=(e,t,r)=>{[e[t],e[r]]=[e[r],e[t]]},Sd=(e,t,r)=>(e[t]=r,e);function hx(e){const t=Wo(),{control:r=t,name:n,keyName:a="id",shouldUnregister:s,rules:i}=e,[l,c]=N.useState(r._getFieldArray(n)),d=N.useRef(r._getFieldArray(n).map(Tr)),u=N.useRef(!1);r._names.array.add(n),N.useMemo(()=>i&&l.length>=0&&r.register(n,i),[r,n,l.length,i]),qo(()=>r._subjects.array.subscribe({next:({values:w,name:C})=>{if(C===n||!C){const S=ae(w,n);Array.isArray(S)&&(c(S),d.current=S.map(Tr))}}}).unsubscribe,[r,n]);const m=N.useCallback(w=>{u.current=!0,r._setFieldArray(n,w)},[r,n]),p=(w,C)=>{const S=yt(Me(w)),$=Ns(r._getFieldArray(n),S);r._names.focus=Cs(n,$.length-1,C),d.current=Ns(d.current,S.map(Tr)),m($),c($),r._setFieldArray(n,$,Ns,{argA:Ss(w)})},f=(w,C)=>{const S=yt(Me(w)),$=Ts(r._getFieldArray(n),S);r._names.focus=Cs(n,0,C),d.current=Ts(d.current,S.map(Tr)),m($),c($),r._setFieldArray(n,$,Ts,{argA:Ss(w)})},v=w=>{const C=As(r._getFieldArray(n),w);d.current=As(d.current,w),m(C),c(C),!Array.isArray(ae(r._fields,n))&&Oe(r._fields,n,void 0),r._setFieldArray(n,C,As,{argA:w})},h=(w,C,S)=>{const $=yt(Me(C)),k=$s(r._getFieldArray(n),w,$);r._names.focus=Cs(n,w,S),d.current=$s(d.current,w,$.map(Tr)),m(k),c(k),r._setFieldArray(n,k,$s,{argA:w,argB:Ss(C)})},x=(w,C)=>{const S=r._getFieldArray(n);Ds(S,w,C),Ds(d.current,w,C),m(S),c(S),r._setFieldArray(n,S,Ds,{argA:w,argB:C},!1)},b=(w,C)=>{const S=r._getFieldArray(n);Es(S,w,C),Es(d.current,w,C),m(S),c(S),r._setFieldArray(n,S,Es,{argA:w,argB:C},!1)},y=(w,C)=>{const S=Me(C),$=Sd(r._getFieldArray(n),w,S);d.current=[...$].map((k,E)=>!k||E===w?Tr():d.current[E]),m($),c([...$]),r._setFieldArray(n,$,Sd,{argA:w,argB:S},!0,!1)},j=w=>{const C=yt(Me(w));d.current=C.map(Tr),m([...C]),c([...C]),r._setFieldArray(n,[...C],S=>S,{},!0,!1)};return N.useEffect(()=>{if(r._state.action=!1,mi(n,r._names)&&r._subjects.state.next({...r._formState}),u.current&&(!vn(r._options.mode).isOnSubmit||r._formState.isSubmitted)&&!vn(r._options.reValidateMode).isOnSubmit)if(r._options.resolver)r._runSchema([n]).then(w=>{r._updateIsValidating([n]);const C=ae(w.errors,n),S=ae(r._formState.errors,n);(S?!C&&S.type||C&&(S.type!==C.type||S.message!==C.message):C&&C.type)&&(C?Oe(r._formState.errors,n,C):He(r._formState.errors,n),r._subjects.state.next({errors:r._formState.errors}))});else{const w=ae(r._fields,n);w&&w._f&&!(vn(r._options.reValidateMode).isOnSubmit&&vn(r._options.mode).isOnSubmit)&&pi(w,r._names.disabled,r._formValues,r._options.criteriaMode===Ft.all,r._options.shouldUseNativeValidation,!0).then(C=>!ct(C)&&r._subjects.state.next({errors:fx(r._formState.errors,C,n)}))}r._subjects.state.next({name:n,values:Me(r._formValues)}),r._names.focus&&kn(r._fields,(w,C)=>{if(r._names.focus&&C.startsWith(r._names.focus)&&w.focus)return w.focus(),1}),r._names.focus="",r._setValid(),u.current=!1},[l,n,r]),N.useEffect(()=>(!ae(r._formValues,n)&&r._setFieldArray(n),()=>{const w=(C,S)=>{const $=ae(r._fields,C);$&&$._f&&($._f.mount=S)};r._options.shouldUnregister||s?r.unregister(n):w(n,!1)}),[n,r,a,s]),{swap:N.useCallback(x,[m,n,r]),move:N.useCallback(b,[m,n,r]),prepend:N.useCallback(f,[m,n,r]),append:N.useCallback(p,[m,n,r]),remove:N.useCallback(v,[m,n,r]),insert:N.useCallback(h,[m,n,r]),update:N.useCallback(y,[m,n,r]),replace:N.useCallback(j,[m,n,r]),fields:N.useMemo(()=>l.map((w,C)=>({...w,[a]:d.current[C]||Tr()})),[l,a])}}function CN(e={}){const t=N.useRef(void 0),r=N.useRef(void 0),[n,a]=N.useState({isDirty:!1,isValidating:!1,isLoading:ht(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:ht(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:n},e.defaultValues&&!ht(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:i,...l}=jN(e);t.current={...l,formState:n}}const s=t.current.control;return s._options=e,qo(()=>{const i=s._subscribe({formState:s._proxyFormState,callback:()=>a({...s._formState}),reRenderRoot:!0});return a(l=>({...l,isReady:!0})),s._formState.isReady=!0,i},[s]),N.useEffect(()=>s._disableForm(e.disabled),[s,e.disabled]),N.useEffect(()=>{e.mode&&(s._options.mode=e.mode),e.reValidateMode&&(s._options.reValidateMode=e.reValidateMode)},[s,e.mode,e.reValidateMode]),N.useEffect(()=>{e.errors&&(s._setErrors(e.errors),s._focusError())},[s,e.errors]),N.useEffect(()=>{e.shouldUnregister&&s._subjects.state.next({values:s._getWatch()})},[s,e.shouldUnregister]),N.useEffect(()=>{if(s._proxyFormState.isDirty){const i=s._getDirty();i!==n.isDirty&&s._subjects.state.next({isDirty:i})}},[s,n.isDirty]),N.useEffect(()=>{var i;e.values&&!Zt(e.values,r.current)?(s._reset(e.values,{keepFieldsRef:!0,...s._options.resetOptions}),!((i=s._options.resetOptions)===null||i===void 0)&&i.keepIsValid||s._setValid(),r.current=e.values,a(l=>({...l}))):s._resetDefaultValues()},[s,e.values]),N.useEffect(()=>{s._state.mount||(s._setValid(),s._state.mount=!0),s._state.watch&&(s._state.watch=!1,s._subjects.state.next({...s._formState})),s._removeUnmounted()}),t.current.formState=N.useMemo(()=>sx(n,s),[s,n]),t.current}var NN=Object.defineProperty,SN=(e,t,r)=>t in e?NN(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,$d=(e,t,r)=>SN(e,typeof t!="symbol"?t+"":t,r);const fi=N.createContext({}),Ur=()=>N.useContext(fi),Ed=new Set(["__proto__","constructor","prototype"]),Aa=(e,t,r)=>{const n=t.split(".");let a=e;for(let i=0;i<n.length-1;i++){const l=n[i];if(Ed.has(l))return;(a[l]==null||typeof a[l]!="object")&&(a[l]={}),a=a[l]}const s=n[n.length-1];Ed.has(s)||(a[s]=r)},bn=async(e,t,r,n,a,s)=>{for(const i of e){const l=s[i.type];if(!l)continue;const c=await l(r,n,i,a);if(c)return i.message??c}},$N=(e,t={},r={})=>async n=>{var a,s,i,l,c;const d={},{errors:u}=yi(e,n,t);for(const p of u){const f=p.campo.replace(/\[(\d+)\]/g,".$1");Aa(d,f,{type:"custom",message:p.message})}const m=[...e.containers].sort((p,f)=>p.ordem-f.ordem);for(const p of m)if(!p.repeatable&&$e(p.condicional,n,t))for(const f of p.campos){if(f.tipo===D.HIDDEN||f.isDisabled||f.isReadOnly||!$e(f.condicional,n,t))continue;if(f.tipo===D.FIELD_ARRAY){const h=Array.isArray(n[f.nome])?n[f.nome]:[];for(let x=0;x<h.length;x++){const b=h[x];for(const y of f.subFields??[]){if(y.isDisabled||y.isReadOnly||!$e(y.condicional,b,t)||!((a=y.validate)!=null&&a.length)||d[`${f.nome}.${x}.${y.nome}`])continue;const j=await bn(y.validate,y.nome,b[y.nome],b,t,r);j&&Aa(d,`${f.nome}.${x}.${y.nome}`,{type:"custom",message:j})}}continue}if(f.tipo===D.SUB_FORM){const h=n[f.nome]??{};for(const x of((s=f.subSchema)==null?void 0:s.fields)??[]){if(x.isDisabled||x.isReadOnly||!((i=x.validate)!=null&&i.length)||d[`${f.nome}.${x.nome}`])continue;const b=await bn(x.validate,x.nome,h[x.nome],h,t,r);b&&Aa(d,`${f.nome}.${x.nome}`,{type:"custom",message:b})}continue}if(!((l=f.validate)!=null&&l.length)||d[f.nome])continue;const v=await bn(f.validate,f.nome,n[f.nome],n,t,r);v&&(d[f.nome]={type:"custom",message:v})}for(const p of m){if(!p.repeatable||!p.nome||!$e(p.condicional,n,t))continue;const f=Array.isArray(n[p.nome])?n[p.nome]:[];for(let v=0;v<f.length;v++){const h=f[v];for(const x of p.campos){if(x.tipo===D.HIDDEN||x.isDisabled||x.isReadOnly||!$e(x.condicional,h,t)||!((c=x.validate)!=null&&c.length)||d[`${p.nome}.${v}.${x.nome}`])continue;const b=await bn(x.validate,x.nome,h[x.nome],h,t,r);b&&Aa(d,`${p.nome}.${v}.${x.nome}`,{type:"custom",message:b})}}}return Object.keys(d).length>0?{values:{},errors:d}:{values:n,errors:{}}},EN=(e,t={},r={})=>async n=>{var a,s;const i={},l=[...e.containers].sort((c,d)=>c.ordem-d.ordem);for(const c of l)if(!(c.condicional&&!$e(c.condicional,n,t))){if(c.repeatable&&c.nome){const d=Array.isArray(n[c.nome])?n[c.nome]:[];for(let u=0;u<d.length;u++){const m=d[u];for(const p of[...c.campos].sort((f,v)=>f.ordem-v.ordem)){if(!((a=p.warn)!=null&&a.length)||!$e(p.condicional,m,t))continue;const f=await bn(p.warn,p.nome,m[p.nome],m,t,r);f&&(i[`${c.nome}.${u}.${p.nome}`]=f)}}continue}for(const d of[...c.campos].sort((u,m)=>u.ordem-m.ordem)){if(!((s=d.warn)!=null&&s.length)||!$e(d.condicional,n,t))continue;const u=await bn(d.warn,d.nome,n[d.nome],n,t,r);u&&(i[d.nome]=u)}}return i},TN=/\{\{\s*(?:event|evento)\.([a-zA-Z0-9_.]+)\s*\}\}/g,wt=(e,t)=>e?e.replace(TN,(r,n)=>t[`evento.${n}`]??t[n]??r):e??"",AN=(e,t)=>({...e,label:wt(e.label,t)}),DN=(e,t)=>{var r;return{...e,label:wt(e.label,t),placeholder:wt(e.placeholder,t),hint:wt(e.hint,t),defaultValue:typeof e.defaultValue=="string"?wt(e.defaultValue,t):e.defaultValue,opcoes:(r=e.opcoes)==null?void 0:r.map(n=>AN(n,t))}},Al=(e,t)=>({...e,titulo:wt(e.titulo,t),descricao:wt(e.descricao,t),campos:e.campos.map(r=>DN(r,t))}),RN=(e,t)=>({...e,titulo:wt(e.titulo,t),descricao:wt(e.descricao,t),containers:e.containers.map(r=>Al(r,t))}),xx=()=>{const e=ra(),t=e.layout.containerStyle,r=e.layout.roundness??"rounded-xl",n=K("overflow-hidden",r,t==="card"?"border":"",t==="bordered"?"border":"",t==="glassmorphism"?"backdrop-blur-sm":""),a=t==="glassmorphism"?{background:"var(--t-surface)",borderColor:"var(--t-border)",borderWidth:"1px",borderStyle:"solid"}:{},s=K("border-b px-6 py-4",t==="flat"?"border-transparent":"");return{wrapperClass:n,wrapperStyle:a,headerClass:s,headerStyle:t==="glassmorphism"?{borderColor:"var(--t-border)"}:{},tmpl:e}},Lt=({name:e,control:t,placeholder:r,type:n="text",disabled:a,readOnly:s})=>{var i;const{field:l,fieldState:c}=Be({name:e,control:t}),d=!!c.error;return o.jsxs("div",{className:"space-y-1",children:[o.jsx(ue,{...l,value:l.value??"",type:n,placeholder:r,disabled:a,readOnly:s,className:K(d&&"border-destructive focus-visible:ring-destructive")}),((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})},Dl=({name:e,control:t,placeholder:r,disabled:n,readOnly:a})=>{var s;const{field:i,fieldState:l}=Be({name:e,control:t});return o.jsxs("div",{className:"space-y-1",children:[o.jsx(io,{...i,value:i.value??"",placeholder:r,disabled:n,readOnly:a,rows:3,className:K(l.error&&"border-destructive focus-visible:ring-destructive")}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},Rl=({name:e,control:t,placeholder:r,options:n,disabled:a,readOnly:s})=>{var i;const{field:l,fieldState:c}=Be({name:e,control:t});return o.jsxs("div",{className:"space-y-1",children:[o.jsxs(Vt,{value:l.value??"",onValueChange:d=>!s&&l.onChange(d),disabled:a||s,children:[o.jsx(Dt,{className:K(c.error&&"border-destructive focus:ring-destructive"),onBlur:l.onBlur,children:o.jsx(Bt,{placeholder:r??"Selecione..."})}),o.jsx(Rt,{children:n.map(d=>o.jsx(Xe,{value:d.valor,disabled:d.disabled,children:d.label},d.valor))})]}),((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})},Pl=({name:e,control:t,label:r,disabled:n,readOnly:a})=>{var s;const{field:i,fieldState:l}=Be({name:e,control:t});return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[o.jsx(rt,{name:i.name,checked:!!i.value,onCheckedChange:c=>!a&&i.onChange(!!c),onBlur:i.onBlur,disabled:n}),r&&o.jsx("span",{className:"text-sm leading-none",children:r})]}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},gx=({name:e,control:t,options:r,disabled:n})=>{var a;const{field:s,fieldState:i}=Be({name:e,control:t}),l=Array.isArray(s.value)?s.value:[],c=d=>{const u=l.includes(d)?l.filter(m=>m!==d):[...l,d];s.onChange(u)};return o.jsxs("div",{className:"space-y-1",children:[o.jsx("div",{className:"flex flex-col gap-2",onBlur:s.onBlur,children:r.map(d=>o.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[o.jsx(rt,{checked:l.includes(d.valor),onCheckedChange:()=>c(d.valor),disabled:n||d.disabled}),o.jsx("span",{className:"text-sm leading-none",children:d.label})]},d.valor))}),((a=i.error)==null?void 0:a.message)&&o.jsx("p",{className:"text-sm text-destructive",children:i.error.message})]})},vx=({name:e,control:t,options:r,visualStyle:n="default",disabled:a})=>{var s;const{field:i,fieldState:l}=Be({name:e,control:t}),c=n==="card";return o.jsxs("div",{className:"space-y-1",onBlur:i.onBlur,children:[o.jsx(Ri,{value:i.value??"",onValueChange:i.onChange,className:K(c?"grid grid-cols-2 gap-2 sm:grid-cols-3":"flex flex-col gap-2"),children:r.map(d=>o.jsxs("label",{className:K("flex items-center gap-2 cursor-pointer",c&&"rounded-lg border p-3 transition-colors hover:bg-accent data-[selected=true]:border-primary data-[selected=true]:bg-primary/5",(a||d.disabled)&&"cursor-not-allowed opacity-50"),"data-selected":i.value===d.valor?"true":void 0,children:[o.jsx(Pi,{value:d.valor,disabled:a||d.disabled}),o.jsx("span",{className:"text-sm leading-none",children:d.label})]},d.valor))}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},bx=e=>{const t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),n=String(e.getDate()).padStart(2,"0");return`${t}-${r}-${n}`},PN=e=>{const t=new Date;return t.setFullYear(t.getFullYear()-e),bx(t)},_N=e=>{const t=new Date;return t.setFullYear(t.getFullYear()-e),bx(t)},ea=({name:e,control:t,isDatetime:r,disabled:n,readOnly:a,validacao:s})=>{var i;const{field:l,fieldState:c}=Be({name:e,control:t}),d=r?"datetime-local":"date",u=f=>r?f+"T00:00":f,m=(s==null?void 0:s.minAge)!=null?u(PN(s.minAge)):(s==null?void 0:s.maxDate)!=null?u(s.maxDate):void 0,p=(s==null?void 0:s.maxAge)!=null?u(_N(s.maxAge)):(s==null?void 0:s.minDate)!=null?u(s.minDate):void 0;return o.jsxs("div",{className:"space-y-1",children:[o.jsx(ue,{name:l.name,value:l.value??"",onChange:l.onChange,onBlur:l.onBlur,type:d,min:p,max:m,disabled:n,readOnly:a,className:K(c.error&&"border-destructive focus-visible:ring-destructive")}),((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})};function IN(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}const yx={128:"€",130:"‚",131:"ƒ",132:"„",133:"…",134:"†",135:"‡",136:"ˆ",137:"‰",138:"Š",139:"‹",140:"Œ",142:"Ž",145:"‘",146:"’",147:"“",148:"”",149:"•",150:"–",151:"—",152:"˜",153:"™",154:"š",155:"›",156:"œ",158:"ž",159:"Ÿ"};for(const[e,t]of Object.entries(yx));let Td;function ON(){if(!(typeof globalThis.TextDecoder>"u"))return Td??(Td=new globalThis.TextDecoder("utf-8"))}const Dn=32*1024,Gt=65533;function FN(e,t="utf-8"){switch(t.toLowerCase()){case"utf-8":case"utf8":{const r=ON();return r?r.decode(e):LN(e)}case"utf-16le":return MN(e);case"us-ascii":case"ascii":return VN(e);case"latin1":case"iso-8859-1":return BN(e);case"windows-1252":return UN(e);default:throw new RangeError(`Encoding '${t}' not supported`)}}function _l(e,t){t.length!==0&&(e.push(String.fromCharCode.apply(null,t)),t.length=0)}function Qe(e,t,r){t.push(r),t.length>=Dn&&_l(e,t)}function zN(e,t,r){if(r<=65535){Qe(e,t,r);return}r-=65536,Qe(e,t,55296+(r>>10)),Qe(e,t,56320+(r&1023))}function LN(e){const t=[],r=[];let n=0;for(e.length>=3&&e[0]===239&&e[1]===187&&e[2]===191&&(n=3);n<e.length;){const a=e[n];if(a<=127){Qe(t,r,a),n++;continue}if(a<194||a>244){Qe(t,r,Gt),n++;continue}if(a<=223){if(n+1>=e.length){Qe(t,r,Gt),n++;continue}const d=e[n+1];if((d&192)!==128){Qe(t,r,Gt),n++;continue}const u=(a&31)<<6|d&63;Qe(t,r,u),n+=2;continue}if(a<=239){if(n+2>=e.length){Qe(t,r,Gt),n++;continue}const d=e[n+1],u=e[n+2];if(!((d&192)===128&&(u&192)===128&&!(a===224&&d<160)&&!(a===237&&d>=160))){Qe(t,r,Gt),n++;continue}const m=(a&15)<<12|(d&63)<<6|u&63;Qe(t,r,m),n+=3;continue}if(n+3>=e.length){Qe(t,r,Gt),n++;continue}const s=e[n+1],i=e[n+2],l=e[n+3];if(!((s&192)===128&&(i&192)===128&&(l&192)===128&&!(a===240&&s<144)&&!(a===244&&s>143))){Qe(t,r,Gt),n++;continue}const c=(a&7)<<18|(s&63)<<12|(i&63)<<6|l&63;zN(t,r,c),n+=4}return _l(t,r),t.join("")}function MN(e){const t=[],r=[],n=e.length;let a=0;for(;a+1<n;){const s=e[a]|e[a+1]<<8;if(a+=2,s>=55296&&s<=56319){if(a+1<n){const i=e[a]|e[a+1]<<8;i>=56320&&i<=57343?(Qe(t,r,s),Qe(t,r,i),a+=2):Qe(t,r,Gt)}else Qe(t,r,Gt);continue}if(s>=56320&&s<=57343){Qe(t,r,Gt);continue}Qe(t,r,s)}return a<n&&Qe(t,r,Gt),_l(t,r),t.join("")}function VN(e){const t=[];for(let r=0;r<e.length;r+=Dn){const n=Math.min(e.length,r+Dn),a=new Array(n-r);for(let s=r,i=0;s<n;s++,i++)a[i]=e[s]&127;t.push(String.fromCharCode.apply(null,a))}return t.join("")}function BN(e){const t=[];for(let r=0;r<e.length;r+=Dn){const n=Math.min(e.length,r+Dn),a=new Array(n-r);for(let s=r,i=0;s<n;s++,i++)a[i]=e[s];t.push(String.fromCharCode.apply(null,a))}return t.join("")}function UN(e){const t=[];let r="";for(let n=0;n<e.length;n++){const a=e[n],s=a>=128&&a<=159?yx[a]:void 0;r+=s??String.fromCharCode(a),r.length>=Dn&&(t.push(r),r="")}return r&&t.push(r),t.join("")}function Ct(e){return new DataView(e.buffer,e.byteOffset)}const HN={len:1,get(e,t){return Ct(e).getUint8(t)},put(e,t,r){return Ct(e).setUint8(t,r),t+1}},Ge={len:2,get(e,t){return Ct(e).getUint16(t,!0)},put(e,t,r){return Ct(e).setUint16(t,r,!0),t+2}},fn={len:2,get(e,t){return Ct(e).getUint16(t)},put(e,t,r){return Ct(e).setUint16(t,r),t+2}},Ke={len:4,get(e,t){return Ct(e).getUint32(t,!0)},put(e,t,r){return Ct(e).setUint32(t,r,!0),t+4}},Ad={len:4,get(e,t){return Ct(e).getUint32(t)},put(e,t,r){return Ct(e).setUint32(t,r),t+4}},WN={len:4,get(e,t){return Ct(e).getInt32(t)},put(e,t,r){return Ct(e).setInt32(t,r),t+4}},qN={len:8,get(e,t){return Ct(e).getBigUint64(t,!0)},put(e,t,r){return Ct(e).setBigUint64(t,r,!0),t+8}};class vr{constructor(t,r){this.len=t,this.encoding=r}get(t,r=0){const n=t.subarray(r,r+this.len);return FN(n,this.encoding)}}const GN="End-Of-Stream";class tt extends Error{constructor(){super(GN),this.name="EndOfStreamError"}}class XN extends Error{constructor(t="The operation was aborted"){super(t),this.name="AbortError"}}class wx{constructor(){this.endOfStream=!1,this.interrupted=!1,this.peekQueue=[]}async peek(t,r=!1){const n=await this.read(t,r);return this.peekQueue.push(t.subarray(0,n)),n}async read(t,r=!1){if(t.length===0)return 0;let n=this.readFromPeekBuffer(t);if(this.endOfStream||(n+=await this.readRemainderFromStream(t.subarray(n),r)),n===0&&!r)throw new tt;return n}readFromPeekBuffer(t){let r=t.length,n=0;for(;this.peekQueue.length>0&&r>0;){const a=this.peekQueue.pop();if(!a)throw new Error("peekData should be defined");const s=Math.min(a.length,r);t.set(a.subarray(0,s),n),n+=s,r-=s,s<a.length&&this.peekQueue.push(a.subarray(s))}return n}async readRemainderFromStream(t,r){let n=0;for(;n<t.length&&!this.endOfStream;){if(this.interrupted)throw new XN;const a=await this.readFromStream(t.subarray(n),r);if(a===0)break;n+=a}if(!r&&n<t.length)throw new tt;return n}}class ZN extends wx{constructor(t){super(),this.reader=t}async abort(){return this.close()}async close(){this.reader.releaseLock()}}class KN extends ZN{async readFromStream(t,r){if(t.length===0)return 0;const n=await this.reader.read(new Uint8Array(t.length),{min:r?void 0:t.length});return n.done&&(this.endOfStream=n.done),n.value?(t.set(n.value),n.value.length):0}}class Dd extends wx{constructor(t){super(),this.reader=t,this.buffer=null}writeChunk(t,r){const n=Math.min(r.length,t.length);return t.set(r.subarray(0,n)),n<r.length?this.buffer=r.subarray(n):this.buffer=null,n}async readFromStream(t,r){if(t.length===0)return 0;let n=0;for(this.buffer&&(n+=this.writeChunk(t,this.buffer));n<t.length&&!this.endOfStream;){const a=await this.reader.read();if(a.done){this.endOfStream=!0;break}a.value&&(n+=this.writeChunk(t.subarray(n),a.value))}if(!r&&n===0&&this.endOfStream)throw new tt;return n}abort(){return this.interrupted=!0,this.reader.cancel()}async close(){await this.abort(),this.reader.releaseLock()}}function YN(e){try{const t=e.getReader({mode:"byob"});return t instanceof ReadableStreamDefaultReader?new Dd(t):new KN(t)}catch(t){if(t instanceof TypeError)return new Dd(e.getReader());throw t}}class Il{constructor(t){this.numBuffer=new Uint8Array(8),this.position=0,this.onClose=t==null?void 0:t.onClose,t!=null&&t.abortSignal&&t.abortSignal.addEventListener("abort",()=>{this.abort()})}async readToken(t,r=this.position){const n=new Uint8Array(t.len);if(await this.readBuffer(n,{position:r})<t.len)throw new tt;return t.get(n,0)}async peekToken(t,r=this.position){const n=new Uint8Array(t.len);if(await this.peekBuffer(n,{position:r})<t.len)throw new tt;return t.get(n,0)}async readNumber(t){if(await this.readBuffer(this.numBuffer,{length:t.len})<t.len)throw new tt;return t.get(this.numBuffer,0)}async peekNumber(t){if(await this.peekBuffer(this.numBuffer,{length:t.len})<t.len)throw new tt;return t.get(this.numBuffer,0)}async ignore(t){if(t<0)throw new RangeError("ignore length must be ≥ 0 bytes");if(this.fileInfo.size!==void 0){const r=this.fileInfo.size-this.position;if(t>r)return this.position+=r,r}return this.position+=t,t}async close(){var t;await this.abort(),await((t=this.onClose)==null?void 0:t.call(this))}normalizeOptions(t,r){if(!this.supportsRandomAccess()&&r&&r.position!==void 0&&r.position<this.position)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");return{mayBeLess:!1,offset:0,length:t.length,position:this.position,...r}}abort(){return Promise.resolve()}}const JN=256e3;class QN extends Il{constructor(t,r){super(r),this.streamReader=t,this.fileInfo=(r==null?void 0:r.fileInfo)??{}}async readBuffer(t,r){const n=this.normalizeOptions(t,r),a=n.position-this.position;if(a>0)return await this.ignore(a),this.readBuffer(t,r);if(a<0)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");if(n.length===0)return 0;const s=await this.streamReader.read(t.subarray(0,n.length),n.mayBeLess);if(this.position+=s,(!r||!r.mayBeLess)&&s<n.length)throw new tt;return s}async peekBuffer(t,r){const n=this.normalizeOptions(t,r);let a=0;if(n.position){const s=n.position-this.position;if(s>0){const i=new Uint8Array(n.length+s);return a=await this.peekBuffer(i,{mayBeLess:n.mayBeLess}),t.set(i.subarray(s)),a-s}if(s<0)throw new Error("Cannot peek from a negative offset in a stream")}if(n.length>0){try{a=await this.streamReader.peek(t.subarray(0,n.length),n.mayBeLess)}catch(s){if(r!=null&&r.mayBeLess&&s instanceof tt)return 0;throw s}if(!n.mayBeLess&&a<n.length)throw new tt}return a}async ignore(t){if(t<0)throw new RangeError("ignore length must be ≥ 0 bytes");const r=Math.min(JN,t),n=new Uint8Array(r);let a=0;for(;a<t;){const s=t-a,i=await this.readBuffer(n,{length:Math.min(r,s)});if(i<0)return i;a+=i}return a}abort(){return this.streamReader.abort()}async close(){return this.streamReader.close()}supportsRandomAccess(){return!1}}class e2 extends Il{constructor(t,r){super(r),this.uint8Array=t,this.fileInfo={...(r==null?void 0:r.fileInfo)??{},size:t.length}}async readBuffer(t,r){r!=null&&r.position&&(this.position=r.position);const n=await this.peekBuffer(t,r);return this.position+=n,n}async peekBuffer(t,r){const n=this.normalizeOptions(t,r),a=Math.min(this.uint8Array.length-n.position,n.length);if(!n.mayBeLess&&a<n.length)throw new tt;return t.set(this.uint8Array.subarray(n.position,n.position+a)),a}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(t){this.position=t}}class t2 extends Il{constructor(t,r){super(r),this.blob=t,this.fileInfo={...(r==null?void 0:r.fileInfo)??{},size:t.size,mimeType:t.type}}async readBuffer(t,r){r!=null&&r.position&&(this.position=r.position);const n=await this.peekBuffer(t,r);return this.position+=n,n}async peekBuffer(t,r){const n=this.normalizeOptions(t,r),a=Math.min(this.blob.size-n.position,n.length);if(!n.mayBeLess&&a<n.length)throw new tt;const s=await this.blob.slice(n.position,n.position+a).arrayBuffer();return t.set(new Uint8Array(s)),a}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(t){this.position=t}}function r2(e,t){const r=YN(e),n=t??{},a=n.onClose;return n.onClose=async()=>{if(await r.close(),a)return a()},new QN(r,n)}function n2(e,t){return new e2(e,t)}function a2(e,t){return new t2(e,t)}var hi={exports:{}},Rs,Rd;function o2(){if(Rd)return Rs;Rd=1;var e=1e3,t=e*60,r=t*60,n=r*24,a=n*7,s=n*365.25;Rs=function(u,m){m=m||{};var p=typeof u;if(p==="string"&&u.length>0)return i(u);if(p==="number"&&isFinite(u))return m.long?c(u):l(u);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(u))};function i(u){if(u=String(u),!(u.length>100)){var m=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(u);if(m){var p=parseFloat(m[1]),f=(m[2]||"ms").toLowerCase();switch(f){case"years":case"year":case"yrs":case"yr":case"y":return p*s;case"weeks":case"week":case"w":return p*a;case"days":case"day":case"d":return p*n;case"hours":case"hour":case"hrs":case"hr":case"h":return p*r;case"minutes":case"minute":case"mins":case"min":case"m":return p*t;case"seconds":case"second":case"secs":case"sec":case"s":return p*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return p;default:return}}}}function l(u){var m=Math.abs(u);return m>=n?Math.round(u/n)+"d":m>=r?Math.round(u/r)+"h":m>=t?Math.round(u/t)+"m":m>=e?Math.round(u/e)+"s":u+"ms"}function c(u){var m=Math.abs(u);return m>=n?d(u,m,n,"day"):m>=r?d(u,m,r,"hour"):m>=t?d(u,m,t,"minute"):m>=e?d(u,m,e,"second"):u+" ms"}function d(u,m,p,f){var v=m>=p*1.5;return Math.round(u/p)+" "+f+(v?"s":"")}return Rs}function s2(e){r.debug=r,r.default=r,r.coerce=c,r.disable=i,r.enable=a,r.enabled=l,r.humanize=o2(),r.destroy=d,Object.keys(e).forEach(u=>{r[u]=e[u]}),r.names=[],r.skips=[],r.formatters={};function t(u){let m=0;for(let p=0;p<u.length;p++)m=(m<<5)-m+u.charCodeAt(p),m|=0;return r.colors[Math.abs(m)%r.colors.length]}r.selectColor=t;function r(u){let m,p=null,f,v;function h(...x){if(!h.enabled)return;const b=h,y=Number(new Date),j=y-(m||y);b.diff=j,b.prev=m,b.curr=y,m=y,x[0]=r.coerce(x[0]),typeof x[0]!="string"&&x.unshift("%O");let w=0;x[0]=x[0].replace(/%([a-zA-Z%])/g,(C,S)=>{if(C==="%%")return"%";w++;const $=r.formatters[S];if(typeof $=="function"){const k=x[w];C=$.call(b,k),x.splice(w,1),w--}return C}),r.formatArgs.call(b,x),(b.log||r.log).apply(b,x)}return h.namespace=u,h.useColors=r.useColors(),h.color=r.selectColor(u),h.extend=n,h.destroy=r.destroy,Object.defineProperty(h,"enabled",{enumerable:!0,configurable:!1,get:()=>p!==null?p:(f!==r.namespaces&&(f=r.namespaces,v=r.enabled(u)),v),set:x=>{p=x}}),typeof r.init=="function"&&r.init(h),h}function n(u,m){const p=r(this.namespace+(typeof m>"u"?":":m)+u);return p.log=this.log,p}function a(u){r.save(u),r.namespaces=u,r.names=[],r.skips=[];const m=(typeof u=="string"?u:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const p of m)p[0]==="-"?r.skips.push(p.slice(1)):r.names.push(p)}function s(u,m){let p=0,f=0,v=-1,h=0;for(;p<u.length;)if(f<m.length&&(m[f]===u[p]||m[f]==="*"))m[f]==="*"?(v=f,h=p,f++):(p++,f++);else if(v!==-1)f=v+1,h++,p=h;else return!1;for(;f<m.length&&m[f]==="*";)f++;return f===m.length}function i(){const u=[...r.names,...r.skips.map(m=>"-"+m)].join(",");return r.enable(""),u}function l(u){for(const m of r.skips)if(s(u,m))return!1;for(const m of r.names)if(s(u,m))return!0;return!1}function c(u){return u instanceof Error?u.stack||u.message:u}function d(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}var i2=s2;(function(e,t){t.formatArgs=n,t.save=a,t.load=s,t.useColors=r,t.storage=i(),t.destroy=(()=>{let c=!1;return()=>{c||(c=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function r(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let c;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(c=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(c[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function n(c){if(c[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+c[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const d="color: "+this.color;c.splice(1,0,d,"color: inherit");let u=0,m=0;c[0].replace(/%[a-zA-Z%]/g,p=>{p!=="%%"&&(u++,p==="%c"&&(m=u))}),c.splice(m,0,d)}t.log=console.debug||console.log||(()=>{});function a(c){try{c?t.storage.setItem("debug",c):t.storage.removeItem("debug")}catch{}}function s(){let c;try{c=t.storage.getItem("debug")||t.storage.getItem("DEBUG")}catch{}return!c&&typeof process<"u"&&"env"in process&&(c=process.env.DEBUG),c}function i(){try{return localStorage}catch{}}e.exports=i2(t);const{formatters:l}=e.exports;l.j=function(c){try{return JSON.stringify(c)}catch(d){return"[UnexpectedJSONParseError]: "+d.message}}})(hi,hi.exports);var l2=hi.exports;const c2=IN(l2),yn={LocalFileHeader:67324752,DataDescriptor:134695760,CentralFileHeader:33639248,EndOfCentralDirectory:101010256},Pd={get(e){return{signature:Ke.get(e,0),compressedSize:Ke.get(e,8),uncompressedSize:Ke.get(e,12)}},len:16},d2={get(e){const t=Ge.get(e,6);return{signature:Ke.get(e,0),minVersion:Ge.get(e,4),dataDescriptor:!!(t&8),compressedMethod:Ge.get(e,8),compressedSize:Ke.get(e,18),uncompressedSize:Ke.get(e,22),filenameLength:Ge.get(e,26),extraFieldLength:Ge.get(e,28),filename:null}},len:30},u2={get(e){return{signature:Ke.get(e,0),nrOfThisDisk:Ge.get(e,4),nrOfThisDiskWithTheStart:Ge.get(e,6),nrOfEntriesOnThisDisk:Ge.get(e,8),nrOfEntriesOfSize:Ge.get(e,10),sizeOfCd:Ke.get(e,12),offsetOfStartOfCd:Ke.get(e,16),zipFileCommentLength:Ge.get(e,20)}},len:22},m2={get(e){const t=Ge.get(e,8);return{signature:Ke.get(e,0),minVersion:Ge.get(e,6),dataDescriptor:!!(t&8),compressedMethod:Ge.get(e,10),compressedSize:Ke.get(e,20),uncompressedSize:Ke.get(e,24),filenameLength:Ge.get(e,28),extraFieldLength:Ge.get(e,30),fileCommentLength:Ge.get(e,32),relativeOffsetOfLocalHeader:Ke.get(e,42),filename:null}},len:46};function jx(e){const t=new Uint8Array(Ke.len);return Ke.put(t,0,e),t}const ar=c2("tokenizer:inflate"),Ps=256*1024,p2=jx(yn.DataDescriptor),Da=jx(yn.EndOfCentralDirectory);class pa{constructor(t){this.tokenizer=t,this.syncBuffer=new Uint8Array(Ps)}async isZip(){return await this.peekSignature()===yn.LocalFileHeader}peekSignature(){return this.tokenizer.peekToken(Ke)}async findEndOfCentralDirectoryLocator(){const t=this.tokenizer,r=Math.min(16*1024,t.fileInfo.size),n=this.syncBuffer.subarray(0,r);await this.tokenizer.readBuffer(n,{position:t.fileInfo.size-r});for(let a=n.length-4;a>=0;a--)if(n[a]===Da[0]&&n[a+1]===Da[1]&&n[a+2]===Da[2]&&n[a+3]===Da[3])return t.fileInfo.size-r+a;return-1}async readCentralDirectory(){if(!this.tokenizer.supportsRandomAccess()){ar("Cannot reading central-directory without random-read support");return}ar("Reading central-directory...");const t=this.tokenizer.position,r=await this.findEndOfCentralDirectoryLocator();if(r>0){ar("Central-directory 32-bit signature found");const n=await this.tokenizer.readToken(u2,r),a=[];this.tokenizer.setPosition(n.offsetOfStartOfCd);for(let s=0;s<n.nrOfEntriesOfSize;++s){const i=await this.tokenizer.readToken(m2);if(i.signature!==yn.CentralFileHeader)throw new Error("Expected Central-File-Header signature");i.filename=await this.tokenizer.readToken(new vr(i.filenameLength,"utf-8")),await this.tokenizer.ignore(i.extraFieldLength),await this.tokenizer.ignore(i.fileCommentLength),a.push(i),ar(`Add central-directory file-entry: n=${s+1}/${a.length}: filename=${a[s].filename}`)}return this.tokenizer.setPosition(t),a}this.tokenizer.setPosition(t)}async unzip(t){const r=await this.readCentralDirectory();if(r)return this.iterateOverCentralDirectory(r,t);let n=!1;do{const a=await this.readLocalFileHeader();if(!a)break;const s=t(a);n=!!s.stop;let i;if(await this.tokenizer.ignore(a.extraFieldLength),a.dataDescriptor&&a.compressedSize===0){const l=[];let c=Ps;ar("Compressed-file-size unknown, scanning for next data-descriptor-signature....");let d=-1;for(;d<0&&c===Ps;){c=await this.tokenizer.peekBuffer(this.syncBuffer,{mayBeLess:!0}),d=f2(this.syncBuffer.subarray(0,c),p2);const u=d>=0?d:c;if(s.handler){const m=new Uint8Array(u);await this.tokenizer.readBuffer(m),l.push(m)}else await this.tokenizer.ignore(u)}ar(`Found data-descriptor-signature at pos=${this.tokenizer.position}`),s.handler&&await this.inflate(a,h2(l),s.handler)}else s.handler?(ar(`Reading compressed-file-data: ${a.compressedSize} bytes`),i=new Uint8Array(a.compressedSize),await this.tokenizer.readBuffer(i),await this.inflate(a,i,s.handler)):(ar(`Ignoring compressed-file-data: ${a.compressedSize} bytes`),await this.tokenizer.ignore(a.compressedSize));if(ar(`Reading data-descriptor at pos=${this.tokenizer.position}`),a.dataDescriptor&&(await this.tokenizer.readToken(Pd)).signature!==134695760)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-Pd.len}`)}while(!n)}async iterateOverCentralDirectory(t,r){for(const n of t){const a=r(n);if(a.handler){this.tokenizer.setPosition(n.relativeOffsetOfLocalHeader);const s=await this.readLocalFileHeader();if(s){await this.tokenizer.ignore(s.extraFieldLength);const i=new Uint8Array(n.compressedSize);await this.tokenizer.readBuffer(i),await this.inflate(s,i,a.handler)}}if(a.stop)break}}async inflate(t,r,n){if(t.compressedMethod===0)return n(r);if(t.compressedMethod!==8)throw new Error(`Unsupported ZIP compression method: ${t.compressedMethod}`);ar(`Decompress filename=${t.filename}, compressed-size=${r.length}`);const a=await pa.decompressDeflateRaw(r);return n(a)}static async decompressDeflateRaw(t){const r=new ReadableStream({start(s){s.enqueue(t),s.close()}}),n=new DecompressionStream("deflate-raw"),a=r.pipeThrough(n);try{const s=await new Response(a).arrayBuffer();return new Uint8Array(s)}catch(s){const i=s instanceof Error?`Failed to deflate ZIP entry: ${s.message}`:"Unknown decompression error in ZIP entry";throw new TypeError(i)}}async readLocalFileHeader(){const t=await this.tokenizer.peekToken(Ke);if(t===yn.LocalFileHeader){const r=await this.tokenizer.readToken(d2);return r.filename=await this.tokenizer.readToken(new vr(r.filenameLength,"utf-8")),r}if(t===yn.CentralFileHeader)return!1;throw t===3759263696?new Error("Encrypted ZIP"):new Error("Unexpected signature")}}function f2(e,t){const r=e.length,n=t.length;if(n>r)return-1;for(let a=0;a<=r-n;a++){let s=!0;for(let i=0;i<n;i++)if(e[a+i]!==t[i]){s=!1;break}if(s)return a}return-1}function h2(e){const t=e.reduce((a,s)=>a+s.length,0),r=new Uint8Array(t);let n=0;for(const a of e)r.set(a,n),n+=a.length;return r}class x2{constructor(t){this.tokenizer=t}inflate(){const t=this.tokenizer;return new ReadableStream({async pull(r){const n=new Uint8Array(1024),a=await t.readBuffer(n,{mayBeLess:!0});if(a===0){r.close();return}r.enqueue(n.subarray(0,a))}}).pipeThrough(new DecompressionStream("gzip"))}}new globalThis.TextDecoder("utf8");new globalThis.TextEncoder;Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function _d(e){const{byteLength:t}=e;if(t===6)return e.getUint16(0)*2**32+e.getUint32(2);if(t===5)return e.getUint8(0)*2**32+e.getUint32(1);if(t===4)return e.getUint32(0);if(t===3)return e.getUint8(0)*2**16+e.getUint16(1);if(t===2)return e.getUint16(0);if(t===1)return e.getUint8(0)}function g2(e,t){if(t==="utf-16le"){const r=[];for(let n=0;n<e.length;n++){const a=e.charCodeAt(n);r.push(a&255,a>>8&255)}return r}if(t==="utf-16be"){const r=[];for(let n=0;n<e.length;n++){const a=e.charCodeAt(n);r.push(a>>8&255,a&255)}return r}return[...e].map(r=>r.charCodeAt(0))}function v2(e,t=0){const r=Number.parseInt(new vr(6).get(e,148).replace(/\0.*$/,"").trim(),8);if(Number.isNaN(r))return!1;let n=256;for(let a=t;a<t+148;a++)n+=e[a];for(let a=t+156;a<t+512;a++)n+=e[a];return r===n}const b2={get:(e,t)=>e[t+3]&127|e[t+2]<<7|e[t+1]<<14|e[t]<<21,len:4},y2=["jpg","png","apng","gif","webp","flif","xcf","cr2","cr3","orf","arw","dng","nef","rw2","raf","tif","bmp","icns","jxr","psd","indd","zip","tar","rar","gz","bz2","7z","dmg","mp4","mid","mkv","webm","mov","avi","mpg","mp2","mp3","m4a","oga","ogg","ogv","opus","flac","wav","spx","amr","pdf","epub","elf","macho","exe","swf","rtf","wasm","woff","woff2","eot","ttf","otf","ttc","ico","flv","ps","xz","sqlite","nes","crx","xpi","cab","deb","ar","rpm","Z","lz","cfb","mxf","mts","blend","bpg","docx","pptx","xlsx","3gp","3g2","j2c","jp2","jpm","jpx","mj2","aif","qcp","odt","ods","odp","xml","mobi","heic","cur","ktx","ape","wv","dcm","ics","glb","pcap","dsf","lnk","alias","voc","ac3","m4v","m4p","m4b","f4v","f4p","f4b","f4a","mie","asf","ogm","ogx","mpc","arrow","shp","aac","mp1","it","s3m","xm","skp","avif","eps","lzh","pgp","asar","stl","chm","3mf","zst","jxl","vcf","jls","pst","dwg","parquet","class","arj","cpio","ace","avro","icc","fbx","vsdx","vtt","apk","drc","lz4","potx","xltx","dotx","xltm","ott","ots","otp","odg","otg","xlsm","docm","dotm","potm","pptm","jar","jmp","rm","sav","ppsm","ppsx","tar.gz","reg","dat"],w2=["image/jpeg","image/png","image/gif","image/webp","image/flif","image/x-xcf","image/x-canon-cr2","image/x-canon-cr3","image/tiff","image/bmp","image/vnd.ms-photo","image/vnd.adobe.photoshop","application/x-indesign","application/epub+zip","application/x-xpinstall","application/vnd.ms-powerpoint.slideshow.macroenabled.12","application/vnd.oasis.opendocument.text","application/vnd.oasis.opendocument.spreadsheet","application/vnd.oasis.opendocument.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.presentationml.slideshow","application/zip","application/x-tar","application/x-rar-compressed","application/gzip","application/x-bzip2","application/x-7z-compressed","application/x-apple-diskimage","application/vnd.apache.arrow.file","video/mp4","audio/midi","video/matroska","video/webm","video/quicktime","video/vnd.avi","audio/wav","audio/qcelp","audio/x-ms-asf","video/x-ms-asf","application/vnd.ms-asf","video/mpeg","video/3gpp","audio/mpeg","audio/mp4","video/ogg","audio/ogg","audio/ogg; codecs=opus","application/ogg","audio/flac","audio/ape","audio/wavpack","audio/amr","application/pdf","application/x-elf","application/x-mach-binary","application/x-msdownload","application/x-shockwave-flash","application/rtf","application/wasm","font/woff","font/woff2","application/vnd.ms-fontobject","font/ttf","font/otf","font/collection","image/x-icon","video/x-flv","application/postscript","application/eps","application/x-xz","application/x-sqlite3","application/x-nintendo-nes-rom","application/x-google-chrome-extension","application/vnd.ms-cab-compressed","application/x-deb","application/x-unix-archive","application/x-rpm","application/x-compress","application/x-lzip","application/x-cfb","application/x-mie","application/mxf","video/mp2t","application/x-blender","image/bpg","image/j2c","image/jp2","image/jpx","image/jpm","image/mj2","audio/aiff","application/xml","application/x-mobipocket-ebook","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/icns","image/ktx","application/dicom","audio/x-musepack","text/calendar","text/vcard","text/vtt","model/gltf-binary","application/vnd.tcpdump.pcap","audio/x-dsf","application/x.ms.shortcut","application/x.apple.alias","audio/x-voc","audio/vnd.dolby.dd-raw","audio/x-m4a","image/apng","image/x-olympus-orf","image/x-sony-arw","image/x-adobe-dng","image/x-nikon-nef","image/x-panasonic-rw2","image/x-fujifilm-raf","video/x-m4v","video/3gpp2","application/x-esri-shape","audio/aac","audio/x-it","audio/x-s3m","audio/x-xm","video/MP1S","video/MP2P","application/vnd.sketchup.skp","image/avif","application/x-lzh-compressed","application/pgp-encrypted","application/x-asar","model/stl","application/vnd.ms-htmlhelp","model/3mf","image/jxl","application/zstd","image/jls","application/vnd.ms-outlook","image/vnd.dwg","application/vnd.apache.parquet","application/java-vm","application/x-arj","application/x-cpio","application/x-ace-compressed","application/avro","application/vnd.iccprofile","application/x.autodesk.fbx","application/vnd.visio","application/vnd.android.package-archive","application/vnd.google.draco","application/x-lz4","application/vnd.openxmlformats-officedocument.presentationml.template","application/vnd.openxmlformats-officedocument.spreadsheetml.template","application/vnd.openxmlformats-officedocument.wordprocessingml.template","application/vnd.ms-excel.template.macroenabled.12","application/vnd.oasis.opendocument.text-template","application/vnd.oasis.opendocument.spreadsheet-template","application/vnd.oasis.opendocument.presentation-template","application/vnd.oasis.opendocument.graphics","application/vnd.oasis.opendocument.graphics-template","application/vnd.ms-excel.sheet.macroenabled.12","application/vnd.ms-word.document.macroenabled.12","application/vnd.ms-word.template.macroenabled.12","application/vnd.ms-powerpoint.template.macroenabled.12","application/vnd.ms-powerpoint.presentation.macroenabled.12","application/java-archive","application/vnd.rn-realmedia","application/x-spss-sav","application/x-ms-regedit","application/x-ft-windows-registry-hive","application/x-jmp-data"],Xn=4100,j2=Xn-2,ur=1024*1024,Id=1024,k2=2**31-1,Mt=16*1024*1024,Go=ur,Od=ur,C2=Mt,N2=1,Fd=100,_s=Mt,zd=64,Ld=Go,S2=256,$2=512,E2=Mt,T2=512,A2=512,Md=256,Vd=Go,Bd=Go,D2=Go,Ud=Mt,R2=new Set(["Unexpected signature","Encrypted ZIP","Expected Central-File-Header signature"]),P2=["ZIP entry count exceeds ","Unsupported ZIP compression method:","ZIP entry compressed data exceeds ","ZIP entry decompressed data exceeds ","Expected data-descriptor-signature at position "],_2=new Set(["Z_BUF_ERROR","Z_DATA_ERROR","ERR_INVALID_STATE"]);class Yr extends Error{}function I2(e){var t;const r=e==null?void 0:e.streamReader;if(((t=r==null?void 0:r.constructor)==null?void 0:t.name)!=="WebStreamByobReader")return e;const{reader:n}=r,a=async()=>{await n.cancel(),n.releaseLock()};return r.close=a,r.abort=async()=>{r.interrupted=!0,await a()},e}function Ol(e,t,r){if(!Number.isFinite(e)||e<0||e>t)throw new Yr(`${r} has invalid size ${e} (maximum ${t} bytes)`);return e}async function Rr(e,t,{maximumLength:r=Mt,reason:n="skip"}={}){const a=Ol(t,r,n);await e.ignore(a)}async function Is(e,t,r,{maximumLength:n=t.length,reason:a="read"}={}){const s=t.length,i=Ol(s,n,a);return e.readBuffer(t,{...r,length:i})}async function O2(e,{maximumLength:t=ur}={}){const r=new ReadableStream({start(l){l.enqueue(e),l.close()}}).pipeThrough(new DecompressionStream("deflate-raw")).getReader(),n=[];let a=0;try{for(;;){const{done:l,value:c}=await r.read();if(l)break;if(a+=c.length,a>t)throw await r.cancel(),new Error(`ZIP entry decompressed data exceeds ${t} bytes`);n.push(c)}}finally{r.releaseLock()}const s=new Uint8Array(a);let i=0;for(const l of n)s.set(l,i),i+=l.length;return s}const kx=134695760,ro=16,F2=ro-1;function z2(e,t){if(e.length<ro)return-1;const r=e.length-ro;for(let n=0;n<=r;n++)if(Ke.get(e,n)===kx&&Ke.get(e,n+8)===t+n)return n;return-1}function L2(e){return(e.codePointAt(0)&32)!==0}function M2(e,t){const r=new Uint8Array(t);let n=0;for(const a of e)r.set(a,n),n+=a.length;return r}async function V2(e,{shouldBuffer:t,maximumLength:r=ur}={}){const{syncBuffer:n}=e,{length:a}=n,s=[];let i=0;for(;;){const l=await e.tokenizer.peekBuffer(n,{mayBeLess:!0}),c=z2(n.subarray(0,l),i),d=c>=0?0:l===a?Math.min(F2,l-1):0,u=c>=0?c:l-d;if(u===0)break;if(i+=u,i>r)throw new Error(`ZIP entry compressed data exceeds ${r} bytes`);if(t){const m=new Uint8Array(u);await e.tokenizer.readBuffer(m),s.push(m)}else await e.tokenizer.ignore(u);if(c>=0)break}if(pt(e.tokenizer)||(e.knownSizeDescriptorScannedBytes+=i),!!t)return M2(s,i)}function B2(e,t){return pt(e.tokenizer)?Math.max(0,Mt-(e.tokenizer.position-t)):Math.max(0,ur-e.knownSizeDescriptorScannedBytes)}async function U2(e,t,{shouldBuffer:r,maximumDescriptorLength:n=ur}={}){if(t.dataDescriptor&&t.compressedSize===0)return V2(e,{shouldBuffer:r,maximumLength:n});if(!r){await Rr(e.tokenizer,t.compressedSize,{maximumLength:pt(e.tokenizer)?ur:e.tokenizer.fileInfo.size,reason:"ZIP entry compressed data"});return}const a=K2(e.tokenizer);if(!Number.isFinite(t.compressedSize)||t.compressedSize<0||t.compressedSize>a)throw new Error(`ZIP entry compressed data exceeds ${a} bytes`);const s=new Uint8Array(t.compressedSize);return await e.tokenizer.readBuffer(s),s}pa.prototype.inflate=async function(e,t,r){if(e.compressedMethod===0)return r(t);if(e.compressedMethod!==8)throw new Error(`Unsupported ZIP compression method: ${e.compressedMethod}`);const n=await O2(t,{maximumLength:ur});return r(n)};pa.prototype.unzip=async function(e){let t=!1,r=0;const n=this.tokenizer.position;this.knownSizeDescriptorScannedBytes=0;do{if(Zn(this.tokenizer,n,Mt))throw new Yr(`ZIP stream probing exceeds ${Mt} bytes`);const a=await this.readLocalFileHeader();if(!a)break;if(r++,r>Id)throw new Error(`ZIP entry count exceeds ${Id}`);const s=e(a);t=!!s.stop,await this.tokenizer.ignore(a.extraFieldLength);const i=await U2(this,a,{shouldBuffer:!!s.handler,maximumDescriptorLength:Math.min(ur,B2(this,n))});if(s.handler&&await this.inflate(a,i,s.handler),a.dataDescriptor){const l=new Uint8Array(ro);if(await this.tokenizer.readBuffer(l),Ke.get(l,0)!==kx)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-l.length}`)}if(Zn(this.tokenizer,n,Mt))throw new Yr(`ZIP stream probing exceeds ${Mt} bytes`)}while(!t)};function H2(e,t){const r=e.getReader();let n=0,a=!1,s=!1;const i=async l=>{a||s||(s=!0,await r.cancel(l))};return new ReadableStream({async pull(l){if(n>=t){l.close(),await i();return}const{done:c,value:d}=await r.read();if(c||!d){a=!0,l.close();return}const u=t-n;if(d.length>u){l.enqueue(d.subarray(0,u)),n+=u,l.close(),await i();return}l.enqueue(d),n+=d.length},async cancel(l){await i(l)}})}async function W2(e,t){return new Fl(t).fromBlob(e)}function Hd(e){switch(e=e.toLowerCase(),e){case"application/epub+zip":return{ext:"epub",mime:e};case"application/vnd.oasis.opendocument.text":return{ext:"odt",mime:e};case"application/vnd.oasis.opendocument.text-template":return{ext:"ott",mime:e};case"application/vnd.oasis.opendocument.spreadsheet":return{ext:"ods",mime:e};case"application/vnd.oasis.opendocument.spreadsheet-template":return{ext:"ots",mime:e};case"application/vnd.oasis.opendocument.presentation":return{ext:"odp",mime:e};case"application/vnd.oasis.opendocument.presentation-template":return{ext:"otp",mime:e};case"application/vnd.oasis.opendocument.graphics":return{ext:"odg",mime:e};case"application/vnd.oasis.opendocument.graphics-template":return{ext:"otg",mime:e};case"application/vnd.openxmlformats-officedocument.presentationml.slideshow":return{ext:"ppsx",mime:e};case"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":return{ext:"xlsx",mime:e};case"application/vnd.ms-excel.sheet.macroenabled":return{ext:"xlsm",mime:"application/vnd.ms-excel.sheet.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.spreadsheetml.template":return{ext:"xltx",mime:e};case"application/vnd.ms-excel.template.macroenabled":return{ext:"xltm",mime:"application/vnd.ms-excel.template.macroenabled.12"};case"application/vnd.ms-powerpoint.slideshow.macroenabled":return{ext:"ppsm",mime:"application/vnd.ms-powerpoint.slideshow.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return{ext:"docx",mime:e};case"application/vnd.ms-word.document.macroenabled":return{ext:"docm",mime:"application/vnd.ms-word.document.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.template":return{ext:"dotx",mime:e};case"application/vnd.ms-word.template.macroenabledtemplate":return{ext:"dotm",mime:"application/vnd.ms-word.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.template":return{ext:"potx",mime:e};case"application/vnd.ms-powerpoint.template.macroenabled":return{ext:"potm",mime:"application/vnd.ms-powerpoint.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.presentation":return{ext:"pptx",mime:e};case"application/vnd.ms-powerpoint.presentation.macroenabled":return{ext:"pptm",mime:"application/vnd.ms-powerpoint.presentation.macroenabled.12"};case"application/vnd.ms-visio.drawing":return{ext:"vsdx",mime:"application/vnd.visio"};case"application/vnd.ms-package.3dmanufacturing-3dmodel+xml":return{ext:"3mf",mime:"model/3mf"}}}function or(e,t,r){r={offset:0,...r};for(const[n,a]of t.entries())if(r.mask){if(a!==(r.mask[n]&e[n+r.offset]))return!1}else if(a!==e[n+r.offset])return!1;return!0}function q2(e){return Number.isFinite(e)?Math.max(1,Math.trunc(e)):Xn}function G2(e,t,r){return r===void 0?e.read(t):(r.throwIfAborted(),new Promise((n,a)=>{const s=()=>{r.removeEventListener("abort",i)},i=()=>{const l=r.reason;s(),(async()=>{try{await e.cancel(l)}catch{}})(),a(l)};r.addEventListener("abort",i,{once:!0}),(async()=>{try{const l=await e.read(t);s(),n(l)}catch(l){s(),a(l)}})()}))}function X2(e){return Number.isFinite(e)?Math.max(0,Math.min(j2,Math.trunc(e))):0}function Z2(e){return Number.isFinite(e)?Math.max(0,e):Number.MAX_SAFE_INTEGER}function pt(e){const t=e.fileInfo.size;return!Number.isFinite(t)||t===Number.MAX_SAFE_INTEGER}function Zn(e,t,r){return pt(e)&&e.position-t>r}function K2(e){const t=e.fileInfo.size,r=Number.isFinite(t)?Math.max(0,t-e.position):Number.MAX_SAFE_INTEGER;return Math.min(r,k2)}function Y2(e){if(e instanceof tt||e instanceof Yr)return!0;if(!(e instanceof Error))return!1;if(R2.has(e.message)||_2.has(e.code))return!0;for(const t of P2)if(e.message.startsWith(t))return!0;return!1}function Wd(e,t=ur){const r=[e.compressedSize,e.uncompressedSize];for(const n of r)if(!Number.isFinite(n)||n<0||n>t)return!1;return!0}function J2(){return{hasContentTypesEntry:!1,hasParsedContentTypesEntry:!1,isParsingContentTypes:!1,hasUnparseableContentTypes:!1,hasWordDirectory:!1,hasPresentationDirectory:!1,hasSpreadsheetDirectory:!1,hasThreeDimensionalModelEntry:!1}}function Q2(e,t){t.startsWith("word/")&&(e.hasWordDirectory=!0),t.startsWith("ppt/")&&(e.hasPresentationDirectory=!0),t.startsWith("xl/")&&(e.hasSpreadsheetDirectory=!0),t.startsWith("3D/")&&t.endsWith(".model")&&(e.hasThreeDimensionalModelEntry=!0)}function qd(e){if(!(!e.hasContentTypesEntry||e.hasUnparseableContentTypes||e.isParsingContentTypes||e.hasParsedContentTypesEntry)){if(e.hasWordDirectory)return{ext:"docx",mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"};if(e.hasPresentationDirectory)return{ext:"pptx",mime:"application/vnd.openxmlformats-officedocument.presentationml.presentation"};if(e.hasSpreadsheetDirectory)return{ext:"xlsx",mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"};if(e.hasThreeDimensionalModelEntry)return{ext:"3mf",mime:"model/3mf"}}}function eS(e){const t=e.indexOf('.main+xml"');if(t===-1){const a="application/vnd.ms-package.3dmanufacturing-3dmodel+xml";return e.includes(`ContentType="${a}"`)?a:void 0}const r=e.slice(0,t),n=r.lastIndexOf('"');return r.slice(n+1)}class Fl{constructor(t){$d(this,"detectConfident",async n=>{if(this.buffer=new Uint8Array(Xn),n.fileInfo.size===void 0&&(n.fileInfo.size=Number.MAX_SAFE_INTEGER),this.tokenizer=n,pt(n)&&(await n.peekBuffer(this.buffer,{length:3,mayBeLess:!0}),this.check([31,139,8])))return this.detectGzip(n);if(await n.peekBuffer(this.buffer,{length:32,mayBeLess:!0}),this.check([66,77]))return{ext:"bmp",mime:"image/bmp"};if(this.check([11,119]))return{ext:"ac3",mime:"audio/vnd.dolby.dd-raw"};if(this.check([120,1]))return{ext:"dmg",mime:"application/x-apple-diskimage"};if(this.check([77,90]))return{ext:"exe",mime:"application/x-msdownload"};if(this.check([37,33]))return await n.peekBuffer(this.buffer,{length:24,mayBeLess:!0}),this.checkString("PS-Adobe-",{offset:2})&&this.checkString(" EPSF-",{offset:14})?{ext:"eps",mime:"application/eps"}:{ext:"ps",mime:"application/postscript"};if(this.check([31,160])||this.check([31,157]))return{ext:"Z",mime:"application/x-compress"};if(this.check([199,113]))return{ext:"cpio",mime:"application/x-cpio"};if(this.check([96,234]))return{ext:"arj",mime:"application/x-arj"};if(this.check([239,187,191]))return this.detectionReentryCount>=Md?void 0:(this.detectionReentryCount++,await this.tokenizer.ignore(3),this.detectConfident(n));if(this.check([71,73,70]))return{ext:"gif",mime:"image/gif"};if(this.check([73,73,188]))return{ext:"jxr",mime:"image/vnd.ms-photo"};if(this.check([31,139,8]))return this.detectGzip(n);if(this.check([66,90,104]))return{ext:"bz2",mime:"application/x-bzip2"};if(this.checkString("ID3")){await Rr(n,6,{maximumLength:6,reason:"ID3 header prefix"});const a=await n.readToken(b2),s=pt(n);if(!Number.isFinite(a)||a<0||s&&(a>_s||n.position+a>_s))return;if(n.position+a>n.fileInfo.size)return s?void 0:{ext:"mp3",mime:"audio/mpeg"};try{await Rr(n,a,{maximumLength:s?_s:n.fileInfo.size,reason:"ID3 payload"})}catch(i){if(i instanceof tt)return;throw i}return this.detectionReentryCount>=Md?void 0:(this.detectionReentryCount++,this.parseTokenizer(n,this.detectionReentryCount))}if(this.checkString("MP+"))return{ext:"mpc",mime:"audio/x-musepack"};if((this.buffer[0]===67||this.buffer[0]===70)&&this.check([87,83],{offset:1}))return{ext:"swf",mime:"application/x-shockwave-flash"};if(this.check([255,216,255]))return this.check([247],{offset:3})?{ext:"jls",mime:"image/jls"}:{ext:"jpg",mime:"image/jpeg"};if(this.check([79,98,106,1]))return{ext:"avro",mime:"application/avro"};if(this.checkString("FLIF"))return{ext:"flif",mime:"image/flif"};if(this.checkString("8BPS"))return{ext:"psd",mime:"image/vnd.adobe.photoshop"};if(this.checkString("MPCK"))return{ext:"mpc",mime:"audio/x-musepack"};if(this.checkString("FORM"))return{ext:"aif",mime:"audio/aiff"};if(this.checkString("icns",{offset:0}))return{ext:"icns",mime:"image/icns"};if(this.check([80,75,3,4])){let a;const s=J2();try{await new pa(n).unzip(i=>{Q2(s,i.filename);const l=i.filename==="[Content_Types].xml",c=qd(s);if(!l&&c)return a=c,{stop:!0};switch(i.filename){case"META-INF/mozilla.rsa":return a={ext:"xpi",mime:"application/x-xpinstall"},{stop:!0};case"META-INF/MANIFEST.MF":return a={ext:"jar",mime:"application/java-archive"},{stop:!0};case"mimetype":return Wd(i,Od)?{async handler(d){const u=new TextDecoder("utf-8").decode(d).trim();a=Hd(u)},stop:!0}:{};case"[Content_Types].xml":return s.hasContentTypesEntry=!0,Wd(i,Od)?(s.isParsingContentTypes=!0,{async handler(d){const u=new TextDecoder("utf-8").decode(d),m=eS(u);m&&(a=Hd(m)),s.hasParsedContentTypesEntry=!0,s.isParsingContentTypes=!1},stop:!0}):(s.hasUnparseableContentTypes=!0,{});default:return/classes\d*\.dex/.test(i.filename)?(a={ext:"apk",mime:"application/vnd.android.package-archive"},{stop:!0}):{}}})}catch(i){if(!Y2(i))throw i;s.isParsingContentTypes&&(s.isParsingContentTypes=!1,s.hasUnparseableContentTypes=!0)}return a??qd(s)??{ext:"zip",mime:"application/zip"}}if(this.checkString("OggS")){await n.ignore(28);const a=new Uint8Array(8);return await n.readBuffer(a),or(a,[79,112,117,115,72,101,97,100])?{ext:"opus",mime:"audio/ogg; codecs=opus"}:or(a,[128,116,104,101,111,114,97])?{ext:"ogv",mime:"video/ogg"}:or(a,[1,118,105,100,101,111,0])?{ext:"ogm",mime:"video/ogg"}:or(a,[127,70,76,65,67])?{ext:"oga",mime:"audio/ogg"}:or(a,[83,112,101,101,120,32,32])?{ext:"spx",mime:"audio/ogg"}:or(a,[1,118,111,114,98,105,115])?{ext:"ogg",mime:"audio/ogg"}:{ext:"ogx",mime:"application/ogg"}}if(this.check([80,75])&&(this.buffer[2]===3||this.buffer[2]===5||this.buffer[2]===7)&&(this.buffer[3]===4||this.buffer[3]===6||this.buffer[3]===8))return{ext:"zip",mime:"application/zip"};if(this.checkString("MThd"))return{ext:"mid",mime:"audio/midi"};if(this.checkString("wOFF")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff",mime:"font/woff"};if(this.checkString("wOF2")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff2",mime:"font/woff2"};if(this.check([212,195,178,161])||this.check([161,178,195,212]))return{ext:"pcap",mime:"application/vnd.tcpdump.pcap"};if(this.checkString("DSD "))return{ext:"dsf",mime:"audio/x-dsf"};if(this.checkString("LZIP"))return{ext:"lz",mime:"application/x-lzip"};if(this.checkString("fLaC"))return{ext:"flac",mime:"audio/flac"};if(this.check([66,80,71,251]))return{ext:"bpg",mime:"image/bpg"};if(this.checkString("wvpk"))return{ext:"wv",mime:"audio/wavpack"};if(this.checkString("%PDF"))return{ext:"pdf",mime:"application/pdf"};if(this.check([0,97,115,109]))return{ext:"wasm",mime:"application/wasm"};if(this.check([73,73])){const a=await this.readTiffHeader(!1);if(a)return a}if(this.check([77,77])){const a=await this.readTiffHeader(!0);if(a)return a}if(this.checkString("MAC "))return{ext:"ape",mime:"audio/ape"};if(this.check([26,69,223,163])){async function a(){const d=await n.peekNumber(HN);let u=128,m=0;for(;!(d&u)&&u!==0;)++m,u>>=1;const p=new Uint8Array(m+1);return await Is(n,p,void 0,{maximumLength:p.length,reason:"EBML field"}),p}async function s(){const d=await a(),u=await a();u[0]^=128>>u.length-1;const m=Math.min(6,u.length),p=new DataView(d.buffer),f=new DataView(u.buffer,u.length-m,m);return{id:_d(p),len:_d(f)}}async function i(d){let u=0;for(;d>0;){if(u++,u>S2||Zn(n,c,Mt))return;const m=n.position,p=await s();if(p.id===17026){if(p.len>zd)return;const f=Ol(p.len,zd,"EBML DocType");return(await n.readToken(new vr(f))).replaceAll(/\00.*$/g,"")}if(pt(n)&&(!Number.isFinite(p.len)||p.len<0||p.len>Ld)||(await Rr(n,p.len,{maximumLength:pt(n)?Ld:n.fileInfo.size,reason:"EBML payload"}),--d,n.position<=m))return}}const l=await s(),c=n.position;switch(await i(l.len)){case"webm":return{ext:"webm",mime:"video/webm"};case"matroska":return{ext:"mkv",mime:"video/matroska"};default:return}}if(this.checkString("SQLi"))return{ext:"sqlite",mime:"application/x-sqlite3"};if(this.check([78,69,83,26]))return{ext:"nes",mime:"application/x-nintendo-nes-rom"};if(this.checkString("Cr24"))return{ext:"crx",mime:"application/x-google-chrome-extension"};if(this.checkString("MSCF")||this.checkString("ISc("))return{ext:"cab",mime:"application/vnd.ms-cab-compressed"};if(this.check([237,171,238,219]))return{ext:"rpm",mime:"application/x-rpm"};if(this.check([197,208,211,198]))return{ext:"eps",mime:"application/eps"};if(this.check([40,181,47,253]))return{ext:"zst",mime:"application/zstd"};if(this.check([127,69,76,70]))return{ext:"elf",mime:"application/x-elf"};if(this.check([33,66,68,78]))return{ext:"pst",mime:"application/vnd.ms-outlook"};if(this.checkString("PAR1")||this.checkString("PARE"))return{ext:"parquet",mime:"application/vnd.apache.parquet"};if(this.checkString("ttcf"))return{ext:"ttc",mime:"font/collection"};if(this.check([254,237,250,206])||this.check([254,237,250,207])||this.check([206,250,237,254])||this.check([207,250,237,254]))return{ext:"macho",mime:"application/x-mach-binary"};if(this.check([4,34,77,24]))return{ext:"lz4",mime:"application/x-lz4"};if(this.checkString("regf"))return{ext:"dat",mime:"application/x-ft-windows-registry-hive"};if(this.checkString("$FL2")||this.checkString("$FL3"))return{ext:"sav",mime:"application/x-spss-sav"};if(this.check([79,84,84,79,0]))return{ext:"otf",mime:"font/otf"};if(this.checkString("#!AMR"))return{ext:"amr",mime:"audio/amr"};if(this.checkString("{\\rtf"))return{ext:"rtf",mime:"application/rtf"};if(this.check([70,76,86,1]))return{ext:"flv",mime:"video/x-flv"};if(this.checkString("IMPM"))return{ext:"it",mime:"audio/x-it"};if(this.checkString("-lh0-",{offset:2})||this.checkString("-lh1-",{offset:2})||this.checkString("-lh2-",{offset:2})||this.checkString("-lh3-",{offset:2})||this.checkString("-lh4-",{offset:2})||this.checkString("-lh5-",{offset:2})||this.checkString("-lh6-",{offset:2})||this.checkString("-lh7-",{offset:2})||this.checkString("-lzs-",{offset:2})||this.checkString("-lz4-",{offset:2})||this.checkString("-lz5-",{offset:2})||this.checkString("-lhd-",{offset:2}))return{ext:"lzh",mime:"application/x-lzh-compressed"};if(this.check([0,0,1,186])){if(this.check([33],{offset:4,mask:[241]}))return{ext:"mpg",mime:"video/MP1S"};if(this.check([68],{offset:4,mask:[196]}))return{ext:"mpg",mime:"video/MP2P"}}if(this.checkString("ITSF"))return{ext:"chm",mime:"application/vnd.ms-htmlhelp"};if(this.check([202,254,186,190])){const a=Ad.get(this.buffer,4),s=fn.get(this.buffer,6);if(a>0&&a<=30)return{ext:"macho",mime:"application/x-mach-binary"};if(s>30)return{ext:"class",mime:"application/java-vm"}}if(this.checkString(".RMF"))return{ext:"rm",mime:"application/vnd.rn-realmedia"};if(this.checkString("DRACO"))return{ext:"drc",mime:"application/vnd.google.draco"};if(this.check([253,55,122,88,90,0]))return{ext:"xz",mime:"application/x-xz"};if(this.checkString("<?xml "))return{ext:"xml",mime:"application/xml"};if(this.check([55,122,188,175,39,28]))return{ext:"7z",mime:"application/x-7z-compressed"};if(this.check([82,97,114,33,26,7])&&(this.buffer[6]===0||this.buffer[6]===1))return{ext:"rar",mime:"application/x-rar-compressed"};if(this.checkString("solid "))return{ext:"stl",mime:"model/stl"};if(this.checkString("AC")){const a=new vr(4,"latin1").get(this.buffer,2);if(a.match("^d*")&&a>=1e3&&a<=1050)return{ext:"dwg",mime:"image/vnd.dwg"}}if(this.checkString("070707"))return{ext:"cpio",mime:"application/x-cpio"};if(this.checkString("BLENDER"))return{ext:"blend",mime:"application/x-blender"};if(this.checkString("!<arch>"))return await n.ignore(8),await n.readToken(new vr(13,"ascii"))==="debian-binary"?{ext:"deb",mime:"application/x-deb"}:{ext:"ar",mime:"application/x-unix-archive"};if(this.checkString("WEBVTT")&&[`
|
|
83
|
+
`,"\r"," "," ","\0"].some(a=>this.checkString(a,{offset:6})))return{ext:"vtt",mime:"text/vtt"};if(this.check([137,80,78,71,13,10,26,10])){const a={ext:"png",mime:"image/png"},s={ext:"apng",mime:"image/apng"};await n.ignore(8);async function i(){return{length:await n.readToken(WN),type:await n.readToken(new vr(4,"latin1"))}}const l=pt(n),c=n.position;let d=0,u=!1;do{if(d++,d>$2||Zn(n,c,E2))break;const m=n.position,p=await i();if(p.length<0)return;if(p.type==="IHDR"){if(p.length!==13)return;u=!0}switch(p.type){case"IDAT":return a;case"acTL":return s;default:if(!u&&p.type!=="CgBI")return;if(l&&p.length>Vd)return u&&L2(p.type)?a:void 0;try{await Rr(n,p.length+4,{maximumLength:l?Vd+4:n.fileInfo.size,reason:"PNG chunk payload"})}catch(f){if(!l&&(f instanceof Yr||f instanceof tt))return a;throw f}}if(n.position<=m)break}while(n.position+8<n.fileInfo.size);return a}if(this.check([65,82,82,79,87,49,0,0]))return{ext:"arrow",mime:"application/vnd.apache.arrow.file"};if(this.check([103,108,84,70,2,0,0,0]))return{ext:"glb",mime:"model/gltf-binary"};if(this.check([102,114,101,101],{offset:4})||this.check([109,100,97,116],{offset:4})||this.check([109,111,111,118],{offset:4})||this.check([119,105,100,101],{offset:4}))return{ext:"mov",mime:"video/quicktime"};if(this.check([73,73,82,79,8,0,0,0,24]))return{ext:"orf",mime:"image/x-olympus-orf"};if(this.checkString("gimp xcf "))return{ext:"xcf",mime:"image/x-xcf"};if(this.checkString("ftyp",{offset:4})&&this.buffer[8]&96){const a=new vr(4,"latin1").get(this.buffer,8).replace("\0"," ").trim();switch(a){case"avif":case"avis":return{ext:"avif",mime:"image/avif"};case"mif1":return{ext:"heic",mime:"image/heif"};case"msf1":return{ext:"heic",mime:"image/heif-sequence"};case"heic":case"heix":return{ext:"heic",mime:"image/heic"};case"hevc":case"hevx":return{ext:"heic",mime:"image/heic-sequence"};case"qt":return{ext:"mov",mime:"video/quicktime"};case"M4V":case"M4VH":case"M4VP":return{ext:"m4v",mime:"video/x-m4v"};case"M4P":return{ext:"m4p",mime:"video/mp4"};case"M4B":return{ext:"m4b",mime:"audio/mp4"};case"M4A":return{ext:"m4a",mime:"audio/x-m4a"};case"F4V":return{ext:"f4v",mime:"video/mp4"};case"F4P":return{ext:"f4p",mime:"video/mp4"};case"F4A":return{ext:"f4a",mime:"audio/mp4"};case"F4B":return{ext:"f4b",mime:"audio/mp4"};case"crx":return{ext:"cr3",mime:"image/x-canon-cr3"};default:return a.startsWith("3g")?a.startsWith("3g2")?{ext:"3g2",mime:"video/3gpp2"}:{ext:"3gp",mime:"video/3gpp"}:{ext:"mp4",mime:"video/mp4"}}}if(this.checkString(`REGEDIT4\r
|
|
84
|
+
`))return{ext:"reg",mime:"application/x-ms-regedit"};if(this.check([82,73,70,70])){if(this.checkString("WEBP",{offset:8}))return{ext:"webp",mime:"image/webp"};if(this.check([65,86,73],{offset:8}))return{ext:"avi",mime:"video/vnd.avi"};if(this.check([87,65,86,69],{offset:8}))return{ext:"wav",mime:"audio/wav"};if(this.check([81,76,67,77],{offset:8}))return{ext:"qcp",mime:"audio/qcelp"}}if(this.check([73,73,85,0,24,0,0,0,136,231,116,216]))return{ext:"rw2",mime:"image/x-panasonic-rw2"};if(this.check([48,38,178,117,142,102,207,17,166,217])){let a=!1;try{async function s(){const d=new Uint8Array(16);return await Is(n,d,void 0,{maximumLength:d.length,reason:"ASF header GUID"}),{id:d,size:Number(await n.readToken(qN))}}await Rr(n,30,{maximumLength:30,reason:"ASF header prelude"});const i=pt(n),l=n.position;let c=0;for(;n.position+24<n.fileInfo.size&&(c++,!(c>T2||Zn(n,l,Mt)));){const d=n.position,u=await s();let m=u.size-24;if(!Number.isFinite(m)||m<0){a=!0;break}if(or(u.id,[145,7,220,183,183,169,207,17,142,230,0,192,12,32,83,101])){const p=new Uint8Array(16);if(m-=await Is(n,p,void 0,{maximumLength:p.length,reason:"ASF stream type GUID"}),or(p,[64,158,105,248,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"audio/x-ms-asf"};if(or(p,[192,239,25,188,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"video/x-ms-asf"};break}if(i&&m>Bd){a=!0;break}if(await Rr(n,m,{maximumLength:i?Bd:n.fileInfo.size,reason:"ASF header payload"}),n.position<=d){a=!0;break}}}catch(s){if(s instanceof tt||s instanceof Yr)pt(n)&&(a=!0);else throw s}return a?void 0:{ext:"asf",mime:"application/vnd.ms-asf"}}if(this.check([171,75,84,88,32,49,49,187,13,10,26,10]))return{ext:"ktx",mime:"image/ktx"};if((this.check([126,16,4])||this.check([126,24,4]))&&this.check([48,77,73,69],{offset:4}))return{ext:"mie",mime:"application/x-mie"};if(this.check([39,10,0,0,0,0,0,0,0,0,0,0],{offset:2}))return{ext:"shp",mime:"application/x-esri-shape"};if(this.check([255,79,255,81]))return{ext:"j2c",mime:"image/j2c"};if(this.check([0,0,0,12,106,80,32,32,13,10,135,10]))switch(await n.ignore(20),await n.readToken(new vr(4,"ascii"))){case"jp2 ":return{ext:"jp2",mime:"image/jp2"};case"jpx ":return{ext:"jpx",mime:"image/jpx"};case"jpm ":return{ext:"jpm",mime:"image/jpm"};case"mjp2":return{ext:"mj2",mime:"image/mj2"};default:return}if(this.check([255,10])||this.check([0,0,0,12,74,88,76,32,13,10,135,10]))return{ext:"jxl",mime:"image/jxl"};if(this.check([254,255]))return this.checkString("<?xml ",{offset:2,encoding:"utf-16be"})?{ext:"xml",mime:"application/xml"}:void 0;if(this.check([208,207,17,224,161,177,26,225]))return{ext:"cfb",mime:"application/x-cfb"};if(await n.peekBuffer(this.buffer,{length:Math.min(256,n.fileInfo.size),mayBeLess:!0}),this.check([97,99,115,112],{offset:36}))return{ext:"icc",mime:"application/vnd.iccprofile"};if(this.checkString("**ACE",{offset:7})&&this.checkString("**",{offset:12}))return{ext:"ace",mime:"application/x-ace-compressed"};if(this.checkString("BEGIN:")){if(this.checkString("VCARD",{offset:6}))return{ext:"vcf",mime:"text/vcard"};if(this.checkString("VCALENDAR",{offset:6}))return{ext:"ics",mime:"text/calendar"}}if(this.checkString("FUJIFILMCCD-RAW"))return{ext:"raf",mime:"image/x-fujifilm-raf"};if(this.checkString("Extended Module:"))return{ext:"xm",mime:"audio/x-xm"};if(this.checkString("Creative Voice File"))return{ext:"voc",mime:"audio/x-voc"};if(this.check([4,0,0,0])&&this.buffer.length>=16){const a=new DataView(this.buffer.buffer).getUint32(12,!0);if(a>12&&this.buffer.length>=a+16)try{const s=new TextDecoder().decode(this.buffer.subarray(16,a+16));if(JSON.parse(s).files)return{ext:"asar",mime:"application/x-asar"}}catch{}}if(this.check([6,14,43,52,2,5,1,1,13,1,2,1,1,2]))return{ext:"mxf",mime:"application/mxf"};if(this.checkString("SCRM",{offset:44}))return{ext:"s3m",mime:"audio/x-s3m"};if(this.check([71])&&this.check([71],{offset:188}))return{ext:"mts",mime:"video/mp2t"};if(this.check([71],{offset:4})&&this.check([71],{offset:196}))return{ext:"mts",mime:"video/mp2t"};if(this.check([66,79,79,75,77,79,66,73],{offset:60}))return{ext:"mobi",mime:"application/x-mobipocket-ebook"};if(this.check([68,73,67,77],{offset:128}))return{ext:"dcm",mime:"application/dicom"};if(this.check([76,0,0,0,1,20,2,0,0,0,0,0,192,0,0,0,0,0,0,70]))return{ext:"lnk",mime:"application/x.ms.shortcut"};if(this.check([98,111,111,107,0,0,0,0,109,97,114,107,0,0,0,0]))return{ext:"alias",mime:"application/x.apple.alias"};if(this.checkString("Kaydara FBX Binary \0"))return{ext:"fbx",mime:"application/x.autodesk.fbx"};if(this.check([76,80],{offset:34})&&(this.check([0,0,1],{offset:8})||this.check([1,0,2],{offset:8})||this.check([2,0,2],{offset:8})))return{ext:"eot",mime:"application/vnd.ms-fontobject"};if(this.check([6,6,237,245,216,29,70,229,189,49,239,231,254,116,183,29]))return{ext:"indd",mime:"application/x-indesign"};if(this.check([255,255,0,0,7,0,0,0,4,0,0,0,1,0,1,0])||this.check([0,0,255,255,0,0,0,7,0,0,0,4,0,1,0,1]))return{ext:"jmp",mime:"application/x-jmp-data"};if(await n.peekBuffer(this.buffer,{length:Math.min(512,n.fileInfo.size),mayBeLess:!0}),this.checkString("ustar",{offset:257})&&(this.checkString("\0",{offset:262})||this.checkString(" ",{offset:262}))||this.check([0,0,0,0,0,0],{offset:257})&&v2(this.buffer))return{ext:"tar",mime:"application/x-tar"};if(this.check([255,254])){const a="utf-16le";return this.checkString("<?xml ",{offset:2,encoding:a})?{ext:"xml",mime:"application/xml"}:this.check([255,14],{offset:2})&&this.checkString("SketchUp Model",{offset:4,encoding:a})?{ext:"skp",mime:"application/vnd.sketchup.skp"}:this.checkString(`Windows Registry Editor Version 5.00\r
|
|
85
|
+
`,{offset:2,encoding:a})?{ext:"reg",mime:"application/x-ms-regedit"}:void 0}if(this.checkString("-----BEGIN PGP MESSAGE-----"))return{ext:"pgp",mime:"application/pgp-encrypted"}}),$d(this,"detectImprecise",async n=>{this.buffer=new Uint8Array(Xn);const a=Z2(n.fileInfo.size);if(await n.peekBuffer(this.buffer,{length:Math.min(8,a),mayBeLess:!0}),this.check([0,0,1,186])||this.check([0,0,1,179]))return{ext:"mpg",mime:"video/mpeg"};if(this.check([0,1,0,0,0]))return{ext:"ttf",mime:"font/ttf"};if(this.check([0,0,1,0]))return{ext:"ico",mime:"image/x-icon"};if(this.check([0,0,2,0]))return{ext:"cur",mime:"image/x-icon"};if(await n.peekBuffer(this.buffer,{length:Math.min(2+this.options.mpegOffsetTolerance,a),mayBeLess:!0}),this.buffer.length>=2+this.options.mpegOffsetTolerance)for(let s=0;s<=this.options.mpegOffsetTolerance;++s){const i=this.scanMpeg(s);if(i)return i}});const r=X2(t==null?void 0:t.mpegOffsetTolerance);this.options={...t,mpegOffsetTolerance:r},this.detectors=[...this.options.customDetectors??[],{id:"core",detect:this.detectConfident},{id:"core.imprecise",detect:this.detectImprecise}],this.tokenizerOptions={abortSignal:this.options.signal},this.gzipProbeDepth=0}getTokenizerOptions(){return{...this.tokenizerOptions}}createTokenizerFromWebStream(t){return I2(r2(t,this.getTokenizerOptions()))}async parseTokenizer(t,r=0){this.detectionReentryCount=r;const n=t.position;for(const a of this.detectors){let s;try{s=await a.detect(t)}catch(i){if(i instanceof tt||i instanceof Yr)return;throw i}if(s)return s;if(n!==t.position)return}}async fromTokenizer(t){try{return await this.parseTokenizer(t)}finally{await t.close()}}async fromBuffer(t){if(!(t instanceof Uint8Array||t instanceof ArrayBuffer))throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof t}\``);const r=t instanceof Uint8Array?t:new Uint8Array(t);if((r==null?void 0:r.length)>1)return this.fromTokenizer(n2(r,this.getTokenizerOptions()))}async fromBlob(t){var r;(r=this.options.signal)==null||r.throwIfAborted();const n=a2(t,this.getTokenizerOptions());return this.fromTokenizer(n)}async fromStream(t){var r;(r=this.options.signal)==null||r.throwIfAborted();const n=this.createTokenizerFromWebStream(t);return this.fromTokenizer(n)}async toDetectionStream(t,r){const n=q2((r==null?void 0:r.sampleSize)??Xn);let a,s;const i=t.getReader({mode:"byob"});try{const{value:d,done:u}=await G2(i,new Uint8Array(n),this.options.signal);if(s=d,!u&&d)try{a=await this.fromBuffer(d.subarray(0,n))}catch(m){if(!(m instanceof tt))throw m;a=void 0}s=d}finally{i.releaseLock()}const l=new TransformStream({async start(d){d.enqueue(s)},transform(d,u){u.enqueue(d)}}),c=t.pipeThrough(l);return c.fileType=a,c}async detectGzip(t){var r;if(this.gzipProbeDepth>=N2)return{ext:"gz",mime:"application/gzip"};const n=new x2(t),a=H2(n.inflate(),C2),s=pt(t);let i,l,c,d;if(s){const u=new AbortController;i=setTimeout(()=>{u.abort(new DOMException(`Operation timed out after ${Fd} ms`,"TimeoutError"))},Fd),l=this.options.signal===void 0?u.signal:AbortSignal.any([this.options.signal,u.signal]),c=new Fl({...this.options,signal:l}),c.gzipProbeDepth=this.gzipProbeDepth+1}else this.gzipProbeDepth++;try{d=await(c??this).fromStream(a)}catch(u){if((u==null?void 0:u.name)==="AbortError"&&((r=l==null?void 0:l.reason)==null?void 0:r.name)!=="TimeoutError")throw u}finally{clearTimeout(i),s||this.gzipProbeDepth--}return(d==null?void 0:d.ext)==="tar"?{ext:"tar.gz",mime:"application/gzip"}:{ext:"gz",mime:"application/gzip"}}check(t,r){return or(this.buffer,t,r)}checkString(t,r){return this.check(g2(t,r==null?void 0:r.encoding),r)}async readTiffTag(t){const r=await this.tokenizer.readToken(t?fn:Ge);switch(await this.tokenizer.ignore(10),r){case 50341:return{ext:"arw",mime:"image/x-sony-arw"};case 50706:return{ext:"dng",mime:"image/x-adobe-dng"}}}async readTiffIFD(t){const r=await this.tokenizer.readToken(t?fn:Ge);if(!(r>A2)&&!(pt(this.tokenizer)&&2+r*12>Ud))for(let n=0;n<r;++n){const a=await this.readTiffTag(t);if(a)return a}}async readTiffHeader(t){const r={ext:"tif",mime:"image/tiff"},n=(t?fn:Ge).get(this.buffer,2),a=(t?Ad:Ke).get(this.buffer,4);if(n===42){if(a>=6){if(this.checkString("CR",{offset:8}))return{ext:"cr2",mime:"image/x-canon-cr2"};if(a>=8){const l=(t?fn:Ge).get(this.buffer,8),c=(t?fn:Ge).get(this.buffer,10);if(l===28&&c===254||l===31&&c===11)return{ext:"nef",mime:"image/x-nikon-nef"}}}if(pt(this.tokenizer)&&a>D2)return r;const s=pt(this.tokenizer)?Ud:this.tokenizer.fileInfo.size;try{await Rr(this.tokenizer,a,{maximumLength:s,reason:"TIFF IFD offset"})}catch(l){if(l instanceof tt)return;throw l}let i;try{i=await this.readTiffIFD(t)}catch(l){if(l instanceof tt)return;throw l}return i??r}if(n===43)return r}scanMpeg(t){if(this.check([255,224],{offset:t,mask:[255,224]})){if(this.check([16],{offset:t+1,mask:[22]}))return this.check([8],{offset:t+1,mask:[8]})?{ext:"aac",mime:"audio/aac"}:{ext:"aac",mime:"audio/aac"};if(this.check([2],{offset:t+1,mask:[6]}))return{ext:"mp3",mime:"audio/mpeg"};if(this.check([4],{offset:t+1,mask:[6]}))return{ext:"mp2",mime:"audio/mpeg"};if(this.check([6],{offset:t+1,mask:[6]}))return{ext:"mp1",mime:"audio/mpeg"}}}}new Set(y2);new Set(w2);const Gd=e=>e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`,Cx=({name:e,control:t,disabled:r,campo:n,fileTypes:a,maxFileSize:s})=>{var i;const{field:l,fieldState:c}=Be({name:e,control:t}),{uploadFile:d,deleteUploadedFile:u}=Ur(),[m,p]=N.useState({status:"idle"}),f=N.useRef(null),[v,h]=N.useState(!1),x=N.useRef(!0);N.useEffect(()=>()=>{x.current=!1},[]);const b=typeof l.value=="string"&&l.value?l.value:null,y=N.useCallback(async S=>{var $;if(a&&a.length>0){const k=await W2(S),E=(k==null?void 0:k.ext)??"",T=(k==null?void 0:k.mime)??"",O=(($=S.name.split(".").pop())==null?void 0:$.toLowerCase())??"",L=S.type.toLowerCase();if(!a.some(A=>{const z=A.toLowerCase();return!!(E&&(z===E||z===T)||T&&z.endsWith("/*")&&T.startsWith(z.slice(0,-1))||!E&&(z===O||z===L||z.endsWith("/*")&&L.startsWith(z.slice(0,-1))))})){p({status:"error",message:`Tipo de arquivo não permitido. Permitidos: ${a.join(", ")}`});return}}if(s&&S.size>s){p({status:"error",message:`Arquivo muito grande. Tamanho máximo: ${Gd(s)}`});return}if(!d){p({status:"error",message:"Preview: upload não disponível sem configuração."});return}p({status:"uploading",fileName:S.name,progress:0});try{if(b&&u)try{await u(b)}catch{}const k=await d(S,n??e,E=>{x.current&&p(T=>T.status==="uploading"?{...T,progress:Math.min(100,E)}:T)});if(!x.current)return;l.onChange(k),p({status:"done",uploadId:k,fileName:S.name,size:S.size})}catch{if(!x.current)return;p({status:"error",message:"Falha no upload. Tente novamente."})}},[d,u,b,n,e,l,a,s]),j=N.useCallback(S=>{var $;const k=($=S.target.files)==null?void 0:$[0];k&&y(k),S.target.value=""},[y]),w=N.useCallback(()=>{b&&u&&u(b).catch(()=>{}),l.onChange(""),p({status:"idle"}),f.current&&(f.current.value="")},[l,b,u]);if(m.status==="done"||m.status==="idle"&&b){const S=m.status==="done"?m.fileName:"Arquivo enviado",$=m.status==="done"?m.size:null;return o.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-green-500 bg-green-500/5 px-4 py-3 gap-2",children:[o.jsxs("svg",{className:"shrink-0 text-green-500",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[o.jsx("rect",{width:"20",height:"20",rx:"4",fill:"currentColor",fillOpacity:"0.15"}),o.jsx("path",{d:"M5 10.5L8.5 14L15 7",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),o.jsx("span",{className:"text-sm font-medium truncate flex-1",children:S}),$!==null&&o.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:Gd($)}),!r&&o.jsx("button",{type:"button",onClick:w,className:"ml-2 shrink-0 text-muted-foreground hover:text-destructive transition-colors","aria-label":"Remover arquivo",children:"✕"})]})}if(m.status==="uploading"){const{fileName:S,progress:$}=m;return o.jsxs("div",{className:"rounded-lg border border-input px-4 py-3 space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-sm font-medium truncate flex-1",children:S}),o.jsxs("span",{className:"text-xs text-muted-foreground ml-2",children:[$,"%"]})]}),o.jsx("div",{className:"h-2 rounded-full bg-muted overflow-hidden",children:o.jsx("div",{className:"h-full bg-primary transition-all duration-200 rounded-full",style:{width:`${$}%`}})})]})}const C=m.status==="error";return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{role:"button",tabIndex:r?-1:0,"aria-label":"Selecionar arquivo",className:K("flex items-center justify-center rounded-lg border-2 border-dashed px-4 py-6 transition-colors cursor-pointer",v?"border-primary bg-primary/5":C||c.error?"border-destructive bg-destructive/5":"border-input hover:border-muted-foreground hover:bg-muted/20",r&&"opacity-50 cursor-not-allowed"),onClick:()=>{var S;return!r&&((S=f.current)==null?void 0:S.click())},onKeyDown:S=>{var $;(S.key==="Enter"||S.key===" ")&&(($=f.current)==null||$.click())},onDragOver:S=>{S.preventDefault(),r||h(!0)},onDragLeave:()=>h(!1),onDrop:r?void 0:S=>{var $;S.preventDefault(),h(!1);const k=($=S.dataTransfer.files)==null?void 0:$[0];k&&y(k)},onBlur:l.onBlur,children:[o.jsx("input",{ref:f,type:"file",onChange:j,disabled:r,className:"sr-only"}),o.jsx("span",{className:"text-sm text-muted-foreground",children:v?"Solte o arquivo aqui":"Clique ou arraste um arquivo"})]}),C&&o.jsxs("p",{className:"text-sm text-destructive",children:[m.message," · ",o.jsx("button",{type:"button",className:"underline hover:no-underline",onClick:()=>p({status:"idle"}),children:"Tentar novamente"})]}),!C&&((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})},tS={cpf:e=>e.replace(/\D/g,"").slice(0,11).replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d{1,2})$/,"$1-$2"),telefone:e=>{const t=e.replace(/\D/g,"").slice(0,11);return t.length<=10?t.replace(/(\d{2})(\d)/,"($1) $2").replace(/(\d{4})(\d)/,"$1-$2"):t.replace(/(\d{2})(\d)/,"($1) $2").replace(/(\d{5})(\d)/,"$1-$2")},cep:e=>e.replace(/\D/g,"").slice(0,8).replace(/(\d{5})(\d)/,"$1-$2")},Jr=({name:e,control:t,placeholder:r,maskType:n,disabled:a,readOnly:s})=>{var i;const{field:l,fieldState:c}=Be({name:e,control:t}),d=tS[n||""],u=N.useCallback(m=>{l.onChange(d?d(m.target.value):m.target.value)},[l,d]);return o.jsxs("div",{className:"space-y-1",children:[o.jsx(ue,{name:l.name,value:l.value||"",onChange:u,onBlur:l.onBlur,placeholder:r,disabled:a,readOnly:s,className:K(c.error&&"border-destructive focus-visible:ring-destructive")}),((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})},zl=({name:e,control:t})=>{const{field:r}=Be({name:e,control:t});return o.jsx("input",{type:"hidden",...r,value:r.value??""})},Nx=e=>e.replace(/\D/g,""),rS=e=>{const t=Nx(e).slice(0,8);return t.length<=5?t:`${t.slice(0,5)}-${t.slice(5)}`},nS=async(e,t)=>{const r=await fetch(`https://viacep.com.br/ws/${e}/json/`,{signal:t});if(!r.ok)throw new Error("Falha ao consultar CEP");return r.json()},Sx=({name:e,control:t,placeholder:r="00000-000",disabled:n,readOnly:a,cepFillMap:s})=>{var i,l;const{field:c,fieldState:d}=Be({name:e,control:t}),{setValue:u}=iN(),{cepLookup:m}=Ur(),[p,f]=N.useState("idle"),[v,h]=N.useState(null),x=N.useRef(null),b=N.useRef(!0);N.useEffect(()=>()=>{var w;b.current=!1,(w=x.current)==null||w.abort()},[]);const y=N.useCallback(async()=>{var w;c.onBlur();const C=Nx(c.value??"");if(C.length===8){(w=x.current)==null||w.abort(),x.current=new AbortController,f("loading"),h(null);try{let S;if(m){const E=x.current;if(S=await m(C,E.signal),E.signal.aborted||!b.current)return}else{const E=await nS(C,x.current.signal);if(!b.current)return;if(E.erro){f("error"),h("CEP não encontrado");return}S={logradouro:E.logradouro,bairro:E.bairro,cidade:E.localidade,estado:E.uf}}if(!b.current)return;if(S.erro){f("error"),h("CEP não encontrado");return}const $=e.includes(".")?`${e.substring(0,e.lastIndexOf("."))}.`:"",k=(E,T,O)=>{if(!O)return;const L=s!=null&&s[E]?`${$}${s[E]}`:`${$}${T}`;u(L,O,{shouldDirty:!0,shouldValidate:!0})};k("logradouro","_address_logradouro",S.logradouro),k("bairro","_address_bairro",S.bairro),k("cidade","_address_cidade",S.cidade),k("estado","_address_estado",S.estado),f("success")}catch(S){if(S instanceof Error&&S.name==="AbortError"||!b.current)return;f("error"),h("Erro ao buscar CEP")}}},[c,m,u,e,s]),j=N.useCallback(w=>{c.onChange(rS(w.target.value))},[c]);return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"relative",children:[o.jsx(ue,{name:c.name,value:c.value||"",onChange:j,onBlur:y,placeholder:r,disabled:n,readOnly:a,className:K("pr-9",d.error&&"border-destructive focus-visible:ring-destructive")}),o.jsxs("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none",children:[p==="loading"&&o.jsx(I.Loader2,{className:"h-4 w-4 animate-spin text-muted-foreground"}),p==="success"&&o.jsx(I.Check,{className:"h-4 w-4 text-green-500"}),p==="error"&&o.jsx(I.AlertCircle,{className:"h-4 w-4 text-destructive"})]})]}),(((i=d.error)==null?void 0:i.message)||v)&&o.jsx("p",{className:"text-sm text-destructive",children:((l=d.error)==null?void 0:l.message)||v})]})},aS=({field:e,control:t,nameOverride:r})=>{const n={name:r,control:t,placeholder:e.placeholder};switch(e.tipo){case D.TEXTO:return o.jsx(Lt,{...n,type:"text"});case D.EMAIL:return o.jsx(Lt,{...n,type:"email"});case D.NUMBER:return o.jsx(Lt,{...n,type:"number"});case D.TEXTAREA:return o.jsx(Dl,{...n});case D.SELECT:return o.jsx(Rl,{...n,options:e.opcoes??[]});case D.RADIO:return o.jsx(vx,{...n,options:e.opcoes??[]});case D.CHECKBOX:return o.jsx(Pl,{name:r,control:t,label:e.label});case D.CHECKBOX_GROUP:return o.jsx(gx,{...n,options:e.opcoes??[]});case D.DATE:return o.jsx(ea,{...n,validacao:e.validacao});case D.DATETIME:return o.jsx(ea,{...n,isDatetime:!0,validacao:e.validacao});case D.FILE:return o.jsx(Cx,{name:r,control:t});case D.TELEFONE:return o.jsx(Jr,{...n,maskType:"telefone"});case D.CPF:return o.jsx(Jr,{...n,maskType:"cpf"});case D.CEP:return o.jsx(Sx,{name:r,control:t,placeholder:e.placeholder});case D.HIDDEN:return o.jsx(zl,{name:r,control:t});default:return console.error(`[DFFieldArray] Tipo de sub-campo "${e.tipo}" não suportado em FIELD_ARRAY. Usando DFTextField como fallback.`),o.jsx(Lt,{...n,type:"text"})}},oS=({name:e,control:t,subFields:r=[],minItems:n=1,maxItems:a,itemLabel:s="Item",addLabel:i})=>{var l;const{fields:c,append:d,remove:u}=hx({control:t,name:e}),{errors:m}=ix({control:t}),p=(l=m[e])==null?void 0:l.message,f=N.useCallback(()=>{const b={};for(const y of r)y.initialValue!==void 0?b[y.nome]=y.initialValue:y.defaultValue!==void 0&&(b[y.nome]=y.defaultValue);return b},[r]);N.useEffect(()=>{if(c.length<n)for(let b=c.length;b<n;b++)d(f())},[n]);const v=[...r].sort((b,y)=>b.ordem-y.ordem),h=!a||c.length<a,x=i??`Adicionar ${s.toLowerCase()}`;return o.jsxs("div",{className:"space-y-3",children:[c.map((b,y)=>o.jsxs("div",{className:"rounded-lg border border-input p-4",children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-primary/10 text-xs font-bold text-primary shrink-0",children:y+1}),o.jsxs("span",{className:"text-sm font-semibold",children:[s," ",y+1]})]}),c.length>n&&o.jsx(Ae,{type:"button",variant:"ghost",size:"icon",onClick:()=>u(y),"aria-label":`Remover ${s.toLowerCase()} ${y+1}`,className:"text-muted-foreground hover:text-destructive",children:o.jsx(I.Trash2,{className:"w-4 h-4"})})]}),o.jsx("div",{className:"grid grid-cols-12 gap-4",children:v.map(j=>{const w=`${e}.${y}.${j.nome}`,C=`span ${j.tamanho??12}`,S=o.jsx(aS,{field:j,control:t,nameOverride:w});return j.tipo===D.CHECKBOX||j.tipo===D.HIDDEN?o.jsx("div",{className:"max-sm:!col-span-12",style:{gridColumn:C},children:S},j.id):o.jsxs("div",{className:"max-sm:!col-span-12 space-y-2",style:{gridColumn:C},children:[o.jsxs("label",{className:"font-medium flex items-center gap-1 text-sm text-foreground",children:[j.label,j.obrigatorio&&o.jsx("span",{className:"text-destructive",children:"*"})]}),S,j.hint&&o.jsx("p",{className:"text-xs text-muted-foreground",children:j.hint})]},j.id)})})]},b.id)),h&&o.jsxs(Ae,{type:"button",variant:"outline",className:"w-full",onClick:()=>d(f()),children:[o.jsx(I.Plus,{className:"w-4 h-4"}),x]}),a&&o.jsxs("p",{className:"text-xs text-center text-muted-foreground",children:["Máximo de ",a," ",s.toLowerCase(),a>1?"s":""]}),p&&o.jsxs("p",{className:"text-sm text-destructive flex items-center gap-1",children:[o.jsx(I.AlertCircle,{className:"w-4 h-4 shrink-0"}),p]})]})},Xd=e=>`R$ ${(e/100).toFixed(2).replace(".",",")}`,sS=(e,t)=>{const r=new Date(e.slice(0,10)+"T00:00:00Z"),n=new Date(t.slice(0,10)+"T00:00:00Z");return Math.round((n.getTime()-r.getTime())/864e5)+1},iS=(e,t)=>{const r=[],n=new Date(e.slice(0,10)+"T00:00:00Z"),a=new Date(t.slice(0,10)+"T00:00:00Z");let s=0;for(;n<=a&&s<60;)r.push(n.toISOString().slice(0,10)),n.setUTCDate(n.getUTCDate()+1),s++;return r},lS=e=>{const[t,r,n]=e.split("-").map(Number),a=new Date(Date.UTC(t,r-1,n)),s=String(n).padStart(2,"0"),i=String(r).padStart(2,"0"),l=new Intl.DateTimeFormat("pt-BR",{weekday:"long",timeZone:"UTC"}).format(a),c=l.charAt(0).toUpperCase()+l.slice(1);return`${s}/${i} - ${c}`},cS=(e,t)=>{const r=n=>{const[a,s,i]=n.slice(0,10).split("-");return`${i}/${s}/${a}`};return`${r(e)} a ${r(t)}`},dS=({name:e,control:t})=>{var r;const{field:n,fieldState:a}=Be({name:e,control:t}),{externalData:s={}}=Ur(),i=n.value??null,l=(r=a.error)==null?void 0:r.message,c=V=>s[`evento.${V}`]??s[V],d=c("dataInicioEvento")??"",u=c("dataFimEvento")??"",m=Number(c("valor")??0),p=Number(c("valorPorDia")??0),f=c("vagasTotal"),v=c("vagasPorDia"),h=c("vagasMasculinas"),x=c("vagasFemininas"),b=f!=null?Number(f):null,y=v!=null?Number(v):null,j=h!=null?Number(h):null,w=x!=null?Number(x):null,C=d&&u?iS(d,u):[],S=(d&&u?sS(d,u):0)>1,$=j!=null&&j>0&&w!=null&&w>0,k=j!=null&&w==null?"masculino":w!=null&&j==null?"feminino":null,E=(i==null?void 0:i.tipo)??null,T=(i==null?void 0:i.data)??null,O=(i==null?void 0:i.genero)??null,L=N.useRef(i);L.current=i;const A=N.useRef(n.onChange);A.current=n.onChange,N.useEffect(()=>{var V,M,_;k&&((V=L.current)==null?void 0:V.genero)!==k&&A.current({tipo:((M=L.current)==null?void 0:M.tipo)??null,data:((_=L.current)==null?void 0:_.data)??null,genero:k})},[k]);const z=V=>{const M={tipo:V,data:null};($||k)&&(M.genero=O??k??void 0),n.onChange(M)},X=V=>{const M={tipo:"por_dia",data:V};($||k)&&(M.genero=O??k??void 0),n.onChange(M)},q=V=>{n.onChange({tipo:E,data:T,genero:V})},Z=V=>E===V;return o.jsxs("div",{className:"space-y-3",children:[$&&o.jsxs("div",{className:"flex items-center gap-2 px-1",children:[o.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:"Você é:"}),o.jsx("div",{className:"flex gap-2",children:["masculino","feminino"].map(V=>o.jsx("button",{type:"button",onClick:()=>q(V),className:K("px-3 py-1 rounded-full text-xs font-medium border transition-all",O===V?"border-primary bg-primary/10 text-primary":"border-input text-muted-foreground hover:border-primary/50"),children:V==="masculino"?"Masculino":"Feminino"},V))})]}),o.jsxs("button",{type:"button",onClick:()=>z("todos_os_dias"),className:K("w-full text-left flex items-start gap-3 p-4 rounded-xl border-2 transition-all",Z("todos_os_dias")?"border-primary bg-primary/5":"border-input hover:border-primary/50"),children:[o.jsx("div",{className:K("mt-0.5 p-2 rounded-lg shrink-0 transition-colors",Z("todos_os_dias")?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"),children:o.jsx(I.CalendarCheck2,{className:"w-4 h-4"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"font-semibold text-sm",children:"Participar todos os dias"}),d&&u?o.jsx("p",{className:"text-xs text-muted-foreground",children:cS(d,u)}):o.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Datas do evento"})]}),o.jsxs("div",{className:"text-right shrink-0",children:[m>0&&o.jsx("p",{className:K("font-bold text-sm",Z("todos_os_dias")?"text-primary":"text-foreground"),children:Xd(m)}),b!=null&&b>0&&o.jsxs("p",{className:"text-xs flex items-center justify-end gap-1 text-muted-foreground",children:[o.jsx(I.Users,{className:"w-3 h-3"}),b," vagas disponíveis"]})]})]}),S?o.jsxs("button",{type:"button",onClick:()=>z("por_dia"),className:K("w-full text-left flex items-start gap-3 p-4 rounded-xl border-2 transition-all",Z("por_dia")?"border-primary bg-primary/5":"border-input hover:border-primary/50"),children:[o.jsx("div",{className:K("mt-0.5 p-2 rounded-lg shrink-0 transition-colors",Z("por_dia")?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"),children:o.jsx(I.CalendarDays,{className:"w-4 h-4"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"font-semibold text-sm",children:"Participar um dia"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Escolha o dia desejado abaixo"})]}),o.jsxs("div",{className:"text-right shrink-0",children:[p>0&&o.jsx("p",{className:K("font-bold text-sm",Z("por_dia")?"text-primary":"text-foreground"),children:Xd(p)}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"por dia"})]})]}):d?o.jsxs("div",{className:"flex items-start gap-2 px-3 py-2.5 rounded-lg border border-input bg-muted/30",children:[o.jsx(I.Info,{className:"w-3.5 h-3.5 mt-0.5 shrink-0 text-muted-foreground"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:'Este evento ocorre em apenas 1 dia — a opção "Participar um dia" não é necessária.'})]}):null,E==="por_dia"&&o.jsxs("div",{className:"pl-2 space-y-2",children:[o.jsx("p",{className:"text-xs font-semibold uppercase tracking-wide text-primary",children:"Selecione o dia:"}),C.length===0?o.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Nenhuma data configurada no evento"}):C.map(V=>o.jsxs("button",{type:"button",onClick:()=>X(V),className:K("w-full text-left flex items-center justify-between px-4 py-3 rounded-lg border transition-all",T===V?"border-primary bg-primary/5":"border-input hover:border-primary/50"),children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:K("w-4 h-4 rounded-full border-2 shrink-0 flex items-center justify-center transition-colors",T===V?"border-primary bg-primary":"border-input"),children:T===V&&o.jsx("span",{className:"w-2 h-2 rounded-full bg-white"})}),o.jsx("span",{className:"text-sm",children:lS(V)})]}),y!=null&&o.jsxs("span",{className:"text-xs text-muted-foreground",children:[y," vagas"]})]},V))]}),l&&o.jsx("p",{className:"text-sm text-destructive",children:l})]})},Zd=.0315,Kd=.124,Yd=7,Jd=12,uS=[{id:"pix",label:"PIX",description:"Transferência instantânea (à vista)",Icon:I.Smartphone,taxa:0},{id:"dinheiro",label:"Dinheiro",description:"Pagamento em espécie",Icon:I.Banknote,taxa:0},{id:"cartao",label:"Cartão de Crédito",description:"Débito ou crédito na maquininha",Icon:I.CreditCard,taxa:Zd,taxaLabel:`Taxa: ${(Zd*100).toFixed(2).replace(".",",")}%`}],mS=[{id:"pix",label:"PIX à Vista",description:"Pagamento instantâneo sem parcelamento",Icon:I.Smartphone,taxa:0},{id:"pix_parcelado",label:"PIX Parcelado",description:`Parcelado em até ${Yd}x sem juros`,Icon:I.Smartphone,taxa:0,parcelas:Yd},{id:"cartao",label:"Cartão de Crédito",description:`Parcelado em até ${Jd}x`,Icon:I.CreditCard,taxa:Kd,parcelas:Jd,taxaLabel:`Taxa: ${(Kd*100).toFixed(2).replace(".",",")}%`},{id:"dinheiro",label:"Dinheiro",description:"Pagamento em espécie",Icon:I.Banknote,taxa:0}],Ra=e=>`R$ ${(e/100).toFixed(2).replace(".",",")}`,Qd=(e,t)=>Math.round(e*(1+t)*100)/100,pS=(e,t)=>Math.round(e/t*100)/100,fS=({name:e,control:t,relatedFieldName:r="tipo_participacao"})=>{var n;const{field:a,fieldState:s}=Be({name:e,control:t}),{externalData:i={},paymentMethodOptions:l}=Ur(),c=a.value??null,d=(n=s.error)==null?void 0:n.message,u=Fn({control:t,name:r}),m=(u==null?void 0:u.tipo)??null,p=j=>i[`evento.${j}`]??i[j],f=Number(p("valor")??0),v=Number(p("valorPorDia")??0),h=m==="por_dia"&&v>0?v:f,x=m==="por_dia"?(l==null?void 0:l.porDia)??uS:(l==null?void 0:l.todosOsDias)??mS,b=m==="por_dia"?(()=>{if(!(u!=null&&u.data))return"Um dia";const j=u.data.split("-");if(j.length===3){const[w,C,S]=j;return`${S}/${C}/${w}`}return u.data})():"Todos os dias",y=j=>{if(j.disabled)return;const w=Qd(h,j.taxa),C={metodo:j.id,valorTotal:w};j.parcelas&&(C.parcelas=j.parcelas),a.onChange(C)};return o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between rounded-xl border border-input px-4 py-3",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"Tipo de participação"}),o.jsx("p",{className:"font-semibold",children:b})]}),o.jsxs("div",{className:"text-right",children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"Valor base"}),o.jsx("p",{className:"text-lg font-bold text-primary",children:Ra(h)})]})]}),o.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-input bg-muted/30 px-3 py-2.5",children:[o.jsx(I.Info,{className:"h-4 w-4 mt-0.5 shrink-0 text-muted-foreground"}),o.jsxs("p",{className:"text-xs",children:[o.jsx("span",{className:"font-bold",children:"Importante:"})," Para validar a inscrição e garantir sua vaga, o pagamento deve ser realizado no ato da inscrição."]})]}),o.jsx("p",{className:"text-sm font-semibold text-primary",children:"Selecione a forma de pagamento:"}),o.jsx("div",{className:"space-y-3",children:x.map(j=>{const{Icon:w}=j,C=(c==null?void 0:c.metodo)===j.id,S=Qd(h,j.taxa),$=!!j.parcelas&&j.parcelas>1,k=$?pS(S,j.parcelas):null;return o.jsxs("button",{type:"button",disabled:j.disabled,onClick:()=>y(j),className:K("w-full text-left flex items-center gap-4 px-4 py-3 rounded-xl border-2 transition-all",C?"border-primary bg-primary/5":"border-input hover:border-primary/50",j.disabled&&"opacity-50 cursor-not-allowed"),children:[o.jsx("div",{className:K("flex items-center justify-center w-10 h-10 rounded-lg shrink-0 transition-colors",C?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"),children:o.jsx(w,{className:"h-5 w-5"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"font-semibold text-sm leading-tight",children:j.label}),o.jsx("p",{className:"text-xs text-muted-foreground",children:j.description}),j.taxaLabel&&o.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:["* ",j.taxaLabel]}),j.taxa>0&&o.jsxs("p",{className:"text-xs text-muted-foreground",children:["Total com taxa: ",Ra(S)]})]}),o.jsx("div",{className:"text-right shrink-0",children:$?o.jsxs(o.Fragment,{children:[o.jsxs("p",{className:"text-xs text-muted-foreground",children:[j.parcelas,"x de"]}),o.jsx("p",{className:"text-base font-bold text-primary",children:Ra(k)})]}):o.jsx("p",{className:"text-base font-bold text-primary",children:Ra(S)})})]},j.id)})}),d&&o.jsx("p",{className:"text-xs text-destructive",children:d})]})},hS=({name:e,control:t,label:r,termoTexto:n,termoPdfUrl:a,termoPdfUploadId:s})=>{var i;const{field:l,fieldState:c}=Be({name:e,control:t}),{resolveTermsUploadUrl:d}=Ur(),u=!!c.error,m=(i=c.error)==null?void 0:i.message,[p,f]=N.useState(null),[v,h]=N.useState(!1),[x,b]=N.useState(!1),y=N.useRef(null);N.useEffect(()=>{var $;x&&(($=y.current)==null||$.focus())},[x]),N.useEffect(()=>{if(!s||!d){f(null);return}let $=!1;return h(!0),d(s).then(k=>{$||f(k)}).catch(()=>{$||f(null)}).finally(()=>{$||h(!1)}),()=>{$=!0}},[s,d]);const j=l.value==="accepted",w=p||a||null,C=!!(n||w||s),S=!!w;return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:K("rounded-lg border p-4 space-y-4 transition-colors",u?"border-destructive bg-destructive/5":j?"border-green-500 bg-green-500/5":"border-input"),children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(I.ScrollText,{className:"h-4 w-4 shrink-0"}),o.jsx("span",{className:"text-sm font-medium",children:r||"Termos e condições"})]}),C?o.jsxs(Ae,{type:"button",variant:"outline",size:"sm",className:"h-7 px-2 text-xs",disabled:v,onClick:()=>b(!0),children:[v?o.jsx(I.Loader2,{className:"h-3 w-3 animate-spin"}):o.jsx(I.ExternalLink,{className:"h-3 w-3"}),"Ler termos"]}):o.jsx("span",{className:"text-xs text-muted-foreground italic",children:s&&v?"Carregando PDF...":"Conteúdo não configurado"})]}),o.jsxs("label",{className:"flex items-start gap-3 cursor-pointer select-none",children:[o.jsx(rt,{className:"mt-0.5",checked:j,onCheckedChange:$=>l.onChange($?"accepted":"")}),o.jsxs("span",{className:"text-sm leading-snug flex-1",children:["Li e aceito ",r?`"${r}"`:"os termos e condições"]}),j&&o.jsx(I.CheckCircle2,{className:"h-4 w-4 text-green-500 shrink-0 mt-0.5"})]})]}),u&&o.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-destructive",children:[o.jsx(I.AlertCircle,{className:"h-3.5 w-3.5 shrink-0"}),m||"Você precisa aceitar os termos para continuar"]}),x&&o.jsx("div",{ref:y,role:"dialog","aria-modal":"true","aria-label":"Termos e condições",tabIndex:-1,className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/60 outline-none",onClick:()=>b(!1),onKeyDown:$=>{$.key==="Escape"&&b(!1)},children:o.jsxs("div",{className:"relative w-full max-w-2xl max-h-[90vh] rounded-xl overflow-hidden flex flex-col bg-background shadow-xl",onClick:$=>$.stopPropagation(),children:[o.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-input",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(I.ScrollText,{className:"h-4 w-4"}),o.jsx("span",{className:"font-semibold",children:"Termos e condições"})]}),o.jsx(Ae,{type:"button",variant:"ghost",size:"icon",onClick:()=>b(!1),children:o.jsx(I.X,{className:"h-4 w-4"})})]}),o.jsx("div",{className:"flex-1 overflow-auto p-4",children:S?o.jsx("iframe",{src:w,className:"w-full rounded border",style:{height:"62vh"},title:"Termos e condições",sandbox:"allow-scripts"}):o.jsx("p",{className:"text-sm whitespace-pre-wrap leading-relaxed",children:n})})]})})]})},xS=({name:e,control:t,placeholder:r,disabled:n,readOnly:a})=>{var s;const{field:i,fieldState:l}=Be({name:e,control:t}),[c,d]=N.useState(!1),u=!!l.error;return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"relative",children:[o.jsx(ue,{...i,value:i.value??"",type:c?"text":"password",placeholder:r,disabled:n,readOnly:a,className:K("pr-10",u&&"border-destructive focus-visible:ring-destructive")}),o.jsx("button",{type:"button",tabIndex:-1,onClick:()=>d(m=>!m),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors","aria-label":c?"Ocultar senha":"Mostrar senha",children:c?o.jsx(I.EyeOff,{size:16}):o.jsx(I.Eye,{size:16})})]}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},$x=({name:e,control:t,label:r,disabled:n,readOnly:a})=>{var s;const{field:i,fieldState:l}=Be({name:e,control:t}),c=!!i.value;return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("label",{className:"flex items-center gap-3 cursor-pointer select-none",children:[o.jsx(_i,{checked:c,onCheckedChange:d=>!a&&i.onChange(d),disabled:n||a,onBlur:i.onBlur}),o.jsx("span",{className:"text-sm leading-none",children:r})]}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},gS=({name:e,control:t,minValue:r=0,maxValue:n=100,step:a=1,disabled:s,readOnly:i})=>{var l;const{field:c,fieldState:d}=Be({name:e,control:t}),u=c.value??r;return N.useEffect(()=>{(c.value===void 0||c.value===null)&&c.onChange(r)},[]),o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(So,{min:r,max:n,step:a,value:[u],onValueChange:m=>!i&&c.onChange(m[0]),disabled:s||i,className:"flex-1"}),o.jsx("span",{className:"text-sm font-medium text-primary min-w-[3rem] text-right tabular-nums",children:u})]}),o.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[o.jsx("span",{children:r}),o.jsx("span",{children:n})]}),((l=d.error)==null?void 0:l.message)&&o.jsx("p",{className:"text-sm text-destructive",children:d.error.message})]})},Os=e=>/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(e),vS=({name:e,control:t,disabled:r,readOnly:n})=>{var a;const{field:s,fieldState:i}=Be({name:e,control:t}),l=s.value||"#000000",[c,d]=N.useState(l);return N.useEffect(()=>{d(l)},[l]),o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("input",{type:"color",value:Os(l)?l:"#000000",disabled:r||n,onChange:u=>s.onChange(u.target.value),className:"h-10 w-14 cursor-pointer rounded-lg border border-input bg-transparent p-1 disabled:cursor-not-allowed disabled:opacity-50"}),o.jsx(ue,{type:"text",value:c,readOnly:n,disabled:r,onChange:u=>{const m=u.target.value;d(m),Os(m)&&s.onChange(m.toUpperCase())},onBlur:()=>{Os(c)||d(l),s.onBlur()},className:K("flex-1 font-mono uppercase",i.error&&"border-destructive focus-visible:ring-destructive"),maxLength:7,placeholder:"#000000"})]}),((a=i.error)==null?void 0:a.message)&&o.jsx("p",{className:"text-sm text-destructive",children:i.error.message})]})},bS=({name:e,control:t,options:r,placeholder:n,disabled:a,readOnly:s})=>{var i,l;const{field:c,fieldState:d}=Be({name:e,control:t}),[u,m]=N.useState(""),[p,f]=N.useState(!1),[v,h]=N.useState(-1),x=N.useRef(null),b=N.useRef(null),y=`autocomplete-${e}-listbox`,j=((i=r.find(T=>T.valor===c.value))==null?void 0:i.label)??"",w=u.length>0?r.filter(T=>T.label.toLowerCase().includes(u.toLowerCase())):r;N.useEffect(()=>{const T=O=>{x.current&&!x.current.contains(O.target)&&(f(!1),m(""),h(-1))};return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[]);const C=()=>{f(!1),m(""),h(-1)};N.useEffect(()=>{if(v<0||!b.current)return;const T=b.current.querySelector(`[id="${y}-option-${v}"]`);T==null||T.scrollIntoView({block:"nearest"})},[v,y]);const S=T=>{T.disabled||(c.onChange(T.valor),C())},$=()=>{c.onChange(""),m(""),h(-1)},k=T=>{if(!p){(T.key==="ArrowDown"||T.key==="ArrowUp")&&(T.preventDefault(),f(!0),h(0));return}switch(T.key){case"ArrowDown":T.preventDefault(),h(O=>O<w.length-1?O+1:O);break;case"ArrowUp":T.preventDefault(),h(O=>O>0?O-1:0);break;case"Enter":T.preventDefault(),v>=0&&w[v]&&!w[v].disabled&&S(w[v]);break;case"Escape":T.preventDefault(),C();break;case"Tab":C();break}},E=p&&v>=0?`${y}-option-${v}`:void 0;return o.jsxs("div",{className:"space-y-1",ref:x,children:[o.jsxs("div",{className:"relative",children:[o.jsx(ue,{type:"text",role:"combobox","aria-expanded":p,"aria-haspopup":"listbox","aria-autocomplete":"list","aria-controls":y,"aria-activedescendant":E,value:p?u:j,placeholder:n??"Buscar...",disabled:a,readOnly:s,onChange:T=>{m(T.target.value),h(-1),f(!0)},onFocus:()=>!s&&f(!0),onKeyDown:k,className:K("pr-8",d.error&&"border-destructive focus-visible:ring-destructive"),autoComplete:"off"}),o.jsx("div",{className:"absolute right-2 top-1/2 -translate-y-1/2 flex items-center gap-1",children:c.value?o.jsx("button",{type:"button",onClick:$,className:"text-[var(--t-text-muted)] hover:text-[var(--t-text)]",tabIndex:-1,"aria-label":"Limpar seleção",children:o.jsx(I.X,{size:14})}):o.jsx(I.ChevronDown,{size:16,className:"text-muted-foreground pointer-events-none","aria-hidden":"true"})}),p&&!a&&!s&&o.jsx("ul",{role:"listbox",id:y,ref:b,"aria-label":"Opções disponíveis",className:"absolute z-50 mt-1 max-h-60 w-full overflow-auto rounded-lg border border-input bg-popover shadow-lg",children:w.length===0?o.jsx("li",{role:"option","aria-selected":!1,className:"px-3 py-2 text-sm text-muted-foreground",children:"Nenhuma opção encontrada"}):w.map((T,O)=>o.jsx("li",{id:`${y}-option-${O}`,role:"option","aria-selected":c.value===T.valor,"aria-disabled":T.disabled,onMouseDown:()=>S(T),className:["flex cursor-pointer items-center px-3 py-2 text-sm",T.disabled?"cursor-not-allowed opacity-40":O===v?"bg-accent":"hover:bg-accent",c.value===T.valor?"font-medium text-primary":"text-foreground"].join(" "),children:T.label},T.valor))})]}),((l=d.error)==null?void 0:l.message)&&o.jsx("p",{className:"text-sm text-destructive",role:"alert",children:d.error.message})]})},Ex=({name:e,control:t,placeholder:r,disabled:n,readOnly:a})=>{var s;const{field:i,fieldState:l}=Be({name:e,control:t}),c=!!l.error;return o.jsxs("div",{className:"space-y-1",children:[o.jsx(ue,{...i,value:i.value??"",type:"time",placeholder:r,disabled:n,readOnly:a,className:K(c&&"border-destructive focus-visible:ring-destructive")}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},yS=({name:e,control:t,startLabel:r="Data inicial",endLabel:n="Data final",disabled:a,readOnly:s})=>{var i;const{field:l,fieldState:c}=Be({name:e,control:t}),d=l.value??{},u=(p,f)=>{l.onChange({...d,[p]:f})},m=!!c.error;return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{children:r}),o.jsx(ue,{type:"date",value:d.start??"",disabled:a,readOnly:s,onChange:p=>u("start",p.target.value),max:d.end??void 0,className:K(m&&"border-destructive focus-visible:ring-destructive")})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{children:n}),o.jsx(ue,{type:"date",value:d.end??"",disabled:a,readOnly:s,onChange:p=>u("end",p.target.value),min:d.start??void 0,className:K(m&&"border-destructive focus-visible:ring-destructive")})]})]}),((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})},wS=({name:e,control:t,maxRating:r=5,disabled:n,readOnly:a})=>{var s;const{field:i,fieldState:l}=Be({name:e,control:t}),c=i.value??0,d=Array.from({length:r},(u,m)=>m+1);return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-1",children:[d.map(u=>o.jsx("button",{type:"button",disabled:n||a,onClick:()=>i.onChange(u===c?0:u),className:"transition-transform hover:scale-110 disabled:cursor-not-allowed disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded","aria-label":`${u} estrela${u>1?"s":""}`,children:o.jsx(I.Star,{size:24,className:"transition-colors",fill:u<=c?"var(--color-primary)":"transparent",stroke:u<=c?"var(--color-primary)":"currentColor"})},u)),c>0&&o.jsxs("span",{className:"ml-2 text-sm text-muted-foreground",children:[c,"/",r]})]}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},jS=({field:e,name:t,control:r,disabled:n,readOnly:a})=>{const s=n||e.isDisabled,i=a||e.isReadOnly;switch(e.tipo){case D.EMAIL:return o.jsx(Lt,{name:t,control:r,type:"email",placeholder:e.placeholder,disabled:s,readOnly:i});case D.NUMBER:return o.jsx(Lt,{name:t,control:r,type:"number",placeholder:e.placeholder,disabled:s,readOnly:i});case D.PASSWORD:return o.jsx(Lt,{name:t,control:r,type:"password",placeholder:e.placeholder,disabled:s,readOnly:i});case D.TELEFONE:return o.jsx(Jr,{name:t,control:r,maskType:"telefone",placeholder:e.placeholder??"(00) 00000-0000",disabled:s,readOnly:i});case D.CPF:return o.jsx(Jr,{name:t,control:r,maskType:"cpf",placeholder:e.placeholder??"000.000.000-00",disabled:s,readOnly:i});case D.CEP:return o.jsx(Jr,{name:t,control:r,maskType:"cep",placeholder:e.placeholder??"00000-000",disabled:s,readOnly:i});case D.TEXTAREA:return o.jsx(Dl,{name:t,control:r,placeholder:e.placeholder,disabled:s,readOnly:i});case D.SELECT:return o.jsx(Rl,{name:t,control:r,options:e.opcoes??[],placeholder:e.placeholder,disabled:s,readOnly:i});case D.CHECKBOX:return o.jsx(Pl,{name:t,control:r,label:e.label??"",disabled:s,readOnly:i});case D.SWITCH:return o.jsx($x,{name:t,control:r,label:e.label??"",disabled:s,readOnly:i});case D.DATE:return o.jsx(ea,{name:t,control:r,disabled:s,readOnly:i});case D.TIME:return o.jsx(Ex,{name:t,control:r,disabled:s,readOnly:i});case D.HIDDEN:return o.jsx(zl,{name:t,control:r});default:return o.jsx(Lt,{name:t,control:r,type:"text",placeholder:e.placeholder,disabled:s,readOnly:i})}},kS=({name:e,control:t,subSchema:r,disabled:n,readOnly:a})=>{if(!r||r.fields.length===0)return null;const s=[...r.fields].sort((i,l)=>i.ordem-l.ordem);return o.jsxs("div",{className:"rounded-xl border border-input bg-muted/30 p-4 space-y-4",children:[r.titulo&&o.jsx("h4",{className:"text-sm font-semibold text-muted-foreground",children:r.titulo}),o.jsx("div",{className:"grid grid-cols-12 gap-4",children:s.map(i=>{const l=`${e}.${i.nome}`,c=i.tipo===D.CHECKBOX||i.tipo===D.SWITCH||i.tipo===D.HIDDEN,d=i.tamanho??6;return o.jsxs("div",{className:`col-span-${d}`,children:[!c&&o.jsxs("label",{className:"mb-1 block text-sm font-medium text-foreground",children:[i.label,i.obrigatorio&&o.jsx("span",{className:"text-destructive",children:" *"})]}),o.jsx(jS,{field:i,name:l,control:t,disabled:n,readOnly:a})]},i.id)})})]})},Tx=({field:e,control:t,nameOverride:r})=>{var n,a;const s=r??e.nome,{componentMapper:i}=Ur(),l=i==null?void 0:i[e.tipo];if(l)return o.jsx(l,{name:s,control:t,field:e});const c={name:s,control:t,placeholder:e.placeholder,disabled:e.isDisabled,readOnly:e.isReadOnly};switch(e.tipo){case D.TEXTO:return o.jsx(Lt,{...c,type:"text"});case D.EMAIL:return o.jsx(Lt,{...c,type:"email"});case D.NUMBER:return o.jsx(Lt,{...c,type:"number"});case D.PASSWORD:return o.jsx(xS,{...c});case D.TEXTAREA:return o.jsx(Dl,{...c});case D.SELECT:return o.jsx(Rl,{...c,options:e.opcoes??[]});case D.AUTOCOMPLETE:return o.jsx(bS,{...c,options:e.opcoes??[]});case D.SWITCH:return o.jsx($x,{name:s,control:t,label:e.label,disabled:e.isDisabled,readOnly:e.isReadOnly});case D.SLIDER:return o.jsx(gS,{name:s,control:t,minValue:e.minValue,maxValue:e.maxValue,step:e.step,disabled:e.isDisabled,readOnly:e.isReadOnly});case D.RATING:return o.jsx(wS,{name:s,control:t,maxRating:e.maxRating,disabled:e.isDisabled,readOnly:e.isReadOnly});case D.COLOR:return o.jsx(vS,{name:s,control:t,disabled:e.isDisabled,readOnly:e.isReadOnly});case D.TIME:return o.jsx(Ex,{...c});case D.DATE_RANGE:return o.jsx(yS,{name:s,control:t,startLabel:e.dateRangeStartLabel,endLabel:e.dateRangeEndLabel,disabled:e.isDisabled,readOnly:e.isReadOnly});case D.RADIO:return o.jsx(vx,{...c,options:e.opcoes??[]});case D.CHECKBOX:return o.jsx(Pl,{name:s,control:t,label:e.label,disabled:e.isDisabled,readOnly:e.isReadOnly});case D.CHECKBOX_GROUP:return o.jsx(gx,{...c,options:e.opcoes??[]});case D.DATE:return o.jsx(ea,{name:s,control:t,disabled:e.isDisabled,readOnly:e.isReadOnly,validacao:e.validacao});case D.DATETIME:return o.jsx(ea,{name:s,control:t,isDatetime:!0,disabled:e.isDisabled,readOnly:e.isReadOnly,validacao:e.validacao});case D.FILE:return o.jsx(Cx,{name:s,control:t,disabled:e.isDisabled,fileTypes:(n=e.validacao)==null?void 0:n.fileTypes,maxFileSize:(a=e.validacao)==null?void 0:a.maxFileSize});case D.TELEFONE:return o.jsx(Jr,{...c,maskType:"telefone"});case D.CPF:return o.jsx(Jr,{...c,maskType:"cpf"});case D.CEP:return o.jsx(Sx,{name:s,control:t,placeholder:e.placeholder,disabled:e.isDisabled,readOnly:e.isReadOnly,cepFillMap:e.cepFillMap});case D.HIDDEN:return o.jsx(zl,{name:s,control:t});case D.PARTICIPATION_TYPE:return o.jsx(dS,{name:s,control:t});case D.PAYMENT_METHOD:return o.jsx(fS,{name:s,control:t,relatedFieldName:e.relatedFieldName});case D.TERMS:return o.jsx(hS,{name:s,control:t,label:e.label,termoTexto:e.termoTexto,termoPdfUrl:e.termoPdfUrl,termoPdfUploadId:e.termoPdfUploadId});case D.FIELD_ARRAY:return o.jsx(oS,{name:s,control:t,subFields:e.subFields,minItems:e.minItems,maxItems:e.maxItems,itemLabel:e.itemLabel,addLabel:e.addLabel});case D.SUB_FORM:return o.jsx(kS,{name:s,control:t,subSchema:e.subSchema,disabled:e.isDisabled,readOnly:e.isReadOnly});default:return o.jsx(Lt,{...c,type:"text"})}},CS=({container:e,control:t})=>{var r;const{externalData:n={},fieldResolvers:a}=Ur(),s=e.icone?Pt[e.icone]:void 0,i=n,l=N.useMemo(()=>Al(e,i),[e,JSON.stringify(i)]),c=N.useMemo(()=>[...l.campos].sort((x,b)=>x.ordem-b.ordem),[l.campos]),d=Fn({control:t}),{wrapperClass:u,wrapperStyle:m,headerClass:p,headerStyle:f,tmpl:v}=xx(),h=x=>{if(!$e(x.condicional,d,n))return null;let b=x;if(x.resolvePropsKey&&a!=null&&a[x.resolvePropsKey]){const S=a[x.resolvePropsKey](x,d,n);b={...x,...S}}if(b.opcoesFromVar){const S=n[b.opcoesFromVar];Array.isArray(S)&&(b={...b,opcoes:S.map($=>typeof $=="string"?{valor:$,label:$}:$&&typeof $=="object"&&"valor"in $&&"label"in $?$:{valor:String($),label:String($)})})}const y=b.tamanho??12,j=b.inicioColuna,w=j?`${j} / span ${y}`:`span ${y}`,C=o.jsx(Tx,{field:b,control:t});return b.tipo===D.CHECKBOX||b.tipo===D.HIDDEN||b.tipo===D.SWITCH?o.jsx("div",{className:"max-sm:!col-span-12",style:{gridColumn:w},children:C},b.id):o.jsxs("div",{className:"max-sm:!col-span-12 space-y-2",style:{gridColumn:w},children:[o.jsxs("label",{className:"font-medium flex items-center gap-1",style:{color:"var(--t-text)"},children:[b.label,b.obrigatorio&&o.jsx("span",{className:"text-destructive",children:"*"})]}),C,b.hint&&o.jsx("p",{className:"text-xs text-muted-foreground",children:b.hint})]},b.id)};return o.jsxs("div",{className:u,style:m,children:[(l.titulo||s)&&o.jsx("div",{className:p,style:f,children:o.jsxs("div",{className:"flex items-center gap-3",children:[s&&o.jsx("div",{className:"p-2 rounded-xl",style:{background:"color-mix(in srgb, var(--t-primary) 12%, transparent)"},children:o.jsx(s,{className:"w-5 h-5",style:{color:"var(--t-primary)"}})}),o.jsxs("div",{children:[o.jsx("h3",{className:((r=v.typography)==null?void 0:r.stepTitleClass)??"text-lg font-semibold",style:{color:"var(--t-text)"},children:l.titulo}),l.descricao&&o.jsx("p",{className:"text-sm",style:{color:"var(--t-text-muted)"},children:l.descricao})]})]})}),o.jsx("div",{className:"p-6 grid grid-cols-12 gap-4",children:c.map(h)})]})},NS=({container:e,control:t})=>{var r;const{externalData:n={}}=Ur(),a=e.nome??"__invalid__",s=e.minItems??1,i=e.maxItems,l=e.itemLabel??"Item",c=e.icone?Pt[e.icone]:void 0,d=n,u=N.useMemo(()=>Al(e,d),[e,JSON.stringify(d)]),m=N.useMemo(()=>[...u.campos].sort((k,E)=>k.ordem-E.ordem),[u.campos]),p=N.useCallback(()=>{const k={};for(const E of m)E.initialValue!==void 0?k[E.nome]=typeof E.initialValue=="string"?wt(E.initialValue,d):E.initialValue:E.defaultValue!==void 0&&(k[E.nome]=E.defaultValue);return k},[m,d]),{fields:f,append:v,remove:h}=hx({control:t,name:a});N.useEffect(()=>{if(e.nome&&f.length<s)for(let k=f.length;k<s;k++)v(p())},[s]);const x=Fn({control:t}),b=N.useMemo(()=>{const k=x[a];return Array.isArray(k)?k:[]},[x,a]),{wrapperClass:y,wrapperStyle:j,headerClass:w,headerStyle:C,tmpl:S}=xx();if(!e.nome)return console.error("[RepeatableContainerRenderer] container.nome é obrigatório para containers repetíveis. Container id:",e.id),null;const $=(k,E)=>{const T=b[E]??{};if(!$e(k.condicional,T,n))return null;const O=`${a}.${E}.${k.nome}`,L=k.tamanho??12,A=k.inicioColuna,z=A?`${A} / span ${L}`:`span ${L}`,X=o.jsx(Tx,{field:k,control:t,nameOverride:O});return k.tipo===D.CHECKBOX||k.tipo===D.HIDDEN?o.jsx("div",{className:"max-sm:!col-span-12",style:{gridColumn:z},children:X},`${k.id}-${E}`):o.jsxs("div",{className:"max-sm:!col-span-12 space-y-2",style:{gridColumn:z},children:[o.jsxs("label",{className:"font-medium flex items-center gap-1",style:{color:"var(--t-text)"},children:[k.label,k.obrigatorio&&o.jsx("span",{className:"text-destructive",children:"*"})]}),X,k.hint&&o.jsx("p",{className:"text-xs text-muted-foreground",children:k.hint})]},`${k.id}-${E}`)};return o.jsxs("div",{className:y,style:j,children:[(u.titulo||c)&&o.jsx("div",{className:w,style:C,children:o.jsxs("div",{className:"flex items-center gap-3",children:[c&&o.jsx("div",{className:"p-2 rounded-xl",style:{background:"color-mix(in srgb, var(--t-primary) 12%, transparent)"},children:o.jsx(c,{className:"w-5 h-5",style:{color:"var(--t-primary)"}})}),o.jsxs("div",{children:[o.jsx("h3",{className:((r=S.typography)==null?void 0:r.stepTitleClass)??"text-lg font-semibold",style:{color:"var(--t-text)"},children:u.titulo}),u.descricao&&o.jsx("p",{className:"text-sm",style:{color:"var(--t-text-muted)"},children:u.descricao})]})]})}),o.jsxs("div",{className:"p-6 space-y-4",children:[f.map((k,E)=>o.jsxs("div",{className:"border border-input rounded-lg p-4 bg-muted/30",children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs font-bold shrink-0 bg-primary text-primary-foreground",children:E+1}),o.jsxs("span",{className:"text-sm font-semibold",children:[l," ",E+1]})]}),f.length>s&&o.jsx("button",{type:"button",onClick:()=>h(E),className:"inline-flex items-center justify-center rounded-md p-1.5 text-destructive hover:bg-destructive/10 transition-colors","aria-label":"Remover item",children:o.jsx(I.Trash2,{className:"w-4 h-4"})})]}),o.jsx("div",{className:"grid grid-cols-12 gap-4",children:m.map(T=>$(T,E))})]},k.id)),(!i||f.length<i)&&o.jsxs("button",{type:"button",className:"w-full flex items-center justify-center gap-2 py-2 px-4 border border-input rounded-lg text-sm hover:bg-accent transition-colors",onClick:()=>v(p()),children:[o.jsx(I.Plus,{className:"w-4 h-4"}),"Adicionar ",l.toLowerCase()]}),i&&o.jsxs("p",{className:"text-xs text-center text-muted-foreground",children:["Máximo de ",i," ",l.toLowerCase(),i>1?"s":""]})]})]})},SS=e=>e.container.repeatable&&e.container.nome?o.jsx(NS,{...e}):o.jsx(CS,{...e}),$S=({step:e,control:t,externalData:r={}})=>{const n=N.useMemo(()=>[...e.containers].sort((s,i)=>s.ordem-i.ordem),[e.containers]),a=Fn({control:t});return o.jsx("div",{className:"grid grid-cols-12 gap-4",children:n.map(s=>{if(s.condicional&&!$e(s.condicional,a,r))return null;const i=s.tamanho??12,l=s.inicioColuna,c=l?`${l} / span ${i}`:`span ${i}`;return o.jsx("div",{className:"max-sm:!col-span-12",style:{gridColumn:c},children:o.jsx(SS,{container:s,control:t})},s.id)})})},ES=N.createContext({submitting:!1,warnings:{},requestSubmit:()=>{}}),TS=ES.Provider,eu=({stepIndex:e,totalSteps:t,step:r,defaultValues:n,externalData:a,fieldErrors:s,isSubmitting:i,submitError:l,validatorMapper:c={},onWarningsChange:d,onValuesChange:u,onSubmit:m,onBack:p})=>{const f=e===t-1,v=N.useMemo(()=>JSON.stringify(a),[a]),h=N.useMemo(()=>$N(r,a,c),[r.id,v]),x=N.useMemo(()=>EN(r,a,c),[r.id,v]),[b,y]=N.useState({}),j=N.useRef(d);j.current=d;const w=a,C=N.useMemo(()=>RN(r,w),[r,v]),S=CN({resolver:h,defaultValues:n,mode:"onTouched"}),{control:$,handleSubmit:k,setError:E,clearErrors:T,setValue:O}=S;N.useEffect(()=>{T();for(const[U,Q]of Object.entries(s))E(U,{type:"server",message:Q})},[s,E,T]);const L=N.useMemo(()=>r.containers.filter(U=>!U.repeatable).flatMap(U=>U.campos).filter(U=>!!U.condicional),[r.containers]),A=N.useMemo(()=>r.containers.filter(U=>!!U.condicional),[r.containers]),z=N.useMemo(()=>r.containers.filter(U=>!U.repeatable).flatMap(U=>U.campos).filter(U=>{var Q;return U.condicional&&((Q=U.setValues)==null?void 0:Q.length)}),[r.containers]),X=N.useMemo(()=>r.containers.filter(U=>U.repeatable&&!!U.nome).map(U=>({container:U,fields:U.campos.filter(Q=>!!Q.condicional)})).filter(U=>U.fields.length>0),[r.containers]),q=N.useRef({}),Z=N.useRef(!0),V=Fn({control:$}),M=N.useRef(u);M.current=u,N.useEffect(()=>{var U;(U=M.current)==null||U.call(M,V)},[V]),N.useEffect(()=>{let U=!1;return x(V).then(Q=>{var Y;U||(y(Q),(Y=j.current)==null||Y.call(j,Q))}).catch(Q=>{U||console.error("[StepForm] warnComputer error:",Q)}),()=>{U=!0}},[V,x]),N.useEffect(()=>{var U;if(!L.length&&!z.length&&!A.length&&!X.length)return;const Q=V;for(const H of L)if(!$e(H.condicional,Q,a)){if(T(H.nome),H.tipo===D.FIELD_ARRAY){const W=Q[H.nome];Array.isArray(W)&&W.forEach((G,ne)=>{(H.subFields??[]).forEach(J=>T(`${H.nome}.${ne}.${J.nome}`))})}if(H.clearedValue!==void 0){const W=H.clearedValue??"";Q[H.nome]!==W&&O(H.nome,W,{shouldValidate:!1})}}for(const H of A)if(!$e(H.condicional,Q,a))if(H.repeatable&&H.nome)(Array.isArray(Q[H.nome])?Q[H.nome]:[]).forEach((W,G)=>{for(const ne of H.campos)T(`${H.nome}.${G}.${ne.nome}`)});else for(const W of H.campos){T(W.nome);const G=W.clearedValue!==void 0?W.clearedValue:void 0;G!==void 0&&Q[W.nome]!==G&&O(W.nome,G,{shouldValidate:!1})}for(const{container:H,fields:W}of X){const G=H.nome,ne=Array.isArray(Q[G])?Q[G]:[];for(let J=0;J<ne.length;J++){const te=ne[J];for(const ce of W)if(!$e(ce.condicional,te,a)&&(T(`${G}.${J}.${ce.nome}`),ce.clearedValue!==void 0)){const be=ce.clearedValue??"";te[ce.nome]!==be&&O(`${G}.${J}.${ce.nome}`,be,{shouldValidate:!1})}}}const Y=Z.current;for(const H of z){const W=$e(H.condicional,Q,a),G=Y?W:q.current[H.nome]??!1;if(W&&!G&&(U=H.setValues)!=null&&U.length)for(const ne of H.setValues){const J=typeof ne.valor=="string"?wt(ne.valor,w):ne.valor;O(ne.campo,J,{shouldValidate:!1})}q.current[H.nome]=W}Z.current=!1},[V,L,z,A,X,a,O,T]);const _=C.icone?Pt[C.icone]:void 0,se=N.useMemo(()=>()=>{S.handleSubmit(m)()},[m]);return o.jsx(lN,{...S,children:o.jsx(TS,{value:{submitting:i,warnings:b,requestSubmit:se},children:o.jsx("form",{onSubmit:k(m),noValidate:!0,onKeyDown:U=>{U.key==="Enter"&&U.target.tagName==="INPUT"&&U.preventDefault()},children:o.jsxs("div",{className:"space-y-6",children:[C.showLabel!==!1&&o.jsxs("div",{className:"text-center space-y-2",children:[_&&o.jsx("div",{className:"w-12 h-12 mx-auto rounded-xl flex items-center justify-center",style:{background:"color-mix(in srgb, var(--t-primary) 12%, transparent)"},children:o.jsx(_,{className:"w-6 h-6",style:{color:"var(--t-primary)"}})}),o.jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--t-text)"},children:C.titulo}),C.descricao&&o.jsx("p",{className:"text-sm text-muted-foreground",children:C.descricao})]}),o.jsx($S,{step:C,control:$,externalData:a}),o.jsxs("div",{className:"flex items-center justify-between gap-4 pt-6 pb-2",children:[o.jsxs(Ae,{type:"button",variant:"outline",onClick:p,disabled:e===0,className:K(e>0&&"border-primary/40 text-primary hover:bg-primary/5"),children:[o.jsx(I.ChevronLeft,{className:"w-4 h-4"}),o.jsx("span",{className:"hidden sm:inline",children:"Anterior"})]}),o.jsxs("span",{className:"text-xs font-semibold tabular-nums sm:hidden text-muted-foreground",children:[e+1,"/",t]}),o.jsxs(Ae,{type:"submit",disabled:i,children:[i?o.jsx(I.Loader2,{className:"w-4 h-4 animate-spin"}):f?o.jsx(I.Check,{className:"w-4 h-4"}):o.jsx(I.ChevronRight,{className:"w-4 h-4"}),o.jsx("span",{className:"hidden sm:inline",children:f?"Finalizar":"Próximo"})]})]}),l&&o.jsx("p",{className:"text-sm text-destructive mt-2 text-center",children:l})]})})})})},no=e=>{if(e)return Pt[e]},AS=({steps:e,currentStep:t,onStepClick:r})=>o.jsx("div",{className:"flex items-center justify-center gap-2 flex-wrap",children:e.map((n,a)=>o.jsx("div",{role:r?"button":void 0,tabIndex:r?0:void 0,onClick:()=>r==null?void 0:r(a),onKeyDown:s=>s.key==="Enter"&&(r==null?void 0:r(a)),className:K("w-8 h-8 rounded-full flex items-center justify-center text-xs font-bold transition-all shrink-0",r&&"cursor-pointer hover:opacity-80"),style:a===t?{background:"var(--t-primary)",color:"#ffffff",boxShadow:"0 0 0 3px color-mix(in srgb, var(--t-primary) 30%, transparent)"}:a<t?{background:"#22c55e",color:"#ffffff"}:{background:"hsl(var(--muted))",color:"hsl(var(--muted-foreground))"},children:a<t?o.jsx(I.Check,{className:"w-4 h-4"}):a+1},n.id))}),DS=({steps:e,currentStep:t,onStepClick:r})=>o.jsx("div",{className:"flex items-center justify-center gap-2 flex-wrap",children:e.map((n,a)=>{const s=no(n.icone)??I.CircleDot;return o.jsx("div",{role:r?"button":void 0,tabIndex:r?0:void 0,onClick:()=>r==null?void 0:r(a),onKeyDown:i=>i.key==="Enter"&&(r==null?void 0:r(a)),className:K("w-9 h-9 rounded-full flex items-center justify-center transition-all shrink-0",r&&"cursor-pointer hover:opacity-80"),style:a===t?{background:"var(--t-primary)",color:"#ffffff",boxShadow:"0 0 0 3px color-mix(in srgb, var(--t-primary) 30%, transparent)"}:a<t?{background:"#22c55e",color:"#ffffff"}:{background:"hsl(var(--muted))",color:"hsl(var(--muted-foreground))"},children:a<t?o.jsx(I.Check,{className:"w-4 h-4"}):o.jsx(s,{className:"w-4 h-4"})},n.id)})}),RS=({steps:e,currentStep:t,position:r,orientation:n="horizontal",onStepClick:a})=>n==="vertical"?o.jsx("div",{className:"flex flex-col gap-0",children:e.map((s,i)=>{const l=no(s.icone)??I.CircleDot,c=i===t,d=i<t,u=i===e.length-1;return o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsxs("div",{className:"flex flex-col items-center",children:[o.jsx("button",{type:"button",onClick:()=>a==null?void 0:a(i),className:K("w-8 h-8 rounded-full flex items-center justify-center transition-all shrink-0",a&&"cursor-pointer hover:opacity-80"),style:c?{background:"var(--t-primary)",color:"#fff",boxShadow:"0 0 10px color-mix(in srgb, var(--t-primary) 50%, transparent)"}:d?{background:"#22c55e",color:"#fff"}:{background:"color-mix(in srgb, var(--t-text) 8%, transparent)",color:"var(--t-text-muted)",border:"1.5px solid color-mix(in srgb, var(--t-border) 60%, transparent)"},children:d?o.jsx(I.Check,{className:"w-3.5 h-3.5"}):o.jsx(l,{className:"w-3.5 h-3.5"})}),!u&&o.jsx("div",{className:"w-[2px] my-1",style:{height:"24px",background:d?"#22c55e":"color-mix(in srgb, var(--t-border) 50%, transparent)"}})]}),o.jsx("span",{className:"text-sm font-medium leading-tight mt-1.5",style:c?{color:"var(--t-primary)"}:d?{color:"#16a34a"}:{color:"var(--t-text-muted)"},children:s.label??s.id})]},s.id)})}):o.jsx("div",{className:"w-full flex items-start",children:e.map((s,i)=>{const l=no(s.icone)??I.CircleDot,c=i===t,d=i<t,u=i===e.length-1;return o.jsxs("div",{className:K("flex items-start",!u&&"flex-1"),children:[o.jsxs("div",{className:"flex flex-col items-center gap-1.5 w-[56px] shrink-0 mx-auto",children:[o.jsx("button",{type:"button",onClick:()=>a==null?void 0:a(i),className:K("w-10 h-10 rounded-full flex items-center justify-center transition-all shrink-0",a&&"cursor-pointer hover:opacity-80"),style:c?{background:"var(--t-primary)",color:"#ffffff",boxShadow:"0 0 12px color-mix(in srgb, var(--t-primary) 50%, transparent)"}:d?{background:"#22c55e",color:"#ffffff"}:{background:"color-mix(in srgb, var(--t-text) 8%, transparent)",color:"var(--t-text-muted)",border:"1.5px solid color-mix(in srgb, var(--t-border) 60%, transparent)"},children:d?o.jsx(I.Check,{className:"w-4 h-4"}):o.jsx(l,{className:"w-4 h-4"})}),o.jsx("span",{className:"text-[10px] font-medium text-center leading-tight line-clamp-2 px-0.5",style:c?{color:"var(--t-primary)"}:d?{color:"#16a34a"}:{color:"var(--t-text-muted)"},children:s.label??s.id})]}),!u&&o.jsx("div",{className:"flex-1 h-[1.5px] mt-5 mx-1",style:{background:d?"linear-gradient(90deg, var(--t-primary), color-mix(in srgb, var(--t-primary) 40%, transparent))":"color-mix(in srgb, var(--t-border) 50%, transparent)"}})]},s.id)})}),Ax=({steps:e,currentStep:t,onStepClick:r,className:n,forceShow:a})=>{const s=ra(),{layout:i}=s;if(!i.showStepIndicators||e.length<=1&&!a)return null;const l=i.stepIndicatorVariant??"numbers",c=i.stepIndicatorPosition??"top-center",d=i.stepIndicatorOrientation??"horizontal",u=(t+1)/e.length*100,m=e[t],p=no(m==null?void 0:m.icone)??I.CircleDot,f=o.jsx("div",{className:"h-1 rounded-full overflow-hidden",style:{background:"color-mix(in srgb, var(--t-primary) 15%, transparent)"},children:o.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${u}%`,background:"linear-gradient(90deg, var(--t-primary), var(--t-accent))"}})}),v=o.jsxs("div",{className:"block sm:hidden space-y-2",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"w-10 h-10 rounded-full flex items-center justify-center shrink-0",style:{background:"var(--t-primary)",color:"#fff"},children:o.jsx(p,{className:"w-5 h-5"})}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("p",{className:"text-sm font-semibold leading-tight truncate",style:{color:"var(--t-text)"},children:(m==null?void 0:m.label)??(m==null?void 0:m.id)}),o.jsxs("p",{className:"text-xs leading-tight",style:{color:"var(--t-text-muted)"},children:["Passo ",t+1," de ",e.length]})]})]}),f]}),h=o.jsxs("div",{className:"hidden sm:block",children:[l==="numbers"&&o.jsx(AS,{steps:e,currentStep:t,onStepClick:r}),l==="icons"&&o.jsx(DS,{steps:e,currentStep:t,onStepClick:r}),l==="icons-labeled"&&o.jsx(RS,{steps:e,currentStep:t,position:c,orientation:d,onStepClick:r})]}),x=i.showProgressBar?o.jsx("div",{className:"hidden sm:block",children:f}):null;return d==="vertical"?o.jsxs("div",{className:K("flex gap-6 items-start",n),children:[v,o.jsxs("div",{className:"hidden sm:flex gap-6 items-start shrink-0",children:[h,x&&o.jsx("div",{className:"flex-1 pt-4",children:x})]})]}):o.jsxs("div",{className:K("space-y-3",n),children:[v,o.jsxs("div",{className:"hidden sm:block space-y-3",children:[h,x]})]})},PS=(e,t,r)=>{var n;const a={...t},s=r;for(const i of e.containers){for(const l of i.campos)if(a[l.nome]===void 0&&(l.initialValue!==void 0?a[l.nome]=typeof l.initialValue=="string"?wt(l.initialValue,s):l.initialValue:l.defaultValue!==void 0&&(a[l.nome]=l.defaultValue)),l.tipo===D.FIELD_ARRAY&&(n=l.subFields)!=null&&n.length){const c=a[l.nome];Array.isArray(c)&&c.length>0&&(a[l.nome]=c.map(d=>{const u={...d};for(const m of l.subFields)u[m.nome]===void 0&&(m.initialValue!==void 0?u[m.nome]=typeof m.initialValue=="string"?wt(m.initialValue,s):m.initialValue:m.defaultValue!==void 0&&(u[m.nome]=m.defaultValue));return u}))}if(i.repeatable&&i.nome){const l=a[i.nome];Array.isArray(l)&&l.length>0&&(a[i.nome]=l.map(c=>{const d={...c};for(const u of i.campos)d[u.nome]===void 0&&(u.initialValue!==void 0?d[u.nome]=typeof u.initialValue=="string"?wt(u.initialValue,s):u.initialValue:u.defaultValue!==void 0&&(d[u.nome]=u.defaultValue));return d}))}}return a},_S=({schema:e,initialValues:t={},initialStep:r=0,onSubmitStep:n,onComplete:a,template:s,formTitle:i,externalData:l={},fieldErrors:c={},uploadFile:d,deleteUploadedFile:u,cepLookup:m,resolveTermsUploadUrl:p,fieldResolvers:f,validatorMapper:v,componentMapper:h,paymentMethodOptions:x,onValuesChange:b,className:y,StepIndicator:j=Ax})=>{const[w,C]=N.useState(()=>r),[S,$]=N.useState({...t}),[k,E]=N.useState(()=>r),[T,O]=N.useState(!1),[L,A]=N.useState(null),[z,X]=N.useState({}),q=N.useRef(p);q.current=p;const Z=N.useCallback(me=>q.current(me),[]),V=!!p,M=N.useRef(u);M.current=u;const _=N.useCallback(me=>M.current(me),[]),se=!!u,U=N.useMemo(()=>JSON.stringify(l),[l]),Q=N.useMemo(()=>JSON.stringify(e.stepConfig),[e.stepConfig]),Y=N.useMemo(()=>{const me=oo(s);return e.stepConfig?{...me,layout:{...me.layout,...e.stepConfig}}:me},[s,Q]),H=N.useMemo(()=>[...e.steps].sort((me,Te)=>me.ordem-Te.ordem),[e.steps]),W=H.length,G=W>0?H[Math.min(w,W-1)]:null,ne=N.useMemo(()=>G?PS(G,S,l):{},[G,S,U]),J=N.useMemo(()=>({uploadFile:d,deleteUploadedFile:se?_:void 0,cepLookup:m,resolveTermsUploadUrl:V?Z:void 0,externalData:l,fieldResolvers:f,validatorMapper:v,fieldWarnings:z,componentMapper:h,paymentMethodOptions:x}),[d,se,_,m,Z,V,f,v,z,h,x,U]),te=N.useCallback(async me=>{if(!T){O(!0),A(null);try{const{cleaned:Te,fileIdsToDelete:ze}=bi(G,me,l);ze.length&&u&&await Promise.allSettled(ze.map(Ve=>u(Ve)));const dt={...S,...Te};if($(dt),n&&await n(w,Te),w===W-1)a&&await a(dt);else{const Ve=w+1;C(Ve),E(P=>Math.max(P,Ve))}}catch(Te){console.error("[FormRenderer] Submit error:",Te);const ze=Te instanceof Error?Te.message:"Ocorreu um erro. Tente novamente.";A(ze)}finally{O(!1)}}},[w,S,T,W,n,a,G,l,u]),ce=N.useCallback(()=>{w>0&&C(me=>me-1)},[w]);if(!G)return o.jsx(fi.Provider,{value:J,children:o.jsx(Kn,{config:Y,className:`min-h-dvh ${Y.wrapperClass??""} ${y??""}`,renderWrapper:!0,children:o.jsx("div",{className:"w-full max-w-4xl mx-auto px-4 py-6 sm:px-6 text-center text-muted-foreground",children:"Nenhum step configurado."})})});const be=Y.layout.eventTitleStyle??"bar",Ce=(Y.layout.stepIndicatorOrientation??"horizontal")==="vertical",ve=W>=1?o.jsx(j,{steps:H.map(me=>({id:me.id,label:me.titulo,icone:me.icone})),currentStep:w,onStepClick:me=>{me!==w&&me<=k&&C(me)}}):null;return o.jsx(fi.Provider,{value:J,children:o.jsx(Kn,{config:Y,className:`min-h-dvh ${Y.wrapperClass??""} ${y??""}`,renderWrapper:!0,children:o.jsxs("div",{className:"w-full max-w-4xl mx-auto px-4 py-6 sm:px-6",children:[i&&be==="bar"&&o.jsx("div",{className:"w-full text-center text-sm font-medium py-2.5 px-4 mb-6 rounded-lg border border-input text-muted-foreground bg-muted/30",children:i}),i&&be==="inline"&&o.jsxs("div",{className:"text-center mb-6",children:[o.jsx("p",{className:"text-xs font-semibold uppercase tracking-widest mb-1",style:{color:"var(--t-text-muted)"},children:"Inscrição"}),o.jsx("h1",{className:"text-2xl font-bold",style:{color:"var(--t-text)"},children:i}),o.jsx("div",{className:"h-0.5 w-12 mx-auto mt-3 rounded-full",style:{background:"var(--t-primary)"}})]}),Ce?o.jsxs("div",{className:"flex gap-6 items-start",children:[o.jsx("div",{className:"hidden sm:block shrink-0 w-44 pt-1",children:ve}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"sm:hidden mb-6",children:ve}),o.jsx(eu,{stepIndex:w,totalSteps:W,step:G,defaultValues:ne,externalData:l,fieldErrors:c,isSubmitting:T,submitError:L,validatorMapper:v,onWarningsChange:X,onValuesChange:b,onSubmit:te,onBack:ce},w)]})]}):o.jsxs(o.Fragment,{children:[ve&&o.jsx("div",{className:"mb-8",children:ve}),o.jsx(eu,{stepIndex:w,totalSteps:W,step:G,defaultValues:ne,externalData:l,fieldErrors:c,isSubmitting:T,submitError:L,validatorMapper:v,onWarningsChange:X,onValuesChange:b,onSubmit:te,onBack:ce},w)]})]})})})},IS=({onFillMock:e,onClear:t})=>o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx(rx,{}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(Ae,{variant:"outline",size:"sm",onClick:e,children:[o.jsx(I.FlaskConical,{className:"w-3.5 h-3.5 mr-1"}),"Preencher mock"]}),o.jsxs(Ae,{variant:"ghost",size:"sm",onClick:t,children:[o.jsx(I.Eraser,{className:"w-3.5 h-3.5 mr-1"}),"Limpar"]})]})]}),OS=({onRestart:e})=>o.jsxs("div",{className:"max-w-4xl mx-auto flex flex-col items-center justify-center py-16 space-y-4",children:[o.jsx("div",{className:"w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center",children:o.jsx(I.PartyPopper,{className:"w-8 h-8 text-primary"})}),o.jsx("h2",{className:"text-xl font-bold text-foreground",children:"Formulário enviado!"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Este é um preview simulado. Nenhum dado foi enviado."}),o.jsxs(Ae,{variant:"outline",onClick:e,children:[o.jsx(I.RotateCcw,{className:"w-4 h-4 mr-1"}),"Recomeçar"]})]}),FS=e=>o.jsx(Ax,{...e,forceShow:!0}),zS=async(e,t,r)=>{for(let n=20;n<=100;n+=20)await new Promise(a=>setTimeout(a,80)),r==null||r(n);return`mock-upload-${Date.now()}`},LS=async e=>({}),tu={texto:"Texto de teste",textarea:"Texto longo de exemplo para preview do formulário.",email:"teste@email.com",number:42,telefone:"(11) 99999-9999",cpf:"123.456.789-00",cep:"01001-000",date:new Date().toISOString().slice(0,10),datetime:new Date().toISOString().slice(0,10),time:"10:30",password:"Senha123!",masked:"123456",checkbox:!0,switch:!0,slider:50,rating:4,color:"#3B82F6",participation_type:{tipo:"todos_os_dias",data:null,genero:null},payment_method:{metodo:"pix",valorTotal:0},date_range:{start:new Date().toISOString().slice(0,10),end:new Date().toISOString().slice(0,10)},file:"mock-upload-preview"};function MS(e){var t,r;const n=e.tipo;if(!(n==="hidden"||n==="terms"||n==="field_array"))return tu[n]!==void 0?tu[n]:(n==="select"||n==="radio"||n==="autocomplete")&&(t=e.opcoes)!=null&&t.length?e.opcoes[0].valor:n==="checkbox_group"&&(r=e.opcoes)!=null&&r.length?[e.opcoes[0].valor]:"Teste"}function VS(e){const t={};for(const r of e.steps)for(const n of r.containers)for(const a of n.campos){const s=MS(a);s!==void 0&&(t[a.nome]=s)}return t}const BS=({eventoData:e})=>{const{containers:t,configs:r,previewTemplateId:n,stepConfig:a}=gt(),s=N.useMemo(()=>yl({containers:t},r,{nome:"Preview",status:vi.RASCUNHO,template:n,stepConfig:a}),[t,r,n,a]),[i,l]=N.useState(0),[c,d]=N.useState({}),[u,m]=N.useState(!1),p=N.useCallback(()=>{d(VS(s)),l(h=>h+1),m(!1)},[s]),f=N.useCallback(()=>{d({}),l(h=>h+1),m(!1)},[]),v=N.useCallback(()=>{d({}),l(h=>h+1),m(!1)},[]);return s.steps.length===0?o.jsx("div",{className:"rounded-lg border border-dashed border-border/40 p-6 text-center text-xs text-muted-foreground/50",children:"Adicione steps, containers e campos para ver o preview ao vivo"}):u?o.jsx(OS,{onRestart:v}):o.jsxs("div",{className:"space-y-3",children:[o.jsx("div",{className:"px-1",children:o.jsx(IS,{onFillMock:p,onClear:f})}),o.jsx(_S,{schema:s,initialValues:c,template:n,externalData:e,uploadFile:zS,cepLookup:LS,onComplete:async()=>m(!0),StepIndicator:FS},i)]})},Dx=({id:e,currentTamanho:t,inicioColuna:r,onResize:n,pushSnapshot:a})=>{const s=N.useRef(null),[i,l]=N.useState(!1),[c,d]=N.useState(null),u=N.useRef(null);N.useEffect(()=>()=>{var p;(p=u.current)==null||p.call(u)},[]);const m=N.useCallback(p=>{p.preventDefault(),p.stopPropagation(),a==null||a();const f=s.current;if(!f)return;const v=f.parentElement;if(!v)return;const h=v.getBoundingClientRect().width,x=f.getBoundingClientRect().width,b=p.clientX,y=r?13-r:12;l(!0);const j=C=>{const S=C.clientX-b,$=(x+S)/h,k=Math.max(1,Math.min(y,Math.round($*12)));d(k),n(k)},w=()=>{l(!1),d(null),u.current=null,window.removeEventListener("mousemove",j),window.removeEventListener("mouseup",w)};u.current=()=>{l(!1),d(null),window.removeEventListener("mousemove",j),window.removeEventListener("mouseup",w)},window.addEventListener("mousemove",j),window.addEventListener("mouseup",w)},[r,n,a]);return{resizeRef:s,resizing:i,resizePreview:c,handleResizeStart:m}},US=({id:e,elementRef:t,onPositionApply:r,setPositionDrag:n,setSelected:a,pushSnapshot:s})=>{const i=N.useRef(null);return N.useEffect(()=>()=>{var l;(l=i.current)==null||l.call(i)},[]),{handlePositionMouseDown:N.useCallback(l=>{l.preventDefault(),l.stopPropagation(),s==null||s(),a(e);const c=t.current;if(!c)return;const d=c.parentElement;if(!d)return;const u=d.getBoundingClientRect(),m=u.width/12,p=c.getBoundingClientRect(),f=Math.max(1,Math.round(p.width/m)),v=p.left-u.left,h=l.clientX-p.left,x=w=>{const C=w-u.left-h,S=Math.round(C/m)+1;return Math.max(1,Math.min(13-f,S))},b=Math.max(1,Math.min(12,Math.round(v/m)+1));n({itemId:e,ghostStart:b,ghostSpan:f,cursorX:l.clientX,cursorY:l.clientY});const y=w=>{n({itemId:e,ghostStart:x(w.clientX),ghostSpan:f,cursorX:w.clientX,cursorY:w.clientY})},j=w=>{r(x(w.clientX)),n(null),i.current=null,window.removeEventListener("mousemove",y),window.removeEventListener("mouseup",j)};i.current=()=>{n(null),window.removeEventListener("mousemove",y),window.removeEventListener("mouseup",j)},window.addEventListener("mousemove",y),window.addEventListener("mouseup",j)},[e,t,r,n,a,s])}},fa=({id:e,container:t})=>{const{attributes:r,listeners:n,setNodeRef:a,transform:s,transition:i,isDragging:l}=Kt.useSortable({id:e,data:{isCanvasItem:!0,type:"field",id:e,fromContainer:t}}),{selectedId:c,setSelected:d,getConfig:u,updateConfig:m,removeItem:p,setPositionDrag:f,positionDrag:v,pushSnapshot:h}=gt(),x=u(e),b=Ah(e),y=(b==null?void 0:b.icon)||I.Type,j=c===e,w=x.tamanho||6,C=(v==null?void 0:v.itemId)===e,[S,$]=N.useState(!1),k="var(--t-primary, hsl(var(--primary)))",E=j?k:S?`color-mix(in srgb, ${k} 60%, transparent)`:`color-mix(in srgb, ${k} 25%, transparent)`,T=j?`0 0 0 2px color-mix(in srgb, ${k} 30%, transparent)`:void 0,{resizeRef:O,resizing:L,resizePreview:A,handleResizeStart:z}=Dx({id:e,currentTamanho:w,inicioColuna:x.inicioColuna,onResize:q=>m(e,{tamanho:q}),pushSnapshot:h}),{handlePositionMouseDown:X}=US({id:e,elementRef:O,onPositionApply:q=>m(e,{inicioColuna:q}),setPositionDrag:f,setSelected:d,pushSnapshot:h});return o.jsxs("div",{ref:q=>{a(q),O.current=q},onClick:q=>{q.stopPropagation(),d(e)},"data-field-id":e,onMouseEnter:()=>$(!0),onMouseLeave:()=>$(!1),className:Ut("relative flex items-center gap-2 rounded border bg-card/80 backdrop-blur-sm px-2.5 pt-1.5 pb-3.5 cursor-pointer transition-all text-xs",L&&"ring-2 ring-blue-400/50",C&&"opacity-0 pointer-events-none"),style:{gridColumn:x.inicioColuna?`${x.inicioColuna} / span ${w}`:`span ${w}`,transform:ta.CSS.Transform.toString(s),transition:i,opacity:l?0:1,borderColor:E,boxShadow:T},children:[o.jsx("div",{onMouseDown:X,onClick:q=>q.stopPropagation(),className:"cursor-ew-resize shrink-0 p-0.5 rounded hover:bg-primary/20 transition-colors",title:"Arrastar para mudar coluna",children:o.jsx(I.ArrowLeftRight,{className:"h-3 w-3 text-primary/60"})}),o.jsx("div",{...n,...r,className:"cursor-grab shrink-0",onClick:q=>q.stopPropagation(),children:o.jsx(I.GripVertical,{className:"h-3 w-3 text-primary"})}),o.jsx(y,{className:"h-3.5 w-3.5 text-primary shrink-0"}),o.jsx("span",{className:"font-medium truncate flex-1",children:x.label}),x.condition&&o.jsx(I.Zap,{className:"h-3 w-3 text-amber-500 shrink-0"}),x.required&&o.jsx("span",{className:"text-destructive font-bold",children:"*"}),o.jsxs("span",{className:"text-[9px] text-muted-foreground shrink-0",children:[A??w,"/12"]}),o.jsx("button",{onClick:q=>{q.stopPropagation(),p(e)},className:"transition-opacity shrink-0 p-0.5 rounded hover:bg-destructive/10",style:{opacity:S?1:0},children:o.jsx(I.Trash2,{className:"h-3 w-3 text-destructive"})}),o.jsx("div",{className:"absolute left-2 -bottom-0.5 font-mono truncate max-w-[90%] pointer-events-none text-[8px] text-muted-foreground/30",children:e}),o.jsx("div",{"data-resize":!0,onMouseDown:z,className:"cursor-col-resize absolute right-0 top-0 bottom-0 w-2 hover:bg-primary/20 transition-colors flex items-center justify-center",children:o.jsx(I.GripHorizontal,{className:"h-3 w-3 text-primary/40 rotate-90"})})]})},HS=({id:e,container:t})=>{var r;const{attributes:n,listeners:a,setNodeRef:s,transform:i,transition:l,isDragging:c}=Kt.useSortable({id:e,data:{isCanvasItem:!0,type:"field",id:e,fromContainer:t}}),{setNodeRef:d,isOver:u}=Xt.useDroppable({id:`zone-${e}`}),{selectedId:m,setSelected:p,getConfig:f,removeItem:v,moveItem:h,containers:x}=gt(),b=f(e),y=(((r=x[e])==null?void 0:r.children)??[]).filter(C=>qe(C)==="field"),j=m===e,w=b.tamanho||12;return o.jsxs("div",{ref:s,onClick:C=>{C.stopPropagation(),p(e)},className:Ut("group/fa relative rounded-lg border overflow-hidden transition-all",c&&"opacity-0 pointer-events-none",j?"border-amber-500 ring-2 ring-amber-500/20 shadow-lg":"border-amber-500/30 hover:border-amber-500/55"),style:{gridColumn:b.inicioColuna?`${b.inicioColuna} / span ${w}`:`span ${w}`,transform:ta.CSS.Transform.toString(i),transition:l},children:[o.jsxs("div",{className:Ut("flex items-center gap-1.5 border-b px-2 py-1.5 transition-colors",j?"bg-amber-500/15 border-amber-500/30":"bg-amber-500/10 border-amber-500/20"),children:[o.jsx("div",{...a,...n,className:"cursor-grab shrink-0 p-1 -ml-1 rounded hover:bg-amber-500/20 transition-colors",onClick:C=>C.stopPropagation(),children:o.jsx(I.GripVertical,{className:"h-3.5 w-3.5 text-amber-500"})}),o.jsxs("div",{className:"flex flex-col -my-1 shrink-0",children:[o.jsx("button",{onClick:C=>{C.stopPropagation(),h(e,"up")},className:"p-0 hover:bg-amber-500/10 rounded transition-colors",title:"Mover para cima",children:o.jsx(I.ChevronUp,{className:"h-3 w-3 text-muted-foreground hover:text-amber-500"})}),o.jsx("button",{onClick:C=>{C.stopPropagation(),h(e,"down")},className:"p-0 hover:bg-amber-500/10 rounded transition-colors",title:"Mover para baixo",children:o.jsx(I.ChevronDown,{className:"h-3 w-3 text-muted-foreground hover:text-amber-500"})})]}),o.jsx(I.List,{className:"h-3.5 w-3.5 text-amber-500 shrink-0"}),o.jsx("span",{className:"text-xs font-semibold truncate flex-1 text-amber-700 dark:text-amber-300",children:b.label}),o.jsxs("span",{className:"text-[10px] text-muted-foreground shrink-0 bg-amber-500/10 px-1.5 rounded",children:[b.itemLabel||"Item"," · ",y.length," campo",y.length!==1?"s":""]}),o.jsx("button",{onClick:C=>{C.stopPropagation(),v(e)},className:"opacity-0 group-hover/fa:opacity-100 transition-opacity shrink-0 p-0.5 rounded hover:bg-destructive/10",children:o.jsx(I.Trash2,{className:"h-3 w-3 text-destructive"})})]}),o.jsx("div",{className:"px-2 -mt-0.5 mb-0.5",children:o.jsx("span",{className:"text-[8px] text-muted-foreground/30 font-mono",children:e})}),o.jsxs("div",{ref:d,className:Ut("relative p-2 min-h-[40px] gap-1.5 transition-all duration-150",u?"bg-amber-500/10 ring-2 ring-inset ring-amber-500/40":""),style:{display:"grid",gridTemplateColumns:"repeat(12, minmax(0, 1fr))",gridAutoRows:"min-content"},children:[y.length===0&&o.jsx("p",{className:"text-[10px] text-muted-foreground/60 text-center py-2 italic",style:{gridColumn:"span 12"},children:"Arraste campos aqui"}),o.jsx(Kt.SortableContext,{items:y,strategy:Kt.rectSortingStrategy,children:y.map(C=>o.jsx(fa,{id:C,container:e},C))})]})]})},ru=5,WS=({id:e,elementRef:t,tamanho:r,inicioColuna:n,onPositionApply:a,setPositionDrag:s,setSelected:i,reorderStrategy:l})=>{const c=N.useRef({inicioColuna:n,tamanho:r});c.current={inicioColuna:n,tamanho:r};const d=N.useRef(null);return N.useEffect(()=>()=>{var u;(u=d.current)==null||u.call(d)},[]),{handleGripMouseDown:N.useCallback(u=>{u.preventDefault(),u.stopPropagation(),i(e);const m=u.clientX,p=u.clientY;let f=!1;const v=()=>{d.current=null,window.removeEventListener("mousemove",h),window.removeEventListener("mouseup",x)},h=j=>{const w=Math.abs(j.clientX-m),C=Math.abs(j.clientY-p);w<ru&&C<ru||(f=!0,v(),w>=C?b(j):y(j))},x=()=>{f||v()};window.addEventListener("mousemove",h),window.addEventListener("mouseup",x),d.current=v;const b=j=>{const w=t.current;if(!w)return;const C=w.parentElement;if(!C)return;const S=C.getBoundingClientRect(),$=S.width/12,{tamanho:k}=c.current,E=w.getBoundingClientRect(),T=E.left-S.left,O=Math.max(1,Math.min(12,Math.round(T/$)+1)),L=E.left;s({itemId:e,ghostStart:O,ghostSpan:k,cursorX:j.clientX,cursorY:j.clientY});const A=q=>{const Z=q-L,V=Math.round(Z/$)+1;return Math.max(1,Math.min(13-k,V))};s({itemId:e,ghostStart:A(j.clientX),ghostSpan:k,cursorX:j.clientX,cursorY:j.clientY});const z=q=>{s({itemId:e,ghostStart:A(q.clientX),ghostSpan:k,cursorX:q.clientX,cursorY:q.clientY})},X=q=>{a(A(q.clientX)),s(null),d.current=null,window.removeEventListener("mousemove",z),window.removeEventListener("mouseup",X)};window.addEventListener("mousemove",z),window.addEventListener("mouseup",X),d.current=()=>{s(null),window.removeEventListener("mousemove",z),window.removeEventListener("mouseup",X)}},y=j=>{const w=l,C=t.current;if(!C)return;const S=C.parentElement;if(!S)return;const $=w.dataAttribute||"data-container-id";w.pushSnapshot(),w.setReorderDrag({draggingId:e});let k=j.clientY;const E=O=>{const L=Array.from(S.children).filter(A=>A!==C&&A.getAttribute($));for(const A of L){const z=A.getBoundingClientRect(),X=z.top+z.height/2;if(O.clientY<X&&O.clientY>z.top&&O.clientY<k){w.moveItemNoSnapshot(e,"up"),k=O.clientY;break}else if(O.clientY>X&&O.clientY<z.bottom&&O.clientY>k){w.moveItemNoSnapshot(e,"down"),k=O.clientY;break}}},T=()=>{w.setReorderDrag(null),d.current=null,window.removeEventListener("mousemove",E),window.removeEventListener("mouseup",T)};window.addEventListener("mousemove",E),window.addEventListener("mouseup",T),d.current=()=>{w.setReorderDrag(null),window.removeEventListener("mousemove",E),window.removeEventListener("mouseup",T)}}},[e,t,a,s,i,l])}},Ll=({showGuides:e,positionDrag:t})=>!e&&!t?null:o.jsxs(o.Fragment,{children:[e&&o.jsx("div",{className:"absolute inset-0 pointer-events-none z-10",style:{display:"grid",gridTemplateColumns:"repeat(12, 1fr)",padding:"inherit",gap:"inherit"},children:Array.from({length:12},(r,n)=>o.jsx("div",{className:"border border-dashed border-muted-foreground/20 rounded-sm flex items-end justify-center pb-1",children:o.jsx("span",{className:"text-[8px] text-muted-foreground/40 font-mono",children:n+1})},n))}),t&&o.jsx("div",{className:"absolute pointer-events-none z-20 rounded-lg border-2 border-dashed border-destructive/60 bg-destructive/10",style:{top:"12px",bottom:"12px",left:`calc(${(t.ghostStart-1)/12*100}% + 12px)`,width:`calc(${t.ghostSpan/12*100}% - 8px)`,transition:"left 0.1s ease-out, width 0.1s ease-out"},children:o.jsxs("div",{className:"absolute -top-5 left-1/2 -translate-x-1/2 bg-destructive text-destructive-foreground text-[10px] font-bold px-2 py-0.5 rounded whitespace-nowrap",children:[t.ghostStart," →"," ",t.ghostStart+t.ghostSpan-1]})})]}),Ml=({id:e,container:t})=>{var r;const{setNodeRef:n,isOver:a}=Xt.useDroppable({id:`zone-${e}`}),{selectedId:s,setSelected:i,getConfig:l,updateConfig:c,removeItem:d,moveItem:u,moveItemNoSnapshot:m,setPositionDrag:p,positionDrag:f,reorderDrag:v,setReorderDrag:h,pushSnapshot:x,containers:b}=gt(),y=l(e),j=((r=b[e])==null?void 0:r.children)??[],w=j.filter(Y=>qe(Y)==="field"),C=s===e,S=y.tamanho||12,$=(f==null?void 0:f.itemId)===e,k=(v==null?void 0:v.draggingId)===e,E=f&&j.includes(f.itemId),T=s&&j.includes(s)&&qe(s)==="field",[O,L]=N.useState(!1),A="var(--t-primary, hsl(var(--primary)))",z=C?A:O?"rgba(59,130,246,0.55)":"rgba(59,130,246,0.3)",X=C?`color-mix(in srgb, ${A} 15%, transparent)`:O?"rgba(59,130,246,0.12)":"rgba(59,130,246,0.07)",q=C?`color-mix(in srgb, ${A} 30%, transparent)`:O?"rgba(59,130,246,0.28)":"rgba(59,130,246,0.18)",Z=C?`0 0 0 3px color-mix(in srgb, ${A} 20%, transparent)`:O?"0 0 0 2px rgba(59,130,246,0.25)":void 0,{resizeRef:V,resizing:M,resizePreview:_,handleResizeStart:se}=Dx({id:e,currentTamanho:S,inicioColuna:y.inicioColuna,onResize:Y=>c(e,{tamanho:Y}),pushSnapshot:x}),U=N.useMemo(()=>({kind:"custom",moveItemNoSnapshot:m,pushSnapshot:x,setReorderDrag:h,dataAttribute:"data-container-id"}),[m,x,h]),{handleGripMouseDown:Q}=WS({id:e,elementRef:V,tamanho:S,inicioColuna:y.inicioColuna||1,onPositionApply:Y=>c(e,{inicioColuna:Y}),setPositionDrag:p,setSelected:i,reorderStrategy:U});return o.jsxs(o.Fragment,{children:[o.jsxs("div",{ref:Y=>{V.current=Y},onClick:Y=>{Y.stopPropagation(),i(e)},onMouseEnter:()=>L(!0),onMouseLeave:()=>L(!1),className:Ut("relative rounded-lg border overflow-hidden transition-all",M&&"ring-2 ring-blue-400/50",$&&"opacity-0 pointer-events-none",k&&"opacity-50"),"data-container-id":e,style:{gridColumn:y.inicioColuna?`${y.inicioColuna} / span ${S}`:`span ${S}`,minWidth:"80px",borderColor:z,boxShadow:Z},children:[o.jsxs("div",{className:"flex items-center gap-1.5 border-b px-2 py-1.5 transition-colors",style:{backgroundColor:X,borderColor:q},children:[o.jsx("div",{"data-grip":!0,onMouseDown:Q,className:"cursor-grab shrink-0 p-1 -ml-1 rounded hover:bg-primary/20 transition-colors",children:o.jsx(I.GripVertical,{className:"h-3.5 w-3.5 text-blue-500"})}),o.jsxs("div",{className:"flex flex-col -my-1 shrink-0",children:[o.jsx("button",{onClick:Y=>{Y.stopPropagation(),u(e,"up")},className:"p-0 hover:bg-primary/10 rounded transition-colors",title:"Mover para cima",children:o.jsx(I.ChevronUp,{className:"h-3 w-3 text-muted-foreground hover:text-primary"})}),o.jsx("button",{onClick:Y=>{Y.stopPropagation(),u(e,"down")},className:"p-0 hover:bg-primary/10 rounded transition-colors",title:"Mover para baixo",children:o.jsx(I.ChevronDown,{className:"h-3 w-3 text-muted-foreground hover:text-primary"})})]}),o.jsx(I.BoxSelect,{className:"h-3.5 w-3.5 text-blue-500 shrink-0"}),o.jsx("span",{className:Ut("text-xs font-semibold truncate flex-1",y.showLabel===!1?"text-blue-500/50 italic":"text-blue-700 dark:text-blue-300"),children:y.label}),y.showAsCard&&o.jsx(I.SquareStack,{className:"h-3 w-3 text-blue-400 shrink-0"}),y.showLabel===!1&&o.jsx(I.EyeOff,{className:"h-3 w-3 text-muted-foreground/50 shrink-0"}),o.jsxs("span",{className:"text-[10px] text-muted-foreground shrink-0 bg-blue-500/10 px-1.5 rounded",children:[_??S,"/12"]}),o.jsx("button",{onClick:Y=>{Y.stopPropagation(),d(e)},className:"transition-opacity shrink-0 p-0.5 rounded hover:bg-destructive/10",style:{opacity:O?1:0},children:o.jsx(I.Trash2,{className:"h-3 w-3 text-destructive"})})]}),o.jsx("div",{className:"px-2 -mt-0.5 mb-0.5",children:o.jsx("span",{className:"text-[8px] text-muted-foreground/30 font-mono",children:e})}),o.jsxs("div",{ref:n,className:Ut("relative p-2 min-h-[40px] gap-1.5 transition-all duration-150",a?"bg-primary/15 ring-2 ring-inset ring-primary/50":(E||T)&&"bg-muted/30"),style:{display:"grid",gridTemplateColumns:"repeat(12, minmax(0, 1fr))",gridAutoRows:"min-content"},children:[o.jsx(Ll,{showGuides:!!E||!!T,positionDrag:E?f:null}),j.length===0&&o.jsx("p",{className:"text-[10px] text-muted-foreground/60 text-center py-2 italic",style:{gridColumn:"span 12"},children:"Arraste campos aqui"}),o.jsx(Kt.SortableContext,{items:w,strategy:Kt.rectSortingStrategy,children:j.filter(Y=>qe(Y)==="field").map(Y=>l(Y).fieldType==="field_array"?o.jsx(HS,{id:Y,container:e},Y):o.jsx(fa,{id:Y,container:e},Y))})]}),o.jsx("div",{onMouseDown:se,className:"cursor-col-resize absolute right-0 top-0 bottom-0 w-2 hover:bg-blue-500/20 transition-colors flex items-center justify-center",children:o.jsx(I.GripHorizontal,{className:"h-3 w-3 text-blue-500/40 rotate-90"})})]}),$&&f&&xi.createPortal(o.jsxs("div",{style:{position:"fixed",left:f.cursorX+14,top:f.cursorY-18,zIndex:9999,pointerEvents:"none"},className:"flex items-center gap-1 bg-foreground text-background text-[10px] font-mono px-2 py-0.5 rounded shadow-xl border border-border/20",children:[o.jsx(I.BoxSelect,{className:"h-2.5 w-2.5"}),"col ",f.ghostStart,"–",f.ghostStart+f.ghostSpan-1]}),document.body)," "]})},Rx=({id:e,container:t,index:r})=>{var n;const{attributes:a,listeners:s,setNodeRef:i,transform:l,transition:c,isDragging:d}=Kt.useSortable({id:e,data:{isCanvasItem:!0,type:"step",id:e}}),{setNodeRef:u,isOver:m}=Xt.useDroppable({id:`zone-${e}`}),{selectedId:p,setSelected:f,getConfig:v,removeItem:h,containers:x,positionDrag:b}=gt(),y=v(e),j=((n=x[e])==null?void 0:n.children)??[],w=p===e,C=b&&j.includes(b.itemId),[S,$]=N.useState(!1),k="var(--t-primary, hsl(var(--primary)))",E=w?k:S?`color-mix(in srgb, ${k} 60%, transparent)`:`color-mix(in srgb, ${k} 25%, transparent)`,T=w?`color-mix(in srgb, ${k} 14%, transparent)`:S?`color-mix(in srgb, ${k} 10%, transparent)`:`color-mix(in srgb, ${k} 6%, transparent)`,O=w?`color-mix(in srgb, ${k} 28%, transparent)`:`color-mix(in srgb, ${k} 15%, transparent)`,L=w?`0 0 0 3px color-mix(in srgb, ${k} 20%, transparent)`:void 0,A={transform:ta.CSS.Transform.toString(l),transition:c,opacity:d?0:1};return o.jsxs("div",{ref:i,style:{...A,borderWidth:"2px",borderStyle:"solid",borderColor:E,boxShadow:L},onMouseEnter:()=>$(!0),onMouseLeave:()=>$(!1),onClick:z=>{z.stopPropagation(),f(e)},className:"group/step rounded-xl overflow-hidden transition-all",children:[o.jsxs("div",{className:"flex items-center gap-2 border-b px-3 py-2",style:{backgroundColor:T,borderColor:O},children:[o.jsx("div",{...s,...a,className:"cursor-grab shrink-0",onClick:z=>z.stopPropagation(),children:o.jsx(I.GripVertical,{className:"h-3.5 w-3.5 text-primary"})}),o.jsx(I.Layers,{className:"h-4 w-4 text-primary shrink-0"}),o.jsxs("span",{className:"text-sm font-bold truncate flex-1 text-primary",children:["Step ",r+1," — ",y.label]}),y.description&&o.jsx("span",{className:"text-[10px] text-muted-foreground truncate hidden md:block",children:y.description}),o.jsx("button",{onClick:z=>{z.stopPropagation(),h(e)},className:"transition-opacity shrink-0 p-1 rounded hover:bg-destructive/10",style:{opacity:S?1:0},children:o.jsx(I.Trash2,{className:"h-3.5 w-3.5 text-destructive"})})]}),o.jsxs("div",{ref:u,className:Ut("relative p-3 min-h-[80px] gap-2 items-start transition-all duration-150",m?"bg-blue-500/20 ring-2 ring-inset ring-blue-400/70 shadow-[inset_0_0_0_2px_theme(colors.blue.400/50%)]":""),style:{display:"grid",gridTemplateColumns:"repeat(12, minmax(0, 1fr))",gridAutoRows:"min-content",backgroundImage:"radial-gradient(circle, hsl(var(--muted-foreground) / 0.15) 1px, transparent 1px)",backgroundSize:"16px 16px"},children:[o.jsx(Ll,{showGuides:!!C,positionDrag:C?b:null}),j.length===0&&o.jsx("p",{className:"text-xs text-muted-foreground/50 text-center py-6 italic w-full",style:{gridColumn:"span 12"},children:"Arraste containers aqui"}),j.map(z=>qe(z)==="container"?o.jsx(Ml,{id:z,container:e},z):o.jsx(fa,{id:z,container:e},z))]})]})},qS=()=>{var e;const{containers:t,setSelected:r}=gt(),n=((e=t.root)==null?void 0:e.children)??[],a=n.filter(l=>qe(l)==="step"),{setNodeRef:s,isOver:i}=Xt.useDroppable({id:"root"});return o.jsxs("div",{ref:s,onClick:()=>r(null),className:`min-h-[500px] rounded-xl border p-4 space-y-4 transition-all duration-150 ${i?"bg-primary/10 border-primary/60 ring-2 ring-primary/30 shadow-[0_0_0_4px_theme(colors.primary/10%)]":"border-border/40"}`,style:{backgroundImage:"radial-gradient(circle, hsl(var(--muted-foreground) / 0.12) 1px, transparent 1px)",backgroundSize:"20px 20px",backgroundColor:i?void 0:"hsl(var(--muted) / 0.3)"},children:[n.length===0&&o.jsx("div",{className:"flex items-center justify-center h-[400px]",children:o.jsxs("div",{className:"text-center space-y-2",children:[o.jsx(I.Layers,{className:"h-10 w-10 text-muted-foreground/30 mx-auto"}),o.jsxs("p",{className:"text-sm text-muted-foreground/50",children:["Arraste ",o.jsx("strong",{children:"Steps"})," da paleta para cá"]})]})}),o.jsx(Kt.SortableContext,{items:a,strategy:Kt.verticalListSortingStrategy,children:n.map((l,c)=>{const d=qe(l);return d==="step"?o.jsx(Rx,{id:l,container:"root",index:c},l):d==="container"?o.jsx(Ml,{id:l,container:"root"},l):o.jsx(fa,{id:l,container:"root"},l)})})]})},GS={personal:"Pessoal",address:"Endereço",health:"Saúde",event:"Evento",payment:"Pagamento",emergency:"Emergência"},XS={texto:"Texto",selecao:"Seleção",range:"Numérico / Visual",data:"Data e Hora",contato:"Contato / Endereço",outros:"Arquivo / Outros"},ZS=()=>{const e=Ir.reduce((t,r)=>{const n=r.group??"outros";return t[n]||(t[n]=[]),t[n].push(r),t},{});return o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("h2",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Estrutura"}),vl.map(t=>o.jsx(nu,{component:t.component,label:t.label,icon:t.icon,color:t.color},t.component))]}),Object.entries(e).map(([t,r])=>o.jsx(Fs,{label:XS[t]??t,children:r.map(n=>o.jsx(nu,{component:n.component,label:n.label,icon:n.icon,color:"border-border"},n.component))},t)),o.jsx(Fs,{label:"Blocos pré-configurados",defaultOpen:!1,children:so.map(t=>o.jsx(KS,{block:t},t.id))}),o.jsx(Fs,{label:"Blocos de steps",defaultOpen:!1,children:ji.map(t=>o.jsx(YS,{block:t},t.id))})]})},Fs=({label:e,children:t,defaultOpen:r=!0})=>{const[n,a]=N.useState(r);return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("button",{type:"button",onClick:()=>a(s=>!s),className:"flex w-full items-center justify-between text-xs font-semibold text-muted-foreground uppercase tracking-wide hover:text-foreground transition-colors",children:[e,o.jsx(I.ChevronDown,{className:`h-3.5 w-3.5 transition-transform ${n?"":"-rotate-90"}`})]}),n&&o.jsx("div",{className:"space-y-1.5",children:t})]})},nu=({component:e,label:t,icon:r,color:n})=>{const{attributes:a,listeners:s,setNodeRef:i,transform:l,isDragging:c}=Xt.useDraggable({id:`palette-${e}`,data:{isPaletteItem:!0,componentType:e}});return o.jsxs("div",{ref:i,...s,...a,className:`cursor-grab flex items-center gap-2 rounded-lg border px-3 py-2 select-none hover:bg-accent transition-colors ${n} ${c?"opacity-50":""}`,style:{transform:c?void 0:ta.CSS.Translate.toString(l)},children:[o.jsx(I.GripVertical,{className:"h-4 w-4 text-muted-foreground"}),o.jsx(r,{className:"h-4 w-4"}),o.jsx("span",{className:"text-sm font-medium",children:t})]})},KS=({block:e})=>{const{attributes:t,listeners:r,setNodeRef:n,transform:a,isDragging:s}=Xt.useDraggable({id:`preset-${e.id}`,data:{isPalettePreset:!0,presetId:e.id}}),i=e.icon?Pt[e.icon]:void 0,l=GS[e.category]??e.category;return o.jsxs("div",{ref:n,...r,...t,className:`cursor-grab flex items-center gap-2 rounded-lg border border-primary/30 bg-primary/5 px-3 py-2 select-none hover:bg-primary/10 transition-colors ${s?"opacity-50":""}`,style:{transform:s?void 0:ta.CSS.Translate.toString(a)},title:e.description,children:[o.jsx(I.GripVertical,{className:"h-4 w-4 text-muted-foreground shrink-0"}),i?o.jsx(i,{className:"h-4 w-4 text-primary shrink-0"}):o.jsx(Pt.Blocks,{className:"h-4 w-4 text-primary shrink-0"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("span",{className:"text-sm font-medium block truncate",children:e.name}),o.jsx("span",{className:"text-[10px] text-muted-foreground",children:l})]})]})},YS=({block:e})=>{const{addPresetStepBlock:t}=gt(),r=e.icon?Pt[e.icon]:void 0;return o.jsxs("button",{type:"button",onClick:()=>t(e),className:"w-full flex items-center gap-2 rounded-lg border border-amber-500/30 bg-amber-500/5 px-3 py-2 cursor-pointer select-none hover:bg-amber-500/15 transition-colors text-left",title:e.description,children:[r?o.jsx(r,{className:"h-4 w-4 text-amber-400 shrink-0"}):o.jsx(Pt.Layers,{className:"h-4 w-4 text-amber-400 shrink-0"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("span",{className:"text-sm font-medium block truncate",children:e.name}),o.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[e.steps.length," steps"]})]}),o.jsxs("span",{className:"text-[10px] text-amber-400 border border-amber-500/30 rounded px-1.5 py-0.5 shrink-0",children:["+",e.steps.length," steps"]})]})},JS=[...vl,...Ir],Px=({data:e})=>{const{getConfig:t}=gt();if(!e)return null;const r=e;if(r.isPalettePreset){const n=wi(r.presetId);return o.jsxs("div",{className:"flex items-center gap-2 rounded-full bg-primary text-primary-foreground px-3 py-1.5 shadow-2xl text-xs font-semibold cursor-grabbing pointer-events-none",children:[o.jsx(Pt.Blocks,{className:"h-3.5 w-3.5 shrink-0"}),(n==null?void 0:n.name)??"Bloco"]})}if(r.isPaletteItem){const n=JS.find(s=>s.component===r.componentType),a=n==null?void 0:n.icon;return o.jsxs("div",{className:"flex items-center gap-2 rounded-full bg-primary text-primary-foreground px-3 py-1.5 shadow-2xl text-xs font-semibold cursor-grabbing pointer-events-none",children:[a&&o.jsx(a,{className:"h-3.5 w-3.5 shrink-0"}),(n==null?void 0:n.label)??r.componentType]})}if(r.isCanvasItem){const{type:n,id:a}=r,s=t(a),i={step:"border-primary/80 bg-primary text-primary-foreground",container:"border-blue-600 bg-blue-600 text-white",field:"border-primary/80 bg-primary text-primary-foreground"},l={step:"Step",container:"Container",field:"Campo"};return o.jsxs("div",{className:Ut("flex items-center gap-2 rounded-full px-3 py-1.5 shadow-2xl text-xs font-semibold cursor-grabbing pointer-events-none min-w-[100px] max-w-[200px]",i[n]??"border-border bg-card"),children:[o.jsx(I.GripVertical,{className:"h-3 w-3 opacity-60 shrink-0"}),o.jsxs("span",{className:"opacity-70 shrink-0",children:[l[n]??n,":"]}),o.jsx("span",{className:"truncate",children:s.label||a})]})}return null},_x=({schema:e,children:t,uploadTermsPdf:r,deleteTermsPdf:n})=>{var a;const s=N.useMemo(()=>{var i;return(i=e==null?void 0:e.steps)!=null&&i.length?Ph(e):null},[e]);return o.jsx(A1,{children:o.jsx(Fh,{initialConfigs:s==null?void 0:s.configs,initialContainers:(a=s==null?void 0:s.dndState)==null?void 0:a.containers,initialTemplateId:(s==null?void 0:s.templateId)??void 0,initialStepConfig:s==null?void 0:s.stepConfig,schemaId:(e==null?void 0:e.id)??void 0,uploadTermsPdf:r,deleteTermsPdf:n,children:t})})},Ix=({children:e,onError:t})=>{const{containers:r,addItem:n,addPresetBlock:a,moveCanvasItem:s,reorderInContainer:i}=gt(),l=Xt.useSensors(Xt.useSensor(Xt.PointerSensor,{activationConstraint:{distance:5}})),[c,d]=N.useState(null);return o.jsxs(Xt.DndContext,{sensors:l,onDragStart:u=>{d({data:u.active.data.current})},onDragEnd:u=>{var m,p,f,v,h;d(null);const{active:x,over:b}=u;if(!b)return;const y=x.data.current,j=String(b.id);if(y!=null&&y.isPalettePreset){const{presetId:w}=y,C=wi(w);if(!C)return;if(j.startsWith("zone-")){const S=j.slice(5);a(C,S)}else j==="root"&&(t==null||t("Arraste o bloco sobre um step existente."));return}if(y!=null&&y.isPaletteItem){const{componentType:w}=y;j==="root"?n(w,"root"):j.startsWith("zone-")&&n(w,j.slice(5));return}if(y!=null&&y.isCanvasItem){const{type:w,id:C}=y;if(w==="step"){const S=((m=r.root)==null?void 0:m.children)??[],$=S.indexOf(C),k=S.indexOf(j);$!==-1&&k!==-1&&$!==k&&i("root",Kt.arrayMove(S,$,k));return}if(w==="field"){const S=y.fromContainer;let $=S,k=null;if(j.startsWith("zone-"))$=j.slice(5);else{const E=wl(j,r);E&&($=E,k=j)}if($===S&&k){const E=((p=r[S])==null?void 0:p.children)??[],T=E.indexOf(C),O=E.indexOf(k);T!==-1&&O!==-1&&T!==O&&i(S,Kt.arrayMove(E,T,O))}else if($!==S){const E=k?(((f=r[$])==null?void 0:f.children)??[]).indexOf(k):-1;s(C,S,$,E>=0?E:((h=(v=r[$])==null?void 0:v.children)==null?void 0:h.length)??0)}}}},children:[e,o.jsx(Xt.DragOverlay,{dropAnimation:null,children:c?o.jsx(Px,{data:c.data}):null})]})},QS=({schema:e,children:t,onError:r,uploadTermsPdf:n,deleteTermsPdf:a})=>o.jsx(_x,{schema:e,uploadTermsPdf:n,deleteTermsPdf:a,children:o.jsx(Ix,{onError:r,children:t})});exports.BuilderDndContext=Ix;exports.BuilderProvider=Fh;exports.BuilderShell=QS;exports.BuilderWrapper=_x;exports.CEP_REGEX=lu;exports.CPF_REGEX=su;exports.Canvas=qS;exports.ConfigPanel=aN;exports.ContainerRenderer=Nh;exports.DFCepField=gl;exports.DFCheckbox=Mo;exports.DFCheckboxGroup=cl;exports.DFDateField=Tn;exports.DFFieldArray=xh;exports.DFFileUpload=xl;exports.DFHidden=Bo;exports.DFMaskedInput=_r;exports.DFParticipationType=gh;exports.DFPaymentMethod=yh;exports.DFRadioGroup=dl;exports.DFSelect=Lo;exports.DFTerms=wh;exports.DFTextField=Tt;exports.DFTextarea=zo;exports.DefaultStepIndicator=Th;exports.DragGhost=Px;exports.DroppedContainer=Ml;exports.DroppedField=fa;exports.DroppedStep=Rx;exports.EMAIL_REGEX=cu;exports.EVENT_VARIABLES=bl;exports.FIELD_TYPES=Ir;exports.FIELD_TYPE_ICONS=Gx;exports.FIELD_TYPE_LABELS=qx;exports.FieldType=D;exports.FormRenderer=Uk;exports.FormSchemaStatus=vi;exports.FormSpy=Hk;exports.GridOverlay=Ll;exports.LivePreview=BS;exports.MaskType=au;exports.OPCOES_POR_DIA=vh;exports.OPCOES_TODOS_OS_DIAS=bh;exports.PRESET_BLOCKS=so;exports.PRESET_STEP_BLOCKS=ji;exports.Palette=ZS;exports.RendererContext=Ga;exports.STRUCTURE_TYPES=vl;exports.StepRenderer=Sh;exports.TELEFONE_REGEX=iu;exports.TEMPLATE_REGISTRY=Zr;exports.TemplateProvider=Kn;exports.builderToFormSchema=yl;exports.evaluateFieldCondition=$e;exports.findParentContainer=wl;exports.formSchemaToBuilder=Ph;exports.generateId=ou;exports.getAllTemplates=dg;exports.getFieldMeta=Wk;exports.getFieldMetaById=Ah;exports.getItemType=qe;exports.getPresetById=wi;exports.getPresetStepBlockById=hg;exports.getPresetsByCategory=fg;exports.getTemplateConfig=oo;exports.interpolate=xt;exports.interpolateContainer=Fo;exports.interpolateField=sh;exports.interpolateStep=ih;exports.isDarkTemplate=uu;exports.isGlassmorphism=ug;exports.isValidCpfDigits=du;exports.makeStepResolver=ah;exports.makeStepWarnComputer=oh;exports.stripHiddenFields=bi;exports.useBuilder=gt;exports.useBuilderExport=Gk;exports.useField=Fk;exports.useFieldApi=zk;exports.useFormApi=Ok;exports.useFormState=$h;exports.useRendererContext=Cr;exports.useTemplate=ra;exports.v4Fallback=Nt;exports.validateBuilderIntegrity=_h;exports.validateStepData=yi;
|