((typeof self !== 'undefined' ? self : this)["webpackJsonpresource_management"] = (typeof self !== 'undefined' ? self : this)["webpackJsonpresource_management"] || []).push([[5],{

/***/ "0adc":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);

// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"3f554254-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./node_modules/windicss-webpack-plugin/dist/loaders/windicss-template.cjs!./src/modules/host/resource-management/components/apiResource/OperateApiDialog.vue?vue&type=template&id=5a8d86d2&scoped=true
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('el-dialog',{directives:[{name:"dialogDrag",rawName:"v-dialogDrag"}],staticClass:"mini-dialog",attrs:{"width":"565px","close-on-click-modal":false,"append-to-body":true,"visible":_vm.operateApiProps.visible,"title":_vm.operateApiProps.title},on:{"update:visible":function($event){return _vm.$set(_vm.operateApiProps, "visible", $event)}}},[_c('el-form',{directives:[{name:"loading",rawName:"v-loading",value:(_vm.formLoading),expression:"formLoading"}],ref:"apiForm",attrs:{"size":"mini","label-width":"150px","rules":_vm.apiRules,"model":_vm.apiForm}},[_c('el-form-item',{attrs:{"label":"名称","prop":"name"}},[_c('el-input',{attrs:{"readonly":_vm.operateApiProps.editType === 'edit',"placeholder":"请输入名称","size":"small","clearable":""},model:{value:(_vm.apiForm.name),callback:function ($$v) {_vm.$set(_vm.apiForm, "name", $$v)},expression:"apiForm.name"}})],1),_c('el-form-item',{attrs:{"label":"显示名称","prop":"displayName"}},[_c('el-input',{attrs:{"placeholder":"请输入显示名称","size":"small","clearable":""},model:{value:(_vm.apiForm.displayName),callback:function ($$v) {_vm.$set(_vm.apiForm, "displayName", $$v)},expression:"apiForm.displayName"}})],1),_c('el-form-item',{attrs:{"label":"声明集","prop":"userClaims"}},[_c('el-select',{staticClass:"w-full",attrs:{"size":"small","multiple":"","filterable":"","clearable":""},on:{"change":_vm.changeClaims},model:{value:(_vm.apiForm.userClaims),callback:function ($$v) {_vm.$set(_vm.apiForm, "userClaims", $$v)},expression:"apiForm.userClaims"}},_vm._l((_vm.claimTypes),function(item){return _c('el-option',{key:item.id,attrs:{"value":item.name,"label":item.name}})}),1)],1),_c('el-form-item',{attrs:{"label":"描述","prop":"description"}},[_c('el-input',{attrs:{"placeholder":"请输入描述","size":"small","clearable":""},model:{value:(_vm.apiForm.description),callback:function ($$v) {_vm.$set(_vm.apiForm, "description", $$v)},expression:"apiForm.description"}})],1),_c('el-form-item',{attrs:{"label":"启用","prop":"enabled"}},[_c('el-checkbox',{model:{value:(_vm.apiForm.enabled),callback:function ($$v) {_vm.$set(_vm.apiForm, "enabled", $$v)},expression:"apiForm.enabled"}})],1),_c('el-form-item',{attrs:{"label":"显示在发现文档中","prop":"showInDiscoveryDocument"}},[_c('el-checkbox',{model:{value:(_vm.apiForm.showInDiscoveryDocument),callback:function ($$v) {_vm.$set(_vm.apiForm, "showInDiscoveryDocument", $$v)},expression:"apiForm.showInDiscoveryDocument"}})],1)],1),_c('div',{staticClass:"text-center",attrs:{"slot":"footer"},slot:"footer"},[_c('el-button',{staticClass:"iconfont icon-save",attrs:{"size":"small","type":"primary"},on:{"click":function($event){return _vm.save()}}},[_vm._v("保存")]),_c('el-button',{staticClass:"iconfont icon-close",attrs:{"size":"small"},on:{"click":function($event){return _vm.cancel()}}},[_vm._v("取消")])],1)],1)}
var staticRenderFns = []


// CONCATENATED MODULE: ./src/modules/host/resource-management/components/apiResource/OperateApiDialog.vue?vue&type=template&id=5a8d86d2&scoped=true

// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js
var regeneratorRuntime = __webpack_require__("c7eb");

// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 3 modules
var slicedToArray = __webpack_require__("3835");

// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js
var asyncToGenerator = __webpack_require__("1da1");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.find.js
var es_array_find = __webpack_require__("7db0");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.function.name.js
var es_function_name = __webpack_require__("b0c0");

// EXTERNAL MODULE: ./node_modules/core-js/modules/es.object.to-string.js
var es_object_to_string = __webpack_require__("d3b7");

// EXTERNAL MODULE: ./node_modules/@wiz-api/auth-server/lib/auth-server.umd.js
var auth_server_umd = __webpack_require__("93f7");

// EXTERNAL MODULE: ./node_modules/@wiz-api/account/lib/account.umd.js
var account_umd = __webpack_require__("32d0");

// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/thread-loader/dist/cjs.js!./node_modules/@vue/cli-plugin-babel/node_modules/babel-loader/lib??ref--12-1!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./node_modules/windicss-webpack-plugin/dist/loaders/windicss-template.cjs!./src/modules/host/resource-management/components/apiResource/OperateApiDialog.vue?vue&type=script&lang=js






//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//



var uuid = __webpack_require__("11c1");
var resourceApi = new auth_server_umd["ApiResourceApi"]();
var claimTypeApi = new account_umd["ClaimTypeApi"]();
/* harmony default export */ var OperateApiDialogvue_type_script_lang_js = ({
  name: 'operateApiDialog',
  props: {
    operateApiProps: {
      type: Object,
      default: function _default() {
        return {
          title: '新增api',
          editType: 'create',
          visible: false
        };
      }
    },
    apiForm: {
      type: Object,
      default: function _default() {
        return {
          name: '',
          displayName: '',
          description: '',
          userClaims: [],
          enabled: false,
          showInDiscoveryDocument: false
        };
      }
    }
  },
  components: {},
  data: function data() {
    return {
      formLoading: false,
      claimTypes: [],
      // 声明集
      initClaimTypes: [],
      apiRules: {
        name: [{
          required: true,
          message: '请输入名称',
          trigger: ['blur', 'change']
        }]
      }
    };
  },
  watch: {
    'apiForm.userClaims': {
      deep: true,
      immediate: true,
      handler: function handler(newClaims, oldClaims) {
        console.log(newClaims, oldClaims, 'newClaims oldClaims');
      }
    }
  },
  computed: {},
  methods: {
    findClaimTypes: function findClaimTypes() {
      var _this = this;
      return Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/Object(regeneratorRuntime["a" /* default */])().mark(function _callee() {
        var _yield$claimTypeApi$g, _yield$claimTypeApi$g2, err, res;
        return Object(regeneratorRuntime["a" /* default */])().wrap(function _callee$(_context) {
          while (1) switch (_context.prev = _context.next) {
            case 0:
              _this.formLoading = true;
              _context.next = 3;
              return claimTypeApi.getAllList();
            case 3:
              _yield$claimTypeApi$g = _context.sent;
              _yield$claimTypeApi$g2 = Object(slicedToArray["a" /* default */])(_yield$claimTypeApi$g, 2);
              err = _yield$claimTypeApi$g2[0];
              res = _yield$claimTypeApi$g2[1];
              _this.formLoading = false;
              if (!err) {
                _this.claimTypes = res;
                _this.initClaimTypes = _.cloneDeep(_this.claimTypes);
              }
            case 9:
            case "end":
              return _context.stop();
          }
        }, _callee);
      }))();
    },
    changeClaims: function changeClaims(claims) {
      // this.claimTypes = _.filter(this.initClaimTypes, (item) => {
      //   return !_.includes(claims, item.id)
      // })
    },
    removeClaims: function removeClaims(claim) {
      var currentClaim = _.find(this.initClaimTypes, ['id', claim]);
      this.$confirm("\u786E\u8BA4\u8981\u5220\u9664".concat(currentClaim.name, "\u4E48"), '提示', {
        confirmButtonText: '确认',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(function () {}).catch(function () {
        return false;
      });
    },
    cancel: function cancel() {
      this.operateApiProps.visible = false;
    },
    save: function save() {
      var _this2 = this;
      this.$refs.apiForm.validate( /*#__PURE__*/function () {
        var _ref = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/Object(regeneratorRuntime["a" /* default */])().mark(function _callee2(valid) {
          var _yield$resourceApi$cr, _yield$resourceApi$cr2, err, res, _yield$resourceApi$up, _yield$resourceApi$up2, updateErr, updateRes;
          return Object(regeneratorRuntime["a" /* default */])().wrap(function _callee2$(_context2) {
            while (1) switch (_context2.prev = _context2.next) {
              case 0:
                if (!valid) {
                  _context2.next = 17;
                  break;
                }
                if (!(_this2.operateApiProps.editType === 'create')) {
                  _context2.next = 10;
                  break;
                }
                _context2.next = 4;
                return resourceApi.create({
                  body: _this2.apiForm
                });
              case 4:
                _yield$resourceApi$cr = _context2.sent;
                _yield$resourceApi$cr2 = Object(slicedToArray["a" /* default */])(_yield$resourceApi$cr, 2);
                err = _yield$resourceApi$cr2[0];
                res = _yield$resourceApi$cr2[1];
                if (!err) {
                  _this2.$message.success({
                    showClose: true,
                    message: '新增成功'
                  });
                  _this2.operateApiProps.visible = false;
                  _this2.$emit('refreshList');
                }
                return _context2.abrupt("return");
              case 10:
                _context2.next = 12;
                return resourceApi.update(_this2.apiForm.id, {
                  body: _this2.apiForm
                });
              case 12:
                _yield$resourceApi$up = _context2.sent;
                _yield$resourceApi$up2 = Object(slicedToArray["a" /* default */])(_yield$resourceApi$up, 2);
                updateErr = _yield$resourceApi$up2[0];
                updateRes = _yield$resourceApi$up2[1];
                if (!updateErr) {
                  _this2.$message.success({
                    showClose: true,
                    message: '修改成功'
                  });
                  _this2.operateApiProps.visible = false;
                  _this2.$emit('refreshList');
                }
              case 17:
              case "end":
                return _context2.stop();
            }
          }, _callee2);
        }));
        return function (_x) {
          return _ref.apply(this, arguments);
        };
      }());
    }
  },
  created: function created() {
    this.findClaimTypes();
  }
});
// CONCATENATED MODULE: ./src/modules/host/resource-management/components/apiResource/OperateApiDialog.vue?vue&type=script&lang=js
 /* harmony default export */ var apiResource_OperateApiDialogvue_type_script_lang_js = (OperateApiDialogvue_type_script_lang_js); 
// EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
var componentNormalizer = __webpack_require__("2877");

// CONCATENATED MODULE: ./src/modules/host/resource-management/components/apiResource/OperateApiDialog.vue





/* normalize component */

var component = Object(componentNormalizer["a" /* default */])(
  apiResource_OperateApiDialogvue_type_script_lang_js,
  render,
  staticRenderFns,
  false,
  null,
  "5a8d86d2",
  null
  
)

/* harmony default export */ var OperateApiDialog = __webpack_exports__["default"] = (component.exports);

/***/ }),

