Files
appco_dist/.output/public/_nuxt/DMlRPFtv.js
T

2 lines
6.0 KiB
JavaScript
Raw Normal View History

2025-07-24 21:08:38 +03:30
import{d as ae,u as ie,G as oe,J as le,r as n,k as se,o as N,aj as re,F as T,z as m,D as j,A as a,a7 as A,y as b,S as O,C as _,H as o,B as k,ai as M,ak as E,a8 as ne,a2 as V,a3 as G,a4 as ce,T as f,cP as ue,d3 as de}from"./An4wrKzt.js";import{B as J}from"./BqtCFMyV.js";import{e as S}from"./DWEdiVkG.js";import{a as pe,_ as ve}from"./BUvi9DDr.js";import{g as me}from"./BJeqWoyX.js";import{k as fe,l as ge,f as _e}from"./CdyxdBvr.js";/* empty css *//* empty css */import"./DEW5QtGI.js";import"./CHJvH-J1.js";import{I as he}from"./BKCdstgB.js";import{T as ye,_ as we}from"./Bml_TY_g.js";import{S as xe}from"./IXW4S341.js";import{_ as Ce}from"./CcL7OnKK.js";import"./BqtpcZoZ.js";import"./DlAUqK2U.js";import"./BP4rNtjZ.js";import"./DRrEHY0h.js";import"./B9RxSNmH.js";import"./m9SOFEMu.js";import"./6e3cjCr7.js";import"./D6k4fLTD.js";import"./C0YPnItT.js";import"./Bg_niXdM.js";import"./f5kSSaFi.js";import"./B1PUzC5B.js";import"./eqKqiL7i.js";import"./DQi007xD.js";import"./WNC8sd82.js";import"./DqGGc3Qn.js";import"./aTaMzsVn.js";import"./__85kIDI.js";import"./Cj99RmFE.js";import"./C8Qj0aip.js";import"./BEC4vyqT.js";import"./BG1DSSUc.js";import"./Cg-xltl7.js";import"./CXzyLBrH.js";import"./BRlUwwiQ.js";import"./CwcOxMy8.js";import"./CUsCK0Cu.js";import"./C6FL30k1.js";import"./BbN7I0i_.js";import"./Cjhwp_AS.js";const be={class:"w-full"},ke={class:"flex w-full p-4 gap-8 justify-between items-center"},Se={class:"flex gap-4 items-center"},Ue={class:"font-semibold text-lg"},Be={class:"flex flex-col items-center"},Fe={class:"circle_highlight_edit"},Re=["alt"],Te={class:"title_edit_highlight mx4 mt2"},je={class:"text-xs text-gray-4"},Ae={key:0,class:"flex items-center h-90vh relative"},Ee={class:"w-full"},He={class:"flex justify-center absolute bottom-20 w-inherit w-full overflow-x-auto"},Ie=["onClick","alt"],De={class:"h-65vh w-full pb-10 overflow-y-auto grid grid-cols-3 gap-2px"},Ft=ae({__name:"index",setup(Pe){const U=ie(),p=oe(),{user:B}=le(),d=n(!1),H=n("stories"),v=n(),g=n(),F=n(!0),c=n([]),h=n([]),I=n(null),R=n(!1),y=n(),D=n(),P=se(()=>U.currentRoute.value.params.id);function Q(){var t;(t=I.value)==null||t.click()}function W(t,e){const i=t.split(","),l=i[0].match(/:(.*?);/)[1],r=atob(i[1]);let s=r.length;const x=new Uint8Array(s);for(;s--;)x[s]=r.charCodeAt(s);return new File([x],e,{type:l})}async function X(){var t;if(d.value)D.value.crop(),d.value=!1,R.value=!0;else try{f.value=!0;let e;if(R.value){const l=W(g.value,"cover.jpg"),{data:r,error:s}=await ue(l,"stories");if(e=r==null?void 0:r.fullPath,s)throw s}else e=g.value;console.log(e,"|",y.value,"|",c.value);const i=await fe(P.value,y.value,e);console.log(i.length>0),i.length>0&&await ge(c.value,(t=i[0])==null?void 0:t.id),U.back()}catch(e){console.log(e)}finally{f.value=!1}}function Y(t){var e,i;v.value=(i=(e=h.value)==null?void 0:e.find(l=>l.id===c.value[t]))==null?void 0:i.media_url,F.value=!0}function Z(t){g.value=t}function q(t){var i;const e=(i=t.target.files)==null?void 0:i[0];if(e){const l=new FileReader;l.onload=r=>{var s;v.value=(s=r.target)==null?void 0:s.result,console.log(r.target.result)},l.readAsDataURL(e),F.value=!1}}async function ee(){var t;try{f.value=!0;const e=(await me(P.value))[0],i=(t=e==null?void 0:e.highlight_media)==null?void 0:t.flatMap(l=>l.mediaitems);c.value=i==null?void 0:i.map(l=>l.id),v.value=i[0].media_url,g.value=e.cover_media_url,y.value=e.title}catch(e){console.log(e)}finally{f.value=!1}}const te=async()=>{try{f.value=!0;const t=await _e(B==null?void 0:B.user_id);h.value=t==null?void 0:t.flatMap(e=>e==null?void 0:e.mediaitems)}catch{de.error("error in fetching stories")}finally{f.value=!1}};return N(ee),N(te),(t,e)=>{const i=he,l=Ce,r=we,s=ye,x=xe,$=re("lazy");return m(),T(x,{spinning:o(f)},{default:j(()=>[a("div",be,[a("div",ke,[a("div",Se,[_(J,{icon:o(p).isRTL?"vuesax-linear:arrow-right":"vuesax-linear:arrow-left",onClick:e[0]||(e[0]=u=>d.value?d.value=!1:o(U).back())},null,8,["icon"]),a("div",Ue,k(o(p).useString(d.value?"editCover":"edit")),1)]),a("div",{class:"text-primary text-sm fw-bold",onClick:X},k(o(p).useString("done")),1