1import{r as Qn,h as ea,e as ft,f as mt,d as nn}from"./BqUEdAed.js";import{u as ta,h as na,d as aa,g as oa,m as ra}from"./Ds_I3cU9.js";import{aU as sa,aV as ia,aW as Bt,aX as la,r as W,J as ye,o as O,g as V,c as Re,h as re,Z as $e,b as me,a as Se,M as he,L as le,e as y,t as ce,F as Te,K as De,f as Ot,T as Ae,l as ue,i as _e,$ as ca,p as an,w as Ce,n as Pe,j as on,v as rn,N as da,Q as ua,u as ie}from"#entry";import{r as pa,a as Ut,i as ga,u as fa}from"./DrL1NOEH.js";import{j as ma}from"./VWaDGczM.js";import{u as ha}from"./B5WxzZSt.js";import{t as va,c as ba}from"./BNe0Xlio.js";let xa={};function ya(n){if(!(n==null||!Number.isFinite(n)))return n<=0?"0":n===1?"1":n<=5?"2-5":n<=10?"6-10":n<=25?"11-25":n<=50?"26-50":n<=100?"51-100":"100+"}function wa(){const n={},e=xa;e.project_id&&(n.project_id=e.project_id),e.template_id&&(n.template_id=e.template_id),e.project_visibility&&(n.project_visibility=e.project_visibility),e.current_page_id&&(n.current_page_id=e.current_page_id),typeof e.page_count=="number"&&Number.isFinite(e.page_count)&&(n.project_page_count=e.page_count);const t=ya(e.page_node_count);return t&&(n.page_node_count_bucket=t),e.editor_session_id&&(n.editor_session_id=e.editor_session_id),e.editor_session_started_at&&(n.editor_session_started_at=e.editor_session_started_at),e.plan_tier&&(n.plan_tier=e.plan_tier),e.workspace_id&&(n.workspace_id=e.workspace_id),n}const sn="core_value_action_v1";function ln(){try{return typeof window>"u"?null:window.localStorage}catch{return null}}function ka(n){const e=ln();if(!e)return{count:0};try{const t=e.getItem(`${sn}:${n}`);if(!t)return{count:0};if(t==="1")return{count:1};const r=JSON.parse(t);return{count:typeof r.count=="number"?r.count:0,first_at:typeof r.first_at=="string"?r.first_at:void 0}}catch{return{count:0}}}function Ca(n,e){const t=ln();if(t)try{t.setItem(`${sn}:${n}`,JSON.stringify(e))}catch{}}function Oe(n,e){const t=wa(),r=e.project_id||t.project_id||"";if(!r)return;const a=`${n}:p:${r}`,l=ka(a);if(n==="project_created"&&l.count>0)return;const g=new Date().toISOString(),i={count:l.count+1,first_at:l.first_at??g};Ca(a,i);const s=l.count===0;ia(`core_value_action_${n}`,{...t,...Sa(e),is_first_for_project:s,project_core_value_action_count:i.count,project_core_value_action_first_at:i.first_at}),Bt({[`first_${n}_at`]:g}),(n==="project_manual_edit"||n==="project_chat_edit")&&Bt({activated_at:g,activation_trigger:n}),la({[`total_${n}`]:1})}function Sa(n){const e={};for(const[t,r]of Object.entries(n))if(r!=null){if(Array.isArray(r)){if(r.length===0)continue;e[t]=r.map(String).join("|");continue}(typeof r=="string"||typeof r=="number"||typeof r=="boolean")&&(e[t]=r)}return e}const Aa={projectCreated:n=>{const e=sa().page_path;return Oe("project_created",{...n,creation_source:n.creation_source??(typeof e=="string"&&e?e:"unknown")})},projectManualEdit:n=>Oe("project_manual_edit",n),projectChatEdit:n=>Oe("project_chat_edit",n),projectExport:n=>Oe("project_export",n),projectShare:n=>Oe("project_share",n)},_a={attachment_count:0,asset_count:0,skill_count:0,reference_image_count:0,document_count:0,asset_ids:[],skill_ids:[],reference_image_ids:[],document_ids:[]};function Le(n){return[...new Set(n.filter(Boolean))]}function Ta(n){const e={..._a,asset_ids:[],skill_ids:[],reference_image_ids:[],document_ids:[]};let t;const r={},a=n.match(/@VeesoScene\(\s*['"]([\s\S]*?)['"]\s*\)/);a?.[1]&&(t=a[1]);for(const s of n.matchAll(/@VeesoUserSkill\(\s*['"]([^'"]+)['"]\s*\)/g)){const p=s[1]?.trim();p&&e.skill_ids.push(p)}e.skill_count=e.skill_ids.length;const l=/@VeesoMaterial\(\s*({[\s\S]*?})\s*\)/g;for(const s of n.matchAll(l))try{const p=JSON.parse(s[1].trim()),h=p.id?.trim();p.type==="reference"?(e.reference_image_count+=1,h&&e.reference_image_ids.push(h)):(e.asset_count+=1,h&&e.asset_ids.push(h))}catch{e.asset_count+=1}const g=/@(Veeso|Seede)Document\(\s*({[\s\S]*?})\s*\)/g;for(const s of n.matchAll(g))try{const h=JSON.parse(s[2].trim()).id?.trim();if(!h)continue;e.document_ids.push(h)}catch{}e.document_count=e.document_ids.length,e.asset_ids=Le(e.asset_ids),e.skill_ids=Le(e.skill_ids),e.reference_image_ids=Le(e.reference_image_ids),e.document_ids=Le(e.document_ids),e.attachment_count=e.asset_count+e.skill_count+e.reference_image_count+e.document_count;const i=n.match(/@VeesoCanvasSize\(width:\s*'(\d+)',\s*height:\s*'(\d+)',\s*strictHeight:\s*'(true|false)'\s*\)/);return i&&(r.width=Number.parseInt(i[1],10),r.height=Number.parseInt(i[2],10),r.strict_height=i[3]==="true",r.height_mode=r.strict_height?"fixed":"auto"),{scene:t,size:r,attachments:e}}function Ke(n,e){return e?.length?n.length?Le([...n,...e]):Le(e):n}function Ea(n,e){if(!e)return zt(n);const t=Ke(n.asset_ids,e.asset_ids),r=Ke(n.skill_ids,e.skill_ids),a=Ke(n.reference_image_ids,e.reference_image_ids),l=Ke(n.document_ids,e.document_ids),g=e.asset_count??t.length,i=e.skill_count??r.length,s=e.reference_image_count??a.length,p=e.document_count??l.length;return zt({asset_count:g,skill_count:i,reference_image_count:s,document_count:p,attachment_count:e.attachment_count??g+i+s+p,asset_ids:t,skill_ids:r,reference_image_ids:a,document_ids:l})}function Na(n,e){if(!e)return n;const t={...n,...e};return t.strict_height!==void 0&&t.height_mode===void 0&&(t.height_mode=t.strict_height?"fixed":"auto"),t.height_mode!==void 0&&t.strict_height===void 0&&(t.strict_height=t.height_mode==="fixed"),t}function zt(n){const e={};return n.attachment_count&&(e.attachment_count=n.attachment_count),n.asset_count&&(e.asset_count=n.asset_count),n.skill_count&&(e.skill_count=n.skill_count),n.reference_image_count&&(e.reference_image_count=n.reference_image_count),n.document_count&&(e.document_count=n.document_count),n.asset_ids?.length&&(e.asset_ids=n.asset_ids),n.skill_ids?.length&&(e.skill_ids=n.skill_ids),n.reference_image_ids?.length&&(e.reference_image_ids=n.reference_image_ids),n.document_ids?.length&&(e.document_ids=n.document_ids),e}function Ra(n){const e=Ta(n.prompt_content),t=Ea(e.attachments,n.attachments),r=Na(e.size,n.size),a={creation_mode:n.creation_mode,prompt_content:n.prompt_content,prompt_length:n.prompt_content.length,...t};return n.account_first_project!==void 0&&(a.account_first_project=n.account_first_project),(n.scene??e.scene)&&(a.scene=n.scene??e.scene),n.coding_model&&(a.coding_model=n.coding_model),n.visibility&&(a.visibility=n.visibility),n.batch_count!==void 0&&(a.batch_count=n.batch_count),r.width!==void 0&&(a.width=r.width),r.height!==void 0&&(a.height=r.height),r.size_preset&&(a.size_preset=r.size_preset),r.he
1ight_mode&&(a.height_mode=r.height_mode),r.strict_height!==void 0&&(a.strict_height=r.strict_height),a}function Ma({width:n=1200,height:e=628}){return{type:"seedeGraphic",messages:[],props:{nodes:{xd8es1lfb:{id:"xd8es1lfb",type:"frame",name:"",x:0,y:0,fill:"#ffffff",w:n,h:e,index:"a0"}}}}}function ds(){const n=W(!1);return{isSubmitting:n,createProject:async(t,r={})=>{n.value=!0;const{user:a}=ta(),l=a.value?.id||a.value?.email||"";let g=!1,i=!1;if(l)try{const h=await Qn("/project",{query:{limit:"1",offset:"0"}});i=Array.isArray(h)&&h.length===0,na("start-trial",l)||(g=i)}catch(h){console.error("Failed to check first project state:",h)}const s=Ma({width:t.width,height:t.height});s.props.inputs={prompt:t.prompt,width:t.width,height:t.height,batchCount:t.batchCount,model:t.model};const p={name:"",description:"",meta:t.tag?{tag:t.tag}:void 0,visibility:t.visibility??"public",thumbnailData:"",data:btoa(unescape(encodeURIComponent(JSON.stringify(s))))};return ea.createProject(p).then(h=>{g&&aa({event_id:h.id,custom_data:{project_id:h.id,model:t.model,tag:t.tag},user_data:oa(a.value)}).then(()=>{ra("start-trial",l)}).catch(o=>{console.error("Failed to track Meta Pixel start trial:",o)});try{Aa.projectCreated({project_id:h.id,...Ra({prompt_content:t.prompt,creation_mode:r.creationMode??"manual",scene:r.scene??t.tag,account_first_project:i,coding_model:t.model,visibility:t.visibility,batch_count:t.batchCount,size:{width:t.width,height:t.height,...r.tracking?.size},attachments:r.tracking?.attachments})})}catch(o){console.error("Failed to track core_value_action_project_created:",o)}return h}).finally(()=>{n.value=!1})}}}const Ht=()=>ft(mt()),$a="auth_token";function Da(){return typeof window<"u"&&typeof localStorage<"u"}function cn(){if(!Da())return null;try{return localStorage.getItem($a)??null}catch(n){return console.warn("Failed to get token from localStorage:",n),null}}const Ia=()=>{const n=async(e,t={})=>{const r=cn();if(!r)throw new Error("No authentication token");const a=Ht();let l=e.startsWith("http")?e:`${a}${e}`;if(t.query){const s=new URLSearchParams(Object.entries(t.query).reduce((p,[h,o])=>(o!=null&&(p[h]=String(o)),p),{})).toString();l+=`?${s}`}const g={"Content-Type":"application/json",Authorization:`Bearer ${r}`,...t.headers};return(await fetch(l,{method:t.method||"GET",headers:g,body:t.body?JSON.stringify(t.body):void 0})).json()};return{api:Ht(),request:n}};function it(n){if(typeof n=="number")return Math.max(0,Math.min(100,n));if(typeof n=="string")return Math.max(0,Math.min(100,Number(n)||0));if(!n||typeof n!="object")return 0;if("progress"in n){const e=Number(n.progress);return Math.max(0,Math.min(100,Number.isFinite(e)?e:0))}if("loaded"in n&&"total"in n){const e=Number(n.loaded),t=Number(n.total);if(Number.isFinite(e)&&Number.isFinite(t)&&t>0)return Math.max(0,Math.min(100,Math.round(e/t*100)))}if("lengthComputable"in n&&n.lengthComputable&&"total"in n&&"loaded"in n){const e=Number(n.loaded),t=Number(n.total);if(Number.isFinite(e)&&Number.isFinite(t)&&t>0)return Math.max(0,Math.min(100,Math.round(e/t*100)))}return 0}function Wt(){const n=cn();if(!n)return console.error("No token found"),null;try{const e=ma(n);return{id:e.id,name:e.name||"",email:e.email,token:n}}catch(e){return console.error("Failed to decode token:",e),null}}function La(){const n=W({reference:!1,material:!1,document:!1}),e=W({reference:0,material:0,document:0});function t(g,i,s){const p={reference:15728640,material:15728640,document:31457280},h={reference:["image/png","image/jpeg","image/webp"],material:["image/png","image/jpeg","image/webp","image/svg+xml"],document:["text/plain","application/pdf","text/markdown","text/x-markdown","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document"]},o=p[i]||30*1024*1024;return g.size>o?(s?.("File size exceeds limit"),!1):h[i].some(R=>i==="document"?g.type===R||g.name.toLowerCase().endsWith(".txt")||g.name.toLowerCase().endsWith(".md")||g.name.toLowerCase().endsWith(".doc")||g.name.toLowerCase().endsWith(".docx"):g.type===R)?!0:(s?.("Unsupported file format"),!1)}async function r(g,i={}){if(!(!g||!t(g,"reference",i.onError))){n.value.reference=!0,e.value.reference=0;try{await fa(g,s=>{i.onSuccess?.(s)},s=>{e.value.reference=it(s)})}catch(s){console.error("Failed to upload reference image:",s);const p=s?.message||"Upload failed";i.onError?.(p)}finally{n.value.reference=!1,e.value.reference=0}}}async function a(g,i={}){const s=Array.from(g).filter(h=>t(h,"material",i.onError));if(s.length===0)return;n.value.material=!0,e.value.material=0;const p=typeof i.onUpdate=="function";try{if(!Wt())throw new Error("User not authenticated, cannot upload material");for(let o=0;o<s.length;o++){const d=s[o],R=o/s.length*100,_=100/s.length;let I=null,D=null;if(p){I=`temp_${Date.now()}_${o}`,D=URL.createObjectURL(d);const f={id:I,url:D,filename:d.name,isMaterial:!0,loading:!0,progress:0,uploadStatus:"uploading"};i.onPick?.(f)}else Array.isArray(i.tempIds)&&i.tempIds[o]&&(I=String(i.tempIds[o]));e.value.material=R,i.onProgress?.({tempId:I,index:o,total:s.length,progress:0,overallProgress:e.value.material,stage:"compress",file:d});const F=await ga(d,{maxSize:1920});e.value.material=R+_*.5,i.onProgress?.({tempId:I,index:o,total:s.length,progress:0,overallProgress:e.value.material,stage:"upload",file:d});const U=await Ut(F.dataURL,{filename:d.name,source:"material"},f=>{const v=it(f);e.value.material=R+_*(v/100),i.onProgress?.({tempId:I,index:o,total:s.length,progress:v,overallProgress:e.value.material,stage:"upload",file:d})});p?(i.onUpdate(I,{...U,isMaterial:!0,loading:!1,progress:100,uploadStatus:"done"}),URL.revokeObjectURL(D)):i.onPick?.(U),e.value.material=R+_,i.onProgress?.({tempId:I,index:o,total:s.length,progress:100,overallProgress:e.value.material,stage:"done",file:d})}i.onSuccess?.()}catch(h){console.error("Failed to upload material:",h);const o=h?.message||"Upload failed";i.onError?.(o)}finally{n.value.material=!1,e.value.material=0}}async function l(g,i={}){const s=Array.from(g).filter(p=>t(p,"document",i.onError));if(s.length!==0){n.value.document=!0,e.value.document=0;try{if(!Wt())throw new Error("User not authenticated, cannot upload document");for(let h=0;h<s.length;h++){const o=s[h],d=h/s.length*100,R=100/s.length;e.value.document=d+R*.2;const _=await pa(o);e.value.document=d+R*.5;const I=await Ut(_,{filename:o.name,source:"document"},D=>{const F=it(D);e.value.document=d+R*(F/100)});i.onPick?.(I),e.value.document=d+R}i.onSuccess?.()}catch(p){console.error("Failed to upload document:",p);const h=p?.message||"Upload failed";i.onError?.(h)}finally{n.value.document=!1,e.value.document=0}}}return{isUploading:n,uploadProgress:e,uploadReference:r,uploadMaterial:a,uploadDocument:l,validateFile:t}}const pt=n=>
1{if(!n||typeof n!="string")return!1;const e=n.trim();return!!(/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$/.test(e)||/^rgba?\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*(,\s*(0|1|0?\.\d+))?\s*\)$/i.test(e)||/^hsla?\(\s*\d+\s*,\s*\d+%?\s*,\s*\d+%?\s*(,\s*(0|1|0?\.\d+))?\s*\)$/i.test(e)||["black","white","red","green","blue","yellow","orange","purple","pink","gray","grey","brown","cyan","magenta","lime","maroon","navy","olive","teal","aqua","fuchsia","silver","gold","coral","salmon","tomato","crimson","indigo","violet","plum","orchid","lavender","beige","ivory","khaki","tan","chocolate","sienna","peru","wheat","moccasin","peachpuff","bisque","blanchedalmond","papayawhip","lemonchiffon","lightgoldenrodyellow","lightyellow","cornsilk","floralwhite","seashell","snow","honeydew","mintcream","azure","aliceblue","ghostwhite","whitesmoke","gainsboro","lightgray","lightgrey","darkgray","darkgrey","dimgray","dimgrey","slategray","slategrey","lightslategray","lightslategrey","transparent"].includes(e.toLowerCase()))},Ne=n=>{if(!n)return n;if(n.startsWith("#"))return n.length===4?`#${n[1]}${n[1]}${n[2]}${n[2]}${n[3]}${n[3]}`:n.toUpperCase();try{const e=document.createElement("canvas");e.width=1,e.height=1;const t=e.getContext("2d");t.fillStyle=n;const r=t.fillStyle;if(r.startsWith("#"))return r.toUpperCase();const a=r.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(a){const l=parseInt(a[1]).toString(16).padStart(2,"0"),g=parseInt(a[2]).toString(16).padStart(2,"0"),i=parseInt(a[3]).toString(16).padStart(2,"0");return`#${l}${g}${i}`.toUpperCase()}}catch{}return n},gt=n=>{if(!n)return 128;let e=n;
1e.startsWith("#")&&(e=e.slice(1)),e.length===3&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]);const t=parseInt(e.substring(0,2),16),r=parseInt(e.substring(2,4),16),a=parseInt(e.substring(4,6),16);return(t*299+r*587+a*114)/1e3},Pa=[{id:"product",label:"Product",color:"blue"},{id:"brand",label:"Brand",color:"purple"},{id:"slogan",label:"Slogan",color:"green"},{id:"title",label:"Title",color:"orange"},{id:"description",label:"Description",color:"pink"},{id:"cta",label:"Call to Action",color:"red"},{id:"logo",label:"Logo",color:"indigo"},{id:"background",label:"Background",color:"teal"}],Fa=()=>Pa,ja=n=>{const e=Fa();if(!n)return e;const t=n.toLowerCase();return e.filter(r=>r.label.toLowerCase().includes(t)||r.id.toLowerCase().includes(t))},Vt=()=>{const n=window.getSelection();if(n.rangeCount===0)return null;const e=n.getRangeAt(0);let t=e.getBoundingClientRect();if(t.width===0&&t.height===0){const r=e.getClientRects();if(r.length>0)t=r[0];else if(e.startContainer.nodeType===Node.ELEMENT_NODE){const a=e.startContainer.childNodes[e.startOffset];a&&a.getBoundingClientRect&&(t=a.getBoundingClientRect())}}return{x:t.left,y:t.bottom}};function Ba(n={}){const{editorRef:e,syncContent:t,onFileDrop:r}=n,a=W({isDragging:!1,isExternalDragging:!1,draggedElement:null,dropIndicator:null,dropTarget:null,dropPosition:null,dropRange:null});let l=null,g=0,i=0,s=null;const p=()=>(s||(s=document.createElement("span"),s.className="drop-indicator",s.setAttribute("data-drop-indicator","true")),s),h=()=>{s&&s.parentNode&&s.parentNode.removeChild(s)},o=c=>{for(;c&&c!==e?.value;){if(c.getAttribute&&(c.getAttribute("data-type")==="image"||c.getAttribute("data-type")==="document"||c.getAttribute("data-type")==="tag"||c.getAttribute("data-type")==="remix"||c.getAttribute("data-type")==="userskill"))return c;c=c.parentElement}return null},d=(c,S)=>{if(document.caretRangeFromPoint)return document.caretRangeFromPoint(c,S);if(document.caretPositionFromPoint){const k=document.caretPositionFromPoint(c,S);if(k){const A=document.createRange();return A.setStart(k.offsetNode,k.offset),A.collapse(!0),A}}return null},R=c=>{const S=o(c.target);S&&(a.value.isDragging=!0,a.value.draggedElement=S,c.dataTransfer.effectAllowed="move",c.dataTransfer.setData("text/plain",""),S.classList.add("dragging"),S.style.opacity="0.5")},_=(c,S,k)=>{const A=o(k);if(A===a.value.draggedElement){h(),a.value.dropTarget=null,a.value.dropRange=null;return}if(A){const B=A.getBoundingClientRect(),m=B.left+B.width/2,M=c<m?"before":"after";if(a.value.dropTarget!==A||a.value.dropPosition!==M){h();const E=p();M==="before"?A.parentNode.insertBefore(E,A):A.parentNode.insertBefore(E,A.nextSibling),a.value.dropTarget=A,a.value.dropPosition=M,a.value.dropRange=null}}else{const B=d(c,S);if(B&&e?.value?.contains(B.startContainer)){let m=B.startContainer,M=!1;for(;m&&m!==e?.value;){if(m===a.value.draggedElement){M=!0;break}m=m.parentNode}if(!M){if(B.startContainer.nodeType===Node.ELEMENT_NODE&&B.startContainer.hasAttribute&&B.startContainer.hasAttribute("data-drop-indicator"))return;h();const E=p();B.insertNode(E),a.value.dropTarget=null,a.value.dropPosition=null,a.value.dropRange={container:E.parentNode,indicator:E}}}else h(),a.value.dropTarget=null,a.value.dropPosition=null,a.value.dropRange=null}},I=c=>{const S=c.dataTransfer.types.includes("Files");if(!a.value.isDragging&&!S)return;c.preventDefault(),c.dataTransfer.dropEffect="move",S&&!a.value.isDragging&&(a.value.isDragging=!0,a.value.isExternalDragging=!0);
1const k=c.clientX,A=c.clientY,B=c.target,m=Math.abs(k-g),M=Math.abs(A-i);m<5&&M<5||(g=k,i=A,l&&cancelAnimationFrame(l),l=requestAnimationFrame(()=>{_(k,A,B),l=null}))},D=c=>{e?.value?.contains(c.relatedTarget)||(h(),a.value.isExternalDragging?U():(a.value.dropTarget=null,a.value.dropPosition=null,a.value.dropRange=null))},F=c=>{const S=c.previousSibling;if((!S||S.nodeType===Node.TEXT_NODE&&S.textContent.length>0&&!S.textContent.endsWith(" ")&&!S.textContent.endsWith("Â ")||S.nodeType===Node.ELEMENT_NODE&&!S.hasAttribute("data-drop-indicator"))&&(!S||S.nodeType!==Node.TEXT_NODE||S.textContent.length===0)){const m=document.createTextNode("Â ");c.parentNode.insertBefore(m,c)}const A=c.nextSibling;if((!A||A.nodeType===Node.TEXT_NODE&&A.textContent.length>0&&!A.textContent.startsWith(" ")&&!A.textContent.startsWith("Â ")||A.nodeType===Node.ELEMENT_NODE&&!A.hasAttribute("data-drop-indicator"))&&(!A||A.nodeType!==Node.TEXT_NODE||A.textContent.length===0)){const m=document.createTextNode("Â ");c.parentNode.insertBefore(m,c.nextSibling)}},U=()=>{l&&(cancelAnimationFrame(l),l=null),g=0,i=0,a.value={isDragging:!1,isExternalDragging:!1,draggedElement:null,dropIndicator:null,dropTarget:null,dropPosition:null,dropRange:null}};return{dragState:a,handleDragStart:R,handleDragOver:I,handleDragLeave:D,handleDrop:c=>{if(c.preventDefault(),!a.value.isDragging)return;if(c.dataTransfer.files&&c.dataTransfer.files.length>0){const E=a.value.dropTarget,H=a.value.dropPosition,G=a.value.dropRange;let P=null;E?P={target:E,position:H}:G&&G.indicator&&(P={target:G.indicator,position:"before"}),r?.(c.dataTransfer.files,P),h(),U();return}if(!a.value.draggedElement){h(),U();return}const k=a.value.draggedElement,A=a.value.dropTarget,B=a.value.dropPosition,m=a.value.dropRange;k.classList.remove("dragging"),k.style.opacity="";let M=!1;if(A&&A!==k)B==="before"?A.parentNode.insertBefore(k,A):A.parentNode.insertBefore(k,A.nextSibling),M=!0;else if(m&&m.indicator){const E=m.indicator;E.parentNode.insertBefore(k,E),M=!0}M&&(F(k),t?.({immediate:!0})),h(),U()},handleDragEnd:c=>{const S=o(c.target);S&&(S.classList.remove("dragging"),S.style.opacity=""),h(),U()},makeDraggable:c=>{c.setAttribute("draggable","true"),c.classList.add("draggable-item")},removeDropIndicators:h,resetDragState:U}}async function Oa(n){const e={images:[],text:""};if(!n)return e;const r=new DOMParser().parseFromString(n,"text/html");let a=0;const l=new Map,g=r.querySelectorAll("img");g.forEach(o=>{const d=`[[Image@${a+1}]]`;l.set(o,d);const R=r.createTextNode(d);o.parentNode.replaceChild(R,o),a++});const i=r.body.textContent||"";e.text=i.replace(/\r\n/g,` 2`).replace(/\r/g,` 3`).replace(/[ \t]+\n/g,` 4`).replace(/\n[ \t]+/g,` 5`).replace(/\n{3,}/g,` 6 7`).trim();const s=[];let p=0;g.forEach(o=>{const d=o.src,R=l.get(o);d&&d.startsWith("data:image")?s.push(fetch(d).then(_=>_.blob()).then(_=>{const I=_.type,D=I.split("/")[1]||"png",F=`pasted-image-${p+1}.${D}`;return{file:new File([_],F,{type:I}),dataURL:d,type:I,id:R,tag:`[Image@${p}]`,index:p}}).catch(_=>(console.error("Failed to process base64 image:",_),null))):d&&d.startsWith("file://")?console.warn("Local file URLs cannot be accessed from browser:",d):d&&(d.startsWith("http://")||d.startsWith("https://"))&&s.push(fetch(d).then(_=>_.blob()).then(_=>{const I=_.type,D=I.split("/")[1]||"png",F=`pasted-image-${p+1}.${D}`;return{file:new File([_],F,{type:I}),url:d,type:I,id:R,tag:`[Image@${p}]`,index:p}}).catch(_=>(console.error("Failed to fetch remote image:",_),null))),p++});const h=await Promise.all(s);return e.images=h.filter(o=>o!==null),e}function Ua(n){if(!n)return!1;const e=n.getData("text/html");return e?e.includes("urn:schemas-microsoft-com:office:word")||e.includes("urn:schemas-microsoft-com:office:office")||e.includes("Microsoft Word")||e.includes("mso-"):!1}class za{constructor(){this.nodes=new Map}register(e,t){this.nodes.set(e,t)}get(e){return this.nodes.get(e)}create(e,t){const r=this.get(e);if(!r)throw new Error(`Node type "${e}" not registered`);return new r(t)}render(e,t,r){return this.create(e,r).render(t,r)}update(e,t,r,a){const l=this.create(e,a);l.update&&l.update(t,r,a)}serialize(e,t,r){const a=this.create(e,r);if(!a.serialize)throw new Error(`Node type "${e}" does not support serialize`);return a.serialize(t)}}const te=new za;function Ha(n={}){const{editorRef:e,syncContent:t,parseAndInsertText:r,insertImage:a,removeMaterial:l,replaceImagePlaceholder:g,toast:i,emit:s}=n,p=f=>f==="userskill"?"skill":f,h=()=>{const f=window.getSelection();if(!f.rangeCount)return;const v=f.getRangeAt(0);v.collapsed||v.deleteContents()},o=()=>{const f=window.getSelection();if(!f.rangeCount)return null;const v=f.getRangeAt(0);let w=f.anchorNode;for(;w&&w!==e?.value;){if(w.nodeType===Node.ELEMENT_NODE&&w.getAttribute?.("data-type")==="image")return w;w=w.parentNode}if(v.collapsed)return null;const c=v.commonAncestorContainer;if(c.nodeType===Node.ELEMENT_NODE){const S=c.querySelectorAll?.('[data-type="image"]');if(S?.length===1&&v.intersectsNode(S[0]))return S[0]}return null},d=()=>{const f=window.getSelection();if(!f.rangeCount)return"";const v=f.getRangeAt(0);if(v.collapsed)return"";const w=v.cloneContents(),c=document.createElement("div");return c.appendChild(w),c.querySelectorAll('[data-type="image"],[data-type="tag"],[data-type="color"],[data-type="remix"],[data-type="userskill"],[data-type="document"]').forEach(A=>{const B=A.getAttribute("data-type");if(!B)return;const m=te.serialize(p(B),A,{});A.parentNode?.replaceChild(document.createTextNode(m),A)}),(c.textContent||"").replace(/\r\n?/g,` 8`).replace(/\u00A0/g," ").replace(/[ \t]+\n/g,` 9`).replace(/\n[ \t]+/g,` 10`).replace(/\n{3,}/g,` 11 12`)},R=f=>{const v=d();v&&(f.preventDefault(),f.clipboardData.setData("text/plain",v))},_=f=>{const v=d();v&&(f.preventDefault(),f.clipboardData.setData("text/plain",v),h(),t?.({immediate:!0}))},I=f=>{const v=new Blob([f],{type:"image/svg+xml"});return new File([v],`paste_${Date.now()}.svg`,{type:"image/svg+xml"})},D=async f=>{try{const v=await fetch(f);if(!v.ok)return null;const w=await v.text();return I(w)}catch{return null}},F=async f=>{const v=f.clipboardData;if(!v)return;if(Ua(v)){f.preventDefault();const P=v.getData("text/html");try{const Y=await Oa(P);Y.text&&U(Y.text);for(const K of Y.images)K.file&&K.id&&await g?.(K.id,K.file);t?.({immediate:!0}),s?.("paste",f);return}catch(Y){console.error("Failed to parse Word HTML:",Y),i?.({title:"Upload failed",description:Y.message||"Content parsing failed",variant:"destructive"})}}const w=v.items;if(!w){s?.("paste",f);return}let c=!1,S=!1,k=null;for(let P=0;P<w.length;P++)w[P].type.indexOf("image")!==-1&&(S=!0,k=w[P]),w[P].type.indexOf("text")!==-1&&(c=!0);const A=v.getData("text/plain"),B=v.getData("text/html"),m=A?.trim().startsWith("<svg")||A?.trim().startsWith("<?xml"),E=B?.match(/<img[^>]+src=["']([^"']+\.svg)["'][^>]*>/i)?.[1]||null,H=o(),G=m||E;if(H&&(S||G)){f.preventDefault();let P=null;if(S&&k?P=k.getAsFile():m?P=I(A):E&&(P=await D(E)),P){const Y=H.getAttribute("data-asset-id");l?.(Y),await a?.(P)}return}if(G){f.preventDefault();let P=null;m?P=I(A):E&&(P=await D(E)),P&&await a?.(P);return}if(S&&k){f.preventDefault();const P=k.getAsFile();P&&await a?.(P);return}if(c){const P=v.getData("text/plain");P&&(f.preventDefault(),r?.(P)),s?.("paste",f);return}s?.("paste",f)},U=f=>{const v=window.getSelection();if(!v.rangeCount)return;const w=v.getRangeAt(0);w.deleteContents();const c=document.createTextNode(f);w.insertNode(c),w.setStartAfter(c),w.collapse(!0),v.removeAllRanges(),v.addRange(w)};return{handleCopy:R,handleCut:_,handlePaste:F,deleteSelection:h,getSelectedMaterial:o,getSelectionAsText:d,insertTextAtCursor:U}}function Wa(n){if(!n)return{content:"",images:[]};const e=[],t=/@(Veeso|Seede)ReferenceImage\((\{.*?\})\)/g;let r;for(;(r=t.exec(n))!==null;)try{let s=r[2],p=0,h=0;for(let d=0;d<s.length;d++)if(s[d]==="{"&&p++,s[d]==="}"&&p--,p===0){h=d+1;break}if(p!==0){const d=n.slice(r.index),R=d.indexOf("{");let _=0,I=-1;for(let D=R;D<d.length;D++)if(d[D]==="{"&&_++,d[D]==="}"&&_--,_===0){I=D+1;break}I>0&&(s=d.slice(R,I))}else s=s.slice(0,h);const o=JSON.parse(s);e.push({url:o.url,tag:o.tag||void 0,filename:o.filename,width:o.width,height:o.height,aspectRatio:o.aspectRatio,fnType:o.fnType})}catch(s){console.error("Failed to parse reference image JSON tag:",s)}let a=n.replace(/@(Veeso|Seede)ReferenceImage\(\{.*?\}\)/g,"");const l=/@(Veeso|Seede)ReferenceImage\(url:\s*'([^']*)',\s*tag:\s*'([^']*)'\)/g;let g;for(;(g=l.exec(a))!==null;){const s=g[2].replace(/\\'/g,"'"),p=g[3].replace(/\\'/g,"'");e.push({url:s,tag:p||void 0})}if(a=a.replace(l,""),!e.length)return Va(a);const i=/\[SeedeImage##([^\]]+)\]/g;return a=a.replace(i,""),{content:a,images:e}}function Va(n){if(!n)return{content:"",images:[]};const e=/\[SeedeImage##([^\]]+)\]/g,t=[];let r;for(;(r=e.exec(n))!==null;)t.push({url:r[1],tag:""});return{content:n.replace(e,""),images:t}}function qa(n){if(!n)return{content:"",size:null};const e=/@VeesoCanvasSize\(([^)]+)\)/g;let t=null,r;for(;(r=e.exec(n))!==null;)try{const l=r[1],g=l.match(/width:\s*'([^']*)'/),i=l.match(/height:\s*'([^']*)'/),s=l.match(/strictHeight:\s*'([^']*)'/);if(g&&i){t={width:g[1],height:i[1],strictHeight:s?s[1]==="true":!1};break}}catch(l){console.error("Failed to parse VeesoCanvasSize tag:",l)}return{content:n.replace(e,""),size:t}}function Xa(n){if(!n)return{content:"",theme:null};const e=/@SeedeTheme\(([^)]+)\)/g;let t=null,r;for(;(r=e.exec(n))!==null;)try{const l=JSON.parse(r[1]);t={value:l.value,label:l.label,description:l.description,colors:l.colors,primaryColor:l.primaryColor,secondaryColor:l.secondaryColor};break}catch(l){console.error("Failed to parse theme tag:",l)}return{content:n.replace(e,""),theme:t}}function Ga(n){if(!n)return{content:"",style:null};const e=/SeedeStyle\('([^']+)',\s*'([^']+)'\)/g;let t=null,r;for(;(r=e.exec(n))!==null;){const l=r[1].replace(/\\'/g,"'"),g=r[2].replace(/\\'/g,"'");t={value:l,label:g};break}return{content:n.replace(e,""),style:t}}function Ka(n={}){const{editorRef:e,chatState:t,emit:r,adjustHeight:a,syncAssetsWithEditor:l}=n,g=W(""),i=W(!0),s=f=>f==="userskill"?"skill":f,p=f=>{if(typeof f!="string")return f;const v=f.trim();return v.startsWith("`")&&v.endsWith("`")&&v.length>=2?v.slice(1,-1).trim():v},h=f=>{const v=String(f||"");let w=2166136261;for(let c=0;c<v.length;c++)w^=v.charCodeAt(c),w=Math.imul(w,16777619);return(w>>>0).toString(16)},o=(f,v)=>{let w=f.parentNode;for(;w&&w!==v;){if(w.nodeType===Node.ELEMENT_NODE){const c=w.getAttribute?.("data-type");if(c==="image"||c==="tag"||c==="color"||c==="remix"||c==="userskill"||c==="document")return!0}w=w.parentNode}return!1},d=()=>
12{if(!e?.value)return!0;const f=e.value;return f.querySelector('[data-type="image"]')||f.querySelector('[data-type="tag"]')||f.querySelector('[data-type="color"]')||f.querySelector('[data-type="remix"]')||f.querySelector('[data-type="userskill"]')||f.querySelector('[data-type="document"]')?!1:!(f.textContent||"").trim()},R=()=>{if(!e?.value)return"";const f=[],v=e.value,w=document.createTreeWalker(v,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,{acceptNode:k=>{if(k.nodeType===Node.ELEMENT_NODE){const A=k.getAttribute?.("data-type");return A==="image"||A==="tag"||A==="color"||A==="remix"||A==="userskill"||A==="document"||k.nodeName==="BR"||k.nodeName==="DIV"||k.nodeName==="P"?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}return k.nodeType===Node.TEXT_NODE&&o(k,v)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}});let c=!1,S;for(;S=w.nextNode();)if(S.nodeType===Node.TEXT_NODE)f.push(S.textContent),c=!1;else if(S.nodeType===Node.ELEMENT_NODE){const k=S.getAttribute?.("data-type");k==="image"||k==="tag"||k==="color"||k==="remix"||k==="userskill"||k==="document"?(f.push(te.serialize(s(k),S,{})),c=!1):S.nodeName==="BR"?(f.push(` 13`),c=!1):(S.nodeName==="DIV"||S.nodeName==="P")&&!c&&(f.length>0&&!f[f.length-1]?.endsWith(` 14`)&&f.push(` 15`),c=!0)}return f.join("")},_=()=>{if(!e?.value)return{text:"",images:[],tags:[],colors:[]};const f=e.value.cloneNode(!0),v=[],w=[],c=[],S=[];return f.querySelectorAll('[data-type="image"]').forEach(k=>{const A=k.getAttribute("data-loading")==="true",B=k.getAttribute("data-upload-status")||"",m=parseFloat(k.getAttribute("data-upload-progress")||"0")||0,M=k.getAttribute("data-asset-id"),E=k.getAttribute("data-url"),H=k.getAttribute("data-tag")||"",G=k.getAttribute("data-is-material")!=="false",P=parseInt(k.getAttribute("data-width")||"128"),Y=parseInt(k.getAttribute("data-height")||"128"),K=k.getAttribute("data-filename")||"";if(A||B==="uploading"||B==="failed"){S.push({id:M,type:"image",status:B||"uploading",progress:m}),k.replaceWith("");return}const ae={id:M,url:E,tag:H,isMaterial:G,width:P,height:Y,name:K};v.push(ae),k.replaceWith(te.serialize("image",k,{}))}),f.querySelectorAll('[data-type="tag"]').forEach(k=>{w.push({id:k.getAttribute("data-tag-id"),label:k.getAttribute("data-label"),value:k.getAttribute("data-value")}),k.replaceWith(te.serialize("tag",k,{}))}),f.querySelectorAll('[data-type="color"]').forEach(k=>{const A=k.getAttribute("data-value"),B=k.getAttribute("data-display-value");c.push({id:k.getAttribute("data-color-id"),value:A,displayValue:B}),k.replaceWith(` ${te.serialize("color",k,{})} `)}),f.querySelectorAll('[data-type="remix"]').forEach(k=>{k.replaceWith(` ${te.serialize("remix",k,{})} `)}),f.querySelectorAll('[data-type="userskill"]').forEach(k=>{k.replaceWith(` ${te.serialize("skill",k,{})} `)}),f.querySelectorAll('[data-type="document"]').forEach(k=>{k.replaceWith(te.serialize("document",k,{}))}),{text:f.innerText.trim(),images:v,tags:w,colors:c,pendingUploads:S}},I=(f={})=>{const{forceHeight:v=!1,forceSyncAssets:w=!1}=f||{};i.value=d();const c=R();if(c===g.value){v&&a?.(),w&&l?.();return}g.value=c,r?.("update:modelValue",c),a?.(),l?.()},D=(f={})=>{I(f)},F=f=>{if(!f)return[];const v=[],w=/@(?:VeesoMaterial|SeedeMaterial)\((\{[\s\S]*?\})\)/g,c=/@VeesoDocument\((\{[\s\S]*?\})\)/g,S=/@VeesoRemix\('([^']+)',\s*'([^']+)'\)/g,k=/@VeesoUserSkill\('([^']+)'\)/g,A=/#([0-9A-Fa-f]{6}|[0-9A-Fa-f]{3})(?=\s|$)/g,B=[];let m;for(;(m=w.exec(f))!==null;)B.push({type:"material",index:m.index,length:m[0].length,data:m[1],raw:m[0]});for(;(m=c.exec(f))!==null;)B.push({type:"document",index:m.index,length:m[0].length,data:m[1],raw:m[0]});for(;(m=S.exec(f))!==null;)B.push({type:"remix",index:m.index,length:m[0].length,data:{id:m[1],name:m[2]},raw:m[0]});for(;(m=k.exec(f))!==null;)B.push({type:"userskill",index:m.index,length:m[0].length,data:{id:m[1]},raw:m[0]});for(;(m=A.exec(f))!==null;){const E=m.index>0?f[m.index-1]:"";(m.index===0||/\s/.test(E))&&B.push({type:"color",index:m.index,length:m[0].length,data:`#${m[1]}`,raw:m[0]})}B.sort((E,H)=>E.index-H.index);let M=0;for(const E of B)if(!(E.index<M)){if(E.index>M){const H=f.slice(M,E.index);H&&v.push({type:"text",content:H})}if(E.type==="material")try{let H=E.data,G=0,P=0;for(let N=0;N<H.length;N++)if(H[N]==="{"&&G++,H[N]==="}"&&G--,G===0){P=N+1;break}P>0&&(H=H.slice(0,P));const Y=JSON.parse(H),K=p(Y.url);let ae=Y.id;if(!ae||/^material_/.test(ae)){const N=K.match(/\/asset\/([a-f0-9-]{36})/i);N?ae=N[1]:ae||(ae=`material_${Date.now()}_${Math.random().toString(36).substr(2,9)}`)}const pe=Y.type==="reference",L=Y.width??(pe?120:void 0),x=Y.height??(pe?120:void 0),T=Y.aspectRatio??(typeof L=="number"&&typeof x=="number"&&x!==0?Math.round(100*L/x)/100:void 0);v.push({type:"material",content:{id:ae,url:K,name:Y.filename||"",width:L,height:x,meta:{w:L,h:x},aspectRatio:T,tag:Y.tag||"",isMaterial:!pe}})}catch{v.push({type:"text",content:E.raw})}else if(E.type==="document")try{const H=JSON.parse(E.data);v.push({type:"document",content:{id:H.id,filename:H.filename}})}catch{v.push({type:"text",content:E.raw})}else E.type==="color"?v.push({type:"color",content:{id:`color_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,value:E.data,displayValue:Ne(E.data)}}):E.type==="remix"?v.push({type:"remix",content:E.data}):E.type==="userskill"&&v.push({type:"userskill",content:E.data});M=E.index+E.length}if(M<f.length){const E=f.slice(M);E&&v.push({type:"text",content:E})}return v};return{isEmpty:i,lastSyncedValue:g,checkEmpty:d,getPlainText:R,getFormattedContent:_,syncContent:D,syncContentCore:I,parseTextWithMaterials:F,parseAndInsertText:(f,v={})=>{const{skipSync:w=!1,stateBehavior:c="merge",insertTextAtCursor:S,insertImageNode:k,insertDocumentTag:A,insertColorTagNode:B,insertRemixTag:m,insertUserSkillTag:M,addAssetToChatState:E}=v;f=f||"",f=f.trim();const H=x=>String(x||"").replace(/[ \t\u00A0]+$/g,"").endsWith(` 16`),G=x=>String(x||"").replace(/^[ \t\u00A0]+/g,"").startsWith(` 17`),P=Xa(f);f=P.content,P.theme&&t&&(t.theme=P.theme);const Y=qa(f);f=Y.content,Y.size&&r?.("update:canvas-size",Y.size);const K=Ga(f);f=K.content,K.style&&t&&(t.style=K.style);const ae=Wa(f);f=ae.content;const pe=(ae.images||[]).map(x=>{const T=p(x?.url||"");if(!T)return null;const N=p(x?.tag||""),$=x?.id||`ref_${h(T)}`;return{...x,id:$,url:T,tag:N,isMaterial:!1}}
17).filter(Boolean);if(t&&(c==="replace"&&(t.assets||(t.assets=[]),t.assets=t.assets.filter(x=>x?.isMaterial===!0)),pe.length))for(const x of pe)E?.(x,{checkDuplicate:!0});const L=F(f);for(let x=0;x<L.length;x++){const T=L[x],N=x>0?L[x-1]:null,$=x<L.length-1?L[x+1]:null;if(T.type==="text")S?.(T.content);else if(T.type==="material"){const q=T.content;N&&N.type==="text"&&(H(N.content)||S?.(` 18`)),k?.(q)!==!1&&((!$||$.type==="material"||$.type==="text"&&!G($.content))&&S?.(` 19`),E?.(q,{checkDuplicate:!0}))}else if(T.type==="document"){const q=T.content;A?.(q),E?.(q,{checkDuplicate:!0})}else if(T.type==="color"){const q=T.content;B?.(q)}else T.type==="remix"?m?.({id:T.content.id,name:T.content.name},{skipSync:!0}):T.type==="userskill"&&M?.({id:T.content.id},{skipSync:!0})}w||D({})}}}class Fe{constructor(e){this.type=e}render(e,t){throw new Error("render must be implemented")}serialize(e){throw new Error("serialize must be implemented")}match(e){return e.getAttribute("data-type")===this.type}update(e,t,r){}}class Ya extends Fe{constructor(){super("color")}render(e,t){const{makeDraggable:r,onClick:a}=t,{id:l,value:g,displayValue:i}=e,s=Ne(g),p=gt(s),h=p>200,o=p>160,d=document.createElement("span");d.contentEditable="false",d.setAttribute("data-type","color"),d.setAttribute("data-color-id",l),d.setAttribute("data-value",g),d.setAttribute("data-display-value",i||s),d.className="color-tag inline-flex items-center gap-1.5 mx-0.5 px-1 py-0.5 rounded-full select-none align-baseline transition-all duration-200";const R=h?"#666666":o?"#444444":s,_=h?.4:o?.2:.15,I=h?"60":o?"40":"30";d.style.cssText=` 20 background-color: ${s}${Math.round(_*255).toString(16).padStart(2,"0")}; 21 color: ${R}; 22 font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, monospace; 23 font-size: 0.8125em; 24 font-weight: 500; 25 letter-spacing: -0.01em; 26 line-height: 1.4; 27 border: 1px solid ${s}${I}; 28 transition: all 0.2s ease; 29 cursor: pointer; 30 `,r&&r(d),a&&d.addEventListener("click",f=>{d.classList.contains("dragging")||(f.preventDefault(),f.stopPropagation(),a({id:l,value:g,displayValue:i||s},d,f))});const D=document.createElement("span");D.className="flex-shrink-0";const F=h?"inset 0 0 0 1px rgba(0,0,0,0.2), 0 0 0 1px rgba(0,0,0,0.08)":"inset 0 0 0 1px rgba(0,0,0,0.1)";D.style.cssText=` 31 width: 12px; 32 height: 12px; 33 border-radius: 50%; 34 background-color: ${s}; 35 box-shadow: ${F}; 36 `;const U=document.createElement("span");return U.className="pointer-events-none",U.textContent=s,d.appendChild(D),d.appendChild(U),d}update(e,t,r){const{value:a}=t,l=Ne(a),g=gt(l),i=g>200,s=g>160,p=i?"#666666":s?"#444444":l,h=i?.4:s?.2:.15,o=i?"60":s?"40":"30";e.setAttribute("data-value",a),e.setAttribute("data-display-value",l),e.style.backgroundColor=`${l}${Math.round(h*255).toString(16).padStart(2,"0")}`,e.style.color=p,e.style.borderColor=`${l}${o}`;const d=e.querySelector("span:first-child");if(d){d.style.backgroundColor=l;const _=i?"inset 0 0 0 1px rgba(0,0,0,0.2), 0 0 0 1px rgba(0,0,0,0.08)":"inset 0 0 0 1px rgba(0,0,0,0.1)";d.style.boxShadow=_}const R=e.querySelector("span:last-child");R&&(R.textContent=l)}serialize(e){return e.getAttribute("data-value")}}const Ja=()=>ft(mt()),Ue='<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="text-black/60"><path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"></path><polyline points="14 2 14 8 20 8"></polyline><line x1="16" y1="13" x2="8" y2="13"></line><line x1="16" y1="17" x2="8" y2="17"></line><line x1="10" y1="9" x2="8" y2="9"></line></svg>',qt='<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="text-black/60 animate-spin"><path d="M21 12a9 9 0 1 1-6.219-8.56"></path></svg>',Za='<svg class="w-2.5 h-2.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2.5" d="M6 18L18 6M6 6l12 12" /></svg>',Xt=(n,e=20)=>{if(!n)return"Document";if(n.length<=e)return n;const t=n.lastIndexOf(".");if(t===-1)return n.slice(0,e-3)+"...";const r=n.slice(0,t),a=n.slice(t),l=e-a.length-3;return l>0?r.slice(0,l)+"..."+a:n.slice(0,e-3)+"..."};class Qa extends Fe{constructor(){super("document")}render(e,t){const{makeDraggable:r,onClick:a,onRemove:l}
36=t,g=e,i=g.filename||g.name||"Document";let s=!!(g.parsed||g.parsed_key);const p=!!g.loading,{id:h}=g,o=document.createElement("span");o.contentEditable="false",o.setAttribute("data-type","document"),o.setAttribute("data-asset-id",g.id),o.setAttribute("data-filename",i),o.setAttribute("data-parsed",s?"true":"false"),o.setAttribute("data-loading",p?"true":"false"),o.setAttribute("title",i),o.className="document-tag group relative inline-flex h-7 items-center gap-1.5 pl-1 pr-2.5 mx-0.5 rounded-full bg-black/5 border border-black/5 hover:border-black/10 transition-all duration-300 select-none align-middle cursor-grab draggable-item",r&&r(o);const d=document.createElement("div");d.className="document-tag-icon w-5 h-5 flex items-center justify-center bg-white rounded-full shadow-sm ring-1 ring-black/5 flex-shrink-0";const R=p||!s;d.innerHTML=R?qt:Ue;const _=document.createElement("span");_.className="text-black/80 text-xs font-medium tracking-tight leading-none flex items-center gap-1 pointer-events-none";const I=document.createElement("span");I.className="max-w-[120px] truncate",I.textContent=Xt(i),_.appendChild(I);const D=document.createElement("span");D.className="document-tag-status text-black/40 text-[10px] font-normal whitespace-nowrap",p?D.textContent="Uploading...":s||(D.textContent="Parsing..."),_.appendChild(D),o.appendChild(d),o.appendChild(_);const F=document.createElement("button");return F.type="button",F.className="absolute -top-1 -right-1 w-4 h-4 bg-black text-white/90 rounded-full flex items-center justify-center shadow-md transition-all duration-200 opacity-0 group-hover:opacity-100 hover:scale-110",F.title="Remove",F.innerHTML=Za,F.addEventListener("click",U=>{U.preventDefault(),U.stopPropagation(),l?l(g,o):o.remove()}),o.appendChild(F),a&&o.addEventListener("click",U=>{o.classList.contains("dragging")||(U.preventDefault(),U.stopPropagation(),a(g,o,U))}),!s&&!p&&h&&this.triggerParse(h,o,d,D),o}async triggerParse(e,t,r,a){try{const l=nn();if(!l)return;const g=Ja(),i=await fetch(`${g}/asset/${e}/parse`,{method:"POST",headers:{Authorization:`Bearer ${l}`}});if(!i.ok)throw new Error(`parse failed: ${i.status}`);if(!(await i.json())?.parsed_key)throw new Error("parse failed: missing parsed_key");t.setAttribute("data-parsed","true"),t.removeAttribute("data-parse-failed"),r.innerHTML=Ue,a.textContent=""}catch(l){console.error("Error triggering document parse:",l),t.setAttribute("data-parsed","false"),t.setAttribute("data-parse-failed","true"),r.innerHTML=Ue,a.textContent="Parse failed"}}update(e,t,r){const a=e.getAttribute("data-asset-id"),l={id:t.id||a,filename:t.filename||t.name||e.getAttribute("data-filename"),parsed:t.parsed!==void 0?t.parsed:e.getAttribute("data-parsed")==="true",loading:t.loading},g=l.filename||"Document",i=!!l.parsed,s=!!l.loading,p=e.getAttribute("data-parse-failed")==="true";e.setAttribute("data-asset-id",l.id),e.setAttribute("data-filename",g),e.setAttribute("data-parsed",i?"true":"false"),e.setAttribute("data-loading",s?"true":"false"),e.setAttribute("title",g),i&&e.removeAttribute("data-parse-failed");const h=e.querySelector(".document-tag-icon");h&&(h.innerHTML=i&&!s?Ue:qt,p&&!i&&(h.innerHTML=Ue));const o=e.querySelector(".max-w-\\[120px\\]");o&&(o.textContent=Xt(g));const d=e.querySelector(".document-tag-status");d&&(s?d.textContent="Uploading...":p?d.textContent="Parse failed":i?d.textContent="":d.textContent="Parsing..."),!i&&!s&&l.id&&!p&&this.triggerParse(l.id,e,h,d)}serialize(e){const t=e.getAttribute("data-filename")||"",r=e.getAttribute("data-asset-id")||"";return` 37 @VeesoDocument(${JSON.stringify({filename:t,id:r})})`}}const Gt=140,eo=48,to=48,no=400,lt='<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><circle cx="8.5" cy="8.5" r="1.5"></circle><polyline points="21 15 16 10 5 21"></polyline></svg>',ct='<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M12 2L2 7l10 5 10-5-10-5z"></path><path d="M2 17l10 5 10-5"></path><path d="M2 12l10 5 10-5"></path></svg>
37',ao='<svg class="h-4 w-4 animate-spin" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 12a9 9 0 1 1-6.219-8.56"></path></svg>';let ke=null,Kt=!1;const oo=(n=null)=>{document.querySelectorAll('[data-type="image"]').forEach(e=>{if(n&&e===n)return;const t=e._setSelected;if(typeof t=="function"){t(!1);return}const r=e.querySelector(".resize-handles");r&&(r.style.opacity="0");const a=e.querySelector(".img-wrapper");if(a){const l=a.querySelector("span:first-child");l&&(l.classList.remove("border-neutral-900"),l.classList.add("border-transparent"))}})},ro=()=>{Kt||(Kt=!0,document.addEventListener("click",n=>{ke&&(ke.contains(n.target)||(ke._setSelected?.(!1),ke=null))},!0))};class so extends Fe{constructor(){super("image")}get materialUsageKeys(){return[{id:"background",label:"Background"},{id:"product",label:"Product"},{id:"model",label:"Model"},{id:"logo",label:"Logo"},{id:"qrcode",label:"QR Code"},{id:"icon",label:"Icon"},{id:"decoration",label:"Decoration"},{id:"texture",label:"Texture"},{id:"chart",label:"Chart"}]}match(e){return e.getAttribute("data-type")==="image"}render(e,t={}){const{onRemove:r,onClick:a,onSync:l,makeDraggable:g}=t,i=e,s=document.createElement("span");s.contentEditable="false",s.setAttribute("data-type","image"),s.setAttribute("data-asset-id",i.id),s.setAttribute("data-url",i.url),s.setAttribute("data-tag",i.tag||"");const p=i.width||i.meta?.w||128,h=i.height||i.meta?.h||128;s.setAttribute("data-width",p),s.setAttribute("data-height",h),s.setAttribute("data-filename",i.name||i.filename||""),s.setAttribute("data-is-material",i.isMaterial!==!1?"true":"false");const o=i?.uploadStatus||(i?.loading?"uploading":i?.uploadStatus)||"",d=i?.loading===!0||o==="uploading",R=Number.isFinite(i?.progress)?Math.max(0,Math.min(100,i.progress)):0;s.setAttribute("data-loading",d?"true":"false"),s.setAttribute("data-upload-status",o||(d?"uploading":"done")),s.setAttribute("data-upload-progress",String(R)),s.className="inline-flex flex-col relative align-middle mx-1 select-none group vertical-align-baseline",s.style.verticalAlign="baseline";const _=document.createElement("span");_.className="img-wrapper relative flex items-center justify-center bg-neutral-100 rounded-xl overflow-visible";const I=document.createElement("span");I.className="absolute inset-0 rounded-xl border border-transparent group-hover:border-neutral-900 transition-colors duration-200 overflow-hidden";const D=p/h;let F=i.previewWidth;F||(D>=1?F=Math.min(p,Gt):F=Math.min(p,Gt*D)),_.style.width=`${Math.round(F)}px`,_.style.aspectRatio=`${D}`;const U=document.createElement("img");let f=i.url;typeof f=="string"&&f.startsWith("`")&&f.endsWith("`")&&(f=f.slice(1,-1)),U.src=f,U.alt=i.name||"image",U.className="w-full h-full object-cover pointer-events-none block",U.onload=()=>{l?.()},I.appendChild(U),_.appendChild(I);const v=document.createElement("div");v.className="upload-overlay absolute inset-0 rounded-xl flex flex-col items-center justify-center gap-2 text-white z-20",v.style.display=d||o==="failed"?"flex":"none",v.onclick=K=>{K.preventDefault(),K.stopPropagation()};const w=document.createElement("div");w.className="flex flex-col items-center justify-center gap-2 px-3 py-2 rounded-lg backdrop-blur-sm",w.style.background=o==="failed"?"rgba(220, 38, 38, 0.65)":"rgba(0, 0, 0, 0.45)";const c=document.createElement("div");c.className="flex items-center justify-center gap-2";const S=document.createElement("div");S.className="upload-spinner",S.innerHTML=ao,S.style.display=o==="failed"?"none":"block";const k=document.createElement("div");k.className="upload-status text-xs font-medium",k.textContent=o==="failed"?"Upload failed":`Uploading ${Math.round(R)}%`,c.appendChild(S),c.appendChild(k);const A=document.createElement("div");A.className="upload-progress-track w-32 h-1.5 rounded-full overflow-hidden",A.style.background="rgba(255, 255, 255, 0.25)",A.style.display=o==="failed"?"none":"block";const B=document.createElement("div");B.className="upload-progress-bar h-full rounded-full",B.style.background="rgba(255, 255, 255, 0.9)",B.style.width=`${Math.round(R)}%`,A.appendChild(B),w.appendChild(c),w.appendChild(A),v.appendChild(w),_.appendChild(v);
37const m=document.createElement("button");m.className="absolute top-2 right-2 w-5 h-5 bg-neutral-900 text-white rounded-full flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity duration-200 z-30 cursor-pointer shadow-sm hover:scale-110",m.innerHTML='<svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>',m.onclick=K=>{K.preventDefault(),K.stopPropagation();const ae=s.getAttribute("data-asset-id");s.remove(),ke===s&&(ke=null),r?.(ae),l?.()},_.appendChild(m);const M=document.createElement("div");M.className=`usage-trigger absolute bottom-2 left-1/2 -translate-x-1/2 flex items-center justify-center gap-1.5 text-[10px] font-medium px-2 py-1 rounded-full transition-opacity duration-200 cursor-pointer z-10 max-w-[85%] ${i.tag?"bg-black/60 text-white shadow-sm backdrop-blur-sm opacity-0 group-hover:opacity-100":"bg-black/60 text-white/90 shadow-sm backdrop-blur-sm opacity-0 group-hover:opacity-100"}`,M.innerHTML=`<span class="truncate">${i.tag||"Add usage"}</span><svg width="8" height="8" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" class="flex-shrink-0"><polyline points="6 9 12 15 18 9"></polyline></svg>`,M.onclick=K=>{K.preventDefault(),K.stopPropagation(),a?.(i,s,K)},_.appendChild(M);const E=document.createElement("div");E.className="type-indicator absolute top-2 left-2 w-5 h-5 bg-black/40 backdrop-blur-sm text-white rounded-md flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity duration-200 z-10 cursor-pointer hover:bg-black/60";const H=i.isMaterial!==!1;E.innerHTML=H?lt:ct,E.onclick=K=>{K.preventDefault(),K.stopPropagation();const pe=!(s.getAttribute("data-is-material")==="true");i.isMaterial=pe,s.setAttribute("data-is-material",pe?"true":"false"),E.innerHTML=pe?lt:ct,l?.()},_.appendChild(E);const G=this.createResizeHandles(_,s,i,l);_.appendChild(G);let P=!1;const Y=K=>{P=K,K?(G.style.opacity="1",I.classList.remove("border-transparent"),I.classList.add("border-neutral-900"),M.classList.remove("opacity-0"),M.classList.add("opacity-100")):(G.style.opacity="0",I.classList.remove("border-neutral-900"),I.classList.add("border-transparent"),M.classList.remove("opacity-100"),M.classList.add("opacity-0"))};return s._setSelected=Y,ro(),_.onclick=K=>{if(s.getAttribute("data-loading")==="true"){K.preventDefault(),K.stopPropagation();return}K.preventDefault(),K.stopPropagation();const ae=!P;oo(s),Y(ae),ke=ae?s:null},s.appendChild(_),g&&g(s,i),s}update(e,t,r){const{onSync:a}=r||{},l=t&&typeof t=="object"?t:{},g=l.asset&&typeof l.asset=="object"?l.asset:null,i=g?{...g,...l}:l,s=e.getAttribute("data-asset-id")||"",p=e.getAttribute("data-url")||"",h=e.getAttribute("data-tag")||"",o=e.getAttribute("data-width")||"",d=e.getAttribute("data-height")||"",R=e.getAttribute("data-filename")||"",_=e.getAttribute("data-loading")==="true",I=e.getAttribute("data-upload-status")||"",D=parseFloat(e.getAttribute("data-upload-progress")||"0")||0,F=i?.id||s,U=i?.url||i?.cdn_url||i?.cdnUrl||p,f=i?.tag??h,v=i?.isMaterial===void 0?e.getAttribute("data-is-material")!=="false":i.isMaterial!==!1,w=String(i?.width||i?.meta?.w||i?.meta?.width||i?.meta?.size?.w||o||128),c=String(i?.height||i?.meta?.h||i?.meta?.height||i?.meta?.size?.h||d||128),S=i?.name||i?.filename||R,k=i?.loading===void 0?_:i.loading===!0,A=i?.uploadStatus===void 0?I||(k?"uploading":"done"):String(i.uploadStatus||""),B=i?.progress===void 0?D:Number(i.progress),m=Number.isFinite(B)?Math.max(0,Math.min(100,B)):0;if(F!==s||U!==p||w!==o||c!==d||S!==R){const G=e.parentNode;if(!G)return;const P=ke===e;P&&(ke=null);const Y=this.render({...i,id:F,url:U,tag:f,isMaterial:v,width:Number(w),height:Number(c),name:S,loading:k,progress:m,uploadStatus:A},r);G.replaceChild(Y,e),P&&(ke=Y),a?.();return}e.setAttribute("data-tag",f||""),e.setAttribute("data-is-material",v?"true":"false"),e.setAttribute("data-loading",k?"true":"false"),e.setAttribute("data-upload-status",A||(k?"uploading":"done")),e.setAttribute("data-upload-progress",String(m)),this.updateUsageLabel(e,f);const E=e.querySelector(".type-indicator");E&&(E.innerHTML=v?lt:ct);const H=e.querySelector(".upload-overlay");if(H){H.style.display=k||A==="failed"?"flex":"none";const G=H.querySelector("div");G&&(G.style.background=A==="failed"?"rgba(220, 38, 38, 0.65)":"rgba(0, 0, 0, 0.45)");const P=H.querySelector(".upload-spinner");P&&(P.style.display=A==="failed"?"none":"block");const Y=H.querySelector(".upload-status");Y&&(Y.textContent=A==="failed"?"Upload failed":`Uploading ${Math.round(m)}%`);const K=H.querySelector(".upload-progress-track");K&&(K.style.display=A==="failed"?"none":"block");const ae=H.querySelector(".upload-progress-bar");ae&&(ae.style.width=`${Math.round(m)}%`)}a?.()}serialize(e){const t=e.getAttribute("data-loading")==="true",r=e.getAttribute("data-upload-status")||"";if(t||r==="uploading"||r==="failed")return"";const a=e.getAttribute("data-asset-id")||"",l=e.getAttribute("data-url")||"",g=e.getAttribute("data-tag")||"",i=parseFloat(e.getAttribute("data-width")),s=parseFloat(e.getAttribute("data-height")),p=e.getAttribute("data-filename")||"",h=e.getAttribute("data-is-material")!=="false",o=(p||"").replace(/[\r\n]+/g," "),d=l.trim(),_=` \`${d.length>=2&&d.startsWith("`")&&d.endsWith("`")?d.slice(1,-1).trim():d}\` `;if(!h){const F=i||120,U=s||120;return`@VeesoMaterial(${JSON.stringify({id:a,url:_,type:"reference",width:F,height:U,aspectRatio:Math.round(100*F/U)/100,tag:g||"Backgroun
37d"})})`}const I=i||128,D=s||128;return`@VeesoMaterial(${JSON.stringify({id:a,filename:o,url:_,width:I,height:D,aspectRatio:Math.round(100*I/D)/100,tag:g})})`}updateUsageLabel(e,t){const r=e.querySelector(".usage-trigger");if(r){const a=r.querySelector("span");a&&(a.textContent=t||"Add usage",a.className="truncate");const l=r.querySelector("svg");l&&l.classList.add("flex-shrink-0");const g=r.classList.contains("opacity-100")&&!r.closest(".group").matches(":hover");r.className=`usage-trigger absolute bottom-2 left-1/2 -translate-x-1/2 flex items-center justify-center gap-1.5 text-[10px] font-medium px-2 py-1 rounded-full transition-opacity duration-200 cursor-pointer z-10 max-w-[85%] ${t?"bg-black/60 text-white":"bg-black/60 text-white/90"} shadow-sm backdrop-blur-sm ${g?"opacity-100":"opacity-0"} group-hover:opacity-100`}}createResizeHandles(e,t,r,a){const l=document.createElement("div");l.className="resize-handles",l.style.cssText=` 38 position: absolute; 39 inset: 0; 40 pointer-events: none; 41 opacity: 0; 42 transition: opacity 0.2s ease; 43 `;const g=[{position:"nw",cursor:"nwse-resize",style:"top: -3px; left: -3px;"},{position:"ne",cursor:"nesw-resize",style:"top: -3px; right: -3px;"},{position:"sw",cursor:"nesw-resize",style:"bottom: -3px; left: -3px;"},{position:"se",cursor:"nwse-resize",style:"bottom: -3px; right: -3px;"}],i=()=>{const s=parseFloat(t.getAttribute("data-width"))||128,p=parseFloat(t.getAttribute("data-height"))||128;return s/p};return g.forEach(({position:s,cursor:p,style:h})=>{const o=document.createElement("div");o.className=`resize-handle-${s}`,o.style.cssText=` 44 position: absolute; 45 width: 12px; 46 height: 12px; 47 border-radius: 7px; 48 background: rgb(255, 255, 255); 49 border: 2px solid rgb(23, 23, 23); 50 box-shadow: rgba(0, 0, 0, 0.2) 0px 1px 3px; 51 pointer-events: auto; 52 transition: 0.15s; 53 ${h} 54 cursor: ${p}; 55 z-index: 20; 56 transform: scale(1); 57 `,o.onmouseenter=()=>{o.style.transform="scale(1.2)"},o.onmouseleave=()=>{o.style.transform="scale(1)"};let d=!1,R=0,_=0,I=0,D=0,F=null,U=0,f=0,v="",w="";o.onmousedown=c=>{c.preventDefault(),c.stopPropagation(),d=!0,R=c.clientX,_=c.clientY,I=e.offsetWidth,D=I,U=R,f=_,v=e.style.transition,w=e.style.willChange,e.style.transition="none",e.style.willChange="width",t.setAttribute("draggable","false"),document.body.style.cursor=p,document.body.style.userSelect="none";const S=i(),k=()=>{if(F=null,!d)return;let m=U-R,M=f-_;(s==="nw"||s==="sw")&&(m=-m),(s==="nw"||s==="ne")&&(M=-M);const E=Math.abs(m)>Math.abs(M)?m:M*S,H=to*S,G=Math.max(eo,H),P=Math.max(G,Math.min(no,I+E)),Y=Math.round(P);Y!==D&&(D=Y,e.style.width=`${Y}px`)},A=m=>{d&&(U=m.clientX,f=m.clientY,!F&&(F=requestAnimationFrame(k)))},B=()=>{d=!1,F&&(cancelAnimationFrame(F),F=null),e.style.transition=v,e.style.willChange=w;const m=Math.round(D/S);t.setAttribute("data-width",D),t.setAttribute("data-height",m),r&&(r.previewWidth=D,r.width=D,r.height=m),t.setAttribute("draggable","true"),document.body.style.cursor="",document.body.style.userSelect="",document.removeEventListener("mousemove",A),document.removeEventListener("mouseup",B),a?.({forceHeight:!0})};document.addEventListener("mousemove",A),document.addEventListener("mouseup",B)},l.appendChild(o)}),l}}class io extends Fe{constructor(){super("remix")}match(e){return e.getAttribute("data-type")==="remix"}render(e,t={}){const{makeDraggable:r}=t,{id:a,name:l}=e,g=document.createElement("span");g.contentEditable="false",g.setAttribute("data-type","remix"),g.setAttribute("data-remix-id",a),g.setAttribute("data-remix-name",l),g.setAttribute("data-value",`@VeesoRemix('${a}', '${l}')`),g.className="remix-tag inline-flex items-center gap-1.5 mx-0.5 px-1.5 py-0.5 rounded-full select-none align-baseline transition-all duration-200",g.style.cssText=` 58 background-color: rgba(139, 92, 246, 0.1); 59 color: #7c3aed; 60 font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, monospace; 61 font-size: 0.8125em; 62 font-weight: 500; 63 letter-spacing: -0.01em; 64 line-height: 1.4; 65 border: 1px solid rgba(139, 92, 246, 0.25); 66 border-radius: 9999px; 67 transition: all 0.2s ease; 68 cursor: default; 69 `,r&&r(g);const i=document.createElement("span");i.innerHTML='<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"></path><polyline points="3.27 6.96 12 12.01 20.73 6.96"></polyline><line x1="12" y1="22.08" x2="12" y2="12"></line></svg>',i.style.display="flex",i.style.alignItems="center";const s=document.createElement("span");return s.textContent=l||"Untitled Remix",s.className="pointer-events-none",g.appendChild(i),g.appendChild(s),g}update(e,t,r){const a=e.parentNode;if(!a)return;const l=this.render(t,r);a.replaceChild(l,e)}serialize(e){const t=e.getAttribute("data-remix-id"),r=e.getAttribute("data-remix-name");return`@VeesoRemix('${t}', '${r}')`}}const lo='<svg width="0.8775em" height="1em" viewBox="0 0 21.2344 24.1992" fill="currentColor" aria-label="asterisk"><g><rect height="24.1992" opacity="0" width="21.2344" x="0" y="0"></rect><path d="M10.4531 24.1992C11.2148 24.1992 11.6602 23.7305 11.6602 22.9336C11.6602 22.793 11.6484 22.6289 11.6484 22.4883L11.4844 13.8984L18.7969 18.293C19.0898 18.4688 19.3594 18.5391 19.6641 18.5391C20.3672 18.5391 20.8828 18.0234 20.8828 17.2969C20.8828 16.7461 20.6719
6916.4414 20.0859 16.125L12.4336 12.1055L20.0859 8.07422C20.6719 7.76953 20.8828 7.45312 20.8828 6.91406C20.8828 6.19922 20.3789 5.67188 19.6641 5.67188C19.3594 5.67188 19.0898 5.74219 18.7969 5.91797L11.4844 10.3125L11.6484 1.72266C11.6484 1.57031 11.6602 1.41797 11.6602 1.26562C11.6602 0.46875 11.2148 0.0117188 10.4531 0.0117188C9.69141 0.0117188 9.23438 0.46875 9.23438 1.26562C9.23438 1.41797 9.24609 1.57031 9.24609 1.72266L9.41016 10.3125L2.08594 5.91797C1.79297 5.74219 1.52344 5.67188 1.20703 5.67188C0.503906 5.67188 0 6.1875 0 6.91406C0 7.45312 0.210938 7.76953 0.808594 8.07422L8.46094 12.1055L0.808594 16.125C0.210938 16.4414 0 16.7461 0 17.2969C0 18.0234 0.503906 18.5391 1.20703 18.5391C1.52344 18.5391 1.79297 18.4688 2.08594 18.293L9.41016 13.8984L9.24609 22.4883C9.24609 22.6289 9.23438 22.793 9.23438 22.9336C9.23438 23.7305 9.69141 24.1992 10.4531 24.1992Z" fill="currentColor" fill-opacity="0.85"></path></g></svg>',co=()=>ft(mt());class uo extends Fe{constructor(){super("userskill")}render(e,t){const{makeDraggable:r,onClick:a,onRemove:l}=t,{id:g,name:i,cover:s}=e,p=document.createElement("span");p.contentEditable="false",p.setAttribute("data-type","userskill"),p.setAttribute("data-skill-id",g),i&&p.setAttribute("data-skill-name",i),s&&p.setAttribute("data-skill-cover",s),p.setAttribute("data-value",`@VeesoUserSkill('${g}')`),p.className="userskill-tag group relative inline-flex h-6 items-center gap-1.5 pl-1 pr-2 rounded-md bg-black/[0.03] border border-black/5 hover:border-black/10 transition-all duration-300 select-none align-middle cursor-pointer",r&&r(p),a&&p.addEventListener("click",D=>{p.classList.contains("dragging")||(D.preventDefault(),D.stopPropagation(),a(e,p,D))});const h=document.createElement("div");h.className="relative w-3.5 h-3.5 flex-shrink-0";const o=document.createElement("img");o.className="absolute inset-0 w-3.5 h-3.5 object-cover rounded ring-1 ring-black/5 opacity-0 transition-opacity duration-300",s&&(o.src=s,o.onload=()=>{o.classList.remove("opacity-0"),d.classList.add("opacity-0")});const d=document.createElement("div");d.className="w-3.5 h-3.5 flex items-center justify-center bg-white rounded ring-1 ring-black/5",d.innerHTML=lo;const R=d.querySelector("svg");R&&(R.setAttribute("width","12"),R.setAttribute("height","12"),R.classList.add("text-black/60")),s&&d.classList.add("opacity-0"),h.appendChild(o),h.appendChild(d),p.appendChild(h);const _=document.createElement("span");_.className="text-black/80 text-xs font-medium tracking-tight truncate max-w-[120px] leading-none flex items-center",_.textContent=i||"Loading...",p.appendChild(_);const I=document.createElement("button");return I.type="button",I.className="absolute -top-1.5 -right-1.5 w-4 h-4 bg-black text-white/90 rounded-full flex items-center justify-center shadow-md transition-all duration-200 opacity-0 group-hover:opacity-100 hover:scale-110",I.title="Remove",I.innerHTML=` 70 <svg class="w-2 h-2" fill="none" stroke="currentColor" viewBox="0 0 24 24"> 71 <path stroke-linecap="round" stroke-linejoin="round" stroke-width="3" d="M6 18L18 6M6 6l12 12" /> 72 </svg> 73 `,I.addEventListener("click",D=>{D.preventDefault(),D.stopPropagation(),l?l(e,p):p.remove()}),p.appendChild(I),(!i||!s)&&this.fetchSkill(g,_,o,d,p),p}update(e,t,r){const a=e.parentNode;if(!a)return;const l=this.render(t,r);a.replaceChild(l,e)}async fetchSkill(e,t,r,a,l){try{const g=nn();if(!g){t.textContent==="Loading..."&&(t.textContent="Skill");return}const i=co(),s=await fetch(`${i}/api/user-skills/${e}`,{headers:{Authorization:`Bearer ${g}`}});if(s.ok){const p=await s.json(),h=p.data||p;h.name?(t.textContent=h.name,l&&l.setAttribute("data-skill-name",h.name)):t.textContent==="Loading..."&&(t.textContent="Skill"),h.cover&&(r.src=h.cover,r.onload=()=>{r.classList.remove("opacity-0"),a.classList.add("opacity-0")},l&&l.setAttribute("data-skill-cover",h.cover))}else t.textContent==="Loading..."&&(t.textContent="Skill not found")}catch(g){console.error("Error fetching skill in tag:",g),t.textContent==="Loading..."&&(t.textContent="Skill")}}serialize(e){return e.getAttribute("data-value")||""}}class po extends Fe{constructor(){super("tag")}render(e,t){const{makeDraggable:r}=t,{id:a,label:l,color:g}=e,i=document.createElement("span");return i.contentEditable="false",i.setAttribute("data-type","tag"),i.setAttribute("data-tag-id",a),i.setAttribute("data-label",l),i.setAttribute("data-value",""),i.className=this.getClassName(g),r&&(r(i),i.classList.add("cursor-grab","draggable-item")),i.innerHTML=`<span class="pointer-events-none">#${l}</span>`,i}update(e,t,r){const a=e.parentNode;if(!a)return;const l=this.render(t,r);a.replaceChild(l,e)}getClassName(e){const t={blue:"bg-blue-100/60 text-black/80 ring-blue-200/60 hover:bg-blue-100/80",purple:"bg-violet-100/60 text-black/80 ring-violet-200/60 hover:bg-violet-100/80",green:"bg-emerald-100/60 text-black/80 ring-emerald-200/60 hover:bg-emerald-100/80",orange:"bg-amber-100/60 text-black/80 ring-amber-200/60 hover:bg-amber-100/80",pink:"bg-pink-100/60 text-black/80 ring-pink-200/60 hover:bg-pink-100/80",red:"bg-rose-100/60 text-black/80 ring-rose-200/60 hover:bg-rose-100/80",indigo:"bg-indigo-100/60 text-black/80 ring-indigo-200/60 hover:bg-indigo-100/80",teal:"bg-teal-100/60 text-black/80 ring-teal-200/60 hover:bg-teal-100/80"};return`inline-flex items-center gap-1 mx-0.5 px-2.5 py-0.5 rounded-full text-[13px] font-medium ring-1 ring-inset select-none align-middle cursor-grab draggable-item transition-all duration-200 ${t[e]||t.blue}`}serialize(e){const t=e.getAttribute("data-tag-id"),r=e.getAttribute("data-value")||"";return`[[tag:${t}:${r}]]`}}te.register("color",Ya);te.register("document",Qa);te.register("image",so);te.register("remix",io);te.register("skill",uo);te.register("tag",po);function go(n={}){const{editorRef:e,syncContent:t,makeDraggable:r,removeAssetFromChatState:a,canAddMore:l,toast:g,limits:i={},onColorClick:s,onMaterialClick:p,onSkillClick:h}=n,{MAX_IMAGES:o=20,MAX_DOCUMENTS:d=20,MAX_TAGS:R=10,MAX_COLORS:_=10}=i,I=L=>{const x=window.getSelection();if(!x.rangeCount)return;const T=x.getRangeAt(0);T.deleteContents();const N=document.createTextNode(L);
73T.insertNode(N),T.setStartAfter(N),T.collapse(!0),x.removeAllRanges(),x.addRange(T)},D=(L,x,T,N={})=>{if(!e?.value)return!1;let $="";L==="image"||L==="document"?$=`[data-asset-id="${x}"]`:L==="tag"?$=`[data-tag-id="${x}"]`:L==="color"?$=`[data-color-id="${x}"]`:L==="remix"?$=`[data-remix-id="${x}"]`:L==="skill"&&($=`[data-skill-id="${x}"]`);const q=e.value.querySelector($);return q?(te.update(L,q,T,{...n,...N}),!0):!1},F=L=>te.render("image",L,{makeDraggable:r,onClick:p,onRemove:x=>{a?.(x),t?.({immediate:!0})},onSync:(x={})=>t?.({immediate:!0,...x})}),U=(L,x=null)=>{if(!e?.value)return!1;if(l&&!l("image"))return g?.({title:"Image limit reached",description:`You can add up to ${o} images`,variant:"destructive"}),!1;e.value.focus();const T=window.getSelection();let N;if(x&&x.target)N=document.createRange(),x.position==="before"?N.setStartBefore(x.target):N.setStartAfter(x.target),N.collapse(!0),T.removeAllRanges(),T.addRange(N);else if(!T.rangeCount||!e.value.contains(T.anchorNode)){N=document.createRange(),N.selectNodeContents(e.value),N.collapse(!1),T.removeAllRanges();try{T.addRange(N)}catch{const Q=F(L);
73return e.value.appendChild(Q),e.value.appendChild(document.createTextNode("Â ")),t?.({immediate:!0}),!0}}N=T.getRangeAt(0);const $=F(L);N.insertNode($);const q=document.createTextNode("Â ");N.setStartAfter($),N.insertNode(q),N.setStartAfter(q),N.collapse(!0),T.removeAllRanges();try{T.addRange(N)}catch{}return t?.({immediate:!0}),!0},f=(L,x)=>{D("image",L,x,{makeDraggable:r,onClick:p,onRemove:T=>{a?.(T),t?.({immediate:!0})}}),t?.({immediate:!0})},v=L=>{if(!e?.value)return;const x=e.value.querySelector(`[data-asset-id="${L}"]`);x&&(x.remove(),t?.({immediate:!0}))},w=(L,x={})=>{const{hideMenu:T}=x;if(l&&!l("tag")){g?.({title:"Tag limit reached",description:`You can add up to ${R} tags`,variant:"destructive"}),T?.();return}const N=window.getSelection();if(!N.rangeCount)return;const $=N.getRangeAt(0),q=$.startContainer;if(q.nodeType===Node.TEXT_NODE){const ne=q.textContent.slice(0,$.startOffset).match(/#([^\s#]*)$/);if(ne){$.setStart(q,ne.index),$.deleteContents();const oe=te.render("tag",L,{makeDraggable:r});$.insertNode(oe);const fe=document.createTextNode("Â ");$.setStartAfter(oe),$.insertNode(fe),$.setStartAfter(fe),$.collapse(!0),N.removeAllRanges(),N.addRange($),T?.(),t?.({immediate:!0})}}},c=L=>{if(!e?.value)return;const x=window.getSelection();let T;if(!x.rangeCount||!e.value.contains(x.anchorNode)){T=document.createRange(),T.selectNodeContents(e.value),T.collapse(!1),x.removeAllRanges();try{x.addRange(T)}catch{const q=te.render("color",L,{makeDraggable:r,onClick:s});e.value.appendChild(q),e.value.appendChild(document.createTextNode("Â "));return}}T=x.getRangeAt(0);const N=te.render("color",L,{makeDraggable:r,onClick:s});T.insertNode(N);const $=document.createTextNode("Â ");T.setStartAfter(N),T.insertNode($),T.setStartAfter($),T.collapse(!0),x.removeAllRanges();try{x.addRange(T)}catch{}},S=L=>{if(!e?.value||!pt(L))return;if(l&&!l("color")){g?.({title:"Color limit reached",description:`You can add up to ${_} color tags`,variant:"destructive"});return}e.value.focus();const x=window.getSelection();let T;const N=`color_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,$=Ne(L),q={id:N,value:L,displayValue:$};if(!x.rangeCount||!e.value.contains(x.anchorNode)){T=document.createRange(),T.selectNodeContents(e.value),T.collapse(!1),x.removeAllRanges();try{x.addRange(T)}catch{const oe=te.render("color",q,{makeDraggable:r,onClick:s});e.value.appendChild(oe),e.value.appendChild(document.createTextNode("Â ")),t?.({immediate:!0});return}}T=x.getRangeAt(0);const Q=te.render("color",q,{makeDraggable:r,onClick:s});T.insertNode(Q);const ne=document.createTextNode("Â ");T.setStartAfter(Q),T.insertNode(ne),T.setStartAfter(ne),T.collapse(!0),x.removeAllRanges();try{x.addRange(T)}catch{}t?.({immediate:!0})},k=(L,x,T,N)=>{if(l&&!l("color")){g?.({title:"Color limit reached",description:`You can add up to ${_} color tags`,variant:"destructive"}),t?.();return}const $=`#${T[1]}`,q=T[0],Q=T.index;x.setStart(L,Q),x.setEnd(L,Q+q.length),x.deleteContents();const ne=`color_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,oe=Ne($),fe={id:ne,value:$,displayValue:oe},Ee=te.render("color",fe,{makeDraggable:r,onClick:s});x.insertNode(Ee);const ve=document.createTextNode("Â ");x.setStartAfter(Ee),x.insertNode(ve),x.setStartAfter(ve),x.collapse(!0);const ge=window.getSelection();ge.removeAllRanges(),ge.addRange(x),N?.(),t?.({immediate:!0})},A=(L,x={})=>{const{hideMenu:T}=x;e?.value&&e.value.focus();const N=window.getSelection();let $;const q=()=>te.render("remix",L,{makeDraggable:r});if(!N.rangeCount||e?.value&&!e.value.contains(N.anchorNode)){$=document.createRange(),e?.value&&($.selectNodeContents(e.value),$.collapse(!1)),N.removeAllRanges();try{N.addRange($)}catch{if(e?.value){const oe=q();e.value.appendChild(oe),e.value.appendChild(document.createTextNode("Â ")),t?.({immediate:!0})}return}}else $=N.getRangeAt(0);const Q=q();$.insertNode(Q);const ne=document.createTextNode("Â ");$.setStartAfter(Q),$.insertNode(ne),$.setStartAfter(ne),$.collapse(!0),N.removeAllRanges();try{N.addRange($)}catch{}T?.(),t?.({immediate:!0})},B=(L,x,T)=>{const N=T[0],$=T[1],q=T[2],Q=T.index;x.setStart(L,Q),x.setEnd(L,Q+N.length),x.deleteContents();const ne=te.render("remix",{id:$,name:q},{makeDraggable:r});x.insertNode(ne);const oe=document.createTextNode("Â ");x.setStartAfter(ne),x.insertNode(oe),x.setStartAfter(oe),x.collapse(!0);const fe=window.getSelection();fe.removeAllRanges(),fe.addRange(x),t?.({immediate:!0})},m=(L,x={})=>{const{hideMenu:T}=x;e?.value&&e.value.focus();const N=window.getSelection();let $;const q=()=>te.render("skill",L,{makeDraggable:r,onClick:h,onRemove:()=>{P(L.id)}});if(!N.rangeCount||e?.value&&!e.value.contains(N.anchorNode)){$=document.createRange(),e?.value&&($.selectNodeContents(e.value),$.collapse(!1)),N.removeAllRanges();try{N.addRange($)}catch{if(e?.value){const oe=q();
73e.value.appendChild(oe),e.value.appendChild(document.createTextNode("Â ")),t?.({immediate:!0})}return}}else $=N.getRangeAt(0);const Q=q();$.insertNode(Q);const ne=document.createTextNode("Â ");$.setStartAfter(Q),$.insertNode(ne),$.setStartAfter(ne),$.collapse(!0),N.removeAllRanges();try{N.addRange($)}catch{}T?.(),t?.({immediate:!0})},M=(L,x,T)=>{const N=T[0],$=T[1],q=T.index;x.setStart(L,q),x.setEnd(L,q+N.length),x.deleteContents();const Q=te.render("skill",{id:$},{makeDraggable:r,onClick:h,onRemove:()=>{P($)}});x.insertNode(Q);const ne=document.createTextNode("Â ");x.setStartAfter(Q),x.insertNode(ne),x.setStartAfter(ne),x.collapse(!0);const oe=window.getSelection();oe.removeAllRanges(),oe.addRange(x),t?.({immediate:!0})},E=(L,x,T,N)=>{if(N){const q=N.getAttribute("data-asset-id"),Q=N.getAttribute("data-url"),ne=N.getAttribute("data-filename"),oe=N.getAttribute("data-width"),fe=N.getAttribute("data-height"),Ee=N.getAttribute("data-loading")==="true",ve={id:q,url:Q,name:ne,tag:x,isMaterial:T,width:oe,height:fe,loading:Ee};return te.update("image",N,ve,{makeDraggable:r,onClick:p,onRemove:ge=>a?.(ge),onSync:ge=>t?.(ge)}),t?.({immediate:!0}),!0}const $=e?.value?.querySelector(`[data-asset-id="${L}"]`);if($){const q=$.getAttribute("data-asset-id"),Q=$.getAttribute("data-url"),ne=$.getAttribute("data-filename"),oe=$.getAttribute("data-width"),fe=$.getAttribute("data-height"),Ee=$.getAttribute("data-loading")==="true",ve={id:q,url:Q,name:ne,tag:x,isMaterial:T,width:oe,height:fe,loading:Ee};return te.update("image",$,ve,{makeDraggable:r,onClick:p,onRemove:ge=>a?.(ge),onSync:ge=>t?.(ge)}),t?.({immediate:!0}),!0}return!1},H=(L,x)=>{const T=Ne(x);D("color",L,{id:L,value:x,displayValue:T},{makeDraggable:r,onClick:s}),t?.({immediate:!0})},G=L=>{if(!e?.value)return;const x=e.value.querySelector(`[data-color-id="${L}"]`);x&&(x.remove(),t?.({immediate:!0}))},P=L=>{if(!e?.value)return;const x=e.value.querySelector(`[data-skill-id="${L}"]`);x&&(x.remove(),t?.({immediate:!0}))};return{insertTextAtCursor:I,insertImageNode:U,createImageElement:F,updateImageNode:f,removeImageNodeById:v,insertTag:w,insertColorTagNode:c,insertColorTag:S,insertColorTagFromInput:k,insertRemixTag:A,insertRemixTagFromInput:B,insertUserSkillTag:m,insertUserSkillTagFromInput:M,insertDocumentTag:(L,x=null)=>{if(!e?.value)return;if(l&&!l("document")){g?.({title:"Document limit reached",description:`You can add up to ${d} items`,variant:"destructive"});return}e.value.focus();const T={makeDraggable:r,onRemove:(oe,fe)=>{fe.remove(),a?.(oe.id),t?.({immediate:!0})}},N=window.getSelection();let $;const q=()=>te.render("document",L,T);if(x&&x.target)$=document.createRange(),x.position==="before"?$.setStartBefore(x.target):$.setStartAfter(x.target),$.collapse(!0),N.removeAllRanges(),N.addRange($);else if(!N.rangeCount||!e.value.contains(N.anchorNode)){$=document.createRange(),$.selectNodeContents(e.value),$.collapse(!1),N.removeAllRanges();try{N.addRange($)}catch{const oe=q();e.value.appendChild(oe),e.value.appendChild(document.createTextNode("Â ")),t?.({immediate:!0});return}}$=N.getRangeAt(0);const Q=q();$.insertNode(Q);const ne=document.createTextNode("Â ");$.setStartAfter(Q),$.insertNode(ne),$.setStartAfter(ne),$.collapse(!0),N.removeAllRanges();try{N.addRange($)}catch{}t?.({immediate:!0})},updateDocumentNode:(L,x)=>{D("document",L,x,{makeDraggable:r,onRemove:(T,N)=>{N.remove(),a?.(T.id),t?.({immediate:!0})}}),t?.({immediate:!0})},updateDocumentParsed:(L,x)=>{const T=e?.value?.querySelector(`[data-asset-id="${L}"]`);if(T){const N=L,$=T.getAttribute("data-filename");te.update("document",T,{id:N,filename:$,parsed:x,loading:!1},{makeDraggable:r,onRemove:(q,Q)=>{Q.remove(),a?.(q.id),t?.({immediate:!0})}})}},updateMaterialTag:E,updateColorTag:H,removeColorTag:G,removeUserSkillTag:P,getTagClassName:L=>{const x={blue:"bg-blue-100/60 text-black/80 ring-blue-200/60 hover:bg-blue-100/80",purple:"bg-violet-100/60 text-black/80 ring-violet-200/60 hover:bg-violet-100/80",green:"bg-emerald-100/60 text-black/80 ring-emerald-200/60 hover:bg-emerald-100/80",orange:"bg-amber-100/60 text-black/80 ring-amber-200/60 hover:bg-amber-100/80",pink:"bg-pink-100/60 text-black/80 ring-pink-200/60 hover:bg-pink-100/80",red:"bg-rose-100/60 text-black/80 ring-rose-200/60 hover:bg-rose-100/80",indigo:"bg-indigo-100/60 text-black/80 ring-indigo-200/60 hover:bg-indigo-100/80",teal:"bg-teal-100/60 text-black/80 ring-teal-200/60 hover:bg-teal-100/80"};return`inline-flex items-center gap-1 mx-0.5 px-2.5 py-0.5 rounded-full text-[13px] font-medium ring-1 ring-inset select-none align-middle cursor-grab draggable-item transition-all duration-200 ${x[L]||x.blue}`}}}const fo={class:"p-1.5 max-h-[220px] overflow-y-auto minimal-scrollbar"},mo=["onClick","onMouseenter"],ho={class:"text-[13px] font-medium flex-1"},vo={key:0,class:"text-[10px] px-1.5 py-0.5 bg-neutral-200/60 text-neutral-500 rounded font-mono"},bo={__name:"TagMenu",props:{show:{type:Boolean,default:!1},tags:{type:Array,default:()=>[]},selectedIndex:{type:Number,default:0},position:{type:Object,default:null}},emits:["select","hover","close"],setup(n,{emit:e}){const t=n,r=e,a=W(null),l=ue(()=>t.show&&t.tags.length>0),g=ue(()=>{if(!t.position)return{};const p=typeof window<"u"?window.innerHeight:1080,h=typeof window<"u"?window.innerWidth:1920,o=16,d=208,R=280;let _=t.position.x;_+d>h-o&&(_=h-d-o),_<o&&(_=o);const I=p-t.position.y-o,D=I<R&&t.position.y>I,F={left:`${_}px`,position:"fixed"};return D?F.bottom=`${p-t.position.y+4}px`:F.top=`${t.position.y+24}px`,F}),i=p=>{r("select",p)},s=p=>{r("hover",p)};return(p,h)=>(O(),V(Te,null,[(O(),Re($e,{to:"body"},[n.show?(O(),V("div",{key:0,class:"fixed inset-0 z-40",onClick:h[0]||(h[0]=o=>r("close"))})):re("",!0)])),(O(),Re($e,{to:"body",disabled:!n.position},[me(Ae,{"enter-active-class":"tag-menu-enter","enter-from-class":"tag-menu-enter-from","enter-to-class":"tag-menu-enter-to","leave-active-class":"tag-menu-leave","leave-from-class":"tag-menu-leave-from","leave-to-class":"tag-menu-leave-to"},{default:Se(()=>
73[l.value?(O(),V("div",{key:0,ref_key:"menuRef",ref:a,class:le(["tag-menu mb-2 w-52 bg-white/90 border border-neutral-200/80 rounded-xl shadow-xl shadow-black/10 z-50 overflow-hidden backdrop-blur-xl",n.position?"fixed":"absolute bottom-full left-4"]),style:he(g.value)},[h[1]||(h[1]=y("div",{class:"px-3 pt-2.5 pb-1.5 border-b border-neutral-100/50"},[y("span",{class:"text-[11px] font-medium text-neutral-400 uppercase tracking-wider pl-0.5"},ce("Insert tag"))],-1)),y("div",fo,[(O(!0),V(Te,null,De(n.tags,(o,d)=>(O(),V("div",{key:o.id,class:le(["tag-item flex items-center gap-2.5 px-2.5 py-2 cursor-pointer rounded-lg transition-all duration-200",{"bg-neutral-100 text-neutral-900":d===n.selectedIndex,"text-neutral-600 hover:bg-neutral-50":d!==n.selectedIndex}]),onClick:R=>i(o),onMouseenter:R=>s(d)},[y("span",{class:le(["w-2 h-2 rounded-full ring-2 ring-offset-1 ring-offset-white flex-shrink-0",{"bg-blue-500 ring-blue-500/20":o.color==="blue","bg-violet-500 ring-violet-500/20":o.color==="purple","bg-emerald-500 ring-emerald-500/20":o.color==="green","bg-amber-500 ring-amber-500/20":o.color==="orange","bg-pink-500 ring-pink-500/20":o.color==="pink","bg-rose-500 ring-rose-500/20":o.color==="red","bg-indigo-500 ring-indigo-500/20":o.color==="indigo","bg-teal-500 ring-teal-500/20":o.color==="teal"}])},null,2),y("span",ho,ce(o.label),1),d===n.selectedIndex?(O(),V("kbd",vo,"âµ")):re("",!0)],42,mo))),128))]),h[2]||(h[2]=y("div",{class:"px-3 py-2 border-t border-neutral-100 bg-neutral-50/50 flex items-center gap-3 text-[10px] text-neutral-400"},[y("span",{class:"flex items-center gap-1"},[y("kbd",{class:"px-1 py-0.5 bg-white border border-neutral-200 rounded text-[9px] font-mono"},"â"),y("kbd",{class:"px-1 py-0.5 bg-white border border-neutral-200 rounded text-[9px] font-mono"},"â"),Ot(" navigate ")]),y("span",{class:"flex items-center gap-1"},[y("kbd",{class:"px-1 py-0.5 bg-white border border-neutral-200 rounded text-[9px] font-mono"},"esc"),Ot(" close ")])],-1))],6)):re("",!0)]),_:1})],8,["disabled"]))],64))}},xo=ye(bo,[["__scopeId","data-v-0ffaad86"]]),yo={class:"p-1.5 max-h-[280px] overflow-y-auto minimal-scrollbar"},wo=["onClick","onMouseenter"],ko={key:1,class:"text-xs font-mono"},Co={class:"flex flex-col flex-1 min-w-0"},So={class:"text-[13px] font-medium truncate"},Ao={class:"text-[11px] text-neutral-400 truncate"},_o={key:0,class:"text-[10px] px-1.5 py-0.5 bg-white shadow-sm border border-neutral-100 text-neutral-400 rounded-md font-sans"},To={__name:"CommandMenu",props:{show:{type:Boolean,default:!1},commands:{type:Array,default:()=>[]},selectedIndex:{type:Number,default:0},position:{type:Object,default:()=>({x:0,y:0})}},emits:["select","hover","close"],setup(n,{emit:e}){const t=n,r=e,a=W(null),l=ue(()=>{if(!t.position)return{};const s=typeof window<"u"?window.innerHeight:1080,p=typeof window<"u"?window.innerWidth:1920,h=16,o=256,d=280;let R=t.position.x;R+o>p-h&&(R=p-o-h),R<h&&(R=h);const _=s-t.position.y-h,I=_<d&&t.position.y>_,D={left:`${R}px`};return I?D.bottom=`${s-t.position.y+4}px`:D.top=`${t.position.y+24}px`,D}),g=s=>{r("select",s)},i=s=>{r("hover",s)};return(s,p)=>(O(),Re($e,{to:"body"},[n.show?(O(),V("div",{key:0,class:"fixed inset-0 z-40",onClick:p[0]||(p[0]=h=>r("close"))})):re("",!0),me(Ae,{"enter-active-class":"command-menu-enter","enter-from-class":"command-menu-enter-from","enter-to-class":"command-menu-enter-to","leave-active-class":"command-menu-leave","leave-from-class":"command-menu-leave-from","leave-to-class":"command-menu-leave-to"},{default:Se(()=>[n.show?(O(),V("div",{key:0,ref_key:"menuRef",ref:a,class:"command-menu fixed z-50 w-64 bg-white/90 border border-neutral-200/80 rounded-xl shadow-xl shadow-black/10 overflow-hidden backdrop-blur-xl",style:he(l.value)},[p[2]||(p[2]=y("div",{class:"px-3 pt-2.5 pb-1.5 border-b border-neutral-100/50"},[y("span",{class:"text-[10px] font-semibold text-neutral-400 uppercase tracking-wider pl-1"},ce("Commands"))],-1)),y("div",yo,[(O(!0),V(Te,null,De(n.commands,(h,o)=>(O(),V("div",{key:h.id,class:le(["command-item flex items-center gap-3 px-2.5 py-2 cursor-pointer rounded-lg transition-all duration-200",{"bg-neutral-100 text-neutral-900":o===n.selectedIndex,"text-neutral-600 hover:bg-neutral-50":o!==n.selectedIndex}]),onClick:d=>g(h),onMousedown:p[1]||(p[1]=_e(()=>{},["prevent"])),onMouseenter:d=>i(o)}
73,[y("div",{class:le(["w-8 h-8 rounded-md flex items-center justify-center bg-white border border-neutral-100 shadow-sm text-neutral-500",{"text-neutral-900 border-neutral-200":o===n.selectedIndex}])},[h.icon?(O(),Re(ca(h.icon),{key:0,class:"w-4 h-4"})):(O(),V("span",ko,ce(h.shortcut||"/"),1))],2),y("div",Co,[y("span",So,ce(h.label),1),y("span",Ao,ce(h.description),1)]),o===n.selectedIndex?(O(),V("kbd",_o," âµ ")):re("",!0)],42,wo))),128))])],4)):re("",!0)]),_:1})]))}},Eo=ye(To,[["__scopeId","data-v-6cf40d93"]]),No={class:"p-4 pb-2"},Ro={class:"flex items-center gap-3 mb-4"},Mo={class:"flex-1 relative group"},$o=["value"],Do={class:"px-4 pb-4 flex-1 overflow-y-auto custom-scrollbar"},Io={class:"grid grid-cols-8 gap-2"},Lo=["onClick","title"],Po={class:"p-3 border-t border-neutral-100 bg-neutral-50/50 flex items-center justify-between gap-2"},Fo={class:"flex items-center gap-2"},jo=["disabled"],Ye=280,Bo=380,ze=16,Oo={__name:"ColorPopover",props:{show:{type:Boolean,default:!1},colorId:{type:String,default:""},colorValue:{type:String,default:"#000000"},position:{type:Object,default:()=>({x:0,y:0})}},emits:["update","close","delete"],setup(n,{emit:e}){const t=n,r=e,a=W(t.colorValue),l=W(null),g=W(null),i=W(!1),s=W(!1),p=["#FFFFFF","#FAFAFA","#E5E5E5","#A3A3A3","#737373","#404040","#171717","#000000","#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#3B82F6","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899","#7F1D1D","#7C2D12","#713F12","#365314","#14532D","#164E63","#1E3A8A","#4C1D95"];an(()=>{s.value="EyeDropper"in window}),Ce(()=>t.colorValue,w=>{i.value||(a.value=w)}),Ce(()=>t.show,async w=>{w&&(a.value=t.colorValue,await Pe(),l.value?.focus(),l.value?.select())});const h=ue(()=>pt(a.value)?Ne(a.value):Ne(t.colorValue)),o=ue(()=>pt(a.value)),d=w=>{let c=w.target.value;c&&!c.startsWith("#")&&/^[0-9A-Fa-f]/.test(c)&&(c="#"+c),a.value=c},R=w=>{a.value=w},_=()=>{o.value&&(r("update",{id:t.colorId,value:h.value}),r("close"))},I=()=>{r("delete",t.colorId),r("close")},D=async()=>{if(!window.EyeDropper)return;const w=new window.EyeDropper;try{const c=await w.open();a.value=c.sRGBHex}catch{}},F=w=>{w.key==="Enter"?(w.preventDefault(),_()):w.key==="Escape"&&(w.preventDefault(),r("close"))},U=w=>{const S=gt(w)>200;return{backgroundColor:w,boxShadow:S?"inset 0 0 0 1px rgba(0,0,0,0.06)":"none"}},f=ue(()=>{const{x:w,y:c}=t.position,S=typeof window<"u"?window.innerWidth:1920,k=typeof window<"u"?window.innerHeight:1080,A=Ye/2;let B=w;w-A<ze&&(B=A+ze),w+A>S-ze&&(B=S-A-ze);const m=k-c-ze,M=m<Bo&&c>m;return{x:B,y:c,showAbove:M}}),v=ue(()=>{const{x:w,y:c,showAbove:S}=f.value,k=typeof window<"u"?window.innerHeight:1080,A={left:`${w-Ye/2}px`,width:`${Ye}px`};return S?A.bottom=`${k-c+8}px`:A.top=`${c+8}px`,A});return(w,c)=>(O(),Re($e,{to:"body"},[n.show?(O(),V("div",{key:0,class:"fixed inset-0 z-[99]",onClick:c[0]||(c[0]=S=>r("close"))})):re("",!0),me(Ae,{"enter-active-class":"transition-all duration-200 ease-out","enter-from-class":"opacity-0 scale-95 translate-y-2","enter-to-class":"opacity-100 scale-100 translate-y-0","leave-active-class":"transition-all duration-150 ease-in","leave-from-class":"opacity-100 scale-100","leave-to-class":"opacity-0 scale-95"},{default:Se(()=>[n.show?(O(),V("div",{key:0,ref_key:"popoverRef",ref:g,class:"color-popover fixed z-[100] bg-white/90 backdrop-blur-xl border border-white/20 rounded-2xl shadow-2xl shadow-black/10 overflow-hidden flex flex-col",style:he([v.value,{width:`${Ye}px`}]),onClick:c[4]||(c[4]=_e(()=>{},["stop"])),onMousedown:c[5]||(c[5]=_e(()=>{},["stop"]))},[y("div",No,[y("div",Ro,[y("div",{class:"w-10 h-10 rounded-full shadow-sm ring-1 ring-black/5 flex-shrink-0 transition-colors duration-200",style:he(U(h.value))},null,4),y("div",Mo,[c[7]||(c[7]=y("span",{class:"absolute left-3 top-1/2 -translate-y-1/2 text-neutral-400 font-mono text-sm pointer-events-none select-none"},"#",-1)),y("input",{ref_key:"inputRef",ref:l,value:a.value.replace("#",""),onInput:d,onKeydown:F,onFocus:c[1]||(c[1]=S=>i.value=!0),onBlur:c[2]||(c[2]=S=>i.value=!1),type:"text",maxlength:"6",class:"w-full py-2.5 pl-7 pr-8 text-sm font-mono text-black/80 dark:text-white/80 uppercase tracking-wider border border-solid border-black/[0.02] dark:border-white/[0.02] bg-black/5 dark:bg-white/5 rounded-lg shadow-none placeholder:text-black/30 dark:placeholder:text-white/30 focus:ring-0 focus-visible:ring-0 focus:outline-none focus-visible:outline-none",placeholder:"000000"},null,40,$o),s.value?(O(),V("button",{key:0,class:"absolute right-2 top-1/2 -translate-y-1/2 p-1 text-neutral-400 hover:text-neutral-700 rounded-md hover:bg-black/5 transition-colors",title:"Pick color from screen",onClick:D},[...c[6]||(c[6]=[y("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[y("path",{d:"m2 22 1-1h3l9-9"}),y("path",{d:"M3 21v-3l9-9"}),y("path",{d:"m15 6 3.4-3.4a2.1 2.1 0 1 1 3 3L5 21l-3 1 1-3L15 6Z"})],-1)])])):re("",!0)])]),c[8]||(c[8]=y("div",{class:"h-px bg-neutral-100 w-full mb-1"},null,-1))]),y("div",Do,[c[9]||(c[9]=y("div",{class:"text-[10px] font-semibold text-neutral-400 uppercase tracking-widest mb-3 pl-0.5"},ce("Palette"),-1)),y("div",Io,[(O(),V(Te,null,De(p,S=>y("button",{key:S,class:"group relative w-full pt-[100%] rounded-full cursor-pointer focus:outline-none",onClick:k=>R(S),title:S}
73,[y("div",{class:le(["absolute inset-0 rounded-full transition-all duration-200 transform group-hover:scale-110 group-focus:scale-110",{"ring-2 ring-offset-2 ring-neutral-900 z-10 scale-110":h.value.toLowerCase()===S.toLowerCase(),"hover:shadow-md":h.value.toLowerCase()!==S.toLowerCase()}]),style:he(U(S))},null,6)],8,Lo)),64))])]),y("div",Po,[y("button",{class:"p-2 text-neutral-400 hover:text-red-500 hover:bg-red-50 rounded-lg transition-colors group",title:"Delete",onClick:I},[...c[10]||(c[10]=[y("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"transition-transform group-hover:scale-110"},[y("path",{d:"M3 6h18"}),y("path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"}),y("path",{d:"M8 6V4c0-1 1-2 2-2h4c0 1 1 2 2 2v2"})],-1)])]),y("div",Fo,[y("button",{class:"px-3 py-2 text-xs font-medium text-neutral-500 hover:text-neutral-800 hover:bg-neutral-100 rounded-lg transition-colors",onClick:c[3]||(c[3]=S=>r("close"))},ce("Cancel")),y("button",{class:"px-4 py-2 text-xs font-semibold text-white bg-neutral-900 hover:bg-black rounded-lg shadow-sm hover:shadow transition-all transform active:scale-95 disabled:opacity-50 disabled:cursor-not-allowed",disabled:!o.value,onClick:_},ce("Apply Color"),8,jo)])])],36)):re("",!0)]),_:1})]))}},Uo=ye(Oo,[["__scopeId","data-v-f7dd76b4"]]),zo={class:"w-full rounded-xl overflow-hidden",style:{"max-height":"calc(400px - 24px)"}},Ho=["src"],Wo={class:"flex gap-2 mb-4"},Vo={key:0,class:"flex-1"},qo={class:"grid grid-cols-2 gap-1.5"},Xo=["onClick"],Go={key:0,class:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Ko={key:1,class:"flex-1 flex flex-col"},Yo={class:"grid grid-cols-3 gap-1.5 mb-3"},Jo=["onClick"],Zo={class:"mt-auto flex items-center gap-1.5"},Qo=["disabled"],Yt=160,Jt=344,er=360,He=16,tr={__name:"MaterialPopover",props:{show:{type:Boolean,default:!1},assetId:{type:String,default:""},assetUrl:{type:String,default:""},currentTag:{type:String,default:""},isMaterial:{type:Boolean,default:!0},position:{type:Object,default:()=>({x:0,y:0})}},emits:["update","close"],setup(n,{emit:e}){const t=n,r=e,a=W(t.isMaterial?"material":"reference"),l=W(""),g=W(""),i=W(null),s=[{id:"all",label:"All"},{id:"layout",label:"Layout"},{id:"style",label:"Style"},{id:"color",label:"Color"},{id:"texture",label:"Texture"},{id:"copy",label:"Copy"},{id:"font",label:"Font"}],p=m=>typeof m=="string"?m.trim():"",h=m=>{const M=p(m);return M?M.split(",").map(E=>E.trim()).filter(Boolean):[]},o=W(!t.isMaterial&&t.currentTag?h(t.currentTag):t.isMaterial?[]:s.map(m=>m.id)),d=[{id:"background",label:"Background"},{id:"product",label:"Product"},{id:"model",label:"Model"},{id:"logo",label:"Logo"},{id:"qrcode",label:"QR Code"},{id:"icon",label:"Icon"},{id:"decoration",label:"Decoration"},{id:"texture",label:"Texture"},{id:"chart",label:"Chart"}],R=m=>{const M=p(m);if(!M)return"";const E=M.toLowerCase(),H=d.find(P=>P.id.toLowerCase()===E);if(H)return H.label;const G=d.find(P=>P.label.toLowerCase()===E);return G?G.label:M},_=Yt+Jt;l.value=t.isMaterial?R(t.currentTag):"",Ce(()=>t.show,async m=>{m&&(a.value=t.isMaterial?"material":"reference",l.value=t.isMaterial?R(t.currentTag):"",t.isMaterial?o.value=[]:o.value=t.currentTag?h(t.currentTag):s.map(M=>M.id),g.value="",await Pe(),i.value?.focus?.())});function I(){a.value!=="reference"&&(a.value="reference",o.value=s.map(m=>m.id),g.value="",c())}function D(){if(a.value==="material")return;a.value="material";const m="Background";l.value=m,g.value="",r("update",{id:t.assetId,tag:m,isMaterial:!0})}function F(m){l.value=m,r("update",{id:t.assetId,tag:m,isMaterial:!0}),r("close")}function U(){g.value.trim()&&(l.value=g.value.trim(),r("update",{id:t.assetId,tag:g.value.trim(),isMaterial:!0}),g.value="",r("close"))}function f(m){return a.value==="material"&&l.value===m}const v=s.filter(m=>m.id!=="all").map(m=>m.id);function w(m){if(m==="all")o.value.includes("all")?o.value=[]:o.value=s.map(M=>M.id);else{const M=o.value.indexOf(m);
73if(M===-1)o.value.push(m),v.every(E=>o.value.includes(E))&&(o.value.includes("all")||o.value.push("all"));else{o.value.splice(M,1);const E=o.value.indexOf("all");E!==-1&&o.value.splice(E,1)}}c()}function c(){const m=o.value.map(M=>s.find(E=>M===E.id)).filter(M=>M).map(M=>M.id).join(",");r("update",{id:t.assetId,tag:m,isMaterial:!1})}function S(m){return a.value==="reference"&&o.value.includes(m)}const k=ue(()=>{const{x:m,y:M}=t.position,E=typeof window<"u"?window.innerWidth:1920,H=typeof window<"u"?window.innerHeight:1080,G=_/2;let P=m;m-G<He&&(P=G+He),m+G>E-He&&(P=E-G-He);const Y=H-M-He,K=Y<er&&M>Y;return{x:P,y:M,showAbove:K}}),A=ue(()=>{const{x:m,y:M,showAbove:E}=k.value,H=typeof window<"u"?window.innerHeight:1080,G={left:`${m-_/2}px`,width:`${_}px`};return E?G.bottom=`${H-M+8}px`:G.top=`${M+8}px`,G}),B=m=>{m.key==="Enter"?(m.preventDefault(),U()):m.key==="Escape"&&(m.preventDefault(),r("close"))};return(m,M)=>(O(),Re($e,{to:"body"},[n.show?(O(),V("div",{key:0,class:"fixed inset-0 z-[99]",onClick:M[0]||(M[0]=E=>r("close"))})):re("",!0),me(Ae,{"enter-active-class":"transition-all duration-200 ease-out","enter-from-class":"opacity-0 scale-95 translate-y-2","enter-to-class":"opacity-100 scale-100 translate-y-0","leave-active-class":"transition-all duration-150 ease-in","leave-from-class":"opacity-100 scale-100","leave-to-class":"opacity-0 scale-95"},{default:Se(()=>[n.show?(O(),V("div",{key:0,class:"material-popover fixed z-[100] bg-white border-[0.5px] border-black/15 rounded-2xl overflow-hidden flex flex-row",style:he([A.value,{width:`${_}px`,maxHeight:"400px"}]),onClick:M[3]||(M[3]=_e(()=>{},["stop"])),onMousedown:M[4]||(M[4]=_e(()=>{},["stop"]))},[y("div",{class:"flex-none bg-black/[0.02] flex items-center justify-center p-3",style:he({width:`${Yt}px`,maxHeight:"400px"})},[y("div",zo,[y("img",{src:n.assetUrl,alt:"Preview",class:"w-full h-full object-contain",style:{"max-height":"calc(400px - 24px)"}},null,8,Ho)])],4),y("div",{class:"flex-1 p-3 flex flex-col overflow-y-auto minimal-scrollbar",style:he({width:`${Jt}px`})},[M[10]||(M[10]=y("h3",{class:"text-black/40 font-normal text-sm mb-2 px-2"},"Use as",-1)),y("div",Wo,[y("button",{type:"button",onClick:I,class:le(["flex-1 p-3 rounded-lg border transition-all duration-200 text-left flex flex-col items-start gap-2",a.value==="reference"?"bg-white border-transparent shadow-[0_4px_12px_rgba(254,113,59,0.08)]":"bg-transparent border-black/5 hover:border-black/10"]),style:he(a.value==="reference"?"box-shadow: 0 0 0 1px #FE713B":"")},[y("div",{class:le(["w-8 h-8 rounded-lg flex items-center justify-center transition-all duration-200",a.value==="reference"?"bg-[#FE713B]/10 text-[#FE713B]":"bg-black/5 text-black/40"])},[...M[5]||(M[5]=[y("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"},[y("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),y("path",{d:"M2 17l10 5 10-5"}),y("path",{d:"M2 12l10 5 10-5"})],-1)])],2),y("span",{class:le(["text-sm font-medium transition-colors duration-200",a.value==="reference"?"text-black/90":"text-black/60"]),style:{"line-height":"1.2"}}," Design reference ",2)],6),y("button",{type:"button",onClick:D,class:le(["flex-1 p-3 rounded-lg border transition-all duration-200 text-left flex flex-col items-start gap-2",a.value==="material"?"bg-white border-transparent shadow-[0_4px_12px_rgba(254,113,59,0.08)]":"bg-transparent border-black/5 hover:border-black/10"]),style:he(a.value==="material"?"box-shadow: 0 0 0 1px #FE713B":"")},[y("div",{class:le(["w-8 h-8 rounded-lg flex items-center justify-center transition-all duration-200",a.value==="material"?"bg-[#FE713B]/10 text-[#FE713B]":"bg-black/5 text-black/40"])},[...M[6]||(M[6]=[y("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"},[y("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),y("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),y("polyline",{points:"21 15 16 10 5 21"})],-1)])],2),y("span",{class:le(["text-sm font-medium transition-colors duration-200",a.value==="material"?"text-black/90":"text-black/60"]),style:{"line-height":"1.2"}}," My assets in design ",2)],6)]),a.value==="reference"?(O(),V("div",Vo,[M[8]||(M[8]=y("div",{class:"text-black/40 text-sm mb-2 px-2"},"Reference points",-1)),y("div",qo,[(O(),V(Te,null,De(s,E=>
73y("button",{key:E.id,class:le(["group/tag flex items-center gap-2 p-2 rounded-lg border border-black/5 hover:border-black/10 bg-transparent transition-all duration-200 text-left focus-visible:outline-none active:scale-[0.98]",E.id==="all"?"col-span-2":""]),onClick:H=>w(E.id),type:"button"},[y("div",{class:le(["w-4 h-4 rounded flex items-center justify-center border-2 transition-all duration-200 flex-shrink-0",S(E.id)?"bg-[#FE713B] border-[#FE713B]":"bg-transparent border-black/20"])},[S(E.id)?(O(),V("svg",Go,[...M[7]||(M[7]=[y("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"3",d:"M5 13l4 4L19 7"},null,-1)])])):re("",!0)],2),y("span",{class:le(["text-sm font-medium transition-colors duration-200",S(E.id)?"text-black/90":"text-black/60"]),style:{"line-height":"1.2"}},ce(E.label),3)],10,Xo)),64))])])):re("",!0),a.value==="material"?(O(),V("div",Ko,[M[9]||(M[9]=y("div",{class:"text-black/40 text-sm mb-2 px-2"},"Asset type",-1)),y("div",Yo,[(O(),V(Te,null,De(d,E=>y("button",{key:E.id,class:le(["group/tag flex items-start p-2 rounded-lg border transition-all duration-200 text-left focus-visible:outline-none active:scale-[0.98]",f(E.label)?"bg-white border-transparent":"bg-transparent border-black/5 hover:border-black/10"]),style:he(f(E.label)?"box-shadow: 0 0 0 1px #FE713B":""),onClick:H=>F(E.label),type:"button"},[y("span",{class:le(["text-sm font-medium transition-colors duration-200",f(E.label)?"text-black/90":"text-black/60"]),style:{"line-height":"1.2"}},ce(E.label),3)],14,Jo)),64))]),y("div",Zo,[on(y("input",{ref_key:"inputRef",ref:i,"onUpdate:modelValue":M[1]||(M[1]=E=>g.value=E),type:"text",placeholder:"Custom usage",class:"flex-1 h-8 text-sm px-3 border border-solid border-black/[0.02] dark:border-white/[0.02] rounded-lg bg-black/5 dark:bg-white/5 shadow-none focus:outline-none focus:ring-0 transition-colors placeholder:text-black/30 dark:placeholder:text-white/30",onKeydown:B,onClick:M[2]||(M[2]=_e(()=>{},["stop"]))},null,544),[[rn,g.value]]),y("button",{onClick:U,disabled:!g.value.trim(),type:"button",class:"h-8 px-3 bg-transparent border border-black/5 text-black/70 text-sm font-medium rounded-xl hover:border-black/10 hover:text-black/90 active:scale-95 transition-all duration-200 disabled:opacity-30 disabled:cursor-not-allowed"}," Add ",8,Qo)])])):re("",!0)],4)],36)):re("",!0)]),_:1})]))}},nr=ye(tr,[["__scopeId","data-v-606c807e"]]),dn=()=>{const{request:n}=Ia();return{listSkills:async(o={})=>n("/api/user-skills",{query:o}),listPublicSkills:async(o={})=>n("/api/user-skills/public",{query:o}),listRecommendedSkills:async(o={})=>n("/api/user-skills/recommended",{query:o}),getSkill:async o=>n(`/api/user-skills/${o}`),createSkill:async o=>n("/api/user-skills",{method:"POST",body:o}),updateSkill:async(o,d)=>n(`/api/user-skills/${o}`,{method:"PUT",body:d}),forkSkill:async o=>n(`/api/user-skills/${o}/fork`,{method:"POST"}),deleteSkill:async o=>n(`/api/user-skills/${o}`,{method:"DELETE"}),analyzeSkillImage:async(o,d)=>n("/api/user-skills/analyze",{method:"POST",body:{assetIds:Array.isArray(o)?o:[o],instruction:d}}),incrementSkillUsage:async o=>n(`/api/user-skills/${o}/use`,{method:"POST"})}},ar={key:0,class:"p-4 flex flex-col items-center justify-center gap-3"},or={key:1,class:"p-4 flex flex-col items-center justify-center gap-3"},rr={class:"text-xs text-red-500"},sr={class:"relative w-full h-48 overflow-hidden"},ir=["src","alt"],lr={key:1,class:"w-full h-full flex items-center justify-center bg-black/[0.03]"},cr={key:2,class:"absolute top-3 left-3 flex flex-wrap gap-1 max-w-[90%]"},dr={key:0,class:"px-2 py-0.5 rounded-md bg-black/40 backdrop-blur-md text-[10px] font-medium text-white/90 border border-white/10"},ur={class:"p-4 overflow-y-auto flex-1 border-t border-black/5"},pr={class:"text-sm font-bold text-black/80 mb-1"},gr={class:"text-xs text-black/50 leading-relaxed whitespace-pre-wrap break-words"},dt=320,We=16,fr={__name:"SkillPopover",props:{show:{type:Boolean,default:!1},skillId:{type:String,default:""},position:{type:Object,default:()=>({x:0,y:0})}},emits:["close","remove"],setup(n,{emit:e}){const t=n,r=e,a=W(null),l=W(!1),g=W(null),i=W(null),{getSkill:s}=dn();Ce(()=>t.show,async d=>{d&&t.skillId?p():d||(a.value=null,g.value=null)}),Ce(()=>t.skillId,d=>{t.show&&d&&p()});const p=async()=>{l.value=!0,g.value=null;try{const d=await s(t.skillId);d&&(d.id||d.data)?a.value=d.data||d:g.value="Failed to load skill data"}catch(d){console.error("Error fetching skill:",d),g.value=d.message||"Error loading skill"}finally{l.value=!1}},h=ue(()=>{const{x:d,y:R}=t.position,_=typeof window<"u"?window.innerWidth:1920,I=typeof window<"u"?window.innerHeight:1080,D=dt/2;let F=d;d-D<We&&(F=D+We),d+D>_-We&&(F=_-D-We);const U=I-R-We,f=U<300&&R>U;return{x:F,y:R,showAbove:f}}),o=ue(()=>{const{x:d,y:R,showAbove:_}=h.value,I=typeof window<"u"?window.innerHeight:1080,D={left:`${d-dt/2}px`,width:`${dt}px`};return _?D.bottom=`${I-R+8}px`:D.top=`${R+8}px`,D});return(d,R)=>(O(),Re($e,{to:"body"},[n.show?(O(),V("div",{key:0,class:"fixed inset-0 z-[99]",onClick:R[0]||(R[0]=_=>r("close"))})):re("",!0),me(Ae,{"enter-active-class":"transition-all duration-200 ease-out","enter-from-class":"opacity-0 scale-95 translate-y-2","enter-to-class":"opacity-100 scale-100 translate-y-0","leave-active-class":"transition-all duration-150 ease-in","leave-from-class":"opacity-100 scale-100","leave-to-class":"opacity-0 scale-95"},{default:Se(()=>[n.show?(O(),V("div",{key:0,ref_key:"popoverRef",ref:i,class:"skill-popover fixed z-[100] bg-white rounded-3xl border-[0.5px] border-black/15 shadow-[0_0_20px_rgba(0,0,0,0.1)] overflow-hidden flex flex-col max-h-[80vh]",style:he(o.value),onClick:R[1]||(R[1]=_e(()=>{},["stop"])),onMousedown:R[2]||(R[2]=_e(()=>{},["stop"]))},[l.value?(O(),V("div",ar,[...R[3]||(R[3]=[y("div",{class:"w-6 h-6 border border-black/20 rounded-full animate-spin"},null,-1),y("div",{class:"text-sm text-black/40"},"Loading skill details...",-1)])])):g.value?(O(),V("div",or,[y("div",rr,ce(g.value),1),y("button",{onClick:p,class:"text-[10px] font-medium text-black/50 hover:text-black/80 underline"}," Retry ")])):a.value?(O(),V(Te,{key:2},[y("div",sr,[a.value.cover?(O(),V("img",{key:0,src:a.value.cover,class:"w-full h-full object-contain",alt:a.value.name},null,8,ir)):(O(),V("div",lr,[...R[4]||(R[4]=[y("svg",{class:"w-8 h-8 text-black/20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1"},[y("path",{d:"M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5"})],-1)])])),a.value.tags&&a.value.tags.length?(O(),V("div",cr,[(O(!0),V(Te,null,De(a.value.tags.slice(0,2),_=>(O(),V("div",{key:_.id||_.name,class:"px-2 py-0.5 rounded-md bg-black/40 backdrop-blur-md text-[10px] font-medium text-white/90 border border-white/10"},ce(_.name),1))),128)),a.value.tags.length>2?(O(),V("div",dr," +"+ce(a.value.tags.length-2),1)):re("",!0)])):re("",!0)]),y("div",ur,[y("h3",pr,ce(a.value.name),1),y("p",gr,ce(a.value.description||"No description provided."),1)])],64)):re("",!0)],36)):re("",!0)]),_:1})]))}},mr={class:"p-3 border-b border-black/5"},hr={class:"relative flex items-center"},vr={class:"flex-1 overflow-y-auto min-h-[100px] p-2 custom-scrollbar"},br={key:0,class:"flex flex-col items-center justify-center py-8 gap-2"},xr={key:1,class:"flex flex-col items-center justify-center py-8 text-black/30"},yr={key:2,class:"grid grid-cols-1 gap-1"},wr=["onClick","onMousemove"],kr={class:"w-10 h-10 rounded-lg bg-black/[0.03] overflow-hidden flex-shrink-0"},Cr=["src"],Sr={key:1,class:"w-full h-full flex items-center justify-center"},Ar={class:"flex-1 min-w-0"},_r={class:"text-[11px] font-bold text-black/80 truncate"},Tr={class:"text-[10px] text-black/40 truncate"},ut=320,Ve=16,Er={__name:"SkillSelectorPopover",props:{show:{type:Boolean,default:!1},position:{type:Object,default:()=>({x:0,y:0})}},emits:["close","select"],setup(n,{emit:e}){const t=n,r=e,a=W([]),l=W(!1),g=W(null),i=W(""),s=W(null),p=W(0),h=W(null),o=W([]),{listPublicSkills:d}=dn();Ce(()=>t.show,async v=>{v&&(p.value=0,a.value.length===0&&await I(),Pe(()=>{h.value?.focus()}))}),Ce(i,()=>{p.value=0});const R=v=>{D.value.length!==0&&(v.key==="ArrowDown"?(v.preventDefault(),p.value=(p.value+1)%D.value.length,_()):v.key==="ArrowUp"?(v.preventDefault(),p.value=(p.value-1+D.value.length)%D.value.length,_()):v.key==="Enter"&&(v.preventDefault(),F(D.value[p.value])))},_=()=>{Pe(()=>{const v=o.value[p.value];v&&v.scrollIntoView({block:"nearest"})})},I=async()=>{l.value=!0,g.value=null;try{const v=await d({q:i.value,limit:50});a.value=v.rows||v||[]}catch(v){console.error("Error fetching skills:",v),g.value="Failed to load skills"}finally{l.value=!1}},D=ue(()=>{if(!i.value)return a.value;const v=i.value.toLowerCase();return a.value.filter(w=>w.name.toLowerCase().includes(v)||w.description&&w.description.toLowerCase().includes(v))}),F=v=>{r("select",v),r("close")},U=ue(()=>{const{x:v,y:w}=t.position,c=typeof window<"u"?window.innerWidth:1920,S=typeof window<"u"?window.innerHeight:1080,
73k=ut/2;let A=v;v-k<Ve&&(A=k+Ve),v+k>c-Ve&&(A=c-k-Ve);const B=S-w-Ve,m=B<400&&w>B;return{x:A,y:w,showAbove:m}}),f=ue(()=>{const{x:v,y:w,showAbove:c}=U.value,S=typeof window<"u"?window.innerHeight:1080,k={left:`${v-ut/2}px`,width:`${ut}px`};return c?k.bottom=`${S-w+8}px`:k.top=`${w+8}px`,k});return(v,w)=>(O(),Re($e,{to:"body"},[n.show?(O(),V("div",{key:0,class:"fixed inset-0 z-[99]",onClick:w[0]||(w[0]=c=>r("close"))})):re("",!0),me(Ae,{"enter-active-class":"transition-all duration-200 ease-out","enter-from-class":"opacity-0 scale-95 translate-y-2","enter-to-class":"opacity-100 scale-100 translate-y-0","leave-active-class":"transition-all duration-150 ease-in","leave-from-class":"opacity-100 scale-100","leave-to-class":"opacity-0 scale-95"},{default:Se(()=>[n.show?(O(),V("div",{key:0,ref_key:"popoverRef",ref:s,class:"fixed z-[100] bg-white rounded-2xl border-[0.5px] border-black/15 shadow-[0_8px_30px_rgb(0,0,0,0.12)] overflow-hidden flex flex-col max-h-[400px]",style:he(f.value),onClick:w[2]||(w[2]=_e(()=>{},["stop"]))},[y("div",mr,[y("div",hr,[on(y("input",{ref_key:"inputRef",ref:h,"onUpdate:modelValue":w[1]||(w[1]=c=>i.value=c),type:"text",placeholder:"Search skills...",class:"w-full h-9 pl-8 pr-3 text-xs border border-solid border-black/[0.02] dark:border-white/[0.02] bg-black/5 dark:bg-white/5 rounded-lg shadow-none placeholder:text-black/30 dark:placeholder:text-white/30 focus:ring-0 focus-visible:ring-0 focus:outline-none focus-visible:outline-none",onInput:I,onKeydown:R},null,544),[[rn,i.value]]),w[3]||(w[3]=y("svg",{class:"absolute left-2.5 w-3.5 h-3.5 text-black/30",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[y("circle",{cx:"11",cy:"11",r:"8"}),y("path",{d:"m21 21-4.3-4.3"})],-1))])]),y("div",vr,[l.value&&a.value.length===0?(O(),V("div",br,[...w[4]||(w[4]=[y("div",{class:"w-5 h-5 border-2 border-black/10 border-t-black/40 rounded-full animate-spin"},null,-1),y("span",{class:"text-[10px] text-black/40"},"Loading skills...",-1)])])):D.value.length===0?(O(),V("div",xr,[...w[5]||(w[5]=[y("svg",{class:"w-8 h-8 mb-2 opacity-20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor"},[y("path",{d:"M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5"})],-1),y("span",{class:"text-[10px]"},"No skills found",-1)])])):(O(),V("div",yr,[(O(!0),V(Te,null,De(D.value,(c,S)=>(O(),V("button",{key:c.id,ref_for:!0,ref:k=>{k&&(o.value[S]=k)},class:le(["group flex items-center gap-3 p-2 rounded-xl transition-all text-left",{"bg-black/[0.05]":S===p.value,"hover:bg-black/[0.03]":S!==p.value}]),onClick:k=>F(c),onMousemove:k=>p.value=S},[y("div",kr,[c.cover?(O(),V("img",{key:0,src:c.cover,class:"w-full h-full object-cover group-hover:scale-110 transition-transform duration-500"},null,8,Cr)):(O(),V("div",Sr,[...w[6]||(w[6]=[y("svg",{class:"w-4 h-4 text-black/10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor"},[y("path",{d:"M12 2L2 7l10 5 10-5-10-5z"})],-1)])]))]),y("div",Ar,[y("div",_r,ce(c.name),1),y("div",Tr,ce(c.category||"General"),1)])],42,wr))),128))]))])],4)):re("",!0)]),_:1})]))}},Nr=ye(Er,[["__scopeId","data-v-061699ba"]]);function Zt(...n){return va(ba(...n))}const Rr={},Mr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function $r(n,e){return O(),V("svg",Mr,[...e[0]||(e[0]=[y("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2"},null,-1),y("circle",{cx:"9",cy:"9",r:"2"},null,-1),y("path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"},null,-1)])])}const Dr=ye(Rr,[["render",$r]]),Ir={},Lr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function Pr(n,e){return O(),V("svg",Lr,[...e[0]||(e[0]=[y("path",{d:"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"},null,-1),y("polyline",{points:"14 2 14 8 20 8"},null,-1)])])}const Fr=ye(Ir,[["render",Pr]]),jr={},Br={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function Or(n,e){return O(),V("svg",Br,[...e[0]||(e[0]=[da('<path d="m19 11-8-8-8.6 8.6a2 2 0 0 0 0 2.8l5.2 5.2c.8.8 2 .8 2.8 0L19 11Z"></path><path d="m5 21 1-1"></path><path d="m19 11 1 1"></path><path d="M15 7l1 1"></path><path d="M8 14h.01"></path>',5)])])}const Ur=ye(jr,[["render",Or]]),zr={},Hr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function Wr(n,e){return O(),V("svg",Hr,[...e[0]||(e[0]=[y("path",{d:"M3 6h18"},null,-1),y("path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"}
73,null,-1),y("path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"},null,-1)])])}const Vr=ye(zr,[["render",Wr]]),qr={},Xr={width:"24",height:"24",viewBox:"0 0 21.2344 24.1992",fill:"currentColor"};function Gr(n,e){return O(),V("svg",Xr,[...e[0]||(e[0]=[y("path",{d:"M10.4531 24.1992C11.2148 24.1992 11.6602 23.7305 11.6602 22.9336C11.6602 22.793 11.6484 22.6289 11.6484 22.4883L11.4844 13.8984L18.7969 18.293C19.0898 18.4688 19.3594 18.5391 19.6641 18.5391C20.3672 18.5391 20.8828 18.0234 20.8828 17.2969C20.8828 16.7461 20.6719 16.4414 20.0859 16.125L12.4336 12.1055L20.0859 8.07422C20.6719 7.76953 20.8828 7.45312 20.8828 6.91406C20.8828 6.19922 20.3789 5.67188 19.6641 5.67188C19.3594 5.67188 19.0898 5.74219 18.7969 5.91797L11.4844 10.3125L11.6484 1.72266C11.6484 1.57031 11.6602 1.41797 11.6602 1.26562C11.6602 0.46875 11.2148 0.0117188 10.4531 0.0117188C9.69141 0.0117188 9.23438 0.46875 9.23438 1.26562C9.23438 1.41797 9.24609 1.57031 9.24609 1.72266L9.41016 10.3125L2.08594 5.91797C1.79297 5.74219 1.52344 5.67188 1.20703 5.67188C0.503906 5.67188 0 6.1875 0 6.91406C0 7.45312 0.210938 7.76953 0.808594 8.07422L8.46094 12.1055L0.808594 16.125C0.210938 16.4414 0 16.7461 0 17.2969C0 18.0234 0.503906 18.5391 1.20703 18.5391C1.52344 18.5391 1.79297 18.4688 2.08594 18.293L9.41016 13.8984L9.24609 22.4883C9.24609 22.6289 9.23438 22.793 9.23438 22.9336C9.23438 23.7305 9.69141 24.1992 10.4531 24.1992Z",fill:"currentColor"},null,-1)])])}const Kr=ye(qr,[["render",Gr]]),Yr={class:"editor-container relative"},Jr={key:0,class:"absolute inset-0 z-10 pointer-events-none flex items-center justify-center rounded-[inherit]"},Zr={class:"ml-1"},Qr={key:0,class:"absolute top-4 left-5 flex items-center gap-2.5 text-neutral-400 pointer-events-none select-none"},Ie=20,Je=5,Qt=10,en=10,tn=50,es=1500,ts=25,ns={__name:"Textarea",props:{placeholderPrefix:{type:String,default:"Let Veeso AI design "},modelValue:{type:String,default:""},class:{type:String,default:""},placeholderClass:{type:String,default:""}
73,placeholderLabels:{type:Array,default:()=>[]},loading:{type:Boolean,default:!1},chatState:{type:Object,default:null},minHeight:{type:Number,default:96},maxHeight:{type:Number,default:0},multiline:{type:Boolean,default:!1}},emits:["update:modelValue","paste","update:canvas-size","focus","blur","document-uploaded"],setup(n,{expose:e,emit:t}){const{toast:r}=ha(),a=n,l=t,{isUploading:g,uploadProgress:i,uploadMaterial:s,uploadDocument:p,validateFile:h}=La(),o=W(null),d=W(0),R=W(""),_=W(!0);let I=null;const D=W(!1),F=W(600),U=ue(()=>a.maxHeight||F.value),f=W(!1),v=u=>{f.value||hn(u)},w=W(!1),c=W(""),S=W(0),k=W(null),A=W(!1),B=W(""),m=W(0),M=W({x:0,y:0}),E=ue(()=>[{id:"skill",label:"Add Skill",description:"Add a user skill",shortcut:"Skl",icon:Kr},{id:"image",label:"Upload Image",description:"Upload an image",shortcut:"Img",icon:Dr},{id:"document",label:"Upload Document",description:"Upload a document",shortcut:"Doc",icon:Fr},{id:"color",label:"Insert Color",description:"Add a color",shortcut:"Col",icon:Ur},{id:"clear",label:"Clear All",description:"Clear editor content",shortcut:"Clr",icon:Vr}]),H=ue(()=>{if(!B.value)return E.value;const u=B.value.toLowerCase();return E.value.filter(b=>b.label.toLowerCase().includes(u)||b.description.toLowerCase().includes(u))}),G=W(!1),P=W({x:0,y:0}),Y=u=>{_t({id:u.id}),G.value=!1},K=u=>{A.value=!1;const b={...M.value},C=window.getSelection();if(C.rangeCount>0){const z=C.getRangeAt(0),J=z.startContainer;if(J.nodeType===Node.TEXT_NODE){const j=J.textContent,Z=z.startOffset,X=j.slice(0,Z).lastIndexOf("/");X!==-1&&(z.setStart(J,X),z.setEnd(J,Z),z.deleteContents(),z.collapse(!0),C.removeAllRanges(),C.addRange(z))}}switch(u.id){case"skill":P.value=b,G.value=!0;break;case"image":{const z=document.createElement("input");z.type="file",z.accept=".png,.jpg,.jpeg,.webp",z.onchange=async J=>{J.target.files?.length&&await st(J.target.files[0])},z.click();break}case"document":{const z=document.createElement("input");z.type="file",z.accept=".pdf,.doc,.docx,.txt,.md",z.onchange=async J=>{if(J.target.files?.length){const j=J.target.files[0];await Ge(j)}},z.click();break}case"color":At("#000000");break;case"clear":Xe("");break}},ae=ue(()=>ja(c.value)),pe=W(!1),L=W({id:"",value:"#000000",position:{x:0,y:0}}),x=(u,b)=>{const C=b.getBoundingClientRect();L.value={id:u.id,value:u.value,position:{x:C.left+C.width/2,y:C.bottom+8}},pe.value=!0},T=W(!1),N=W({id:"",url:"",tag:"",isMaterial:!0,position:{x:0,y:0}}),$=(u,b)=>{const C=b.getBoundingClientRect();N.value={id:u.id,url:u.url,tag:u.tag||"",isMaterial:u.isMaterial!==!1,element:b,position:{x:C.left+C.width/2,y:C.bottom+8}},T.value=!0},q=W(!1),Q=W({id:"",position:{x:0,y:0}}),ne=(u,b)=>{const C=b.getBoundingClientRect();Q.value={id:u.id,position:{x:C.left+C.width/2,y:C.bottom+8}},q.value=!0},oe=/#([0-9A-Fa-f]{6}|[0-9A-Fa-f]{3})\s$/,fe=/@VeesoRemix\('([^']+)',\s*'([^']+)'\)$/,Ee=/@VeesoUserSkill\('([^']+)'\)$/,ve=new Set,ge=(u,{checkDuplicate:b=!1}={})=>{a.chatState&&(a.chatState.assets||(a.chatState.assets=[]),!(b&&a.chatState.assets.some(z=>z.id===u.id))&&(u.editorManaged=!0,a.chatState.assets.push(u),ve.add(u.id)))},Ze=u=>{if(!a.chatState?.assets)return;const b=a.chatState.assets.findIndex(C=>C.id===u);b>-1&&a.chatState.assets.splice(b,1),ve.delete(u)},ht=()=>{a.chatState&&(a.chatState.assets=[],ve.clear())},un=()=>{if(!a.chatState?.assets?.length||!o.value)return;const u=new Set(Array.from(o.value.querySelectorAll('[data-type="image"]')).map(b=>b.getAttribute("data-asset-id")).filter(Boolean));a.chatState.assets=a.chatState.assets.filter(b=>b.isMaterial===!1||!ve.has(b.id)?!0:u.has(b.id));for(const b of ve)a.chatState.assets.some(C=>C.id===b)||ve.delete(b)},pn=()=>o.value?{images:o.value.querySelectorAll('[data-type="image"]').length,documents:o.value.querySelectorAll('[data-type="document"]').length,tags:o.value.querySelectorAll('[data-type="tag"]').length,colors:o.value.querySelectorAll('[data-type="color"]').length}:{images:0,documents:0,tags:0,colors:0},Qe=u=>{const b=pn();switch(u){case"image":return b.images<Ie;case"document":return b.documents<Je;case"tag":return b.tags<Qt;case"color":return b.colors<en;default:return!0}},et=()=>{if(a.maxHeight)return;const u=window.innerHeight-300;F.value=Math.max(u,200)},qe=()=>{if(a.loading||!o.value)return;o.value.style.height="auto";const u=o.value.scrollHeight,b=Math.max(a.minHeight,Math.min(u,U.value));o.value.style.height=`${b}px`},{dragState:gn,handleDragStart:vt,handleDragOver:bt,handleDragLeave:xt,handleDrop:yt,handleDragEnd:wt,makeDraggable:fn}=Ba({editorRef:o,syncContent:v,onFileDrop:jn}),{isEmpty:tt,lastSyncedValue:kt,checkEmpty:Ct,getFormattedContent:mn,syncContent:hn,parseAndInsertText:vn}=Ka({editorRef:o,chatState:a.chatState,emit:l,adjustHeight:qe,syncAssetsWithEditor:un}),{insertTextAtCursor:bn,insertImageNode:nt,createImageElement:xn,updateImageNode:Me,removeImageNodeById:St,insertTag:yn,insertColorTagNode:wn,insertColorTag:At,insertColorTagFromInput:kn,insertRemixTag:Cn,insertRemixTagFromInput:Sn,insertUserSkillTag:_t,insertUserSkillTagFromInput:An,updateMaterialTag:Tt,updateColorTag:_n,removeColorTag:Tn,removeUserSkillTag:En,insertDocumentTag:Et,updateDocumentNode:Nn,updateDocumentParsed:Rn}=go({editorRef:o,syncContent:v,makeDraggable:fn,addAssetToChatState:ge,removeAssetFromChatState:Ze,canAddMore:Qe,toast:r,limits:{MAX_IMAGES:Ie,MAX_DOCUMENTS:Je,MAX_TAGS:Qt,MAX_COLORS:en},onColorClick:x,onMaterialClick:$,onSkillClick:ne}),at=u=>{yn(u,{hideMenu:()=>w.value=!1})},Mn=(u,b,C)=>{kn(u,b,C,()=>w.value=!1)},$n=(u,b,C)=>{Sn(u,b,C)},Dn=({id:u,value:b})=>{_n(u,b)},In=u=>{Tn(u)},Ln=({id:u,tag:b,isMaterial:C})=>{const z=N.value.element;if(Tt(u,b,C,z),a.chatState?.assets){const J=a.chatState.assets.find(j=>j.id===u);J&&(J.isMaterial=C)}},Pn=u=>{En(u)},Nt=(u,b={})=>{vn(u,{...b,insertTextAtCursor:bn,insertImageNode:nt,insertColorTagNode:wn,insertRemixTag:Cn,insertUserSkillTag:_t,insertDocumentTag:Et,addAssetToChatState:ge})},Fn=u=>
73new Promise((b,C)=>{try{const z=URL.createObjectURL(u);b(z)}catch(z){C(z)}}),ot=u=>new Promise(b=>{const C=new Image;C.onload=()=>b({width:C.naturalWidth||0,height:C.naturalHeight||0}),C.onerror=()=>b(null),C.src=u}),Rt=async(u,b=null)=>{if(!Qe("image")){r({title:"Image limit reached",description:`You can add up to ${Ie} images`,variant:"destructive"});return}const C=`temp_${Date.now()}`,z=URL.createObjectURL(u),J=await ot(z);if(o.value&&!b){const j=window.getSelection();let Z;!j.rangeCount||!o.value.contains(j.anchorNode)?(Z=document.createRange(),Z.selectNodeContents(o.value),Z.collapse(!1)):Z=j.getRangeAt(0);const{startContainer:se,startOffset:X}=Z,ee=se;if(ee.nodeType===Node.TEXT_NODE){const de=ee.textContent;if(X>0&&de&&de[X-1]!==` 74`){const Be=document.createTextNode(` 75`),xe=document.createRange();xe.setStart(ee,X),xe.collapse(!0),xe.insertNode(Be),Z.setStartAfter(Be),Z.collapse(!0),j.removeAllRanges(),j.addRange(Z)}}else if(ee.nodeType===Node.ELEMENT_NODE&&X>0){const de=ee.childNodes[X-1];if(de&&de.nodeType===Node.TEXT_NODE&&de.textContent&&!de.textContent.endsWith(` 76`)){const be=document.createTextNode(` 77`);ee.insertBefore(be,ee.childNodes[X]),Z.setStartAfter(be),Z.collapse(!0),j.removeAllRanges(),j.addRange(Z)}}}nt({id:C,url:z,loading:!0,progress:0,uploadStatus:"uploading",filename:u?.name||"",width:J?.width,height:J?.height},b),await s([u],{tempIds:[C],onProgress:({tempId:j,progress:Z,stage:se})=>{const X=j||C;o.value?.querySelector(`[data-type="image"][data-asset-id="${X}"]`)&&se!=="done"&&Me(X,{loading:!0,progress:Z,uploadStatus:"uploading"})},onPick:j=>{if(!o.value?.querySelector(`[data-type="image"][data-asset-id="${C}"]`)){try{URL.revokeObjectURL(z)}catch{}return}Me(C,{...j,loading:!1,progress:100,uploadStatus:"done"}),ge(j);try{URL.revokeObjectURL(z)}catch{}},onError:j=>{o.value?.querySelector(`[data-type="image"][data-asset-id="${C}"]`)&&Me(C,{loading:!1,progress:0,uploadStatus:"failed"}),r({title:"Upload failed",description:j||"Material upload failed, please try again",variant:"destructive"})}})};function jn(u,b){!u||u.length===0||Array.from(u).forEach(async C=>{const z=C.type.startsWith("image/"),J=["text/plain","application/pdf","text/markdown","text/x-markdown","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document"].includes(C.type)||C.name.toLowerCase().endsWith(".txt")||C.name.toLowerCase().endsWith(".md")||C.name.toLowerCase().endsWith(".doc")||C.name.toLowerCase().endsWith(".docx");z?await st(C):J?await Ge(C):r({title:"Unsupported file",description:"Only images and documents are supported",variant:"destructive"})})}const Bn=async(u,b)=>{if(!o.value)return;const C=[],z=document.createTreeWalker(o.value,NodeFilter.SHOW_TEXT,null,!1);let J;for(;J=z.nextNode();)J.textContent.includes(u)&&C.push(J);for(const j of C){const Z=j.textContent,se=Z.indexOf(u);if(se!==-1){const X=Z.substring(0,se),ee=Z.substring(se+u.length),de=j.parentNode,be=await Fn(b),Be=await ot(be),xe=`temp_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,Kn=xn({id:xe,url:be,loading:!0,filename:b?.name||"",width:Be?.width,height:Be?.height});if(X){const we=document.createTextNode(X);de.insertBefore(we,j)}de.insertBefore(Kn,j);const Yn=document.createTextNode("Â ");if(de.insertBefore(Yn,j),ee){const we=document.createTextNode(ee);de.insertBefore(we,j)}de.removeChild(j),await s([b],{tempIds:[xe],onProgress:({tempId:we,progress:Jn,stage:Zn})=>{const jt=we||xe;o.value?.querySelector(`[data-type="image"][data-asset-id="${jt}"]`)&&Zn!=="done"&&Me(jt,{loading:!0,progress:Jn,uploadStatus:"uploading"})},onPick:we=>{if(!o.value?.querySelector(`[data-type="image"][data-asset-id="${xe}"]`)){try{URL.revokeObjectURL(be)}catch{}return}Me(xe,{...we,loading:!1,progress:100,uploadStatus:"done"}),ge(we);try{URL.revokeObjectURL(be)}catch{}},onError:we=>{o.value?.querySelector(`[data-type="image"][data-asset-id="${xe}"]`)&&Me(xe,{loading:!1,progress:0,uploadStatus:"failed"}),r({title:"Upload failed",description:we||"Material upload failed, please try again",variant:"destructive"})}});break}}},Mt=u=>{St(u),Ze(u)},On=u=>{St(u)},{handleCopy:$t,handleCut:Dt,handlePaste:It}=Ha({editorRef:o,syncContent:v,parseAndInsertText:Nt,insertImage:Rt,removeMaterial:Mt,replaceImagePlaceholder:Bn,toast:r,emit:l}),Un=()=>{const u=window.getSelection();if(!u.rangeCount){v();return}const b=u.getRangeAt(0),C=b.startContainer;
77if(C.nodeType!==Node.TEXT_NODE){w.value=!1,A.value=!1,v();return}const z=b.startOffset,j=C.textContent.slice(0,z),Z=j[j.length-1],se=j.includes("#")||j.includes("/")||Z===" "||Z===")";if(j==="- "||j.endsWith(` 78- `)){const X=j.lastIndexOf("- ");b.setStart(C,X),b.setEnd(C,z),b.deleteContents();const ee=document.createTextNode("⢠");b.insertNode(ee),b.setStartAfter(ee),b.collapse(!0),u.removeAllRanges(),u.addRange(b),v();return}if(!se){w.value=!1,A.value=!1,v();return}if(Z===")"){const X=j.match(fe);if(X){$n(C,b,X),A.value=!1;return}const ee=j.match(Ee);if(ee){An(C,b,ee),A.value=!1;return}}if(Z===" "&&j.includes("#")){const X=j.match(oe);if(X){Mn(C,b,X),A.value=!1;return}}if(j.includes("/")){const X=j.match(/\/([^\s/]*)$/);if(X){A.value=!0,B.value=X[1],m.value=0;const ee=Vt();ee&&(M.value=ee),w.value=!1,v();return}}if(A.value=!1,j.includes("#")){const X=j.match(/#([^\s#]*)$/);if(X){const ee=X[1];if(/^[0-9A-Fa-f]{0,6}$/.test(ee)&&ee.length>0)w.value=!1;else{w.value=!0,c.value=ee,S.value=0;const be=Vt();be?k.value=be:k.value=null}}else w.value=!1}else w.value=!1;v()},zn=u=>{const b=(u.ctrlKey||u.metaKey)&&u.key==="z"&&!u.shiftKey,C=(u.ctrlKey||u.metaKey)&&(u.key==="y"||u.key==="z"&&u.shiftKey);if(b||C){setTimeout(()=>v(),0);return}if(u.key==="ArrowRight"){const z=window.getSelection();if(z.rangeCount){const J=z.getRangeAt(0),{startContainer:j,startOffset:Z}=J;if(j.nodeType===Node.TEXT_NODE&&Z===j.textContent.length-1){const se=j.nextSibling;if(se&&se.nodeType===Node.ELEMENT_NODE&&se.hasAttribute("data-type")&&se.contentEditable==="false"){u.preventDefault();const X=document.createRange();X.setStart(j,Z+1),X.collapse(!0),z.removeAllRanges(),z.addRange(X);return}}}}if(u.key==="ArrowLeft"){const z=window.getSelection();if(z.rangeCount){const J=z.getRangeAt(0),{startContainer:j,startOffset:Z}=J;if(j.nodeType===Node.TEXT_NODE&&Z===1){const se=j.previousSibling;if(se&&se.nodeType===Node.ELEMENT_NODE&&se.hasAttribute("data-type")&&se.contentEditable==="false"){u.preventDefault();const X=document.createRange();X.setStart(j,Z-1),X.collapse(!0),z.removeAllRanges(),z.addRange(X);return}}}}if(A.value&&H.value.length>0){if(u.key==="ArrowUp"){u.preventDefault(),m.value=(m.value-1+H.value.length)%H.value.length;return}if(u.key==="ArrowDown"){u.preventDefault(),m.value=(m.value+1)%H.value.length;return}if(u.key==="Enter"||u.key==="Tab"){u.preventDefault(),K(H.value[m.value]);return}if(u.key==="Escape"){u.preventDefault(),A.value=!1;return}}if(w.value&&ae.value.length>0){if(u.key==="ArrowUp"){u.preventDefault(),S.value=(S.value-1+ae.value.length)%ae.value.length;return}if(u.key==="ArrowDown"){u.preventDefault(),S.value=(S.value+1)%ae.value.length;return}if(u.key==="Enter"||u.key==="Tab"){u.preventDefault(),at(ae.value[S.value]);return}if(u.key==="Escape"){u.preventDefault(),w.value=!1;return}}if(u.key==="Enter"&&!u.shiftKey&&!u.isComposing&&!G.value){a.multiline?Pe(()=>v()):(u.preventDefault(),l("enter",u));return}},je=()=>
78{const u=a.placeholderLabels;if(!u||!u.length)return;const b=u[d.value]||"";_.value?R.value.length<b.length?(R.value=b.substring(0,R.value.length+1),I=setTimeout(je,tn)):I=setTimeout(()=>{_.value=!1,je()},es):R.value.length>0?(R.value=R.value.substring(0,R.value.length-1),I=setTimeout(je,ts)):(d.value=(d.value+1)%u.length,_.value=!0,I=setTimeout(je,tn))},Lt=()=>{I&&clearTimeout(I),R.value="",d.value=0,_.value=!0,je()},Hn=()=>{I&&(clearTimeout(I),I=null)};Ce(()=>a.placeholderLabels,()=>{Lt()},{deep:!0});let rt=!1;Ce(()=>a.modelValue,u=>{if(!rt&&u!==kt.value&&o.value){rt=!0,kt.value=u||"",f.value=!0;try{Xe(u||"")}finally{f.value=!1}rt=!1}}),Ce(()=>a.loading,(u,b)=>{b&&!u&&Pe(()=>qe())});const Wn=u=>{if(!Qe("image")){r({title:"Image limit reached",description:`You can add up to ${Ie} images`,variant:"destructive"});return}nt(u),ge(u,{checkDuplicate:!0})},Xe=u=>{if(o.value){if(o.value.innerHTML="",ht(),a.chatState&&(a.chatState.theme=null,a.chatState.style=null,a.chatState.documents=[]),u){o.value.focus(),Nt(u,{skipSync:!0,stateBehavior:"replace"});try{const b=window.getSelection(),C=document.createRange();C.selectNodeContents(o.value),C.collapse(!1),b.removeAllRanges(),b.addRange(C)}catch{}}tt.value=Ct(),qe()}},Vn=()=>a.modelValue,qn=(u,b)=>{Me(u,b)},Xn=async u=>{await Ge(u)},Gn=()=>{if(!o.value)return!1;const u=o.value.querySelector('[data-type="image"][data-loading="true"]')||o.value.querySelector('[data-type="image"][data-upload-status="failed"]'),b=o.value.querySelector('[data-type="document"][data-loading="true"]');return!!(u||b||a.chatState?.assets?.some(C=>C.loading)||a.chatState?.documents?.some(C=>C.loading))},st=async(u,b={})=>{if(!a.chatState)return;const C=b.isMaterial!==!1;if((a.chatState.assets||[]).length>=Ie){r({title:"Image limit reached",description:`You can add up to ${Ie} images`,variant:"destructive"});return}if(!h(u,"material",X=>r({title:"Invalid file",description:X,variant:"destructive"})))return;const J=URL.createObjectURL(u),j=await ot(J),Z=`temp_${Date.now()}`,se={id:Z,url:J,filename:u.name,isMaterial:C,loading:!0,progress:0,uploadStatus:"uploading",width:j?.width||128,height:j?.height||128};a.chatState.assets||(a.chatState.assets=[]),a.chatState.assets.push(se),await s([u],{tempIds:[Z],onProgress:({progress:X})=>{const ee=a.chatState.assets?.find(de=>de.id===Z);ee&&(ee.progress=X)},onPick:X=>{const ee=a.chatState.assets?.findIndex(de=>de.id===Z);ee!=null&&ee>-1&&a.chatState.assets.splice(ee,1,{...X,isMaterial:C,loading:!1,progress:100,uploadStatus:"done",width:j?.width||X.width||128,height:j?.height||X.height||128});try{URL.revokeObjectURL(J)}catch{}},onError:X=>{a.chatState?.assets&&(a.chatState.assets=a.chatState.assets.filter(ee=>ee.id!==Z));try{URL.revokeObjectURL(J)}catch{}r({title:"Upload failed",description:X||"Image upload failed, please try again",variant:"destructive"})}})},Ge=async u=>{if(!a.chatState)return;if((a.chatState.documents||[]).length>=Je){r({title:"Document limit reached",description:`You can add up to ${Je} documents`,variant:"destructive"});return}if(!h(u,"document",z=>r({title:"Invalid file",description:z,variant:"destructive"})))return;const C=`temp_doc_${Date.now()}`;a.chatState.documents||(a.chatState.documents=[]),a.chatState.documents.push({id:C,filename:u.name,loading:!0,parsed:!1}),await p([u],{onPick:z=>{const J=a.chatState.documents?.findIndex(j=>j.id===C);if(J!=null&&J>-1){const j={...z,loading:!1};a.chatState.documents.splice(J,1,j),l("document-uploaded",j)}},onError:z=>{a.chatState?.documents&&(a.chatState.documents=a.chatState.documents.filter(J=>J.id!==C)),r({title:"Upload failed",description:z||"Document upload failed, please try again",variant:"destructive"})}})};e({getFormattedContent:mn,insertImage:Rt,insertMaterial:Wn,removeMaterial:Mt,removeMaterialNode:On,updateMaterialTag:Tt,updateMaterialAsset:qn,insertTag:at,insertColorTag:At,insertDocumentTag:Et,insertDocumentFile:Xn,updateDocumentNode:Nn,updateDocumentParsed:Rn,uploadImageOnly:st,uploadDocumentOnly:Ge,hasPendingUploads:Gn,isUploading:g,uploadProgress:i,getValue:Vn,setValue:Xe,focu
78s:()=>o.value?.focus(),clear:()=>{o.value&&(o.value.innerHTML="",ht(),v({immediate:!0}))}});const Pt=u=>{const{data:b,element:C}=u.detail;$(b,C)},Ft=u=>{const{id:b}=u.detail;Ze(b),v({immediate:!0})};return an(()=>{if(et(),window.addEventListener("resize",et),Lt(),a.modelValue&&o.value){f.value=!0;try{Xe(a.modelValue)}finally{f.value=!1}}tt.value=Ct(),qe(),o.value?.addEventListener("material-click",Pt),o.value?.addEventListener("remove-material",Ft)}),ua(()=>{window.removeEventListener("resize",et),Hn(),o.value?.removeEventListener("material-click",Pt),o.value?.removeEventListener("remove-material",Ft)}),(u,b)=>(O(),V("div",Yr,[me(Eo,{show:A.value,commands:H.value,"selected-index":m.value,position:M.value,onSelect:K,onHover:b[0]||(b[0]=C=>m.value=C),onClose:b[1]||(b[1]=C=>A.value=!1)},null,8,["show","commands","selected-index","position"]),me(xo,{show:w.value,tags:ae.value,"selected-index":S.value,position:k.value,onSelect:at,onHover:b[2]||(b[2]=C=>S.value=C),onClose:b[3]||(b[3]=C=>w.value=!1)},null,8,["show","tags","selected-index","position"]),me(Uo,{show:pe.value,"color-id":L.value.id,"color-value":L.value.value,position:L.value.position,onUpdate:Dn,onDelete:In,onClose:b[4]||(b[4]=C=>pe.value=!1)},null,8,["show","color-id","color-value","position"]),me(nr,{show:T.value,"asset-id":N.value.id,"asset-url":N.value.url,"current-tag":N.value.tag,"is-material":N.value.isMaterial,position:N.value.position,onUpdate:Ln,onClose:b[5]||(b[5]=C=>T.value=!1)},null,8,["show","asset-id","asset-url","current-tag","is-material","position"]),me(fr,{show:q.value,"skill-id":Q.value.id,position:Q.value.position,onRemove:Pn,onClose:b[6]||(b[6]=C=>q.value=!1)},null,8,["show","skill-id","position"]),me(Nr,{show:G.value,position:P.value,onSelect:Y,onClose:b[7]||(b[7]=C=>G.value=!1)},null,8,["show","position"]),y("div",{ref_key:"editorRef",ref:o,contenteditable:"true",class:le(ie(Zt)("editor-content relative w-full px-5 py-4 text-neutral-800 minimal-scrollbar resize-none focus:outline-none bg-transparent overflow-y-auto leading-relaxed",a.class)),style:he({minHeight:`${a.minHeight}px`,maxHeight:`${U.value}px`}),onInput:Un,onCopy:b[8]||(b[8]=(...C)=>ie($t)&&ie($t)(...C)),onCut:b[9]||(b[9]=(...C)=>ie(Dt)&&ie(Dt)(...C)),onPaste:b[10]||(b[10]=(...C)=>ie(It)&&ie(It)(...C)),onKeydown:zn,onDragstart:b[11]||(b[11]=(...C)=>ie(vt)&&ie(vt)(...C)),onDragover:b[12]||(b[12]=(...C)=>ie(bt)&&ie(bt)(...C)),onDragleave:b[13]||(b[13]=(...C)=>ie(xt)&&ie(xt)(...C)),onDrop:b[14]||(b[14]=(...C)=>ie(yt)&&ie(yt)(...C)),onDragend:b[15]||(b[15]=(...C)=>ie(wt)&&ie(wt)(...C)),onFocus:b[16]||(b[16]=C=>{D.value=!0,l("focus")}),onBlur:b[17]||(b[17]=C=>{D.value=!1,l("blur")}),onScroll:b[18]||(b[18]=C=>{pe.value=!1,T.value=!1})},null,38),me(Ae,{"enter-active-class":"transition-all duration-200 ease-out","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-active-class":"transition-all duration-150 ease-in","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:Se(()=>[ie(gn).isExternalDragging?(O(),V("div",Jr,[...b[19]||(b[19]=[y("div",{class:"absolute inset-0 bg-white/60 backdrop-blur-[2px] rounded-[inherit]"},null,-1),y("div",{class:"absolute inset-[6px] border-2 border-dashed border-black/15 rounded-2xl"},null,-1),y("div",{class:"relative flex flex-col items-center gap-1.5"},[y("div",{class:"w-8 h-8 rounded-full bg-black/5 flex items-center justify-center"},[y("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"text-black/40"},[y("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),y("polyline",{points:"7 10 12 15 17 10"}),y("line",{x1:"12",y1:"15",x2:"12",y2:"3"})])]),y("span",{class:"text-xs font-medium text-black/40"},"Drop files here")],-1)])])):re("",!0)]),_:1}),me(Ae,{"enter-active-class":"transition-all duration-300 ease-out","enter-from-class":"opacity-0 translate-y-0.5","enter-to-class":"opacity-100 translate-y-0","leave-active-class":D.value?"":"transition-all duration-200 ease-in","leave-from-class":D.value?"":"opacity-100","leave-to-class":D.value?"":"opacity-0"},{default:Se(()=>
78[ie(tt)&&!n.loading?(O(),V("div",{key:0,class:le(ie(Zt)("placeholder-text absolute top-4 left-5 text-neutral-400 pointer-events-none select-none font-normal flex items-center",a.placeholderClass))},[y("span",null,ce(n.placeholderPrefix),1),y("span",Zr,ce(R.value),1)],2)):re("",!0)]),_:1},8,["leave-active-class","leave-from-class","leave-to-class"]),me(Ae,{"enter-active-class":"transition-all duration-200 ease-out","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-active-class":"transition-all duration-150 ease-in","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:Se(()=>[n.loading?(O(),V("div",Qr,[...b[20]||(b[20]=[y("span",{class:"loading-dots flex gap-1"},[y("span",{class:"dot"}),y("span",{class:"dot"}),y("span",{class:"dot"})],-1),y("span",{class:"text-[13px]"},"Please wait a moment while your design is being created...",-1)])])):re("",!0)]),_:1})]))}},us=ye(ns,[["__scopeId","data-v-99af4f57"]]);export{us as T,ds as u}; 79//# sourceMappingURL=ClZGvPF7.js.map
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.