PageSourceSearch

https://ipora.ai/assets/js/index-f537a585.js

js ipora.ai collected 2026-10-05 15:18:13 UTC 11,648 bytes, 1 lines download raw bytes

1import{h as ge,u as me,r as x,Q as fe,c as U,D as ye,k as i,l as s,t as l,m as k,n as f,z as b,p as w,H as A,I as D,g as _e,B as n,J as B,K as Y,w as he}from"./vendor-cb264e7a.js";import{a2 as ve,u as xe,a3 as K,o as G,q as H,s as z,v as V,w as F,a4 as J,a5 as I,x as ke}from"./index-92930b80.js";import"./auth-54dfec7d.js";const be={class:"space-y-6"},we={class:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4"},Te={class:"text-2xl font-bold text-gray-900"},Me={class:"text-sm text-gray-600 mt-1"},Ce={class:"flex items-center gap-3"},Se=["disabled","aria-label"],Ae=["disabled"],De={class:"bg-white rounded-2xl shadow-sm p-3 sm:p-4"},Ie={class:"flex flex-wrap gap-2"},Le=["onClick"],Ne={class:"bg-white rounded-2xl shadow-sm overflow-hidden"},Pe={key:0,class:"py-12 text-center"},Re={class:"text-sm text-gray-500 mt-4"},Ee={key:1,class:"p-4 sm:p-6 space-y-8"},$e={class:"flex items-center justify-center"},je={class:"text-xs font-semibold text-gray-400"},Oe={class:"space-y-3"},Ue=["onClick"],Be={class:"flex items-center justify-between gap-4"},Ye={class:"flex items-center gap-3 min-w-0"},Ke={class:"w-10 h-10 rounded-full bg-gray-100 flex items-center justify-center flex-shrink-0"},Ge={class:"w-8 h-8 rounded-full flex items-center justify-center"},He={class:"min-w-0"},ze={class:"text-sm font-semibold text-gray-900 truncate"},Ve={class:"text-sm text-gray-700 truncate"},Fe={class:"mt-1 flex flex-wrap items-center gap-3 text-xs text-gray-500"},Je={class:"inline-flex items-center gap-1"},qe={key:0,class:"inline-flex items-center gap-1 text-gray-400"},Qe={class:"inline-flex items-center gap-1"},We={class:"inline-flex items-center gap-1"},Xe={class:"flex items-center gap-2 flex-shrink-0"},Ze=["disabled","onClick"],et=["aria-label"],tt={class:"pt-2 flex justify-center"},st=["disabled"],at={key:2,class:"py-12 text-center"},ot={class:"text-gray-600 font-medium"},nt={class:"text-sm text-gray-500 mt-1"},ct=ge({__name:"index",setup(rt){const d=ve(),q=_e(),{t:p,te:Q}=me(),{toDisplay:L,toDisplayDateTime:W}=xe(),X=e=>e?W(e,""):"",N=(e,t)=>{var o;const a=(o=e==null?void 0:e.metadata)==null?void 0:o.i18n;if(a){const r=t==="title"?a.titleKey:a.messageKey;if(r&&Q(r))return p(r,a.params||{})}return t==="title"?e.title:e.message},Z=e=>N(e,"title"),ee=e=>N(e,"message"),u=(e,t)=>{const a=p(e);return a===e?t:a},T=x(new Set),M=x(!1),y=x(!1),c=x([]),_=x("ALL"),m=fe({category:void 0,page:1,page_size:20}),te={trademark:"/trademarks",patent:"/patents",copyright:"/copyrights","industrial-design":"/industrial-designs","support-ticket":"/support-tickets",company:"/companies",user:"/users"},se=e=>{var r,g;const a=(((r=e.target)==null?void 0:r.type)||"").toLowerCase().replace(/_/g,"-"),o=te[a];return o&&((g=e.target)==null?void 0:g.id)?`${o}/${e.target.id}`:null},ae=U(()=>{var t,a,o,r,g,h,E,$;const e=c.value.reduce((v,S)=>{var j,O;return S.is_read||(v.ALL=((j=v.ALL)!=null?j:0)+1,v[S.category]=((O=v[S.category])!=null?O:0)+1),v},{});return[{key:"ALL",icon:K,label:u("common.all","All"),badge:(t=e.ALL)!=null?t:0},{key:"COMPANY",icon:G,label:p("notifications_page.categories.company"),badge:(a=e.COMPANY)!=null?a:0},{key:"TRADEMARK",icon:H,label:p("notifications_page.categories.trademark"),badge:(o=e.TRADEMARK)!=null?o:0},{key:"INDUSTRIAL_DESIGN",icon:z,label:p("notifications_page.categories.industrial_design"),badge:(r=e.INDUSTRIAL_DESIGN)!=null?r:0},{key:"COPYRIGHT",icon:V,label:p("notifications_page.categories.copyright"),badge:(g=e.COPYRIGHT)!=null?g:0},{key:"PATENT",icon:F,label:p("notifications_page.categories.patent"),badge:(h=e.PATENT)!=null?h:0},{key:"SUPPORT_TICKET",icon:J,label:p("notifications_page.categories.support_ticket"),badge:(E=e.SUPPORT_TICKET)!=null?E:0},{key:"SYSTEM",icon:I,label:p("notifications_page.categories.system"),badge:($=e.SYSTEM)!=null?$:0}]}),oe=e=>({USER:ke,COMPANY:G,TRADEMARK:H,PATENT:F,COPYRIGHT:V,INDUSTRIAL_DESIGN:z,SUPPORT_TICKET:J,SYSTEM:I,UPDATE_LOG:I})[e]||K,P=(e,t)=>e.toDateString()===t.toDateString(),ne=e=>{const t=new Date,a=new Date;a.setDate(t.getDate()-1);const o=t.getTime()-e.getTime(),r=Math.floor(o/(1e3*60*60*24));return P(e,t)?u("notifications_page.group_today","Today"):P(e,a)?u("notifications_page.group_yesterday","Yesterday"):r<7?u("notifications_page.group_this_week","This Week"):L(e.toISOString().slice(0,10),e.toISOString().slice(0,10))},re=U(()=>{const e={};return c.value.forEach(t=>{const a=t.created_at?new Date(t.created_at):new Date,o=ne(a);e[o]||(e[o]={label:o,items:[],timestamp:a.getTime()}),e[o].items.push(t)}),Object.values(e).sort((t,a)=>a.timestamp-t.timestamp).map(({label:t,items:a})=>({label:t,items:a}))}),ie=e=>{const t=new Date(e),o=new Date().getTime()-t.getTime(),r=Math.floor(o/6e4),g=Math.floor(r/60),h=Math.floor(g/24);return r<1?u("notifications_page.just_now","Just now"):r<60?`${r}${u("notifications_page.minutes_suffix","m")}`:g<24?`${g}${u("notifications_page.hours_suffix","h")}`:h<7?`${h}${u("notifications_page.days_suffix","d")}`:L(t.toISOString().slice(0,10),t.toISOString().slice(0,10))},C=async()=>{m.page=1,await d.fetchNotifications(m),c.value=[...d.notifications]},le=async()=>{var e;if(!(y.value||!d.hasNextPage)){y.value=!0;try{const t=((e=m.page)!=null?e:1)+1;m.page=t,await d.fetchNotifications(m),c.value=[...c.value,...d.notifications]}finally{y.value=!1}}},de=async e=>{_.value!==e&&(_.value=e,m.category=e==="ALL"?void 0:e,await C(),await d.updateUnreadCount())}
1,ce=async()=>{await Promise.all([C(),d.updateUnreadCount()])},ue=async e=>{e.is_read||await R([e.id]);const t=se(e);t&&q.push(t)},R=async e=>{e.forEach(t=>T.value.add(t));try{await d.markAsRead(e),c.value=c.value.map(t=>e.includes(t.id)?{...t,is_read:!0,read_at:new Date().toISOString()}:t)}catch(t){console.error("Failed to mark notifications as read:",t)}finally{e.forEach(t=>T.value.delete(t))}},pe=async()=>{M.value=!0;try{await d.markAllAsRead();const e=new Date().toISOString();c.value=c.value.map(t=>({...t,is_read:!0,read_at:e})),await d.updateUnreadCount()}catch(e){console.error("Failed to mark all notifications as read:",e)}finally{M.value=!1}};return ye(async()=>{!localStorage.getItem("access_token")||await Promise.all([C(),d.updateUnreadCount()])}),(e,t)=>(n(),i("div",be,[s("div",we,[s("div",null,[s("h1",Te,l(e.$t("notifications_page.title")),1),s("p",Me,l(e.$t("notifications_page.manage_description")),1)]),s("div",Ce,[s("button",{type:"button",class:"inline-flex items-center justify-center w-10 h-10 rounded-full bg-white border border-gray-200 text-gray-600 hover:text-primary hover:border-primary/40",disabled:k(d).isLoading,onClick:ce,"aria-label":e.$t("common.refresh")},[(n(),i("svg",{class:f(["w-4 h-4",{"animate-spin":k(d).isLoading}]),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[...t[0]||(t[0]=[s("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"},null,-1)])],2))],8,Se),k(d).unreadCount>0?(n(),i("button",{key:0,onClick:pe,disabled:M.value,class:"btn btn-primary gap-2"},[t[1]||(t[1]=s("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 13l4 4L19 7"})],-1)),b(" "+l(e.$t("notifications_page.mark_all_read")),1)],8,Ae)):w("",!0)])]),s("div",De,[s("div",Ie,[(n(!0),i(A,null,D(ae.value,a=>(n(),i("button",{key:a.key,type:"button",class:f(["inline-flex items-center gap-2 rounded-full border px-3 py-1.5 text-xs font-semibold transition-all",[a.key===_.value?"bg-primary text-white border-primary shadow-sm":"border-gray-200 text-gray-700 hover:text-primary hover:border-primary/40"]]),onClick:o=>de(a.key)},[s("span",{class:f(["inline-flex items-center justify-center w-6 h-6 rounded-full",a.key===_.value?"bg-white/20 text-white":"bg-gray-100 text-gray-600"])},[(n(),B(Y(a.icon),{class:"w-3.5 h-3.5"}))],2),s("span",null,l(a.label),1),a.badge!==void 0?(n(),i("span",{key:0,class:f(["rounded-full px-2 py-0.5 text-[11px] font-semibold",a.key===_.value?"bg-white/20 text-white":"bg-gray-100 text-gray-600"])},l(a.badge),3)):w("",!0)],10,Le))),128))])]),s("div",Ne,[k(d).isLoading&&c.value.length===0?(n(),i("div",Pe,[t[2]||(t[2]=s("div",{class:"animate-spin rounded-full h-10 w-10 border-b-2 border-primary mx-auto"},null,-1)),s("p",Re,l(e.$t("notifications_page.loading")),1)])):c.value.length>0?(n(),i("div",Ee,[(n(!0),i(A,null,D(re.value,a=>(n(),i("section",{key:a.label,class:"space-y-4"},[s("div",$e,[s("span",je,l(a.label),1)]),s("div",Oe,[(n(!0),i(A,null,D(a.items,o=>(n(),i("article",{key:o.id},[s("div",{class:f(["rounded-2xl border border-gray-100 bg-white px-4 py-3 hover:shadow-sm transition-all cursor-pointer",{"bg-gray-50":!o.is_read}]),onClick:r=>ue(o)},[s("div",Be,[s("div",Ye,[s("div",Ke,[s("div",Ge,[(n(),B(Y(oe(o.category)),{class:"w-4.5 h-4.5"}))])]),s("div",He,[s("p",ze,l(Z(o)),1),s("p",Ve,l(ee(o)),1),s("div",Fe,[s("span",Je,[t[3]||(t[3]=s("svg",{class:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})],-1)),b(" "+l(o.time_since||ie(o.created_at)),1)]),o.created_at?(n(),i("span",qe,l(X(o.created_at)),1)):w("",!0),s("span",Qe,[t[4]||(t[4]=s("svg",{class:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"})],-1)),b(" "+l(o.actor_name||u("notifications_page.system_actor","System")),1)]),s("span",We,[t[5]||(t[5]=s("span",{class:"w-1.5 h-1.5 rounded-full bg-gray-300"},null,-1)),b(" "+l(o.category_display),1)])])])]),s("div",Xe,[o.is_read?(n(),i("span",{key:1,class:"text-primary inline-flex items-center","aria-label":e.$t("notifications_page.read")},[...t[6]||(t[6]=[s("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 13l4 4L19 7"}
1)],-1)])],8,et)):(n(),i("button",{key:0,type:"button",class:"inline-flex items-center rounded-full bg-white border border-gray-200 px-4 py-1.5 text-xs font-semibold text-gray-700 hover:border-primary/40 hover:text-primary",disabled:T.value.has(o.id),onClick:he(r=>R([o.id]),["stop"])},l(e.$t("notifications_page.mark_as_read")),9,Ze))])])],10,Ue)]))),128))])]))),128)),s("div",tt,[k(d).hasNextPage?(n(),i("button",{key:0,type:"button",class:"inline-flex items-center gap-2 rounded-full bg-white border border-gray-200 px-5 py-2 text-sm font-semibold text-gray-700 hover:border-primary/40 hover:text-primary",disabled:y.value,onClick:le},[s("span",null,l(u("common.load_more","Load More")),1),(n(),i("svg",{class:f(["w-4 h-4",{"animate-spin":y.value}]),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[...t[7]||(t[7]=[s("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 9l-7 7-7-7"},null,-1)])],2))],8,st)):w("",!0)])])):(n(),i("div",at,[t[8]||(t[8]=s("svg",{class:"w-16 h-16 text-gray-400 mx-auto mb-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9"})],-1)),s("p",ot,l(e.$t("notifications_page.no_notifications")),1),s("p",nt,l(e.$t("notifications_page.no_notifications_description")),1)]))])]))}});export{ct as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.