"use strict";(self.webpackChunkforgejo=self.webpackChunkforgejo||[]).push([["context-popup"],{"./node_modules/vue-loader/dist/exportHelper.js":(function(g,i){var r;r={value:!0},i.A=(e,t)=>{const u=e.__vccOpts||e;for(const[d,a]of t)u[d]=a;return u}}),"./web_src/js/components/ContextPopup.vue":(function(g,i,r){r.d(i,{default:function(){return L}});var e=r("./node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js"),t=r("./node_modules/@vue/shared/dist/shared.esm-bundler.js");const u={ref:"root"},d={key:0,class:"tw-h-12 tw-w-12 is-loading"},a={key:1,id:"issue-info-popup"},h={class:"labels-list"},v=["innerHTML"],f={key:2};function m(s,o,p,$,A,n){const x=(0,e.g2)("svg-icon");return(0,e.uX)(),(0,e.CE)("div",u,[s.loading?((0,e.uX)(),(0,e.CE)("div",d)):(0,e.Q3)("v-if",!0),!s.loading&&s.issue!==null?((0,e.uX)(),(0,e.CE)("div",a,[(0,e.Lk)("p",null,[(0,e.Lk)("small",null,(0,t.v_)(s.issue.repository.full_name)+" on "+(0,t.v_)(n.createdAt),1)]),(0,e.Lk)("p",null,[(0,e.bF)(x,{name:n.icon,class:(0,t.C4)(["text",n.color])},null,8,["name","class"]),o[0]||(o[0]=(0,e.eW)()),(0,e.Lk)("strong",null,(0,t.v_)(s.issue.title),1),(0,e.eW)(" #"+(0,t.v_)(s.issue.number),1)]),(0,e.Lk)("p",null,(0,t.v_)(n.body),1),(0,e.Lk)("div",h,[(0,e.Q3)(" eslint-disable-next-line vue/no-v-html "),((0,e.uX)(!0),(0,e.CE)(e.FK,null,(0,e.pI)(n.labels,l=>((0,e.uX)(),(0,e.CE)("div",{key:l.name,class:"ui label",style:(0,t.Tr)({color:l.textColor,backgroundColor:l.color}),innerHTML:l.name},null,12,v))),128))])])):(0,e.Q3)("v-if",!0),!s.loading&&s.issue===null?((0,e.uX)(),(0,e.CE)("div",f,[(0,e.Lk)("p",null,[(0,e.Lk)("small",null,(0,t.v_)(s.i18nErrorOccurred),1)]),(0,e.Lk)("p",null,(0,t.v_)(s.i18nErrorMessage),1)])):(0,e.Q3)("v-if",!0)],512)}var _=r("./web_src/js/svg.js"),j=r("./web_src/js/utils/color.js"),y=r("./web_src/js/modules/fetch.js"),b=r("./web_src/js/features/emoji.js"),k=r("./node_modules/escape-goat/index.js");const{appSubUrl:C,i18n:c}=window.config;var w={components:{SvgIcon:_.Ah},data:()=>({loading:!1,issue:null,i18nErrorOccurred:c.error_occurred,i18nErrorMessage:null}),computed:{createdAt(){return new Date(this.issue.created_at).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})},body(){const s=this.issue.body.replace(/\n+/g," ");return s.length>85?`${s.substring(0,85)}\u2026`:s},icon(){return this.issue.pull_request!==null?this.issue.pull_request.merged===!0?"octicon-git-merge":this.issue.state==="closed"?"octicon-git-pull-request-closed":this.issue.pull_request.draft===!0?"octicon-git-pull-request-draft":"octicon-git-pull-request":this.issue.state==="closed"?"octicon-issue-closed":"octicon-issue-opened"},color(){if(this.issue.pull_request!==null){if(this.issue.pull_request.merged===!0)return"purple";if(this.issue.pull_request.draft===!0&&this.issue.state==="open")return"grey"}return this.issue.state==="closed"?"red":"green"},labels(){return this.issue.labels.map(s=>({name:(0,k.z)(s.name).replaceAll(/:[-+\w]+:/g,o=>(0,b.UF)(o.substring(1,o.length-1))),color:`#${s.color}`,textColor:(0,j.a)(`#${s.color}`)}))}},mounted(){this.$refs.root.addEventListener("ce-load-context-popup",s=>{const o=s.detail;!this.loading&&this.issue===null&&this.load(o)})},methods:{async load(s){this.loading=!0,this.i18nErrorMessage=null;try{const o=await(0,y.fG)(`${C}/${s.owner}/${s.repo}/issues/${s.index}/info`),p=await o.json();if(!o.ok){this.i18nErrorMessage=p.message??c.network_error;return}this.issue=p}catch{this.i18nErrorMessage=c.network_error}finally{this.loading=!1}}}},E=r("./node_modules/vue-loader/dist/exportHelper.js"),L=(0,E.A)(w,[["render",m]])})}]);
