files_versions-files_versions.js 51 KB

12
  1. (()=>{var e,i,n,s={14507:(e,i,n)=>{"use strict";var s=n(85471),r=n(53334),o=n(43627),a=n.n(o),l=n(85168),c=n(16406),d=n(61338),u=n(21777),p=n(46222),h=n(53278),f=n(63814),m=n(71089),v=n(51651),g=n(63623);const A=(0,f.dC)("dav"),b=(0,g.UU)(A),w=t=>{b.setHeaders({"X-Requested-With":"XMLHttpRequest",requesttoken:null!=t?t:""})};(0,u.zo)(w),w((0,u.do)());const _=b,y=(0,n(35947).YK)().setApp("files_version").detectUser().build();const C={name:"BackupRestoreIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}};var x=n(14486);const N=(0,x.A)(C,(function(){var t=this,e=t._self._c;return e("span",t._b({staticClass:"material-design-icon backup-restore-icon",attrs:{"aria-hidden":!t.title||null,"aria-label":t.title,role:"img"},on:{click:function(e){return t.$emit("click",e)}}},"span",t.$attrs,!1),[e("svg",{staticClass:"material-design-icon__svg",attrs:{fill:t.fillColor,width:t.size,height:t.size,viewBox:"0 0 24 24"}},[e("path",{attrs:{d:"M12,3A9,9 0 0,0 3,12H0L4,16L8,12H5A7,7 0 0,1 12,5A7,7 0 0,1 19,12A7,7 0 0,1 12,19C10.5,19 9.09,18.5 7.94,17.7L6.5,19.14C8.04,20.3 9.94,21 12,21A9,9 0 0,0 21,12A9,9 0 0,0 12,3M14,12A2,2 0 0,0 12,10A2,2 0 0,0 10,12A2,2 0 0,0 12,14A2,2 0 0,0 14,12Z"}},[t.title?e("title",[t._v(t._s(t.title))]):t._e()])])])}),[],!1,null,null,null).exports;var E=n(11037);const V={name:"DownloadIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}},L=(0,x.A)(V,(function(){var t=this,e=t._self._c;return e("span",t._b({staticClass:"material-design-icon download-icon",attrs:{"aria-hidden":!t.title||null,"aria-label":t.title,role:"img"},on:{click:function(e){return t.$emit("click",e)}}},"span",t.$attrs,!1),[e("svg",{staticClass:"material-design-icon__svg",attrs:{fill:t.fillColor,width:t.size,height:t.size,viewBox:"0 0 24 24"}},[e("path",{attrs:{d:"M5,20H19V18H5M19,9H15V3H9V9H5L12,16L19,9Z"}},[t.title?e("title",[t._v(t._s(t.title))]):t._e()])])])}),[],!1,null,null,null).exports,k={name:"FileCompareIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}},S=(0,x.A)(k,(function(){var t=this,e=t._self._c;return e("span",t._b({staticClass:"material-design-icon file-compare-icon",attrs:{"aria-hidden":!t.title||null,"aria-label":t.title,role:"img"},on:{click:function(e){return t.$emit("click",e)}}},"span",t.$attrs,!1),[e("svg",{staticClass:"material-design-icon__svg",attrs:{fill:t.fillColor,width:t.size,height:t.size,viewBox:"0 0 24 24"}},[e("path",{attrs:{d:"M10,18H6V16H10V18M10,14H6V12H10V14M10,1V2H6C4.89,2 4,2.89 4,4V20A2,2 0 0,0 6,22H10V23H12V1H10M20,8V20C20,21.11 19.11,22 18,22H14V20H18V11H14V9H18.5L14,4.5V2L20,8M16,14H14V12H16V14M16,18H14V16H16V18Z"}},[t.title?e("title",[t._v(t._s(t.title))]):t._e()])])])}),[],!1,null,null,null).exports,I={name:"ImageOffOutlineIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}},O=(0,x.A)(I,(function(){var t=this,e=t._self._c;return e("span",t._b({staticClass:"material-design-icon image-off-outline-icon",attrs:{"aria-hidden":!t.title||null,"aria-label":t.title,role:"img"},on:{click:function(e){return t.$emit("click",e)}}},"span",t.$attrs,!1),[e("svg",{staticClass:"material-design-icon__svg",attrs:{fill:t.fillColor,width:t.size,height:t.size,viewBox:"0 0 24 24"}},[e("path",{attrs:{d:"M22 20.7L3.3 2L2 3.3L3 4.3V19C3 20.1 3.9 21 5 21H19.7L20.7 22L22 20.7M5 19V6.3L12.6 13.9L11.1 15.8L9 13.1L6 17H15.7L17.7 19H5M8.8 5L6.8 3H19C20.1 3 21 3.9 21 5V17.2L19 15.2V5H8.8"}},[t.title?e("title",[t._v(t._s(t.title))]):t._e()])])])}),[],!1,null,null,null).exports;var T=n(93919),P=n(63420),D=n(10700),$=n(41944),R=n(4604),H=n(44559),B=n(57874),F=n(32981),j=n(35810),z=n(65043);const M=(t,e)=>0!=(t&e),U=(0,s.pM)({name:"Version",components:{NcActionLink:D.A,NcActionButton:P.A,NcAvatar:$.A,NcDateTime:R.A,NcListItem:H.N,BackupRestore:N,Download:L,FileCompare:S,Pencil:T.A,Delete:E.A,ImageOffOutline:O},directives:{tooltip:B.A},props:{version:{type:Object,required:!0},fileInfo:{type:Object,required:!0},isCurrent:{type:Boolean,default:!1},isFirstVersion:{type:Boolean,default:!1},loadPreview:{type:Boolean,default:!1},canView:{type:Boolean,default:!1},canCompare:{type:Boolean,default:!1}},emits:["click","compare","restore","delete","label-update-request"],data:()=>({previewLoaded:!1,previewErrored:!1,capabilities:(0,F.C)("core","capabilities",{files:{version_labeling:!1,version_deletion:!1}}),versionAuthor:""}),computed:{humanReadableSize(){return(0,j.v7)(this.version.size)},versionLabel(){var t;const e=null!==(t=this.version.label)&&void 0!==t?t:"";return this.isCurrent?""===e?(0,r.Tl)("files_versions","Current version"):"".concat(e," (").concat((0,r.Tl)("files_versions","Current version"),")"):this.isFirstVersion&&""===e?(0,r.Tl)("files_versions","Initial version"):e},downloadURL(){return this.isCurrent?(0,f.aU)()+(0,m.HS)("/remote.php/webdav",this.fileInfo.path,this.fileInfo.name):(0,f.aU)()+this.version.url},enableLabeling(){return!0===this.capabilities.files.version_labeling},enableDeletion(){return!0===this.capabilities.files.version_deletion},hasDeletePermissions(){return M(this.fileInfo.permissions,j.aX.DELETE)},hasUpdatePermissions(){return M(this.fileInfo.permissions,j.aX.UPDATE)},isDownloadable(){if(0==(this.fileInfo.permissions&j.aX.READ))return!1;if("shared"===this.fileInfo.mountType){const t=this.fileInfo.shareAttributes.find((t=>"permissions"===t.scope&&"download"===t.key))||{};if(!1===(null==t?void 0:t.enabled))return!1}return!0}},created(){this.fetchDisplayName()},methods:{labelUpdate(){this.$emit("label-update-request")},restoreVersion(){this.$emit("restore",this.version)},async deleteVersion(){await this.$nextTick(),await this.$nextTick(),this.$emit("delete",this.version)},async fetchDisplayName(){if(this.version.author)try{const{data:t}=await z.Ay.get((0,f.KT)("/cloud/users/".concat(this.version.author)));this.versionAuthor=t.ocs.data.displayname}catch(t){this.versionAuthor=null}},click(){this.canView?this.$emit("click",{version:this.version}):window.location=this.downloadURL},compareVersion(){if(!this.canView)throw new Error("Cannot compare version of this file");this.$emit("compare",{version:this.version})},t:r.Tl}});var q=n(85072),W=n.n(q),G=n(97825),K=n.n(G),Y=n(77659),X=n.n(Y),Z=n(55056),Q=n.n(Z),J=n(10540),tt=n.n(J),et=n(41113),it=n.n(et),nt=n(87863),st={};st.styleTagTransform=it(),st.setAttributes=Q(),st.insert=X().bind(null,"head"),st.domAPI=K(),st.insertStyleElement=tt(),W()(nt.A,st),nt.A&&nt.A.locals&&nt.A.locals;const rt=(0,x.A)(U,(function(){var t=this,e=t._self._c;return t._self._setupProxy,e("NcListItem",{staticClass:"version",attrs:{"force-display-actions":!0,"data-files-versions-version":t.version.fileVersion},on:{click:t.click},scopedSlots:t._u([{key:"icon",fn:function(){return[t.loadPreview||t.previewLoaded?!t.isCurrent&&!t.version.hasPreview||t.previewErrored?e("div",{staticClass:"version__image"},[e("ImageOffOutline",{attrs:{size:20}})],1):e("img",{staticClass:"version__image",attrs:{src:t.version.previewUrl,alt:"",decoding:"async",fetchpriority:"low",loading:"lazy"},on:{load:function(e){t.previewLoaded=!0},error:function(e){t.previewErrored=!0}}}):e("div",{staticClass:"version__image"})]},proxy:!0},{key:"name",fn:function(){return[e("div",{staticClass:"version__info"},[t.versionLabel?e("div",{staticClass:"version__info__label",attrs:{title:t.versionLabel}},[t._v("\n\t\t\t\t"+t._s(t.versionLabel)+"\n\t\t\t")]):t._e(),t._v(" "),t.versionAuthor?e("div",{staticClass:"version__info"},[t.versionLabel?e("span",[t._v("•")]):t._e(),t._v(" "),e("NcAvatar",{staticClass:"avatar",attrs:{user:t.version.author,size:16,"disable-menu":!0,"disable-tooltip":!0,"show-user-status":!1}}),t._v(" "),e("div",[t._v(t._s(t.versionAuthor))])],1):t._e()])]},proxy:!0},{key:"subname",fn:function(){return[e("div",{staticClass:"version__info version__info__subline"},[e("NcDateTime",{staticClass:"version__info__date",attrs:{"relative-time":"short",timestamp:t.version.mtime}}),t._v(" "),e("span",[t._v("•")]),t._v(" "),e("span",[t._v(t._s(t.humanReadableSize))])],1)]},proxy:!0},{key:"actions",fn:function(){return[t.enableLabeling&&t.hasUpdatePermissions?e("NcActionButton",{attrs:{"data-cy-files-versions-version-action":"label","close-after-click":!0},on:{click:t.labelUpdate},scopedSlots:t._u([{key:"icon",fn:function(){return[e("Pencil",{attrs:{size:22}})]},proxy:!0}],null,!1,3072546167)},[t._v("\n\t\t\t"+t._s(""===t.version.label?t.t("files_versions","Name this version"):t.t("files_versions","Edit version name"))+"\n\t\t")]):t._e(),t._v(" "),!t.isCurrent&&t.canView&&t.canCompare?e("NcActionButton",{attrs:{"data-cy-files-versions-version-action":"compare","close-after-click":!0},on:{click:t.compareVersion},scopedSlots:t._u([{key:"icon",fn:function(){return[e("FileCompare",{attrs:{size:22}})]},proxy:!0}],null,!1,1958207595)},[t._v("\n\t\t\t"+t._s(t.t("files_versions","Compare to current version"))+"\n\t\t")]):t._e(),t._v(" "),!t.isCurrent&&t.hasUpdatePermissions?e("NcActionButton",{attrs:{"data-cy-files-versions-version-action":"restore","close-after-click":!0},on:{click:t.restoreVersion},scopedSlots:t._u([{key:"icon",fn:function(){return[e("BackupRestore",{attrs:{size:22}})]},proxy:!0}],null,!1,2239038444)},[t._v("\n\t\t\t"+t._s(t.t("files_versions","Restore version"))+"\n\t\t")]):t._e(),t._v(" "),t.isDownloadable?e("NcActionLink",{attrs:{"data-cy-files-versions-version-action":"download",href:t.downloadURL,"close-after-click":!0,download:t.downloadURL},scopedSlots:t._u([{key:"icon",fn:function(){return[e("Download",{attrs:{size:22}})]},proxy:!0}],null,!1,927269758)},[t._v("\n\t\t\t"+t._s(t.t("files_versions","Download version"))+"\n\t\t")]):t._e(),t._v(" "),!t.isCurrent&&t.enableDeletion&&t.hasDeletePermissions?e("NcActionButton",{attrs:{"data-cy-files-versions-version-action":"delete","close-after-click":!0},on:{click:t.deleteVersion},scopedSlots:t._u([{key:"icon",fn:function(){return[e("Delete",{attrs:{size:22}})]},proxy:!0}],null,!1,2429175571)},[t._v("\n\t\t\t"+t._s(t.t("files_versions","Delete version"))+"\n\t\t")]):t._e()]},proxy:!0}])})}),[],!1,null,"71e31498",null).exports,ot=(0,s.pM)({name:"VirtualScrolling",props:{sections:{type:Array,required:!0},containerElement:{type:HTMLElement,default:null},useWindow:{type:Boolean,default:!1},headerHeight:{type:Number,default:75},renderDistance:{type:Number,default:.5},bottomBufferRatio:{type:Number,default:2},scrollToKey:{type:String,default:""}},data:()=>({scrollPosition:0,containerHeight:0,rowsContainerHeight:0,resizeObserver:null}),computed:{visibleSections(){y.debug("[VirtualScrolling] Computing visible section",{sections:this.sections});const t=this.containerHeight,e=this.scrollPosition,i=e+t;let n=0,s=0;const r=this.sections.map((r=>(s+=this.headerHeight,{...r,rows:r.rows.reduce(((r,o)=>{n=s,s+=o.height;let a=0;return s<e?a=(e-s)/t:n>i&&(a=(n-i)/t),a>this.renderDistance?r:[...r,{...o,distance:a}]}),[])}))).filter((t=>t.rows.length>0)),o=r.flatMap((t=>{let{rows:e}=t;return e})).flatMap((t=>{let{items:e}=t;return e})),a=this._rowIdToKeyMap;o.forEach((t=>t.key=a[t.id]));const l=o.map((t=>{let{key:e}=t;return e})).filter((t=>void 0!==t)),c=Object.values(a).filter((t=>!l.includes(t)));return o.filter((t=>{let{key:e}=t;return void 0===e})).forEach((t=>{var e;return t.key=null!==(e=c.pop())&&void 0!==e?e:Math.random().toString(36).substr(2)})),this._rowIdToKeyMap=o.reduce(((t,e)=>{let{id:i,key:n}=e;return{...t,["".concat(i)]:n}}),{}),r},totalHeight(){return this.sections.map((t=>this.headerHeight+t.height)).reduce(((t,e)=>t+e),0)+0},paddingTop(){if(0===this.visibleSections.length)return 0;let t=0;for(const e of this.sections)if(e.key===this.visibleSections[0].rows[0].sectionKey){for(const i of e.rows){if(i.key===this.visibleSections[0].rows[0].key)return t;t+=i.height}t+=this.headerHeight}else t+=this.headerHeight+e.height;return t},rowsContainerStyle(){return{height:"".concat(this.totalHeight,"px"),paddingTop:"".concat(this.paddingTop,"px")}},isNearBottom(){const t=this.containerHeight*this.bottomBufferRatio;return this.scrollPosition+this.containerHeight>=this.totalHeight-t},container(){return y.debug("[VirtualScrolling] Computing container"),null!==this.containerElement?this.containerElement:this.useWindow?window:this.$refs.container}},watch:{isNearBottom(t){y.debug("[VirtualScrolling] isNearBottom changed",{value:t}),t&&this.$emit("need-content")},visibleSections(){this.isNearBottom&&this.$emit("need-content")},scrollToKey(t){let e=0;for(const i of this.sections){if(i.key===t)break;e+=this.headerHeight+i.height}y.debug("[VirtualScrolling] Scrolling to",{currentRowTopDistanceFromTop:e}),this.container.scrollTo({top:e,behavior:"smooth"})}},beforeCreate(){this._rowIdToKeyMap={}},mounted(){this.resizeObserver=new ResizeObserver((t=>{for(const e of t){const t=e.contentRect;e.target===this.container&&(this.containerHeight=t.height),e.target.classList.contains("vs-rows-container")&&(this.rowsContainerHeight=t.height)}})),this.useWindow?(window.addEventListener("resize",this.updateContainerSize,{passive:!0}),this.containerHeight=window.innerHeight):this.resizeObserver.observe(this.container),this.resizeObserver.observe(this.$refs.rowsContainer),this.container.addEventListener("scroll",this.updateScrollPosition,{passive:!0})},beforeDestroy(){var t;this.useWindow&&window.removeEventListener("resize",this.updateContainerSize),null===(t=this.resizeObserver)||void 0===t||t.disconnect(),this.container.removeEventListener("scroll",this.updateScrollPosition)},methods:{updateScrollPosition(){var t;null!==(t=this._onScrollHandle)&&void 0!==t||(this._onScrollHandle=requestAnimationFrame((()=>{this._onScrollHandle=null,this.useWindow?this.scrollPosition=this.container.scrollY:this.scrollPosition=this.container.scrollTop})))},updateContainerSize(){this.containerHeight=window.innerHeight}}});var at=n(26201),lt={};lt.styleTagTransform=it(),lt.setAttributes=Q(),lt.insert=X().bind(null,"head"),lt.domAPI=K(),lt.insertStyleElement=tt(),W()(at.A,lt),at.A&&at.A.locals&&at.A.locals;const ct=(0,x.A)(ot,(function(){var t=this,e=t._self._c;return t._self._setupProxy,t.useWindow||null!==t.containerElement?e("div",{ref:"rowsContainer",staticClass:"vs-rows-container",style:t.rowsContainerStyle},[t._t("default",null,{visibleSections:t.visibleSections}),t._v(" "),t._t("loader")],2):e("div",{ref:"container",staticClass:"vs-container"},[e("div",{ref:"rowsContainer",staticClass:"vs-rows-container",style:t.rowsContainerStyle},[t._t("default",null,{visibleSections:t.visibleSections}),t._v(" "),t._t("loader")],2)])}),[],!1,null,"49a1883f",null).exports;var dt=n(85338),ut=n(9518),pt=n(82182);const ht=(0,s.pM)({name:"VersionLabelForm",components:{NcButton:ut.A,NcTextField:pt.A,Check:dt.A},props:{versionLabel:{type:String,default:""}},data(){return{innerVersionLabel:this.versionLabel}},mounted(){this.$nextTick((()=>{this.$refs.labelInput.$el.getElementsByTagName("input")[0].focus()}))},methods:{setVersionLabel(t){this.$emit("label-update",t)},t:r.Tl}});var ft=n(81122),mt={};mt.styleTagTransform=it(),mt.setAttributes=Q(),mt.insert=X().bind(null,"head"),mt.domAPI=K(),mt.insertStyleElement=tt(),W()(ft.A,mt),ft.A&&ft.A.locals&&ft.A.locals;const vt={name:"VersionTab",components:{Version:rt,VirtualScrolling:ct,VersionLabelForm:(0,x.A)(ht,(function(){var t=this,e=t._self._c;return t._self._setupProxy,e("form",{staticClass:"version-label-modal",on:{submit:function(e){return e.preventDefault(),t.setVersionLabel(t.innerVersionLabel)}}},[e("label",[e("div",{staticClass:"version-label-modal__title"},[t._v(t._s(t.t("files_versions","Version name")))]),t._v(" "),e("NcTextField",{ref:"labelInput",attrs:{value:t.innerVersionLabel,placeholder:t.t("files_versions","Version name"),"label-outside":!0},on:{"update:value":function(e){t.innerVersionLabel=e}}})],1),t._v(" "),e("div",{staticClass:"version-label-modal__info"},[t._v("\n\t\t"+t._s(t.t("files_versions","Named versions are persisted, and excluded from automatic cleanups when your storage quota is full."))+"\n\t")]),t._v(" "),e("div",{staticClass:"version-label-modal__actions"},[e("NcButton",{attrs:{disabled:0===t.innerVersionLabel.trim().length},on:{click:function(e){return t.setVersionLabel("")}}},[t._v("\n\t\t\t"+t._s(t.t("files_versions","Remove version name"))+"\n\t\t")]),t._v(" "),e("NcButton",{attrs:{type:"primary","native-type":"submit"},scopedSlots:t._u([{key:"icon",fn:function(){return[e("Check")]},proxy:!0}])},[t._v("\n\t\t\t"+t._s(t.t("files_versions","Save version name"))+"\n\t\t")])],1)])}),[],!1,null,"20b51aac",null).exports,NcLoadingIcon:p.A,NcModal:h.A},mixins:[c.A],data:()=>({fileInfo:null,isActive:!1,versions:[],loading:!1,showVersionLabelForm:!1}),computed:{sections(){return[{key:"versions",rows:this.orderedVersions.map((t=>({key:t.mtime,height:68,sectionKey:"versions",items:[t]}))),height:68*this.orderedVersions.length}]},orderedVersions(){return[...this.versions].sort(((t,e)=>t.mtime===this.fileInfo.mtime?-1:e.mtime===this.fileInfo.mtime?1:e.mtime-t.mtime))},initialVersionMtime(){return this.versions.map((t=>t.mtime)).reduce(((t,e)=>Math.min(t,e)))},viewerFileInfo(){let t="";return 1&this.fileInfo.permissions&&(t+="R"),2&this.fileInfo.permissions&&(t+="W"),8&this.fileInfo.permissions&&(t+="D"),{...this.fileInfo,mime:this.fileInfo.mimetype,basename:this.fileInfo.name,filename:this.fileInfo.path+"/"+this.fileInfo.name,permissions:t,fileid:this.fileInfo.id}},canView(){var t;return null===(t=window.OCA.Viewer)||void 0===t||null===(t=t.mimetypesCompare)||void 0===t?void 0:t.includes(this.fileInfo.mimetype)},canCompare(){return!this.isMobile}},mounted(){(0,d.B1)("files_versions:restore:restored",this.fetchVersions)},beforeUnmount(){(0,d.al)("files_versions:restore:restored",this.fetchVersions)},methods:{async update(t){this.fileInfo=t,this.resetState(),this.fetchVersions()},async setIsActive(t){this.isActive=t},async fetchVersions(){try{this.loading=!0,this.versions=await async function(t){var e;const i="/versions/".concat(null===(e=(0,u.HW)())||void 0===e?void 0:e.uid,"/versions/").concat(t.id);try{return(await _.getDirectoryContents(i,{data:'<?xml version="1.0"?>\n<d:propfind xmlns:d="DAV:"\n\txmlns:oc="http://owncloud.org/ns"\n\txmlns:nc="http://nextcloud.org/ns"\n\txmlns:ocs="http://open-collaboration-services.org/ns">\n\t<d:prop>\n\t\t<d:getcontentlength />\n\t\t<d:getcontenttype />\n\t\t<d:getlastmodified />\n\t\t<d:getetag />\n\t\t<nc:version-label />\n\t\t<nc:version-author />\n\t\t<nc:has-preview />\n\t</d:prop>\n</d:propfind>',details:!0})).data.filter((t=>{let{mime:e}=t;return""!==e})).map((e=>function(t,e){var i;const n=1e3*(0,v.A)(t.lastmod).unix();let s="";return s=n===e.mtime?(0,f.Jv)("/core/preview?fileId={fileId}&c={fileEtag}&x=250&y=250&forceIcon=0&a=0",{fileId:e.id,fileEtag:e.etag}):(0,f.Jv)("/apps/files_versions/preview?file={file}&version={fileVersion}",{file:(0,m.HS)(e.path,e.name),fileVersion:t.basename}),{fileId:e.id,label:t.props["version-label"]&&String(t.props["version-label"]),author:null!==(i=t.props["version-author"])&&void 0!==i?i:null,filename:t.filename,basename:(0,v.A)(n).format("LLL"),mime:t.mime,etag:"".concat(t.props.getetag),size:t.size,type:t.type,mtime:n,permissions:"R",hasPreview:1===t.props["has-preview"],previewUrl:s,url:(0,m.HS)("/remote.php/dav",t.filename),source:(0,f.dC)("dav")+(0,m.O0)(t.filename),fileVersion:t.basename}}(e,t)))}catch(t){throw y.error("Could not fetch version",{exception:t}),t}}(this.fileInfo)}finally{this.loading=!1}},async handleRestore(e){const i=this.fileInfo;this.fileInfo={...this.fileInfo,size:e.size,mtime:e.mtime};const n={preventDefault:!1,fileInfo:this.fileInfo,version:e};if((0,d.Ic)("files_versions:restore:requested",n),!n.preventDefault)try{await async function(t){try{var e,i;y.debug("Restoring version",{url:t.url}),await _.moveFile("/versions/".concat(null===(e=(0,u.HW)())||void 0===e?void 0:e.uid,"/versions/").concat(t.fileId,"/").concat(t.fileVersion),"/versions/".concat(null===(i=(0,u.HW)())||void 0===i?void 0:i.uid,"/restore/target"))}catch(t){throw y.error("Could not restore version",{exception:t}),t}}(e),""!==e.label?(0,l.Te)(t("files_versions","".concat(e.label," restored"))):e.mtime===this.initialVersionMtime?(0,l.Te)(t("files_versions","Initial version restored")):(0,l.Te)(t("files_versions","Version restored")),(0,d.Ic)("files_versions:restore:restored",e)}catch(n){this.fileInfo=i,(0,l.Qg)(t("files_versions","Could not restore version")),(0,d.Ic)("files_versions:restore:failed",e)}},handleLabelUpdateRequest(t){this.showVersionLabelForm=!0,this.editedVersion=t},async handleLabelUpdate(t){const e=this.editedVersion.label;this.editedVersion.label=t,this.showVersionLabelForm=!1;try{await async function(t,e){return await _.customRequest(t.filename,{method:"PROPPATCH",data:'<?xml version="1.0"?>\n\t\t\t\t\t<d:propertyupdate xmlns:d="DAV:"\n\t\t\t\t\t\txmlns:oc="http://owncloud.org/ns"\n\t\t\t\t\t\txmlns:nc="http://nextcloud.org/ns"\n\t\t\t\t\t\txmlns:ocs="http://open-collaboration-services.org/ns">\n\t\t\t\t\t<d:set>\n\t\t\t\t\t\t<d:prop>\n\t\t\t\t\t\t\t<nc:version-label>'.concat(e,"</nc:version-label>\n\t\t\t\t\t\t</d:prop>\n\t\t\t\t\t</d:set>\n\t\t\t\t\t</d:propertyupdate>")})}(this.editedVersion,t),this.editedVersion=null}catch(t){this.editedVersion.label=e,(0,l.Qg)(this.t("files_versions","Could not set version label")),logger.error("Could not set version label",{exception:t})}},async handleDelete(e){const i=this.versions.indexOf(e);this.versions.splice(i,1);try{await async function(t){await _.deleteFile(t.filename)}(e)}catch(i){this.versions.push(e),(0,l.Qg)(t("files_versions","Could not delete version"))}},resetState(){this.$set(this,"versions",[])},openVersion(t){let{version:e}=t;if(e.mtime===this.fileInfo.mtime)return void OCA.Viewer.open({fileInfo:this.viewerFileInfo});const i=this.versions.map((t=>{var e,i;return{...t,filename:t.mtime===this.fileInfo.mtime?a().join("files",null!==(e=null===(i=(0,u.HW)())||void 0===i?void 0:i.uid)&&void 0!==e?e:"",this.fileInfo.path,this.fileInfo.name):t.filename,hasPreview:!1,previewUrl:void 0}}));OCA.Viewer.open({fileInfo:i.find((t=>t.source===e.source)),enableSidebar:!1})},compareVersion(t){let{version:e}=t;const i=this.versions.map((t=>({...t,hasPreview:!1,previewUrl:void 0})));OCA.Viewer.compare(this.viewerFileInfo,i.find((t=>t.source===e.source)))}}};var gt=n(34808),At={};At.styleTagTransform=it(),At.setAttributes=Q(),At.insert=X().bind(null,"head"),At.domAPI=K(),At.insertStyleElement=tt(),W()(gt.A,At),gt.A&&gt.A.locals&&gt.A.locals;const bt=(0,x.A)(vt,(function(){var t=this,e=t._self._c;return e("div",{staticClass:"versions-tab__container"},[e("VirtualScrolling",{attrs:{sections:t.sections,"header-height":0},scopedSlots:t._u([{key:"default",fn:function(i){let{visibleSections:n}=i;return[e("ul",{attrs:{"data-files-versions-versions-list":""}},[1===n.length?t._l(n[0].rows,(function(i){return e("Version",{key:i.items[0].mtime,attrs:{"can-view":t.canView,"can-compare":t.canCompare,"load-preview":t.isActive,version:i.items[0],"file-info":t.fileInfo,"is-current":i.items[0].mtime===t.fileInfo.mtime,"is-first-version":i.items[0].mtime===t.initialVersionMtime},on:{click:t.openVersion,compare:t.compareVersion,restore:t.handleRestore,"label-update-request":function(e){return t.handleLabelUpdateRequest(i.items[0])},delete:t.handleDelete}})})):t._e()],2)]}}])},[t._v(" "),t.loading?e("NcLoadingIcon",{staticClass:"files-list-viewer__loader",attrs:{slot:"loader"},slot:"loader"}):t._e()],1),t._v(" "),t.showVersionLabelForm?e("NcModal",{attrs:{title:t.t("files_versions","Name this version")},on:{close:function(e){t.showVersionLabelForm=!1}}},[e("VersionLabelForm",{attrs:{"version-label":t.editedVersion.label},on:{"label-update":t.handleLabelUpdate}})],1):t._e()],1)}),[],!1,null,null,null).exports;var wt=n(80284);s.Ay.prototype.t=r.Tl,s.Ay.prototype.n=r.zw,s.Ay.use(wt.Ay);const _t=s.Ay.extend(bt);let yt=null;window.addEventListener("DOMContentLoaded",(function(){var t;void 0!==(null===(t=OCA.Files)||void 0===t?void 0:t.Sidebar)&&OCA.Files.Sidebar.registerTab(new OCA.Files.Sidebar.Tab({id:"version_vue",name:(0,r.Tl)("files_versions","Versions"),iconSvg:'<svg xmlns="http://www.w3.org/2000/svg" id="mdi-backup-restore" viewBox="0 0 24 24"><path d="M12,3A9,9 0 0,0 3,12H0L4,16L8,12H5A7,7 0 0,1 12,5A7,7 0 0,1 19,12A7,7 0 0,1 12,19C10.5,19 9.09,18.5 7.94,17.7L6.5,19.14C8.04,20.3 9.94,21 12,21A9,9 0 0,0 21,12A9,9 0 0,0 12,3M14,12A2,2 0 0,0 12,10A2,2 0 0,0 10,12A2,2 0 0,0 12,14A2,2 0 0,0 14,12Z" /></svg>',async mount(t,e,i){yt&&yt.$destroy(),yt=new _t({parent:i}),await yt.update(e),yt.$mount(t)},update(t){yt.update(t)},setIsActive(t){yt&&yt.setIsActive(t)},destroy(){yt.$destroy(),yt=null},enabled(t){var e;return!(null===(e=null==t?void 0:t.isDirectory())||void 0===e||e)}}))}))},87863:(t,e,i)=>{"use strict";i.d(e,{A:()=>a});var n=i(71354),s=i.n(n),r=i(76314),o=i.n(r)()(s());o.push([t.id,".version[data-v-71e31498]{display:flex;flex-direction:row}.version__info[data-v-71e31498]{display:flex;flex-direction:row;align-items:center;gap:.5rem;color:var(--color-main-text);font-weight:500}.version__info__label[data-v-71e31498]{font-weight:700;overflow:hidden;text-overflow:ellipsis}.version__info__date[data-v-71e31498]{overflow:hidden;text-overflow:ellipsis}.version__info__subline[data-v-71e31498]{color:var(--color-text-maxcontrast)}.version__image[data-v-71e31498]{width:3rem;height:3rem;border:1px solid var(--color-border);border-radius:var(--border-radius-large);display:flex;justify-content:center;color:var(--color-text-light)}","",{version:3,sources:["webpack://./apps/files_versions/src/components/Version.vue"],names:[],mappings:"AACA,0BACC,YAAA,CACA,kBAAA,CAEA,gCACC,YAAA,CACA,kBAAA,CACA,kBAAA,CACA,SAAA,CACA,4BAAA,CACA,eAAA,CAEA,uCACC,eAAA,CAEA,eAAA,CACA,sBAAA,CAGD,sCAEC,eAAA,CACA,sBAAA,CAGD,yCACC,mCAAA,CAIF,iCACC,UAAA,CACA,WAAA,CACA,oCAAA,CACA,wCAAA,CAGA,YAAA,CACA,sBAAA,CACA,6BAAA",sourcesContent:["\n.version {\n\tdisplay: flex;\n\tflex-direction: row;\n\n\t&__info {\n\t\tdisplay: flex;\n\t\tflex-direction: row;\n\t\talign-items: center;\n\t\tgap: 0.5rem;\n\t\tcolor: var(--color-main-text);\n\t\tfont-weight: 500;\n\n\t\t&__label {\n\t\t\tfont-weight: 700;\n\t\t\t// Fix overflow on narrow screens\n\t\t\toverflow: hidden;\n\t\t\ttext-overflow: ellipsis;\n\t\t}\n\n\t\t&__date {\n\t\t\t// Fix overflow on narrow screens\n\t\t\toverflow: hidden;\n\t\t\ttext-overflow: ellipsis;\n\t\t}\n\n\t\t&__subline {\n\t\t\tcolor: var(--color-text-maxcontrast)\n\t\t}\n\t}\n\n\t&__image {\n\t\twidth: 3rem;\n\t\theight: 3rem;\n\t\tborder: 1px solid var(--color-border);\n\t\tborder-radius: var(--border-radius-large);\n\n\t\t// Useful to display no preview icon.\n\t\tdisplay: flex;\n\t\tjustify-content: center;\n\t\tcolor: var(--color-text-light);\n\t}\n}\n"],sourceRoot:""}]);const a=o},81122:(t,e,i)=>{"use strict";i.d(e,{A:()=>a});var n=i(71354),s=i.n(n),r=i(76314),o=i.n(r)()(s());o.push([t.id,".version-label-modal[data-v-20b51aac]{display:flex;justify-content:space-between;flex-direction:column;height:250px;padding:16px}.version-label-modal__title[data-v-20b51aac]{margin-bottom:12px;font-weight:600}.version-label-modal__info[data-v-20b51aac]{margin-top:12px;color:var(--color-text-maxcontrast)}.version-label-modal__actions[data-v-20b51aac]{display:flex;justify-content:space-between;margin-top:64px}","",{version:3,sources:["webpack://./apps/files_versions/src/components/VersionLabelForm.vue"],names:[],mappings:"AACA,sCACC,YAAA,CACA,6BAAA,CACA,qBAAA,CACA,YAAA,CACA,YAAA,CAEA,6CACC,kBAAA,CACA,eAAA,CAGD,4CACC,eAAA,CACA,mCAAA,CAGD,+CACC,YAAA,CACA,6BAAA,CACA,eAAA",sourcesContent:["\n.version-label-modal {\n\tdisplay: flex;\n\tjustify-content: space-between;\n\tflex-direction: column;\n\theight: 250px;\n\tpadding: 16px;\n\n\t&__title {\n\t\tmargin-bottom: 12px;\n\t\tfont-weight: 600;\n\t}\n\n\t&__info {\n\t\tmargin-top: 12px;\n\t\tcolor: var(--color-text-maxcontrast);\n\t}\n\n\t&__actions {\n\t\tdisplay: flex;\n\t\tjustify-content: space-between;\n\t\tmargin-top: 64px;\n\t}\n}\n"],sourceRoot:""}]);const a=o},26201:(t,e,i)=>{"use strict";i.d(e,{A:()=>a});var n=i(71354),s=i.n(n),r=i(76314),o=i.n(r)()(s());o.push([t.id,".vs-container[data-v-49a1883f]{overflow-y:scroll;height:100%}.vs-rows-container[data-v-49a1883f]{box-sizing:border-box;will-change:scroll-position,padding;contain:layout paint style}","",{version:3,sources:["webpack://./apps/files_versions/src/components/VirtualScrolling.vue"],names:[],mappings:"AACA,+BACC,iBAAA,CACA,WAAA,CAGD,oCACC,qBAAA,CACA,mCAAA,CACA,0BAAA",sourcesContent:["\n.vs-container {\n\toverflow-y: scroll;\n\theight: 100%;\n}\n\n.vs-rows-container {\n\tbox-sizing: border-box;\n\twill-change: scroll-position, padding;\n\tcontain: layout paint style;\n}\n"],sourceRoot:""}]);const a=o},34808:(t,e,i)=>{"use strict";i.d(e,{A:()=>a});var n=i(71354),s=i.n(n),r=i(76314),o=i.n(r)()(s());o.push([t.id,".versions-tab__container{height:100%}","",{version:3,sources:["webpack://./apps/files_versions/src/views/VersionTab.vue"],names:[],mappings:"AACA,yBACC,WAAA",sourcesContent:["\n.versions-tab__container {\n\theight: 100%;\n}\n"],sourceRoot:""}]);const a=o},42634:()=>{},15340:()=>{},79838:()=>{},35810:(t,e,i)=>{"use strict";i.d(e,{Al:()=>I,H4:()=>k,PY:()=>L,Q$:()=>S,R3:()=>b,VL:()=>A,aX:()=>h,lJ:()=>V,pt:()=>w,v7:()=>P});var n=i(35947),s=i(21777),r=i(43627),o=i(71089),a=i(63814),l=i(36117),c=i(44719),d=i(70306),u=i(2568);const p=(0,n.YK)().setApp("@nextcloud/files").detectUser().build();var h=(t=>(t[t.NONE=0]="NONE",t[t.CREATE=4]="CREATE",t[t.READ=1]="READ",t[t.UPDATE=2]="UPDATE",t[t.DELETE=8]="DELETE",t[t.SHARE=16]="SHARE",t[t.ALL=31]="ALL",t))(h||{});const f=["d:getcontentlength","d:getcontenttype","d:getetag","d:getlastmodified","d:creationdate","d:displayname","d:quota-available-bytes","d:resourcetype","nc:has-preview","nc:is-encrypted","nc:mount-type","oc:comments-unread","oc:favorite","oc:fileid","oc:owner-display-name","oc:owner-id","oc:permissions","oc:size"],m={d:"DAV:",nc:"http://nextcloud.org/ns",oc:"http://owncloud.org/ns",ocs:"http://open-collaboration-services.org/ns"},v=function(){return void 0===window._nc_dav_properties&&(window._nc_dav_properties=[...f]),window._nc_dav_properties.map((t=>`<${t} />`)).join(" ")},g=function(){return void 0===window._nc_dav_namespaces&&(window._nc_dav_namespaces={...m}),Object.keys(window._nc_dav_namespaces).map((t=>`xmlns:${t}="${window._nc_dav_namespaces?.[t]}"`)).join(" ")},A=function(){return`<?xml version="1.0"?>\n\t\t<d:propfind ${g()}>\n\t\t\t<d:prop>\n\t\t\t\t${v()}\n\t\t\t</d:prop>\n\t\t</d:propfind>`},b=function(t){return`<?xml version="1.0" encoding="UTF-8"?>\n<d:searchrequest ${g()}\n\txmlns:ns="https://github.com/icewind1991/SearchDAV/ns">\n\t<d:basicsearch>\n\t\t<d:select>\n\t\t\t<d:prop>\n\t\t\t\t${v()}\n\t\t\t</d:prop>\n\t\t</d:select>\n\t\t<d:from>\n\t\t\t<d:scope>\n\t\t\t\t<d:href>/files/${(0,s.HW)()?.uid}/</d:href>\n\t\t\t\t<d:depth>infinity</d:depth>\n\t\t\t</d:scope>\n\t\t</d:from>\n\t\t<d:where>\n\t\t\t<d:and>\n\t\t\t\t<d:or>\n\t\t\t\t\t<d:not>\n\t\t\t\t\t\t<d:eq>\n\t\t\t\t\t\t\t<d:prop>\n\t\t\t\t\t\t\t\t<d:getcontenttype/>\n\t\t\t\t\t\t\t</d:prop>\n\t\t\t\t\t\t\t<d:literal>httpd/unix-directory</d:literal>\n\t\t\t\t\t\t</d:eq>\n\t\t\t\t\t</d:not>\n\t\t\t\t\t<d:eq>\n\t\t\t\t\t\t<d:prop>\n\t\t\t\t\t\t\t<oc:size/>\n\t\t\t\t\t\t</d:prop>\n\t\t\t\t\t\t<d:literal>0</d:literal>\n\t\t\t\t\t</d:eq>\n\t\t\t\t</d:or>\n\t\t\t\t<d:gt>\n\t\t\t\t\t<d:prop>\n\t\t\t\t\t\t<d:getlastmodified/>\n\t\t\t\t\t</d:prop>\n\t\t\t\t\t<d:literal>${t}</d:literal>\n\t\t\t\t</d:gt>\n\t\t\t</d:and>\n\t\t</d:where>\n\t\t<d:orderby>\n\t\t\t<d:order>\n\t\t\t\t<d:prop>\n\t\t\t\t\t<d:getlastmodified/>\n\t\t\t\t</d:prop>\n\t\t\t\t<d:descending/>\n\t\t\t</d:order>\n\t\t</d:orderby>\n\t\t<d:limit>\n\t\t\t<d:nresults>100</d:nresults>\n\t\t\t<ns:firstresult>0</ns:firstresult>\n\t\t</d:limit>\n\t</d:basicsearch>\n</d:searchrequest>`};var w=(t=>(t.Folder="folder",t.File="file",t))(w||{});const _=function(t,e){return null!==t.match(e)},y=(t,e)=>{if(t.id&&"number"!=typeof t.id)throw new Error("Invalid id type of value");if(!t.source)throw new Error("Missing mandatory source");try{new URL(t.source)}catch(t){throw new Error("Invalid source format, source must be a valid URL")}if(!t.source.startsWith("http"))throw new Error("Invalid source format, only http(s) is supported");if(t.mtime&&!(t.mtime instanceof Date))throw new Error("Invalid mtime type");if(t.crtime&&!(t.crtime instanceof Date))throw new Error("Invalid crtime type");if(!t.mime||"string"!=typeof t.mime||!t.mime.match(/^[-\w.]+\/[-+\w.]+$/gi))throw new Error("Missing or invalid mandatory mime");if("size"in t&&"number"!=typeof t.size&&void 0!==t.size)throw new Error("Invalid size type");if("permissions"in t&&void 0!==t.permissions&&!("number"==typeof t.permissions&&t.permissions>=h.NONE&&t.permissions<=h.ALL))throw new Error("Invalid permissions");if(t.owner&&null!==t.owner&&"string"!=typeof t.owner)throw new Error("Invalid owner type");if(t.attributes&&"object"!=typeof t.attributes)throw new Error("Invalid attributes type");if(t.root&&"string"!=typeof t.root)throw new Error("Invalid root type");if(t.root&&!t.root.startsWith("/"))throw new Error("Root must start with a leading slash");if(t.root&&!t.source.includes(t.root))throw new Error("Root must be part of the source");if(t.root&&_(t.source,e)){const i=t.source.match(e)[0];if(!t.source.includes((0,r.join)(i,t.root)))throw new Error("The root must be relative to the service. e.g /files/emma")}if(t.status&&!Object.values(C).includes(t.status))throw new Error("Status must be a valid NodeStatus")};var C=(t=>(t.NEW="new",t.FAILED="failed",t.LOADING="loading",t.LOCKED="locked",t))(C||{});class x{_data;_attributes;_knownDavService=/(remote|public)\.php\/(web)?dav/i;readonlyAttributes=Object.entries(Object.getOwnPropertyDescriptors(x.prototype)).filter((t=>"function"==typeof t[1].get&&"__proto__"!==t[0])).map((t=>t[0]));handler={set:(t,e,i)=>!this.readonlyAttributes.includes(e)&&Reflect.set(t,e,i),deleteProperty:(t,e)=>!this.readonlyAttributes.includes(e)&&Reflect.deleteProperty(t,e),get:(t,e,i)=>this.readonlyAttributes.includes(e)?(p.warn(`Accessing "Node.attributes.${e}" is deprecated, access it directly on the Node instance.`),Reflect.get(this,e)):Reflect.get(t,e,i)};constructor(t,e){y(t,e||this._knownDavService),this._data={...t,attributes:{}},this._attributes=new Proxy(this._data.attributes,this.handler),this.update(t.attributes??{}),e&&(this._knownDavService=e)}get source(){return this._data.source.replace(/\/$/i,"")}get encodedSource(){const{origin:t}=new URL(this.source);return t+(0,o.O0)(this.source.slice(t.length))}get basename(){return(0,r.basename)(this.source)}get extension(){return(0,r.extname)(this.source)}get dirname(){if(this.root){let t=this.source;this.isDavRessource&&(t=t.split(this._knownDavService).pop());const e=t.indexOf(this.root),i=this.root.replace(/\/$/,"");return(0,r.dirname)(t.slice(e+i.length)||"/")}const t=new URL(this.source);return(0,r.dirname)(t.pathname)}get mime(){return this._data.mime}get mtime(){return this._data.mtime}set mtime(t){this._data.mtime=t}get crtime(){return this._data.crtime}get size(){return this._data.size}set size(t){this.updateMtime(),this._data.size=t}get attributes(){return this._attributes}get permissions(){return null!==this.owner||this.isDavRessource?void 0!==this._data.permissions?this._data.permissions:h.NONE:h.READ}set permissions(t){this.updateMtime(),this._data.permissions=t}get owner(){return this.isDavRessource?this._data.owner:null}get isDavRessource(){return _(this.source,this._knownDavService)}get root(){return this._data.root?this._data.root.replace(/^(.+)\/$/,"$1"):this.isDavRessource&&(0,r.dirname)(this.source).split(this._knownDavService).pop()||null}get path(){if(this.root){let t=this.source;this.isDavRessource&&(t=t.split(this._knownDavService).pop());const e=t.indexOf(this.root),i=this.root.replace(/\/$/,"");return t.slice(e+i.length)||"/"}return(this.dirname+"/"+this.basename).replace(/\/\//g,"/")}get fileid(){return this._data?.id}get status(){return this._data?.status}set status(t){this._data.status=t}move(t){y({...this._data,source:t},this._knownDavService),this._data.source=t,this.updateMtime()}rename(t){if(t.includes("/"))throw new Error("Invalid basename");this.move((0,r.dirname)(this.source)+"/"+t)}updateMtime(){this._data.mtime&&(this._data.mtime=new Date)}update(t){for(const[e,i]of Object.entries(t))try{void 0===i?delete this.attributes[e]:this.attributes[e]=i}catch(t){if(t instanceof TypeError)continue;throw t}}}class N extends x{get type(){return w.File}}class E extends x{constructor(t){super({...t,mime:"httpd/unix-directory"})}get type(){return w.Folder}get extension(){return null}get mime(){return"httpd/unix-directory"}}const V=(0,d.f)()?`/files/${(0,d.G)()}`:`/files/${(0,s.HW)()?.uid}`,L=function(){const t=(0,a.dC)("dav");return(0,d.f)()?t.replace("remote.php","public.php"):t}(),k=function(t=L,e={}){const i=(0,c.UU)(t,{headers:e});function n(t){i.setHeaders({...e,"X-Requested-With":"XMLHttpRequest",requesttoken:t??""})}return(0,s.zo)(n),n((0,s.do)()),(0,c.Gu)().patch("fetch",((t,e)=>{const i=e.headers;return i?.method&&(e.method=i.method,delete i.method),fetch(t,e)})),i},S=(t,e="/",i=V)=>{const n=new AbortController;return new l.CancelablePromise((async(s,r,o)=>{o((()=>n.abort()));try{s((await t.getDirectoryContents(`${i}${e}`,{signal:n.signal,details:!0,data:`<?xml version="1.0"?>\n\t\t<oc:filter-files ${g()}>\n\t\t\t<d:prop>\n\t\t\t\t${v()}\n\t\t\t</d:prop>\n\t\t\t<oc:filter-rules>\n\t\t\t\t<oc:favorite>1</oc:favorite>\n\t\t\t</oc:filter-rules>\n\t\t</oc:filter-files>`,headers:{method:"REPORT"},includeSelf:!0})).data.filter((t=>t.filename!==e)).map((t=>I(t,i))))}catch(t){r(t)}}))},I=function(t,e=V,i=L){let n=(0,s.HW)()?.uid;if((0,d.f)())n=n??"anonymous";else if(!n)throw new Error("No user id found");const r=t.props,o=function(t=""){let e=h.NONE;return t?((t.includes("C")||t.includes("K"))&&(e|=h.CREATE),t.includes("G")&&(e|=h.READ),(t.includes("W")||t.includes("N")||t.includes("V"))&&(e|=h.UPDATE),t.includes("D")&&(e|=h.DELETE),t.includes("R")&&(e|=h.SHARE),e):e}(r?.permissions),a=String(r?.["owner-id"]||n),l=r.fileid||0,c={id:l,source:`${i}${t.filename}`,mtime:new Date(Date.parse(t.lastmod)),mime:t.mime||"application/octet-stream",size:r?.size||Number.parseInt(r.getcontentlength||"0"),status:l<0?C.FAILED:void 0,permissions:o,owner:a,root:e,attributes:{...t,...r,hasPreview:r?.["has-preview"]}};return delete c.attributes?.props,"file"===t.type?new N(c):new E(c)};window._oc_config,window._oc_config?.blacklist_files_regex&&new RegExp(window._oc_config.blacklist_files_regex);const O=["B","KB","MB","GB","TB","PB"],T=["B","KiB","MiB","GiB","TiB","PiB"];function P(t,e=!1,i=!1,n=!1){i=i&&!n,"string"==typeof t&&(t=Number(t));let s=t>0?Math.floor(Math.log(t)/Math.log(n?1e3:1024)):0;s=Math.min((i?T.length:O.length)-1,s);const r=i?T[s]:O[s];let o=(t/Math.pow(n?1e3:1024,s)).toFixed(1);return!0===e&&0===s?("0.0"!==o?"< 1 ":"0 ")+(i?T[1]:O[1]):(o=s<2?parseFloat(o).toFixed(0):parseFloat(o).toLocaleString((0,u.lO)()),o+" "+r)}var D={};!function(t){const e=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",i="["+e+"]["+e+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*",n=new RegExp("^"+i+"$");t.isExist=function(t){return void 0!==t},t.isEmptyObject=function(t){return 0===Object.keys(t).length},t.merge=function(t,e,i){if(e){const n=Object.keys(e),s=n.length;for(let r=0;r<s;r++)t[n[r]]="strict"===i?[e[n[r]]]:e[n[r]]}},t.getValue=function(e){return t.isExist(e)?e:""},t.isName=function(t){return!(null==n.exec(t))},t.getAllMatches=function(t,e){const i=[];let n=e.exec(t);for(;n;){const s=[];s.startIndex=e.lastIndex-n[0].length;const r=n.length;for(let t=0;t<r;t++)s.push(n[t]);i.push(s),n=e.exec(t)}return i},t.nameRegexp=i}(D);new RegExp("(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['\"])(([\\s\\S])*?)\\5)?","g");var $={};const R={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(t,e,i){return t}};$.buildOptions=function(t){return Object.assign({},R,t)},$.defaultOptions=R,!Number.parseInt&&window.parseInt&&(Number.parseInt=window.parseInt),!Number.parseFloat&&window.parseFloat&&(Number.parseFloat=window.parseFloat),new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");var H={};function B(t,e,i){let n;const s={};for(let r=0;r<t.length;r++){const o=t[r],a=F(o);let l="";if(l=void 0===i?a:i+"."+a,a===e.textNodeName)void 0===n?n=o[a]:n+=""+o[a];else{if(void 0===a)continue;if(o[a]){let t=B(o[a],e,l);const i=z(t,e);o[":@"]?j(t,o[":@"],l,e):1!==Object.keys(t).length||void 0===t[e.textNodeName]||e.alwaysCreateTextNode?0===Object.keys(t).length&&(e.alwaysCreateTextNode?t[e.textNodeName]="":t=""):t=t[e.textNodeName],void 0!==s[a]&&s.hasOwnProperty(a)?(Array.isArray(s[a])||(s[a]=[s[a]]),s[a].push(t)):e.isArray(a,l,i)?s[a]=[t]:s[a]=t}}}return"string"==typeof n?n.length>0&&(s[e.textNodeName]=n):void 0!==n&&(s[e.textNodeName]=n),s}function F(t){const e=Object.keys(t);for(let t=0;t<e.length;t++){const i=e[t];if(":@"!==i)return i}}function j(t,e,i,n){if(e){const s=Object.keys(e),r=s.length;for(let o=0;o<r;o++){const r=s[o];n.isArray(r,i+"."+r,!0,!0)?t[r]=[e[r]]:t[r]=e[r]}}}function z(t,e){const{textNodeName:i}=e,n=Object.keys(t).length;return 0===n||!(1!==n||!t[i]&&"boolean"!=typeof t[i]&&0!==t[i])}H.prettify=function(t,e){return B(t,e)};const{buildOptions:M}=$,{prettify:U}=H;function q(t,e,i,n){let s="",r=!1;for(let o=0;o<t.length;o++){const a=t[o],l=W(a);if(void 0===l)continue;let c="";if(c=0===i.length?l:`${i}.${l}`,l===e.textNodeName){let t=a[l];K(c,e)||(t=e.tagValueProcessor(l,t),t=Y(t,e)),r&&(s+=n),s+=t,r=!1;continue}if(l===e.cdataPropName){r&&(s+=n),s+=`<![CDATA[${a[l][0][e.textNodeName]}]]>`,r=!1;continue}if(l===e.commentPropName){s+=n+`\x3c!--${a[l][0][e.textNodeName]}--\x3e`,r=!0;continue}if("?"===l[0]){const t=G(a[":@"],e),i="?xml"===l?"":n;let o=a[l][0][e.textNodeName];o=0!==o.length?" "+o:"",s+=i+`<${l}${o}${t}?>`,r=!0;continue}let d=n;""!==d&&(d+=e.indentBy);const u=n+`<${l}${G(a[":@"],e)}`,p=q(a[l],e,c,d);-1!==e.unpairedTags.indexOf(l)?e.suppressUnpairedNode?s+=u+">":s+=u+"/>":p&&0!==p.length||!e.suppressEmptyNode?p&&p.endsWith(">")?s+=u+`>${p}${n}</${l}>`:(s+=u+">",p&&""!==n&&(p.includes("/>")||p.includes("</"))?s+=n+e.indentBy+p+n:s+=p,s+=`</${l}>`):s+=u+"/>",r=!0}return s}function W(t){const e=Object.keys(t);for(let i=0;i<e.length;i++){const n=e[i];if(t.hasOwnProperty(n)&&":@"!==n)return n}}function G(t,e){let i="";if(t&&!e.ignoreAttributes)for(let n in t){if(!t.hasOwnProperty(n))continue;let s=e.attributeValueProcessor(n,t[n]);s=Y(s,e),!0===s&&e.suppressBooleanAttributes?i+=` ${n.substr(e.attributeNamePrefix.length)}`:i+=` ${n.substr(e.attributeNamePrefix.length)}="${s}"`}return i}function K(t,e){let i=(t=t.substr(0,t.length-e.textNodeName.length-1)).substr(t.lastIndexOf(".")+1);for(let n in e.stopNodes)if(e.stopNodes[n]===t||e.stopNodes[n]==="*."+i)return!0;return!1}function Y(t,e){if(t&&t.length>0&&e.processEntities)for(let i=0;i<e.entities.length;i++){const n=e.entities[i];t=t.replace(n.regex,n.val)}return t}const X=function(t,e){let i="";return e.format&&e.indentBy.length>0&&(i="\n"),q(t,e,"",i)},Z={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&amp;"},{regex:new RegExp(">","g"),val:"&gt;"},{regex:new RegExp("<","g"),val:"&lt;"},{regex:new RegExp("'","g"),val:"&apos;"},{regex:new RegExp('"',"g"),val:"&quot;"}],processEntities:!0,stopNodes:[],oneListGroup:!1};function Q(t){this.options=Object.assign({},Z,t),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=et),this.processTextOrObjNode=J,this.options.format?(this.indentate=tt,this.tagEndChar=">\n",this.newLine="\n"):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function J(t,e,i){const n=this.j2x(t,i+1);return void 0!==t[this.options.textNodeName]&&1===Object.keys(t).length?this.buildTextValNode(t[this.options.textNodeName],e,n.attrStr,i):this.buildObjectNode(n.val,e,n.attrStr,i)}function tt(t){return this.options.indentBy.repeat(t)}function et(t){return!(!t.startsWith(this.options.attributeNamePrefix)||t===this.options.textNodeName)&&t.substr(this.attrPrefixLen)}Q.prototype.build=function(t){return this.options.preserveOrder?X(t,this.options):(Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t}),this.j2x(t,0).val)},Q.prototype.j2x=function(t,e){let i="",n="";for(let s in t)if(Object.prototype.hasOwnProperty.call(t,s))if(void 0===t[s])this.isAttribute(s)&&(n+="");else if(null===t[s])this.isAttribute(s)?n+="":"?"===s[0]?n+=this.indentate(e)+"<"+s+"?"+this.tagEndChar:n+=this.indentate(e)+"<"+s+"/"+this.tagEndChar;else if(t[s]instanceof Date)n+=this.buildTextValNode(t[s],s,"",e);else if("object"!=typeof t[s]){const r=this.isAttribute(s);if(r)i+=this.buildAttrPairStr(r,""+t[s]);else if(s===this.options.textNodeName){let e=this.options.tagValueProcessor(s,""+t[s]);n+=this.replaceEntitiesValue(e)}else n+=this.buildTextValNode(t[s],s,"",e)}else if(Array.isArray(t[s])){const i=t[s].length;let r="";for(let o=0;o<i;o++){const i=t[s][o];void 0===i||(null===i?"?"===s[0]?n+=this.indentate(e)+"<"+s+"?"+this.tagEndChar:n+=this.indentate(e)+"<"+s+"/"+this.tagEndChar:"object"==typeof i?this.options.oneListGroup?r+=this.j2x(i,e+1).val:r+=this.processTextOrObjNode(i,s,e):r+=this.buildTextValNode(i,s,"",e))}this.options.oneListGroup&&(r=this.buildObjectNode(r,s,"",e)),n+=r}else if(this.options.attributesGroupName&&s===this.options.attributesGroupName){const e=Object.keys(t[s]),n=e.length;for(let r=0;r<n;r++)i+=this.buildAttrPairStr(e[r],""+t[s][e[r]])}else n+=this.processTextOrObjNode(t[s],s,e);return{attrStr:i,val:n}},Q.prototype.buildAttrPairStr=function(t,e){return e=this.options.attributeValueProcessor(t,""+e),e=this.replaceEntitiesValue(e),this.options.suppressBooleanAttributes&&"true"===e?" "+t:" "+t+'="'+e+'"'},Q.prototype.buildObjectNode=function(t,e,i,n){if(""===t)return"?"===e[0]?this.indentate(n)+"<"+e+i+"?"+this.tagEndChar:this.indentate(n)+"<"+e+i+this.closeTag(e)+this.tagEndChar;{let s="</"+e+this.tagEndChar,r="";return"?"===e[0]&&(r="?",s=""),!i&&""!==i||-1!==t.indexOf("<")?!1!==this.options.commentPropName&&e===this.options.commentPropName&&0===r.length?this.indentate(n)+`\x3c!--${t}--\x3e`+this.newLine:this.indentate(n)+"<"+e+i+r+this.tagEndChar+t+this.indentate(n)+s:this.indentate(n)+"<"+e+i+r+">"+t+s}},Q.prototype.closeTag=function(t){let e="";return-1!==this.options.unpairedTags.indexOf(t)?this.options.suppressUnpairedNode||(e="/"):e=this.options.suppressEmptyNode?"/":`></${t}`,e},Q.prototype.buildTextValNode=function(t,e,i,n){if(!1!==this.options.cdataPropName&&e===this.options.cdataPropName)return this.indentate(n)+`<![CDATA[${t}]]>`+this.newLine;if(!1!==this.options.commentPropName&&e===this.options.commentPropName)return this.indentate(n)+`\x3c!--${t}--\x3e`+this.newLine;if("?"===e[0])return this.indentate(n)+"<"+e+i+"?"+this.tagEndChar;{let s=this.options.tagValueProcessor(e,t);return s=this.replaceEntitiesValue(s),""===s?this.indentate(n)+"<"+e+i+this.closeTag(e)+this.tagEndChar:this.indentate(n)+"<"+e+i+">"+s+"</"+e+this.tagEndChar}},Q.prototype.replaceEntitiesValue=function(t){if(t&&t.length>0&&this.options.processEntities)for(let e=0;e<this.options.entities.length;e++){const i=this.options.entities[e];t=t.replace(i.regex,i.val)}return t}}},r={};function o(t){var e=r[t];if(void 0!==e)return e.exports;var i=r[t]={id:t,loaded:!1,exports:{}};return s[t].call(i.exports,i,i.exports,o),i.loaded=!0,i.exports}o.m=s,e=[],o.O=(t,i,n,s)=>{if(!i){var r=1/0;for(d=0;d<e.length;d++){i=e[d][0],n=e[d][1],s=e[d][2];for(var a=!0,l=0;l<i.length;l++)(!1&s||r>=s)&&Object.keys(o.O).every((t=>o.O[t](i[l])))?i.splice(l--,1):(a=!1,s<r&&(r=s));if(a){e.splice(d--,1);var c=n();void 0!==c&&(t=c)}}return t}s=s||0;for(var d=e.length;d>0&&e[d-1][2]>s;d--)e[d]=e[d-1];e[d]=[i,n,s]},o.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return o.d(e,{a:e}),e},o.d=(t,e)=>{for(var i in e)o.o(e,i)&&!o.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},o.f={},o.e=t=>Promise.all(Object.keys(o.f).reduce(((e,i)=>(o.f[i](t,e),e)),[])),o.u=t=>t+"-"+t+".js?v="+{1110:"e20948a2fd7d006e5209",5455:"87834f78ac52a71dca18"}[t],o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i={},n="nextcloud:",o.l=(t,e,s,r)=>{if(i[t])i[t].push(e);else{var a,l;if(void 0!==s)for(var c=document.getElementsByTagName("script"),d=0;d<c.length;d++){var u=c[d];if(u.getAttribute("src")==t||u.getAttribute("data-webpack")==n+s){a=u;break}}a||(l=!0,(a=document.createElement("script")).charset="utf-8",a.timeout=120,o.nc&&a.setAttribute("nonce",o.nc),a.setAttribute("data-webpack",n+s),a.src=t),i[t]=[e];var p=(e,n)=>{a.onerror=a.onload=null,clearTimeout(h);var s=i[t];if(delete i[t],a.parentNode&&a.parentNode.removeChild(a),s&&s.forEach((t=>t(n))),e)return e(n)},h=setTimeout(p.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=p.bind(null,a.onerror),a.onload=p.bind(null,a.onload),l&&document.head.appendChild(a)}},o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.nmd=t=>(t.paths=[],t.children||(t.children=[]),t),o.j=2250,(()=>{var t;o.g.importScripts&&(t=o.g.location+"");var e=o.g.document;if(!t&&e&&(e.currentScript&&(t=e.currentScript.src),!t)){var i=e.getElementsByTagName("script");if(i.length)for(var n=i.length-1;n>-1&&(!t||!/^http(s?):/.test(t));)t=i[n--].src}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=t})(),(()=>{o.b=document.baseURI||self.location.href;var t={2250:0};o.f.j=(e,i)=>{var n=o.o(t,e)?t[e]:void 0;if(0!==n)if(n)i.push(n[2]);else{var s=new Promise(((i,s)=>n=t[e]=[i,s]));i.push(n[2]=s);var r=o.p+o.u(e),a=new Error;o.l(r,(i=>{if(o.o(t,e)&&(0!==(n=t[e])&&(t[e]=void 0),n)){var s=i&&("load"===i.type?"missing":i.type),r=i&&i.target&&i.target.src;a.message="Loading chunk "+e+" failed.\n("+s+": "+r+")",a.name="ChunkLoadError",a.type=s,a.request=r,n[1](a)}}),"chunk-"+e,e)}},o.O.j=e=>0===t[e];var e=(e,i)=>{var n,s,r=i[0],a=i[1],l=i[2],c=0;if(r.some((e=>0!==t[e]))){for(n in a)o.o(a,n)&&(o.m[n]=a[n]);if(l)var d=l(o)}for(e&&e(i);c<r.length;c++)s=r[c],o.o(t,s)&&t[s]&&t[s][0](),t[s]=0;return o.O(d)},i=self.webpackChunknextcloud=self.webpackChunknextcloud||[];i.forEach(e.bind(null,0)),i.push=e.bind(null,i.push.bind(i))})(),o.nc=void 0;var a=o.O(void 0,[4208],(()=>o(14507)));a=o.O(a)})();
  2. //# sourceMappingURL=files_versions-files_versions.js.map?v=8eb376a407744b933601