1import{H as x,p as a,o as O,c as h,P as b,h as y,av as S,aF as _,M as D,i as A,aq as C,k as w,q as v,m as P,j as R}from"./index-Db445JXE.js";import"./bu-search-EiIJOnlE.js";import"./bu-select-Du6euHFc.js";import"./bu-dialog-DrsLcWkX.js";import"./bu-input-DDVYxuOq.js";import"./bu-textarea-Bpp8yoZK.js";import"./bu-toggle-switch-sHy4xIzL.js";import{c as $,g as U,a as T}from"./ProjectUtil-CSeMD1Hs.js";import"./iron-icon-uWzU_ETe.js";import"./iron-flex-layout-gopRBjDy.js";import"./iron-icons-CfMukaon.js";import"./iron-validatable-behavior-Dxi6swMk.js";import"./TaskRequest-DPnGNDts.js";var L=Object.defineProperty,N=Object.getOwnPropertyDescriptor,c=(e,o,s,i)=>{for(var t=i>1?void 0:i?N(o,s):o,r=e.length-1,l;r>=0;r--)(l=e[r])&&(t=(i?l(o,s,t):l(t))||t);return i&&t&&L(o,s,t),t};let p=class extends b{constructor(){super(),this.loadingDisplay="none",this.firstGoal="",this.editing={name:"",description:""},this.relatedTeam="",this.isAllowPublic=!1,this.setAllowPublic=e=>{this.isAllowPublic=e}}static get template(){return y` 2 <style include="shared-styles"> 3 h { 4 display: block; 5 font-size: 1.5em; 6 font-weight: bold; 7 margin: 1em 0 16px; 8 } 9 button { 10 display: block; 11 margin: 2em auto; 12 max-width: 350px; 13 width: 95%; 14 border-radius: 100px; 15 text-align: center; 16 color: #fff; 17 padding: 10px 20px; 18 font-size: 16px; 19 font-weight: bold; 20 background: var(--bu-palette-primary-gradient); 21 cursor: pointer; 22 } 23 </style> 24 25 <h>ããã¸ã§ã¯ãã使ãã</h> 26 <label>ããã¸ã§ã¯ãå</label> 27 <bu-input 28 type="text" 29 placeholder="æé«ã®åå" 30 value="{{editing.name}}" 31 ></bu-input> 32 <label>説æ</label> 33 <bu-textarea 34 placeholder="ç®æããã¨ãã³ã³ã»ãã" 35 value="{{editing.description}}" 36 ></bu-textarea> 37 <label>æçµçãªã´ã¼ã«</label> 38 <bu-input 39 type="text" 40 placeholder="(ä¾)æé«ã®ãã¼ãã£ã«è·å ´ãå®ç¾ãã" 41 value="{{firstGoal}}" 42 ></bu-input> 43 44 <label>é¢é£ãããã¼ã </label> 45 <bu-select options="[[teamOptions]]" value="{{relatedTeam}}"></bu-select> 46 47 <bu-toggle-switch 48 label="å ¨ä½ã«å ¬éãã" 49 value="{{isAllowPublic}}" 50 on-change="{{setAllowPublic}}" 51 > 52 </bu-toggle-switch> 53 54 <button on-click="save">使ãã</button> 55 56 <bu-loading display="{{loadingDisplay}}"></bu-loading> 57 `}observeDialogState(){if(this.dialogState==="open"){if(!this.community){window.alert("ãã¼ã¿ããã¼ãã§ãã¦ãã¾ãããå°ãå¾ ã£ã¦ãããã¿ã³ãæ¼ãã¦ãã ãã"),this.dialogState="close";return}this.editing={name:"",description:""}}}get teamOptions(){return[{label:"é¸ãã§ãã ãã",value:""},{label:"-----",value:""},{label:"ãªã",value:""},...(this.teams||[]).map(e=>({label:e.name,value:e.id}))]}getShortProf(e){return{uid:e.uid||"",id:e.id||"",displayName:e.displayName||"-",message:e.message||"",organization:e.organization||"",photoURL:e.photoURL||""}}async save(){if(!this.community||!this.user)return;this.loadingDisplay="block";const e=S().toISOString();try{const o=await $({allowPublicRead:this.isAllowPublic,admins:[this.user.uid],name:this.editing.name||"No Title",description:this.editing.description||"",communityid:this.community.id,relatedTeams:[this.relatedTeam||""],createdBy:this.getShortProf(this.user),created:e,updated:e});await _(o.id,this.firstGoal||"æçµã´ã¼ã«ãããã«æ¸ãã¦ãã ãã"),this.path=`/project/${o.id}`}catch(o){console.error(o)}finally{this.loadingDisplay="none",this.dialogState="close"}}};c([a({type:Object})],p.prototype,"user",2);c([a({type:Object})],p.prototype,"community",2);c([a({type:Array})],p.prototype,"teams",2);c([a({type:String,notify:!0})],p.prototype,"path",2);c([a({type:String,notify:!0})],p.prototype,"dialogState",2);c([a({type:String})],p.prototype,"loadingDisplay",2);c([a({type:String})],p.prototype,"firstGoal",2);c([a({type:Object})],p.prototype,"editing",2);c([a({type:String})],p.prototype,"relatedTeam",2);c([a({type:Boolean})],p.prototype,"isAllowPublic",2);c([a({type:Object})],p.prototype,"setAllowPublic",2);c([O("dialogState")],p.prototype,"observeDialogState",1);c([x("teams")],p.prototype,"teamOptions",1);p=c([h("project-new-dialog")],p);var k=Object.defineProperty,z=Object.getOwnPropertyDescriptor,d=(e,o,s,i)=>{for(var t=i>1?void 0:i?z(o,s):o,r=e.length-1,l;r>=0;r--)(l=e[r])&&(t=(i?l(o,s,t):l(t))||t);return i&&t&&k(o,s,t),t};let n=class extends b{constructor(){super(),this.dialogState="close"}static get template(){return y` 58 <style include="shared-styles"> 59 button { 60 display: block; 61 border-radius: 100px; 62 color: #fff; 63 padding: 6px 12px; 64 font-weight: bold; 65 background: var(--bu-palette-primary-gradient); 66 cursor: pointer; 67 } 68 </style> 69 <button on-click="open">使ãã</button> 70 <bu-dialog state="{{dialogState}}"> 71 <project-new-dialog 72 user="[[user]]" 73 community="[[community]]" 74 teams="[[teams]]" 75 dialog-state="{{dialogState}}" 76 path="{{path}}" 77 > 78 </project-new-dialog> 79 </bu-dialog> 80 `}open(){this.dialogState="open"}};d([a({type:Object})],n.prototype,"user",2);d([a({type:Object})],n.prototype,"community",2);d([a({type:Array})],n.prototype,"teams",2);d([a({type:String,notify:!0})],n.prototype,"path",2);d([a({type:String})],n.prototype,"dialogState",2);
80n=d([h("project-controls-new")],n);var F=Object.defineProperty,G=Object.getOwnPropertyDescriptor,j=(e,o,s,i)=>{for(var t=i>1?void 0:i?G(o,s):o,r=e.length-1,l;r>=0;r--)(l=e[r])&&(t=(i?l(o,s,t):l(t))||t);return i&&t&&F(o,s,t),t};let m=class extends b{static get template(){return y` 81 <style include="shared-styles"> 82 a { 83 text-decoration: none; 84 color: black; 85 } 86 project { 87 display: block; 88 background-color: #eee; 89 padding: 1em; 90 border-radius: 6px; 91 } 92 image1 { 93 display: block; 94 margin: 0 16px 0 0; 95 width: 100px; 96 height: 100px; 97 background-color: #ccc; 98 } 99 detail { 100 display: block; 101 width: calc(100% - 116px); 102 } 103 h { 104 display: block; 105 font-weight: bold; 106 overflow: hidden; 107 height: 25px; 108 } 109 description { 110 display: block; 111 height: 66px; 112 padding: 0.5em; 113 overflow: hidden; 114 } 115 116 img { 117 width: 100px; 118 height: 100px; 119 object-fit: cover; 120 } 121 </style> 122 123 <a href="/project/[[project.id]]"> 124 <project> 125 <flex> 126 <image1><img src="[[thumbURL]]" /> </image1> 127 <detail> 128 <h>[[project.name]]</h> 129 <description>[[project.description]]</description> 130 </detail> 131 </flex> 132 </project> 133 </a> 134 `}constructor(){super()}get thumbURL(){return this.project?.thumbURL??"/images/project/rocket.svg"}};j([a({type:Object})],m.prototype,"project",2);j([x("project")],m.prototype,"thumbURL",1);m=j([h("project-short")],m);var I=Object.defineProperty,q=Object.getOwnPropertyDescriptor,g=(e,o,s,i)=>{for(var t=i>1?void 0:i?q(o,s):o,r=e.length-1,l;r>=0;r--)(l=e[r])&&(t=(i?l(o,s,t):l(t))||t);return i&&t&&I(o,s,t),t};let u=class extends D{constructor(){super(),this.teams=[],this.joinedProjects=[],this.communityProjects=[]}static get template(){return y` 135 <style include="shared-styles"> 136 article { 137 margin: 0 1em; 138 } 139 h { 140 display: block; 141 font-size: 1.5em; 142 font-weight: bold; 143 margin: 1em 0 16px; 144 } 145 bu-search { 146 display: block; 147 margin: 0; 148 } 149 category { 150 display: flex; 151 margin: auto 0; 152 } 153 category-label { 154 display: block; 155 margin: auto 1em auto 0; 156 } 157 project-controls-new { 158 display: block; 159 margin: auto 1.2em 16px auto; 160 } 161 project-short { 162 display: block; 163 margin: 1em 0; 164 } 165 h3 { 166 margin-top: 2rem; 167 } 168 </style> 169 170 <article> 171 <flex> 172 <h>ããã¸ã§ã¯ãä¸è¦§</h> 173 <project-controls-new 174 user="[[user]]" 175 community="[[community]]" 176 teams="[[teams]]" 177 path="{{path}}" 178 ></project-controls-new> 179 </flex> 180 <bu-search searchword="{{searchword}}"></bu-search> 181 182 <!--category> 183 <category-label>ã«ãã´ãª:</category-label> 184 <bu-select value="{{selected}}" options="[[options]]"></bu-select> 185 </category--> 186 187 <h3>èªåãåå ãã¦ããããã¸ã§ã¯ã</h3> 188 <template is="dom-if" if="[[!exists(joinedProjects)]]"> 189 <p>èªåãåå ãã¦ããããã¸ã§ã¯ãã¯è¦ã¤ããã¾ããã§ããã</p> 190 </template> 191 <template is="dom-repeat" items="[[joinedProjects]]" as="project"> 192 <project-short project="[[project]]"></project-short> 193 </template> 194 195 <h3>ã³ãã¥ããã£ã®ããã¸ã§ã¯ã</h3> 196 <template is="dom-if" if="[[!exists(communityProjects)]]"> 197 <p>ã³ãã¥ããã£ã®ããã¸ã§ã¯ãã¯è¦ã¤ããã¾ããã§ããã</p> 198 </template> 199 <template is="dom-repeat" items="[[communityProjects]]" as="project"> 200 <project-short project="[[project]]"></project-short> 201 </template> 202 </article> 203 `}init(){if(!this.user?.uid||!this.community?.id){this.detachAll();return}if(this.prevUid===this.user.uid&&this.prevCid==this.community.id)return;this.prevUid=this.user.uid,this.prevCid=this.community.id,this.detachAll(),this.loadProjects();const e=A("teams/{teamid}",{}),o=P();this.teamDetacher=C(v(e,o("communityid","==",this.community.id)),s=>{const i=s.docs.map(t=>w(t));this.teams=i}
203)}async loadProjects(){if(!(!this.user?.uid||!this.community?.id)){if(this.user.projects&&Object.keys(this.user.projects).length>0){const o=this.community.settings.project.sortByUpdated==="asc"?"asc":"desc",s=Object.entries(this.user.projects).sort(([t,r],[l,f])=>o=="asc"?r>f?1:-1:r>f?-1:1).map(([t,r])=>t),i=[];await Promise.all(s.map(async t=>{const r=await U(t);r!=null&&!r.deleted&&i.push(r)})),this.joinedProjects=i}if(this.communityid){const e=T(),o=P(),s=await R(v(e,o("communityid","==",this.communityid)));s.empty||(this.communityProjects=s.docs.filter(i=>!this.user?.projects?.[i.id]).map(w))}}}exists(e){return!(!e||e.length===0)}detachAll(){this.detacher?.(),this.detacher=void 0,this.teamDetacher?.(),this.teamDetacher=void 0,this.joinedProjects=[],this.communityProjects=[]}};g([a({type:Array})],u.prototype,"teams",2);g([a({type:String})],u.prototype,"searchword",2);g([O("user","community")],u.prototype,"init",1);u=g([h("project-index")],u);
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.