Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_sharing/js/dist/files_sharing_tab.js')
-rw-r--r--apps/files_sharing/js/dist/files_sharing_tab.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/apps/files_sharing/js/dist/files_sharing_tab.js b/apps/files_sharing/js/dist/files_sharing_tab.js
index 4f8990d5e88..8ddeb68d42c 100644
--- a/apps/files_sharing/js/dist/files_sharing_tab.js
+++ b/apps/files_sharing/js/dist/files_sharing_tab.js
@@ -1400,7 +1400,7 @@ var Q=function(){function t(){!function(t,e){if(!(t instanceof e))throw new Type
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
- */var lt,ft={mixins:[$,g],props:{fileInfo:{type:Object,default:function(){},required:!0},share:{type:h,default:null}},data:function(){return{config:new Q,errors:{},loading:!1,saving:!1,open:!1,updateQueue:new At.a({concurrency:1}),reactiveState:this.share&&this.share.state,SHARE_TYPES:{SHARE_TYPE_USER:OC.Share.SHARE_TYPE_USER,SHARE_TYPE_GROUP:OC.Share.SHARE_TYPE_GROUP,SHARE_TYPE_LINK:OC.Share.SHARE_TYPE_LINK,SHARE_TYPE_EMAIL:OC.Share.SHARE_TYPE_EMAIL,SHARE_TYPE_REMOTE:OC.Share.SHARE_TYPE_REMOTE,SHARE_TYPE_CIRCLE:OC.Share.SHARE_TYPE_CIRCLE,SHARE_TYPE_GUEST:OC.Share.SHARE_TYPE_GUEST,SHARE_TYPE_REMOTE_GROUP:OC.Share.SHARE_TYPE_REMOTE_GROUP,SHARE_TYPE_ROOM:OC.Share.SHARE_TYPE_ROOM}}},computed:{hasNote:{get:function(){return""!==this.share.note},set:function(t){this.share.note=t?null:""}},dateTomorrow:function(){return moment().add(1,"days")},firstDay:function(){return window.firstDay?window.firstDay:0},lang:function(){return{days:window.dayNamesShort?window.dayNamesShort:["Sun.","Mon.","Tue.","Wed.","Thu.","Fri.","Sat."],months:window.monthNamesShort?window.monthNamesShort:["Jan.","Feb.","Mar.","Apr.","May.","Jun.","Jul.","Aug.","Sep.","Oct.","Nov.","Dec."],placeholder:{date:"Select Date"}}},isShareOwner:function(){return this.share&&this.share.owner===Object(N.getCurrentUser)().uid}},methods:{checkShare:function(t){if(t.password&&("string"!=typeof t.password||""===t.password.trim()))return!1;if(t.expirationDate&&!moment(t.expirationDate).isValid())return!1;return!0},onExpirationChange:function(t){var e=moment(t).format("YYYY-MM-DD");this.share.expireDate=e,this.queueUpdate("expireDate")},onExpirationDisable:function(){this.share.expireDate="",this.queueUpdate("expireDate")},onNoteChange:function(t){this.$set(this.share,"newNote",t.trim())},onNoteSubmit:function(){this.share.newNote&&(this.share.note=this.share.newNote,this.$delete(this.share,"newNote"),this.queueUpdate("note"))},onDelete:(lt=ut(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,this.loading=!0,this.open=!1,t.next=5,this.deleteShare(this.share.id);case 5:console.debug("Share deleted",this.share.id),this.$emit("remove:share",this.share),t.next=12;break;case 9:t.prev=9,t.t0=t.catch(0),this.open=!0;case 12:return t.prev=12,this.loading=!1,t.finish(12);case 15:case"end":return t.stop()}}),t,this,[[0,9,12,15]])}))),function(){return lt.apply(this,arguments)}),queueUpdate:function(t){var e=this;if(this.share.id){var n=this.share[t].toString();this.updateQueue.add(ut(regeneratorRuntime.mark((function r(){var o,i;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return e.saving=!0,e.errors={},r.prev=2,r.next=5,e.updateShare(e.share.id,{property:t,value:n});case 5:e.$delete(e.errors,t),e.$delete(e.share,"newPassword"),r.next=14;break;case 9:r.prev=9,r.t0=r.catch(2),o=r.t0.property,i=r.t0.message,e.onSyncError(o,i);case 14:return r.prev=14,e.saving=!1,r.finish(14);case 17:case"end":return r.stop()}}),r,null,[[2,9,14,17]])}))))}else console.error("Cannot update share.",this.share,"No valid id")},onSyncError:function(t,e){switch(this.open=!0,t){case"password":case"pending":case"expireDate":case"note":this.$set(this.errors,t,e);var n=this.$refs[t];if(n){n.$el&&(n=n.$el);var r=n.querySelector(".focusable");r&&r.focus()}}},debounceQueueUpdate:k()((function(t){this.queueUpdate(t)}),500)}},dt={name:"SharingEntryInherited",components:{ActionButton:ot.a,ActionLink:b.a,ActionText:at.a,Avatar:s.a,SharingEntrySimple:C},mixins:[ft],props:{share:{type:h,required:!0}},computed:{fileTargetUrl:function(){return Object(i.generateUrl)("/f/{fileid}",{fileid:this.share.fileSource})}}},pt=(r(817),Object(T.a)(dt,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("SharingEntrySimple",{key:t.share.id,staticClass:"sharing-entry__inherited",attrs:{title:t.share.shareWithDisplayName},scopedSlots:t._u([{key:"avatar",fn:function(){return[n("Avatar",{staticClass:"sharing-entry__avatar",attrs:{user:t.share.shareWith,"display-name":t.share.shareWithDisplayName,"tooltip-message":""}})]},proxy:!0}])},[t._v(" "),n("ActionText",{attrs:{icon:"icon-user"}},[t._v("\n\t\t"+t._s(t.t("files_sharing","Added by {initiator}",{initiator:t.share.ownerDisplayName}))+"\n\t")]),t._v(" "),t.share.canDelete&&t.share.fileSource?n("ActionLink",{attrs:{icon:"icon-folder",href:t.fileTargetUrl}},[t._v("\n\t\t"+t._s(t.t("files_sharing","Via folder"))+"\n\t")]):t._e(),t._v(" "),t.share.canDelete?n("ActionButton",{attrs:{icon:"icon-close"},on:{click:function(e){return e.preventDefault(),t.onDelete(e)}}},[t._v("\n\t\t"+t._s(t.t("files_sharing","Unshare"))+"\n\t")]):t._e()],1)}),[],!1,null,"7cbe9523",null).exports);function ht(t,e,n,r,o,i,a){try{var s=t[i](a),A=s.value}catch(t){return void n(t)}s.done?e(A):Promise.resolve(A).then(r,o)}var vt,gt={name:"SharingInherited",components:{ActionButton:ot.a,SharingEntryInherited:pt,SharingEntrySimple:C},props:{fileInfo:{type:Object,default:function(){},required:!0}},data:function(){return{loaded:!1,loading:!1,showInheritedShares:!1,shares:[]}},computed:{showInheritedSharesIcon:function(){return this.loading?"icon-loading-small":this.showInheritedShares?"icon-triangle-n":"icon-triangle-s"},mainTitle:function(){return t("files_sharing","Others with access")},subTitle:function(){return this.showInheritedShares&&0===this.shares.length?t("files_sharing","No other users with access found"):""},toggleTooltip:function(){return"dir"===this.fileInfo.type?t("files_sharing","Toggle list of others with access to this directory"):t("files_sharing","Toggle list of others with access to this file")},fullPath:function(){return"".concat(this.fileInfo.path,"/").concat(this.fileInfo.name).replace("//","/")}},watch:{fileInfo:function(){this.resetState()}},methods:{toggleInheritedShares:function(){this.showInheritedShares=!this.showInheritedShares,this.showInheritedShares?this.fetchInheritedShares():this.resetState()},fetchInheritedShares:(vt=function(t){return function(){var e=this,n=arguments;return new Promise((function(r,o){var i=t.apply(e,n);function a(t){ht(i,r,o,a,s,"next",t)}function s(t){ht(i,r,o,a,s,"throw",t)}a(void 0)}))}}(regeneratorRuntime.mark((function e(){var n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.loading=!0,e.prev=1,n=Object(i.generateOcsUrl)("apps/files_sharing/api/v1/shares/inherited?format=json&path=".concat(this.fullPath),2),e.next=5,c.a.get(n.replace(/\/$/,""));case 5:r=e.sent,this.shares=r.data.ocs.data.map((function(t){return new h(t)})).sort((function(t,e){return e.createdTime-t.createdTime})),console.info(this.shares),this.loaded=!0,e.next=14;break;case 11:e.prev=11,e.t0=e.catch(1),OC.Notification.showTemporary(t("files_sharing","Unable to fetch inherited shares"),{type:"error"});case 14:return e.prev=14,this.loading=!1,e.finish(14);case 17:case"end":return e.stop()}}),e,this,[[1,11,14,17]])}))),function(){return vt.apply(this,arguments)}),resetState:function(){this.loaded=!1,this.loading=!1,this.showInheritedShares=!1,this.shares=[]}}},mt=(r(819),Object(T.a)(gt,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("ul",{attrs:{id:"sharing-inherited-shares"}},[n("SharingEntrySimple",{staticClass:"sharing-entry__inherited",attrs:{title:t.mainTitle,subtitle:t.subTitle},scopedSlots:t._u([{key:"avatar",fn:function(){return[n("div",{staticClass:"avatar-shared icon-more-white"})]},proxy:!0}])},[t._v(" "),n("ActionButton",{attrs:{icon:t.showInheritedSharesIcon},on:{click:function(e){return e.preventDefault(),e.stopPropagation(),t.toggleInheritedShares(e)}}},[t._v("\n\t\t\t"+t._s(t.toggleTooltip)+"\n\t\t")])],1),t._v(" "),t._l(t.shares,(function(t){return n("SharingEntryInherited",{key:t.id,attrs:{share:t}})}))],2)}),[],!1,null,"2ae2c800",null).exports),bt=r(280),yt=r.n(bt),wt=r(631),xt=r.n(wt),Et=r(281),_t=r.n(Et),Tt=r(282),Ct=r.n(Tt);function It(t){return(It="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Bt(t,e,n,r,o,i,a){try{var s=t[i](a),A=s.value}catch(t){return void n(t)}s.done?e(A):Promise.resolve(A).then(r,o)}function Mt(t){return function(){var e=this,n=arguments;return new Promise((function(r,o){var i=t.apply(e,n);function a(t){Bt(i,r,o,a,s,"next",t)}function s(t){Bt(i,r,o,a,s,"throw",t)}a(void 0)}))}}var Ot,St,Nt,Dt,kt,Lt="abcdefgijkmnopqrstwxyzABCDEFGHJKLMNPQRSTWXYZ23456789",jt={name:"SharingEntryLink",components:{Actions:w.a,ActionButton:ot.a,ActionCheckbox:yt.a,ActionRadio:xt.a,ActionInput:_t.a,ActionLink:b.a,ActionText:at.a,ActionTextEditable:Ct.a,Avatar:s.a},directives:{Tooltip:E.a},mixins:[ft],props:{canReshare:{type:Boolean,default:!0}},data:function(){return{copySuccess:!0,copied:!1,publicUploadRWValue:OC.PERMISSION_UPDATE|OC.PERMISSION_CREATE|OC.PERMISSION_READ|OC.PERMISSION_DELETE,publicUploadRValue:OC.PERMISSION_READ,publicUploadWValue:OC.PERMISSION_CREATE,ExternalLinkActions:OCA.Sharing.ExternalLinkActions.state}},computed:{randomId:function(){return Math.random().toString(27).substr(2)},title:function(){if(this.share&&this.share.id){if(!this.isShareOwner&&this.share.ownerDisplayName)return t("files_sharing","Shared via link by {initiator}",{initiator:this.share.ownerDisplayName});if(this.share.label&&""!==this.share.label.trim())return this.share.label;if(this.isEmailShareType)return this.share.shareWith}return t("files_sharing","Share link")},hasExpirationDate:{get:function(){return this.config.isDefaultExpireDateEnforced||!!this.share.expireDate},set:function(t){this.share.expireDate=t?""!==this.config.defaultExpirationDateString?this.config.defaultExpirationDateString:moment().format("YYYY-MM-DD"):""}},dateMaxEnforced:function(){return this.config.isDefaultExpireDateEnforced&&moment().add(1+this.config.defaultExpireDate,"days")},isPasswordProtected:{get:function(){return this.config.enforcePasswordForPublicLink||!!this.share.password},set:(kt=Mt(regeneratorRuntime.mark((function t(e){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!e){t.next=6;break}return t.next=3,this.generatePassword();case 3:t.t0=t.sent,t.next=7;break;case 6:t.t0="";case 7:this.share.password=t.t0,this.share.newPassword=this.share.password;case 9:case"end":return t.stop()}}),t,this)}))),function(t){return kt.apply(this,arguments)})},isTalkEnabled:function(){return void 0!==OC.appswebroots.spreed},isPasswordProtectedByTalkAvailable:function(){return this.isPasswordProtected&&this.isTalkEnabled},isPasswordProtectedByTalk:{get:function(){return this.share.sendPasswordByTalk},set:(Dt=Mt(regeneratorRuntime.mark((function t(e){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:this.share.sendPasswordByTalk=e;case 1:case"end":return t.stop()}}),t,this)}))),function(t){return Dt.apply(this,arguments)})},isEmailShareType:function(){return!!this.share&&this.share.type===this.SHARE_TYPES.SHARE_TYPE_EMAIL},pendingPassword:function(){return this.config.enforcePasswordForPublicLink&&this.share&&!this.share.id},pendingExpirationDate:function(){return this.config.isDefaultExpireDateEnforced&&this.share&&!this.share.id},canUpdate:{get:function(){return this.share.hasUpdatePermission},set:function(t){this.share.permissions=t?OC.PERMISSION_READ|OC.PERMISSION_UPDATE:OC.PERMISSION_READ}},hasUnsavedPassword:function(){return void 0!==this.share.newPassword},isFolder:function(){return"dir"===this.fileInfo.type},fileHasCreatePermission:function(){return!!(this.fileInfo.permissions&OC.PERMISSION_CREATE)},shareLink:function(){return window.location.protocol+"//"+window.location.host+Object(i.generateUrl)("/s/")+this.share.token},clipboardTooltip:function(){return this.copied?this.copySuccess?t("files_sharing","Link copied"):t("files_sharing","Cannot copy, please copy the link manually"):t("files_sharing","Copy to clipboard")},externalActions:function(){return this.ExternalLinkActions.actions},isPasswordPolicyEnabled:function(){return"object"===It(this.config.passwordPolicy)}},methods:{onNewLinkShare:(Nt=Mt(regeneratorRuntime.mark((function e(){var n,r,o,i,a=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n={share_type:OC.Share.SHARE_TYPE_LINK},this.config.isDefaultExpireDateEnforced&&(n.expiration=this.config.defaultExpirationDateString),!this.config.enableLinkPasswordByDefault){e.next=6;break}return e.next=5,this.generatePassword();case 5:n.password=e.sent;case 6:if(!this.config.enforcePasswordForPublicLink&&!this.config.isDefaultExpireDateEnforced){e.next=31;break}if(this.loading=!0,!this.share||this.share.id){e.next=18;break}if(!this.checkShare(this.share)){e.next=15;break}return e.next=12,this.pushNewLinkShare(this.share,!0);case 12:return e.abrupt("return",!0);case 15:return this.open=!0,OC.Notification.showTemporary(t("files_sharing","Error, please enter proper password and/or expiration date")),e.abrupt("return",!1);case 18:if(!this.config.enforcePasswordForPublicLink){e.next=22;break}return e.next=21,this.generatePassword();case 21:n.password=e.sent;case 22:return r=new h(n),e.next=25,new Promise((function(t){a.$emit("add:share",r,t)}));case 25:o=e.sent,this.open=!1,this.loading=!1,o.open=!0,e.next=34;break;case 31:return i=new h(n),e.next=34,this.pushNewLinkShare(i);case 34:case"end":return e.stop()}}),e,this)}))),function(){return Nt.apply(this,arguments)}),pushNewLinkShare:(St=Mt(regeneratorRuntime.mark((function t(e,n){var r,o,i,a,s,A=this;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,this.loading=!0,this.errors={},r=(this.fileInfo.path+"/"+this.fileInfo.name).replace("//","/"),t.next=6,this.createShare({path:r,shareType:OC.Share.SHARE_TYPE_LINK,password:e.password,expireDate:e.expireDate});case 6:if(o=t.sent,this.open=!1,console.debug("Link share created",o),!n){t.next=15;break}return t.next=12,new Promise((function(t){A.$emit("update:share",o,t)}));case 12:i=t.sent,t.next=18;break;case 15:return t.next=17,new Promise((function(t){A.$emit("add:share",o,t)}));case 17:i=t.sent;case 18:i.copyLink(),t.next=26;break;case 21:t.prev=21,t.t0=t.catch(0),a=t.t0.response,(s=a.data.ocs.meta.message).match(/password/i)?this.onSyncError("password",s):s.match(/date/i)?this.onSyncError("expireDate",s):this.onSyncError("pending",s);case 26:return t.prev=26,this.loading=!1,t.finish(26);case 29:case"end":return t.stop()}}),t,this,[[0,21,26,29]])}))),function(t,e){return St.apply(this,arguments)}),togglePermissions:function(t){var e=parseInt(t.target.value,10);this.share.permissions=e,this.queueUpdate("permissions")},generatePassword:(Ot=Mt(regeneratorRuntime.mark((function t(){var e;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.config.passwordPolicy.api||!this.config.passwordPolicy.api.generate){t.next=12;break}return t.prev=1,t.next=4,c.a.get(this.config.passwordPolicy.api.generate);case 4:if(!(e=t.sent).data.ocs.data.password){t.next=7;break}return t.abrupt("return",e.data.ocs.data.password);case 7:t.next=12;break;case 9:t.prev=9,t.t0=t.catch(1),console.info("Error generating password from password_policy",t.t0);case 12:return t.abrupt("return",Array(10).fill(0).reduce((function(t,e){return t+=Lt.charAt(Math.floor(Math.random()*Lt.length))}),""));case 13:case"end":return t.stop()}}),t,this,[[1,9]])}))),function(){return Ot.apply(this,arguments)}),copyLink:function(){var t=Mt(regeneratorRuntime.mark((function t(){var e=this;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.$copyText(this.shareLink);case 3:this.$refs.copyButton.$el.focus(),this.copySuccess=!0,this.copied=!0,t.next=13;break;case 8:t.prev=8,t.t0=t.catch(0),this.copySuccess=!1,this.copied=!0,console.error(t.t0);case 13:return t.prev=13,setTimeout((function(){e.copySuccess=!1,e.copied=!1}),4e3),t.finish(13);case 16:case"end":return t.stop()}}),t,this,[[0,8,13,16]])})));return function(){return t.apply(this,arguments)}}(),onPasswordChange:function(t){this.$set(this.share,"newPassword",t)},onPasswordDisable:function(){this.share.password="",this.$delete(this.share,"newPassword"),this.share.id&&this.queueUpdate("password")},onPasswordSubmit:function(){this.hasUnsavedPassword&&(this.share.password=this.share.newPassword.trim(),this.queueUpdate("password"))},onMenuClose:function(){this.onPasswordSubmit(),this.onNoteSubmit()},onCancel:function(){this.$emit("remove:share",this.share)}}},Rt=(r(821),{name:"SharingLinkList",components:{SharingEntryLink:Object(T.a)(jt,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("li",{staticClass:"sharing-entry sharing-entry__link",class:{"sharing-entry--share":t.share}},[n("Avatar",{staticClass:"sharing-entry__avatar",class:t.isEmailShareType?"icon-mail-white":"icon-public-white",attrs:{"is-no-user":!0}}),t._v(" "),n("div",{staticClass:"sharing-entry__desc"},[n("h5",[t._v(t._s(t.title))])]),t._v(" "),t.share&&!t.isEmailShareType&&t.share.token?n("Actions",{ref:"copyButton",staticClass:"sharing-entry__copy"},[n("ActionLink",{attrs:{href:t.shareLink,target:"_blank",icon:t.copied&&t.copySuccess?"icon-checkmark-color":"icon-clippy"},on:{click:function(e){return e.stopPropagation(),e.preventDefault(),t.copyLink(e)}}},[t._v("\n\t\t\t"+t._s(t.clipboardTooltip)+"\n\t\t")])],1):t._e(),t._v(" "),t.loading||!t.pendingPassword&&!t.pendingExpirationDate?t.loading?n("div",{staticClass:"icon-loading-small sharing-entry__loading"}):n("Actions",{staticClass:"sharing-entry__actions",attrs:{"menu-align":"right",open:t.open},on:{"update:open":function(e){t.open=e},close:t.onMenuClose}},[t.share?[t.share.canEdit?[t.isFolder&&t.fileHasCreatePermission&&t.config.isPublicUploadEnabled?[n("ActionRadio",{attrs:{checked:t.share.permissions===t.publicUploadRValue,value:t.publicUploadRValue,name:t.randomId,disabled:t.saving},on:{change:t.togglePermissions}},[t._v("\n\t\t\t\t\t\t"+t._s(t.t("files_sharing","Read only"))+"\n\t\t\t\t\t")]),t._v(" "),n("ActionRadio",{attrs:{checked:t.share.permissions===t.publicUploadRWValue,value:t.publicUploadRWValue,disabled:t.saving,name:t.randomId},on:{change:t.togglePermissions}},[t._v("\n\t\t\t\t\t\t"+t._s(t.t("files_sharing","Allow upload and editing"))+"\n\t\t\t\t\t")]),t._v(" "),n("ActionRadio",{staticClass:"sharing-entry__action--public-upload",attrs:{checked:t.share.permissions===t.publicUploadWValue,value:t.publicUploadWValue,disabled:t.saving,name:t.randomId},on:{change:t.togglePermissions}},[t._v("\n\t\t\t\t\t\t"+t._s(t.t("files_sharing","File drop (upload only)"))+"\n\t\t\t\t\t")])]:n("ActionCheckbox",{attrs:{checked:t.canUpdate,disabled:t.saving},on:{"update:checked":function(e){t.canUpdate=e},change:function(e){return t.queueUpdate("permissions")}}},[t._v("\n\t\t\t\t\t"+t._s(t.t("files_sharing","Allow editing"))+"\n\t\t\t\t")]),t._v(" "),n("ActionCheckbox",{attrs:{checked:t.share.hideDownload,disabled:t.saving},on:{"update:checked":function(e){return t.$set(t.share,"hideDownload",e)},change:function(e){return t.queueUpdate("hideDownload")}}},[t._v("\n\t\t\t\t\t"+t._s(t.t("files_sharing","Hide download"))+"\n\t\t\t\t")]),t._v(" "),n("ActionCheckbox",{staticClass:"share-link-password-checkbox",attrs:{checked:t.isPasswordProtected,disabled:t.config.enforcePasswordForPublicLink||t.saving},on:{"update:checked":function(e){t.isPasswordProtected=e},uncheck:t.onPasswordDisable}},[t._v("\n\t\t\t\t\t"+t._s(t.config.enforcePasswordForPublicLink?t.t("files_sharing","Password protection (enforced)"):t.t("files_sharing","Password protect"))+"\n\t\t\t\t")]),t._v(" "),t.isPasswordProtected?n("ActionInput",{directives:[{name:"tooltip",rawName:"v-tooltip.auto",value:{content:t.errors.password,show:t.errors.password,trigger:"manual",defaultContainer:"#app-sidebar"},expression:"{\n\t\t\t\t\t\tcontent: errors.password,\n\t\t\t\t\t\tshow: errors.password,\n\t\t\t\t\t\ttrigger: 'manual',\n\t\t\t\t\t\tdefaultContainer: '#app-sidebar'\n\t\t\t\t\t}",modifiers:{auto:!0}}],ref:"password",staticClass:"share-link-password",class:{error:t.errors.password},attrs:{disabled:t.saving,required:t.config.enforcePasswordForPublicLink,value:t.hasUnsavedPassword?t.share.newPassword:"***************",icon:"icon-password",autocomplete:"new-password",type:t.hasUnsavedPassword?"text":"password"},on:{"update:value":t.onPasswordChange,submit:t.onPasswordSubmit}},[t._v("\n\t\t\t\t\t"+t._s(t.t("files_sharing","Enter a password"))+"\n\t\t\t\t")]):t._e(),t._v(" "),t.isPasswordProtectedByTalkAvailable?n("ActionCheckbox",{staticClass:"share-link-password-talk-checkbox",attrs:{checked:t.isPasswordProtectedByTalk,disabled:t.saving},on:{"update:checked":function(e){t.isPasswordProtectedByTalk=e},change:function(e){return t.queueUpdate("sendPasswordByTalk")}}},[t._v("\n\t\t\t\t\t"+t._s(t.t("files_sharing","Video verification"))+"\n\t\t\t\t")]):t._e(),t._v(" "),n("ActionCheckbox",{staticClass:"share-link-expire-date-checkbox",attrs:{checked:t.hasExpirationDate,disabled:t.config.isDefaultExpireDateEnforced||t.saving},on:{"update:checked":function(e){t.hasExpirationDate=e},uncheck:t.onExpirationDisable}},[t._v("\n\t\t\t\t\t"+t._s(t.config.isDefaultExpireDateEnforced?t.t("files_sharing","Expiration date (enforced)"):t.t("files_sharing","Set expiration date"))+"\n\t\t\t\t")]),t._v(" "),t.hasExpirationDate?n("ActionInput",{directives:[{name:"tooltip",rawName:"v-tooltip.auto",value:{content:t.errors.expireDate,show:t.errors.expireDate,trigger:"manual",defaultContainer:"#app-sidebar"},expression:"{\n\t\t\t\t\t\tcontent: errors.expireDate,\n\t\t\t\t\t\tshow: errors.expireDate,\n\t\t\t\t\t\ttrigger: 'manual',\n\t\t\t\t\t\tdefaultContainer: '#app-sidebar'\n\t\t\t\t\t}",modifiers:{auto:!0}}],ref:"expireDate",staticClass:"share-link-expire-date",class:{error:t.errors.expireDate},attrs:{disabled:t.saving,"first-day-of-week":t.firstDay,lang:t.lang,value:t.share.expireDate,icon:"icon-calendar-dark",type:"date","not-before":t.dateTomorrow,"not-after":t.dateMaxEnforced},on:{"update:value":t.onExpirationChange}},[t._v("\n\t\t\t\t\t"+t._s(t.t("files_sharing","Enter a date"))+"\n\t\t\t\t")]):t._e(),t._v(" "),n("ActionCheckbox",{attrs:{checked:t.hasNote,disabled:t.saving},on:{"update:checked":function(e){t.hasNote=e},uncheck:function(e){return t.queueUpdate("note")}}},[t._v("\n\t\t\t\t\t"+t._s(t.t("files_sharing","Note to recipient"))+"\n\t\t\t\t")]),t._v(" "),t.hasNote?n("ActionTextEditable",{directives:[{name:"tooltip",rawName:"v-tooltip.auto",value:{content:t.errors.note,show:t.errors.note,trigger:"manual",defaultContainer:"#app-sidebar"},expression:"{\n\t\t\t\t\t\tcontent: errors.note,\n\t\t\t\t\t\tshow: errors.note,\n\t\t\t\t\t\ttrigger: 'manual',\n\t\t\t\t\t\tdefaultContainer: '#app-sidebar'\n\t\t\t\t\t}",modifiers:{auto:!0}}],ref:"note",class:{error:t.errors.note},attrs:{disabled:t.saving,placeholder:t.t("files_sharing","Enter a note for the share recipient"),value:t.share.newNote||t.share.note,icon:"icon-edit"},on:{"update:value":t.onNoteChange,submit:t.onNoteSubmit}}):t._e()]:t._e(),t._v(" "),t._l(t.externalActions,(function(e,r){var o=e.icon,i=e.url,a=e.name;return n("ActionLink",{key:r,attrs:{href:i(t.shareLink),icon:o,target:"_blank"}},[t._v("\n\t\t\t\t"+t._s(a)+"\n\t\t\t")])})),t._v(" "),t.share.canDelete?n("ActionButton",{attrs:{icon:"icon-close",disabled:t.saving},on:{click:function(e){return e.preventDefault(),t.onDelete(e)}}},[t._v("\n\t\t\t\t"+t._s(t.t("files_sharing","Unshare"))+"\n\t\t\t")]):t._e(),t._v(" "),!t.isEmailShareType&&t.canReshare?n("ActionButton",{staticClass:"new-share-link",attrs:{icon:"icon-add"},on:{click:function(e){return e.preventDefault(),e.stopPropagation(),t.onNewLinkShare(e)}}},[t._v("\n\t\t\t\t"+t._s(t.t("files_sharing","Add another link"))+"\n\t\t\t")]):t._e()]:t.canReshare?n("ActionButton",{staticClass:"new-share-link",attrs:{icon:"icon-add"},on:{click:function(e){return e.preventDefault(),e.stopPropagation(),t.onNewLinkShare(e)}}},[t._v("\n\t\t\t"+t._s(t.t("files_sharing","Create a new share link"))+"\n\t\t")]):t._e()],2):n("Actions",{staticClass:"sharing-entry__actions",attrs:{"menu-align":"right",open:t.open},on:{"update:open":function(e){t.open=e},close:t.onNewLinkShare}},[t.errors.pending?n("ActionText",{class:{error:t.errors.pending},attrs:{icon:"icon-error"}},[t._v("\n\t\t\t"+t._s(t.errors.pending)+"\n\t\t")]):n("ActionText",{attrs:{icon:"icon-info"}},[t._v("\n\t\t\t"+t._s(t.t("files_sharing","Please enter the following required information before creating the share"))+"\n\t\t")]),t._v(" "),t.pendingPassword?n("ActionText",{attrs:{icon:"icon-password"}},[t._v("\n\t\t\t"+t._s(t.t("files_sharing","Password protection (enforced)"))+"\n\t\t")]):t.config.enableLinkPasswordByDefault?n("ActionCheckbox",{staticClass:"share-link-password-checkbox",attrs:{checked:t.isPasswordProtected,disabled:t.config.enforcePasswordForPublicLink||t.saving},on:{"update:checked":function(e){t.isPasswordProtected=e},uncheck:t.onPasswordDisable}},[t._v("\n\t\t\t"+t._s(t.t("files_sharing","Password protection"))+"\n\t\t")]):t._e(),t._v(" "),t.pendingPassword||t.share.password?n("ActionInput",{directives:[{name:"tooltip",rawName:"v-tooltip.auto",value:{content:t.errors.password,show:t.errors.password,trigger:"manual",defaultContainer:"#app-sidebar"},expression:"{\n\t\t\t\tcontent: errors.password,\n\t\t\t\tshow: errors.password,\n\t\t\t\ttrigger: 'manual',\n\t\t\t\tdefaultContainer: '#app-sidebar'\n\t\t\t}",modifiers:{auto:!0}}],staticClass:"share-link-password",attrs:{value:t.share.password,disabled:t.saving,required:t.config.enableLinkPasswordByDefault||t.config.enforcePasswordForPublicLink,minlength:t.isPasswordPolicyEnabled&&t.config.passwordPolicy.minLength,icon:"",autocomplete:"new-password"},on:{"update:value":function(e){return t.$set(t.share,"password",e)},submit:t.onNewLinkShare}},[t._v("\n\t\t\t"+t._s(t.t("files_sharing","Enter a password"))+"\n\t\t")]):t._e(),t._v(" "),t.pendingExpirationDate?n("ActionText",{attrs:{icon:"icon-calendar-dark"}},[t._v("\n\t\t\t"+t._s(t.t("files_sharing","Expiration date (enforced)"))+"\n\t\t")]):t._e(),t._v(" "),t.pendingExpirationDate?n("ActionInput",{directives:[{name:"tooltip",rawName:"v-tooltip.auto",value:{content:t.errors.expireDate,show:t.errors.expireDate,trigger:"manual",defaultContainer:"#app-sidebar"},expression:"{\n\t\t\t\tcontent: errors.expireDate,\n\t\t\t\tshow: errors.expireDate,\n\t\t\t\ttrigger: 'manual',\n\t\t\t\tdefaultContainer: '#app-sidebar'\n\t\t\t}",modifiers:{auto:!0}}],staticClass:"share-link-expire-date",attrs:{disabled:t.saving,"first-day-of-week":t.firstDay,lang:t.lang,icon:"",type:"date","not-before":t.dateTomorrow,"not-after":t.dateMaxEnforced},model:{value:t.share.expireDate,callback:function(e){t.$set(t.share,"expireDate",e)},expression:"share.expireDate"}},[t._v("\n\t\t\t"+t._s(t.t("files_sharing","Enter a date"))+"\n\t\t")]):t._e(),t._v(" "),n("ActionButton",{attrs:{icon:"icon-close"},on:{click:function(e){return e.preventDefault(),e.stopPropagation(),t.onCancel(e)}}},[t._v("\n\t\t\t"+t._s(t.t("files_sharing","Cancel"))+"\n\t\t")])],1)],1)}),[],!1,null,"294d1e5a",null).exports},mixins:[g],props:{fileInfo:{type:Object,default:function(){},required:!0},shares:{type:Array,default:function(){return[]},required:!0},canReshare:{type:Boolean,required:!0}},data:function(){return{canLinkShare:OC.getCapabilities().files_sharing.public.enabled}},computed:{hasLinkShares:function(){var t=this;return this.shares.filter((function(e){return e.type===t.SHARE_TYPES.SHARE_TYPE_LINK})).length>0},hasShares:function(){return this.shares.length>0}},methods:{addShare:function(t,e){this.shares.unshift(t),this.awaitForShare(t,e)},awaitForShare:function(t,e){var n=this;this.$nextTick((function(){var r=n.$children.find((function(e){return e.share===t}));r&&e(r)}))},removeShare:function(t){var e=this.shares.findIndex((function(e){return e===t}));this.shares.splice(e,1)}}}),Qt=Object(T.a)(Rt,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return t.canLinkShare?n("ul",{staticClass:"sharing-link-list"},[!t.hasLinkShares&&t.canReshare?n("SharingEntryLink",{attrs:{"can-reshare":t.canReshare,"file-info":t.fileInfo},on:{"add:share":t.addShare}}):t._e(),t._v(" "),t.hasShares?t._l(t.shares,(function(e,r){return n("SharingEntryLink",{key:e.id,attrs:{"can-reshare":t.canReshare,share:t.shares[r],"file-info":t.fileInfo},on:{"update:share":[function(e){return t.$set(t.shares,r,e)},function(e){return t.awaitForShare.apply(void 0,arguments)}],"add:share":function(e){return t.addShare.apply(void 0,arguments)},"remove:share":t.removeShare}})})):t._e()],2):t._e()}),[],!1,null,null,null).exports,Pt={name:"SharingEntry",components:{Actions:w.a,ActionButton:ot.a,ActionCheckbox:yt.a,ActionInput:_t.a,ActionTextEditable:Ct.a,Avatar:s.a},directives:{Tooltip:E.a},mixins:[ft],data:function(){return{permissionsEdit:OC.PERMISSION_UPDATE,permissionsCreate:OC.PERMISSION_CREATE,permissionsDelete:OC.PERMISSION_DELETE,permissionsRead:OC.PERMISSION_READ,permissionsShare:OC.PERMISSION_SHARE}},computed:{title:function(){var e=this.share.shareWithDisplayName;return this.share.type===this.SHARE_TYPES.SHARE_TYPE_GROUP?e+=" (".concat(t("files_sharing","group"),")"):this.share.type===this.SHARE_TYPES.SHARE_TYPE_ROOM?e+=" (".concat(t("files_sharing","conversation"),")"):this.share.type===this.SHARE_TYPES.SHARE_TYPE_REMOTE?e+=" (".concat(t("files_sharing","remote"),")"):this.share.type===this.SHARE_TYPES.SHARE_TYPE_REMOTE_GROUP?e+=" (".concat(t("files_sharing","remote group"),")"):this.share.type===this.SHARE_TYPES.SHARE_TYPE_GUEST&&(e+=" (".concat(t("files_sharing","guest"),")")),e},tooltip:function(){if(this.share.owner!==this.share.uidFileOwner){var e={user:this.share.shareWithDisplayName,owner:this.share.owner};return this.share.type===this.SHARE_TYPES.SHARE_TYPE_GROUP?t("files_sharing","Shared with the group {user} by {owner}",e):this.share.type===this.SHARE_TYPES.SHARE_TYPE_ROOM?t("files_sharing","Shared with the conversation {user} by {owner}",e):t("files_sharing","Shared with {user} by {owner}",e)}return null},canHaveNote:function(){return this.share.type!==this.SHARE_TYPES.SHARE_TYPE_REMOTE&&this.share.type!==this.SHARE_TYPES.SHARE_TYPE_REMOTE_GROUP},canEdit:{get:function(){return this.share.hasUpdatePermission},set:function(t){this.updatePermissions({isEditChecked:t})}},canCreate:{get:function(){return this.share.hasCreatePermission},set:function(t){this.updatePermissions({isCreateChecked:t})}},canDelete:{get:function(){return this.share.hasDeletePermission},set:function(t){this.updatePermissions({isDeleteChecked:t})}},canReshare:{get:function(){return this.share.hasSharePermission},set:function(t){this.updatePermissions({isReshareChecked:t})}},isFolder:function(){return"dir"===this.fileInfo.type},hasExpirationDate:{get:function(){return this.config.isDefaultInternalExpireDateEnforced||!!this.share.expireDate},set:function(t){this.share.expireDate=t?""!==this.config.defaultInternalExpirationDateString?this.config.defaultInternalExpirationDateString:moment().format("YYYY-MM-DD"):""}},dateMaxEnforced:function(){return this.config.isDefaultInternalExpireDateEnforced&&moment().add(1+this.config.defaultInternalExpireDate,"days")}},methods:{updatePermissions:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.isEditChecked,n=void 0===e?this.canEdit:e,r=t.isCreateChecked,o=void 0===r?this.canCreate:r,i=t.isDeleteChecked,a=void 0===i?this.canDelete:i,s=t.isReshareChecked,A=void 0===s?this.canReshare:s,c=this.permissionsRead|(o?this.permissionsCreate:0)|(a?this.permissionsDelete:0)|(n?this.permissionsEdit:0)|(A?this.permissionsShare:0);this.share.permissions=c,this.queueUpdate("permissions")},onMenuClose:function(){this.onNoteSubmit()}}},Gt=(r(823),{name:"SharingList",components:{SharingEntry:Object(T.a)(Pt,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("li",{staticClass:"sharing-entry"},[n("Avatar",{staticClass:"sharing-entry__avatar",attrs:{user:t.share.shareWith,"display-name":t.share.shareWithDisplayName,url:t.share.shareWithAvatar}}),t._v(" "),n("div",{directives:[{name:"tooltip",rawName:"v-tooltip.auto",value:t.tooltip,expression:"tooltip",modifiers:{auto:!0}}],staticClass:"sharing-entry__desc"},[n("h5",[t._v(t._s(t.title))])]),t._v(" "),n("Actions",{staticClass:"sharing-entry__actions",attrs:{"menu-align":"right"},on:{close:t.onMenuClose}},[t.share.canEdit?[n("ActionCheckbox",{ref:"canEdit",attrs:{checked:t.canEdit,value:t.permissionsEdit,disabled:t.saving},on:{"update:checked":function(e){t.canEdit=e}}},[t._v("\n\t\t\t\t"+t._s(t.t("files_sharing","Allow editing"))+"\n\t\t\t")]),t._v(" "),t.isFolder?n("ActionCheckbox",{ref:"canCreate",attrs:{checked:t.canCreate,value:t.permissionsCreate,disabled:t.saving},on:{"update:checked":function(e){t.canCreate=e}}},[t._v("\n\t\t\t\t"+t._s(t.t("files_sharing","Allow creating"))+"\n\t\t\t")]):t._e(),t._v(" "),t.isFolder?n("ActionCheckbox",{ref:"canDelete",attrs:{checked:t.canDelete,value:t.permissionsDelete,disabled:t.saving},on:{"update:checked":function(e){t.canDelete=e}}},[t._v("\n\t\t\t\t"+t._s(t.t("files_sharing","Allow deleting"))+"\n\t\t\t")]):t._e(),t._v(" "),n("ActionCheckbox",{ref:"canReshare",attrs:{checked:t.canReshare,value:t.permissionsShare,disabled:t.saving},on:{"update:checked":function(e){t.canReshare=e}}},[t._v("\n\t\t\t\t"+t._s(t.t("files_sharing","Allow resharing"))+"\n\t\t\t")]),t._v(" "),n("ActionCheckbox",{attrs:{checked:t.hasExpirationDate,disabled:t.config.isDefaultExpireDateEnforced||t.saving},on:{"update:checked":function(e){t.hasExpirationDate=e},uncheck:t.onExpirationDisable}},[t._v("\n\t\t\t\t"+t._s(t.config.isDefaultExpireDateEnforced?t.t("files_sharing","Expiration date enforced"):t.t("files_sharing","Set expiration date"))+"\n\t\t\t")]),t._v(" "),t.hasExpirationDate?n("ActionInput",{directives:[{name:"tooltip",rawName:"v-tooltip.auto",value:{content:t.errors.expireDate,show:t.errors.expireDate,trigger:"manual"},expression:"{\n\t\t\t\t\tcontent: errors.expireDate,\n\t\t\t\t\tshow: errors.expireDate,\n\t\t\t\t\ttrigger: 'manual'\n\t\t\t\t}",modifiers:{auto:!0}}],ref:"expireDate",class:{error:t.errors.expireDate},attrs:{disabled:t.saving,"first-day-of-week":t.firstDay,lang:t.lang,value:t.share.expireDate,icon:"icon-calendar-dark",type:"date","not-before":t.dateTomorrow,"not-after":t.dateMaxEnforced},on:{"update:value":t.onExpirationChange}},[t._v("\n\t\t\t\t"+t._s(t.t("files_sharing","Enter a date"))+"\n\t\t\t")]):t._e(),t._v(" "),t.canHaveNote?[n("ActionCheckbox",{attrs:{checked:t.hasNote,disabled:t.saving},on:{"update:checked":function(e){t.hasNote=e},uncheck:function(e){return t.queueUpdate("note")}}},[t._v("\n\t\t\t\t\t"+t._s(t.t("files_sharing","Note to recipient"))+"\n\t\t\t\t")]),t._v(" "),t.hasNote?n("ActionTextEditable",{directives:[{name:"tooltip",rawName:"v-tooltip.auto",value:{content:t.errors.note,show:t.errors.note,trigger:"manual"},expression:"{\n\t\t\t\t\t\tcontent: errors.note,\n\t\t\t\t\t\tshow: errors.note,\n\t\t\t\t\t\ttrigger: 'manual'\n\t\t\t\t\t}",modifiers:{auto:!0}}],ref:"note",class:{error:t.errors.note},attrs:{disabled:t.saving,value:t.share.newNote||t.share.note,icon:"icon-edit"},on:{"update:value":t.onNoteChange,submit:t.onNoteSubmit}}):t._e()]:t._e()]:t._e(),t._v(" "),t.share.canDelete?n("ActionButton",{attrs:{icon:"icon-close",disabled:t.saving},on:{click:function(e){return e.preventDefault(),t.onDelete(e)}}},[t._v("\n\t\t\t"+t._s(t.t("files_sharing","Unshare"))+"\n\t\t")]):t._e()],2)],1)}),[],!1,null,"462ee840",null).exports},props:{fileInfo:{type:Object,default:function(){},required:!0},shares:{type:Array,default:function(){return[]},required:!0}},computed:{hasShares:function(){return 0===this.shares.length}},methods:{removeShare:function(t){var e=this.shares.findIndex((function(e){return e===t}));this.shares.splice(e,1)}}}),Yt=Object(T.a)(Gt,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("ul",{staticClass:"sharing-sharee-list"},t._l(t.shares,(function(e){return n("SharingEntry",{key:e.id,attrs:{"file-info":t.fileInfo,share:e},on:{"remove:share":t.removeShare}})})),1)}),[],!1,null,null,null).exports;function Ut(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if(!(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t)))return;var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=t[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{r||null==s.return||s.return()}finally{if(o)throw i}}return n}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Ht(t,e,n,r,o,i,a){try{var s=t[i](a),A=s.value}catch(t){return void n(t)}s.done?e(A):Promise.resolve(A).then(r,o)}var Ft,zt={name:"SharingTab",components:{Avatar:s.a,CollectionList:o.a,SharingEntryInternal:S,SharingEntrySimple:C,SharingInherited:mt,SharingInput:nt,SharingLinkList:Qt,SharingList:Yt,Tab:l.a},mixins:[g],props:{fileInfo:{type:Object,default:function(){},required:!0}},data:function(){return{error:"",expirationInterval:null,icon:"icon-share",loading:!0,name:t("files_sharing","Sharing"),reshare:null,sharedWithMe:{},shares:[],linkShares:[],sections:OCA.Sharing.ShareTabSections.getSections()}},computed:{id:function(){return"sharing"},activeTab:function(){return this.$parent.activeTab},isSharedWithMe:function(){return Object.keys(this.sharedWithMe).length>0},canReshare:function(){return!!(this.fileInfo.permissions&OC.PERMISSION_SHARE)||!(!this.reshare||!this.reshare.hasSharePermission)}},watch:{fileInfo:function(){this.resetState(),this.getShares()}},beforeMount:function(){this.getShares()},methods:{getShares:(Ft=function(t){return function(){var e=this,n=arguments;return new Promise((function(r,o){var i=t.apply(e,n);function a(t){Ht(i,r,o,a,s,"next",t)}function s(t){Ht(i,r,o,a,s,"throw",t)}a(void 0)}))}}(regeneratorRuntime.mark((function e(){var n,r,o,a,s,A,u,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,this.loading=!0,n=Object(i.generateOcsUrl)("apps/files_sharing/api/v1",2)+"shares",r=(this.fileInfo.path+"/"+this.fileInfo.name).replace("//","/"),o=c.a.get(n,{params:{format:"json",path:r,reshares:!0}}),a=c.a.get(n,{params:{format:"json",path:r,shared_with_me:!0}}),e.next=9,Promise.all([o,a]);case 9:s=e.sent,A=Ut(s,2),u=A[0],l=A[1],this.loading=!1,this.processSharedWithMe(l),this.processShares(u),e.next=23;break;case 18:e.prev=18,e.t0=e.catch(0),this.error=t("files_sharing","Unable to load the shares list"),this.loading=!1,console.error("Error loading the shares list",e.t0);case 23:case"end":return e.stop()}}),e,this,[[0,18]])}))),function(){return Ft.apply(this,arguments)}),resetState:function(){clearInterval(this.expirationInterval),this.loading=!0,this.error="",this.sharedWithMe={},this.shares=[]},updateExpirationSubtitle:function(e){var n=moment(e.expireDate).unix();this.$set(this.sharedWithMe,"subtitle",t("files_sharing","Expires {relativetime}",{relativetime:OC.Util.relativeModifiedDate(1e3*n)})),moment().unix()>n&&(clearInterval(this.expirationInterval),this.$set(this.sharedWithMe,"subtitle",t("files_sharing","this share just expired.")))},processShares:function(t){var e=this,n=t.data;if(n.ocs&&n.ocs.data&&n.ocs.data.length>0){var r=n.ocs.data.map((function(t){return new h(t)})).sort((function(t,e){return e.createdTime-t.createdTime}));this.linkShares=r.filter((function(t){return t.type===e.SHARE_TYPES.SHARE_TYPE_LINK||t.type===e.SHARE_TYPES.SHARE_TYPE_EMAIL})),this.shares=r.filter((function(t){return t.type!==e.SHARE_TYPES.SHARE_TYPE_LINK&&t.type!==e.SHARE_TYPES.SHARE_TYPE_EMAIL}))}},processSharedWithMe:function(e){var n=e.data;if(n.ocs&&n.ocs.data&&n.ocs.data[0]){var r=new h(n),o=function(e){return e.type===OC.Share.SHARE_TYPE_GROUP?t("files_sharing","Shared with you and the group {group} by {owner}",{group:e.shareWithDisplayName,owner:e.ownerDisplayName},void 0,{escape:!1}):e.type===OC.Share.SHARE_TYPE_CIRCLE?t("files_sharing","Shared with you and {circle} by {owner}",{circle:e.shareWithDisplayName,owner:e.ownerDisplayName},void 0,{escape:!1}):e.type===OC.Share.SHARE_TYPE_ROOM?e.shareWithDisplayName?t("files_sharing","Shared with you and the conversation {conversation} by {owner}",{conversation:e.shareWithDisplayName,owner:e.ownerDisplayName},void 0,{escape:!1}):t("files_sharing","Shared with you in a conversation by {owner}",{owner:e.ownerDisplayName},void 0,{escape:!1}):t("files_sharing","Shared with you by {owner}",{owner:e.ownerDisplayName},void 0,{escape:!1})}(r),i=r.ownerDisplayName,a=r.owner;this.sharedWithMe={displayName:i,title:o,user:a},this.reshare=r,r.expireDate&&moment(r.expireDate).unix()>moment().unix()&&(this.updateExpirationSubtitle(r),this.expirationInterval=setInterval(this.updateExpirationSubtitle,1e4,r))}},addShare:function(t){t.type===this.SHARE_TYPES.SHARE_TYPE_EMAIL?this.linkShares.unshift(t):this.shares.unshift(t)}}},Zt=Object(T.a)(zt,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("Tab",{class:{"icon-loading":t.loading},attrs:{id:t.id,icon:t.icon,name:t.name}},[t.error?n("div",{staticClass:"emptycontent"},[n("div",{staticClass:"icon icon-error"}),t._v(" "),n("h2",[t._v(t._s(t.error))])]):[t.isSharedWithMe?n("SharingEntrySimple",t._b({staticClass:"sharing-entry__reshare",scopedSlots:t._u([{key:"avatar",fn:function(){return[n("Avatar",{staticClass:"sharing-entry__avatar",attrs:{user:t.sharedWithMe.user,"display-name":t.sharedWithMe.displayName,"tooltip-message":""}})]},proxy:!0}],null,!1,1643724538)},"SharingEntrySimple",t.sharedWithMe,!1)):t._e(),t._v(" "),t.loading?t._e():n("SharingInput",{attrs:{"can-reshare":t.canReshare,"file-info":t.fileInfo,"link-shares":t.linkShares,reshare:t.reshare,shares:t.shares},on:{"add:share":t.addShare}}),t._v(" "),t.loading?t._e():n("SharingLinkList",{attrs:{"can-reshare":t.canReshare,"file-info":t.fileInfo,shares:t.linkShares}}),t._v(" "),t.loading?t._e():n("SharingList",{attrs:{shares:t.shares,"file-info":t.fileInfo}}),t._v(" "),t.canReshare&&!t.loading?n("SharingInherited",{attrs:{"file-info":t.fileInfo}}):t._e(),t._v(" "),n("SharingEntryInternal",{attrs:{"file-info":t.fileInfo}}),t._v(" "),t.fileInfo?n("CollectionList",{attrs:{id:""+t.fileInfo.id,type:"file",name:t.fileInfo.name}}):t._e(),t._v(" "),t._l(t.sections,(function(e,r){return n("div",{key:r,ref:"section-"+r,refInFor:!0,staticClass:"sharingTab__additionalContent"},[n(e(t.$refs["section-"+r],t.fileInfo),{tag:"component",attrs:{"file-info":t.fileInfo}})],1)}))]],2)}),[],!1,null,"6c172dd3",null).exports;function $t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function Wt(t,e){if(!Object.prototype.hasOwnProperty.call(t,e))throw new TypeError("attempted to use private field on non-instance");return t}var Vt=0;
+ */var lt,ft={mixins:[$,g],props:{fileInfo:{type:Object,default:function(){},required:!0},share:{type:h,default:null}},data:function(){return{config:new Q,errors:{},loading:!1,saving:!1,open:!1,updateQueue:new At.a({concurrency:1}),reactiveState:this.share&&this.share.state,SHARE_TYPES:{SHARE_TYPE_USER:OC.Share.SHARE_TYPE_USER,SHARE_TYPE_GROUP:OC.Share.SHARE_TYPE_GROUP,SHARE_TYPE_LINK:OC.Share.SHARE_TYPE_LINK,SHARE_TYPE_EMAIL:OC.Share.SHARE_TYPE_EMAIL,SHARE_TYPE_REMOTE:OC.Share.SHARE_TYPE_REMOTE,SHARE_TYPE_CIRCLE:OC.Share.SHARE_TYPE_CIRCLE,SHARE_TYPE_GUEST:OC.Share.SHARE_TYPE_GUEST,SHARE_TYPE_REMOTE_GROUP:OC.Share.SHARE_TYPE_REMOTE_GROUP,SHARE_TYPE_ROOM:OC.Share.SHARE_TYPE_ROOM}}},computed:{hasNote:{get:function(){return""!==this.share.note},set:function(t){this.share.note=t?null:""}},dateTomorrow:function(){return moment().add(1,"days")},firstDay:function(){return window.firstDay?window.firstDay:0},lang:function(){return{days:window.dayNamesShort?window.dayNamesShort:["Sun.","Mon.","Tue.","Wed.","Thu.","Fri.","Sat."],months:window.monthNamesShort?window.monthNamesShort:["Jan.","Feb.","Mar.","Apr.","May.","Jun.","Jul.","Aug.","Sep.","Oct.","Nov.","Dec."],placeholder:{date:"Select Date"}}},isShareOwner:function(){return this.share&&this.share.owner===Object(N.getCurrentUser)().uid}},methods:{checkShare:function(t){if(t.password&&("string"!=typeof t.password||""===t.password.trim()))return!1;if(t.expirationDate&&!moment(t.expirationDate).isValid())return!1;return!0},onExpirationChange:function(t){var e=moment(t).format("YYYY-MM-DD");this.share.expireDate=e,this.queueUpdate("expireDate")},onExpirationDisable:function(){this.share.expireDate="",this.queueUpdate("expireDate")},onNoteChange:function(t){this.$set(this.share,"newNote",t.trim())},onNoteSubmit:function(){this.share.newNote&&(this.share.note=this.share.newNote,this.$delete(this.share,"newNote"),this.queueUpdate("note"))},onDelete:(lt=ut(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,this.loading=!0,this.open=!1,t.next=5,this.deleteShare(this.share.id);case 5:console.debug("Share deleted",this.share.id),this.$emit("remove:share",this.share),t.next=12;break;case 9:t.prev=9,t.t0=t.catch(0),this.open=!0;case 12:return t.prev=12,this.loading=!1,t.finish(12);case 15:case"end":return t.stop()}}),t,this,[[0,9,12,15]])}))),function(){return lt.apply(this,arguments)}),queueUpdate:function(t){var e=this;if(this.share.id){var n=this.share[t].toString();this.updateQueue.add(ut(regeneratorRuntime.mark((function r(){var o;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return e.saving=!0,e.errors={},r.prev=2,r.next=5,e.updateShare(e.share.id,{property:t,value:n});case 5:e.$delete(e.errors,t),e.$delete(e.share,"newPassword"),r.next=13;break;case 9:r.prev=9,r.t0=r.catch(2),(o=r.t0.message)&&""!==o&&e.onSyncError(t,o);case 13:return r.prev=13,e.saving=!1,r.finish(13);case 16:case"end":return r.stop()}}),r,null,[[2,9,13,16]])}))))}else console.error("Cannot update share.",this.share,"No valid id")},onSyncError:function(t,e){switch(this.open=!0,t){case"password":case"pending":case"expireDate":case"note":this.$set(this.errors,t,e);var n=this.$refs[t];if(n){n.$el&&(n=n.$el);var r=n.querySelector(".focusable");r&&r.focus()}}},debounceQueueUpdate:k()((function(t){this.queueUpdate(t)}),500)}},dt={name:"SharingEntryInherited",components:{ActionButton:ot.a,ActionLink:b.a,ActionText:at.a,Avatar:s.a,SharingEntrySimple:C},mixins:[ft],props:{share:{type:h,required:!0}},computed:{fileTargetUrl:function(){return Object(i.generateUrl)("/f/{fileid}",{fileid:this.share.fileSource})}}},pt=(r(817),Object(T.a)(dt,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("SharingEntrySimple",{key:t.share.id,staticClass:"sharing-entry__inherited",attrs:{title:t.share.shareWithDisplayName},scopedSlots:t._u([{key:"avatar",fn:function(){return[n("Avatar",{staticClass:"sharing-entry__avatar",attrs:{user:t.share.shareWith,"display-name":t.share.shareWithDisplayName,"tooltip-message":""}})]},proxy:!0}])},[t._v(" "),n("ActionText",{attrs:{icon:"icon-user"}},[t._v("\n\t\t"+t._s(t.t("files_sharing","Added by {initiator}",{initiator:t.share.ownerDisplayName}))+"\n\t")]),t._v(" "),t.share.canDelete&&t.share.fileSource?n("ActionLink",{attrs:{icon:"icon-folder",href:t.fileTargetUrl}},[t._v("\n\t\t"+t._s(t.t("files_sharing","Via folder"))+"\n\t")]):t._e(),t._v(" "),t.share.canDelete?n("ActionButton",{attrs:{icon:"icon-close"},on:{click:function(e){return e.preventDefault(),t.onDelete(e)}}},[t._v("\n\t\t"+t._s(t.t("files_sharing","Unshare"))+"\n\t")]):t._e()],1)}),[],!1,null,"7cbe9523",null).exports);function ht(t,e,n,r,o,i,a){try{var s=t[i](a),A=s.value}catch(t){return void n(t)}s.done?e(A):Promise.resolve(A).then(r,o)}var vt,gt={name:"SharingInherited",components:{ActionButton:ot.a,SharingEntryInherited:pt,SharingEntrySimple:C},props:{fileInfo:{type:Object,default:function(){},required:!0}},data:function(){return{loaded:!1,loading:!1,showInheritedShares:!1,shares:[]}},computed:{showInheritedSharesIcon:function(){return this.loading?"icon-loading-small":this.showInheritedShares?"icon-triangle-n":"icon-triangle-s"},mainTitle:function(){return t("files_sharing","Others with access")},subTitle:function(){return this.showInheritedShares&&0===this.shares.length?t("files_sharing","No other users with access found"):""},toggleTooltip:function(){return"dir"===this.fileInfo.type?t("files_sharing","Toggle list of others with access to this directory"):t("files_sharing","Toggle list of others with access to this file")},fullPath:function(){return"".concat(this.fileInfo.path,"/").concat(this.fileInfo.name).replace("//","/")}},watch:{fileInfo:function(){this.resetState()}},methods:{toggleInheritedShares:function(){this.showInheritedShares=!this.showInheritedShares,this.showInheritedShares?this.fetchInheritedShares():this.resetState()},fetchInheritedShares:(vt=function(t){return function(){var e=this,n=arguments;return new Promise((function(r,o){var i=t.apply(e,n);function a(t){ht(i,r,o,a,s,"next",t)}function s(t){ht(i,r,o,a,s,"throw",t)}a(void 0)}))}}(regeneratorRuntime.mark((function e(){var n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.loading=!0,e.prev=1,n=Object(i.generateOcsUrl)("apps/files_sharing/api/v1/shares/inherited?format=json&path=".concat(this.fullPath),2),e.next=5,c.a.get(n.replace(/\/$/,""));case 5:r=e.sent,this.shares=r.data.ocs.data.map((function(t){return new h(t)})).sort((function(t,e){return e.createdTime-t.createdTime})),console.info(this.shares),this.loaded=!0,e.next=14;break;case 11:e.prev=11,e.t0=e.catch(1),OC.Notification.showTemporary(t("files_sharing","Unable to fetch inherited shares"),{type:"error"});case 14:return e.prev=14,this.loading=!1,e.finish(14);case 17:case"end":return e.stop()}}),e,this,[[1,11,14,17]])}))),function(){return vt.apply(this,arguments)}),resetState:function(){this.loaded=!1,this.loading=!1,this.showInheritedShares=!1,this.shares=[]}}},mt=(r(819),Object(T.a)(gt,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("ul",{attrs:{id:"sharing-inherited-shares"}},[n("SharingEntrySimple",{staticClass:"sharing-entry__inherited",attrs:{title:t.mainTitle,subtitle:t.subTitle},scopedSlots:t._u([{key:"avatar",fn:function(){return[n("div",{staticClass:"avatar-shared icon-more-white"})]},proxy:!0}])},[t._v(" "),n("ActionButton",{attrs:{icon:t.showInheritedSharesIcon},on:{click:function(e){return e.preventDefault(),e.stopPropagation(),t.toggleInheritedShares(e)}}},[t._v("\n\t\t\t"+t._s(t.toggleTooltip)+"\n\t\t")])],1),t._v(" "),t._l(t.shares,(function(t){return n("SharingEntryInherited",{key:t.id,attrs:{share:t}})}))],2)}),[],!1,null,"2ae2c800",null).exports),bt=r(280),yt=r.n(bt),wt=r(631),xt=r.n(wt),Et=r(281),_t=r.n(Et),Tt=r(282),Ct=r.n(Tt);function It(t){return(It="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Bt(t,e,n,r,o,i,a){try{var s=t[i](a),A=s.value}catch(t){return void n(t)}s.done?e(A):Promise.resolve(A).then(r,o)}function Mt(t){return function(){var e=this,n=arguments;return new Promise((function(r,o){var i=t.apply(e,n);function a(t){Bt(i,r,o,a,s,"next",t)}function s(t){Bt(i,r,o,a,s,"throw",t)}a(void 0)}))}}var Ot,St,Nt,Dt,kt,Lt="abcdefgijkmnopqrstwxyzABCDEFGHJKLMNPQRSTWXYZ23456789",jt={name:"SharingEntryLink",components:{Actions:w.a,ActionButton:ot.a,ActionCheckbox:yt.a,ActionRadio:xt.a,ActionInput:_t.a,ActionLink:b.a,ActionText:at.a,ActionTextEditable:Ct.a,Avatar:s.a},directives:{Tooltip:E.a},mixins:[ft],props:{canReshare:{type:Boolean,default:!0}},data:function(){return{copySuccess:!0,copied:!1,publicUploadRWValue:OC.PERMISSION_UPDATE|OC.PERMISSION_CREATE|OC.PERMISSION_READ|OC.PERMISSION_DELETE,publicUploadRValue:OC.PERMISSION_READ,publicUploadWValue:OC.PERMISSION_CREATE,ExternalLinkActions:OCA.Sharing.ExternalLinkActions.state}},computed:{randomId:function(){return Math.random().toString(27).substr(2)},title:function(){if(this.share&&this.share.id){if(!this.isShareOwner&&this.share.ownerDisplayName)return t("files_sharing","Shared via link by {initiator}",{initiator:this.share.ownerDisplayName});if(this.share.label&&""!==this.share.label.trim())return this.share.label;if(this.isEmailShareType)return this.share.shareWith}return t("files_sharing","Share link")},hasExpirationDate:{get:function(){return this.config.isDefaultExpireDateEnforced||!!this.share.expireDate},set:function(t){this.share.expireDate=t?""!==this.config.defaultExpirationDateString?this.config.defaultExpirationDateString:moment().format("YYYY-MM-DD"):""}},dateMaxEnforced:function(){return this.config.isDefaultExpireDateEnforced&&moment().add(1+this.config.defaultExpireDate,"days")},isPasswordProtected:{get:function(){return this.config.enforcePasswordForPublicLink||!!this.share.password},set:(kt=Mt(regeneratorRuntime.mark((function t(e){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!e){t.next=6;break}return t.next=3,this.generatePassword();case 3:t.t0=t.sent,t.next=7;break;case 6:t.t0="";case 7:this.share.password=t.t0,this.share.newPassword=this.share.password;case 9:case"end":return t.stop()}}),t,this)}))),function(t){return kt.apply(this,arguments)})},isTalkEnabled:function(){return void 0!==OC.appswebroots.spreed},isPasswordProtectedByTalkAvailable:function(){return this.isPasswordProtected&&this.isTalkEnabled},isPasswordProtectedByTalk:{get:function(){return this.share.sendPasswordByTalk},set:(Dt=Mt(regeneratorRuntime.mark((function t(e){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:this.share.sendPasswordByTalk=e;case 1:case"end":return t.stop()}}),t,this)}))),function(t){return Dt.apply(this,arguments)})},isEmailShareType:function(){return!!this.share&&this.share.type===this.SHARE_TYPES.SHARE_TYPE_EMAIL},pendingPassword:function(){return this.config.enforcePasswordForPublicLink&&this.share&&!this.share.id},pendingExpirationDate:function(){return this.config.isDefaultExpireDateEnforced&&this.share&&!this.share.id},canUpdate:{get:function(){return this.share.hasUpdatePermission},set:function(t){this.share.permissions=t?OC.PERMISSION_READ|OC.PERMISSION_UPDATE:OC.PERMISSION_READ}},hasUnsavedPassword:function(){return void 0!==this.share.newPassword},isFolder:function(){return"dir"===this.fileInfo.type},fileHasCreatePermission:function(){return!!(this.fileInfo.permissions&OC.PERMISSION_CREATE)},shareLink:function(){return window.location.protocol+"//"+window.location.host+Object(i.generateUrl)("/s/")+this.share.token},clipboardTooltip:function(){return this.copied?this.copySuccess?t("files_sharing","Link copied"):t("files_sharing","Cannot copy, please copy the link manually"):t("files_sharing","Copy to clipboard")},externalActions:function(){return this.ExternalLinkActions.actions},isPasswordPolicyEnabled:function(){return"object"===It(this.config.passwordPolicy)}},methods:{onNewLinkShare:(Nt=Mt(regeneratorRuntime.mark((function e(){var n,r,o,i,a=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n={share_type:OC.Share.SHARE_TYPE_LINK},this.config.isDefaultExpireDateEnforced&&(n.expiration=this.config.defaultExpirationDateString),!this.config.enableLinkPasswordByDefault){e.next=6;break}return e.next=5,this.generatePassword();case 5:n.password=e.sent;case 6:if(!this.config.enforcePasswordForPublicLink&&!this.config.isDefaultExpireDateEnforced){e.next=31;break}if(this.loading=!0,!this.share||this.share.id){e.next=18;break}if(!this.checkShare(this.share)){e.next=15;break}return e.next=12,this.pushNewLinkShare(this.share,!0);case 12:return e.abrupt("return",!0);case 15:return this.open=!0,OC.Notification.showTemporary(t("files_sharing","Error, please enter proper password and/or expiration date")),e.abrupt("return",!1);case 18:if(!this.config.enforcePasswordForPublicLink){e.next=22;break}return e.next=21,this.generatePassword();case 21:n.password=e.sent;case 22:return r=new h(n),e.next=25,new Promise((function(t){a.$emit("add:share",r,t)}));case 25:o=e.sent,this.open=!1,this.loading=!1,o.open=!0,e.next=34;break;case 31:return i=new h(n),e.next=34,this.pushNewLinkShare(i);case 34:case"end":return e.stop()}}),e,this)}))),function(){return Nt.apply(this,arguments)}),pushNewLinkShare:(St=Mt(regeneratorRuntime.mark((function t(e,n){var r,o,i,a,s,A=this;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,this.loading=!0,this.errors={},r=(this.fileInfo.path+"/"+this.fileInfo.name).replace("//","/"),t.next=6,this.createShare({path:r,shareType:OC.Share.SHARE_TYPE_LINK,password:e.password,expireDate:e.expireDate});case 6:if(o=t.sent,this.open=!1,console.debug("Link share created",o),!n){t.next=15;break}return t.next=12,new Promise((function(t){A.$emit("update:share",o,t)}));case 12:i=t.sent,t.next=18;break;case 15:return t.next=17,new Promise((function(t){A.$emit("add:share",o,t)}));case 17:i=t.sent;case 18:i.copyLink(),t.next=26;break;case 21:t.prev=21,t.t0=t.catch(0),a=t.t0.response,(s=a.data.ocs.meta.message).match(/password/i)?this.onSyncError("password",s):s.match(/date/i)?this.onSyncError("expireDate",s):this.onSyncError("pending",s);case 26:return t.prev=26,this.loading=!1,t.finish(26);case 29:case"end":return t.stop()}}),t,this,[[0,21,26,29]])}))),function(t,e){return St.apply(this,arguments)}),togglePermissions:function(t){var e=parseInt(t.target.value,10);this.share.permissions=e,this.queueUpdate("permissions")},generatePassword:(Ot=Mt(regeneratorRuntime.mark((function t(){var e;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.config.passwordPolicy.api||!this.config.passwordPolicy.api.generate){t.next=12;break}return t.prev=1,t.next=4,c.a.get(this.config.passwordPolicy.api.generate);case 4:if(!(e=t.sent).data.ocs.data.password){t.next=7;break}return t.abrupt("return",e.data.ocs.data.password);case 7:t.next=12;break;case 9:t.prev=9,t.t0=t.catch(1),console.info("Error generating password from password_policy",t.t0);case 12:return t.abrupt("return",Array(10).fill(0).reduce((function(t,e){return t+=Lt.charAt(Math.floor(Math.random()*Lt.length))}),""));case 13:case"end":return t.stop()}}),t,this,[[1,9]])}))),function(){return Ot.apply(this,arguments)}),copyLink:function(){var t=Mt(regeneratorRuntime.mark((function t(){var e=this;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.$copyText(this.shareLink);case 3:this.$refs.copyButton.$el.focus(),this.copySuccess=!0,this.copied=!0,t.next=13;break;case 8:t.prev=8,t.t0=t.catch(0),this.copySuccess=!1,this.copied=!0,console.error(t.t0);case 13:return t.prev=13,setTimeout((function(){e.copySuccess=!1,e.copied=!1}),4e3),t.finish(13);case 16:case"end":return t.stop()}}),t,this,[[0,8,13,16]])})));return function(){return t.apply(this,arguments)}}(),onPasswordChange:function(t){this.$set(this.share,"newPassword",t)},onPasswordDisable:function(){this.share.password="",this.$delete(this.share,"newPassword"),this.share.id&&this.queueUpdate("password")},onPasswordSubmit:function(){this.hasUnsavedPassword&&(this.share.password=this.share.newPassword.trim(),this.queueUpdate("password"))},onMenuClose:function(){this.onPasswordSubmit(),this.onNoteSubmit()},onCancel:function(){this.$emit("remove:share",this.share)}}},Rt=(r(821),{name:"SharingLinkList",components:{SharingEntryLink:Object(T.a)(jt,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("li",{staticClass:"sharing-entry sharing-entry__link",class:{"sharing-entry--share":t.share}},[n("Avatar",{staticClass:"sharing-entry__avatar",class:t.isEmailShareType?"icon-mail-white":"icon-public-white",attrs:{"is-no-user":!0}}),t._v(" "),n("div",{staticClass:"sharing-entry__desc"},[n("h5",[t._v(t._s(t.title))])]),t._v(" "),t.share&&!t.isEmailShareType&&t.share.token?n("Actions",{ref:"copyButton",staticClass:"sharing-entry__copy"},[n("ActionLink",{attrs:{href:t.shareLink,target:"_blank",icon:t.copied&&t.copySuccess?"icon-checkmark-color":"icon-clippy"},on:{click:function(e){return e.stopPropagation(),e.preventDefault(),t.copyLink(e)}}},[t._v("\n\t\t\t"+t._s(t.clipboardTooltip)+"\n\t\t")])],1):t._e(),t._v(" "),t.loading||!t.pendingPassword&&!t.pendingExpirationDate?t.loading?n("div",{staticClass:"icon-loading-small sharing-entry__loading"}):n("Actions",{staticClass:"sharing-entry__actions",attrs:{"menu-align":"right",open:t.open},on:{"update:open":function(e){t.open=e},close:t.onMenuClose}},[t.share?[t.share.canEdit?[t.isFolder&&t.fileHasCreatePermission&&t.config.isPublicUploadEnabled?[n("ActionRadio",{attrs:{checked:t.share.permissions===t.publicUploadRValue,value:t.publicUploadRValue,name:t.randomId,disabled:t.saving},on:{change:t.togglePermissions}},[t._v("\n\t\t\t\t\t\t"+t._s(t.t("files_sharing","Read only"))+"\n\t\t\t\t\t")]),t._v(" "),n("ActionRadio",{attrs:{checked:t.share.permissions===t.publicUploadRWValue,value:t.publicUploadRWValue,disabled:t.saving,name:t.randomId},on:{change:t.togglePermissions}},[t._v("\n\t\t\t\t\t\t"+t._s(t.t("files_sharing","Allow upload and editing"))+"\n\t\t\t\t\t")]),t._v(" "),n("ActionRadio",{staticClass:"sharing-entry__action--public-upload",attrs:{checked:t.share.permissions===t.publicUploadWValue,value:t.publicUploadWValue,disabled:t.saving,name:t.randomId},on:{change:t.togglePermissions}},[t._v("\n\t\t\t\t\t\t"+t._s(t.t("files_sharing","File drop (upload only)"))+"\n\t\t\t\t\t")])]:n("ActionCheckbox",{attrs:{checked:t.canUpdate,disabled:t.saving},on:{"update:checked":function(e){t.canUpdate=e},change:function(e){return t.queueUpdate("permissions")}}},[t._v("\n\t\t\t\t\t"+t._s(t.t("files_sharing","Allow editing"))+"\n\t\t\t\t")]),t._v(" "),n("ActionCheckbox",{attrs:{checked:t.share.hideDownload,disabled:t.saving},on:{"update:checked":function(e){return t.$set(t.share,"hideDownload",e)},change:function(e){return t.queueUpdate("hideDownload")}}},[t._v("\n\t\t\t\t\t"+t._s(t.t("files_sharing","Hide download"))+"\n\t\t\t\t")]),t._v(" "),n("ActionCheckbox",{staticClass:"share-link-password-checkbox",attrs:{checked:t.isPasswordProtected,disabled:t.config.enforcePasswordForPublicLink||t.saving},on:{"update:checked":function(e){t.isPasswordProtected=e},uncheck:t.onPasswordDisable}},[t._v("\n\t\t\t\t\t"+t._s(t.config.enforcePasswordForPublicLink?t.t("files_sharing","Password protection (enforced)"):t.t("files_sharing","Password protect"))+"\n\t\t\t\t")]),t._v(" "),t.isPasswordProtected?n("ActionInput",{directives:[{name:"tooltip",rawName:"v-tooltip.auto",value:{content:t.errors.password,show:t.errors.password,trigger:"manual",defaultContainer:"#app-sidebar"},expression:"{\n\t\t\t\t\t\tcontent: errors.password,\n\t\t\t\t\t\tshow: errors.password,\n\t\t\t\t\t\ttrigger: 'manual',\n\t\t\t\t\t\tdefaultContainer: '#app-sidebar'\n\t\t\t\t\t}",modifiers:{auto:!0}}],ref:"password",staticClass:"share-link-password",class:{error:t.errors.password},attrs:{disabled:t.saving,required:t.config.enforcePasswordForPublicLink,value:t.hasUnsavedPassword?t.share.newPassword:"***************",icon:"icon-password",autocomplete:"new-password",type:t.hasUnsavedPassword?"text":"password"},on:{"update:value":t.onPasswordChange,submit:t.onPasswordSubmit}},[t._v("\n\t\t\t\t\t"+t._s(t.t("files_sharing","Enter a password"))+"\n\t\t\t\t")]):t._e(),t._v(" "),t.isPasswordProtectedByTalkAvailable?n("ActionCheckbox",{staticClass:"share-link-password-talk-checkbox",attrs:{checked:t.isPasswordProtectedByTalk,disabled:t.saving},on:{"update:checked":function(e){t.isPasswordProtectedByTalk=e},change:function(e){return t.queueUpdate("sendPasswordByTalk")}}},[t._v("\n\t\t\t\t\t"+t._s(t.t("files_sharing","Video verification"))+"\n\t\t\t\t")]):t._e(),t._v(" "),n("ActionCheckbox",{staticClass:"share-link-expire-date-checkbox",attrs:{checked:t.hasExpirationDate,disabled:t.config.isDefaultExpireDateEnforced||t.saving},on:{"update:checked":function(e){t.hasExpirationDate=e},uncheck:t.onExpirationDisable}},[t._v("\n\t\t\t\t\t"+t._s(t.config.isDefaultExpireDateEnforced?t.t("files_sharing","Expiration date (enforced)"):t.t("files_sharing","Set expiration date"))+"\n\t\t\t\t")]),t._v(" "),t.hasExpirationDate?n("ActionInput",{directives:[{name:"tooltip",rawName:"v-tooltip.auto",value:{content:t.errors.expireDate,show:t.errors.expireDate,trigger:"manual",defaultContainer:"#app-sidebar"},expression:"{\n\t\t\t\t\t\tcontent: errors.expireDate,\n\t\t\t\t\t\tshow: errors.expireDate,\n\t\t\t\t\t\ttrigger: 'manual',\n\t\t\t\t\t\tdefaultContainer: '#app-sidebar'\n\t\t\t\t\t}",modifiers:{auto:!0}}],ref:"expireDate",staticClass:"share-link-expire-date",class:{error:t.errors.expireDate},attrs:{disabled:t.saving,"first-day-of-week":t.firstDay,lang:t.lang,value:t.share.expireDate,icon:"icon-calendar-dark",type:"date","not-before":t.dateTomorrow,"not-after":t.dateMaxEnforced},on:{"update:value":t.onExpirationChange}},[t._v("\n\t\t\t\t\t"+t._s(t.t("files_sharing","Enter a date"))+"\n\t\t\t\t")]):t._e(),t._v(" "),n("ActionCheckbox",{attrs:{checked:t.hasNote,disabled:t.saving},on:{"update:checked":function(e){t.hasNote=e},uncheck:function(e){return t.queueUpdate("note")}}},[t._v("\n\t\t\t\t\t"+t._s(t.t("files_sharing","Note to recipient"))+"\n\t\t\t\t")]),t._v(" "),t.hasNote?n("ActionTextEditable",{directives:[{name:"tooltip",rawName:"v-tooltip.auto",value:{content:t.errors.note,show:t.errors.note,trigger:"manual",defaultContainer:"#app-sidebar"},expression:"{\n\t\t\t\t\t\tcontent: errors.note,\n\t\t\t\t\t\tshow: errors.note,\n\t\t\t\t\t\ttrigger: 'manual',\n\t\t\t\t\t\tdefaultContainer: '#app-sidebar'\n\t\t\t\t\t}",modifiers:{auto:!0}}],ref:"note",class:{error:t.errors.note},attrs:{disabled:t.saving,placeholder:t.t("files_sharing","Enter a note for the share recipient"),value:t.share.newNote||t.share.note,icon:"icon-edit"},on:{"update:value":t.onNoteChange,submit:t.onNoteSubmit}}):t._e()]:t._e(),t._v(" "),t._l(t.externalActions,(function(e,r){var o=e.icon,i=e.url,a=e.name;return n("ActionLink",{key:r,attrs:{href:i(t.shareLink),icon:o,target:"_blank"}},[t._v("\n\t\t\t\t"+t._s(a)+"\n\t\t\t")])})),t._v(" "),t.share.canDelete?n("ActionButton",{attrs:{icon:"icon-close",disabled:t.saving},on:{click:function(e){return e.preventDefault(),t.onDelete(e)}}},[t._v("\n\t\t\t\t"+t._s(t.t("files_sharing","Unshare"))+"\n\t\t\t")]):t._e(),t._v(" "),!t.isEmailShareType&&t.canReshare?n("ActionButton",{staticClass:"new-share-link",attrs:{icon:"icon-add"},on:{click:function(e){return e.preventDefault(),e.stopPropagation(),t.onNewLinkShare(e)}}},[t._v("\n\t\t\t\t"+t._s(t.t("files_sharing","Add another link"))+"\n\t\t\t")]):t._e()]:t.canReshare?n("ActionButton",{staticClass:"new-share-link",attrs:{icon:"icon-add"},on:{click:function(e){return e.preventDefault(),e.stopPropagation(),t.onNewLinkShare(e)}}},[t._v("\n\t\t\t"+t._s(t.t("files_sharing","Create a new share link"))+"\n\t\t")]):t._e()],2):n("Actions",{staticClass:"sharing-entry__actions",attrs:{"menu-align":"right",open:t.open},on:{"update:open":function(e){t.open=e},close:t.onNewLinkShare}},[t.errors.pending?n("ActionText",{class:{error:t.errors.pending},attrs:{icon:"icon-error"}},[t._v("\n\t\t\t"+t._s(t.errors.pending)+"\n\t\t")]):n("ActionText",{attrs:{icon:"icon-info"}},[t._v("\n\t\t\t"+t._s(t.t("files_sharing","Please enter the following required information before creating the share"))+"\n\t\t")]),t._v(" "),t.pendingPassword?n("ActionText",{attrs:{icon:"icon-password"}},[t._v("\n\t\t\t"+t._s(t.t("files_sharing","Password protection (enforced)"))+"\n\t\t")]):t.config.enableLinkPasswordByDefault?n("ActionCheckbox",{staticClass:"share-link-password-checkbox",attrs:{checked:t.isPasswordProtected,disabled:t.config.enforcePasswordForPublicLink||t.saving},on:{"update:checked":function(e){t.isPasswordProtected=e},uncheck:t.onPasswordDisable}},[t._v("\n\t\t\t"+t._s(t.t("files_sharing","Password protection"))+"\n\t\t")]):t._e(),t._v(" "),t.pendingPassword||t.share.password?n("ActionInput",{directives:[{name:"tooltip",rawName:"v-tooltip.auto",value:{content:t.errors.password,show:t.errors.password,trigger:"manual",defaultContainer:"#app-sidebar"},expression:"{\n\t\t\t\tcontent: errors.password,\n\t\t\t\tshow: errors.password,\n\t\t\t\ttrigger: 'manual',\n\t\t\t\tdefaultContainer: '#app-sidebar'\n\t\t\t}",modifiers:{auto:!0}}],staticClass:"share-link-password",attrs:{value:t.share.password,disabled:t.saving,required:t.config.enableLinkPasswordByDefault||t.config.enforcePasswordForPublicLink,minlength:t.isPasswordPolicyEnabled&&t.config.passwordPolicy.minLength,icon:"",autocomplete:"new-password"},on:{"update:value":function(e){return t.$set(t.share,"password",e)},submit:t.onNewLinkShare}},[t._v("\n\t\t\t"+t._s(t.t("files_sharing","Enter a password"))+"\n\t\t")]):t._e(),t._v(" "),t.pendingExpirationDate?n("ActionText",{attrs:{icon:"icon-calendar-dark"}},[t._v("\n\t\t\t"+t._s(t.t("files_sharing","Expiration date (enforced)"))+"\n\t\t")]):t._e(),t._v(" "),t.pendingExpirationDate?n("ActionInput",{directives:[{name:"tooltip",rawName:"v-tooltip.auto",value:{content:t.errors.expireDate,show:t.errors.expireDate,trigger:"manual",defaultContainer:"#app-sidebar"},expression:"{\n\t\t\t\tcontent: errors.expireDate,\n\t\t\t\tshow: errors.expireDate,\n\t\t\t\ttrigger: 'manual',\n\t\t\t\tdefaultContainer: '#app-sidebar'\n\t\t\t}",modifiers:{auto:!0}}],staticClass:"share-link-expire-date",attrs:{disabled:t.saving,"first-day-of-week":t.firstDay,lang:t.lang,icon:"",type:"date","not-before":t.dateTomorrow,"not-after":t.dateMaxEnforced},model:{value:t.share.expireDate,callback:function(e){t.$set(t.share,"expireDate",e)},expression:"share.expireDate"}},[t._v("\n\t\t\t"+t._s(t.t("files_sharing","Enter a date"))+"\n\t\t")]):t._e(),t._v(" "),n("ActionButton",{attrs:{icon:"icon-close"},on:{click:function(e){return e.preventDefault(),e.stopPropagation(),t.onCancel(e)}}},[t._v("\n\t\t\t"+t._s(t.t("files_sharing","Cancel"))+"\n\t\t")])],1)],1)}),[],!1,null,"294d1e5a",null).exports},mixins:[g],props:{fileInfo:{type:Object,default:function(){},required:!0},shares:{type:Array,default:function(){return[]},required:!0},canReshare:{type:Boolean,required:!0}},data:function(){return{canLinkShare:OC.getCapabilities().files_sharing.public.enabled}},computed:{hasLinkShares:function(){var t=this;return this.shares.filter((function(e){return e.type===t.SHARE_TYPES.SHARE_TYPE_LINK})).length>0},hasShares:function(){return this.shares.length>0}},methods:{addShare:function(t,e){this.shares.unshift(t),this.awaitForShare(t,e)},awaitForShare:function(t,e){var n=this;this.$nextTick((function(){var r=n.$children.find((function(e){return e.share===t}));r&&e(r)}))},removeShare:function(t){var e=this.shares.findIndex((function(e){return e===t}));this.shares.splice(e,1)}}}),Qt=Object(T.a)(Rt,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return t.canLinkShare?n("ul",{staticClass:"sharing-link-list"},[!t.hasLinkShares&&t.canReshare?n("SharingEntryLink",{attrs:{"can-reshare":t.canReshare,"file-info":t.fileInfo},on:{"add:share":t.addShare}}):t._e(),t._v(" "),t.hasShares?t._l(t.shares,(function(e,r){return n("SharingEntryLink",{key:e.id,attrs:{"can-reshare":t.canReshare,share:t.shares[r],"file-info":t.fileInfo},on:{"update:share":[function(e){return t.$set(t.shares,r,e)},function(e){return t.awaitForShare.apply(void 0,arguments)}],"add:share":function(e){return t.addShare.apply(void 0,arguments)},"remove:share":t.removeShare}})})):t._e()],2):t._e()}),[],!1,null,null,null).exports,Pt={name:"SharingEntry",components:{Actions:w.a,ActionButton:ot.a,ActionCheckbox:yt.a,ActionInput:_t.a,ActionTextEditable:Ct.a,Avatar:s.a},directives:{Tooltip:E.a},mixins:[ft],data:function(){return{permissionsEdit:OC.PERMISSION_UPDATE,permissionsCreate:OC.PERMISSION_CREATE,permissionsDelete:OC.PERMISSION_DELETE,permissionsRead:OC.PERMISSION_READ,permissionsShare:OC.PERMISSION_SHARE}},computed:{title:function(){var e=this.share.shareWithDisplayName;return this.share.type===this.SHARE_TYPES.SHARE_TYPE_GROUP?e+=" (".concat(t("files_sharing","group"),")"):this.share.type===this.SHARE_TYPES.SHARE_TYPE_ROOM?e+=" (".concat(t("files_sharing","conversation"),")"):this.share.type===this.SHARE_TYPES.SHARE_TYPE_REMOTE?e+=" (".concat(t("files_sharing","remote"),")"):this.share.type===this.SHARE_TYPES.SHARE_TYPE_REMOTE_GROUP?e+=" (".concat(t("files_sharing","remote group"),")"):this.share.type===this.SHARE_TYPES.SHARE_TYPE_GUEST&&(e+=" (".concat(t("files_sharing","guest"),")")),e},tooltip:function(){if(this.share.owner!==this.share.uidFileOwner){var e={user:this.share.shareWithDisplayName,owner:this.share.owner};return this.share.type===this.SHARE_TYPES.SHARE_TYPE_GROUP?t("files_sharing","Shared with the group {user} by {owner}",e):this.share.type===this.SHARE_TYPES.SHARE_TYPE_ROOM?t("files_sharing","Shared with the conversation {user} by {owner}",e):t("files_sharing","Shared with {user} by {owner}",e)}return null},canHaveNote:function(){return this.share.type!==this.SHARE_TYPES.SHARE_TYPE_REMOTE&&this.share.type!==this.SHARE_TYPES.SHARE_TYPE_REMOTE_GROUP},canEdit:{get:function(){return this.share.hasUpdatePermission},set:function(t){this.updatePermissions({isEditChecked:t})}},canCreate:{get:function(){return this.share.hasCreatePermission},set:function(t){this.updatePermissions({isCreateChecked:t})}},canDelete:{get:function(){return this.share.hasDeletePermission},set:function(t){this.updatePermissions({isDeleteChecked:t})}},canReshare:{get:function(){return this.share.hasSharePermission},set:function(t){this.updatePermissions({isReshareChecked:t})}},isFolder:function(){return"dir"===this.fileInfo.type},hasExpirationDate:{get:function(){return this.config.isDefaultInternalExpireDateEnforced||!!this.share.expireDate},set:function(t){this.share.expireDate=t?""!==this.config.defaultInternalExpirationDateString?this.config.defaultInternalExpirationDateString:moment().format("YYYY-MM-DD"):""}},dateMaxEnforced:function(){return this.config.isDefaultInternalExpireDateEnforced&&moment().add(1+this.config.defaultInternalExpireDate,"days")}},methods:{updatePermissions:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.isEditChecked,n=void 0===e?this.canEdit:e,r=t.isCreateChecked,o=void 0===r?this.canCreate:r,i=t.isDeleteChecked,a=void 0===i?this.canDelete:i,s=t.isReshareChecked,A=void 0===s?this.canReshare:s,c=this.permissionsRead|(o?this.permissionsCreate:0)|(a?this.permissionsDelete:0)|(n?this.permissionsEdit:0)|(A?this.permissionsShare:0);this.share.permissions=c,this.queueUpdate("permissions")},onMenuClose:function(){this.onNoteSubmit()}}},Gt=(r(823),{name:"SharingList",components:{SharingEntry:Object(T.a)(Pt,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("li",{staticClass:"sharing-entry"},[n("Avatar",{staticClass:"sharing-entry__avatar",attrs:{user:t.share.shareWith,"display-name":t.share.shareWithDisplayName,url:t.share.shareWithAvatar}}),t._v(" "),n("div",{directives:[{name:"tooltip",rawName:"v-tooltip.auto",value:t.tooltip,expression:"tooltip",modifiers:{auto:!0}}],staticClass:"sharing-entry__desc"},[n("h5",[t._v(t._s(t.title))])]),t._v(" "),n("Actions",{staticClass:"sharing-entry__actions",attrs:{"menu-align":"right"},on:{close:t.onMenuClose}},[t.share.canEdit?[n("ActionCheckbox",{ref:"canEdit",attrs:{checked:t.canEdit,value:t.permissionsEdit,disabled:t.saving},on:{"update:checked":function(e){t.canEdit=e}}},[t._v("\n\t\t\t\t"+t._s(t.t("files_sharing","Allow editing"))+"\n\t\t\t")]),t._v(" "),t.isFolder?n("ActionCheckbox",{ref:"canCreate",attrs:{checked:t.canCreate,value:t.permissionsCreate,disabled:t.saving},on:{"update:checked":function(e){t.canCreate=e}}},[t._v("\n\t\t\t\t"+t._s(t.t("files_sharing","Allow creating"))+"\n\t\t\t")]):t._e(),t._v(" "),t.isFolder?n("ActionCheckbox",{ref:"canDelete",attrs:{checked:t.canDelete,value:t.permissionsDelete,disabled:t.saving},on:{"update:checked":function(e){t.canDelete=e}}},[t._v("\n\t\t\t\t"+t._s(t.t("files_sharing","Allow deleting"))+"\n\t\t\t")]):t._e(),t._v(" "),n("ActionCheckbox",{ref:"canReshare",attrs:{checked:t.canReshare,value:t.permissionsShare,disabled:t.saving},on:{"update:checked":function(e){t.canReshare=e}}},[t._v("\n\t\t\t\t"+t._s(t.t("files_sharing","Allow resharing"))+"\n\t\t\t")]),t._v(" "),n("ActionCheckbox",{attrs:{checked:t.hasExpirationDate,disabled:t.config.isDefaultExpireDateEnforced||t.saving},on:{"update:checked":function(e){t.hasExpirationDate=e},uncheck:t.onExpirationDisable}},[t._v("\n\t\t\t\t"+t._s(t.config.isDefaultExpireDateEnforced?t.t("files_sharing","Expiration date enforced"):t.t("files_sharing","Set expiration date"))+"\n\t\t\t")]),t._v(" "),t.hasExpirationDate?n("ActionInput",{directives:[{name:"tooltip",rawName:"v-tooltip.auto",value:{content:t.errors.expireDate,show:t.errors.expireDate,trigger:"manual"},expression:"{\n\t\t\t\t\tcontent: errors.expireDate,\n\t\t\t\t\tshow: errors.expireDate,\n\t\t\t\t\ttrigger: 'manual'\n\t\t\t\t}",modifiers:{auto:!0}}],ref:"expireDate",class:{error:t.errors.expireDate},attrs:{disabled:t.saving,"first-day-of-week":t.firstDay,lang:t.lang,value:t.share.expireDate,icon:"icon-calendar-dark",type:"date","not-before":t.dateTomorrow,"not-after":t.dateMaxEnforced},on:{"update:value":t.onExpirationChange}},[t._v("\n\t\t\t\t"+t._s(t.t("files_sharing","Enter a date"))+"\n\t\t\t")]):t._e(),t._v(" "),t.canHaveNote?[n("ActionCheckbox",{attrs:{checked:t.hasNote,disabled:t.saving},on:{"update:checked":function(e){t.hasNote=e},uncheck:function(e){return t.queueUpdate("note")}}},[t._v("\n\t\t\t\t\t"+t._s(t.t("files_sharing","Note to recipient"))+"\n\t\t\t\t")]),t._v(" "),t.hasNote?n("ActionTextEditable",{directives:[{name:"tooltip",rawName:"v-tooltip.auto",value:{content:t.errors.note,show:t.errors.note,trigger:"manual"},expression:"{\n\t\t\t\t\t\tcontent: errors.note,\n\t\t\t\t\t\tshow: errors.note,\n\t\t\t\t\t\ttrigger: 'manual'\n\t\t\t\t\t}",modifiers:{auto:!0}}],ref:"note",class:{error:t.errors.note},attrs:{disabled:t.saving,value:t.share.newNote||t.share.note,icon:"icon-edit"},on:{"update:value":t.onNoteChange,submit:t.onNoteSubmit}}):t._e()]:t._e()]:t._e(),t._v(" "),t.share.canDelete?n("ActionButton",{attrs:{icon:"icon-close",disabled:t.saving},on:{click:function(e){return e.preventDefault(),t.onDelete(e)}}},[t._v("\n\t\t\t"+t._s(t.t("files_sharing","Unshare"))+"\n\t\t")]):t._e()],2)],1)}),[],!1,null,"462ee840",null).exports},props:{fileInfo:{type:Object,default:function(){},required:!0},shares:{type:Array,default:function(){return[]},required:!0}},computed:{hasShares:function(){return 0===this.shares.length}},methods:{removeShare:function(t){var e=this.shares.findIndex((function(e){return e===t}));this.shares.splice(e,1)}}}),Yt=Object(T.a)(Gt,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("ul",{staticClass:"sharing-sharee-list"},t._l(t.shares,(function(e){return n("SharingEntry",{key:e.id,attrs:{"file-info":t.fileInfo,share:e},on:{"remove:share":t.removeShare}})})),1)}),[],!1,null,null,null).exports;function Ut(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if(!(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t)))return;var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=t[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{r||null==s.return||s.return()}finally{if(o)throw i}}return n}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Ht(t,e,n,r,o,i,a){try{var s=t[i](a),A=s.value}catch(t){return void n(t)}s.done?e(A):Promise.resolve(A).then(r,o)}var Ft,zt={name:"SharingTab",components:{Avatar:s.a,CollectionList:o.a,SharingEntryInternal:S,SharingEntrySimple:C,SharingInherited:mt,SharingInput:nt,SharingLinkList:Qt,SharingList:Yt,Tab:l.a},mixins:[g],props:{fileInfo:{type:Object,default:function(){},required:!0}},data:function(){return{error:"",expirationInterval:null,icon:"icon-share",loading:!0,name:t("files_sharing","Sharing"),reshare:null,sharedWithMe:{},shares:[],linkShares:[],sections:OCA.Sharing.ShareTabSections.getSections()}},computed:{id:function(){return"sharing"},activeTab:function(){return this.$parent.activeTab},isSharedWithMe:function(){return Object.keys(this.sharedWithMe).length>0},canReshare:function(){return!!(this.fileInfo.permissions&OC.PERMISSION_SHARE)||!(!this.reshare||!this.reshare.hasSharePermission)}},watch:{fileInfo:function(){this.resetState(),this.getShares()}},beforeMount:function(){this.getShares()},methods:{getShares:(Ft=function(t){return function(){var e=this,n=arguments;return new Promise((function(r,o){var i=t.apply(e,n);function a(t){Ht(i,r,o,a,s,"next",t)}function s(t){Ht(i,r,o,a,s,"throw",t)}a(void 0)}))}}(regeneratorRuntime.mark((function e(){var n,r,o,a,s,A,u,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,this.loading=!0,n=Object(i.generateOcsUrl)("apps/files_sharing/api/v1",2)+"shares",r=(this.fileInfo.path+"/"+this.fileInfo.name).replace("//","/"),o=c.a.get(n,{params:{format:"json",path:r,reshares:!0}}),a=c.a.get(n,{params:{format:"json",path:r,shared_with_me:!0}}),e.next=9,Promise.all([o,a]);case 9:s=e.sent,A=Ut(s,2),u=A[0],l=A[1],this.loading=!1,this.processSharedWithMe(l),this.processShares(u),e.next=23;break;case 18:e.prev=18,e.t0=e.catch(0),this.error=t("files_sharing","Unable to load the shares list"),this.loading=!1,console.error("Error loading the shares list",e.t0);case 23:case"end":return e.stop()}}),e,this,[[0,18]])}))),function(){return Ft.apply(this,arguments)}),resetState:function(){clearInterval(this.expirationInterval),this.loading=!0,this.error="",this.sharedWithMe={},this.shares=[]},updateExpirationSubtitle:function(e){var n=moment(e.expireDate).unix();this.$set(this.sharedWithMe,"subtitle",t("files_sharing","Expires {relativetime}",{relativetime:OC.Util.relativeModifiedDate(1e3*n)})),moment().unix()>n&&(clearInterval(this.expirationInterval),this.$set(this.sharedWithMe,"subtitle",t("files_sharing","this share just expired.")))},processShares:function(t){var e=this,n=t.data;if(n.ocs&&n.ocs.data&&n.ocs.data.length>0){var r=n.ocs.data.map((function(t){return new h(t)})).sort((function(t,e){return e.createdTime-t.createdTime}));this.linkShares=r.filter((function(t){return t.type===e.SHARE_TYPES.SHARE_TYPE_LINK||t.type===e.SHARE_TYPES.SHARE_TYPE_EMAIL})),this.shares=r.filter((function(t){return t.type!==e.SHARE_TYPES.SHARE_TYPE_LINK&&t.type!==e.SHARE_TYPES.SHARE_TYPE_EMAIL}))}},processSharedWithMe:function(e){var n=e.data;if(n.ocs&&n.ocs.data&&n.ocs.data[0]){var r=new h(n),o=function(e){return e.type===OC.Share.SHARE_TYPE_GROUP?t("files_sharing","Shared with you and the group {group} by {owner}",{group:e.shareWithDisplayName,owner:e.ownerDisplayName},void 0,{escape:!1}):e.type===OC.Share.SHARE_TYPE_CIRCLE?t("files_sharing","Shared with you and {circle} by {owner}",{circle:e.shareWithDisplayName,owner:e.ownerDisplayName},void 0,{escape:!1}):e.type===OC.Share.SHARE_TYPE_ROOM?e.shareWithDisplayName?t("files_sharing","Shared with you and the conversation {conversation} by {owner}",{conversation:e.shareWithDisplayName,owner:e.ownerDisplayName},void 0,{escape:!1}):t("files_sharing","Shared with you in a conversation by {owner}",{owner:e.ownerDisplayName},void 0,{escape:!1}):t("files_sharing","Shared with you by {owner}",{owner:e.ownerDisplayName},void 0,{escape:!1})}(r),i=r.ownerDisplayName,a=r.owner;this.sharedWithMe={displayName:i,title:o,user:a},this.reshare=r,r.expireDate&&moment(r.expireDate).unix()>moment().unix()&&(this.updateExpirationSubtitle(r),this.expirationInterval=setInterval(this.updateExpirationSubtitle,1e4,r))}},addShare:function(t){t.type===this.SHARE_TYPES.SHARE_TYPE_EMAIL?this.linkShares.unshift(t):this.shares.unshift(t)}}},Zt=Object(T.a)(zt,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("Tab",{class:{"icon-loading":t.loading},attrs:{id:t.id,icon:t.icon,name:t.name}},[t.error?n("div",{staticClass:"emptycontent"},[n("div",{staticClass:"icon icon-error"}),t._v(" "),n("h2",[t._v(t._s(t.error))])]):[t.isSharedWithMe?n("SharingEntrySimple",t._b({staticClass:"sharing-entry__reshare",scopedSlots:t._u([{key:"avatar",fn:function(){return[n("Avatar",{staticClass:"sharing-entry__avatar",attrs:{user:t.sharedWithMe.user,"display-name":t.sharedWithMe.displayName,"tooltip-message":""}})]},proxy:!0}],null,!1,1643724538)},"SharingEntrySimple",t.sharedWithMe,!1)):t._e(),t._v(" "),t.loading?t._e():n("SharingInput",{attrs:{"can-reshare":t.canReshare,"file-info":t.fileInfo,"link-shares":t.linkShares,reshare:t.reshare,shares:t.shares},on:{"add:share":t.addShare}}),t._v(" "),t.loading?t._e():n("SharingLinkList",{attrs:{"can-reshare":t.canReshare,"file-info":t.fileInfo,shares:t.linkShares}}),t._v(" "),t.loading?t._e():n("SharingList",{attrs:{shares:t.shares,"file-info":t.fileInfo}}),t._v(" "),t.canReshare&&!t.loading?n("SharingInherited",{attrs:{"file-info":t.fileInfo}}):t._e(),t._v(" "),n("SharingEntryInternal",{attrs:{"file-info":t.fileInfo}}),t._v(" "),t.fileInfo?n("CollectionList",{attrs:{id:""+t.fileInfo.id,type:"file",name:t.fileInfo.name}}):t._e(),t._v(" "),t._l(t.sections,(function(e,r){return n("div",{key:r,ref:"section-"+r,refInFor:!0,staticClass:"sharingTab__additionalContent"},[n(e(t.$refs["section-"+r],t.fileInfo),{tag:"component",attrs:{"file-info":t.fileInfo}})],1)}))]],2)}),[],!1,null,"6c172dd3",null).exports;function $t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function Wt(t,e){if(!Object.prototype.hasOwnProperty.call(t,e))throw new TypeError("attempted to use private field on non-instance");return t}var Vt=0;
/**
* @copyright Copyright (c) 2019 John Molakvoæ <skjnldsv@protonmail.com>
*