/***/ 1:
/***/ (function(module, exports) {

/* (ignored) */

/***/ }),

/***/ "11c1":
/***/ (function(module, exports, __webpack_require__) {

var v1 = __webpack_require__("c437");
var v4 = __webpack_require__("c64e");

var uuid = v4;
uuid.v1 = v1;
uuid.v4 = v4;

module.exports = uuid;


/***/ }),

/***/ "2366":
/***/ (function(module, exports) {

/**
 * Convert array of 16 byte values to UUID string format of the form:
 * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
 */
var byteToHex = [];
for (var i = 0; i < 256; ++i) {
  byteToHex[i] = (i + 0x100).toString(16).substr(1);
}

function bytesToUuid(buf, offset) {
  var i = offset || 0;
  var bth = byteToHex;
  // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4
  return ([
    bth[buf[i++]], bth[buf[i++]],
    bth[buf[i++]], bth[buf[i++]], '-',
    bth[buf[i++]], bth[buf[i++]], '-',
    bth[buf[i++]], bth[buf[i++]], '-',
    bth[buf[i++]], bth[buf[i++]], '-',
    bth[buf[i++]], bth[buf[i++]],
    bth[buf[i++]], bth[buf[i++]],
    bth[buf[i++]], bth[buf[i++]]
  ]).join('');
}

module.exports = bytesToUuid;


/***/ }),

