Files
appco_dist/.output/public/_nuxt/BEAiPI1G.js
T
2025-08-25 21:57:52 +03:30

2 lines
3.7 KiB
JavaScript

import{d as D,u as j,H as A,r as k,a2 as B,o as I,y as r,z as i,A as a,B as p,I as o,T as x,bX as M,a3 as w,a4 as V,C as v,D as f,E as y,R as $}from"./LXNkq-sH.js";import{_ as O}from"./CscEAC8U.js";import{C as T,a as q}from"./7leyeuG9.js";import{m as s,e as c,r as z,c as H}from"./dtdfDtta.js";import{a as X,_ as G}from"./C2V_a-2D.js";import"./BmRZT0Vn.js";const J={class:"w-full h-screen bg-black text-white"},K={class:"flex w-full p-4 gap-8 justify-between items-center"},Q={class:"flex gap-8 items-center"},W=["alt"],Y={class:"font-semibold text-lg"},Z={class:"w-full flex items-center justify-center"},ee=["src","alt"],te={key:1,class:"empty-state"},se={class:"media-picker"},ae={class:"media-grid"},oe=["onClick"],ne=["src"],le=["src"],re=["onClick"],ie={class:"absolute bottom-5 right-5 addStyle"},_=10,_e=D({__name:"index",setup(ue){const d=j(),u=A(),h=k(null),m=k("");function b(){d.push({name:"home"}),z()}B(s,e=>{s.value.length===0?c.value="":s.value.length===1?c.value=s.value[0]:c.value=e[e.length-1]});function C(){s.value.length!==0?d.push({name:"add-story-infStory"}):$.warn(u.useString("addAtLeastOneMedia"))}function S(e){c.value=s.value[e]}const E=e=>e.includes(".mp4")||e.includes(".mov")||e.includes("video"),P=async()=>{try{T.isNativePlatform()?(await q.pickImages({limit:_-s.value.length})).photos.forEach(t=>s.value.push(t.webPath)):h.value.click()}catch(e){console.error("Error selecting media:",e)}},R=e=>{const t=e.target.files;t.length&&(Array.from(t).forEach(n=>{s.value.length<_&&(s.value.push(URL.createObjectURL(n)),H.value.push(n),c.value=URL.createObjectURL(n))}),h.value.value="")},U=e=>{e.preventDefault();const t=e.dataTransfer.files;Array.from(t).forEach(n=>{s.value.length<_&&s.value.push(URL.createObjectURL(n))})},L=e=>{s.value.splice(e,1)};return I(()=>{switch(d.currentRoute.value.name){case"add-product-inputProduct":m.value="product";break;case"add-story-inputStory":m.value="story";break;case"add-product-excel-inputProductExcel":m.value="productExcel";break}}),(e,t)=>{const n=X,N=G;return i(),r(w,null,[a("div",J,[a("div",K,[a("div",Q,[a("img",{src:O,alt:e.appName.en,class:"w-4",onClick:b},null,8,W),a("div",Y,p(o(u).useString("newStory")),1)]),a("div",{class:"text-primary text-sm",onClick:C},p(o(u).useString("next")),1)]),a("div",Z,[o(c)?(i(),r("img",{key:0,src:o(c),alt:e.appName.en,class:"w-full aspect-square"},null,8,ee)):o(s).length===0?(i(),r("p",te,p(o(u).useString("tapPlusToAdd")),1)):x("",!0)]),a("div",se,[a("div",{class:"drop-area",onDragover:t[0]||(t[0]=M(()=>{},["prevent"])),onDrop:U},[a("div",ae,[(i(!0),r(w,null,V(o(s),(l,g)=>(i(),r("div",{key:g,class:"media-container",onClick:F=>S(g)},[E(l)?(i(),r("video",{key:0,src:l,class:"media-preview",controls:""},null,8,ne)):(i(),r("img",{key:1,src:l,class:"media-preview"},null,8,le)),a("button",{onClick:F=>L(g),class:"remove-btn"},"✖",8,re)],8,oe))),128)),o(s).length<_?(i(),r("div",{key:0,class:"add-media text-black",onClick:P},t[5]||(t[5]=[a("span",null,"+",-1)]))):x("",!0)])],32),a("input",{ref_key:"fileInput",ref:h,type:"file",accept:"image/*,video/*",multiple:"",hidden:"",onChange:R},null,544)])]),a("div",ie,[v(N,{value:m.value,"onUpdate:value":t[4]||(t[4]=l=>m.value=l),"button-style":"solid"},{default:f(()=>[v(n,{onClick:t[1]||(t[1]=l=>o(d).push({name:"add-product-excel-inputProductExcel"})),value:"productExcel"},{default:f(()=>[y(p(o(u).useString("productExcel")),1)]),_:1}),v(n,{onClick:t[2]||(t[2]=l=>o(d).push({name:"add-product-inputProduct"})),value:"product"},{default:f(()=>[y(p(o(u).useString("product2")),1)]),_:1}),v(n,{onClick:t[3]||(t[3]=l=>o(d).push({name:"add-story-inputStory"})),value:"story"},{default:f(()=>[y(p(o(u).useString("story2")),1)]),_:1})]),_:1},8,["value"])])],64)}}});export{_e as _};