1import{T as G,d as p,A as c,l as h,o as d,c as P,w,a as s,i as S,b as r,t as i,u as t,e as u,f as n,g as j}from"./app-BXvjiwzs.js";import{_ as I}from"./AppLayout-BBE6ZWWx.js";import{_}from"./InputLabel-EdE1ED1G.js";import{_ as f}from"./TextInput-T7CbsF8T.js";import{_ as V,M as X,a as $,b as k,s as D}from"./slugify-Bo8bErfw.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";import"./createLucideIcon-C95wdH9q.js";const H=s("h2",{class:"font-semibold text-xl text-gray-800 leading-tight"}," Crear nuevo Post ",-1),O={class:"py-12"},R={class:"max-w-7xl mx-auto px-4 lg:px-8"},z={class:"mb-8"},F={class:"flex justify-between"},Y={class:"flex gap-4 text-xs"},q={key:0,class:"text-red-500"},J={class:"mb-8"},K={class:"flex justify-between"},Q=s("p",{class:"text-xs"},"Generado automáticamente",-1),W={key:0,class:"text-red-500"},Z={class:"mb-8"},ee={class:"flex justify-between"},te={class:"flex gap-4 text-xs"},se={key:0,class:"text-red-500"},le={class:"mb-8"},oe={class:"flex justify-between"},ae={class:"flex gap-4 text-xs"},re={key:0,class:"text-red-500"},ie={class:"mb-8"},de={key:0,class:"text-red-500"},ue={class:"flex gap-3 flex-wrap mb-8"},ne={class:"mb-4 grow"},_e={key:0,class:"text-red-500"},me={class:"mb-4 grow"},ce={key:0,class:"text-red-500"},pe={class:"mb-8"},ge={class:"flex justify-between"},fe={class:"flex gap-4 text-xs"},he={key:0,class:"text-red-500"},xe={class:"mb-8"},ye={key:0,class:"text-red-500"},ve={class:"flex gap-3 flex-wrap mb-8"},be={class:"mb-4 grow"},we={key:0,class:"text-red-500"},Ve={class:"mb-4 grow"},ke={key:0,class:"text-red-500"},Me={class:"mb-4 grow"},Te={key:0,class:"text-red-500"},Ae={class:"mt-4"},Ce=["disabled"],Ne={key:0,class:"animate-spin h-5 w-5 mr-2 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},Ue=s("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"},null,-1),Ee=s("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"},null,-1),Le=[Ue,Ee],M=255,T=100,A=200,C=700,$e={__name:"Create",props:{authors:Array,categories:Array,tags:Array},setup(N){const g=N,e=G({title:"",slug:"",meta_title:"",meta_description:"",image_post_url:null,image_card_url:null,post_html:"",summary:"",publish_date:"",author_id:"",category_id:"",tags:[]}),m=p(!1),x=p(0),y=p(0),v=p(0),b=p(0);c(()=>e.title,o=>{x.value=o.length,e.slug=D(o,{lower:!0,strict:!0})}),c(()=>e.meta_title,o=>{y.value=o.length}),c(()=>e.meta_description,o=>{v.value=o.length}),c(()=>e.summary,o=>{b.value=o.length}),c(()=>e.post_html,o=>{}),c(()=>g.tags,o=>{console.log("Tags actualizados:",o)});async function U(){if(!m.value){m.value=!0;try{await e.post(route("posts.store"))}catch(o){console.error(o)}finally{m.value=!1}}}const E=h(()=>g.authors.map(o=>({id:o.id,name:o.name}))),L=h(()=>g.categories.map(o=>({id:o.id,name:o.name}))),B=h(()=>g.tags.map(o=>({value:o.id,label:o.name})));return(o,l)=>(d(),P(I,{title:"Nuevo Post"},{header:w(()=>[H]),default:w(()=>[s("div",O,[s("div",R,[s("form",{onSubmit:S(U,["prevent"]),enctype:"multipart/form-data"},[s("div",z,[s("div",F,[r(_,{for:"title",value:"TÃtulo"}),s("div",Y,[s("p",null,"Nº caracteres: "+i(x.value),1),s("p",null,"Max. caracteres: "+i(M))])]),r(f,{id:"title",modelValue:t(e).title,"onUpdate:modelValue":l[0]||(l[0]=a=>t(e).title=a),class:"block w-full mt-1",type:"text",maxlength:M},null,8,["modelValue"]),t(e).errors.title?(d(),u("p",q,i(t(e).errors.title),1)):n("",!0)]),s("div",J,[s("div",K,[r(_,{for:"slug",value:"Slug"}),Q]),r(f,{id:"slug",modelValue:t(e).slug,"onUpdate:modelValue":l[1]||(l[1]=a=>t(e).slug=a),class:"block w-full mt-1",type:"text",disabled:""},null,8,["modelValue"]),t(e).errors.slug?(d(),u("p",W,i(t(e).errors.slug),1)):n("",!0)]),s("div",Z,[s("div",ee,[r(_,{for:"meta_title",value:"Meta TÃtulo"}),s("div",te,[s("p",null,"Nº caracteres: "+i(y.value),1),s("p",null,"Max. caracteres: "+i(T))])]),r(f,{id:"meta_title",modelValue:t(e).meta_title,"onUpdate:modelValue":l[2]||(l[2]=a=>t(e).meta_title=a),class:"block w-full mt-1",type:"text",maxlength:T},null,8,["modelValue"]),t(e).errors.meta_title?(d(),u("p",se,i(t(e).errors.meta_title),
11)):n("",!0)]),s("div",le,[s("div",oe,[r(_,{for:"meta_description",value:"Meta Descripción"}),s("div",ae,[s("p",null,"Nº caracteres: "+i(v.value),1),s("p",null,"Max. caracteres: "+i(A))])]),r(V,{id:"meta_description",modelValue:t(e).meta_description,"onUpdate:modelValue":l[3]||(l[3]=a=>t(e).meta_description=a),rows:2,class:"block w-full mt-1",type:"text",maxlength:A},null,8,["modelValue"]),t(e).errors.meta_description?(d(),u("p",re,i(t(e).errors.meta_description),1)):n("",!0)]),s("div",ie,[r(_,{for:"tags",value:"Tags"}),r(X,{"initial-tags":B.value,modelValue:t(e).tags,"onUpdate:modelValue":l[4]||(l[4]=a=>t(e).tags=a)},null,8,["initial-tags","modelValue"]),t(e).errors.tags?(d(),u("p",de,i(t(e).errors.tags),1)):n("",!0)]),s("div",ue,[s("div",ne,[r(_,{for:"image_post_url",value:"Imagen del Post (MAX. 5MB)"}),s("input",{id:"image_post_url",name:"image_post_url",type:"file",onChange:l[5]||(l[5]=a=>t(e).image_post_url=a.target.files[0]),class:"block w-full mt-1 border border-gray-300 rounded-lg cursor-pointer bg-gray-50 focus:outline-none file:bg-gray-300 file:border-0 file:me-4 file:py-2 file:px-4"},null,32),t(e).errors.image_post_url?(d(),u("p",_e,i(t(e).errors.image_post_url),1)):n("",!0)]),s("div",me,[r(_,{for:"image_card_url",value:"Imagen de la Tarjeta (MAX. 5MB)"}),s("input",{id:"image_card_url",name:"image_card_url",type:"file",onChange:l[6]||(l[6]=a=>t(e).image_card_url=a.target.files[0]),class:"block w-full mt-1 border border-gray-300 rounded-lg cursor-pointer bg-gray-50 focus:outline-none file:bg-gray-300 file:border-0 file:me-4 file:py-2 file:px-4"},null,32),t(e).errors.image_card_url?(d(),u("p",ce,i(t(e).errors.image_card_url),1)):n("",!0)])]),s("div",pe,[s("div",ge,[r(_,{for:"summary",value:"Resumen"}),s("div",fe,[s("p",null,"Nº caracteres: "+i(b.value),1),s("p",null,"Max. caracteres: "+i(C))])]),r(V,{id:"summary",modelValue:t(e).summary,"onUpdate:modelValue":l[7]||(l[7]=a=>t(e).summary=a),class:"block w-full mt-1",maxlength:C},null,8,["modelValue"]),t(e).errors.summary?(d(),u("p",he,i(t(e).errors.summary),1)):n("",!0)]),s("div",xe,[r(_,{for:"post_html",value:"Contenido del Post"}),r($,{modelValue:t(e).post_html,"onUpdate:modelValue":l[8]||(l[8]=a=>t(e).post_html=a)},null,8,["modelValue"]),t(e).errors.post_html?(d(),u("p",ye,i(t(e).errors.post_html),1)):n("",!0)]),s("div",ve,[s("div",be,[r(_,{for:"publish_date",value:"Fecha de Publicación"}),r(f,{id:"publish_date",modelValue:t(e).publish_date,"onUpdate:modelValue":l[9]||(l[9]=a=>t(e).publish_date=a),class:"block w-full mt-1",type:"date"},null,8,["modelValue"]),t(e).errors.publish_date?(d(),u("p",we,i(t(e).errors.publish_date),1)):n("",!0)]),s("div",Ve,[r(_,{for:"author_id",value:"Autor"}),r(k,{id:"author_id",modelValue:t(e).author_id,"onUpdate:modelValue":l[10]||(l[10]=a=>t(e).author_id=a),options:E.value,autofocus:!0},null,8,["modelValue","options"]),t(e).errors.author_id?(d(),u("p",ke,i(t(e).errors.author_id),1)):n("",!0)]),s("div",Me,[r(_,{for:"category_id",value:"CategorÃa"}),r(k,{id:"category_id",modelValue:t(e).category_id,"onUpdate:modelValue":l[11]||(l[11]=a=>t(e).category_id=a),options:L.value,autofocus:!0},null,8,["modelValue","options"]),t(e).errors.category_id?(d(),u("p",Te,i(t(e).errors.category_id),1)):n("",!0)])]),s("div",Ae,[s("button",{type:"submit",disabled:m.value,class:"flex items-center px-4 py-2 bg-indigo-500 text-white rounded-lg"},[m.value?(d(),u("svg",Ne,Le)):n("",!0),j(" "+i(m.value?"Guardando...":"Guardar Post"),1)],8,Ce)])],32)])])]),_:1}))}};export{$e as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.