/***/ "7db0":
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var $ = __webpack_require__("23e7");
var $find = __webpack_require__("b727").find;
var addToUnscopables = __webpack_require__("44d2");

var FIND = 'find';
var SKIPS_HOLES = true;

// Shouldn't skip holes
// eslint-disable-next-line es/no-array-prototype-find -- testing
if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });

// `Array.prototype.find` method
// https://tc39.es/ecma262/#sec-array.prototype.find
$({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
  find: function find(callbackfn /* , that = undefined */) {
    return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  }
});

// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
addToUnscopables(FIND);


/***/ }),

/***/ "c437":
/***/ (function(module, exports, __webpack_require__) {

var rng = __webpack_require__("e1f4");
var bytesToUuid = __webpack_require__("2366");

// **`v1()` - Generate time-based UUID**
//
// Inspired by https://github.com/LiosK/UUID.js
// and http://docs.python.org/library/uuid.html

var _nodeId;
var _clockseq;

// Previous uuid creation time
var _lastMSecs = 0;
var _lastNSecs = 0;

// See https://github.com/uuidjs/uuid for API details
function v1(options, buf, offset) {
  var i = buf && offset || 0;
  var b = buf || [];

  options = options || {};
  var node = options.node || _nodeId;
  var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq;

  // node and clockseq need to be initialized to random values if they're not
  // specified.  We do this lazily to minimize issues related to insufficient
  // system entropy.  See #189
  if (node == null || clockseq == null) {
    var seedBytes = rng();
    if (node == null) {
      // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)
      node = _nodeId = [
        seedBytes[0] | 0x01,
        seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]
      ];
    }
    if (clockseq == null) {
      // Per 4.2.2, randomize (14 bit) clockseq
      clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff;
    }
  }

  // UUID timestamps are 100 nano-second units since the Gregorian epoch,
  // (1582-10-15 00:00).  JSNumbers aren't precise enough for this, so
  // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'
  // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.
  var msecs = options.msecs !== undefined ? options.msecs : new Date().getTime();

  // Per 4.2.1.2, use count of uuid's generated during the current clock
  // cycle to simulate higher resolution clock
  var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1;

  // Time since last uuid creation (in msecs)
  var dt = (msecs - _lastMSecs) + (nsecs - _lastNSecs)/10000;

  // Per 4.2.1.2, Bump clockseq on clock regression
  if (dt < 0 && options.clockseq === undefined) {
    clockseq = clockseq + 1 & 0x3fff;
  }

  // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new
  // time interval
  if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {
    nsecs = 0;
  }

  // Per 4.2.1.2 Throw error if too many uuids are requested
  if (nsecs >= 10000) {
    throw new Error('uuid.v1(): Can\'t create more than 10M uuids/sec');
  }

  _lastMSecs = msecs;
  _lastNSecs = nsecs;
  _clockseq = clockseq;

  // Per 4.1.4 - Convert from unix epoch to Gregorian epoch
  msecs += 12219292800000;

  // `time_low`
  var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;
  b[i++] = tl >>> 24 & 0xff;
  b[i++] = tl >>> 16 & 0xff;
  b[i++] = tl >>> 8 & 0xff;
  b[i++] = tl & 0xff;

  // `time_mid`
  var tmh = (msecs / 0x100000000 * 10000) & 0xfffffff;
  b[i++] = tmh >>> 8 & 0xff;
  b[i++] = tmh & 0xff;

  // `time_high_and_version`
  b[i++] = tmh >>> 24 & 0xf | 0x10; // include version
  b[i++] = tmh >>> 16 & 0xff;

  // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)
  b[i++] = clockseq >>> 8 | 0x80;

  // `clock_seq_low`
  b[i++] = clockseq & 0xff;

  // `node`
  for (var n = 0; n < 6; ++n) {
    b[i + n] = node[n];
  }

  return buf ? buf : bytesToUuid(b);
}

module.exports = v1;


/***/ }),

