parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"QdEO":[function(require,module,exports) {
module.exports={props:{name:{type:String,required:!0},value:{type:null,default:null},type:{type:String,required:!0},length:{type:[String,Number],default:null},readonly:{type:Boolean,default:!1},required:{type:Boolean,default:!1},options:{type:Object,default:function(){return{}}},newItem:{type:Boolean,default:!1},relation:{type:Object,default:null},fields:{type:Object,default:null},values:{type:Object,default:null}}};
},{}],"v9+M":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=t(require("../../../mixins/interface"));function t(e){return e&&e.__esModule?e:{default:e}}function i(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var n={name:"interface-checkboxes-relational",mixins:[e.default],data:function(){return{items:[],selection:[],unchecked:{}}},computed:{relatedPk:function(){var e=this.relation.junction.collection_one.fields;return this.$lodash.find(e,{primary_key:!0}).field},junctionFieldOfRelated:function(){return this.relation.junction.field_many.field},junctionPk:function(){return this.$lodash.find(this.relation.collection_many.fields,{primary_key:!0}).field}},created:function(){var e=this;this.getItems(),this.newItem||(this.selection=this.value.map(function(t){return t[e.junctionFieldOfRelated][e.relatedPk]}))},methods:{uid:function(e){return this.$helpers.shortid.generate()+"_"+e.id},getItems:function(){var e=this,t=this.relation.junction.collection_one.collection;this.$api.getItems(t,{}).then(function(t){e.items=t.data})},labelRendered:function(e){return this.options.template?this.$helpers.micromustache.render(this.options.template,e):this.item[this.relatedPk]},onSelection:function(e,t){var i=this,n=this.items.filter(function(t){return t[i.relatedPk]==e})[0];if(this.selection.includes(e)){var o=this.selection.indexOf(e);this.selection.splice(o,1),this.removeItem(e)}else this.selection.push(e),this.addItem(e,n)},prepareItem:function(e){return i({},this.junctionFieldOfRelated,e)},addItem:function(e,t){var i=this,n=[],o=!1;this.value&&this.value.forEach(function(t){if(t.$delete){var r=i.unchecked[t[i.junctionPk]];r[i.junctionFieldOfRelated][i.relatedPk]==e?(o=!0,n.push(r),delete i.unchecked[t[i.junctionPk]]):n.push(t)}else n.push(t)}),o||n.push(this.prepareItem(t)),this.$emit("input",n)},removeItem:function(e){var t=this,n=[];this.value.forEach(function(o){var r;o.$delete||o[t.junctionFieldOfRelated][t.relatedPk]!=e?n.push(o):o[t.junctionPk]&&(t.unchecked[o[t.junctionPk]]=o,n.push((i(r={},t.junctionPk,o[t.junctionPk]),i(r,"$delete",!0),r)))}),this.$emit("input",n)}}};exports.default=n;
(function(){var e=exports.default||module.exports;"function"==typeof e&&(e=e.options),Object.assign(e,{render:function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"interface-checkbox-relational"},e._l(e.items,function(t){return n("v-checkbox",{key:"checkbox_relational_"+t.id,style:{flexBasis:100/(e.options.grid||1)+"%"},attrs:{id:e.uid(t),value:t[e.relatedPk],disabled:e.readonly,label:e.labelRendered(t),checked:e.selection.includes(t[e.relatedPk])},on:{change:function(n){return e.onSelection(t.id,n)}}})}),1)},staticRenderFns:[],_compiled:!0,_scopeId:null,functional:void 0});})();
},{"../../../mixins/interface":"QdEO"}]},{},["v9+M"], "__DirectusExtension__")