/*! For license information please see files_versions-files_versions.js.LICENSE.txt */ !function(){var e,n={59042:function(e,n,r){"use strict";var o=r(20144),s=r(31352),i=r(64024),a=r(45994),l=r(81063),u=r(79753),c=r(4820);(0,l.getPatcher)().patch("request",c.default);var f=(0,u.generateRemoteUrl)("dav"),d=(0,l.createClient)(f),v='\n\n\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\n',p=(0,r(17499).IY)().setApp("files_version").detectUser().build(),m=r(65358),h=r(80351),b=r.n(h);function j(e,t,n,r,o,s,i){try{var a=e[s](i),l=a.value}catch(e){return void n(e)}a.done?t(l):Promise.resolve(l).then(r,o)}function A(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var s=e.apply(t,n);function i(e){j(s,r,o,i,a,"next",e)}function a(e){j(s,r,o,i,a,"throw",e)}i(void 0)}))}}function y(e){return g.apply(this,arguments)}function g(){return(g=A(regeneratorRuntime.mark((function e(t){var n,r,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r="/versions/".concat(null===(n=(0,a.ts)())||void 0===n?void 0:n.uid,"/versions/").concat(t.id),e.prev=1,e.next=4,d.getDirectoryContents(r,{data:v,details:!0});case 4:return o=e.sent,e.abrupt("return",o.data.filter((function(e){return""!==e.mime})).map((function(e){return w(e,t)})));case 8:throw e.prev=8,e.t0=e.catch(1),p.error("Could not fetch version",{exception:e.t0}),e.t0;case 12:case"end":return e.stop()}}),e,null,[[1,8]])})))).apply(this,arguments)}function _(e){return x.apply(this,arguments)}function x(){return(x=A(regeneratorRuntime.mark((function e(t){var n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,p.debug("Restoring version",{url:t.url}),e.next=4,d.moveFile("/versions/".concat(null===(n=(0,a.ts)())||void 0===n?void 0:n.uid,"/versions/").concat(t.fileId,"/").concat(t.fileVersion),"/versions/".concat(null===(r=(0,a.ts)())||void 0===r?void 0:r.uid,"/restore/target"));case 4:e.next=10;break;case 6:throw e.prev=6,e.t0=e.catch(0),p.error("Could not restore version",{exception:e.t0}),e.t0;case 10:case"end":return e.stop()}}),e,null,[[0,6]])})))).apply(this,arguments)}function w(e,t){return{fileId:t.id,label:e.props["version-label"],fileName:e.filename,mimeType:e.mime,size:e.size,type:e.type,mtime:1e3*b()(e.lastmod).unix(),preview:(0,u.generateUrl)("/apps/files_versions/preview?file={file}&version={fileVersion}",{file:(0,m.RQ)(t.path,t.name),fileVersion:e.basename}),url:(0,m.RQ)("/remote.php/dav",e.filename),fileVersion:e.basename}}function C(e,t){return k.apply(this,arguments)}function k(){return(k=A(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,d.customRequest(t.fileName,{method:"PROPPATCH",data:'\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t'.concat(n,"\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t")});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function V(e){return I.apply(this,arguments)}function I(){return(I=A(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,d.deleteFile(t.fileName);case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var O=r(88722),R=r(41293),z=r(73229),P=r(80419),D=r(57612),L=r(24860),S=r(15961),N=r(79954),U=r(78595),E=r(91770),B=0;function F(e,t){return e!==B&&(e&t)===t}var T={name:"Version",components:{NcActionLink:S.ih,NcActionButton:S.Js,NcListItem:S.hx,NcModal:S.Jc,NcButton:S.P2,NcTextField:S.h3,BackupRestore:O.Z,Download:R.Z,Pencil:z.default,Check:P.default,Delete:D.Z,ImageOffOutline:L.Z},directives:{tooltip:S.u},filters:{humanReadableSize:function(e){return OC.Util.humanFileSize(e)},humanDateFromNow:function(e){return b()(e).fromNow()}},props:{version:{type:Object,required:!0},fileInfo:{type:Object,required:!0},isCurrent:{type:Boolean,default:!1},isFirstVersion:{type:Boolean,default:!1}},data:function(){return{showVersionLabelForm:!1,formVersionLabelValue:this.version.label,capabilities:(0,N.j)("core","capabilities",{files:{version_labeling:!1,version_deletion:!1}}),previewError:!1}},computed:{versionLabel:function(){var e,t=null!==(e=this.version.label)&&void 0!==e?e:"";return this.isCurrent?""===t?(0,s.Iu)("files_versions","Current version"):"".concat(t," (").concat((0,s.Iu)("files_versions","Current version"),")"):this.isFirstVersion&&""===t?(0,s.Iu)("files_versions","Initial version"):t},downloadURL:function(){return this.isCurrent?(0,u.getRootUrl)()+(0,m.RQ)("/remote.php/webdav",this.fileInfo.path,this.fileInfo.name):(0,u.getRootUrl)()+this.version.url},previewURL:function(){return this.isCurrent?(0,u.generateUrl)("/core/preview?fileId={fileId}&c={fileEtag}&x=250&y=250&forceIcon=0&a=0",{fileId:this.fileInfo.id,fileEtag:this.fileInfo.etag}):this.version.preview},formattedDate:function(){return b()(this.version.mtime).format("LLL")},hasDeletePermissions:function(){return F(this.fileInfo.permissions,E.y3.DELETE)},hasUpdatePermissions:function(){return F(this.fileInfo.permissions,E.y3.UPDATE)},isDownloadable:function(){if(0==(this.fileInfo.permissions&E.y3.READ))return!1;if("shared"===this.fileInfo.mountType){var e=this.fileInfo.shareAttributes.find((function(e){return"permissions"===e.scope&&"download"===e.key}));if(void 0!==e&&!1===e.enabled)return!1}return!0}},methods:{openVersion:function(e){e.preventDefault();var t={preventDefault:!1,fileInfo:this.fileInfo,version:this.version};(0,U.j8)("files_versions:view:open",t),t.preventDefault||(window.location.href=this.downloadURL)},openVersionLabelModal:function(){var e=this;this.showVersionLabelForm=!0,this.$nextTick((function(){e.$refs.labelInput.$el.getElementsByTagName("input")[0].focus()}))},restoreVersion:function(){this.$emit("restore",this.version)},setVersionLabel:function(e){this.formVersionLabelValue=e,this.showVersionLabelForm=!1,this.$emit("label-update",this.version,e)},deleteVersion:function(){this.$emit("delete",this.version)}}},Z=r(93379),M=r.n(Z),$=r(7795),q=r.n($),Y=r(90569),G=r.n(Y),Q=r(3565),J=r.n(Q),H=r(19216),W=r.n(H),K=r(44589),X=r.n(K),ee=r(31514),te={};te.styleTagTransform=X(),te.setAttributes=J(),te.insert=G().bind(null,"head"),te.domAPI=q(),te.insertStyleElement=W(),M()(ee.Z,te),ee.Z&&ee.Z.locals&&ee.Z.locals;var ne=r(51900);function re(e){return re="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},re(e)}function oe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function se(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n=s)&&Object.keys(o.O).every((function(e){return o.O[e](n[l])}))?n.splice(l--,1):(a=!1,s0&&e[c-1][2]>s;c--)e[c]=e[c-1];e[c]=[n,r,s]},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,{a:t}),t},o.d=function(e,t){for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.nmd=function(e){return e.paths=[],e.children||(e.children=[]),e},o.j=1358,function(){o.b=document.baseURI||self.location.href;var e={1358:0};o.O.j=function(t){return 0===e[t]};var t=function(t,n){var r,s,i=n[0],a=n[1],l=n[2],u=0;if(i.some((function(t){return 0!==e[t]}))){for(r in a)o.o(a,r)&&(o.m[r]=a[r]);if(l)var c=l(o)}for(t&&t(n);u