text: // All material copyright ESRI, All Rights Reserved, unless otherwise specified.
  // See http://js.arcgis.com/3.15/esri/copyright.txt and http://www.arcgis.com/apps/webappbuilder/copyright.txt for details.
  
  //>>built
  define("dojo/_base/declare dojo/_base/lang dojo/_base/array dojo/json dojo/Deferred esri/graphicsUtils esri/IdentityManager jimu/portalUtils jimu/portalUrlUtils jimu/Role jimu/dijit/Message ../BaseFeatureAction jimu/dijit/Popup jimu/dijit/AddItemForm".split(" "),function(l,d,m,n,p,q,f,r,t,u,k,v,w,x){return l(v,{name:"SaveToMyContent",iconClass:"icon-save",isFeatureSupported:function(b){return 0>=b.features.length||!b.features[0].geometry?!1:!0},onExecute:function(b,a){this.checkPrivilege().then(d.hitch(this,
  function(c){if(c)var e=new x({appConfig:this.appConfig}),h=new w({content:e,titleLabel:window.jimuNls.featureActions.SaveToMyContent,width:525,height:220,buttons:[{label:window.jimuNls.common.ok,onClick:d.hitch(this,function(){e.showBusy();h.disableButton(0);e.validate().then(d.hitch(this,function(c){c.valid?this._addItem(b,a,e):(e.hideBusy(),h.enableButton(0))}))})},{label:window.jimuNls.common.cancel,classNames:["jimu-btn-vacation"],onClick:d.hitch(this,function(){h.close()})}]});else new k({message:window.jimuNls.noEditPrivileges})}))},
  checkPrivilege:function(){var b=t.getStandardPortalUrl(this.appConfig.portalUrl),a=r.getPortal(b);if(a){if(a.haveSignIn())return this._hasPrivilege(a);f.useSignInPage=!1;return a.signIn().then(d.hitch(this,function(){f.useSignInPage=!0;return this._hasPrivilege(a)}),d.hitch(this,function(){f.useSignInPage=!0}))}b=new p;b.resolve(!1);return b},_hasPrivilege:function(b){return b.loadSelfInfo().then(d.hitch(this,function(a){if(a&&a.user){var b=new u({id:a.user.roleId?a.user.roleId:a.user.role,role:a.user.role});
  a.user.privileges&&b.setPrivileges(a.user.privileges);return b.canCreateItem()&&b.canPublishFeatures()}return!1}),function(){return!1})},_addItem:function(b,a,c){var e=c.getName(),h=c.getFolderId(),f=c.popup;a=a||{};var g={name:a.name,type:a.type||"Feature Layer",displayField:a.displayField,description:a.description,copyrightText:a.copyright,geometryType:a.geometryType||b.geometryType,fields:a.fields||b.fields,objectIdField:a.objectIdField};b.features[0].geometry&&(a=q.graphicsExtent(b.features),
  g.initialExtent=a,g.fullExtent=a);!g.objectIdField&&g.fields&&m.some(g.fields,function(a){if("esriFieldTypeOID"===a.type)return g.objectIdField=a.name,!0});b={layers:[{layerDefinition:g,featureSet:b.toJson()}]};c.addItem({name:e,title:e,type:"Feature Collection",typeKeywords:"WAB_created",text:n.stringify(b)},h).then(d.hitch(this,function(a){!0===a.success?f.close():(c.hideBusy(),f.enableButton(0),new k({message:a.error?a.error.message:""}))}),function(a){c.hideBusy();f.enableButton(0);new k({message:a.message})})}})});