import{a1 as P,ag as I,z as O,I as y,M as v,j as a,E as m,D as l,J as S,r as $,H as V,K as _,B as r,S as w,F as M,dJ as G,T as d,aw as H}from"./main-crazy-owls-work.js";import{R as J,C as x}from"./row-DAt4Bs0l.js";import{F as K}from"./index-DLeF0Q26.js";import{P as N}from"./index-DbMzUBXN.js";import{I as D}from"./index-D66C40IV.js";globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(t,e){return this.cache.has(t)?this.cache.get(t):(this.cache.set(t,e),e)}};const Q=()=>({config:{temperature:"0.8"},fallbackContent:"",model:"gpt-4",platform:"openai",prompt:"",title:"",type:"text"}),U=globalThis.jotaiAtomCache.get("/home/runner/work/bit-social/bit-social/frontend/src/common/globalStates/aiPromptConfig.ts/$aiPromptConfig",P(Q()));U.debugLabel="$aiPromptConfig";const W=globalThis.jotaiAtomCache.get("/home/runner/work/bit-social/bit-social/frontend/src/common/globalStates/aiPromptConfig.ts/$aiPromptConfigModal",P({open:!1,type:"create"}));W.debugLabel="$aiPromptConfigModal";globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(t,e){return this.cache.has(t)?this.cache.get(t):(this.cache.set(t,e),e)}};function X(){const{data:t,isLoading:e}=I({queryFn:async()=>O("smart-tags",void 0,void 0,"GET"),queryKey:["smart-tags"]});return{isSmartTagsLoading:e,smartTags:(t==null?void 0:t.data)||{}}}globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(t,e){return this.cache.has(t)?this.cache.get(t):(this.cache.set(t,e),e)}};globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(t,e){return this.cache.has(t)?this.cache.get(t):(this.cache.set(t,e),e)}};globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(t,e){return this.cache.has(t)?this.cache.get(t):(this.cache.set(t,e),e)}};function Y({handleSmartTag:t}){const e=y(v);return a(m,{icon:a(S,{color:"#ff8609",size:18}),onClick:()=>e(!0),size:"small",type:"text",children:l("Prompt Tags")})}globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(t,e){return this.cache.has(t)?this.cache.get(t):(this.cache.set(t,e),e)}};const{Title:Z}=d;var tt={name:"5bhc30",styles:"margin-bottom:8px"};function et({label:t,onChange:e,promptBox:z=!0,value:f,wordCount:L,wrapperClassName:F,...k}){const{smartTags:o}=X(),b=$.useRef(null),{isProClient:T}=V(_),B=y(v),A=(h,n)=>{var C,j;if(n==="pro"&&!T){B(!0);return}const c=(j=(C=b.current)==null?void 0:C.resizableTextArea)==null?void 0:j.textArea,s=String(f??""),i=`{${h}}`;if(!c){e==null||e(`${s} ${i}`);return}const{selectionEnd:g,selectionStart:p}=c,E=s.slice(0,p)+i+s.slice(g);e==null||e(E),requestAnimationFrame(()=>{c.focus(),c.setSelectionRange(p+i.length,p+i.length)})},R=h=>{e==null||e(h.target.value)},u=(h,n)=>r(M,{children:[n&&a(Z,{level:5,style:{margin:0},children:n}),a(w,{align:"start",direction:"vertical",size:0,wrap:!0,children:Object.values(h).map(({description:c,key:s,label:i,type:g})=>a(H,{title:c,children:r(m,{className:"m-1",onClick:()=>A(s,g),size:"small",type:"dashed",children:[i," ",!T&&g==="pro"&&a(S,{color:"#ff8609",size:18})]})},s))})]}),q=r(w,{align:"start",direction:"vertical",size:"middle",style:{width:"100%"},children:[(o==null?void 0:o.advance)&&u(o.advance,l("Advance Tags")),(o==null?void 0:o.post)&&u(o.post,l("Post Tags")),(o==null?void 0:o.product)&&u(o.product,l("Product Tags"))]});return r("div",{className:F,children:[r(J,{align:"top",justify:"space-between",children:[a(x,{span:10,children:t}),a(x,{span:14,children:r(K,{align:"center",css:tt,justify:"end",children:[z&&a(Y,{handleSmartTag:A}),a(M,{children:a(N,{content:q,overlayInnerStyle:{maxHeight:"60vh",overflow:"auto"},placement:"bottom",trigger:"click",children:a(m,{icon:a(G,{}),size:"small",type:"text",children:l("Show Smart Tags")})})})]})})]}),a(D.TextArea,{maxLength:L,onChange:R,ref:b,showCount:!0,value:f,...k})]})}const rt=$.memo(et);globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(t,e){return this.cache.has(t)?this.cache.get(t):(this.cache.set(t,e),e)}};globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(t,e){return this.cache.has(t)?this.cache.get(t):(this.cache.set(t,e),e)}};globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(t,e){return this.cache.has(t)?this.cache.get(t):(this.cache.set(t,e),e)}};globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(t,e){return this.cache.has(t)?this.cache.get(t):(this.cache.set(t,e),e)}};globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(t,e){return this.cache.has(t)?this.cache.get(t):(this.cache.set(t,e),e)}};const{Text:ht}=d;globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(t,e){return this.cache.has(t)?this.cache.get(t):(this.cache.set(t,e),e)}};const{Text:lt}=d;export{rt as M};
