gant-core 0.2.12 → 0.2.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,4 +7,4 @@
7
7
  *
8
8
  * MIT Licensed
9
9
  */
10
- const CA=v,xA=y,FA=l,PA=function(){var e;return e=jA?process.env.TEMP||process.env.TMP||(process.env.SystemRoot||process.env.windir)+"\\temp":process.env.TMPDIR||process.env.TMP||process.env.TEMP||"/tmp",SA.test(e)&&(e=e.slice(0,-1)),e},AA=process.binding("constants"),BA=PA(),MA="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",TA=/XXXXXX/,kA=3,RA=(AA.O_CREAT||AA.fs.O_CREAT)|(AA.O_EXCL||AA.fs.O_EXCL)|(AA.O_RDWR||AA.fs.O_RDWR),IA=AA.EBADF||AA.os.errno.EBADF,LA=AA.ENOENT||AA.os.errno.ENOENT,NA=[];var UA=!1,GA=!1;function WA(e){var t=[],r=null;try{r=FA.randomBytes(e)}catch(t){r=FA.pseudoRandomBytes(e)}for(var n=0;n<e;n++)t.push(MA[r[n]%MA.length]);return t.join("")}function qA(e){return void 0===e}function VA(e,t){return"function"==typeof e?[t||{},e]:qA(e)?[{},t]:[e,t]}function zA(e){if(e.name)return xA.join(e.dir||BA,e.name);if(e.template)return e.template.replace(TA,WA(6));const t=[e.prefix||"tmp-",process.pid,WA(12),e.postfix||""].join("");return xA.join(e.dir||BA,t)}function $A(e,t){var r=VA(e,t),n=r[0],o=r[1],i=n.name?1:n.tries||kA;return isNaN(i)||i<0?o(new Error("Invalid tries")):n.template&&!n.template.match(TA)?o(new Error("Invalid template provided")):void function e(){const t=zA(n);CA.stat(t,(function(r){if(!r)return i-- >0?e():o(new Error("Could not get a unique tmp filename, max tries reached "+t));o(null,t)}))}()}function KA(e){var t=VA(e)[0],r=t.name?1:t.tries||kA;if(isNaN(r)||r<0)throw new Error("Invalid tries");if(t.template&&!t.template.match(TA))throw new Error("Invalid template provided");do{const e=zA(t);try{CA.statSync(e)}catch(t){return e}}while(r-- >0);throw new Error("Could not get a unique tmp filename, max tries reached")}function YA(e){const t=[e];do{for(var r=t.pop(),n=!1,o=CA.readdirSync(r),i=0,a=o.length;i<a;i++){var u=xA.join(r,o[i]);CA.lstatSync(u).isDirectory()?(n||(n=!0,t.push(r)),t.push(u)):CA.unlinkSync(u)}n||CA.rmdirSync(r)}while(0!==t.length)}function HA(e,t,r){const n=QA((function(e){try{0<=e[0]&&CA.closeSync(e[0])}catch(e){if(!(t=e,eB(t,-IA,"EBADF")||ZA(e)))throw e}var t;try{CA.unlinkSync(e[1])}catch(e){if(!ZA(e))throw e}}),[t,e]);return r.keep||NA.unshift(n),n}function JA(e,t){const r=QA(t.unsafeCleanup?YA:CA.rmdirSync.bind(CA),e);return t.keep||NA.unshift(r),r}function QA(e,t){var r=!1;return function n(o){if(!r){const o=NA.indexOf(n);o>=0&&NA.splice(o,1),r=!0,e(t)}o&&o(null)}}function XA(){if(!GA||UA)for(;NA.length;)try{NA[0].call(null)}catch(e){}}function ZA(e){return eB(e,-LA,"ENOENT")}function eB(e,t,r){return e.code==t||e.code==r}const tB=process.versions.node.split(".").map((function(e){return parseInt(e,10)}));0===tB[0]&&(tB[1]<9||9===tB[1]&&tB[2]<5)&&process.addListener("uncaughtException",(function(e){throw GA=!0,XA(),e})),process.addListener("exit",(function(e){e&&(GA=!0),XA()})),EA.tmpdir=BA,EA.dir=function(e,t){var r=VA(e,t),n=r[0],o=r[1];$A(n,(function(e,t){if(e)return o(e);CA.mkdir(t,n.mode||448,(function(e){if(e)return o(e);o(null,t,JA(t,n))}))}))},EA.dirSync=function(e){var t=VA(e)[0];const r=KA(t);return CA.mkdirSync(r,t.mode||448),{name:r,removeCallback:JA(r,t)}},EA.file=function(e,t){var r=VA(e,t),n=r[0],o=r[1];n.postfix=qA(n.postfix)?".tmp":n.postfix,$A(n,(function(e,t){if(e)return o(e);CA.open(t,RA,n.mode||384,(function(e,r){return e?o(e):n.discardDescriptor?CA.close(r,(function(e){if(e){try{CA.unlinkSync(t)}catch(t){ZA(t)||(e=t)}return o(e)}o(null,t,void 0,HA(t,-1,n))})):n.detachDescriptor?o(null,t,r,HA(t,-1,n)):void o(null,t,r,HA(t,r,n))}))}))},EA.fileSync=function(e){var t=VA(e)[0];t.postfix=t.postfix||".tmp";const r=t.discardDescriptor||t.detachDescriptor,n=KA(t);var o=CA.openSync(n,RA,t.mode||384);return t.discardDescriptor&&(CA.closeSync(o),o=void 0),{name:n,fd:o,removeCallback:HA(n,r?-1:o,t)}},EA.tmpName=$A,EA.tmpNameSync=KA,EA.setGracefulCleanup=function(){UA=!0};var rB={},nB=h.commonjsGlobal&&h.commonjsGlobal.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},e(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(rB,"__esModule",{value:!0});var oB=function(e){function t(t){var r=this.constructor,n=e.call(this,"Failed to create temporary file for editor")||this;n.originalError=t;var o=r.prototype;return Object.setPrototypeOf?Object.setPrototypeOf(n,o):n.__proto__=r.prototype,n}return nB(t,e),t}(Error);rB.CreateFileError=oB;var iB={},aB=h.commonjsGlobal&&h.commonjsGlobal.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},e(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(iB,"__esModule",{value:!0});var uB=function(e){function t(t){var r=this.constructor,n=e.call(this,"Failed launch editor")||this;n.originalError=t;var o=r.prototype;return Object.setPrototypeOf?Object.setPrototypeOf(n,o):n.__proto__=r.prototype,n}return aB(t,e),t}(Error);iB.LaunchEditorError=uB;var sB={},cB=h.commonjsGlobal&&h.commonjsGlobal.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},e(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(sB,"__esModule",{value:!0});var lB=function(e){function t(t){var r=this.constructor,n=e.call(this,"Failed to read temporary file")||this;n.originalError=t;var o=r.prototype;return Object.setPrototypeOf?Object.setPrototypeOf(n,o):n.__proto__=r.prototype,n}return cB(t,e),t}(Error);sB.ReadFileError=lB;var fB={},pB=h.commonjsGlobal&&h.commonjsGlobal.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},e(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(fB,"__esModule",{value:!0});var dB=function(e){function t(t){var r=this.constructor,n=e.call(this,"Failed to cleanup temporary file")||this;n.originalError=t;var o=r.prototype;return Object.setPrototypeOf?Object.setPrototypeOf(n,o):n.__proto__=r.prototype,n}return pB(t,e),t}(Error);fB.RemoveFileError=dB,Object.defineProperty(dP,"__esModule",{value:!0});var hB=hP,bB=s,vB=v,yB=OA,mB=EA,gB=rB;dP.CreateFileError=gB.CreateFileError;var DB=iB;dP.LaunchEditorError=DB.LaunchEditorError;var _B=sB;dP.ReadFileError=_B.ReadFileError;var wB=fB;dP.RemoveFileError=wB.RemoveFileError,dP.edit=function(e,t){void 0===e&&(e="");var r=new EB(e,t);return r.run(),r.cleanup(),r.text};var OB=dP.editAsync=function(e,t,r){void 0===e&&(e="");var n=new EB(e,r);n.runAsync((function(e,r){if(e)setImmediate(t,e,null);else try{n.cleanup(),setImmediate(t,null,r)}catch(e){setImmediate(t,e,null)}}))},EB=function(){function e(e,t){void 0===e&&(e=""),this.text="",this.fileOptions={},this.text=e,t&&(this.fileOptions=t),this.determineEditor(),this.createTemporaryFile()}return e.splitStringBySpace=function(e){for(var t=[],r="",n=0;n<e.length;n++){var o=e[n];n>0&&" "===o&&"\\"!==e[n-1]&&r.length>0?(t.push(r),r=""):r+=o}return r.length>0&&t.push(r),t},Object.defineProperty(e.prototype,"temp_file",{get:function(){return console.log("DEPRECATED: temp_file. Use tempFile moving forward."),this.tempFile},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"last_exit_status",{get:function(){return console.log("DEPRECATED: last_exit_status. Use lastExitStatus moving forward."),this.lastExitStatus},enumerable:!0,configurable:!0}),e.prototype.run=function(){return this.launchEditor(),this.readTemporaryFile(),this.text},e.prototype.runAsync=function(e){var t=this;try{this.launchEditorAsync((function(){try{t.readTemporaryFile(),setImmediate(e,null,t.text)}catch(t){setImmediate(e,t,null)}}))}catch(t){setImmediate(e,t,null)}},e.prototype.cleanup=function(){this.removeTemporaryFile()},e.prototype.determineEditor=function(){var t=process.env.VISUAL?process.env.VISUAL:process.env.EDITOR?process.env.EDITOR:/^win/.test(process.platform)?"notepad":"vim",r=e.splitStringBySpace(t).map((function(e){return e.replace("\\ "," ")})),n=r.shift();this.editor={args:r,bin:n}},e.prototype.createTemporaryFile=function(){try{this.tempFile=mB.tmpNameSync(this.fileOptions);var e={encoding:"utf8"};this.fileOptions.hasOwnProperty("mode")&&(e.mode=this.fileOptions.mode),vB.writeFileSync(this.tempFile,this.text,e)}catch(e){throw new gB.CreateFileError(e)}},e.prototype.readTemporaryFile=function(){try{var e=vB.readFileSync(this.tempFile);if(0===e.length)this.text="";else{var t=hB.detect(e).toString();yB.encodingExists(t)||(t="utf8"),this.text=yB.decode(e,t)}}catch(e){throw new _B.ReadFileError(e)}},e.prototype.removeTemporaryFile=function(){try{vB.unlinkSync(this.tempFile)}catch(e){throw new wB.RemoveFileError(e)}},e.prototype.launchEditor=function(){try{var e=bB.spawnSync(this.editor.bin,this.editor.args.concat([this.tempFile]),{stdio:"inherit"});this.lastExitStatus=e.status}catch(e){throw new DB.LaunchEditorError(e)}},e.prototype.launchEditorAsync=function(e){var t=this;try{bB.spawn(this.editor.bin,this.editor.args.concat([this.tempFile]),{stdio:"inherit"}).on("exit",(function(r){t.lastExitStatus=r,setImmediate(e)}))}catch(e){throw new DB.LaunchEditorError(e)}},e}();dP.ExternalEditor=EB;class jB extends nP{_run(e){this.done=e,this.editorResult=new Te.Subject;const t=Jv(this.rl);this.lineSubscription=t.line.subscribe(this.startExternalEditor.bind(this));void 0===this.opt.waitUserInput||this.opt.waitUserInput||this.startExternalEditor();const r=this.handleSubmitEvents(this.editorResult);return r.success.forEach(this.onEnd.bind(this)),r.error.forEach(this.onError.bind(this)),this.currentText=this.opt.default,this.opt.default=null,this.render(),this}render(e){let t="",r=this.getQuestion();"answered"===this.status?r+=K.dim("Received"):r+=K.dim("Press <enter> to launch your preferred editor."),e&&(t=K.red(">> ")+e),this.screen.render(r,t)}startExternalEditor(){this.rl.pause(),OB(this.currentText,this.endExternalEditor.bind(this),{postfix:this.opt.postfix??".txt"})}endExternalEditor(e,t){this.rl.resume(),e?this.editorResult.error(e):this.editorResult.next(t)}onEnd(e){this.editorResult.unsubscribe(),this.lineSubscription.unsubscribe(),this.answer=e.value,this.status="answered",this.render(),this.screen.done(),this.done(this.answer)}onError(e){this.render(e.isValid)}}var SB,CB={exports:{}},xB=Object.prototype.toString,FB=Math.max,PB=function(e,t){for(var r=[],n=0;n<e.length;n+=1)r[n]=e[n];for(var o=0;o<t.length;o+=1)r[o+e.length]=t[o];return r},AB=function(e){var t=this;if("function"!=typeof t||"[object Function]"!==xB.apply(t))throw new TypeError("Function.prototype.bind called on incompatible "+t);for(var r,n=function(e,t){for(var r=[],n=t||0,o=0;n<e.length;n+=1,o+=1)r[o]=e[n];return r}(arguments,1),o=FB(0,t.length-n.length),i=[],a=0;a<o;a++)i[a]="$"+a;if(r=Function("binder","return function ("+function(e,t){for(var r="",n=0;n<e.length;n+=1)r+=e[n],n+1<e.length&&(r+=t);return r}(i,",")+"){ return binder.apply(this,arguments); }")((function(){if(this instanceof r){var o=t.apply(this,PB(n,arguments));return Object(o)===o?o:this}return t.apply(e,PB(n,arguments))})),t.prototype){var u=function(){};u.prototype=t.prototype,r.prototype=new u,u.prototype=null}return r},BB=Function.prototype.bind||AB,MB=Error,TB=EvalError,kB=RangeError,RB=ReferenceError,IB=SyntaxError,LB=TypeError,NB=URIError,UB="undefined"!=typeof Symbol&&Symbol,GB=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var n=Object.getOwnPropertySymbols(e);if(1!==n.length||n[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var o=Object.getOwnPropertyDescriptor(e,t);if(42!==o.value||!0!==o.enumerable)return!1}return!0},WB={__proto__:null,foo:{}},qB=Object,VB=Function.prototype.call,zB=Object.prototype.hasOwnProperty,$B=BB.call(VB,zB),KB=MB,YB=TB,HB=kB,JB=RB,QB=IB,XB=LB,ZB=NB,eM=Function,tM=function(e){try{return eM('"use strict"; return ('+e+").constructor;")()}catch(e){}},rM=Object.getOwnPropertyDescriptor;if(rM)try{rM({},"")}catch(e){rM=null}var nM=function(){throw new XB},oM=rM?function(){try{return nM}catch(e){try{return rM(arguments,"callee").get}catch(e){return nM}}}():nM,iM="function"==typeof UB&&"function"==typeof Symbol&&"symbol"==typeof UB("foo")&&"symbol"==typeof Symbol("bar")&&GB(),aM={__proto__:WB}.foo===WB.foo&&!(WB instanceof qB),uM=Object.getPrototypeOf||(aM?function(e){return e.__proto__}:null),sM={},cM="undefined"!=typeof Uint8Array&&uM?uM(Uint8Array):SB,lM={__proto__:null,"%AggregateError%":"undefined"==typeof AggregateError?SB:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?SB:ArrayBuffer,"%ArrayIteratorPrototype%":iM&&uM?uM([][Symbol.iterator]()):SB,"%AsyncFromSyncIteratorPrototype%":SB,"%AsyncFunction%":sM,"%AsyncGenerator%":sM,"%AsyncGeneratorFunction%":sM,"%AsyncIteratorPrototype%":sM,"%Atomics%":"undefined"==typeof Atomics?SB:Atomics,"%BigInt%":"undefined"==typeof BigInt?SB:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?SB:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?SB:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?SB:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":KB,"%eval%":eval,"%EvalError%":YB,"%Float32Array%":"undefined"==typeof Float32Array?SB:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?SB:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?SB:FinalizationRegistry,"%Function%":eM,"%GeneratorFunction%":sM,"%Int8Array%":"undefined"==typeof Int8Array?SB:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?SB:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?SB:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":iM&&uM?uM(uM([][Symbol.iterator]())):SB,"%JSON%":"object"==typeof JSON?JSON:SB,"%Map%":"undefined"==typeof Map?SB:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&iM&&uM?uM((new Map)[Symbol.iterator]()):SB,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?SB:Promise,"%Proxy%":"undefined"==typeof Proxy?SB:Proxy,"%RangeError%":HB,"%ReferenceError%":JB,"%Reflect%":"undefined"==typeof Reflect?SB:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?SB:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&iM&&uM?uM((new Set)[Symbol.iterator]()):SB,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?SB:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":iM&&uM?uM(""[Symbol.iterator]()):SB,"%Symbol%":iM?Symbol:SB,"%SyntaxError%":QB,"%ThrowTypeError%":oM,"%TypedArray%":cM,"%TypeError%":XB,"%Uint8Array%":"undefined"==typeof Uint8Array?SB:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?SB:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?SB:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?SB:Uint32Array,"%URIError%":ZB,"%WeakMap%":"undefined"==typeof WeakMap?SB:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?SB:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?SB:WeakSet};if(uM)try{null.error}catch(e){var fM=uM(uM(e));lM["%Error.prototype%"]=fM}var pM,dM,hM=function e(t){var r;if("%AsyncFunction%"===t)r=tM("async function () {}");else if("%GeneratorFunction%"===t)r=tM("function* () {}");else if("%AsyncGeneratorFunction%"===t)r=tM("async function* () {}");else if("%AsyncGenerator%"===t){var n=e("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if("%AsyncIteratorPrototype%"===t){var o=e("%AsyncGenerator%");o&&uM&&(r=uM(o.prototype))}return lM[t]=r,r},bM={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},vM=BB,yM=$B,mM=vM.call(Function.call,Array.prototype.concat),gM=vM.call(Function.apply,Array.prototype.splice),DM=vM.call(Function.call,String.prototype.replace),_M=vM.call(Function.call,String.prototype.slice),wM=vM.call(Function.call,RegExp.prototype.exec),OM=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,EM=/\\(\\)?/g,jM=function(e,t){var r,n=e;if(yM(bM,n)&&(n="%"+(r=bM[n])[0]+"%"),yM(lM,n)){var o=lM[n];if(o===sM&&(o=hM(n)),void 0===o&&!t)throw new XB("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:r,name:n,value:o}}throw new QB("intrinsic "+e+" does not exist!")},SM=function(e,t){if("string"!=typeof e||0===e.length)throw new XB("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new XB('"allowMissing" argument must be a boolean');if(null===wM(/^%?[^%]*%?$/,e))throw new QB("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=function(e){var t=_M(e,0,1),r=_M(e,-1);if("%"===t&&"%"!==r)throw new QB("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==t)throw new QB("invalid intrinsic syntax, expected opening `%`");var n=[];return DM(e,OM,(function(e,t,r,o){n[n.length]=r?DM(o,EM,"$1"):t||e})),n}(e),n=r.length>0?r[0]:"",o=jM("%"+n+"%",t),i=o.name,a=o.value,u=!1,s=o.alias;s&&(n=s[0],gM(r,mM([0,1],s)));for(var c=1,l=!0;c<r.length;c+=1){var f=r[c],p=_M(f,0,1),d=_M(f,-1);if(('"'===p||"'"===p||"`"===p||'"'===d||"'"===d||"`"===d)&&p!==d)throw new QB("property names with quotes must have matching quotes");if("constructor"!==f&&l||(u=!0),yM(lM,i="%"+(n+="."+f)+"%"))a=lM[i];else if(null!=a){if(!(f in a)){if(!t)throw new XB("base intrinsic for "+e+" exists, but the property is not available.");return}if(rM&&c+1>=r.length){var h=rM(a,f);a=(l=!!h)&&"get"in h&&!("originalValue"in h.get)?h.get:a[f]}else l=yM(a,f),a=a[f];l&&!u&&(lM[i]=a)}}return a};function CM(){if(dM)return pM;dM=1;var e=SM("%Object.defineProperty%",!0)||!1;if(e)try{e({},"a",{value:1})}catch(t){e=!1}return pM=e}var xM=SM("%Object.getOwnPropertyDescriptor%",!0);if(xM)try{xM([],"length")}catch(e){xM=null}var FM=xM,PM=CM(),AM=IB,BM=LB,MM=FM,TM=CM(),kM=function(){return!!TM};kM.hasArrayLengthDefineBug=function(){if(!TM)return null;try{return 1!==TM([],"length",{value:1}).length}catch(e){return!0}};var RM=SM,IM=function(e,t,r){if(!e||"object"!=typeof e&&"function"!=typeof e)throw new BM("`obj` must be an object or a function`");if("string"!=typeof t&&"symbol"!=typeof t)throw new BM("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new BM("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new BM("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new BM("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new BM("`loose`, if provided, must be a boolean");var n=arguments.length>3?arguments[3]:null,o=arguments.length>4?arguments[4]:null,i=arguments.length>5?arguments[5]:null,a=arguments.length>6&&arguments[6],u=!!MM&&MM(e,t);if(PM)PM(e,t,{configurable:null===i&&u?u.configurable:!i,enumerable:null===n&&u?u.enumerable:!n,value:r,writable:null===o&&u?u.writable:!o});else{if(!a&&(n||o||i))throw new AM("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");e[t]=r}},LM=kM(),NM=FM,UM=LB,GM=RM("%Math.floor%"),WM=function(e,t){if("function"!=typeof e)throw new UM("`fn` is not a function");if("number"!=typeof t||t<0||t>4294967295||GM(t)!==t)throw new UM("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],n=!0,o=!0;if("length"in e&&NM){var i=NM(e,"length");i&&!i.configurable&&(n=!1),i&&!i.writable&&(o=!1)}return(n||o||!r)&&(LM?IM(e,"length",t,!0,!0):IM(e,"length",t)),e};!function(e){var t=BB,r=SM,n=WM,o=LB,i=r("%Function.prototype.apply%"),a=r("%Function.prototype.call%"),u=r("%Reflect.apply%",!0)||t.call(a,i),s=CM(),c=r("%Math.max%");e.exports=function(e){if("function"!=typeof e)throw new o("a function is required");var r=u(t,a,arguments);return n(r,1+c(0,e.length-(arguments.length-1)),!0)};var l=function(){return u(t,i,arguments)};s?s(e.exports,"apply",{value:l}):e.exports.apply=l}(CB);var qM=CB.exports,VM=i.Stream,zM=qM;function $M(e,t,r){var n=zM(e||function(e){this.queue(e)}),o=zM(t||function(){this.queue(null)}),i=!1,a=!1,u=[],s=!1,c=new VM;function l(){for(;u.length&&!c.paused;){var e=u.shift();if(null===e)return c.emit("end");c.emit("data",e)}}return c.readable=!0,c.writable=!0,c.paused=!1,c.autoDestroy=!(r&&!1===r.autoDestroy),c.write=function(e){return n(this,e),!c.paused},c.queue=function(e){return s||(null===e&&(s=!0),u.push(e),l()),c},c.push=c.queue,c.on("end",(function(){c.readable=!1,!c.writable&&c.autoDestroy&&process.nextTick((function(){c.destroy()}))})),c.end=function(e){if(!i)return i=!0,arguments.length&&c.write(e),c.writable=!1,o(c),!c.readable&&c.autoDestroy&&c.destroy(),c},c.destroy=function(){if(!a)return a=!0,i=!0,u.length=0,c.writable=!1,c.readable=!1,c.emit("close"),c},c.pause=function(){if(!c.paused)return c.paused=!0,c},c.resume=function(){return c.paused&&(c.paused=!1,c.emit("resume")),l(),c.paused||c.emit("drain"),c},c}var KM=$M;$M.through=$M;var YM=h.getDefaultExportFromCjs(KM);const HM=i;var JM=class extends HM{#e=null;constructor(e={}){super(e),this.writable=this.readable=!0,this.muted=!1,this.on("pipe",this._onpipe),this.replace=e.replace,this._prompt=e.prompt||null,this._hadControl=!1}#t(e,t){return this._dest?this._dest[e]:this._src?this._src[e]:t}#r(e,...t){"function"==typeof this._dest?.[e]&&this._dest[e](...t),"function"==typeof this._src?.[e]&&this._src[e](...t)}get isTTY(){return null!==this.#e?this.#e:this.#t("isTTY",!1)}set isTTY(e){this.#e=e}get rows(){return this.#t("rows")}get columns(){return this.#t("columns")}mute(){this.muted=!0}unmute(){this.muted=!1}_onpipe(e){this._src=e}pipe(e,t){return this._dest=e,super.pipe(e,t)}pause(){if(this._src)return this._src.pause()}resume(){if(this._src)return this._src.resume()}write(e){if(this.muted){if(!this.replace)return!0;if(e.match(/^\u001b/))return 0===e.indexOf(this._prompt)&&(e=(e=e.slice(this._prompt.length)).replace(/./g,this.replace),e=this._prompt+e),this._hadControl=!0,this.emit("data",e);this._prompt&&this._hadControl&&0===e.indexOf(this._prompt)&&(this._hadControl=!1,this.emit("data",this._prompt),e=e.slice(this._prompt.length)),e=e.toString().replace(/./g,this.replace)}this.emit("data",e)}end(e){this.muted&&(e=e&&this.replace?e.toString().replace(/./g,this.replace):null),e&&this.emit("data",e),this.emit("end")}destroy(...e){return this.#r("destroy",...e)}destroySoon(...e){return this.#r("destroySoon",...e)}close(...e){return this.#r("close",...e)}},QM=h.getDefaultExportFromCjs(JM);class XM{constructor(e){this.rl||=m.createInterface(function(e={}){e.skipTTYChecks=void 0===e.skipTTYChecks||e.skipTTYChecks;const t=e.input||process.stdin;if(!e.skipTTYChecks&&!t.isTTY){const e=new Error("Prompts can not be meaningfully rendered in non-TTY environments");throw e.isTtyError=!0,e}const r=new QM;r.pipe(e.output||process.stdout);const n=r;return{terminal:!0,...e,input:t,output:n}}(e)),this.rl.resume(),this.onForceClose=this.onForceClose.bind(this),process.on("exit",this.onForceClose),this.rl.on("SIGINT",this.onForceClose)}onForceClose(){this.close(),process.kill(process.pid,"SIGINT"),console.log("")}close(){this.rl.removeListener("SIGINT",this.onForceClose),process.removeListener("exit",this.onForceClose),this.rl.output.unmute(),this.activePrompt&&"function"==typeof this.activePrompt.close&&this.activePrompt.close(),this.rl.output.end(),this.rl.pause(),this.rl.close()}}var ZM=Dy,eT=j_,tT=vm,rT=Function.prototype,nT=Object.prototype,oT=rT.toString,iT=nT.hasOwnProperty,aT=oT.call(Object);var uT=function(e){if(!tT(e)||"[object Object]"!=ZM(e))return!1;var t=eT(e);if(null===t)return!0;var r=iT.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&oT.call(r)==aT},sT=VD,cT=rj,lT=cm,fT=_y,pT=oj;var dT=function(e,t,r,n){if(!fT(e))return e;for(var o=-1,i=(t=cT(t,e)).length,a=i-1,u=e;null!=u&&++o<i;){var s=pT(t[o]),c=r;if("__proto__"===s||"constructor"===s||"prototype"===s)return e;if(o!=a){var l=u[s];void 0===(c=n?n(l,s,u):void 0)&&(c=fT(l)?l:lT(t[o+1])?[]:{})}sT(u,s,c),u=u[s]}return e},hT=dT;var bT=function(e,t,r){return null==e?e:hT(e,t,r)};const vT=function(e,t,r){return"function"!=typeof e[t]?Te.of(e):Te.from(Me(e[t])(r).then((r=>(e[t]=r,e))))},yT={isPlainObject:h.getDefaultExportFromCjs(uT),set:h.getDefaultExportFromCjs(bT),get:lj};class mT extends XM{constructor(e,t){super(t),this.prompts=e}run(e,t){yT.isPlainObject(t)?this.answers={...t}:this.answers={},yT.isPlainObject(e)&&(e=Object.values(e).every((e=>yT.isPlainObject(e)&&void 0===e.name))?Object.entries(e).map((([e,t])=>({name:e,...t}))):[e]);const r=Array.isArray(e)?Te.from(e):e;return this.process=r.pipe(Te.concatMap(this.processQuestion.bind(this)),Te.publish()),this.process.connect(),this.process.pipe(Te.reduce(((e,t)=>(yT.set(e,t.name,t.answer),e)),this.answers)).toPromise(Promise).then(this.onCompletion.bind(this),this.onError.bind(this))}onCompletion(){return this.close(),this.answers}onError(e){return this.close(),Promise.reject(e)}processQuestion(e){return e={...e},Te.defer((()=>Te.of(e).pipe(Te.concatMap(this.setDefaultType.bind(this)),Te.concatMap(this.filterIfRunnable.bind(this)),Te.concatMap((()=>vT(e,"message",this.answers))),Te.concatMap((()=>vT(e,"default",this.answers))),Te.concatMap((()=>vT(e,"choices",this.answers))),Te.concatMap(this.fetchAnswer.bind(this)))))}fetchAnswer(e){const t=this.prompts[e.type];return this.activePrompt=new t(e,this.rl,this.answers),Te.defer((()=>Te.from(this.activePrompt.run().then((t=>({name:e.name,answer:t}))))))}setDefaultType(e){return this.prompts[e.type]||(e.type="input"),Te.defer((()=>Te.of(e)))}filterIfRunnable(e){if(!0!==e.askAnswered&&void 0!==yT.get(this.answers,e.name))return Te.empty();if(!1===e.when)return Te.empty();if("function"!=typeof e.when)return Te.of(e);const{answers:t}=this;return Te.defer((()=>Te.from(Me(e.when)(t).then((t=>{if(t)return e}))).pipe(Te.filter((e=>null!=e)))))}}function gT(e){const t=function(r,n){let o;try{o=new mT(t.prompts,e)}catch(e){return Promise.reject(e)}const i=o.run(r,n);return i.ui=o,i};return t.prompts={},t.registerPrompt=function(e,r){return t.prompts[e]=r,this},t.restoreDefaultPrompts=function(){this.registerPrompt("list",oP),this.registerPrompt("input",iP),this.registerPrompt("number",aP),this.registerPrompt("confirm",uP),this.registerPrompt("rawlist",sP),this.registerPrompt("expand",cP),this.registerPrompt("checkbox",lP),this.registerPrompt("password",pP),this.registerPrompt("editor",jB)},t.restoreDefaultPrompts(),t}const DT=gT();const _T={prompt:DT,ui:{BottomBar:class extends XM{constructor(e={}){super(e),this.log=YM(this.writeLog.bind(this)),this.bottomBar=e.bottomBar||"",this.render()}render(){return this.write(this.bottomBar),this}clean(){return XF(this.rl,this.bottomBar.split("\n").length),this}updateBottomBar(e){return XF(this.rl,1),this.rl.output.unmute(),this.clean(),this.bottomBar=e,this.render(),this.rl.output.mute(),this}writeLog(e){return this.rl.output.unmute(),this.clean(),this.rl.output.write(this.enforceLF(e.toString())),this.render(),this.rl.output.mute(),this}enforceLF(e){return e.match(/[\r\n]$/)?e:e+"\n"}write(e){const t=e.split(/\n/);this.height=t.length,this.rl.setPrompt(t[t.length-1]),0===this.rl.output.rows&&0===this.rl.output.columns&&JF(this.rl,e.length+this.rl.line.length),this.rl.output.write(e)}},Prompt:mT},createPromptModule:gT,registerPrompt:function(e,t){DT.registerPrompt(e,t)},restoreDefaultPrompts:function(){DT.restoreDefaultPrompts()},Separator:iS};var wT="0.2.12";const OT=process.cwd();exports.createModule=async()=>{const e=await g.loadJSON(y.resolve(OT,"package.json")),t=await _T.prompt([{type:"list",name:"type",message:"请选择一个选项:",default:"react",choices:["vue","react"]},{type:"input",message:"workspaces name",name:"workspaces",validate:function(e){return!(e&&!v.existsSync(y.resolve(OT,e)))||"工作空间不存在"}},{type:"input",message:"package name",name:"name",validate:function(e){return!!e.replace(/\s/g,"")||"姓名不能为空,请重新输入"}},{type:"input",message:"version",name:"version",default:e.version}]),r="vue"===t.type,n=v.readFileSync(y.resolve(__dirname,r?"../../template/template.vue.package.json":"../../template/template.package.json"),"utf-8"),o=h.ejs.compile(n),i=y.resolve(OT,t.workspaces,t.name);v.existsSync(y.resolve(i))||v.mkdirSync(i),s.exec(`cd ${i}`,((e,n,a)=>{e?console.error(`错误: ${e.message}`):a?console.error(`错误: ${a}`):(h.createCwdConfig(i,t.name,r),v.mkdirSync(y.resolve(i,"public")),v.mkdirSync(y.resolve(i,"src")),v.writeFileSync(y.resolve(i,"package.json"),o({...t,coreVersion:`^${wT}`})),v.writeFileSync(y.resolve(i,"tsconfig.json"),'{\n "extends": ["./src/.gant/tsconfig.json"]\n }'),v.writeFileSync(y.resolve(i,"tsconfig.json"),'{\n "extends": ["./src/.gant/tsconfig.json"]\n }'))}))},exports.stringWidthExports=FS;
10
+ const CA=v,xA=y,FA=l,PA=function(){var e;return e=jA?process.env.TEMP||process.env.TMP||(process.env.SystemRoot||process.env.windir)+"\\temp":process.env.TMPDIR||process.env.TMP||process.env.TEMP||"/tmp",SA.test(e)&&(e=e.slice(0,-1)),e},AA=process.binding("constants"),BA=PA(),MA="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",TA=/XXXXXX/,kA=3,RA=(AA.O_CREAT||AA.fs.O_CREAT)|(AA.O_EXCL||AA.fs.O_EXCL)|(AA.O_RDWR||AA.fs.O_RDWR),IA=AA.EBADF||AA.os.errno.EBADF,LA=AA.ENOENT||AA.os.errno.ENOENT,NA=[];var UA=!1,GA=!1;function WA(e){var t=[],r=null;try{r=FA.randomBytes(e)}catch(t){r=FA.pseudoRandomBytes(e)}for(var n=0;n<e;n++)t.push(MA[r[n]%MA.length]);return t.join("")}function qA(e){return void 0===e}function VA(e,t){return"function"==typeof e?[t||{},e]:qA(e)?[{},t]:[e,t]}function zA(e){if(e.name)return xA.join(e.dir||BA,e.name);if(e.template)return e.template.replace(TA,WA(6));const t=[e.prefix||"tmp-",process.pid,WA(12),e.postfix||""].join("");return xA.join(e.dir||BA,t)}function $A(e,t){var r=VA(e,t),n=r[0],o=r[1],i=n.name?1:n.tries||kA;return isNaN(i)||i<0?o(new Error("Invalid tries")):n.template&&!n.template.match(TA)?o(new Error("Invalid template provided")):void function e(){const t=zA(n);CA.stat(t,(function(r){if(!r)return i-- >0?e():o(new Error("Could not get a unique tmp filename, max tries reached "+t));o(null,t)}))}()}function KA(e){var t=VA(e)[0],r=t.name?1:t.tries||kA;if(isNaN(r)||r<0)throw new Error("Invalid tries");if(t.template&&!t.template.match(TA))throw new Error("Invalid template provided");do{const e=zA(t);try{CA.statSync(e)}catch(t){return e}}while(r-- >0);throw new Error("Could not get a unique tmp filename, max tries reached")}function YA(e){const t=[e];do{for(var r=t.pop(),n=!1,o=CA.readdirSync(r),i=0,a=o.length;i<a;i++){var u=xA.join(r,o[i]);CA.lstatSync(u).isDirectory()?(n||(n=!0,t.push(r)),t.push(u)):CA.unlinkSync(u)}n||CA.rmdirSync(r)}while(0!==t.length)}function HA(e,t,r){const n=QA((function(e){try{0<=e[0]&&CA.closeSync(e[0])}catch(e){if(!(t=e,eB(t,-IA,"EBADF")||ZA(e)))throw e}var t;try{CA.unlinkSync(e[1])}catch(e){if(!ZA(e))throw e}}),[t,e]);return r.keep||NA.unshift(n),n}function JA(e,t){const r=QA(t.unsafeCleanup?YA:CA.rmdirSync.bind(CA),e);return t.keep||NA.unshift(r),r}function QA(e,t){var r=!1;return function n(o){if(!r){const o=NA.indexOf(n);o>=0&&NA.splice(o,1),r=!0,e(t)}o&&o(null)}}function XA(){if(!GA||UA)for(;NA.length;)try{NA[0].call(null)}catch(e){}}function ZA(e){return eB(e,-LA,"ENOENT")}function eB(e,t,r){return e.code==t||e.code==r}const tB=process.versions.node.split(".").map((function(e){return parseInt(e,10)}));0===tB[0]&&(tB[1]<9||9===tB[1]&&tB[2]<5)&&process.addListener("uncaughtException",(function(e){throw GA=!0,XA(),e})),process.addListener("exit",(function(e){e&&(GA=!0),XA()})),EA.tmpdir=BA,EA.dir=function(e,t){var r=VA(e,t),n=r[0],o=r[1];$A(n,(function(e,t){if(e)return o(e);CA.mkdir(t,n.mode||448,(function(e){if(e)return o(e);o(null,t,JA(t,n))}))}))},EA.dirSync=function(e){var t=VA(e)[0];const r=KA(t);return CA.mkdirSync(r,t.mode||448),{name:r,removeCallback:JA(r,t)}},EA.file=function(e,t){var r=VA(e,t),n=r[0],o=r[1];n.postfix=qA(n.postfix)?".tmp":n.postfix,$A(n,(function(e,t){if(e)return o(e);CA.open(t,RA,n.mode||384,(function(e,r){return e?o(e):n.discardDescriptor?CA.close(r,(function(e){if(e){try{CA.unlinkSync(t)}catch(t){ZA(t)||(e=t)}return o(e)}o(null,t,void 0,HA(t,-1,n))})):n.detachDescriptor?o(null,t,r,HA(t,-1,n)):void o(null,t,r,HA(t,r,n))}))}))},EA.fileSync=function(e){var t=VA(e)[0];t.postfix=t.postfix||".tmp";const r=t.discardDescriptor||t.detachDescriptor,n=KA(t);var o=CA.openSync(n,RA,t.mode||384);return t.discardDescriptor&&(CA.closeSync(o),o=void 0),{name:n,fd:o,removeCallback:HA(n,r?-1:o,t)}},EA.tmpName=$A,EA.tmpNameSync=KA,EA.setGracefulCleanup=function(){UA=!0};var rB={},nB=h.commonjsGlobal&&h.commonjsGlobal.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},e(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(rB,"__esModule",{value:!0});var oB=function(e){function t(t){var r=this.constructor,n=e.call(this,"Failed to create temporary file for editor")||this;n.originalError=t;var o=r.prototype;return Object.setPrototypeOf?Object.setPrototypeOf(n,o):n.__proto__=r.prototype,n}return nB(t,e),t}(Error);rB.CreateFileError=oB;var iB={},aB=h.commonjsGlobal&&h.commonjsGlobal.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},e(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(iB,"__esModule",{value:!0});var uB=function(e){function t(t){var r=this.constructor,n=e.call(this,"Failed launch editor")||this;n.originalError=t;var o=r.prototype;return Object.setPrototypeOf?Object.setPrototypeOf(n,o):n.__proto__=r.prototype,n}return aB(t,e),t}(Error);iB.LaunchEditorError=uB;var sB={},cB=h.commonjsGlobal&&h.commonjsGlobal.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},e(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(sB,"__esModule",{value:!0});var lB=function(e){function t(t){var r=this.constructor,n=e.call(this,"Failed to read temporary file")||this;n.originalError=t;var o=r.prototype;return Object.setPrototypeOf?Object.setPrototypeOf(n,o):n.__proto__=r.prototype,n}return cB(t,e),t}(Error);sB.ReadFileError=lB;var fB={},pB=h.commonjsGlobal&&h.commonjsGlobal.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},e(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(fB,"__esModule",{value:!0});var dB=function(e){function t(t){var r=this.constructor,n=e.call(this,"Failed to cleanup temporary file")||this;n.originalError=t;var o=r.prototype;return Object.setPrototypeOf?Object.setPrototypeOf(n,o):n.__proto__=r.prototype,n}return pB(t,e),t}(Error);fB.RemoveFileError=dB,Object.defineProperty(dP,"__esModule",{value:!0});var hB=hP,bB=s,vB=v,yB=OA,mB=EA,gB=rB;dP.CreateFileError=gB.CreateFileError;var DB=iB;dP.LaunchEditorError=DB.LaunchEditorError;var _B=sB;dP.ReadFileError=_B.ReadFileError;var wB=fB;dP.RemoveFileError=wB.RemoveFileError,dP.edit=function(e,t){void 0===e&&(e="");var r=new EB(e,t);return r.run(),r.cleanup(),r.text};var OB=dP.editAsync=function(e,t,r){void 0===e&&(e="");var n=new EB(e,r);n.runAsync((function(e,r){if(e)setImmediate(t,e,null);else try{n.cleanup(),setImmediate(t,null,r)}catch(e){setImmediate(t,e,null)}}))},EB=function(){function e(e,t){void 0===e&&(e=""),this.text="",this.fileOptions={},this.text=e,t&&(this.fileOptions=t),this.determineEditor(),this.createTemporaryFile()}return e.splitStringBySpace=function(e){for(var t=[],r="",n=0;n<e.length;n++){var o=e[n];n>0&&" "===o&&"\\"!==e[n-1]&&r.length>0?(t.push(r),r=""):r+=o}return r.length>0&&t.push(r),t},Object.defineProperty(e.prototype,"temp_file",{get:function(){return console.log("DEPRECATED: temp_file. Use tempFile moving forward."),this.tempFile},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"last_exit_status",{get:function(){return console.log("DEPRECATED: last_exit_status. Use lastExitStatus moving forward."),this.lastExitStatus},enumerable:!0,configurable:!0}),e.prototype.run=function(){return this.launchEditor(),this.readTemporaryFile(),this.text},e.prototype.runAsync=function(e){var t=this;try{this.launchEditorAsync((function(){try{t.readTemporaryFile(),setImmediate(e,null,t.text)}catch(t){setImmediate(e,t,null)}}))}catch(t){setImmediate(e,t,null)}},e.prototype.cleanup=function(){this.removeTemporaryFile()},e.prototype.determineEditor=function(){var t=process.env.VISUAL?process.env.VISUAL:process.env.EDITOR?process.env.EDITOR:/^win/.test(process.platform)?"notepad":"vim",r=e.splitStringBySpace(t).map((function(e){return e.replace("\\ "," ")})),n=r.shift();this.editor={args:r,bin:n}},e.prototype.createTemporaryFile=function(){try{this.tempFile=mB.tmpNameSync(this.fileOptions);var e={encoding:"utf8"};this.fileOptions.hasOwnProperty("mode")&&(e.mode=this.fileOptions.mode),vB.writeFileSync(this.tempFile,this.text,e)}catch(e){throw new gB.CreateFileError(e)}},e.prototype.readTemporaryFile=function(){try{var e=vB.readFileSync(this.tempFile);if(0===e.length)this.text="";else{var t=hB.detect(e).toString();yB.encodingExists(t)||(t="utf8"),this.text=yB.decode(e,t)}}catch(e){throw new _B.ReadFileError(e)}},e.prototype.removeTemporaryFile=function(){try{vB.unlinkSync(this.tempFile)}catch(e){throw new wB.RemoveFileError(e)}},e.prototype.launchEditor=function(){try{var e=bB.spawnSync(this.editor.bin,this.editor.args.concat([this.tempFile]),{stdio:"inherit"});this.lastExitStatus=e.status}catch(e){throw new DB.LaunchEditorError(e)}},e.prototype.launchEditorAsync=function(e){var t=this;try{bB.spawn(this.editor.bin,this.editor.args.concat([this.tempFile]),{stdio:"inherit"}).on("exit",(function(r){t.lastExitStatus=r,setImmediate(e)}))}catch(e){throw new DB.LaunchEditorError(e)}},e}();dP.ExternalEditor=EB;class jB extends nP{_run(e){this.done=e,this.editorResult=new Te.Subject;const t=Jv(this.rl);this.lineSubscription=t.line.subscribe(this.startExternalEditor.bind(this));void 0===this.opt.waitUserInput||this.opt.waitUserInput||this.startExternalEditor();const r=this.handleSubmitEvents(this.editorResult);return r.success.forEach(this.onEnd.bind(this)),r.error.forEach(this.onError.bind(this)),this.currentText=this.opt.default,this.opt.default=null,this.render(),this}render(e){let t="",r=this.getQuestion();"answered"===this.status?r+=K.dim("Received"):r+=K.dim("Press <enter> to launch your preferred editor."),e&&(t=K.red(">> ")+e),this.screen.render(r,t)}startExternalEditor(){this.rl.pause(),OB(this.currentText,this.endExternalEditor.bind(this),{postfix:this.opt.postfix??".txt"})}endExternalEditor(e,t){this.rl.resume(),e?this.editorResult.error(e):this.editorResult.next(t)}onEnd(e){this.editorResult.unsubscribe(),this.lineSubscription.unsubscribe(),this.answer=e.value,this.status="answered",this.render(),this.screen.done(),this.done(this.answer)}onError(e){this.render(e.isValid)}}var SB,CB={exports:{}},xB=Object.prototype.toString,FB=Math.max,PB=function(e,t){for(var r=[],n=0;n<e.length;n+=1)r[n]=e[n];for(var o=0;o<t.length;o+=1)r[o+e.length]=t[o];return r},AB=function(e){var t=this;if("function"!=typeof t||"[object Function]"!==xB.apply(t))throw new TypeError("Function.prototype.bind called on incompatible "+t);for(var r,n=function(e,t){for(var r=[],n=t||0,o=0;n<e.length;n+=1,o+=1)r[o]=e[n];return r}(arguments,1),o=FB(0,t.length-n.length),i=[],a=0;a<o;a++)i[a]="$"+a;if(r=Function("binder","return function ("+function(e,t){for(var r="",n=0;n<e.length;n+=1)r+=e[n],n+1<e.length&&(r+=t);return r}(i,",")+"){ return binder.apply(this,arguments); }")((function(){if(this instanceof r){var o=t.apply(this,PB(n,arguments));return Object(o)===o?o:this}return t.apply(e,PB(n,arguments))})),t.prototype){var u=function(){};u.prototype=t.prototype,r.prototype=new u,u.prototype=null}return r},BB=Function.prototype.bind||AB,MB=Error,TB=EvalError,kB=RangeError,RB=ReferenceError,IB=SyntaxError,LB=TypeError,NB=URIError,UB="undefined"!=typeof Symbol&&Symbol,GB=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var n=Object.getOwnPropertySymbols(e);if(1!==n.length||n[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var o=Object.getOwnPropertyDescriptor(e,t);if(42!==o.value||!0!==o.enumerable)return!1}return!0},WB={__proto__:null,foo:{}},qB=Object,VB=Function.prototype.call,zB=Object.prototype.hasOwnProperty,$B=BB.call(VB,zB),KB=MB,YB=TB,HB=kB,JB=RB,QB=IB,XB=LB,ZB=NB,eM=Function,tM=function(e){try{return eM('"use strict"; return ('+e+").constructor;")()}catch(e){}},rM=Object.getOwnPropertyDescriptor;if(rM)try{rM({},"")}catch(e){rM=null}var nM=function(){throw new XB},oM=rM?function(){try{return nM}catch(e){try{return rM(arguments,"callee").get}catch(e){return nM}}}():nM,iM="function"==typeof UB&&"function"==typeof Symbol&&"symbol"==typeof UB("foo")&&"symbol"==typeof Symbol("bar")&&GB(),aM={__proto__:WB}.foo===WB.foo&&!(WB instanceof qB),uM=Object.getPrototypeOf||(aM?function(e){return e.__proto__}:null),sM={},cM="undefined"!=typeof Uint8Array&&uM?uM(Uint8Array):SB,lM={__proto__:null,"%AggregateError%":"undefined"==typeof AggregateError?SB:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?SB:ArrayBuffer,"%ArrayIteratorPrototype%":iM&&uM?uM([][Symbol.iterator]()):SB,"%AsyncFromSyncIteratorPrototype%":SB,"%AsyncFunction%":sM,"%AsyncGenerator%":sM,"%AsyncGeneratorFunction%":sM,"%AsyncIteratorPrototype%":sM,"%Atomics%":"undefined"==typeof Atomics?SB:Atomics,"%BigInt%":"undefined"==typeof BigInt?SB:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?SB:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?SB:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?SB:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":KB,"%eval%":eval,"%EvalError%":YB,"%Float32Array%":"undefined"==typeof Float32Array?SB:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?SB:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?SB:FinalizationRegistry,"%Function%":eM,"%GeneratorFunction%":sM,"%Int8Array%":"undefined"==typeof Int8Array?SB:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?SB:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?SB:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":iM&&uM?uM(uM([][Symbol.iterator]())):SB,"%JSON%":"object"==typeof JSON?JSON:SB,"%Map%":"undefined"==typeof Map?SB:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&iM&&uM?uM((new Map)[Symbol.iterator]()):SB,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?SB:Promise,"%Proxy%":"undefined"==typeof Proxy?SB:Proxy,"%RangeError%":HB,"%ReferenceError%":JB,"%Reflect%":"undefined"==typeof Reflect?SB:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?SB:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&iM&&uM?uM((new Set)[Symbol.iterator]()):SB,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?SB:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":iM&&uM?uM(""[Symbol.iterator]()):SB,"%Symbol%":iM?Symbol:SB,"%SyntaxError%":QB,"%ThrowTypeError%":oM,"%TypedArray%":cM,"%TypeError%":XB,"%Uint8Array%":"undefined"==typeof Uint8Array?SB:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?SB:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?SB:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?SB:Uint32Array,"%URIError%":ZB,"%WeakMap%":"undefined"==typeof WeakMap?SB:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?SB:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?SB:WeakSet};if(uM)try{null.error}catch(e){var fM=uM(uM(e));lM["%Error.prototype%"]=fM}var pM,dM,hM=function e(t){var r;if("%AsyncFunction%"===t)r=tM("async function () {}");else if("%GeneratorFunction%"===t)r=tM("function* () {}");else if("%AsyncGeneratorFunction%"===t)r=tM("async function* () {}");else if("%AsyncGenerator%"===t){var n=e("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if("%AsyncIteratorPrototype%"===t){var o=e("%AsyncGenerator%");o&&uM&&(r=uM(o.prototype))}return lM[t]=r,r},bM={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},vM=BB,yM=$B,mM=vM.call(Function.call,Array.prototype.concat),gM=vM.call(Function.apply,Array.prototype.splice),DM=vM.call(Function.call,String.prototype.replace),_M=vM.call(Function.call,String.prototype.slice),wM=vM.call(Function.call,RegExp.prototype.exec),OM=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,EM=/\\(\\)?/g,jM=function(e,t){var r,n=e;if(yM(bM,n)&&(n="%"+(r=bM[n])[0]+"%"),yM(lM,n)){var o=lM[n];if(o===sM&&(o=hM(n)),void 0===o&&!t)throw new XB("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:r,name:n,value:o}}throw new QB("intrinsic "+e+" does not exist!")},SM=function(e,t){if("string"!=typeof e||0===e.length)throw new XB("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new XB('"allowMissing" argument must be a boolean');if(null===wM(/^%?[^%]*%?$/,e))throw new QB("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=function(e){var t=_M(e,0,1),r=_M(e,-1);if("%"===t&&"%"!==r)throw new QB("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==t)throw new QB("invalid intrinsic syntax, expected opening `%`");var n=[];return DM(e,OM,(function(e,t,r,o){n[n.length]=r?DM(o,EM,"$1"):t||e})),n}(e),n=r.length>0?r[0]:"",o=jM("%"+n+"%",t),i=o.name,a=o.value,u=!1,s=o.alias;s&&(n=s[0],gM(r,mM([0,1],s)));for(var c=1,l=!0;c<r.length;c+=1){var f=r[c],p=_M(f,0,1),d=_M(f,-1);if(('"'===p||"'"===p||"`"===p||'"'===d||"'"===d||"`"===d)&&p!==d)throw new QB("property names with quotes must have matching quotes");if("constructor"!==f&&l||(u=!0),yM(lM,i="%"+(n+="."+f)+"%"))a=lM[i];else if(null!=a){if(!(f in a)){if(!t)throw new XB("base intrinsic for "+e+" exists, but the property is not available.");return}if(rM&&c+1>=r.length){var h=rM(a,f);a=(l=!!h)&&"get"in h&&!("originalValue"in h.get)?h.get:a[f]}else l=yM(a,f),a=a[f];l&&!u&&(lM[i]=a)}}return a};function CM(){if(dM)return pM;dM=1;var e=SM("%Object.defineProperty%",!0)||!1;if(e)try{e({},"a",{value:1})}catch(t){e=!1}return pM=e}var xM=SM("%Object.getOwnPropertyDescriptor%",!0);if(xM)try{xM([],"length")}catch(e){xM=null}var FM=xM,PM=CM(),AM=IB,BM=LB,MM=FM,TM=CM(),kM=function(){return!!TM};kM.hasArrayLengthDefineBug=function(){if(!TM)return null;try{return 1!==TM([],"length",{value:1}).length}catch(e){return!0}};var RM=SM,IM=function(e,t,r){if(!e||"object"!=typeof e&&"function"!=typeof e)throw new BM("`obj` must be an object or a function`");if("string"!=typeof t&&"symbol"!=typeof t)throw new BM("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new BM("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new BM("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new BM("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new BM("`loose`, if provided, must be a boolean");var n=arguments.length>3?arguments[3]:null,o=arguments.length>4?arguments[4]:null,i=arguments.length>5?arguments[5]:null,a=arguments.length>6&&arguments[6],u=!!MM&&MM(e,t);if(PM)PM(e,t,{configurable:null===i&&u?u.configurable:!i,enumerable:null===n&&u?u.enumerable:!n,value:r,writable:null===o&&u?u.writable:!o});else{if(!a&&(n||o||i))throw new AM("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");e[t]=r}},LM=kM(),NM=FM,UM=LB,GM=RM("%Math.floor%"),WM=function(e,t){if("function"!=typeof e)throw new UM("`fn` is not a function");if("number"!=typeof t||t<0||t>4294967295||GM(t)!==t)throw new UM("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],n=!0,o=!0;if("length"in e&&NM){var i=NM(e,"length");i&&!i.configurable&&(n=!1),i&&!i.writable&&(o=!1)}return(n||o||!r)&&(LM?IM(e,"length",t,!0,!0):IM(e,"length",t)),e};!function(e){var t=BB,r=SM,n=WM,o=LB,i=r("%Function.prototype.apply%"),a=r("%Function.prototype.call%"),u=r("%Reflect.apply%",!0)||t.call(a,i),s=CM(),c=r("%Math.max%");e.exports=function(e){if("function"!=typeof e)throw new o("a function is required");var r=u(t,a,arguments);return n(r,1+c(0,e.length-(arguments.length-1)),!0)};var l=function(){return u(t,i,arguments)};s?s(e.exports,"apply",{value:l}):e.exports.apply=l}(CB);var qM=CB.exports,VM=i.Stream,zM=qM;function $M(e,t,r){var n=zM(e||function(e){this.queue(e)}),o=zM(t||function(){this.queue(null)}),i=!1,a=!1,u=[],s=!1,c=new VM;function l(){for(;u.length&&!c.paused;){var e=u.shift();if(null===e)return c.emit("end");c.emit("data",e)}}return c.readable=!0,c.writable=!0,c.paused=!1,c.autoDestroy=!(r&&!1===r.autoDestroy),c.write=function(e){return n(this,e),!c.paused},c.queue=function(e){return s||(null===e&&(s=!0),u.push(e),l()),c},c.push=c.queue,c.on("end",(function(){c.readable=!1,!c.writable&&c.autoDestroy&&process.nextTick((function(){c.destroy()}))})),c.end=function(e){if(!i)return i=!0,arguments.length&&c.write(e),c.writable=!1,o(c),!c.readable&&c.autoDestroy&&c.destroy(),c},c.destroy=function(){if(!a)return a=!0,i=!0,u.length=0,c.writable=!1,c.readable=!1,c.emit("close"),c},c.pause=function(){if(!c.paused)return c.paused=!0,c},c.resume=function(){return c.paused&&(c.paused=!1,c.emit("resume")),l(),c.paused||c.emit("drain"),c},c}var KM=$M;$M.through=$M;var YM=h.getDefaultExportFromCjs(KM);const HM=i;var JM=class extends HM{#e=null;constructor(e={}){super(e),this.writable=this.readable=!0,this.muted=!1,this.on("pipe",this._onpipe),this.replace=e.replace,this._prompt=e.prompt||null,this._hadControl=!1}#t(e,t){return this._dest?this._dest[e]:this._src?this._src[e]:t}#r(e,...t){"function"==typeof this._dest?.[e]&&this._dest[e](...t),"function"==typeof this._src?.[e]&&this._src[e](...t)}get isTTY(){return null!==this.#e?this.#e:this.#t("isTTY",!1)}set isTTY(e){this.#e=e}get rows(){return this.#t("rows")}get columns(){return this.#t("columns")}mute(){this.muted=!0}unmute(){this.muted=!1}_onpipe(e){this._src=e}pipe(e,t){return this._dest=e,super.pipe(e,t)}pause(){if(this._src)return this._src.pause()}resume(){if(this._src)return this._src.resume()}write(e){if(this.muted){if(!this.replace)return!0;if(e.match(/^\u001b/))return 0===e.indexOf(this._prompt)&&(e=(e=e.slice(this._prompt.length)).replace(/./g,this.replace),e=this._prompt+e),this._hadControl=!0,this.emit("data",e);this._prompt&&this._hadControl&&0===e.indexOf(this._prompt)&&(this._hadControl=!1,this.emit("data",this._prompt),e=e.slice(this._prompt.length)),e=e.toString().replace(/./g,this.replace)}this.emit("data",e)}end(e){this.muted&&(e=e&&this.replace?e.toString().replace(/./g,this.replace):null),e&&this.emit("data",e),this.emit("end")}destroy(...e){return this.#r("destroy",...e)}destroySoon(...e){return this.#r("destroySoon",...e)}close(...e){return this.#r("close",...e)}},QM=h.getDefaultExportFromCjs(JM);class XM{constructor(e){this.rl||=m.createInterface(function(e={}){e.skipTTYChecks=void 0===e.skipTTYChecks||e.skipTTYChecks;const t=e.input||process.stdin;if(!e.skipTTYChecks&&!t.isTTY){const e=new Error("Prompts can not be meaningfully rendered in non-TTY environments");throw e.isTtyError=!0,e}const r=new QM;r.pipe(e.output||process.stdout);const n=r;return{terminal:!0,...e,input:t,output:n}}(e)),this.rl.resume(),this.onForceClose=this.onForceClose.bind(this),process.on("exit",this.onForceClose),this.rl.on("SIGINT",this.onForceClose)}onForceClose(){this.close(),process.kill(process.pid,"SIGINT"),console.log("")}close(){this.rl.removeListener("SIGINT",this.onForceClose),process.removeListener("exit",this.onForceClose),this.rl.output.unmute(),this.activePrompt&&"function"==typeof this.activePrompt.close&&this.activePrompt.close(),this.rl.output.end(),this.rl.pause(),this.rl.close()}}var ZM=Dy,eT=j_,tT=vm,rT=Function.prototype,nT=Object.prototype,oT=rT.toString,iT=nT.hasOwnProperty,aT=oT.call(Object);var uT=function(e){if(!tT(e)||"[object Object]"!=ZM(e))return!1;var t=eT(e);if(null===t)return!0;var r=iT.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&oT.call(r)==aT},sT=VD,cT=rj,lT=cm,fT=_y,pT=oj;var dT=function(e,t,r,n){if(!fT(e))return e;for(var o=-1,i=(t=cT(t,e)).length,a=i-1,u=e;null!=u&&++o<i;){var s=pT(t[o]),c=r;if("__proto__"===s||"constructor"===s||"prototype"===s)return e;if(o!=a){var l=u[s];void 0===(c=n?n(l,s,u):void 0)&&(c=fT(l)?l:lT(t[o+1])?[]:{})}sT(u,s,c),u=u[s]}return e},hT=dT;var bT=function(e,t,r){return null==e?e:hT(e,t,r)};const vT=function(e,t,r){return"function"!=typeof e[t]?Te.of(e):Te.from(Me(e[t])(r).then((r=>(e[t]=r,e))))},yT={isPlainObject:h.getDefaultExportFromCjs(uT),set:h.getDefaultExportFromCjs(bT),get:lj};class mT extends XM{constructor(e,t){super(t),this.prompts=e}run(e,t){yT.isPlainObject(t)?this.answers={...t}:this.answers={},yT.isPlainObject(e)&&(e=Object.values(e).every((e=>yT.isPlainObject(e)&&void 0===e.name))?Object.entries(e).map((([e,t])=>({name:e,...t}))):[e]);const r=Array.isArray(e)?Te.from(e):e;return this.process=r.pipe(Te.concatMap(this.processQuestion.bind(this)),Te.publish()),this.process.connect(),this.process.pipe(Te.reduce(((e,t)=>(yT.set(e,t.name,t.answer),e)),this.answers)).toPromise(Promise).then(this.onCompletion.bind(this),this.onError.bind(this))}onCompletion(){return this.close(),this.answers}onError(e){return this.close(),Promise.reject(e)}processQuestion(e){return e={...e},Te.defer((()=>Te.of(e).pipe(Te.concatMap(this.setDefaultType.bind(this)),Te.concatMap(this.filterIfRunnable.bind(this)),Te.concatMap((()=>vT(e,"message",this.answers))),Te.concatMap((()=>vT(e,"default",this.answers))),Te.concatMap((()=>vT(e,"choices",this.answers))),Te.concatMap(this.fetchAnswer.bind(this)))))}fetchAnswer(e){const t=this.prompts[e.type];return this.activePrompt=new t(e,this.rl,this.answers),Te.defer((()=>Te.from(this.activePrompt.run().then((t=>({name:e.name,answer:t}))))))}setDefaultType(e){return this.prompts[e.type]||(e.type="input"),Te.defer((()=>Te.of(e)))}filterIfRunnable(e){if(!0!==e.askAnswered&&void 0!==yT.get(this.answers,e.name))return Te.empty();if(!1===e.when)return Te.empty();if("function"!=typeof e.when)return Te.of(e);const{answers:t}=this;return Te.defer((()=>Te.from(Me(e.when)(t).then((t=>{if(t)return e}))).pipe(Te.filter((e=>null!=e)))))}}function gT(e){const t=function(r,n){let o;try{o=new mT(t.prompts,e)}catch(e){return Promise.reject(e)}const i=o.run(r,n);return i.ui=o,i};return t.prompts={},t.registerPrompt=function(e,r){return t.prompts[e]=r,this},t.restoreDefaultPrompts=function(){this.registerPrompt("list",oP),this.registerPrompt("input",iP),this.registerPrompt("number",aP),this.registerPrompt("confirm",uP),this.registerPrompt("rawlist",sP),this.registerPrompt("expand",cP),this.registerPrompt("checkbox",lP),this.registerPrompt("password",pP),this.registerPrompt("editor",jB)},t.restoreDefaultPrompts(),t}const DT=gT();const _T={prompt:DT,ui:{BottomBar:class extends XM{constructor(e={}){super(e),this.log=YM(this.writeLog.bind(this)),this.bottomBar=e.bottomBar||"",this.render()}render(){return this.write(this.bottomBar),this}clean(){return XF(this.rl,this.bottomBar.split("\n").length),this}updateBottomBar(e){return XF(this.rl,1),this.rl.output.unmute(),this.clean(),this.bottomBar=e,this.render(),this.rl.output.mute(),this}writeLog(e){return this.rl.output.unmute(),this.clean(),this.rl.output.write(this.enforceLF(e.toString())),this.render(),this.rl.output.mute(),this}enforceLF(e){return e.match(/[\r\n]$/)?e:e+"\n"}write(e){const t=e.split(/\n/);this.height=t.length,this.rl.setPrompt(t[t.length-1]),0===this.rl.output.rows&&0===this.rl.output.columns&&JF(this.rl,e.length+this.rl.line.length),this.rl.output.write(e)}},Prompt:mT},createPromptModule:gT,registerPrompt:function(e,t){DT.registerPrompt(e,t)},restoreDefaultPrompts:function(){DT.restoreDefaultPrompts()},Separator:iS};var wT="0.2.14";const OT=process.cwd();exports.createModule=async()=>{const e=await g.loadJSON(y.resolve(OT,"package.json")),t=await _T.prompt([{type:"list",name:"type",message:"请选择一个选项:",default:"react",choices:["vue","react"]},{type:"input",message:"workspaces name",name:"workspaces",validate:function(e){return!(e&&!v.existsSync(y.resolve(OT,e)))||"工作空间不存在"}},{type:"input",message:"package name",name:"name",validate:function(e){return!!e.replace(/\s/g,"")||"姓名不能为空,请重新输入"}},{type:"input",message:"version",name:"version",default:e.version}]),r="vue"===t.type,n=v.readFileSync(y.resolve(__dirname,r?"../../template/template.vue.package.json":"../../template/template.package.json"),"utf-8"),o=h.ejs.compile(n),i=y.resolve(OT,t.workspaces,t.name);v.existsSync(y.resolve(i))||v.mkdirSync(i),s.exec(`cd ${i}`,((e,n,a)=>{e?console.error(`错误: ${e.message}`):a?console.error(`错误: ${a}`):(h.createCwdConfig(i,t.name,r),v.mkdirSync(y.resolve(i,"public")),v.mkdirSync(y.resolve(i,"src")),v.writeFileSync(y.resolve(i,"package.json"),o({...t,coreVersion:`^${wT}`})),v.writeFileSync(y.resolve(i,"tsconfig.json"),'{\n "extends": ["./src/.gant/tsconfig.json"]\n }'),v.writeFileSync(y.resolve(i,"tsconfig.json"),'{\n "extends": ["./src/.gant/tsconfig.json"]\n }'))}))},exports.stringWidthExports=FS;
@@ -1,2 +1,2 @@
1
- import{r as e}from"../request/index.js";import{groupBy as t,reduce as s,find as i,keyBy as n,pick as a,get as r,uniqueId as o,omit as c,isEmpty as h,findIndex as u,isPlainObject as d,cloneDeep as g,mapValues as m,uniqBy as l}from"lodash-es";import{e as p}from"../event/index.js";const y=new class{codeLists=[];codeMaps={};async findAllCodeList(){const s=await e("/codeList/findAll",{data:{},serviceId:"fwPlatform"})||[],i=t(s,"type");this.codeLists=s,this.codeMaps=i}getCodeLocaleList=e=>[...this.codeMaps?.[e]]||[];getCodeLocaleName=(e,t)=>{const n=this.getCodeLocaleList(e);function a(e){const t=i(n,(t=>t.value===String(e)));return t?.name||""}if(Array.isArray(t)){const e=s(t,((e="",t="")=>e+","+a(t)),"");return e.slice(1,e.length)}if(String(t).indexOf(",")>=0){const e=t.replace("[","").replace("]","").split(","),i=s(e,((e="",t="")=>e+","+a(t)),"");return i.slice(1,i.length)}return a(t)}};y.getCodeLocaleList,y.getCodeLocaleName;const w=new class{parameterList=[];parameterMap={};findAllParameters=async()=>{const t=await e("/parameter/findAll",{serviceId:"fwPlatform",data:{}},{showError:!1})||[],s=n(t,"name");this.parameterList=t,this.parameterMap=s};getSystemParameterByName=e=>"string"==typeof e?this.parameterMap[e]:a(this.parameterMap,e)},S="ping",f="pong",I="WS_CONTENT_SUCCESS",L="WS_CONTENT_ERROR",P="WS_CONTENT_CLOSE";const T=new class{RECIPIENT_TYPE_ALL="all";RECIPIENT_TYPE_USER="user";RECIPIENT_TYPE_OBSERVER="obsvr";RECIPIENT_TYPE_CONNECTION="conn";webSocketUrl="";ws=null;repeat=0;connectLoading=!1;disReconnect=!1;pingTimeoutFn=null;pongTimeoutFn=null;reconnectFn=null;repeatLimit=2;connectionId="";userLoginName="";eventStack={};constructor(){}init=(e,t)=>{this.userLoginName=e,this.webSocketUrl=(e=>{const t=`userLoginName=${e}`,{host:s,protocol:i,port:n,hostname:a}=window.location,r=i.includes("https");let o=r?"wss":"ws",c=s;!r&&n&&(c=`${a}:${parseInt(n)}`);return`${o}://${c}/notification-ws?${t}`})(e),this.disReconnect=r(t,"disReconnect",!1),this.repeatLimit=r(t,"repeatLimit",20),this.createWebSocket()};createWebSocket=()=>{this.connectLoading=!0;try{this.ws=new WebSocket(this.webSocketUrl),this.registerEvent()}catch(e){this.ws=null,this.reconnect()}finally{this.connectLoading=!1}};reconnect=()=>{this.reconnectFn&&clearTimeout(this.reconnectFn),this.repeatLimit&&this.repeatLimit<=this.repeat||this.connectLoading||this.disReconnect||this.ws||(this.repeat++,this.reconnectFn=setTimeout((()=>{this.createWebSocket()}),1e4))};heartCheck=()=>{this.repeat=0,this.disReconnect||(this.pingTimeoutFn=setTimeout((()=>{const e=`{"userLoginName":"${this.userLoginName}","connectionId":"${this.connectionId}","content":"${S}"}`;this.ws?.send(e),this.pongTimeoutFn=setTimeout((()=>{this.ws?.close()}),1e4)}),1e4))};heartReset=()=>{this.pingTimeoutFn&&(clearTimeout(this.pingTimeoutFn),this.pingTimeoutFn=null),this.pongTimeoutFn&&(clearTimeout(this.pongTimeoutFn),this.pongTimeoutFn=null)};disconnect=()=>{this.heartReset(),1==this.ws?.readyState&&this.ws?.close(),this.ws=null};registerEvent=()=>{this.ws&&(this.ws.onopen=()=>{this.heartCheck()},this.ws.onmessage=e=>{this.heartReset(),this.heartCheck();const t=e.data;try{if(t==f||JSON.parse(t).content==S||JSON.parse(t).content==f)return;const e=JSON.parse(t),s={...e,senderTime:e.senderTime};if(p.emit(I,s),Object.keys(this.eventStack).map((e=>{const t=this.eventStack[e],i=t.recipientType?.includes(s.recipientType);i&&t?.event?.(s)})),s.recipientType==this.RECIPIENT_TYPE_CONNECTION)return void(this.connectionId=s.recipientCode)}catch(e){console.warn("received error!!!",e)}},this.ws.onerror=()=>{this.heartReset(),this.reconnect(),p.emit(L)},this.ws.onclose=()=>{console.warn("webSocket close"),this.ws=null,this.heartReset(),this.reconnect(),p.emit(P)})};addTypeListener=(e,t)=>{const s=Array.isArray(e)?e:[e],i=o();return this.eventStack[i]={recipientType:s,type:"recipientType",event:t},i};removeListener=e=>{this.eventStack=c(this.eventStack,e)}},{RECIPIENT_TYPE_OBSERVER:C}=T,v="PROGRESS_UPDEDATE";const k=new class{websocketId;progressObserver={};constructor(){this.websocketId=T.addTypeListener(C,this.progressEvent)}progressEvent(e){Object.keys(this.progressObserver).map((t=>{const s=this.progressObserver[t];e?.recipientCode===s.type&&(this.progressObserver[t]={...s,data:e})})),this.updedataProgress()}updedataProgress(){const e=[];Object.keys(this.progressObserver).map((t=>{const s=this.progressObserver[t];h(s?.data)||e.push(s)})),p.emit(v,e)}addProgressListener(e,t){const s=o();return this.progressObserver[s]={type:e,options:t},s}removeProgressListener(e){this.progressObserver=c(this.progressObserver,e),this.updedataProgress()}async requestProgress(t,s){if(!T.connectionId&&!s?.headers?.connectionId)return console.error("WebSocket no link established");const i=(new Date).getDate()+"",n=this.addProgressListener(i);try{const n=await e.post(t,{headers:{observerId:i,connectionId:T.connectionId,...s?.headers},data:s?.params},{getParams:s?.getParams});s?.success?.(n)}catch(e){console.error("---\x3e",e),s?.error?.(e)}this.removeProgressListener(n)}};const U=(({prefixKey:e="",storage:t=localStorage}={})=>new class{storage=t;prefixKey=e;getKey(e){return`${this.prefixKey}${e}`.toUpperCase()}set(e,t,s=604800){const i=JSON.stringify({value:t,expire:null!==s?(new Date).getTime()+1e3*s:null});this.storage.setItem(this.getKey(e),i)}get(e,t=null){const s=this.storage.getItem(this.getKey(e));if(s)try{const t=JSON.parse(s),{value:i,expire:n}=t;if(null===n||n>=Date.now())return i;this.remove(e)}catch(e){return console.error(e),t}return t}remove(e){this.storage.removeItem(this.getKey(e))}clear(){this.storage.clear()}setCookie(e,t,s=604800){document.cookie=`${this.getKey(e)}=${t}; Max-Age=${s}`}getCookie(e){const t=document.cookie.split("; ");for(let s=0,i=t.length;s<i;s++){const i=t[s].split("=");if(i[0]===this.getKey(e))return i[1]}return""}removeCookie(e){this.setCookie(e,1,-1)}clearCookie(){const e=document.cookie.match(/[^ =;]+(?==)/g);if(e)for(let t=e.length;t--;)document.cookie=e[t]+"=0;expire="+new Date(0).toUTCString()}})();class b{userIdentity={};currentUser={};isSuperAdmin=!1;roles=[];functions=[];delegations=[];userSetting={};users=[];getUserIdentity(){if(!h(this.userIdentity))return this.userIdentity;const e=U?.get("userIdentity");return e||{}}setUserIdentity(e){return this.userIdentity={...this.userIdentity,...e},U.set("userIdentity",this.userIdentity),this.userIdentity}clearUserIdentity(){U.remove("userIdentity"),this.userIdentity={}}setUserAggregateInfo=({delegations:e,roles:t,functions:s,isSuperAdmin:i,currentUser:n})=>{this.delegations=e,this.roles=t,this.functions=s,this.isSuperAdmin=i,this.currentUser=n};getUserSettingType=e=>`${this.currentUser.id}-${e}`;getUserSetting=async t=>{const s=this.getUserSettingType(t),i=this.currentUser.id;if(this.userSetting[s])return this.userSetting[s];const n=await async function(t){return e("/accountUserSelf/getUserData",{data:t,serviceId:"fwSecurity"})}({dataType:t,dataId:i+t}),a=n?.bigData?JSON.parse(n.bigData):void 0;return this.userSetting[s]=a,a};updateUserSetting=async(t,s)=>{const i=this.getUserSettingType(t),n=this.currentUser.id;return await async function(t,s){return e("/accountUserSelf/setUserData",{data:t,serviceId:"fwSecurity"},s)}({dataType:t,dataId:n+t,bigData:JSON.stringify(s)}),this.userSetting[i]=s,s};removeUserSetting=async t=>{const s=this.getUserSettingType(t),i=this.currentUser.id;await async function(t,s){return e("/accountUserSelf/delUserData",{data:t,serviceId:"fwSecurity"},s)}({dataType:t,dataId:i}),delete this.userSetting[s]};getUserInfo=async(t,s)=>{const i=u(this.users,(e=>s?e.userLoginName===t:e.id===t));if(i>-1)return r(this.users,`[${i}]`);const n=s?await async function(t){return e("/security/getUserByUserLoginName",{method:"POST",data:{userLoginName:t},serviceId:"fwSecurity"})}(t):await async function(t){return e("/security/getUserById",{method:"POST",data:{id:t},serviceId:"fwSecurity"})}(t);return d(n)&&this.users.push(n),n}}const E=/^https?:\/\/(([a-zA-Z0-9_-])+(\.)?)*(:\d+)?(\/((\.)?(\?)?=?&?[a-zA-Z0-9_-](\?)?)*)*$/i,O=/^https?:\/\/(([a-zA-Z0-9_-])+(\.)?)*(:\d+)?(\/((\.)?(\?)?=?&?[a-zA-Z0-9_-](\?)?)*)*$/i,N=e=>E.test(e)||O.test(e)||0===e?.indexOf("/")?e:"/"+e,D="MENU_HISTORY_UPDATE",R="MENU_BREADCRUMBS_UPDATE";class A{menuDataMaps={};menuData=[];menuPathMaps={};breadcrumbs=[];menuHistorys=[];userId;constructor(){}addListenerMenuHistorys=e=>{p.on(D,e)};removeListenerMenuHistorys=e=>p.off(D,e);addListenerBreadcrumbs=e=>p.on(R,e);removeListenerBreadcrumbs=e=>p.off(R,e);getTreeMenuData=(e,t,s)=>e.map((e=>{const{id:i,path:n,leaf:a}=e,r=t[i],o={...e,key:i,path:s?s+N(n):N(n)};if(r&&!a){const e=this.getTreeMenuData(r,t,o.path);o.children=e}return this.menuDataMaps[o.path]=o,o})).sort(((e,t)=>e.seqNum-t.seqNum));init=(e,s)=>{const i=g(e);if(h(i))return;const n=t(i,"parentResourceId"),{ROOT:a,...r}=n;this.menuData=this.getTreeMenuData(a,r),this.menuData=[...this.menuData];const o=m(this.menuDataMaps,"name");this.updateMenuMaps(o),this.initMenuHistorys(s)};updateMenuMaps=e=>{this.menuPathMaps={...this.menuPathMaps,...e};const t=this.menuHistorys.map((e=>{const t=this.menuPathMaps[e.pathname];return{pathname:e.pathname,name:t||e.name}})),s=this.breadcrumbs.map((e=>{const t=this.menuPathMaps[e.pathname];return{...e,name:t||e.name}}));this.updatehistorys(t),this.updateBreadcrumbs(s)};liseterHistorys=e=>{let t=this.menuHistorys;this.menuDataMaps[e]?.leaf&&!t.some((t=>t.pathname===e))&&(t=[{pathname:e,name:this.menuPathMaps[e]},...t],this.updatehistorys(t))};updatehistorys=e=>{if(!this.userId)return;const t=e.map((e=>({...e,name:e.name?e.name:this.menuPathMaps[e.pathname]})));this.menuHistorys=t,this.menuHistorys=l(this.menuHistorys,"pathname"),p.emit(D,this.menuHistorys),U.set(`${this.userId}-menu-history`,this.menuHistorys)};initMenuHistorys=e=>{this.userId=e;const t=U.get(`${e}-menu-history`,this.menuHistorys);this.updatehistorys(t)};liseterBreadcrumbs=e=>{const t=e.split("/");let s=1;const i=[],n={pathname:e,name:this.menuPathMaps[e]};for(;s<t.length;){const e=t.slice(0,s).join("/");this.menuPathMaps[e]&&i.push({name:this.menuPathMaps[e],pathname:e}),s++}i.push(n),this.updateBreadcrumbs(i)};updateBreadcrumbs=e=>{this.breadcrumbs=e,this.breadcrumbs=l(this.breadcrumbs,"pathname"),p.emit(R,e)}}class M{loginPathname;BASE="/";get baseLoginPathname(){return`${this.BASE}${this.loginPathname?.replace("/","")}`}tokenValue="";get isLoginPathname(){const e=window.location.pathname;return this.baseLoginPathname==e}getRealPath=e=>`${this.BASE}${e.replace("/","")}`;chekToken=async()=>{const t=await e("/authentication/checkToken",{serviceId:"fwSecurity"},{showError:!1});return t&&this.isLoginPathname&&window.location.replace(this.BASE),t};getLoginMethod=async()=>e("/authentication/getLoginMethod",{serviceId:"fwSecurity"});redirectBaseLogin=async()=>{const e=window.location.pathname,t=window.location.href;if(this.isLoginPathname)return!0;const s=new URLSearchParams;e!==this.BASE&&"/"!==e&&s.append("redirectUrl",t);const i=decodeURIComponent(s.toString());return window.location.replace(`${this.baseLoginPathname}${i?"?"+decodeURIComponent(s.toString()):""}`),!1};checkPassword=async()=>"noPass"!==await e("/security/checkPasswordUpdateTime",{data:{}},{showError:!1})||(this.tokenValue=await e("/authentication/extractToken",{data:{}}),!1);refactorToken=async()=>{var t;await(t=this.tokenValue,e("/authentication/refactorToken",{data:{value:t}}))};login=async e=>{const t=await this.baseLogin(e);return t.error,t};baseLogin=async t=>{const s={error:void 0,data:void 0};try{const i=await function(t){return e("/authentication/login",{data:t,serviceId:"fwSecurity"})}(t),{userToken:n,traceId:a}=i;if(n){s.data=i;return await this.checkPassword()||(s.error="passwordExpiration"),s}return a?(s.data=i,s.error="SLIDER_VERIFICATION_LOGIN",s):(s.error="passwordError",s)}catch(e){return s.error="validateError",s}};loginSuccess=()=>{let e=new URLSearchParams(window.location.search).get("redirectUrl");e?window.location.href=e:window.location.replace(this.BASE)};baseLoginOut=async()=>{const t=new URLSearchParams,s=window.location.href;window.location.pathname!==this.BASE&&t.append("redirectUrl",s),await e("/authentication/logout",{data:{},serviceId:"fwSecurity"}),window.location.replace(`${this.baseLoginPathname}?${t.toString()}`)}}const $={sso:!1,ssoUrlSearchParams:["ticket"],ssoCheckTokenUrl:"",ssoSuccessUrlkey:"successUrl",ssoLoginUrl:window.location.origin+"/fwSecurity/ssoAuth/login.api",ssologinOutUrl:window.location.origin+"fwSecurity/ssoAuth/logout.api"};class _{init(e){this.ssoConfig={...this.ssoConfig,...e}}ssoConfig=$;isSso=async t=>{if(!this.ssoConfig.sso)return!1;let s=!1;try{s=await e("/ssoAuthConfig/checkOnlyRedirect",{},{showError:!1})}catch(e){console.error("sso",e)}return t&&(s=await t()),!!s};ssoLogin=()=>{const{ssoSuccessUrlkey:e,ssoUrlSearchParams:t,ssoLoginUrl:s}=this.ssoConfig,i=new URLSearchParams(window.location.search.slice(1)),n=new URLSearchParams,a=window.location.href;return n.append(e,encodeURIComponent(a)),t.map((e=>{const t=i.get(e);t&&n.append(e,t)})),window.location.href=`${s}?${n.toString()}`,!1};ssoLoginOut=()=>{window.location.href=this.ssoConfig.ssologinOutUrl}}class B{getValidateCodeImage=t=>function(t={}){return e("/authentication/getValidateCode",{data:t,serviceId:"fwSecurity"})}(t);sliderVerificationCodeImage=()=>e("/authentication/sliderVerificationCode",{method:"POST",serviceId:"fwSecurity"});checkCaptcha=t=>{return s=t,e("/authentication/checkCaptcha",{method:"POST",data:{...s},serviceId:"fwSecurity"});var s}}class x extends M{ssoLogin;validate;noCheckPermissionsPath=[];ssoCallback;constructor(){super(),this.ssoLogin=new _,this.validate=new B}init=(e,t="/",s)=>{this.BASE=t,this.ssoCallback=s,this.noCheckPermissionsPath=e?.noCheckPermissionsPath,this.ssoLogin.init(e),this.loginPathname=e?.loginPathname||"/login"};isNoLoginRequiredPage=()=>{const e=window.location.pathname,t=this.noCheckPermissionsPath?.some((t=>this.getRealPath(t)==e));return t};loginOut=async()=>{await this.ssoLogin.isSso(this.ssoCallback)&&this.ssoLogin.ssoLoginOut(),await this.baseLoginOut()};loginAuthentication=async t=>{var s;await(s=t,e("/authentication/beforeLoginCheckCode",{method:"POST",data:{...s},serviceId:"fwSecurity"})),this.loginSuccess()};redirectLogin=async()=>{if(this.isNoLoginRequiredPage())return!0;return await this.ssoLogin.isSso(this.ssoCallback)?(this.ssoLogin.ssoLogin(),!1):!!this.isLoginPathname||await this.redirectBaseLogin()}}const F=new class{userStore;menuStore;loginStore;isSuperAdmin=!1;loginCallback;constructor(){this.userStore=new b,this.menuStore=new A,this.loginStore=new x}platformLanguages=[];productInfo={isProdEnv:!1,productName:""};get isPrd(){return this.productInfo?.isProdEnv}get userInfo(){return this.userStore.currentUser}get menuData(){return this.menuStore.menuData}findPlantform=async()=>{const t=await e("/platformManage/getPlatformAggregateInfo",{method:"POST"},{showError:!1});this.platformLanguages=t.platformLanguages,this.productInfo=t.productInfo};getAggregateInfo=async t=>{const s=await async function(){return e("/security/findUserAggregateInfo",{method:"POST"})}(),{user:i,startMenus:n,isSuperAdmin:a,...r}=s;this.userStore.setUserAggregateInfo({...r,currentUser:i}),this.isSuperAdmin=a;const o="function"==typeof t?await t(s):t;this.menuStore.init(h(o)?n:o,i.id)};init=async e=>{const{base:t="/",menuData:s,loginSuccessCallback:i,ssoCallback:n,websocket:a=!0}=e;this.loginStore.init(e?.loginConfig,t,n);try{const e=await this.loginStore.chekToken();return e?(this.userStore.setUserIdentity(e),await this.getAggregateInfo(s),await y.findAllCodeList(),await w.findAllParameters(),a&&T.init(this.userStore.currentUser.userLoginName),await(i?.()),!0):await this.loginStore.redirectLogin()}catch(e){console.error(e)}return!1}};const H="company-v1";var V=new class{data={};getCompanyDataType=e=>`${H}-${e}`;getCompanyData=async t=>{const s=this.getCompanyDataType(t);if(this.data[s])return this.data[s];const i=await async function(t){return e("/companyData/getCompanyData",{data:t,serviceId:"fwSecurity"})}({dataType:t,dataId:H}),n=i?.bigData?JSON.parse(i.bigData):void 0;this.data[s]=n};updateCompanyData=async(t,s)=>{const i=this.getCompanyDataType(t);return await async function(t){return e("/companyData/setCompanyData",{data:t,serviceId:"fwSecurity"})}({dataType:t,dataId:H,bigData:JSON.stringify(s)}),this.data[i]=s,s};removeCompanyData=async t=>{const s=this.getCompanyDataType(t);await async function(t){return e("/companyData/delCompanyData",{data:t,serviceId:"fwSecurity"})}({dataType:t,dataId:H}),delete this.data[s]}};const J=y,K=w,W=F.userStore,Y=F.loginStore,j=F.menuStore;export{D as M,k as P,P as W,R as a,v as b,J as c,L as d,I as e,F as g,V as i,Y as l,j as m,K as p,U as s,W as u,T as w};
1
+ import{r as e}from"../request/index.js";import{groupBy as t,reduce as s,find as i,keyBy as n,pick as a,get as r,uniqueId as o,omit as c,isEmpty as h,findIndex as u,isPlainObject as d,cloneDeep as g,mapValues as m,uniqBy as p}from"lodash-es";import{e as l}from"../event/index.js";const y=new class{codeLists=[];codeMaps={};async findAllCodeList(){const s=await e("/codeList/findAll",{data:{},serviceId:"fwPlatform"})||[],i=t(s,"type");this.codeLists=s,this.codeMaps=i}getCodeLocaleList=e=>[...this.codeMaps?.[e]]||[];getCodeLocaleName=(e,t)=>{const n=this.getCodeLocaleList(e);function a(e){const t=i(n,(t=>t.value===String(e)));return t?.name||""}if(Array.isArray(t)){const e=s(t,((e="",t="")=>e+","+a(t)),"");return e.slice(1,e.length)}if(String(t).indexOf(",")>=0){const e=t.replace("[","").replace("]","").split(","),i=s(e,((e="",t="")=>e+","+a(t)),"");return i.slice(1,i.length)}return a(t)}};y.getCodeLocaleList,y.getCodeLocaleName;const w=new class{parameterList=[];parameterMap={};findAllParameters=async()=>{const t=await e("/parameter/findAll",{serviceId:"fwPlatform",data:{}},{showError:!1})||[],s=n(t,"name");this.parameterList=t,this.parameterMap=s};getSystemParameterByName=e=>"string"==typeof e?this.parameterMap[e]:a(this.parameterMap,e)},S="ping",f="pong",I="WS_CONTENT_SUCCESS",L="WS_CONTENT_ERROR",P="WS_CONTENT_CLOSE";const T=new class{RECIPIENT_TYPE_ALL="all";RECIPIENT_TYPE_USER="user";RECIPIENT_TYPE_OBSERVER="obsvr";RECIPIENT_TYPE_CONNECTION="conn";webSocketUrl="";ws=null;repeat=0;connectLoading=!1;disReconnect=!1;pingTimeoutFn=null;pongTimeoutFn=null;reconnectFn=null;repeatLimit=2;connectionId="";userLoginName="";eventStack={};constructor(){}init=(e,t)=>{this.userLoginName=e,this.webSocketUrl=(e=>{const t=`userLoginName=${e}`,{host:s,protocol:i,port:n,hostname:a}=window.location,r=i.includes("https");let o=r?"wss":"ws",c=s;!r&&n&&(c=`${a}:${parseInt(n)}`);return`${o}://${c}/notification-ws?${t}`})(e),this.disReconnect=r(t,"disReconnect",!1),this.repeatLimit=r(t,"repeatLimit",20),this.createWebSocket()};createWebSocket=()=>{this.connectLoading=!0;try{this.ws=new WebSocket(this.webSocketUrl),this.registerEvent()}catch(e){this.ws=null,this.reconnect()}finally{this.connectLoading=!1}};reconnect=()=>{this.reconnectFn&&clearTimeout(this.reconnectFn),this.repeatLimit&&this.repeatLimit<=this.repeat||this.connectLoading||this.disReconnect||this.ws||(this.repeat++,this.reconnectFn=setTimeout((()=>{this.createWebSocket()}),1e4))};heartCheck=()=>{this.repeat=0,this.disReconnect||(this.pingTimeoutFn=setTimeout((()=>{const e=`{"userLoginName":"${this.userLoginName}","connectionId":"${this.connectionId}","content":"${S}"}`;this.ws?.send(e),this.pongTimeoutFn=setTimeout((()=>{this.ws?.close()}),1e4)}),1e4))};heartReset=()=>{this.pingTimeoutFn&&(clearTimeout(this.pingTimeoutFn),this.pingTimeoutFn=null),this.pongTimeoutFn&&(clearTimeout(this.pongTimeoutFn),this.pongTimeoutFn=null)};disconnect=()=>{this.heartReset(),1==this.ws?.readyState&&this.ws?.close(),this.ws=null};registerEvent=()=>{this.ws&&(this.ws.onopen=()=>{this.heartCheck()},this.ws.onmessage=e=>{this.heartReset(),this.heartCheck();const t=e.data;try{if(t==f||JSON.parse(t).content==S||JSON.parse(t).content==f)return;const e=JSON.parse(t),s={...e,senderTime:e.senderTime};if(l.emit(I,s),Object.keys(this.eventStack).map((e=>{const t=this.eventStack[e],i=t.recipientType?.includes(s.recipientType);i&&t?.event?.(s)})),s.recipientType==this.RECIPIENT_TYPE_CONNECTION)return void(this.connectionId=s.recipientCode)}catch(e){console.warn("received error!!!",e)}},this.ws.onerror=()=>{this.heartReset(),this.reconnect(),l.emit(L)},this.ws.onclose=()=>{console.warn("webSocket close"),this.ws=null,this.heartReset(),this.reconnect(),l.emit(P)})};addTypeListener=(e,t)=>{const s=Array.isArray(e)?e:[e],i=o();return this.eventStack[i]={recipientType:s,type:"recipientType",event:t},i};removeListener=e=>{this.eventStack=c(this.eventStack,e)}},{RECIPIENT_TYPE_OBSERVER:C}=T,v="PROGRESS_UPDEDATE";const k=new class{websocketId;progressObserver={};constructor(){this.websocketId=T.addTypeListener(C,this.progressEvent)}progressEvent(e){Object.keys(this.progressObserver).map((t=>{const s=this.progressObserver[t];e?.recipientCode===s.type&&(this.progressObserver[t]={...s,data:e})})),this.updedataProgress()}updedataProgress(){const e=[];Object.keys(this.progressObserver).map((t=>{const s=this.progressObserver[t];h(s?.data)||e.push({...s})})),l.emit(v,e)}addProgressListener(e,t){const s=o();return this.progressObserver[s]={type:e,options:t},s}removeProgressListener(e){this.progressObserver=c(this.progressObserver,e),this.updedataProgress()}async requestProgress(t,s){if(!T.connectionId&&!s?.headers?.connectionId)return console.error("WebSocket no link established");const i=(new Date).getDate()+"",n=this.addProgressListener(i);l.on(v,(e=>{const t=e.find((e=>e.type===i));t&&s?.onProgress?.(t.data?.progress)}));try{const n=await e.post(t,{headers:{observerId:i,connectionId:T.connectionId,...s?.headers},data:s?.params},{getParams:s?.getParams});s?.success?.(n)}catch(e){console.error("---\x3e",e),s?.error?.(e)}l.off(v,(e=>{})),this.removeProgressListener(n)}};const U=(({prefixKey:e="",storage:t=localStorage}={})=>new class{storage=t;prefixKey=e;getKey(e){return`${this.prefixKey}${e}`.toUpperCase()}set(e,t,s=604800){const i=JSON.stringify({value:t,expire:null!==s?(new Date).getTime()+1e3*s:null});this.storage.setItem(this.getKey(e),i)}get(e,t=null){const s=this.storage.getItem(this.getKey(e));if(s)try{const t=JSON.parse(s),{value:i,expire:n}=t;if(null===n||n>=Date.now())return i;this.remove(e)}catch(e){return console.error(e),t}return t}remove(e){this.storage.removeItem(this.getKey(e))}clear(){this.storage.clear()}setCookie(e,t,s=604800){document.cookie=`${this.getKey(e)}=${t}; Max-Age=${s}`}getCookie(e){const t=document.cookie.split("; ");for(let s=0,i=t.length;s<i;s++){const i=t[s].split("=");if(i[0]===this.getKey(e))return i[1]}return""}removeCookie(e){this.setCookie(e,1,-1)}clearCookie(){const e=document.cookie.match(/[^ =;]+(?==)/g);if(e)for(let t=e.length;t--;)document.cookie=e[t]+"=0;expire="+new Date(0).toUTCString()}})();class b{userIdentity={};currentUser={};isSuperAdmin=!1;roles=[];functions=[];delegations=[];userSetting={};users=[];getUserIdentity(){if(!h(this.userIdentity))return this.userIdentity;const e=U?.get("userIdentity");return e||{}}setUserIdentity(e){return this.userIdentity={...this.userIdentity,...e},U.set("userIdentity",this.userIdentity),this.userIdentity}clearUserIdentity(){U.remove("userIdentity"),this.userIdentity={}}setUserAggregateInfo=({delegations:e,roles:t,functions:s,isSuperAdmin:i,currentUser:n})=>{this.delegations=e,this.roles=t,this.functions=s,this.isSuperAdmin=i,this.currentUser=n};getUserSettingType=e=>`${this.currentUser.id}-${e}`;getUserSetting=async t=>{const s=this.getUserSettingType(t),i=this.currentUser.id;if(this.userSetting[s])return this.userSetting[s];const n=await async function(t){return e("/accountUserSelf/getUserData",{data:t,serviceId:"fwSecurity"})}({dataType:t,dataId:i+t}),a=n?.bigData?JSON.parse(n.bigData):void 0;return this.userSetting[s]=a,a};updateUserSetting=async(t,s)=>{const i=this.getUserSettingType(t),n=this.currentUser.id;return await async function(t,s){return e("/accountUserSelf/setUserData",{data:t,serviceId:"fwSecurity"},s)}({dataType:t,dataId:n+t,bigData:JSON.stringify(s)}),this.userSetting[i]=s,s};removeUserSetting=async t=>{const s=this.getUserSettingType(t),i=this.currentUser.id;await async function(t,s){return e("/accountUserSelf/delUserData",{data:t,serviceId:"fwSecurity"},s)}({dataType:t,dataId:i}),delete this.userSetting[s]};getUserInfo=async(t,s)=>{const i=u(this.users,(e=>s?e.userLoginName===t:e.id===t));if(i>-1)return r(this.users,`[${i}]`);const n=s?await async function(t){return e("/security/getUserByUserLoginName",{method:"POST",data:{userLoginName:t},serviceId:"fwSecurity"})}(t):await async function(t){return e("/security/getUserById",{method:"POST",data:{id:t},serviceId:"fwSecurity"})}(t);return d(n)&&this.users.push(n),n}}const E=/^https?:\/\/(([a-zA-Z0-9_-])+(\.)?)*(:\d+)?(\/((\.)?(\?)?=?&?[a-zA-Z0-9_-](\?)?)*)*$/i,O=/^https?:\/\/(([a-zA-Z0-9_-])+(\.)?)*(:\d+)?(\/((\.)?(\?)?=?&?[a-zA-Z0-9_-](\?)?)*)*$/i,N=e=>E.test(e)||O.test(e)||0===e?.indexOf("/")?e:"/"+e,D="MENU_HISTORY_UPDATE",R="MENU_BREADCRUMBS_UPDATE";class A{menuDataMaps={};menuData=[];menuPathMaps={};breadcrumbs=[];menuHistorys=[];userId;constructor(){}addListenerMenuHistorys=e=>{l.on(D,e)};removeListenerMenuHistorys=e=>l.off(D,e);addListenerBreadcrumbs=e=>l.on(R,e);removeListenerBreadcrumbs=e=>l.off(R,e);getTreeMenuData=(e,t,s)=>e.map((e=>{const{id:i,path:n,leaf:a}=e,r=t[i],o={...e,key:i,path:s?s+N(n):N(n)};if(r&&!a){const e=this.getTreeMenuData(r,t,o.path);o.children=e}return this.menuDataMaps[o.path]=o,o})).sort(((e,t)=>e.seqNum-t.seqNum));init=(e,s)=>{const i=g(e);if(h(i))return;const n=t(i,"parentResourceId"),{ROOT:a,...r}=n;this.menuData=this.getTreeMenuData(a,r),this.menuData=[...this.menuData];const o=m(this.menuDataMaps,"name");this.updateMenuMaps(o),this.initMenuHistorys(s)};updateMenuMaps=e=>{this.menuPathMaps={...this.menuPathMaps,...e};const t=this.menuHistorys.map((e=>{const t=this.menuPathMaps[e.pathname];return{pathname:e.pathname,name:t||e.name}})),s=this.breadcrumbs.map((e=>{const t=this.menuPathMaps[e.pathname];return{...e,name:t||e.name}}));this.updatehistorys(t),this.updateBreadcrumbs(s)};liseterHistorys=e=>{let t=this.menuHistorys;this.menuDataMaps[e]?.leaf&&!t.some((t=>t.pathname===e))&&(t=[{pathname:e,name:this.menuPathMaps[e]},...t],this.updatehistorys(t))};updatehistorys=e=>{if(!this.userId)return;const t=e.map((e=>({...e,name:e.name?e.name:this.menuPathMaps[e.pathname]})));this.menuHistorys=t,this.menuHistorys=p(this.menuHistorys,"pathname"),l.emit(D,this.menuHistorys),U.set(`${this.userId}-menu-history`,this.menuHistorys)};initMenuHistorys=e=>{this.userId=e;const t=U.get(`${e}-menu-history`,this.menuHistorys);this.updatehistorys(t)};liseterBreadcrumbs=e=>{const t=e.split("/");let s=1;const i=[],n={pathname:e,name:this.menuPathMaps[e]};for(;s<t.length;){const e=t.slice(0,s).join("/");this.menuPathMaps[e]&&i.push({name:this.menuPathMaps[e],pathname:e}),s++}i.push(n),this.updateBreadcrumbs(i)};updateBreadcrumbs=e=>{this.breadcrumbs=e,this.breadcrumbs=p(this.breadcrumbs,"pathname"),l.emit(R,e)}}class M{loginPathname;BASE="/";get baseLoginPathname(){return`${this.BASE}${this.loginPathname?.replace("/","")}`}tokenValue="";get isLoginPathname(){const e=window.location.pathname;return this.baseLoginPathname==e}getRealPath=e=>`${this.BASE}${e.replace("/","")}`;chekToken=async()=>{const t=await e("/authentication/checkToken",{serviceId:"fwSecurity"},{showError:!1});return t&&this.isLoginPathname&&window.location.replace(this.BASE),t};getLoginMethod=async()=>e("/authentication/getLoginMethod",{serviceId:"fwSecurity"});redirectBaseLogin=async()=>{const e=window.location.pathname,t=window.location.href;if(this.isLoginPathname)return!0;const s=new URLSearchParams;e!==this.BASE&&"/"!==e&&s.append("redirectUrl",t);const i=decodeURIComponent(s.toString());return window.location.replace(`${this.baseLoginPathname}${i?"?"+decodeURIComponent(s.toString()):""}`),!1};checkPassword=async()=>"noPass"!==await e("/security/checkPasswordUpdateTime",{data:{}},{showError:!1})||(this.tokenValue=await e("/authentication/extractToken",{data:{}}),!1);refactorToken=async()=>{var t;await(t=this.tokenValue,e("/authentication/refactorToken",{data:{value:t}}))};login=async e=>{const t=await this.baseLogin(e);return t.error,t};baseLogin=async t=>{const s={error:void 0,data:void 0};try{const i=await function(t){return e("/authentication/login",{data:t,serviceId:"fwSecurity"})}(t),{userToken:n,traceId:a}=i;if(n){s.data=i;return await this.checkPassword()||(s.error="passwordExpiration"),s}return a?(s.data=i,s.error="SLIDER_VERIFICATION_LOGIN",s):(s.error="passwordError",s)}catch(e){return s.error="validateError",s}};loginSuccess=()=>{let e=new URLSearchParams(window.location.search).get("redirectUrl");e?window.location.href=e:window.location.replace(this.BASE)};baseLoginOut=async()=>{const t=new URLSearchParams,s=window.location.href;window.location.pathname!==this.BASE&&t.append("redirectUrl",s),await e("/authentication/logout",{data:{},serviceId:"fwSecurity"}),window.location.replace(`${this.baseLoginPathname}?${t.toString()}`)}}const $={sso:!1,ssoUrlSearchParams:["ticket"],ssoCheckTokenUrl:"",ssoSuccessUrlkey:"successUrl",ssoLoginUrl:window.location.origin+"/fwSecurity/ssoAuth/login.api",ssologinOutUrl:window.location.origin+"fwSecurity/ssoAuth/logout.api"};class _{init(e){this.ssoConfig={...this.ssoConfig,...e}}ssoConfig=$;isSso=async t=>{if(!this.ssoConfig.sso)return!1;let s=!1;try{s=await e("/ssoAuthConfig/checkOnlyRedirect",{},{showError:!1})}catch(e){console.error("sso",e)}return t&&(s=await t()),!!s};ssoLogin=()=>{const{ssoSuccessUrlkey:e,ssoUrlSearchParams:t,ssoLoginUrl:s}=this.ssoConfig,i=new URLSearchParams(window.location.search.slice(1)),n=new URLSearchParams,a=window.location.href;return n.append(e,encodeURIComponent(a)),t.map((e=>{const t=i.get(e);t&&n.append(e,t)})),window.location.href=`${s}?${n.toString()}`,!1};ssoLoginOut=()=>{window.location.href=this.ssoConfig.ssologinOutUrl}}class B{getValidateCodeImage=t=>function(t={}){return e("/authentication/getValidateCode",{data:t,serviceId:"fwSecurity"})}(t);sliderVerificationCodeImage=()=>e("/authentication/sliderVerificationCode",{method:"POST",serviceId:"fwSecurity"});checkCaptcha=t=>{return s=t,e("/authentication/checkCaptcha",{method:"POST",data:{...s},serviceId:"fwSecurity"});var s}}class x extends M{ssoLogin;validate;noCheckPermissionsPath=[];ssoCallback;constructor(){super(),this.ssoLogin=new _,this.validate=new B}init=(e,t="/",s)=>{this.BASE=t,this.ssoCallback=s,this.noCheckPermissionsPath=e?.noCheckPermissionsPath,this.ssoLogin.init(e),this.loginPathname=e?.loginPathname||"/login"};isNoLoginRequiredPage=()=>{const e=window.location.pathname,t=this.noCheckPermissionsPath?.some((t=>this.getRealPath(t)==e));return t};loginOut=async()=>{await this.ssoLogin.isSso(this.ssoCallback)&&this.ssoLogin.ssoLoginOut(),await this.baseLoginOut()};loginAuthentication=async t=>{var s;await(s=t,e("/authentication/beforeLoginCheckCode",{method:"POST",data:{...s},serviceId:"fwSecurity"})),this.loginSuccess()};redirectLogin=async()=>{if(this.isNoLoginRequiredPage())return!0;return await this.ssoLogin.isSso(this.ssoCallback)?(this.ssoLogin.ssoLogin(),!1):!!this.isLoginPathname||await this.redirectBaseLogin()}}const F=new class{userStore;menuStore;loginStore;isSuperAdmin=!1;loginCallback;constructor(){this.userStore=new b,this.menuStore=new A,this.loginStore=new x}platformLanguages=[];productInfo={isProdEnv:!1,productName:""};get isPrd(){return this.productInfo?.isProdEnv}get userInfo(){return this.userStore.currentUser}get menuData(){return this.menuStore.menuData}findPlantform=async()=>{const t=await e("/platformManage/getPlatformAggregateInfo",{method:"POST"},{showError:!1});this.platformLanguages=t.platformLanguages,this.productInfo=t.productInfo};getAggregateInfo=async t=>{const s=await async function(){return e("/security/findUserAggregateInfo",{method:"POST"})}(),{user:i,startMenus:n,isSuperAdmin:a,...r}=s;this.userStore.setUserAggregateInfo({...r,currentUser:i}),this.isSuperAdmin=a;const o="function"==typeof t?await t(s):t;this.menuStore.init(h(o)?n:o,i.id)};init=async e=>{const{base:t="/",menuData:s,loginSuccessCallback:i,ssoCallback:n,websocket:a=!0}=e;this.loginStore.init(e?.loginConfig,t,n);try{const e=await this.loginStore.chekToken();return e?(this.userStore.setUserIdentity(e),await this.getAggregateInfo(s),await y.findAllCodeList(),await w.findAllParameters(),a&&T.init(this.userStore.currentUser.userLoginName),await(i?.()),!0):await this.loginStore.redirectLogin()}catch(e){console.error(e)}return!1}};const H="company-v1";var V=new class{data={};getCompanyDataType=e=>`${H}-${e}`;getCompanyData=async t=>{const s=this.getCompanyDataType(t);if(this.data[s])return this.data[s];const i=await async function(t){return e("/companyData/getCompanyData",{data:t,serviceId:"fwSecurity"})}({dataType:t,dataId:H}),n=i?.bigData?JSON.parse(i.bigData):void 0;this.data[s]=n};updateCompanyData=async(t,s)=>{const i=this.getCompanyDataType(t);return await async function(t){return e("/companyData/setCompanyData",{data:t,serviceId:"fwSecurity"})}({dataType:t,dataId:H,bigData:JSON.stringify(s)}),this.data[i]=s,s};removeCompanyData=async t=>{const s=this.getCompanyDataType(t);await async function(t){return e("/companyData/delCompanyData",{data:t,serviceId:"fwSecurity"})}({dataType:t,dataId:H}),delete this.data[s]}};const J=y,K=w,W=F.userStore,Y=F.loginStore,j=F.menuStore;export{D as M,k as P,P as W,R as a,v as b,J as c,L as d,I as e,F as g,V as i,Y as l,j as m,K as p,U as s,W as u,T as w};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/core/store/codelist/index.ts","../../../src/core/store/codelist/services.ts","../../../src/core/store/parameter/index.ts","../../../src/core/store/parameter/services.ts","../../../src/core/store/websocket.ts","../../../src/core/store/progress.ts","../../../src/core/store/storage.ts","../../../src/core/store/user/index.ts","../../../src/core/store/user/services.ts","../../../src/core/store/menu/index.ts","../../../src/core/store/login/base.ts","../../../src/core/store/login/services/base.ts","../../../src/core/store/login/services/authentication.ts","../../../src/core/store/login/sso.ts","../../../src/core/store/login/services/sso.ts","../../../src/core/store/login/validate.ts","../../../src/core/store/login/services/validate.ts","../../../src/core/store/login/index.ts","../../../src/core/store/global/index.ts","../../../src/core/store/global/services.ts","../../../src/core/store/companydata/index.ts","../../../src/core/store/companydata/services.ts","../../../src/core/store/index.ts"],"sourcesContent":["import { findAllCodeListApi } from './services';\nimport { groupBy, find, reduce } from 'lodash-es';\n\nexport interface CodeTypeGroup {\n codeTypeId: string;\n id: string;\n isGroup: boolean;\n name: string;\n type: string;\n typeName: string;\n value: string;\n}\n\nexport interface CodeTypeChild extends CodeTypeGroup {\n groupId: string;\n}\n\nexport type CodeTypeItem = CodeTypeChild | CodeTypeGroup;\nexport type CodeList = CodeTypeItem[];\nexport type CodeValue = Record<string, any>;\nexport type CodeMaps = { [name: string]: CodeList };\n\nclass CodeListStore {\n codeLists: CodeList = [];\n codeMaps: CodeMaps = {};\n async findAllCodeList() {\n const res = await findAllCodeListApi();\n const data = res || [];\n const dataMap = groupBy(data, 'type');\n this.codeLists = data;\n this.codeMaps = dataMap;\n }\n getCodeLocaleList = (codeType: string) => {\n return [...this.codeMaps?.[codeType]] || [];\n };\n getCodeLocaleName = (codeType: string, value: string) => {\n const codeList = this.getCodeLocaleList(codeType);\n function getName(value: string): string {\n const code = find(codeList, (item: any) => item.value === String(value));\n return code?.name || '';\n }\n if (Array.isArray(value)) {\n const text = reduce(\n value,\n (res = '', value = '') => res + ',' + getName(value),\n '',\n );\n return text.slice(1, text.length);\n } else if (String(value).indexOf(',') >= 0) {\n const str = value.replace('[', '').replace(']', '');\n const valueArr = str.split(',');\n const text = reduce(\n valueArr,\n (res = '', value = '') => res + ',' + getName(value),\n '',\n );\n return text.slice(1, text.length);\n } else {\n return getName(value);\n }\n };\n}\n\nconst codeListStoreInstance = new CodeListStore();\nexport const getCodeLocaleList = codeListStoreInstance.getCodeLocaleList;\nexport const getCodeLocaleName = codeListStoreInstance.getCodeLocaleName;\nexport default codeListStoreInstance;\n","import request from '@core/request';\n\nexport function findAllCodeListApi() {\n return request('/codeList/findAll', {\n data: {},\n serviceId: 'fwPlatform',\n });\n}\n","import { findSystemParameterApi } from './services';\nimport { keyBy, pick } from 'lodash-es';\n\nexport interface ParameterItem {\n catalog: string;\n description: string;\n id: string;\n name: string;\n optCounter: number;\n type: string;\n value: string;\n}\n\nexport type ParameterList = ParameterItem[];\nexport type ParameterMaps = { [name: string]: ParameterItem };\n\nclass ParameterStoreClass {\n parameterList: ParameterList = [];\n parameterMap: ParameterMaps = {};\n findAllParameters= async()=>{\n const res = await findSystemParameterApi();\n const data = res || [];\n const dataMap: any = keyBy(data, 'name');\n this.parameterList = data;\n this.parameterMap = dataMap;\n }\n /**\n * 获取系统参数,可以一次指定获取多个参数(传入数组)\n * @param name {string | string[]} 需要获取到的参数的key\n * @returns 返回根据key查询到一个参数对象\n */\n getSystemParameterByName =(name: string | string[])=> {\n if (typeof name === 'string') return this.parameterMap[name];\n return pick(this.parameterMap, name);\n }\n}\n\nconst parameterStoreInstance = new ParameterStoreClass();\n\nexport default parameterStoreInstance;\n","import request from '@core/request';\n//获取系统参数\nexport function findSystemParameterApi() {\n return request(\n '/parameter/findAll',\n {\n serviceId: 'fwPlatform',\n data: {},\n },\n {\n showError: false,\n },\n );\n}\n","import { uniqueId, get, omit } from \"lodash-es\";\nimport emitter from \"@core/event\";\n//计算最终的WebSocketUrl\nconst pingMsg = \"ping\"; //客户端心跳信息\nconst pongMsg = \"pong\"; //服务端心跳信息\nconst reconnectTimeout = 10000;\nconst pingPongTimeout = 10000; //发送的心跳的间隔时间\nexport interface WEBSOCKETRECROD {\n id: string;\n recipientType: string;\n recipientCode: string;\n title?: string;\n status?: \"01\" | \"00\";\n senderName?: string;\n senderTime?: string;\n content: string;\n linkUri?: string;\n linkName?: string;\n progress?: number;\n}\nexport const WS_CONTENT_SUCCESS = \"WS_CONTENT_SUCCESS\";\nexport const WS_CONTENT_ERROR = \"WS_CONTENT_ERROR\";\nexport const WS_CONTENT_CLOSE = \"WS_CONTENT_CLOSE\";\nconst getWebSocketUrl = (userLoginName: string) => {\n const suffix = \"notification-ws\";\n const paramStr = `userLoginName=${userLoginName}`;\n const { host, protocol, port, hostname } = window.location;\n //是否是https\n const isHttps = protocol.includes(\"https\");\n //ws协议\n let wsProtocol = isHttps ? \"wss\" : \"ws\";\n //默认是host\n let wsHost: string = host;\n //如果不是是https并且有端口号时,ws端口就是web端口+1\n if (!isHttps && port) {\n let newhost = parseInt(port);\n wsHost = `${hostname}:${newhost}`;\n }\n const wsAddress = `${wsProtocol}://${wsHost}/${suffix}?${paramStr}`;\n return wsAddress;\n};\n\ntype GantWebSocketOptions = {\n disReconnect?: boolean;\n repeatLimit?: null | undefined | number;\n};\nexport class GantWebSocket {\n RECIPIENT_TYPE_ALL = \"all\"; // 所有用户均可收到的消息类型【公告等消息】\n RECIPIENT_TYPE_USER = \"user\"; // 某个用户可以收到【用户通知】\n RECIPIENT_TYPE_OBSERVER = \"obsvr\"; // 某个观察者可以收到【接口处理进度】\n RECIPIENT_TYPE_CONNECTION = \"conn\"; // 某个连接成功接收到【ws连接专用】\n //链接地址\n private webSocketUrl: string = \"\";\n // WebSocket\n private ws: WebSocket | null = null;\n //重链次数\n private repeat = 0;\n // 链接状态\n private connectLoading = false;\n\n //禁止重链\n private disReconnect = false;\n\n private pingTimeoutFn: null | NodeJS.Timeout = null;\n private pongTimeoutFn: null | NodeJS.Timeout = null;\n private reconnectFn: null | NodeJS.Timeout = null;\n\n //是否限制次数\n private repeatLimit: null | undefined | number = 2;\n\n //链接标识\n connectionId: string = \"\";\n private userLoginName: string = \"\";\n\n private eventStack: {\n [name: string]: {\n type: \"recipientType\" | \"message\";\n recipientType: string[];\n event: (data: WEBSOCKETRECROD) => void;\n };\n } = {};\n constructor() {}\n\n init = (userLoginName: string, options?: GantWebSocketOptions) => {\n this.userLoginName = userLoginName;\n this.webSocketUrl = getWebSocketUrl(userLoginName);\n this.disReconnect = get(options, \"disReconnect\", false);\n this.repeatLimit = get(options, \"repeatLimit\", 20);\n this.createWebSocket();\n };\n createWebSocket = () => {\n this.connectLoading = true;\n try {\n this.ws = new WebSocket(this.webSocketUrl);\n this.registerEvent();\n } catch (error) {\n this.ws = null;\n this.reconnect();\n } finally {\n this.connectLoading = false;\n }\n };\n //重新链接\n reconnect = () => {\n if (this.reconnectFn) clearTimeout(this.reconnectFn);\n if (!!this.repeatLimit && this.repeatLimit <= this.repeat) return;\n if (this.connectLoading || this.disReconnect || this.ws) return;\n this.repeat++;\n this.reconnectFn = setTimeout(() => {\n this.createWebSocket();\n }, reconnectTimeout);\n };\n //链接状态检查\n heartCheck = () => {\n this.repeat = 0;\n if (this.disReconnect) return;\n this.pingTimeoutFn = setTimeout(() => {\n const msg = `{\"userLoginName\":\"${this.userLoginName}\",\"connectionId\":\"${this.connectionId}\",\"content\":\"${pingMsg}\"}`;\n this.ws?.send(msg);\n this.pongTimeoutFn = setTimeout(() => {\n this.ws?.close();\n }, pingPongTimeout);\n }, pingPongTimeout);\n };\n\n heartReset = () => {\n if (this.pingTimeoutFn) {\n clearTimeout(this.pingTimeoutFn);\n this.pingTimeoutFn = null;\n }\n if (this.pongTimeoutFn) {\n clearTimeout(this.pongTimeoutFn);\n this.pongTimeoutFn = null;\n }\n };\n\n //主动断开连接\n disconnect = () => {\n this.heartReset();\n this.ws?.readyState == 1 && this.ws?.close();\n this.ws = null;\n };\n\n //注册事件\n registerEvent = () => {\n if (!this.ws) return;\n this.ws.onopen = () => {\n this.heartCheck();\n };\n this.ws.onmessage = (e) => {\n this.heartReset();\n this.heartCheck();\n const dataStr = e.data;\n try {\n //忽略心跳回复信息\n if (\n dataStr == pongMsg ||\n JSON.parse(dataStr).content == pingMsg ||\n JSON.parse(dataStr).content == pongMsg\n )\n return;\n const wsdata: WEBSOCKETRECROD = JSON.parse(dataStr);\n const data = {\n ...wsdata,\n senderTime: wsdata.senderTime,\n };\n emitter.emit(WS_CONTENT_SUCCESS, data);\n Object.keys(this.eventStack).map((eventId) => {\n const itemEevent = this.eventStack[eventId];\n const isIncludes = itemEevent.recipientType?.includes(\n data.recipientType\n );\n if (isIncludes) itemEevent?.event?.(data);\n });\n //存储服务端连接成功后的第一次响应返回的标识id\n if (data.recipientType == this.RECIPIENT_TYPE_CONNECTION) {\n this.connectionId = data.recipientCode;\n return;\n }\n } catch (err) {\n console.warn(\"received error!!!\", err);\n }\n };\n this.ws.onerror = () => {\n this.heartReset();\n this.reconnect();\n emitter.emit(WS_CONTENT_ERROR);\n };\n this.ws.onclose = () => {\n console.warn(\"webSocket close\");\n this.ws = null;\n this.heartReset();\n this.reconnect();\n emitter.emit(WS_CONTENT_CLOSE);\n };\n };\n\n addTypeListener = (\n type: string | string[],\n event: (data: WEBSOCKETRECROD) => void\n ) => {\n const eventType = Array.isArray(type) ? type : [type];\n const id = uniqueId();\n this.eventStack[id] = {\n recipientType: eventType,\n type: \"recipientType\",\n event,\n };\n return id;\n };\n removeListener = (id: string | string[]) => {\n this.eventStack = omit(this.eventStack, id);\n };\n}\nconst websocket = new GantWebSocket();\nexport default websocket;\n","import websocket, { WEBSOCKETRECROD } from './websocket';\nimport request from '@core/request';\nimport { uniqueId, omit, isEmpty } from 'lodash-es';\nimport emitter from '@core/event';\nconst { RECIPIENT_TYPE_OBSERVER } = websocket;\nexport interface ProgressOptions {\n type?: string;\n options?: any;\n data?: WEBSOCKETRECROD;\n}\nexport const PROGRESS_UPDEDATE = 'PROGRESS_UPDEDATE';\nexport class GantProgress {\n websocketId: string;\n private progressObserver: { [id: string]: ProgressOptions } = {};\n constructor() {\n this.websocketId = websocket.addTypeListener(\n RECIPIENT_TYPE_OBSERVER,\n this.progressEvent,\n );\n }\n progressEvent(data: WEBSOCKETRECROD) {\n Object.keys(this.progressObserver).map((id) => {\n const itemObserver = this.progressObserver[id];\n if (data?.recipientCode === itemObserver.type) {\n this.progressObserver[id] = {\n ...itemObserver,\n data: data,\n };\n }\n });\n this.updedataProgress();\n }\n\n updedataProgress() {\n const newProgress: ProgressOptions[] = [];\n Object.keys(this.progressObserver).map((id) => {\n const itemObserver = this.progressObserver[id];\n if (!isEmpty(itemObserver?.data)) newProgress.push(itemObserver);\n });\n emitter.emit(PROGRESS_UPDEDATE, newProgress);\n }\n\n addProgressListener(type: string, options?: any) {\n const id = uniqueId();\n this.progressObserver[id] = {\n type: type,\n options,\n };\n return id;\n }\n removeProgressListener(id: string) {\n this.progressObserver = omit(this.progressObserver, id);\n this.updedataProgress();\n }\n async requestProgress(\n url: string,\n options?: {\n params?: any;\n success?: (params: any) => void;\n error?: (error: any) => void;\n headers?: any;\n getParams?: boolean;\n },\n ) {\n if (!websocket.connectionId && !options?.headers?.connectionId)\n return console.error(`WebSocket no link established`);\n const observerId = new Date().getDate() + '';\n const progressId = this.addProgressListener(observerId);\n try {\n const response = await request.post(\n url,\n {\n headers: {\n observerId,\n connectionId: websocket.connectionId,\n ...options?.headers,\n },\n data: options?.params,\n },\n {\n getParams: options?.getParams,\n },\n );\n options?.success?.(response);\n } catch (error) {\n console.error('--->', error);\n options?.error?.(error);\n }\n this.removeProgressListener(progressId);\n }\n}\n\nconst Progress = new GantProgress();\nexport default Progress;\n","// 默认缓存期限为7天\nconst DEFAULT_CACHE_TIME = 60 * 60 * 24 * 7;\n\n/**\n * 创建本地缓存对象\n * @param {string=} prefixKey -\n * @param {Object} [storage=localStorage] - sessionStorage | localStorage\n */\nexport const createStorage = ({\n prefixKey = '',\n storage = localStorage,\n} = {}) => {\n /**\n * 本地缓存类\n * @class Storage\n */\n const StorageClass = class {\n storage = storage;\n prefixKey?: string = prefixKey;\n\n getKey(key: string) {\n return `${this.prefixKey}${key}`.toUpperCase();\n }\n\n /**\n * @description 设置缓存\n * @param {string} key 缓存键\n * @param {*} value 缓存值\n * @param expire\n */\n set(key: string, value: any, expire: number | null = DEFAULT_CACHE_TIME) {\n const stringData = JSON.stringify({\n value,\n expire: expire !== null ? new Date().getTime() + expire * 1000 : null,\n });\n this.storage.setItem(this.getKey(key), stringData);\n }\n\n /**\n * 读取缓存\n * @param {string} key 缓存键\n * @param {*=} def 默认值\n */\n get(key: string, def: any = null) {\n const item = this.storage.getItem(this.getKey(key));\n if (item) {\n try {\n const data = JSON.parse(item);\n const { value, expire } = data;\n // 在有效期内直接返回\n if (expire === null || expire >= Date.now()) {\n return value;\n }\n this.remove(key);\n } catch (e) {\n console.error(e);\n return def;\n }\n }\n return def;\n }\n\n /**\n * 从缓存删除某项\n * @param {string} key\n */\n remove(key: string) {\n this.storage.removeItem(this.getKey(key));\n }\n\n /**\n * 清空所有缓存\n * @memberOf Cache\n */\n clear(): void {\n this.storage.clear();\n }\n\n /**\n * 设置cookie\n * @param {string} name cookie 名称\n * @param {*} value cookie 值\n * @param {number=} expire 过期时间\n * 如果过期时间未设置,默认关闭浏览器自动删除\n * @example\n */\n setCookie(\n name: string,\n value: any,\n expire: number | null = DEFAULT_CACHE_TIME,\n ) {\n document.cookie = `${this.getKey(name)}=${value}; Max-Age=${expire}`;\n }\n\n /**\n * 根据名字获取cookie值\n * @param name\n */\n getCookie(name: string): string {\n const cookieArr = document.cookie.split('; ');\n for (let i = 0, length = cookieArr.length; i < length; i++) {\n const kv = cookieArr[i].split('=');\n if (kv[0] === this.getKey(name)) {\n return kv[1];\n }\n }\n return '';\n }\n\n /**\n * 根据名字删除指定的cookie\n * @param {string} key\n */\n removeCookie(key: string) {\n this.setCookie(key, 1, -1);\n }\n\n /**\n * 清空cookie,使所有cookie失效\n */\n clearCookie(): void {\n const keys = document.cookie.match(/[^ =;]+(?==)/g);\n if (keys) {\n for (let i = keys.length; i--; ) {\n document.cookie = keys[i] + '=0;expire=' + new Date(0).toUTCString();\n }\n }\n }\n };\n return new StorageClass();\n};\n\nexport const storage = createStorage();\n","import { findIndex, get, isEmpty, isPlainObject, omit } from \"lodash-es\";\nimport { storage } from \"../storage\";\nimport { UserIdentityType, User } from \"../type\";\nimport {\n getUserDataApi,\n setUserDataApi,\n delUserDataApi,\n getUserByIdApi,\n getUserByUserLoginNameApi,\n} from \"./services\";\n\nexport default class UserStore {\n userIdentity = {} as UserIdentityType; //用户身份信息\n currentUser = {} as User; //当前用户信息\n isSuperAdmin = false;\n roles: string[] = []; //用户所属角色\n functions: string[] = []; //用户授权功能点\n delegations: any[] = []; //用户代理信息\n userSetting: { [type: string]: any } = {};\n users: User[] = [];\n getUserIdentity(): UserIdentityType {\n if (!isEmpty(this.userIdentity)) return this.userIdentity;\n const localUserIdentity = storage?.get(\"userIdentity\");\n return localUserIdentity ? localUserIdentity : ({} as UserIdentityType);\n }\n setUserIdentity(identity: Partial<UserIdentityType>) {\n this.userIdentity = {\n ...this.userIdentity,\n ...identity,\n };\n storage.set(\"userIdentity\", this.userIdentity);\n return this.userIdentity;\n }\n clearUserIdentity() {\n storage.remove(\"userIdentity\");\n this.userIdentity = {} as UserIdentityType;\n }\n setUserAggregateInfo = ({\n delegations,\n roles,\n functions,\n isSuperAdmin,\n currentUser,\n }: any) => {\n this.delegations = delegations;\n this.roles = roles;\n this.functions = functions;\n this.isSuperAdmin = isSuperAdmin;\n this.currentUser = currentUser;\n };\n getUserSettingType = (dataType: string) => {\n const userId = this.currentUser.id;\n return `${userId}-${dataType}`;\n };\n getUserSetting = async (dataType: string) => {\n const key = this.getUserSettingType(dataType);\n const userId = this.currentUser.id;\n if (!!this.userSetting[key]) {\n return this.userSetting[key];\n }\n const res = await getUserDataApi({ dataType, dataId: userId+dataType });\n const bigData = res?.bigData ? JSON.parse(res.bigData) : undefined;\n this.userSetting[key] = bigData;\n return bigData;\n };\n updateUserSetting = async (dataType: string, data: any) => {\n const key = this.getUserSettingType(dataType);\n const userId = this.currentUser.id;\n await setUserDataApi({\n dataType,\n dataId: userId+dataType,\n bigData: JSON.stringify(data),\n });\n this.userSetting[key] = data;\n return data;\n };\n removeUserSetting = async (dataType: string) => {\n const key = this.getUserSettingType(dataType);\n const userId = this.currentUser.id;\n await delUserDataApi({ dataType, dataId: userId });\n delete this.userSetting[key];\n };\n getUserInfo = async (userId: string, userLoginName?: boolean) => {\n const index = findIndex(this.users, (itemUser) =>\n userLoginName ? itemUser.userLoginName === userId : itemUser.id === userId\n );\n if (index > -1) return get(this.users, `[${index}]`);\n const userInfo = userLoginName\n ? await getUserByUserLoginNameApi(userId)\n : await getUserByIdApi(userId);\n isPlainObject(userInfo) && this.users.push(userInfo);\n return userInfo;\n };\n}\n","import request, { GantServerOptions } from \"@core/request\";\n//公司定制化数据接口\nexport async function setUserDataApi(params: any, options?: GantServerOptions) {\n return request(\n \"/accountUserSelf/setUserData\",\n {\n data: params,\n serviceId: \"fwSecurity\",\n },\n options\n );\n}\n\n//获取公司定制化信息\nexport async function getUserDataApi(params: any) {\n return request(\"/accountUserSelf/getUserData\", {\n data: params,\n serviceId: \"fwSecurity\",\n });\n}\n//删除公司定制化信息\nexport async function delUserDataApi(params: any, options?: GantServerOptions) {\n return request(\n \"/accountUserSelf/delUserData\",\n {\n data: params,\n serviceId: \"fwSecurity\",\n },\n options\n );\n}\n\nexport async function getUserByIdApi(userId: string) {\n return request(\"/security/getUserById\", {\n method: \"POST\",\n data: { id: userId },\n serviceId: \"fwSecurity\",\n });\n}\n\nexport async function getUserByUserLoginNameApi(userLoginName: string) {\n return request(\"/security/getUserByUserLoginName\", {\n method: \"POST\",\n data: { userLoginName: userLoginName },\n serviceId: \"fwSecurity\",\n });\n}\n","import {\n isEmpty,\n groupBy,\n omit,\n cloneDeep,\n mapValues,\n uniqBy,\n remove,\n includes,\n} from 'lodash-es';\nimport { ServerMenuData, ServerMenuMap, ServerMenu } from '../type';\nimport emitter from '@core/event';\nimport { storage } from '../storage';\nexport const httpsRegexp =\n /^https?:\\/\\/(([a-zA-Z0-9_-])+(\\.)?)*(:\\d+)?(\\/((\\.)?(\\?)?=?&?[a-zA-Z0-9_-](\\?)?)*)*$/i;\nexport const httpRegexp =\n /^https?:\\/\\/(([a-zA-Z0-9_-])+(\\.)?)*(:\\d+)?(\\/((\\.)?(\\?)?=?&?[a-zA-Z0-9_-](\\?)?)*)*$/i;\n\nconst getItemPath = (path: string) => {\n if (httpsRegexp.test(path) || httpRegexp.test(path)) return path;\n return path?.indexOf('/') === 0 ? path : '/' + path;\n};\n\nexport const MENU_HISTORY_UPDATE = 'MENU_HISTORY_UPDATE';\nexport const MENU_BREADCRUMBS_UPDATE = 'MENU_BREADCRUMBS_UPDATE';\n\nexport default class MenuStore {\n menuDataMaps: ServerMenuMap = {};\n menuData: ServerMenuData = [];\n menuPathMaps: { [name: string]: string } = {};\n breadcrumbs: any[] = [];\n menuHistorys = [] as { pathname: string; name: string }[];\n userId?: string;\n constructor() {}\n addListenerMenuHistorys = (listener: (...args: any[]) => void) => {\n emitter.on(MENU_HISTORY_UPDATE, listener);\n };\n\n removeListenerMenuHistorys = (listener: (...args: any[]) => void) => {\n return emitter.off(MENU_HISTORY_UPDATE, listener);\n };\n addListenerBreadcrumbs = (listener: (...args: any[]) => void) => {\n return emitter.on(MENU_BREADCRUMBS_UPDATE, listener);\n };\n removeListenerBreadcrumbs = (listener: (...args: any[]) => void) => {\n return emitter.off(MENU_BREADCRUMBS_UPDATE, listener);\n };\n getTreeMenuData = (\n data: ServerMenuData,\n childrenGroup: {\n [name: string]: ServerMenuData;\n },\n parentPath?: string,\n ) => {\n return data\n .map((item) => {\n const { id, path, leaf } = item;\n const childrenData = childrenGroup[id];\n const newItem: ServerMenu = {\n ...item,\n key: id,\n path: parentPath ? parentPath + getItemPath(path) : getItemPath(path),\n };\n if (!!childrenData && !leaf) {\n const children = this.getTreeMenuData(\n childrenData,\n childrenGroup,\n newItem.path,\n );\n newItem.children = children;\n }\n this.menuDataMaps[newItem.path] = newItem;\n return newItem;\n })\n .sort((a, b) => a.seqNum - b.seqNum);\n };\n init = (menuData: ServerMenuData, userId: string) => {\n const cloneMenuData = cloneDeep(menuData);\n if (isEmpty(cloneMenuData)) return;\n const groupObj = groupBy(cloneMenuData, 'parentResourceId');\n const { ROOT, ...childrenGroup } = groupObj;\n this.menuData = this.getTreeMenuData(ROOT, childrenGroup);\n this.menuData = [...this.menuData];\n const menuPathMaps = mapValues(this.menuDataMaps, 'name');\n this.updateMenuMaps(menuPathMaps);\n this.initMenuHistorys(userId);\n return;\n };\n updateMenuMaps = (menuPathMaps: any) => {\n this.menuPathMaps = { ...this.menuPathMaps, ...menuPathMaps };\n const historys = this.menuHistorys;\n const newHistorys = historys.map((item) => {\n const itemName = this.menuPathMaps[item.pathname];\n return {\n pathname: item.pathname,\n name: itemName ? itemName : item.name,\n };\n });\n const newBreadcrumbs = this.breadcrumbs.map((item) => {\n const itemName = this.menuPathMaps[item.pathname];\n return {\n ...item,\n name: itemName ? itemName : item.name,\n };\n });\n this.updatehistorys(newHistorys);\n this.updateBreadcrumbs(newBreadcrumbs);\n };\n\n liseterHistorys = (pathname: string) => {\n let historys = this.menuHistorys;\n if (\n !this.menuDataMaps[pathname]?.leaf ||\n historys.some((item) => item.pathname === pathname)\n )\n return;\n historys = [{ pathname, name: this.menuPathMaps[pathname] }, ...historys];\n this.updatehistorys(historys);\n };\n\n updatehistorys = (historys: { pathname: string; name: string }[]) => {\n if (!this.userId) return;\n const newHistorys = historys.map((item) => {\n return {\n ...item,\n name: item.name ? item.name : this.menuPathMaps[item.pathname],\n };\n });\n this.menuHistorys = newHistorys;\n this.menuHistorys = uniqBy(this.menuHistorys, 'pathname');\n emitter.emit(MENU_HISTORY_UPDATE, this.menuHistorys);\n storage.set(`${this.userId}-menu-history`, this.menuHistorys);\n };\n initMenuHistorys = (userId: string) => {\n this.userId = userId;\n const historys = storage.get(`${userId}-menu-history`, this.menuHistorys);\n this.updatehistorys(historys);\n };\n liseterBreadcrumbs = (pathname: string) => {\n const array = pathname.split('/');\n let index = 1;\n const breadcrumbs: any[] = [];\n const current = { pathname, name: this.menuPathMaps[pathname] };\n while (index < array.length) {\n const itemPathname = array.slice(0, index).join('/');\n if (!!this.menuPathMaps[itemPathname])\n breadcrumbs.push({\n name: this.menuPathMaps[itemPathname],\n pathname: itemPathname,\n });\n index++;\n }\n breadcrumbs.push(current);\n this.updateBreadcrumbs(breadcrumbs);\n };\n updateBreadcrumbs = (breadcrumbs: any[]) => {\n this.breadcrumbs = breadcrumbs;\n this.breadcrumbs = uniqBy(this.breadcrumbs, 'pathname');\n emitter.emit(MENU_BREADCRUMBS_UPDATE, breadcrumbs);\n };\n}\n","import { LoginResultData } from \"../type\";\nimport {\n accountLoginApi,\n accountLogoutApi,\n BaseLoginParams,\n getLoginMethodApi,\n checkPasswordApi,\n extractTokenApi,\n refactorTokenApi,\n checkTokenApi,\n} from \"./services\";\nexport type LoginErrorType =\n | \"passwordError\"\n | \"validateError\"\n | \"passwordExpiration\"\n | \"SLIDER_VERIFICATION_LOGIN\";\n\nexport default class BaseLogin {\n loginPathname?: string;\n BASE: string = \"/\";\n get baseLoginPathname() {\n return `${this.BASE}${this.loginPathname?.replace(\"/\", \"\")}`;\n }\n tokenValue: string = \"\";\n\n get isLoginPathname() {\n const pathname = window.location.pathname;\n return this.baseLoginPathname == pathname;\n }\n\n getRealPath = (pathname: string) => {\n return `${this.BASE}${pathname.replace(\"/\", \"\")}`;\n };\n\n chekToken = async () => {\n const res = await checkTokenApi();\n if (!!res && this.isLoginPathname) window.location.replace(this.BASE);\n return res;\n };\n\n getLoginMethod = async () => {\n return getLoginMethodApi();\n };\n\n redirectBaseLogin = async () => {\n const pathname = window.location.pathname;\n const url = window.location.href;\n if (this.isLoginPathname) return true;\n const urlParams = new URLSearchParams();\n if (pathname !== this.BASE && pathname !== \"/\")\n urlParams.append(\"redirectUrl\", url);\n const searchString = decodeURIComponent(urlParams.toString());\n window.location.replace(\n `${this.baseLoginPathname}${\n !!searchString ? \"?\" + decodeURIComponent(urlParams.toString()) : \"\"\n }`\n );\n return false;\n };\n\n checkPassword = async () => {\n const res = await checkPasswordApi();\n if (res === \"noPass\") {\n // 临时清除token,待修改完密码后恢复\n this.tokenValue = await extractTokenApi();\n return false;\n }\n return true;\n };\n\n refactorToken = async () => {\n await refactorTokenApi(this.tokenValue);\n };\n\n login = async (params: BaseLoginParams) => {\n const res = await this.baseLogin(params);\n if (res.error) return res;\n return res;\n };\n\n private baseLogin = async (params: BaseLoginParams) => {\n const result: {\n error?: LoginErrorType;\n data?: LoginResultData;\n } = {\n error: undefined,\n data: undefined,\n };\n try {\n //其他登录方式未补充完\n const res = await accountLoginApi(params);\n const { userToken, traceId } = res;\n if (userToken) {\n result.data = res;\n const checked = await this.checkPassword();\n if (!checked) result.error = \"passwordExpiration\";\n return result;\n }\n //traceId 需要第三方验证 //验证码之后的由业务自行判断\n if (traceId) {\n result.data = res;\n result.error = \"SLIDER_VERIFICATION_LOGIN\";\n return result;\n }\n result.error = \"passwordError\";\n return result;\n } catch (err) {\n result.error = \"validateError\";\n return result;\n }\n };\n\n loginSuccess = () => {\n const params = new URLSearchParams(window.location.search);\n let url = params.get(\"redirectUrl\");\n if (url) window.location.href = url;\n else window.location.replace(this.BASE);\n };\n baseLoginOut = async () => {\n const params = new URLSearchParams();\n const url = window.location.href;\n if (window.location.pathname !== this.BASE)\n params.append(\"redirectUrl\", url);\n await accountLogoutApi();\n window.location.replace(`${this.baseLoginPathname}?${params.toString()}`);\n };\n}\n","import request from '@core/request';\nimport { AccountLoginParams } from './types';\n//获取登录方式\n// 获取登录方式\nexport function getLoginMethodApi() {\n return request('/authentication/getLoginMethod', {\n serviceId: 'fwSecurity',\n });\n}\n\n// 检查登录状态\nexport function checkTokenApi() {\n return request(\n '/authentication/checkToken',\n {\n serviceId: 'fwSecurity',\n },\n { showError: false },\n );\n}\n\nexport function accountLoginApi(params: AccountLoginParams) {\n return request('/authentication/login', {\n data: params,\n serviceId: 'fwSecurity',\n });\n}\n\n// 登出\nexport function accountLogoutApi() {\n return request('/authentication/logout', {\n data: {},\n serviceId: 'fwSecurity',\n });\n}\n\n// 进入代理\nexport function delegateLoginApi(params: any) {\n return request('/delegateAuth/delegateLogin', {\n data: params,\n serviceId: 'fwSecurity',\n });\n}\n\n// 退出代理\nexport function delegateLogoutApi(params: any) {\n return request('/delegateAuth/delegateLogout', {\n data: params,\n serviceId: 'fwSecurity',\n });\n}\n","import request from '@core/request';\nimport { BeforeLoginCheckCodeParams } from './types';\n\n// 登录之后校验二次验证码\nexport function beforeLoginCheckCodeApi(payload: BeforeLoginCheckCodeParams) {\n return request('/authentication/beforeLoginCheckCode', {\n method: 'POST',\n data: {\n ...payload,\n },\n serviceId: 'fwSecurity',\n });\n}\n// 检测登录密码是否需要重置\nexport function checkPasswordApi() {\n return request(\n '/security/checkPasswordUpdateTime',\n { data: {} },\n { showError: false },\n );\n}\n\n// 提取token\nexport function extractTokenApi() {\n return request('/authentication/extractToken', { data: {} });\n}\n\n// 恢复token\nexport function refactorTokenApi(tokenValue: string) {\n return request('/authentication/refactorToken', {\n data: { value: tokenValue },\n });\n}\n","import { SSOConfigType } from \"../type\";\nimport { checkAuthConfigApi } from \"./services\";\n\nconst defaultSsoConfig = {\n sso: false,\n ssoUrlSearchParams: [\"ticket\"],\n ssoCheckTokenUrl: \"\",\n ssoSuccessUrlkey: \"successUrl\",\n ssoLoginUrl: window.location.origin + \"/fwSecurity/ssoAuth/login.api\",\n ssologinOutUrl: window.location.origin + \"fwSecurity/ssoAuth/logout.api\",\n};\n\nexport default class SSOLogin {\n init(ssoConfig?: SSOConfigType) {\n this.ssoConfig = { ...this.ssoConfig, ...ssoConfig };\n }\n private ssoConfig: Required<SSOConfigType> = defaultSsoConfig;\n\n isSso = async (ssoCallback?: () => boolean) => {\n if (!this.ssoConfig.sso) return false;\n let sso = false;\n try {\n sso = await checkAuthConfigApi();\n } catch (error) {\n console.error(\"sso\", error);\n }\n if (ssoCallback) {\n sso = await ssoCallback();\n }\n return !!sso;\n };\n\n ssoLogin = () => {\n //在检测cookie中是否包含userIdentity信息\n const { ssoSuccessUrlkey, ssoUrlSearchParams, ssoLoginUrl } =\n this.ssoConfig;\n const params = new URLSearchParams(window.location.search.slice(1));\n const ssoParams = new URLSearchParams();\n const url = window.location.href;\n ssoParams.append(ssoSuccessUrlkey, encodeURIComponent(url));\n ssoUrlSearchParams.map((key) => {\n const value = params.get(key);\n if (value) ssoParams.append(key, value);\n });\n //待补充sso检测\n window.location.href = `${ssoLoginUrl}?${ssoParams.toString()}`;\n\n return false;\n };\n\n ssoLoginOut = () => {\n window.location.href = this.ssoConfig.ssologinOutUrl;\n };\n}\n","import request from '@core/request';\n// 检测三方是否配置sso登录\nexport function checkAuthConfigApi() {\n return request('/ssoAuthConfig/checkOnlyRedirect', {}, { showError: false });\n}\n// 验证ssoToken并转换为甘棠Token, 写入到Cookie中\nexport function ssoLoginApi(params: any) {\n const { ssoTokenType, ssoToken } = params;\n return request(\n `/authentication/ssoLogin?tokenType=${ssoTokenType}&token=${ssoToken}`,\n {\n serviceId: 'fwSecurity',\n },\n );\n}\n","import {\n getValidateCodeApi,\n sliderVerificationCodeApi,\n checkCaptchaApi,\n GetValidateCodeParams,\n CaptchaCheckParams,\n} from './services';\nexport default class ValidateLogin {\n getValidateCodeImage = (params: GetValidateCodeParams) => {\n return getValidateCodeApi(params);\n };\n sliderVerificationCodeImage = () => {\n return sliderVerificationCodeApi();\n };\n checkCaptcha = (params: CaptchaCheckParams) => {\n return checkCaptchaApi(params);\n };\n}\n","import request from '@core/request';\nimport { CaptchaCheckParams } from './types';\n\n//获取验证码\nexport function getValidateCodeApi(params = {}) {\n return request('/authentication/getValidateCode', {\n data: params,\n serviceId: 'fwSecurity',\n });\n}\n\n//获取滑块验证码\nexport function sliderVerificationCodeApi() {\n return request('/authentication/sliderVerificationCode', {\n method: 'POST',\n serviceId: 'fwSecurity',\n });\n}\n\n//校验滑块验证码\nexport function checkCaptchaApi(payload: CaptchaCheckParams) {\n return request('/authentication/checkCaptcha', {\n method: 'POST',\n data: {\n ...payload,\n },\n serviceId: 'fwSecurity',\n });\n}\n","import BaseLogin from \"./base\";\nimport SSOLogin from \"./sso\";\nimport ValidateLogin from \"./validate\";\nimport {\n BeforeLoginCheckCodeParams,\n beforeLoginCheckCodeApi,\n} from \"./services\";\nimport type { LOGIN_CONFIG } from \"../../../cli/interfaces\";\nexport default class LoginStore extends BaseLogin {\n ssoLogin: SSOLogin;\n validate: ValidateLogin;\n noCheckPermissionsPath?: string[] = [];\n ssoCallback?: () => boolean;\n constructor() {\n super();\n this.ssoLogin = new SSOLogin();\n this.validate = new ValidateLogin();\n }\n init = (\n loginConfig?: LOGIN_CONFIG,\n base = \"/\",\n ssoCallback?: () => boolean\n ) => {\n this.BASE = base;\n this.ssoCallback = ssoCallback;\n this.noCheckPermissionsPath = loginConfig?.noCheckPermissionsPath;\n this.ssoLogin.init(loginConfig);\n this.loginPathname = loginConfig?.loginPathname || \"/login\";\n };\n isNoLoginRequiredPage = () => {\n const pathname = window.location.pathname;\n const isNoLogin = this.noCheckPermissionsPath?.some((itemPath) => {\n return this.getRealPath(itemPath) == pathname;\n });\n return isNoLogin;\n };\n loginOut = async () => {\n const isSSO = await this.ssoLogin.isSso(this.ssoCallback);\n if (isSSO) this.ssoLogin.ssoLoginOut();\n await this.baseLoginOut();\n };\n loginAuthentication = async (params: BeforeLoginCheckCodeParams) => {\n await beforeLoginCheckCodeApi(params);\n this.loginSuccess();\n return;\n };\n redirectLogin = async () => {\n if (this.isNoLoginRequiredPage()) return true;\n const isSSO = await this.ssoLogin.isSso(this.ssoCallback);\n if (isSSO) {\n this.ssoLogin.ssoLogin();\n return false;\n }\n if (this.isLoginPathname) return true;\n return await this.redirectBaseLogin();\n };\n}\n","import {\n findUserAggregateInfoApi,\n getPlatformAggregateInfoApi,\n} from \"./services\";\nimport CodeListStoreInstance from \"../codelist\";\nimport ParameterStoreInstance from \"../parameter\";\nimport websocket from \"../websocket\";\nimport UserStore from \"../user\";\nimport MenuStore from \"../menu\";\nimport LoginStore from \"../login\";\nimport {\n UserAggregateInfo,\n Language,\n ProductInfo,\n ServerMenuData,\n GlobalOptions,\n} from \"../type\";\nimport { isEmpty } from \"lodash-es\";\nclass GlobalStoreClass {\n //无需登录验证的页面\n userStore: UserStore;\n menuStore: MenuStore;\n loginStore: LoginStore;\n isSuperAdmin: boolean = false;\n loginCallback?: () => void;\n constructor() {\n this.userStore = new UserStore();\n this.menuStore = new MenuStore();\n this.loginStore = new LoginStore();\n }\n platformLanguages: Language[] = [];\n productInfo: ProductInfo = {\n isProdEnv: false,\n productName: \"\",\n };\n get isPrd() {\n return this.productInfo?.isProdEnv;\n }\n get userInfo() {\n return this.userStore.currentUser;\n }\n\n get menuData() {\n return this.menuStore.menuData;\n }\n\n findPlantform = async () => {\n const res = await getPlatformAggregateInfoApi();\n this.platformLanguages = res.platformLanguages;\n this.productInfo = res.productInfo;\n };\n getAggregateInfo = async (\n menus?: ServerMenuData | ((res: UserAggregateInfo) => ServerMenuData)\n ) => {\n const res: UserAggregateInfo = await findUserAggregateInfoApi();\n\n const { user: currentUser, startMenus, isSuperAdmin, ...restInfo } = res;\n\n this.userStore.setUserAggregateInfo({ ...restInfo, currentUser });\n\n this.isSuperAdmin = isSuperAdmin;\n\n const localeMenus = typeof menus == \"function\" ? await menus(res) : menus;\n\n this.menuStore.init(\n isEmpty(localeMenus) ? startMenus : localeMenus,\n currentUser.id\n );\n };\n init = async (options: GlobalOptions) => {\n const { base = \"/\", menuData, loginSuccessCallback, ssoCallback,websocket:_startwebsocket=true } = options;\n this.loginStore.init(options?.loginConfig, base, ssoCallback);\n try {\n //检查token\n const res = await this.loginStore.chekToken();\n if (res) {\n //登录状态下获取聚合信息 保存header\n this.userStore.setUserIdentity(res);\n await this.getAggregateInfo(menuData);\n await CodeListStoreInstance.findAllCodeList();\n await ParameterStoreInstance.findAllParameters();\n //websocket注册\n if(_startwebsocket) websocket.init(this.userStore.currentUser.userLoginName);\n await loginSuccessCallback?.();\n return true;\n }\n //未登录情况下跳转到登录\n return await this.loginStore.redirectLogin();\n } catch (error) {\n console.error(error);\n }\n return false;\n };\n}\n\nconst globalStore = new GlobalStoreClass();\n\nexport default globalStore;\n","import request from '@core/request';\nexport async function findUserAggregateInfoApi() {\n return request('/security/findUserAggregateInfo', {\n method: 'POST',\n });\n}\n\n// 获取平台信息\nexport function getPlatformAggregateInfoApi() {\n return request(\n '/platformManage/getPlatformAggregateInfo',\n {\n method: 'POST',\n },\n { showError: false },\n );\n}\n","const companyVersion = 'company-v1';\nimport {\n getCompanyDataApi,\n setCompanyDataApi,\n delCompanyDataApi,\n} from './services';\nclass CompanyData {\n data: any = {};\n getCompanyDataType = (dataType: string) => {\n return `${companyVersion}-${dataType}`;\n };\n getCompanyData = async (dataType: string) => {\n const key = this.getCompanyDataType(dataType);\n if (!!this.data[key]) {\n return this.data[key];\n }\n const res = await getCompanyDataApi({ dataType, dataId: companyVersion });\n const bigData = res?.bigData ? JSON.parse(res.bigData) : undefined;\n this.data[key] = bigData;\n };\n updateCompanyData = async (dataType: string, data: any) => {\n const key = this.getCompanyDataType(dataType);\n await setCompanyDataApi({\n dataType,\n dataId: companyVersion,\n bigData: JSON.stringify(data),\n });\n this.data[key] = data;\n return data;\n };\n removeCompanyData = async (dataType: string) => {\n const key = this.getCompanyDataType(dataType);\n await delCompanyDataApi({ dataType, dataId: companyVersion });\n delete this.data[key];\n };\n}\n\nexport default new CompanyData();\n","import request from '@core/request';\nexport type CompanyDataParams = {\n dataType: string;\n dataId: string;\n bigData?: string;\n};\n\n//公司定制化数据接口\nexport async function setCompanyDataApi(params: CompanyDataParams) {\n return request('/companyData/setCompanyData', {\n data: params,\n serviceId: 'fwSecurity',\n });\n}\n\n//获取公司定制化信息\nexport async function getCompanyDataApi(params: CompanyDataParams) {\n return request('/companyData/getCompanyData', {\n data: params,\n serviceId: 'fwSecurity',\n });\n}\n\n//删除公司定制化信息\nexport async function delCompanyDataApi(params: CompanyDataParams) {\n return request('/companyData/delCompanyData', {\n data: params,\n serviceId: 'fwSecurity',\n });\n}\n","import CodeListStoreInstance from './codelist';\nimport ParameterStoreInstance from './parameter';\nimport websocket from './websocket';\nimport progress from './progress';\nimport globalStore from './global';\nimport companydataStore from './companydata';\nimport { storage as storageStore } from './storage';\nexport type * from './type';\n\nconst codeListStore = CodeListStoreInstance;\nconst parameterStore = ParameterStoreInstance;\nconst userStore = globalStore.userStore;\nconst loginStore = globalStore.loginStore;\nconst menuStore = globalStore.menuStore;\n\nexport {\n globalStore,\n codeListStore,\n parameterStore,\n websocket,\n progress,\n userStore,\n loginStore,\n menuStore,\n companydataStore,\n storageStore,\n};\nexport { MENU_HISTORY_UPDATE, MENU_BREADCRUMBS_UPDATE } from './menu';\nexport { PROGRESS_UPDEDATE } from './progress';\nexport {\n WS_CONTENT_CLOSE,\n WS_CONTENT_ERROR,\n WS_CONTENT_SUCCESS,\n} from './websocket';\n"],"names":["codeListStoreInstance","codeLists","codeMaps","findAllCodeList","data","request","serviceId","dataMap","groupBy","this","getCodeLocaleList","codeType","getCodeLocaleName","value","codeList","getName","code","find","item","String","name","Array","isArray","text","reduce","res","slice","length","indexOf","valueArr","replace","split","parameterStoreInstance","parameterList","parameterMap","findAllParameters","async","showError","keyBy","getSystemParameterByName","pick","pingMsg","pongMsg","WS_CONTENT_SUCCESS","WS_CONTENT_ERROR","WS_CONTENT_CLOSE","websocket","RECIPIENT_TYPE_ALL","RECIPIENT_TYPE_USER","RECIPIENT_TYPE_OBSERVER","RECIPIENT_TYPE_CONNECTION","webSocketUrl","ws","repeat","connectLoading","disReconnect","pingTimeoutFn","pongTimeoutFn","reconnectFn","repeatLimit","connectionId","userLoginName","eventStack","constructor","init","options","paramStr","host","protocol","port","hostname","window","location","isHttps","includes","wsProtocol","wsHost","parseInt","getWebSocketUrl","get","createWebSocket","WebSocket","registerEvent","error","reconnect","clearTimeout","setTimeout","heartCheck","msg","send","close","heartReset","disconnect","readyState","onopen","onmessage","e","dataStr","JSON","parse","content","wsdata","senderTime","emitter","emit","Object","keys","map","eventId","itemEevent","isIncludes","recipientType","event","recipientCode","err","console","warn","onerror","onclose","addTypeListener","type","eventType","id","uniqueId","removeListener","omit","PROGRESS_UPDEDATE","Progress","websocketId","progressObserver","progressEvent","itemObserver","updedataProgress","newProgress","isEmpty","push","addProgressListener","removeProgressListener","requestProgress","url","headers","observerId","Date","getDate","progressId","response","post","params","getParams","success","storage","prefixKey","localStorage","getKey","key","toUpperCase","set","expire","DEFAULT_CACHE_TIME","stringData","stringify","getTime","setItem","def","getItem","now","remove","removeItem","clear","setCookie","document","cookie","getCookie","cookieArr","i","kv","removeCookie","clearCookie","match","toUTCString","createStorage","UserStore","userIdentity","currentUser","isSuperAdmin","roles","functions","delegations","userSetting","users","getUserIdentity","localUserIdentity","setUserIdentity","identity","clearUserIdentity","setUserAggregateInfo","getUserSettingType","dataType","getUserSetting","userId","getUserDataApi","dataId","bigData","undefined","updateUserSetting","setUserDataApi","removeUserSetting","delUserDataApi","getUserInfo","index","findIndex","itemUser","userInfo","method","getUserByUserLoginNameApi","getUserByIdApi","isPlainObject","httpsRegexp","httpRegexp","getItemPath","path","test","MENU_HISTORY_UPDATE","MENU_BREADCRUMBS_UPDATE","MenuStore","menuDataMaps","menuData","menuPathMaps","breadcrumbs","menuHistorys","addListenerMenuHistorys","listener","on","removeListenerMenuHistorys","off","addListenerBreadcrumbs","removeListenerBreadcrumbs","getTreeMenuData","childrenGroup","parentPath","leaf","childrenData","newItem","children","sort","a","b","seqNum","cloneMenuData","cloneDeep","groupObj","ROOT","mapValues","updateMenuMaps","initMenuHistorys","newHistorys","itemName","pathname","newBreadcrumbs","updatehistorys","updateBreadcrumbs","liseterHistorys","historys","some","uniqBy","liseterBreadcrumbs","array","current","itemPathname","join","BaseLogin","loginPathname","BASE","baseLoginPathname","tokenValue","isLoginPathname","getRealPath","chekToken","getLoginMethod","redirectBaseLogin","href","urlParams","URLSearchParams","append","searchString","decodeURIComponent","toString","checkPassword","refactorToken","login","baseLogin","result","accountLoginApi","userToken","traceId","loginSuccess","search","baseLoginOut","defaultSsoConfig","sso","ssoUrlSearchParams","ssoCheckTokenUrl","ssoSuccessUrlkey","ssoLoginUrl","origin","ssologinOutUrl","SSOLogin","ssoConfig","isSso","ssoCallback","ssoLogin","ssoParams","encodeURIComponent","ssoLoginOut","ValidateLogin","getValidateCodeImage","getValidateCodeApi","sliderVerificationCodeImage","checkCaptcha","payload","LoginStore","validate","noCheckPermissionsPath","super","loginConfig","base","isNoLoginRequiredPage","isNoLogin","itemPath","loginOut","loginAuthentication","redirectLogin","globalStore","userStore","menuStore","loginStore","loginCallback","platformLanguages","productInfo","isProdEnv","productName","isPrd","findPlantform","getAggregateInfo","menus","findUserAggregateInfoApi","user","startMenus","restInfo","localeMenus","loginSuccessCallback","_startwebsocket","CodeListStoreInstance","ParameterStoreInstance","companyVersion","getCompanyDataType","getCompanyData","getCompanyDataApi","updateCompanyData","setCompanyDataApi","removeCompanyData","delCompanyDataApi","codeListStore","parameterStore"],"mappings":"uRA+DA,MAAMA,EAAwB,IAzC9B,MACEC,UAAsB,GACtBC,SAAqB,CAAA,EACrB,qBAAMC,GACJ,MACMC,QCxBDC,EAAQ,oBAAqB,CAClCD,KAAM,CAAE,EACRE,UAAW,gBDsBS,GACdC,EAAUC,EAAQJ,EAAM,QAC9BK,KAAKR,UAAYG,EACjBK,KAAKP,SAAWK,CACjB,CACDG,kBAAqBC,GACZ,IAAIF,KAAKP,WAAWS,KAAc,GAE3CC,kBAAoB,CAACD,EAAkBE,KACrC,MAAMC,EAAWL,KAAKC,kBAAkBC,GACxC,SAASI,EAAQF,GACf,MAAMG,EAAOC,EAAKH,GAAWI,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AAiC+G,GACtC,OAAO9I,EAAQ,8BAA+B,CAC5CD,KAAM+I,EACN7I,UAAW,cAEf,CDLsB+V,CAAkB,CAAEhK,WAAUI,OAAQyJ,IAClDxJ,EAAUjL,GAAKiL,QAAUxG,KAAKC,MAAM1E,EAAIiL,cAAWC,EACzDlM,KAAKL,KAAKsJ,GAAOgD,CAAO,EAE1B4J,kBAAoBlU,MAAOiK,EAAkBjM,KAC3C,MAAMsJ,EAAMjJ,KAAK0V,mBAAmB9J,GAOpC,aCpBGjK,eAAiC+G,GACtC,OAAO9I,EAAQ,8BAA+B,CAC5CD,KAAM+I,EACN7I,UAAW,cAEf,CDSUiW,CAAkB,CACtBlK,WACAI,OAAQyJ,EACRxJ,QAASxG,KAAK8D,UAAU5J,KAE1BK,KAAKL,KAAKsJ,GAAOtJ,EACVA,CAAI,EAEboW,kBAAoBpU,MAAOiK,IACzB,MAAM3C,EAAMjJ,KAAK0V,mBAAmB9J,SCPjCjK,eAAiC+G,GACtC,OAAO9I,EAAQ,8BAA+B,CAC5CD,KAAM+I,EACN7I,UAAW,cAEf,CDGUmW,CAAkB,CAAEpK,WAAUI,OAAQyJ,WACrCzV,KAAKL,KAAKsJ,EAAI,GExBnB,MAAAgN,EAAgBV,EAChBW,EAAiBV,EACjBpB,EAAYD,EAAYC,UACxBE,EAAaH,EAAYG,WACzBD,EAAYF,EAAYE"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/core/store/codelist/index.ts","../../../src/core/store/codelist/services.ts","../../../src/core/store/parameter/index.ts","../../../src/core/store/parameter/services.ts","../../../src/core/store/websocket.ts","../../../src/core/store/progress.ts","../../../src/core/store/storage.ts","../../../src/core/store/user/index.ts","../../../src/core/store/user/services.ts","../../../src/core/store/menu/index.ts","../../../src/core/store/login/base.ts","../../../src/core/store/login/services/base.ts","../../../src/core/store/login/services/authentication.ts","../../../src/core/store/login/sso.ts","../../../src/core/store/login/services/sso.ts","../../../src/core/store/login/validate.ts","../../../src/core/store/login/services/validate.ts","../../../src/core/store/login/index.ts","../../../src/core/store/global/index.ts","../../../src/core/store/global/services.ts","../../../src/core/store/companydata/index.ts","../../../src/core/store/companydata/services.ts","../../../src/core/store/index.ts"],"sourcesContent":["import { findAllCodeListApi } from './services';\nimport { groupBy, find, reduce } from 'lodash-es';\n\nexport interface CodeTypeGroup {\n codeTypeId: string;\n id: string;\n isGroup: boolean;\n name: string;\n type: string;\n typeName: string;\n value: string;\n}\n\nexport interface CodeTypeChild extends CodeTypeGroup {\n groupId: string;\n}\n\nexport type CodeTypeItem = CodeTypeChild | CodeTypeGroup;\nexport type CodeList = CodeTypeItem[];\nexport type CodeValue = Record<string, any>;\nexport type CodeMaps = { [name: string]: CodeList };\n\nclass CodeListStore {\n codeLists: CodeList = [];\n codeMaps: CodeMaps = {};\n async findAllCodeList() {\n const res = await findAllCodeListApi();\n const data = res || [];\n const dataMap = groupBy(data, 'type');\n this.codeLists = data;\n this.codeMaps = dataMap;\n }\n getCodeLocaleList = (codeType: string) => {\n return [...this.codeMaps?.[codeType]] || [];\n };\n getCodeLocaleName = (codeType: string, value: string) => {\n const codeList = this.getCodeLocaleList(codeType);\n function getName(value: string): string {\n const code = find(codeList, (item: any) => item.value === String(value));\n return code?.name || '';\n }\n if (Array.isArray(value)) {\n const text = reduce(\n value,\n (res = '', value = '') => res + ',' + getName(value),\n '',\n );\n return text.slice(1, text.length);\n } else if (String(value).indexOf(',') >= 0) {\n const str = value.replace('[', '').replace(']', '');\n const valueArr = str.split(',');\n const text = reduce(\n valueArr,\n (res = '', value = '') => res + ',' + getName(value),\n '',\n );\n return text.slice(1, text.length);\n } else {\n return getName(value);\n }\n };\n}\n\nconst codeListStoreInstance = new CodeListStore();\nexport const getCodeLocaleList = codeListStoreInstance.getCodeLocaleList;\nexport const getCodeLocaleName = codeListStoreInstance.getCodeLocaleName;\nexport default codeListStoreInstance;\n","import request from '@core/request';\n\nexport function findAllCodeListApi() {\n return request('/codeList/findAll', {\n data: {},\n serviceId: 'fwPlatform',\n });\n}\n","import { findSystemParameterApi } from './services';\nimport { keyBy, pick } from 'lodash-es';\n\nexport interface ParameterItem {\n catalog: string;\n description: string;\n id: string;\n name: string;\n optCounter: number;\n type: string;\n value: string;\n}\n\nexport type ParameterList = ParameterItem[];\nexport type ParameterMaps = { [name: string]: ParameterItem };\n\nclass ParameterStoreClass {\n parameterList: ParameterList = [];\n parameterMap: ParameterMaps = {};\n findAllParameters= async()=>{\n const res = await findSystemParameterApi();\n const data = res || [];\n const dataMap: any = keyBy(data, 'name');\n this.parameterList = data;\n this.parameterMap = dataMap;\n }\n /**\n * 获取系统参数,可以一次指定获取多个参数(传入数组)\n * @param name {string | string[]} 需要获取到的参数的key\n * @returns 返回根据key查询到一个参数对象\n */\n getSystemParameterByName =(name: string | string[])=> {\n if (typeof name === 'string') return this.parameterMap[name];\n return pick(this.parameterMap, name);\n }\n}\n\nconst parameterStoreInstance = new ParameterStoreClass();\n\nexport default parameterStoreInstance;\n","import request from '@core/request';\n//获取系统参数\nexport function findSystemParameterApi() {\n return request(\n '/parameter/findAll',\n {\n serviceId: 'fwPlatform',\n data: {},\n },\n {\n showError: false,\n },\n );\n}\n","import { uniqueId, get, omit } from \"lodash-es\";\nimport emitter from \"@core/event\";\n//计算最终的WebSocketUrl\nconst pingMsg = \"ping\"; //客户端心跳信息\nconst pongMsg = \"pong\"; //服务端心跳信息\nconst reconnectTimeout = 10000;\nconst pingPongTimeout = 10000; //发送的心跳的间隔时间\nexport interface WEBSOCKETRECROD {\n id: string;\n recipientType: string;\n recipientCode: string;\n title?: string;\n status?: \"01\" | \"00\";\n senderName?: string;\n senderTime?: string;\n content: string;\n linkUri?: string;\n linkName?: string;\n progress?: number;\n}\nexport const WS_CONTENT_SUCCESS = \"WS_CONTENT_SUCCESS\";\nexport const WS_CONTENT_ERROR = \"WS_CONTENT_ERROR\";\nexport const WS_CONTENT_CLOSE = \"WS_CONTENT_CLOSE\";\nconst getWebSocketUrl = (userLoginName: string) => {\n const suffix = \"notification-ws\";\n const paramStr = `userLoginName=${userLoginName}`;\n const { host, protocol, port, hostname } = window.location;\n //是否是https\n const isHttps = protocol.includes(\"https\");\n //ws协议\n let wsProtocol = isHttps ? \"wss\" : \"ws\";\n //默认是host\n let wsHost: string = host;\n //如果不是是https并且有端口号时,ws端口就是web端口+1\n if (!isHttps && port) {\n let newhost = parseInt(port);\n wsHost = `${hostname}:${newhost}`;\n }\n const wsAddress = `${wsProtocol}://${wsHost}/${suffix}?${paramStr}`;\n return wsAddress;\n};\n\ntype GantWebSocketOptions = {\n disReconnect?: boolean;\n repeatLimit?: null | undefined | number;\n};\nexport class GantWebSocket {\n RECIPIENT_TYPE_ALL = \"all\"; // 所有用户均可收到的消息类型【公告等消息】\n RECIPIENT_TYPE_USER = \"user\"; // 某个用户可以收到【用户通知】\n RECIPIENT_TYPE_OBSERVER = \"obsvr\"; // 某个观察者可以收到【接口处理进度】\n RECIPIENT_TYPE_CONNECTION = \"conn\"; // 某个连接成功接收到【ws连接专用】\n //链接地址\n private webSocketUrl: string = \"\";\n // WebSocket\n private ws: WebSocket | null = null;\n //重链次数\n private repeat = 0;\n // 链接状态\n private connectLoading = false;\n\n //禁止重链\n private disReconnect = false;\n\n private pingTimeoutFn: null | NodeJS.Timeout = null;\n private pongTimeoutFn: null | NodeJS.Timeout = null;\n private reconnectFn: null | NodeJS.Timeout = null;\n\n //是否限制次数\n private repeatLimit: null | undefined | number = 2;\n\n //链接标识\n connectionId: string = \"\";\n private userLoginName: string = \"\";\n\n private eventStack: {\n [name: string]: {\n type: \"recipientType\" | \"message\";\n recipientType: string[];\n event: (data: WEBSOCKETRECROD) => void;\n };\n } = {};\n constructor() {}\n\n init = (userLoginName: string, options?: GantWebSocketOptions) => {\n this.userLoginName = userLoginName;\n this.webSocketUrl = getWebSocketUrl(userLoginName);\n this.disReconnect = get(options, \"disReconnect\", false);\n this.repeatLimit = get(options, \"repeatLimit\", 20);\n this.createWebSocket();\n };\n createWebSocket = () => {\n this.connectLoading = true;\n try {\n this.ws = new WebSocket(this.webSocketUrl);\n this.registerEvent();\n } catch (error) {\n this.ws = null;\n this.reconnect();\n } finally {\n this.connectLoading = false;\n }\n };\n //重新链接\n reconnect = () => {\n if (this.reconnectFn) clearTimeout(this.reconnectFn);\n if (!!this.repeatLimit && this.repeatLimit <= this.repeat) return;\n if (this.connectLoading || this.disReconnect || this.ws) return;\n this.repeat++;\n this.reconnectFn = setTimeout(() => {\n this.createWebSocket();\n }, reconnectTimeout);\n };\n //链接状态检查\n heartCheck = () => {\n this.repeat = 0;\n if (this.disReconnect) return;\n this.pingTimeoutFn = setTimeout(() => {\n const msg = `{\"userLoginName\":\"${this.userLoginName}\",\"connectionId\":\"${this.connectionId}\",\"content\":\"${pingMsg}\"}`;\n this.ws?.send(msg);\n this.pongTimeoutFn = setTimeout(() => {\n this.ws?.close();\n }, pingPongTimeout);\n }, pingPongTimeout);\n };\n\n heartReset = () => {\n if (this.pingTimeoutFn) {\n clearTimeout(this.pingTimeoutFn);\n this.pingTimeoutFn = null;\n }\n if (this.pongTimeoutFn) {\n clearTimeout(this.pongTimeoutFn);\n this.pongTimeoutFn = null;\n }\n };\n\n //主动断开连接\n disconnect = () => {\n this.heartReset();\n this.ws?.readyState == 1 && this.ws?.close();\n this.ws = null;\n };\n\n //注册事件\n registerEvent = () => {\n if (!this.ws) return;\n this.ws.onopen = () => {\n this.heartCheck();\n };\n this.ws.onmessage = (e) => {\n this.heartReset();\n this.heartCheck();\n const dataStr = e.data;\n try {\n //忽略心跳回复信息\n if (\n dataStr == pongMsg ||\n JSON.parse(dataStr).content == pingMsg ||\n JSON.parse(dataStr).content == pongMsg\n )\n return;\n const wsdata: WEBSOCKETRECROD = JSON.parse(dataStr);\n const data = {\n ...wsdata,\n senderTime: wsdata.senderTime,\n };\n emitter.emit(WS_CONTENT_SUCCESS, data);\n Object.keys(this.eventStack).map((eventId) => {\n const itemEevent = this.eventStack[eventId];\n const isIncludes = itemEevent.recipientType?.includes(\n data.recipientType\n );\n if (isIncludes) itemEevent?.event?.(data);\n });\n //存储服务端连接成功后的第一次响应返回的标识id\n if (data.recipientType == this.RECIPIENT_TYPE_CONNECTION) {\n this.connectionId = data.recipientCode;\n return;\n }\n } catch (err) {\n console.warn(\"received error!!!\", err);\n }\n };\n this.ws.onerror = () => {\n this.heartReset();\n this.reconnect();\n emitter.emit(WS_CONTENT_ERROR);\n };\n this.ws.onclose = () => {\n console.warn(\"webSocket close\");\n this.ws = null;\n this.heartReset();\n this.reconnect();\n emitter.emit(WS_CONTENT_CLOSE);\n };\n };\n\n addTypeListener = (\n type: string | string[],\n event: (data: WEBSOCKETRECROD) => void\n ) => {\n const eventType = Array.isArray(type) ? type : [type];\n const id = uniqueId();\n this.eventStack[id] = {\n recipientType: eventType,\n type: \"recipientType\",\n event,\n };\n return id;\n };\n removeListener = (id: string | string[]) => {\n this.eventStack = omit(this.eventStack, id);\n };\n}\nconst websocket = new GantWebSocket();\nexport default websocket;\n","import websocket, { WEBSOCKETRECROD } from './websocket';\nimport request from '@core/request';\nimport { uniqueId, omit, isEmpty } from 'lodash-es';\nimport emitter from '@core/event';\nconst { RECIPIENT_TYPE_OBSERVER } = websocket;\nexport interface ProgressOptions {\n type?: string;\n options?: any;\n data?: WEBSOCKETRECROD;\n}\nexport const PROGRESS_UPDEDATE = 'PROGRESS_UPDEDATE';\nexport class GantProgress {\n websocketId: string;\n private progressObserver: { [id: string]: ProgressOptions } = {};\n constructor() {\n this.websocketId = websocket.addTypeListener(RECIPIENT_TYPE_OBSERVER, this.progressEvent);\n }\n progressEvent(data: WEBSOCKETRECROD) {\n Object.keys(this.progressObserver).map(id => {\n const itemObserver = this.progressObserver[id];\n if (data?.recipientCode === itemObserver.type) {\n this.progressObserver[id] = {\n ...itemObserver,\n data: data,\n };\n }\n });\n this.updedataProgress();\n }\n\n updedataProgress() {\n const newProgress: ProgressOptions[] = [];\n Object.keys(this.progressObserver).map(id => {\n const itemObserver = this.progressObserver[id];\n if (!isEmpty(itemObserver?.data)) newProgress.push({ ...itemObserver });\n });\n emitter.emit(PROGRESS_UPDEDATE, newProgress);\n }\n\n addProgressListener(type: string, options?: any) {\n const id = uniqueId();\n this.progressObserver[id] = {\n type: type,\n options,\n };\n return id;\n }\n removeProgressListener(id: string) {\n this.progressObserver = omit(this.progressObserver, id);\n this.updedataProgress();\n }\n async requestProgress(\n url: string,\n options?: {\n params?: any;\n success?: (params: any) => void;\n onProgress?: (progress: number) => void;\n error?: (error: any) => void;\n headers?: any;\n getParams?: boolean;\n }\n ) {\n if (!websocket.connectionId && !options?.headers?.connectionId)\n return console.error(`WebSocket no link established`);\n const observerId = new Date().getDate() + '';\n const progressId = this.addProgressListener(observerId);\n emitter.on(PROGRESS_UPDEDATE, (items: ProgressOptions[]) => {\n const item = items.find(item => item.type === observerId);\n if (item) {\n options?.onProgress?.(item.data?.progress);\n }\n });\n try {\n const response = await request.post(\n url,\n {\n headers: {\n observerId,\n connectionId: websocket.connectionId,\n ...options?.headers,\n },\n data: options?.params,\n },\n {\n getParams: options?.getParams,\n }\n );\n options?.success?.(response);\n } catch (error) {\n console.error('--->', error);\n options?.error?.(error);\n }\n emitter.off(PROGRESS_UPDEDATE, props => {});\n this.removeProgressListener(progressId);\n }\n}\n\nconst Progress = new GantProgress();\nexport default Progress;\n","// 默认缓存期限为7天\nconst DEFAULT_CACHE_TIME = 60 * 60 * 24 * 7;\n\n/**\n * 创建本地缓存对象\n * @param {string=} prefixKey -\n * @param {Object} [storage=localStorage] - sessionStorage | localStorage\n */\nexport const createStorage = ({\n prefixKey = '',\n storage = localStorage,\n} = {}) => {\n /**\n * 本地缓存类\n * @class Storage\n */\n const StorageClass = class {\n storage = storage;\n prefixKey?: string = prefixKey;\n\n getKey(key: string) {\n return `${this.prefixKey}${key}`.toUpperCase();\n }\n\n /**\n * @description 设置缓存\n * @param {string} key 缓存键\n * @param {*} value 缓存值\n * @param expire\n */\n set(key: string, value: any, expire: number | null = DEFAULT_CACHE_TIME) {\n const stringData = JSON.stringify({\n value,\n expire: expire !== null ? new Date().getTime() + expire * 1000 : null,\n });\n this.storage.setItem(this.getKey(key), stringData);\n }\n\n /**\n * 读取缓存\n * @param {string} key 缓存键\n * @param {*=} def 默认值\n */\n get(key: string, def: any = null) {\n const item = this.storage.getItem(this.getKey(key));\n if (item) {\n try {\n const data = JSON.parse(item);\n const { value, expire } = data;\n // 在有效期内直接返回\n if (expire === null || expire >= Date.now()) {\n return value;\n }\n this.remove(key);\n } catch (e) {\n console.error(e);\n return def;\n }\n }\n return def;\n }\n\n /**\n * 从缓存删除某项\n * @param {string} key\n */\n remove(key: string) {\n this.storage.removeItem(this.getKey(key));\n }\n\n /**\n * 清空所有缓存\n * @memberOf Cache\n */\n clear(): void {\n this.storage.clear();\n }\n\n /**\n * 设置cookie\n * @param {string} name cookie 名称\n * @param {*} value cookie 值\n * @param {number=} expire 过期时间\n * 如果过期时间未设置,默认关闭浏览器自动删除\n * @example\n */\n setCookie(\n name: string,\n value: any,\n expire: number | null = DEFAULT_CACHE_TIME,\n ) {\n document.cookie = `${this.getKey(name)}=${value}; Max-Age=${expire}`;\n }\n\n /**\n * 根据名字获取cookie值\n * @param name\n */\n getCookie(name: string): string {\n const cookieArr = document.cookie.split('; ');\n for (let i = 0, length = cookieArr.length; i < length; i++) {\n const kv = cookieArr[i].split('=');\n if (kv[0] === this.getKey(name)) {\n return kv[1];\n }\n }\n return '';\n }\n\n /**\n * 根据名字删除指定的cookie\n * @param {string} key\n */\n removeCookie(key: string) {\n this.setCookie(key, 1, -1);\n }\n\n /**\n * 清空cookie,使所有cookie失效\n */\n clearCookie(): void {\n const keys = document.cookie.match(/[^ =;]+(?==)/g);\n if (keys) {\n for (let i = keys.length; i--; ) {\n document.cookie = keys[i] + '=0;expire=' + new Date(0).toUTCString();\n }\n }\n }\n };\n return new StorageClass();\n};\n\nexport const storage = createStorage();\n","import { findIndex, get, isEmpty, isPlainObject, omit } from \"lodash-es\";\nimport { storage } from \"../storage\";\nimport { UserIdentityType, User } from \"../type\";\nimport {\n getUserDataApi,\n setUserDataApi,\n delUserDataApi,\n getUserByIdApi,\n getUserByUserLoginNameApi,\n} from \"./services\";\n\nexport default class UserStore {\n userIdentity = {} as UserIdentityType; //用户身份信息\n currentUser = {} as User; //当前用户信息\n isSuperAdmin = false;\n roles: string[] = []; //用户所属角色\n functions: string[] = []; //用户授权功能点\n delegations: any[] = []; //用户代理信息\n userSetting: { [type: string]: any } = {};\n users: User[] = [];\n getUserIdentity(): UserIdentityType {\n if (!isEmpty(this.userIdentity)) return this.userIdentity;\n const localUserIdentity = storage?.get(\"userIdentity\");\n return localUserIdentity ? localUserIdentity : ({} as UserIdentityType);\n }\n setUserIdentity(identity: Partial<UserIdentityType>) {\n this.userIdentity = {\n ...this.userIdentity,\n ...identity,\n };\n storage.set(\"userIdentity\", this.userIdentity);\n return this.userIdentity;\n }\n clearUserIdentity() {\n storage.remove(\"userIdentity\");\n this.userIdentity = {} as UserIdentityType;\n }\n setUserAggregateInfo = ({\n delegations,\n roles,\n functions,\n isSuperAdmin,\n currentUser,\n }: any) => {\n this.delegations = delegations;\n this.roles = roles;\n this.functions = functions;\n this.isSuperAdmin = isSuperAdmin;\n this.currentUser = currentUser;\n };\n getUserSettingType = (dataType: string) => {\n const userId = this.currentUser.id;\n return `${userId}-${dataType}`;\n };\n getUserSetting = async (dataType: string) => {\n const key = this.getUserSettingType(dataType);\n const userId = this.currentUser.id;\n if (!!this.userSetting[key]) {\n return this.userSetting[key];\n }\n const res = await getUserDataApi({ dataType, dataId: userId+dataType });\n const bigData = res?.bigData ? JSON.parse(res.bigData) : undefined;\n this.userSetting[key] = bigData;\n return bigData;\n };\n updateUserSetting = async (dataType: string, data: any) => {\n const key = this.getUserSettingType(dataType);\n const userId = this.currentUser.id;\n await setUserDataApi({\n dataType,\n dataId: userId+dataType,\n bigData: JSON.stringify(data),\n });\n this.userSetting[key] = data;\n return data;\n };\n removeUserSetting = async (dataType: string) => {\n const key = this.getUserSettingType(dataType);\n const userId = this.currentUser.id;\n await delUserDataApi({ dataType, dataId: userId });\n delete this.userSetting[key];\n };\n getUserInfo = async (userId: string, userLoginName?: boolean) => {\n const index = findIndex(this.users, (itemUser) =>\n userLoginName ? itemUser.userLoginName === userId : itemUser.id === userId\n );\n if (index > -1) return get(this.users, `[${index}]`);\n const userInfo = userLoginName\n ? await getUserByUserLoginNameApi(userId)\n : await getUserByIdApi(userId);\n isPlainObject(userInfo) && this.users.push(userInfo);\n return userInfo;\n };\n}\n","import request, { GantServerOptions } from \"@core/request\";\n//公司定制化数据接口\nexport async function setUserDataApi(params: any, options?: GantServerOptions) {\n return request(\n \"/accountUserSelf/setUserData\",\n {\n data: params,\n serviceId: \"fwSecurity\",\n },\n options\n );\n}\n\n//获取公司定制化信息\nexport async function getUserDataApi(params: any) {\n return request(\"/accountUserSelf/getUserData\", {\n data: params,\n serviceId: \"fwSecurity\",\n });\n}\n//删除公司定制化信息\nexport async function delUserDataApi(params: any, options?: GantServerOptions) {\n return request(\n \"/accountUserSelf/delUserData\",\n {\n data: params,\n serviceId: \"fwSecurity\",\n },\n options\n );\n}\n\nexport async function getUserByIdApi(userId: string) {\n return request(\"/security/getUserById\", {\n method: \"POST\",\n data: { id: userId },\n serviceId: \"fwSecurity\",\n });\n}\n\nexport async function getUserByUserLoginNameApi(userLoginName: string) {\n return request(\"/security/getUserByUserLoginName\", {\n method: \"POST\",\n data: { userLoginName: userLoginName },\n serviceId: \"fwSecurity\",\n });\n}\n","import {\n isEmpty,\n groupBy,\n omit,\n cloneDeep,\n mapValues,\n uniqBy,\n remove,\n includes,\n} from 'lodash-es';\nimport { ServerMenuData, ServerMenuMap, ServerMenu } from '../type';\nimport emitter from '@core/event';\nimport { storage } from '../storage';\nexport const httpsRegexp =\n /^https?:\\/\\/(([a-zA-Z0-9_-])+(\\.)?)*(:\\d+)?(\\/((\\.)?(\\?)?=?&?[a-zA-Z0-9_-](\\?)?)*)*$/i;\nexport const httpRegexp =\n /^https?:\\/\\/(([a-zA-Z0-9_-])+(\\.)?)*(:\\d+)?(\\/((\\.)?(\\?)?=?&?[a-zA-Z0-9_-](\\?)?)*)*$/i;\n\nconst getItemPath = (path: string) => {\n if (httpsRegexp.test(path) || httpRegexp.test(path)) return path;\n return path?.indexOf('/') === 0 ? path : '/' + path;\n};\n\nexport const MENU_HISTORY_UPDATE = 'MENU_HISTORY_UPDATE';\nexport const MENU_BREADCRUMBS_UPDATE = 'MENU_BREADCRUMBS_UPDATE';\n\nexport default class MenuStore {\n menuDataMaps: ServerMenuMap = {};\n menuData: ServerMenuData = [];\n menuPathMaps: { [name: string]: string } = {};\n breadcrumbs: any[] = [];\n menuHistorys = [] as { pathname: string; name: string }[];\n userId?: string;\n constructor() {}\n addListenerMenuHistorys = (listener: (...args: any[]) => void) => {\n emitter.on(MENU_HISTORY_UPDATE, listener);\n };\n\n removeListenerMenuHistorys = (listener: (...args: any[]) => void) => {\n return emitter.off(MENU_HISTORY_UPDATE, listener);\n };\n addListenerBreadcrumbs = (listener: (...args: any[]) => void) => {\n return emitter.on(MENU_BREADCRUMBS_UPDATE, listener);\n };\n removeListenerBreadcrumbs = (listener: (...args: any[]) => void) => {\n return emitter.off(MENU_BREADCRUMBS_UPDATE, listener);\n };\n getTreeMenuData = (\n data: ServerMenuData,\n childrenGroup: {\n [name: string]: ServerMenuData;\n },\n parentPath?: string,\n ) => {\n return data\n .map((item) => {\n const { id, path, leaf } = item;\n const childrenData = childrenGroup[id];\n const newItem: ServerMenu = {\n ...item,\n key: id,\n path: parentPath ? parentPath + getItemPath(path) : getItemPath(path),\n };\n if (!!childrenData && !leaf) {\n const children = this.getTreeMenuData(\n childrenData,\n childrenGroup,\n newItem.path,\n );\n newItem.children = children;\n }\n this.menuDataMaps[newItem.path] = newItem;\n return newItem;\n })\n .sort((a, b) => a.seqNum - b.seqNum);\n };\n init = (menuData: ServerMenuData, userId: string) => {\n const cloneMenuData = cloneDeep(menuData);\n if (isEmpty(cloneMenuData)) return;\n const groupObj = groupBy(cloneMenuData, 'parentResourceId');\n const { ROOT, ...childrenGroup } = groupObj;\n this.menuData = this.getTreeMenuData(ROOT, childrenGroup);\n this.menuData = [...this.menuData];\n const menuPathMaps = mapValues(this.menuDataMaps, 'name');\n this.updateMenuMaps(menuPathMaps);\n this.initMenuHistorys(userId);\n return;\n };\n updateMenuMaps = (menuPathMaps: any) => {\n this.menuPathMaps = { ...this.menuPathMaps, ...menuPathMaps };\n const historys = this.menuHistorys;\n const newHistorys = historys.map((item) => {\n const itemName = this.menuPathMaps[item.pathname];\n return {\n pathname: item.pathname,\n name: itemName ? itemName : item.name,\n };\n });\n const newBreadcrumbs = this.breadcrumbs.map((item) => {\n const itemName = this.menuPathMaps[item.pathname];\n return {\n ...item,\n name: itemName ? itemName : item.name,\n };\n });\n this.updatehistorys(newHistorys);\n this.updateBreadcrumbs(newBreadcrumbs);\n };\n\n liseterHistorys = (pathname: string) => {\n let historys = this.menuHistorys;\n if (\n !this.menuDataMaps[pathname]?.leaf ||\n historys.some((item) => item.pathname === pathname)\n )\n return;\n historys = [{ pathname, name: this.menuPathMaps[pathname] }, ...historys];\n this.updatehistorys(historys);\n };\n\n updatehistorys = (historys: { pathname: string; name: string }[]) => {\n if (!this.userId) return;\n const newHistorys = historys.map((item) => {\n return {\n ...item,\n name: item.name ? item.name : this.menuPathMaps[item.pathname],\n };\n });\n this.menuHistorys = newHistorys;\n this.menuHistorys = uniqBy(this.menuHistorys, 'pathname');\n emitter.emit(MENU_HISTORY_UPDATE, this.menuHistorys);\n storage.set(`${this.userId}-menu-history`, this.menuHistorys);\n };\n initMenuHistorys = (userId: string) => {\n this.userId = userId;\n const historys = storage.get(`${userId}-menu-history`, this.menuHistorys);\n this.updatehistorys(historys);\n };\n liseterBreadcrumbs = (pathname: string) => {\n const array = pathname.split('/');\n let index = 1;\n const breadcrumbs: any[] = [];\n const current = { pathname, name: this.menuPathMaps[pathname] };\n while (index < array.length) {\n const itemPathname = array.slice(0, index).join('/');\n if (!!this.menuPathMaps[itemPathname])\n breadcrumbs.push({\n name: this.menuPathMaps[itemPathname],\n pathname: itemPathname,\n });\n index++;\n }\n breadcrumbs.push(current);\n this.updateBreadcrumbs(breadcrumbs);\n };\n updateBreadcrumbs = (breadcrumbs: any[]) => {\n this.breadcrumbs = breadcrumbs;\n this.breadcrumbs = uniqBy(this.breadcrumbs, 'pathname');\n emitter.emit(MENU_BREADCRUMBS_UPDATE, breadcrumbs);\n };\n}\n","import { LoginResultData } from \"../type\";\nimport {\n accountLoginApi,\n accountLogoutApi,\n BaseLoginParams,\n getLoginMethodApi,\n checkPasswordApi,\n extractTokenApi,\n refactorTokenApi,\n checkTokenApi,\n} from \"./services\";\nexport type LoginErrorType =\n | \"passwordError\"\n | \"validateError\"\n | \"passwordExpiration\"\n | \"SLIDER_VERIFICATION_LOGIN\";\n\nexport default class BaseLogin {\n loginPathname?: string;\n BASE: string = \"/\";\n get baseLoginPathname() {\n return `${this.BASE}${this.loginPathname?.replace(\"/\", \"\")}`;\n }\n tokenValue: string = \"\";\n\n get isLoginPathname() {\n const pathname = window.location.pathname;\n return this.baseLoginPathname == pathname;\n }\n\n getRealPath = (pathname: string) => {\n return `${this.BASE}${pathname.replace(\"/\", \"\")}`;\n };\n\n chekToken = async () => {\n const res = await checkTokenApi();\n if (!!res && this.isLoginPathname) window.location.replace(this.BASE);\n return res;\n };\n\n getLoginMethod = async () => {\n return getLoginMethodApi();\n };\n\n redirectBaseLogin = async () => {\n const pathname = window.location.pathname;\n const url = window.location.href;\n if (this.isLoginPathname) return true;\n const urlParams = new URLSearchParams();\n if (pathname !== this.BASE && pathname !== \"/\")\n urlParams.append(\"redirectUrl\", url);\n const searchString = decodeURIComponent(urlParams.toString());\n window.location.replace(\n `${this.baseLoginPathname}${\n !!searchString ? \"?\" + decodeURIComponent(urlParams.toString()) : \"\"\n }`\n );\n return false;\n };\n\n checkPassword = async () => {\n const res = await checkPasswordApi();\n if (res === \"noPass\") {\n // 临时清除token,待修改完密码后恢复\n this.tokenValue = await extractTokenApi();\n return false;\n }\n return true;\n };\n\n refactorToken = async () => {\n await refactorTokenApi(this.tokenValue);\n };\n\n login = async (params: BaseLoginParams) => {\n const res = await this.baseLogin(params);\n if (res.error) return res;\n return res;\n };\n\n private baseLogin = async (params: BaseLoginParams) => {\n const result: {\n error?: LoginErrorType;\n data?: LoginResultData;\n } = {\n error: undefined,\n data: undefined,\n };\n try {\n //其他登录方式未补充完\n const res = await accountLoginApi(params);\n const { userToken, traceId } = res;\n if (userToken) {\n result.data = res;\n const checked = await this.checkPassword();\n if (!checked) result.error = \"passwordExpiration\";\n return result;\n }\n //traceId 需要第三方验证 //验证码之后的由业务自行判断\n if (traceId) {\n result.data = res;\n result.error = \"SLIDER_VERIFICATION_LOGIN\";\n return result;\n }\n result.error = \"passwordError\";\n return result;\n } catch (err) {\n result.error = \"validateError\";\n return result;\n }\n };\n\n loginSuccess = () => {\n const params = new URLSearchParams(window.location.search);\n let url = params.get(\"redirectUrl\");\n if (url) window.location.href = url;\n else window.location.replace(this.BASE);\n };\n baseLoginOut = async () => {\n const params = new URLSearchParams();\n const url = window.location.href;\n if (window.location.pathname !== this.BASE)\n params.append(\"redirectUrl\", url);\n await accountLogoutApi();\n window.location.replace(`${this.baseLoginPathname}?${params.toString()}`);\n };\n}\n","import request from '@core/request';\nimport { AccountLoginParams } from './types';\n//获取登录方式\n// 获取登录方式\nexport function getLoginMethodApi() {\n return request('/authentication/getLoginMethod', {\n serviceId: 'fwSecurity',\n });\n}\n\n// 检查登录状态\nexport function checkTokenApi() {\n return request(\n '/authentication/checkToken',\n {\n serviceId: 'fwSecurity',\n },\n { showError: false },\n );\n}\n\nexport function accountLoginApi(params: AccountLoginParams) {\n return request('/authentication/login', {\n data: params,\n serviceId: 'fwSecurity',\n });\n}\n\n// 登出\nexport function accountLogoutApi() {\n return request('/authentication/logout', {\n data: {},\n serviceId: 'fwSecurity',\n });\n}\n\n// 进入代理\nexport function delegateLoginApi(params: any) {\n return request('/delegateAuth/delegateLogin', {\n data: params,\n serviceId: 'fwSecurity',\n });\n}\n\n// 退出代理\nexport function delegateLogoutApi(params: any) {\n return request('/delegateAuth/delegateLogout', {\n data: params,\n serviceId: 'fwSecurity',\n });\n}\n","import request from '@core/request';\nimport { BeforeLoginCheckCodeParams } from './types';\n\n// 登录之后校验二次验证码\nexport function beforeLoginCheckCodeApi(payload: BeforeLoginCheckCodeParams) {\n return request('/authentication/beforeLoginCheckCode', {\n method: 'POST',\n data: {\n ...payload,\n },\n serviceId: 'fwSecurity',\n });\n}\n// 检测登录密码是否需要重置\nexport function checkPasswordApi() {\n return request(\n '/security/checkPasswordUpdateTime',\n { data: {} },\n { showError: false },\n );\n}\n\n// 提取token\nexport function extractTokenApi() {\n return request('/authentication/extractToken', { data: {} });\n}\n\n// 恢复token\nexport function refactorTokenApi(tokenValue: string) {\n return request('/authentication/refactorToken', {\n data: { value: tokenValue },\n });\n}\n","import { SSOConfigType } from \"../type\";\nimport { checkAuthConfigApi } from \"./services\";\n\nconst defaultSsoConfig = {\n sso: false,\n ssoUrlSearchParams: [\"ticket\"],\n ssoCheckTokenUrl: \"\",\n ssoSuccessUrlkey: \"successUrl\",\n ssoLoginUrl: window.location.origin + \"/fwSecurity/ssoAuth/login.api\",\n ssologinOutUrl: window.location.origin + \"fwSecurity/ssoAuth/logout.api\",\n};\n\nexport default class SSOLogin {\n init(ssoConfig?: SSOConfigType) {\n this.ssoConfig = { ...this.ssoConfig, ...ssoConfig };\n }\n private ssoConfig: Required<SSOConfigType> = defaultSsoConfig;\n\n isSso = async (ssoCallback?: () => boolean) => {\n if (!this.ssoConfig.sso) return false;\n let sso = false;\n try {\n sso = await checkAuthConfigApi();\n } catch (error) {\n console.error(\"sso\", error);\n }\n if (ssoCallback) {\n sso = await ssoCallback();\n }\n return !!sso;\n };\n\n ssoLogin = () => {\n //在检测cookie中是否包含userIdentity信息\n const { ssoSuccessUrlkey, ssoUrlSearchParams, ssoLoginUrl } =\n this.ssoConfig;\n const params = new URLSearchParams(window.location.search.slice(1));\n const ssoParams = new URLSearchParams();\n const url = window.location.href;\n ssoParams.append(ssoSuccessUrlkey, encodeURIComponent(url));\n ssoUrlSearchParams.map((key) => {\n const value = params.get(key);\n if (value) ssoParams.append(key, value);\n });\n //待补充sso检测\n window.location.href = `${ssoLoginUrl}?${ssoParams.toString()}`;\n\n return false;\n };\n\n ssoLoginOut = () => {\n window.location.href = this.ssoConfig.ssologinOutUrl;\n };\n}\n","import request from '@core/request';\n// 检测三方是否配置sso登录\nexport function checkAuthConfigApi() {\n return request('/ssoAuthConfig/checkOnlyRedirect', {}, { showError: false });\n}\n// 验证ssoToken并转换为甘棠Token, 写入到Cookie中\nexport function ssoLoginApi(params: any) {\n const { ssoTokenType, ssoToken } = params;\n return request(\n `/authentication/ssoLogin?tokenType=${ssoTokenType}&token=${ssoToken}`,\n {\n serviceId: 'fwSecurity',\n },\n );\n}\n","import {\n getValidateCodeApi,\n sliderVerificationCodeApi,\n checkCaptchaApi,\n GetValidateCodeParams,\n CaptchaCheckParams,\n} from './services';\nexport default class ValidateLogin {\n getValidateCodeImage = (params: GetValidateCodeParams) => {\n return getValidateCodeApi(params);\n };\n sliderVerificationCodeImage = () => {\n return sliderVerificationCodeApi();\n };\n checkCaptcha = (params: CaptchaCheckParams) => {\n return checkCaptchaApi(params);\n };\n}\n","import request from '@core/request';\nimport { CaptchaCheckParams } from './types';\n\n//获取验证码\nexport function getValidateCodeApi(params = {}) {\n return request('/authentication/getValidateCode', {\n data: params,\n serviceId: 'fwSecurity',\n });\n}\n\n//获取滑块验证码\nexport function sliderVerificationCodeApi() {\n return request('/authentication/sliderVerificationCode', {\n method: 'POST',\n serviceId: 'fwSecurity',\n });\n}\n\n//校验滑块验证码\nexport function checkCaptchaApi(payload: CaptchaCheckParams) {\n return request('/authentication/checkCaptcha', {\n method: 'POST',\n data: {\n ...payload,\n },\n serviceId: 'fwSecurity',\n });\n}\n","import BaseLogin from \"./base\";\nimport SSOLogin from \"./sso\";\nimport ValidateLogin from \"./validate\";\nimport {\n BeforeLoginCheckCodeParams,\n beforeLoginCheckCodeApi,\n} from \"./services\";\nimport type { LOGIN_CONFIG } from \"../../../cli/interfaces\";\nexport default class LoginStore extends BaseLogin {\n ssoLogin: SSOLogin;\n validate: ValidateLogin;\n noCheckPermissionsPath?: string[] = [];\n ssoCallback?: () => boolean;\n constructor() {\n super();\n this.ssoLogin = new SSOLogin();\n this.validate = new ValidateLogin();\n }\n init = (\n loginConfig?: LOGIN_CONFIG,\n base = \"/\",\n ssoCallback?: () => boolean\n ) => {\n this.BASE = base;\n this.ssoCallback = ssoCallback;\n this.noCheckPermissionsPath = loginConfig?.noCheckPermissionsPath;\n this.ssoLogin.init(loginConfig);\n this.loginPathname = loginConfig?.loginPathname || \"/login\";\n };\n isNoLoginRequiredPage = () => {\n const pathname = window.location.pathname;\n const isNoLogin = this.noCheckPermissionsPath?.some((itemPath) => {\n return this.getRealPath(itemPath) == pathname;\n });\n return isNoLogin;\n };\n loginOut = async () => {\n const isSSO = await this.ssoLogin.isSso(this.ssoCallback);\n if (isSSO) this.ssoLogin.ssoLoginOut();\n await this.baseLoginOut();\n };\n loginAuthentication = async (params: BeforeLoginCheckCodeParams) => {\n await beforeLoginCheckCodeApi(params);\n this.loginSuccess();\n return;\n };\n redirectLogin = async () => {\n if (this.isNoLoginRequiredPage()) return true;\n const isSSO = await this.ssoLogin.isSso(this.ssoCallback);\n if (isSSO) {\n this.ssoLogin.ssoLogin();\n return false;\n }\n if (this.isLoginPathname) return true;\n return await this.redirectBaseLogin();\n };\n}\n","import {\n findUserAggregateInfoApi,\n getPlatformAggregateInfoApi,\n} from \"./services\";\nimport CodeListStoreInstance from \"../codelist\";\nimport ParameterStoreInstance from \"../parameter\";\nimport websocket from \"../websocket\";\nimport UserStore from \"../user\";\nimport MenuStore from \"../menu\";\nimport LoginStore from \"../login\";\nimport {\n UserAggregateInfo,\n Language,\n ProductInfo,\n ServerMenuData,\n GlobalOptions,\n} from \"../type\";\nimport { isEmpty } from \"lodash-es\";\nclass GlobalStoreClass {\n //无需登录验证的页面\n userStore: UserStore;\n menuStore: MenuStore;\n loginStore: LoginStore;\n isSuperAdmin: boolean = false;\n loginCallback?: () => void;\n constructor() {\n this.userStore = new UserStore();\n this.menuStore = new MenuStore();\n this.loginStore = new LoginStore();\n }\n platformLanguages: Language[] = [];\n productInfo: ProductInfo = {\n isProdEnv: false,\n productName: \"\",\n };\n get isPrd() {\n return this.productInfo?.isProdEnv;\n }\n get userInfo() {\n return this.userStore.currentUser;\n }\n\n get menuData() {\n return this.menuStore.menuData;\n }\n\n findPlantform = async () => {\n const res = await getPlatformAggregateInfoApi();\n this.platformLanguages = res.platformLanguages;\n this.productInfo = res.productInfo;\n };\n getAggregateInfo = async (\n menus?: ServerMenuData | ((res: UserAggregateInfo) => ServerMenuData)\n ) => {\n const res: UserAggregateInfo = await findUserAggregateInfoApi();\n\n const { user: currentUser, startMenus, isSuperAdmin, ...restInfo } = res;\n\n this.userStore.setUserAggregateInfo({ ...restInfo, currentUser });\n\n this.isSuperAdmin = isSuperAdmin;\n\n const localeMenus = typeof menus == \"function\" ? await menus(res) : menus;\n\n this.menuStore.init(\n isEmpty(localeMenus) ? startMenus : localeMenus,\n currentUser.id\n );\n };\n init = async (options: GlobalOptions) => {\n const { base = \"/\", menuData, loginSuccessCallback, ssoCallback,websocket:_startwebsocket=true } = options;\n this.loginStore.init(options?.loginConfig, base, ssoCallback);\n try {\n //检查token\n const res = await this.loginStore.chekToken();\n if (res) {\n //登录状态下获取聚合信息 保存header\n this.userStore.setUserIdentity(res);\n await this.getAggregateInfo(menuData);\n await CodeListStoreInstance.findAllCodeList();\n await ParameterStoreInstance.findAllParameters();\n //websocket注册\n if(_startwebsocket) websocket.init(this.userStore.currentUser.userLoginName);\n await loginSuccessCallback?.();\n return true;\n }\n //未登录情况下跳转到登录\n return await this.loginStore.redirectLogin();\n } catch (error) {\n console.error(error);\n }\n return false;\n };\n}\n\nconst globalStore = new GlobalStoreClass();\n\nexport default globalStore;\n","import request from '@core/request';\nexport async function findUserAggregateInfoApi() {\n return request('/security/findUserAggregateInfo', {\n method: 'POST',\n });\n}\n\n// 获取平台信息\nexport function getPlatformAggregateInfoApi() {\n return request(\n '/platformManage/getPlatformAggregateInfo',\n {\n method: 'POST',\n },\n { showError: false },\n );\n}\n","const companyVersion = 'company-v1';\nimport {\n getCompanyDataApi,\n setCompanyDataApi,\n delCompanyDataApi,\n} from './services';\nclass CompanyData {\n data: any = {};\n getCompanyDataType = (dataType: string) => {\n return `${companyVersion}-${dataType}`;\n };\n getCompanyData = async (dataType: string) => {\n const key = this.getCompanyDataType(dataType);\n if (!!this.data[key]) {\n return this.data[key];\n }\n const res = await getCompanyDataApi({ dataType, dataId: companyVersion });\n const bigData = res?.bigData ? JSON.parse(res.bigData) : undefined;\n this.data[key] = bigData;\n };\n updateCompanyData = async (dataType: string, data: any) => {\n const key = this.getCompanyDataType(dataType);\n await setCompanyDataApi({\n dataType,\n dataId: companyVersion,\n bigData: JSON.stringify(data),\n });\n this.data[key] = data;\n return data;\n };\n removeCompanyData = async (dataType: string) => {\n const key = this.getCompanyDataType(dataType);\n await delCompanyDataApi({ dataType, dataId: companyVersion });\n delete this.data[key];\n };\n}\n\nexport default new CompanyData();\n","import request from '@core/request';\nexport type CompanyDataParams = {\n dataType: string;\n dataId: string;\n bigData?: string;\n};\n\n//公司定制化数据接口\nexport async function setCompanyDataApi(params: CompanyDataParams) {\n return request('/companyData/setCompanyData', {\n data: params,\n serviceId: 'fwSecurity',\n });\n}\n\n//获取公司定制化信息\nexport async function getCompanyDataApi(params: CompanyDataParams) {\n return request('/companyData/getCompanyData', {\n data: params,\n serviceId: 'fwSecurity',\n });\n}\n\n//删除公司定制化信息\nexport async function delCompanyDataApi(params: CompanyDataParams) {\n return request('/companyData/delCompanyData', {\n data: params,\n serviceId: 'fwSecurity',\n });\n}\n","import CodeListStoreInstance from './codelist';\nimport ParameterStoreInstance from './parameter';\nimport websocket from './websocket';\nimport progress from './progress';\nimport globalStore from './global';\nimport companydataStore from './companydata';\nimport { storage as storageStore } from './storage';\nexport type * from './type';\n\nconst codeListStore = CodeListStoreInstance;\nconst parameterStore = ParameterStoreInstance;\nconst userStore = globalStore.userStore;\nconst loginStore = globalStore.loginStore;\nconst menuStore = globalStore.menuStore;\n\nexport {\n globalStore,\n codeListStore,\n parameterStore,\n websocket,\n progress,\n userStore,\n loginStore,\n menuStore,\n companydataStore,\n storageStore,\n};\nexport { MENU_HISTORY_UPDATE, MENU_BREADCRUMBS_UPDATE } from './menu';\nexport { PROGRESS_UPDEDATE } from './progress';\nexport {\n WS_CONTENT_CLOSE,\n WS_CONTENT_ERROR,\n WS_CONTENT_SUCCESS,\n} from './websocket';\n"],"names":["codeListStoreInstance","codeLists","codeMaps","findAllCodeList","data","request","serviceId","dataMap","groupBy","this","getCodeLocaleList","codeType","getCodeLocaleName","value","codeList","getName","code","find","item","String","name","Array","isArray","text","reduce","res","slice","length","indexOf","valueArr","replace","split","parameterStoreInstance","parameterList","parameterMap","findAllParameters","async","showError","keyBy","getSystemParameterByName","pick","pingMsg","pongMsg","WS_CONTENT_SUCCESS","WS_CONTENT_ERROR","WS_CONTENT_CLOSE","websocket","RECIPIENT_TYPE_ALL","RECIPIENT_TYPE_USER","RECIPIENT_TYPE_OBSERVER","RECIPIENT_TYPE_CONNECTION","webSocketUrl","ws","repeat","connectLoading","disReconnect","pingTimeoutFn","pongTimeoutFn","reconnectFn","repeatLimit","connectionId","userLoginName","eventStack","constructor","init","options","paramStr","host","protocol","port","hostname","window","location","isHttps","includes","wsProtocol","wsHost","parseInt","getWebSocketUrl","get","createWebSocket","WebSocket","registerEvent","error","reconnect","clearTimeout","setTimeout","heartCheck","msg","send","close","heartReset","disconnect","readyState","onopen","onmessage","e","dataStr","JSON","parse","content","wsdata","senderTime","emitter","emit","Object","keys","map","eventId","itemEevent","isIncludes","recipientType","event","recipientCode","err","console","warn","onerror","onclose","addTypeListener","type","eventType","id","uniqueId","removeListener","omit","PROGRESS_UPDEDATE","Progress","websocketId","progressObserver","progressEvent","itemObserver","updedataProgress","newProgress","isEmpty","push","addProgressListener","removeProgressListener","requestProgress","url","headers","observerId","Date","getDate","progressId","on","items","onProgress","progress","response","post","params","getParams","success","off","props","storage","prefixKey","localStorage","getKey","key","toUpperCase","set","expire","DEFAULT_CACHE_TIME","stringData","stringify","getTime","setItem","def","getItem","now","remove","removeItem","clear","setCookie","document","cookie","getCookie","cookieArr","i","kv","removeCookie","clearCookie","match","toUTCString","createStorage","UserStore","userIdentity","currentUser","isSuperAdmin","roles","functions","delegations","userSetting","users","getUserIdentity","localUserIdentity","setUserIdentity","identity","clearUserIdentity","setUserAggregateInfo","getUserSettingType","dataType","getUserSetting","userId","getUserDataApi","dataId","bigData","undefined","updateUserSetting","setUserDataApi","removeUserSetting","delUserDataApi","getUserInfo","index","findIndex","itemUser","userInfo","method","getUserByUserLoginNameApi","getUserByIdApi","isPlainObject","httpsRegexp","httpRegexp","getItemPath","path","test","MENU_HISTORY_UPDATE","MENU_BREADCRUMBS_UPDATE","MenuStore","menuDataMaps","menuData","menuPathMaps","breadcrumbs","menuHistorys","addListenerMenuHistorys","listener","removeListenerMenuHistorys","addListenerBreadcrumbs","removeListenerBreadcrumbs","getTreeMenuData","childrenGroup","parentPath","leaf","childrenData","newItem","children","sort","a","b","seqNum","cloneMenuData","cloneDeep","groupObj","ROOT","mapValues","updateMenuMaps","initMenuHistorys","newHistorys","itemName","pathname","newBreadcrumbs","updatehistorys","updateBreadcrumbs","liseterHistorys","historys","some","uniqBy","liseterBreadcrumbs","array","current","itemPathname","join","BaseLogin","loginPathname","BASE","baseLoginPathname","tokenValue","isLoginPathname","getRealPath","chekToken","getLoginMethod","redirectBaseLogin","href","urlParams","URLSearchParams","append","searchString","decodeURIComponent","toString","checkPassword","refactorToken","login","baseLogin","result","accountLoginApi","userToken","traceId","loginSuccess","search","baseLoginOut","defaultSsoConfig","sso","ssoUrlSearchParams","ssoCheckTokenUrl","ssoSuccessUrlkey","ssoLoginUrl","origin","ssologinOutUrl","SSOLogin","ssoConfig","isSso","ssoCallback","ssoLogin","ssoParams","encodeURIComponent","ssoLoginOut","ValidateLogin","getValidateCodeImage","getValidateCodeApi","sliderVerificationCodeImage","checkCaptcha","payload","LoginStore","validate","noCheckPermissionsPath","super","loginConfig","base","isNoLoginRequiredPage","isNoLogin","itemPath","loginOut","loginAuthentication","redirectLogin","globalStore","userStore","menuStore","loginStore","loginCallback","platformLanguages","productInfo","isProdEnv","productName","isPrd","findPlantform","getAggregateInfo","menus","findUserAggregateInfoApi","user","startMenus","restInfo","localeMenus","loginSuccessCallback","_startwebsocket","CodeListStoreInstance","ParameterStoreInstance","companyVersion","getCompanyDataType","getCompanyData","getCompanyDataApi","updateCompanyData","setCompanyDataApi","removeCompanyData","delCompanyDataApi","codeListStore","parameterStore"],"mappings":"uRA+DA,MAAMA,EAAwB,IAzC9B,MACEC,UAAsB,GACtBC,SAAqB,CAAA,EACrB,qBAAMC,GACJ,MACMC,QCxBDC,EAAQ,oBAAqB,CAClCD,KAAM,CAAE,EACRE,UAAW,gBDsBS,GACdC,EAAUC,EAAQJ,EAAM,QAC9BK,KAAKR,UAAYG,EACjBK,KAAKP,SAAWK,CACjB,CACDG,kBAAqBC,GACZ,IAAIF,KAAKP,WAAWS,KAAc,GAE3CC,kBAAoB,CAACD,EAAkBE,KACrC,MAAMC,EAAWL,KAAKC,kBAAkBC,GACxC,SAASI,EAAQF,GACf,MAAMG,EAAOC,EAAKH,GAAWI,GAAcA,EAAKL,QAAUM,OAAON,KACjE,OAAOG,GAAMI,MAAQ,EACtB,CACD,GAAIC,MAAMC,QAAQT,GAAQ,CACxB,MAAMU,EAAOC,EACXX,GACA,CAACY,EAAM,GAAIZ,EAAQ,KAAOY,EAAM,IAAMV,EAAQF,IAC9C,IAEF,OAAOU,EAAKG,MAAM,EAAGH,EAAKI,OAC3B,CAAM,GAAIR,OAAON,GAAOe,QAAQ,MAAQ,EAAG,CAC1C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,cAEf,CDLsBmW,CAAkB,CAAE9J,WAAUI,OAAQuJ,IAClDtJ,EAAUvL,GAAKuL,QAAU9G,KAAKC,MAAM1E,EAAIuL,cAAWC,EACzDxM,KAAKL,KAAK4J,GAAOgD,CAAO,EAE1B0J,kBAAoBtU,MAAOuK,EAAkBvM,KAC3C,MAAM4J,EAAMvJ,KAAK8V,mBAAmB5J,GAOpC,aCpBGvK,eAAiCmH,GACtC,OAAOlJ,EAAQ,8BAA+B,CAC5CD,KAAMmJ,EACNjJ,UAAW,cAEf,CDSUqW,CAAkB,CACtBhK,WACAI,OAAQuJ,EACRtJ,QAAS9G,KAAKoE,UAAUlK,KAE1BK,KAAKL,KAAK4J,GAAO5J,EACVA,CAAI,EAEbwW,kBAAoBxU,MAAOuK,IACzB,MAAM3C,EAAMvJ,KAAK8V,mBAAmB5J,SCPjCvK,eAAiCmH,GACtC,OAAOlJ,EAAQ,8BAA+B,CAC5CD,KAAMmJ,EACNjJ,UAAW,cAEf,CDGUuW,CAAkB,CAAElK,WAAUI,OAAQuJ,WACrC7V,KAAKL,KAAK4J,EAAI,GExBnB,MAAA8M,EAAgBV,EAChBW,EAAiBV,EACjBpB,EAAYD,EAAYC,UACxBE,EAAaH,EAAYG,WACzBD,EAAYF,EAAYE"}
@@ -2249,6 +2249,7 @@ declare class GantProgress {
2249
2249
  requestProgress(url: string, options?: {
2250
2250
  params?: any;
2251
2251
  success?: (params: any) => void;
2252
+ onProgress?: (progress: number) => void;
2252
2253
  error?: (error: any) => void;
2253
2254
  headers?: any;
2254
2255
  getParams?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gant-core",
3
- "version": "0.2.12",
3
+ "version": "0.2.14",
4
4
  "description": "",
5
5
  "main": "lib/core/index.js",
6
6
  "types": "lib/types/index.d.ts",