/*! For license information please see systemtags-systemtags.js.LICENSE.txt */ (()=>{var e,s={30213:(e,s,i)=>{var n=i(64492),l=i(19755);OCA.SystemTags||(OCA.SystemTags={}),OCA.SystemTags.App={initFileList(e){return this._fileList||(this._fileList=new OCA.SystemTags.FileList(e,{id:"systemtags",fileActions:this._createFileActions(),config:OCA.Files.App.getFilesConfig(),shown:!0}),this._fileList.appName=t("systemtags","Tags")),this._fileList},removeFileList(){this._fileList&&this._fileList.$fileList.empty()},_createFileActions(){const e=new OCA.Files.FileActions;return e.registerDefaultActions(),e.merge(OCA.Files.fileActions),this._globalActionsInitialized||(this._onActionsUpdated=n.bind(this._onActionsUpdated,this),OCA.Files.fileActions.on("setDefault.app-systemtags",this._onActionsUpdated),OCA.Files.fileActions.on("registerAction.app-systemtags",this._onActionsUpdated),this._globalActionsInitialized=!0),e.register("dir","Open",OC.PERMISSION_READ,"",(function(e,t){OCA.Files.App.setActiveView("files",{silent:!0}),OCA.Files.App.fileList.changeDirectory(OC.joinPaths(t.$file.attr("data-path"),e),!0,!0)})),e.setDefault("dir","Open"),e},_onActionsUpdated(e){this._fileList&&(e.action?this._fileList.fileActions.registerAction(e.action):e.defaultAction&&this._fileList.fileActions.setDefault(e.defaultAction.mime,e.defaultAction.name))},destroy(){OCA.Files.fileActions.off("setDefault.app-systemtags",this._onActionsUpdated),OCA.Files.fileActions.off("registerAction.app-systemtags",this._onActionsUpdated),this.removeFileList(),this._fileList=null,delete this._globalActionsInitialized}},window.addEventListener("DOMContentLoaded",(function(){l("#app-content-systemtagsfilter").on("show",(function(e){OCA.SystemTags.App.initFileList(l(e.target))})),l("#app-content-systemtagsfilter").on("hide",(function(){OCA.SystemTags.App.removeFileList()}))}))},22609:(e,t,s)=>{var i=s(64492);OCA.SystemTags=i.extend({},OCA.SystemTags),OCA.SystemTags||(OCA.SystemTags={}),OCA.SystemTags.FilesPlugin={ignoreLists:["trashbin","files.public"],attach(e){if(!(this.ignoreLists.indexOf(e.id)>=0||OCA.SystemTags.View)){const t=new OCA.SystemTags.SystemTagsInfoView;e.registerDetailView(t),OCA.SystemTags.View=t}}},OC.Plugins.register("OCA.Files.FileList",OCA.SystemTags.FilesPlugin)},19294:(e,t,s)=>{"use strict";s(30213),s(99641),s(22609),s(36670);var i=s(93379),n=s.n(i),l=s(79891);n()(l.Z,{insert:"head",singleton:!1}),l.Z.locals,window.OCA.SystemTags=OCA.SystemTags},99641:(e,s,i)=>{var n=i(64492),l=i(19755);!function(){const e=function(e,t){this.initialize(e,t)};e.prototype=n.extend({},OCA.Files.FileList.prototype,{id:"systemtagsfilter",appName:t("systemtags","Tagged files"),_systemTagIds:[],_lastUsedTags:[],_clientSideSort:!0,_allowSelection:!1,_filterField:null,initialize(e,t){if(OCA.Files.FileList.prototype.initialize.apply(this,arguments),this.initialized)return;t&&t.systemTagIds&&(this._systemTagIds=t.systemTagIds),OC.Plugins.attach("OCA.SystemTags.FileList",this);const s=this.$el.find("#controls").empty();n.defer(n.bind(this._getLastUsedTags,this)),this._initFilterField(s)},destroy(){this.$filterField.remove(),OCA.Files.FileList.prototype.destroy.apply(this,arguments)},_getLastUsedTags(){const e=this;l.ajax({type:"GET",url:OC.generateUrl("/apps/systemtags/lastused"),success(t){e._lastUsedTags=t}})},_initFilterField(e){const s=this;return this.$filterField=l(''),e.append(this.$filterField),this.$filterField.select2({placeholder:t("systemtags","Select tags to filter by"),allowClear:!1,multiple:!0,toggleSelect:!0,separator:",",query:n.bind(this._queryTagsAutocomplete,this),id:e=>e.id,initSelection(e,t){const s=l(e).val().trim();if(s){const e=s.split(","),i=[];OC.SystemTags.collection.fetch({success(){n.each(e,(function(e){const t=OC.SystemTags.collection.get(e);n.isUndefined(t)||i.push(t.toJSON())})),t(i)}})}else t([])},formatResult:e=>OC.SystemTags.getDescriptiveTag(e),formatSelection:e=>OC.SystemTags.getDescriptiveTag(e)[0].outerHTML,sortResults:e=>(e.sort((function(e,t){const i=s._lastUsedTags.indexOf(e.id),n=s._lastUsedTags.indexOf(t.id);return i!==n?-1===n?-1:-1===i?1:ie,formatNoMatches:()=>t("systemtags","No tags found")}),this.$filterField.on("change",n.bind(this._onTagsChanged,this)),this.$filterField},_queryTagsAutocomplete(e){OC.SystemTags.collection.fetch({success(){const t=OC.SystemTags.collection.filterByName(e.term);e.callback({results:n.invoke(t,"toJSON")})}})},_onUrlChanged(e){if(e.dir){const t=n.filter(e.dir.split("/"),(function(e){return""!==e.trim()}));this.$filterField.select2("val",t||[]),this._systemTagIds=t,this.reload()}},_onTagsChanged(e){const t=l(e.target).val().trim();this._systemTagIds=""!==t?t.split(","):[],this.$el.trigger(l.Event("changeDirectory",{dir:this._systemTagIds.join("/")})),this.reload()},updateEmptyContent(){"/"===this.getCurrentDirectory()?(this._systemTagIds.length?this.$el.find("#emptycontent").html('

'+t("systemtags","No files found for the selected tags")+"

"):this.$el.find("#emptycontent").html('

'+t("systemtags","Please select tags to filter by")+"

"),this.$el.find("#emptycontent").toggleClass("hidden",!this.isEmpty),this.$el.find("#filestable thead th").toggleClass("hidden",this.isEmpty)):OCA.Files.FileList.prototype.updateEmptyContent.apply(this,arguments)},getDirectoryPermissions:()=>OC.PERMISSION_READ|OC.PERMISSION_DELETE,updateStorageStatistics(){},reload(){if(this._setCurrentDir("/",!1),!this._systemTagIds.length)return this.updateEmptyContent(),this.setFiles([]),l.Deferred().resolve();this._selectedFiles={},this._selectionSummary.clear(),this._currentFileModel&&this._currentFileModel.off(),this._currentFileModel=null,this.$el.find(".select-all").prop("checked",!1),this.showMask(),this._reloadCall=this.filesClient.getFilteredFiles({systemTagIds:this._systemTagIds},{properties:this._getWebdavProperties()}),this._detailsView&&this._updateDetailsView(null);const e=this.reloadCallback.bind(this);return this._reloadCall.then(e,e)},reloadCallback(e,t){return t&&t.unshift({}),OCA.Files.FileList.prototype.reloadCallback.call(this,e,t)}}),OCA.SystemTags.FileList=e}()},36670:()=>{!function(e){function t(e){const t=e.toJSON();return OC.isUserAdmin()||t.canAssign||(t.locked=!0),t}const s=e.Files.DetailFileInfoView.extend({_rendered:!1,className:"systemTagsInfoView",name:"systemTags",id:"systemTagsInfoView",_inputView:null,initialize(e){const s=this;e=e||{},this._inputView=new OC.SystemTags.SystemTagsInputField({multiple:!0,allowActions:!0,allowCreate:!0,isAdmin:OC.isUserAdmin(),initSelection(e,i){i(s.selectedTagsCollection.map(t))}}),this.selectedTagsCollection=new OC.SystemTags.SystemTagsMappingCollection([],{objectType:"files"}),this._inputView.collection.on("change:name",this._onTagRenamedGlobally,this),this._inputView.collection.on("remove",this._onTagDeletedGlobally,this),this._inputView.on("select",this._onSelectTag,this),this._inputView.on("deselect",this._onDeselectTag,this)},_onSelectTag(e){this.selectedTagsCollection.create(e.toJSON())},_onDeselectTag(e){this.selectedTagsCollection.get(e).destroy()},_onTagRenamedGlobally(e){const t=this.selectedTagsCollection.get(e.id);t&&t.set(e.toJSON())},_onTagDeletedGlobally(e){this.selectedTagsCollection.remove(e)},setFileInfo(e){const s=this;this._rendered||this.render(),e&&(this.selectedTagsCollection.setObjectId(e.id),this.selectedTagsCollection.fetch({success(e){e.fetched=!0;const i=e.map(t);s._inputView.setData(i),i.length>0&&s.show()}})),this.hide()},render(){this.$el.append(this._inputView.$el),this._inputView.render()},isVisible(){return!this.$el.hasClass("hidden")},show(){this.$el.removeClass("hidden")},hide(){this.$el.addClass("hidden")},toggle(){this.$el.toggleClass("hidden")},openDropdown(){this.$el.find(".systemTagsInputField").select2("open")},remove(){this._inputView.remove()}});e.SystemTags.SystemTagsInfoView=s}(OCA)},79891:(e,t,s)=>{"use strict";s.d(t,{Z:()=>o});var i=s(94015),n=s.n(i),l=s(23645),a=s.n(l)()(n());a.push([e.id,"#app-content-systemtagsfilter .select2-container{width:30%;margin-left:10px}#app-sidebar .app-sidebar-header__action .tag-label{cursor:pointer;padding:13px 0;display:flex;color:var(--color-text-light);position:relative;margin-top:-20px}","",{version:3,sources:["webpack://./apps/systemtags/src/css/systemtagsfilelist.scss"],names:[],mappings:"AASA,iDACC,SAAA,CACA,gBAAA,CAGD,oDACC,cAAA,CACA,cAAA,CACA,YAAA,CACA,6BAAA,CACA,iBAAA,CACA,gBAAA",sourcesContent:["/*\n * Copyright (c) 2016\n *\n * This file is licensed under the Affero General Public License version 3\n * or later.\n *\n * See the COPYING-README file.\n *\n */\n#app-content-systemtagsfilter .select2-container {\n\twidth: 30%;\n\tmargin-left: 10px;\n}\n\n#app-sidebar .app-sidebar-header__action .tag-label {\n\tcursor: pointer;\n\tpadding: 13px 0;\n\tdisplay: flex;\n\tcolor: var(--color-text-light);\n\tposition: relative;\n\tmargin-top: -20px;\n}\n"],sourceRoot:""}]);const o=a}},i={};function n(e){var t=i[e];if(void 0!==t)return t.exports;var l=i[e]={id:e,loaded:!1,exports:{}};return s[e].call(l.exports,l,l.exports,n),l.loaded=!0,l.exports}n.m=s,n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},e=[],n.O=(t,s,i,l)=>{if(!s){var a=1/0;for(c=0;c=l)&&Object.keys(n.O).every((e=>n.O[e](s[r])))?s.splice(r--,1):(o=!1,l0&&e[c-1][2]>l;c--)e[c]=e[c-1];e[c]=[s,i,l]},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var s in t)n.o(t,s)&&!n.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),n.j=698,(()=>{var e={698:0};n.O.j=t=>0===e[t];var t=(t,s)=>{var i,l,a=s[0],o=s[1],r=s[2],d=0;if(a.some((t=>0!==e[t]))){for(i in o)n.o(o,i)&&(n.m[i]=o[i]);if(r)var c=r(n)}for(t&&t(s);dn(19294)));l=n.O(l)})(); //# sourceMappingURL=systemtags-systemtags.js.map?v=2c8707d968bd84f58ddd