/***/ "c64e":
/***/ (function(module, exports, __webpack_require__) {

var rng = __webpack_require__("e1f4");
var bytesToUuid = __webpack_require__("2366");

function v4(options, buf, offset) {
  var i = buf && offset || 0;

  if (typeof(options) == 'string') {
    buf = options === 'binary' ? new Array(16) : null;
    options = null;
  }
  options = options || {};

  var rnds = options.random || (options.rng || rng)();

  // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
  rnds[6] = (rnds[6] & 0x0f) | 0x40;
  rnds[8] = (rnds[8] & 0x3f) | 0x80;

  // Copy bytes to buffer, if provided
  if (buf) {
    for (var ii = 0; ii < 16; ++ii) {
      buf[i + ii] = rnds[ii];
    }
  }

  return buf || bytesToUuid(rnds);
}

module.exports = v4;


/***/ }),

/***/ "e1f4":
/***/ (function(module, exports) {

// Unique ID creation requires a high quality random # generator.  In the
// browser this is a little complicated due to unknown quality of Math.random()
// and inconsistent support for the `crypto` API.  We do the best we can via
// feature-detection

// getRandomValues needs to be invoked in a context where "this" is a Crypto
// implementation. Also, find the complete implementation of crypto on IE11.
var getRandomValues = (typeof(crypto) != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto)) ||
                      (typeof(msCrypto) != 'undefined' && typeof window.msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto));

if (getRandomValues) {
  // WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto
  var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef

  module.exports = function whatwgRNG() {
    getRandomValues(rnds8);
    return rnds8;
  };
} else {
  // Math.random()-based (RNG)
  //
  // If all else fails, use Math.random().  It's fast, but is of unspecified
  // quality.
  var rnds = new Array(16);

  module.exports = function mathRNG() {
    for (var i = 0, r; i < 16; i++) {
      if ((i & 0x03) === 0) r = Math.random() * 0x100000000;
      rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;
    }

    return rnds;
  };
}


/***/ })

}]);
//# sourceMappingURL=resource-management.umd.5.js.map