@cloudbase/js-sdk 2.19.1 → 2.19.3

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.
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("cloudbase_model",[],t):"object"==typeof exports?exports.cloudbase_model=t():e.cloudbase_model=t()}("undefined"!=typeof window?window:this,(()=>(()=>{var e={530:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(679),t)},276:function(e,t){!function(e){"use strict";var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},t(e,n)};var n=function(){return n=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},n.apply(this,arguments)};function r(e,t,n,r){return new(n||(n=Promise))((function(t,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function i(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var r;e.done?t(e.value):(r=e.value,r instanceof n?r:new n((function(e){e(r)}))).then(a,i)}c((r=r.apply(e,[])).next())}))}function o(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}var a=function(e){function n(t,n){var r=e.call(this,t)||this;return r.name="WxCloudSDKError",r.code=null==n?void 0:n.code,r.requestId=null==n?void 0:n.requestId,r.originError=null==n?void 0:n.originError,r}return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}(n,e),n}(Error);function i(){return"undefined"!=typeof window&&window||"undefined"!=typeof globalThis&&globalThis}function c(){try{var e=i();if(!e)return;return"undefined"==typeof wx?i().location.href:e.__wxRoute}catch(e){}}var s=function(e){var t=e.dataSourceName,n=e.methodName,s=e.params,u=e.realMethodName,l=e.callFunction,d=e.envType,f=void 0===d?"prod":d,p=e.mode;return r(void 0,0,void 0,(function(){var e,r,d,h,y,v;return o(this,(function(o){switch(o.label){case 0:e={data:{},requestId:""},o.label=1;case 1:return o.trys.push([1,3,,4]),[4,l({name:"lowcode-datasource",data:{dataSourceName:t,methodName:n,params:s,userAgent:(b=i(),(null==b?void 0:b.navigator)?b.navigator.userAgent:"undefined"!=typeof wx&&wx.getSystemInfo?(wx.getSystemInfo({success:function(e){e&&(m=["brand","model","version","system","platform","SDKVersion","language"].map((function(t){return"".concat(t,": ").concat(e[t])})).join(", "))}}),m):void 0),referrer:c(),"x-sdk-version":"1.5.0",envType:f,mode:p}})];case 2:if(r=o.sent(),d=(null===(y=null==r?void 0:r.result)||void 0===y?void 0:y.requestId)||(null==r?void 0:r.requestId)||(null==r?void 0:r.requestID),null==r?void 0:r.result.code)throw new a("【错误】".concat(null==r?void 0:r.result.message,"\n【操作】调用 models.").concat(t?"".concat(t,"."):"").concat(u,"\n【错误码】").concat(null==r?void 0:r.result.code,"\n【请求ID】").concat(d||"N/A"),{code:null==r?void 0:r.result.code,requestId:d});return e.data=(null===(v=null==r?void 0:r.result)||void 0===v?void 0:v.data)||{},e.requestId=d,[3,4];case 3:throw"WxCloudSDKError"===(h=o.sent()).name?h:(console.log(h),new a("【错误】".concat(h.message,"\n 【操作】调用 models.").concat(t?"".concat(t,"."):"").concat(u,"\n 【请求ID】N/A"),{code:"UnknownError",originError:h}));case 4:return[2,e]}var m,b}))}))},u=function(e){var t=e.sql,n=e.params,a=e.config,i=e.callFunction,c=e.unsafe,u=void 0!==c&&c;return r(void 0,0,void 0,(function(){return o(this,(function(e){return[2,s({realMethodName:"$runSQL",methodName:"callWedaApi",params:{action:"RunMysqlCommand",data:{sqlTemplate:t,config:a,parameter:u?"":Object.entries(n||{}).reduce((function(e,t){var n=t[0],r=t[1];if(void 0!==r){var o="OBJECT";switch(typeof r){case"boolean":o="BOOLEAN";break;case"number":o="NUMBER";break;case"string":o="STRING";break;default:o=Array.isArray(r)?"ARRAY":"OBJECT"}e.push({key:n,type:o,value:"STRING"===o?r:JSON.stringify(r)})}return e}),[])||[]}},callFunction:i,mode:"sdk"})]}))}))},l=function(e){return{$runSQL:function(t,a,i){return r(this,0,void 0,(function(){return o(this,(function(r){switch(r.label){case 0:return[4,u({sql:t,params:a,config:n(n({},i),{preparedStatements:!0}),callFunction:e})];case 1:return[2,r.sent()]}}))}))},$runSQLRaw:function(t,a){return r(this,0,void 0,(function(){return o(this,(function(r){switch(r.label){case 0:return[4,u({sql:t,params:[],config:n(n({},a),{preparedStatements:!1}),callFunction:e})];case 1:return[2,r.sent()]}}))}))}}},d={create:{methodName:"wedaCreateV2"},createMany:{methodName:"wedaBatchCreateV2"},update:{methodName:"wedaUpdateV2"},upsert:{methodName:"wedaUpsertV2"},updateMany:{methodName:"wedaBatchUpdateV2"},delete:{methodName:"wedaDeleteV2"},deleteMany:{methodName:"wedaBatchDeleteV2"},get:{methodName:"wedaGetItemV2",defaultParams:{filter:{where:{}},select:{$master:!0}}},list:{methodName:"wedaGetRecordsV2",defaultParams:{filter:{where:{}},select:{$master:!0}}}},f=function(e){var t=l(e);return new Proxy({},{get:function(i,c){if("string"==typeof c)return Object.prototype.hasOwnProperty.call(t,c)?t[c]:function(e,t){return new Proxy({},{get:function(i,c){var u=d[c];if(!u){var l=new Error("不支持的操作: ".concat(c));throw new a(l.message||"Unknown error occurred",{originError:l,code:"NotSupported",requestId:"N/A"})}return function(a){return r(void 0,0,void 0,(function(){var r,i,l,d,f;return o(this,(function(o){switch(o.label){case 0:return r=n(n({},u.defaultParams||{}),a||{}),[4,s({callFunction:t,dataSourceName:e,methodName:u.methodName,realMethodName:c,params:r,envType:null==a?void 0:a.envType})];case 1:return i=o.sent(),l={data:{}},d=u.responseKey,l.data=d?null===(f=null==i?void 0:i.data)||void 0===f?void 0:f[d]:null==i?void 0:i.data,[2,l]}}))}))}}})}(c,e)}})},p={filter:{where:{}},select:{$master:!0}};function h(e){return{getUrl:function(t){return"".concat(t,"/").concat(e)},method:"post"}}var y={get:n(n({},h("get")),{defaultParams:n({},p)}),list:n(n({},h("list")),{defaultParams:n({},p)}),create:h("create"),createMany:h("createMany"),update:n(n({},h("update")),{method:"put"}),updateMany:n(n({},h("updateMany")),{method:"put"}),upsert:h("upsert"),delete:h("delete"),deleteMany:h("deleteMany")},v="Unknown error occurred",m="NotSupported",b=function(e,t,n,r){var o=l(e);return new Proxy({},{get:function(e,a){if("string"==typeof a)return Object.prototype.hasOwnProperty.call(o,a)?o[a]:g(n,a,t,r)}})},w=function(e,t,n,r,o){return new a("【错误】".concat(e,"\n【操作】调用 models.").concat(t,".").concat(n,"\n【错误码】").concat(r,"\n【请求ID】").concat(o),{code:r,requestId:o})},g=function(e,t,i,c){return new Proxy({},{get:function(s,u){if("runSQLTemplate"!==u){var l=y[u];if(!l){var d=new Error("不支持的操作: ".concat(u));throw new a(d.message||v,{originError:d,code:m,requestId:"N/A"})}return function(n){return void 0===n&&(n={}),r(void 0,0,void 0,(function(){var r,c,s,d,f,p,h,y,m,b;return o(this,(function(o){switch(o.label){case 0:r=l.getUrl,c=l.method,s=l.defaultParams,d=void 0===s?{}:s,f=Object.assign({},d,n),p="pre"===f.envType?"pre":"prod",h=[e,p,r(t)].join("/"),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,i({url:h,body:JSON.stringify(f),method:c})];case 2:if((y=o.sent()).code)throw w(null==y?void 0:y.message,t,u,null==y?void 0:y.code,null==y?void 0:y.requestId);return"get"===u&&Object.assign(y,{data:null!==(b=y.data.record)&&void 0!==b?b:y.data}),[2,y];case 3:throw m=o.sent(),new a((null==m?void 0:m.message)||v,{originError:m});case 4:return[2]}}))}))}}if(!(null==c?void 0:c.sqlBaseUrl))throw d=new Error("不支持的操作: ".concat(u)),new a(d.message||v,{originError:d,code:m,requestId:"N/A"});return function(e){return r(void 0,0,void 0,(function(){var r,s,l,d,f,p,h,y,m,b,g,O,S,_,j,E;return o(this,(function(o){switch(o.label){case 0:r=e.params,s=e.templateName,l=e.envType,d="pre"===l?"pre":"prod",f=[c.sqlBaseUrl,d,s,"run"].join("/"),p=Object.entries(r||{}).reduce((function(e,t){var n=t[0],r=t[1];if(void 0!==r){var o="OBJECT";switch(typeof r){case"boolean":o="BOOLEAN";break;case"number":o="NUMBER";break;case"string":o="STRING";break;default:o=Array.isArray(r)?"ARRAY":"OBJECT"}e.push({key:n,type:o,value:"STRING"===o?r:JSON.stringify(r)})}return e}),[]),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,i({url:f,body:JSON.stringify({parameter:p}),method:"POST"})];case 2:if(h=o.sent(),null===(m=null==h?void 0:h.Response)||void 0===m?void 0:m.Error)throw w(null===(g=null===(b=null==h?void 0:h.Response)||void 0===b?void 0:b.Error)||void 0===g?void 0:g.Message,t,u,null===(S=null===(O=null==h?void 0:h.Response)||void 0===O?void 0:O.Error)||void 0===S?void 0:S.Code,null===(_=null==h?void 0:h.Response)||void 0===_?void 0:_.RequestId);return[2,n(n({},null!==(j=null==h?void 0:h.Response)&&void 0!==j?j:{}),{data:null===(E=null==h?void 0:h.Response)||void 0===E?void 0:E.Data})];case 3:throw y=o.sent(),new a((null==y?void 0:y.message)||v,{originError:y});case 4:return[2]}}))}))}}})};function O(e){if(!e)throw new Error("cloud is required");if(!e.callFunction)throw new Error("cloud.callFunction is required");var t=f(e.callFunction.bind(e));return e.models=t,e}var S={init:O,generateHTTPClient:b};e.default=S,e.generateHTTPClient=b,e.init=O,Object.defineProperty(e,"__esModule",{value:!0})}(t)},679:(e,t,n)=>{"use strict";n.r(t),n.d(t,{lazyGetEntity:()=>f,registerModel:()=>v});var r=n(276),o=n(19),a={};for(const e in r)["default","lazyGetEntity","registerModel"].indexOf(e)<0&&(a[e]=()=>r[e]);n.d(t,a);var i=function(){return i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},i.apply(this,arguments)},c=function(e,t,n,r){return new(n||(n=Promise))((function(o,a){function i(e){try{s(r.next(e))}catch(e){a(e)}}function c(e){try{s(r.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,c)}s((r=r.apply(e,t||[])).next())}))},s=function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(c){return function(s){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,r=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=t.call(e,i)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,s])}}},u=o.U3.yE,l="models",d=new WeakMap;function f(e){return new Proxy({},{get:function(t,n){var o=d.get(e);return o||(o=function(e){var t=this,n=e.callFunction.bind(e),o=e.request.fetch.bind(e.request),a=e.getEndPointWithKey("GATEWAY"),u=a.BASE_URL,l=a.PROTOCOL,d="".concat(l).concat(u,"/model"),f="".concat(l).concat(u,"/sql"),p=(0,r.generateHTTPClient)(n,(function(e){return c(t,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return[4,o(i(i({},e),{headers:i({"Content-Type":"application/json"},e.headers)}))];case 1:return[4,t.sent().data];case 2:return[2,t.sent()]}}))}))}),d,{sqlBaseUrl:f});return p}(e),d.set(e,o)),o[n]}})}var p="cloudbase_init",h=new u;h.on(p,(function(e){var t=e.data;Object.assign(t,{models:f(t)})}));var y={name:l,namespace:l,entity:new Proxy({},{get:function(e,t){console.warn("【deprecated】Accessing Cloudbase.prototype.models.".concat(t,"."))}}),injectEvents:{bus:h,events:[p]}};try{cloudbase.registerComponent(y)}catch(e){}function v(e){try{e.registerComponent(y)}catch(e){console.warn(e)}}},19:(e,t,n)=>{"use strict";n.d(t,{U3:()=>r});var r={};n.r(r),n.d(r,{yE:()=>_});var o="@cloudbase/js-sdk";function a(){return o}var i,c="INVALID_OPERATION",s="OPERATION_FAIL";!function(e){e.local="local",e.none="none",e.session="session"}(i||(i={}));function u(e,t){console.warn("[".concat(a(),"][").concat(e,"]:").concat(t))}var l,d,f=(l=function(e,t){return l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},l(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}l(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),p=function(){return p=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},p.apply(this,arguments)},h=function(e,t,n,r){return new(n||(n=Promise))((function(o,a){function i(e){try{s(r.next(e))}catch(e){a(e)}}function c(e){try{s(r.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,c)}s((r=r.apply(e,t||[])).next())}))},y=function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(c){return function(s){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,r=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=t.call(e,i)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,s])}}};!function(e){function t(t){var n=e.call(this)||this,r=t.timeout,o=t.timeoutMsg,a=t.restrictedMethods;return n.timeout=r||0,n.timeoutMsg=o||"请求超时",n.restrictedMethods=a||["get","post","upload","download"],n}f(t,e),t.prototype.get=function(e){return this.request(p(p({},e),{method:"get"}),this.restrictedMethods.includes("get"))},t.prototype.post=function(e){return this.request(p(p({},e),{method:"post"}),this.restrictedMethods.includes("post"))},t.prototype.put=function(e){return this.request(p(p({},e),{method:"put"}))},t.prototype.upload=function(e){var t=e.data,n=e.file,r=e.name,o=e.method,a=e.headers,i=void 0===a?{}:a,c={post:"post",put:"put"}[null==o?void 0:o.toLowerCase()]||"put",s=new FormData;return"post"===c?(Object.keys(t).forEach((function(e){s.append(e,t[e])})),s.append("key",r),s.append("file",n),this.request(p(p({},e),{data:s,method:c}),this.restrictedMethods.includes("upload"))):this.request(p(p({},e),{method:"put",headers:i,body:n}),this.restrictedMethods.includes("upload"))},t.prototype.download=function(e){return h(this,void 0,void 0,(function(){var t,n,r,o;return y(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this.get(p(p({},e),{headers:{},responseType:"blob"}))];case 1:return t=a.sent().data,n=window.URL.createObjectURL(new Blob([t])),r=decodeURIComponent(new URL(e.url).pathname.split("/").pop()||""),(o=document.createElement("a")).href=n,o.setAttribute("download",r),o.style.display="none",document.body.appendChild(o),o.click(),window.URL.revokeObjectURL(n),document.body.removeChild(o),[3,3];case 2:return a.sent(),[3,3];case 3:return[2,new Promise((function(t){t({statusCode:200,tempFilePath:e.url})}))]}}))}))},t.prototype.fetch=function(e){var t;return h(this,void 0,void 0,(function(){var n,r,o,a,i,c,s,u,l,d,f,v=this;return y(this,(function(m){switch(m.label){case 0:return n=new AbortController,r=e.url,o=e.enableAbort,a=void 0!==o&&o,i=e.stream,c=void 0!==i&&i,s=e.signal,u=e.timeout,l=null!=u?u:this.timeout,s&&(s.aborted&&n.abort(),s.addEventListener("abort",(function(){return n.abort()}))),d=null,a&&l&&(d=setTimeout((function(){console.warn(v.timeoutMsg),n.abort(new Error(v.timeoutMsg))}),l)),[4,fetch(r,p(p({},e),{signal:n.signal})).then((function(e){return h(v,void 0,void 0,(function(){var t,n,r;return y(this,(function(o){switch(o.label){case 0:return clearTimeout(d),e.ok?(t=e,[3,3]):[3,1];case 1:return r=(n=Promise).reject,[4,e.json()];case 2:t=r.apply(n,[o.sent()]),o.label=3;case 3:return[2,t]}}))}))})).catch((function(e){return clearTimeout(d),Promise.reject(e)}))];case 1:return f=m.sent(),[2,{data:c?f.body:(null===(t=f.headers.get("content-type"))||void 0===t?void 0:t.includes("application/json"))?f.json():f.text(),statusCode:f.status,header:f.headers}]}}))}))},t.prototype.request=function(e,t){var n=this;void 0===t&&(t=!1);var r=String(e.method).toLowerCase()||"get";return new Promise((function(o){var a,i,c,s=e.url,u=e.headers,l=void 0===u?{}:u,d=e.data,f=e.responseType,p=e.withCredentials,h=e.body,y=e.onUploadProgress,v=function(e,t,n){void 0===n&&(n={});var r=/\?/.test(t),o="";return Object.keys(n).forEach((function(e){""===o?!r&&(t+="?"):o+="&",o+="".concat(e,"=").concat(encodeURIComponent(n[e]))})),/^http(s)?:\/\//.test(t+=o)?t:"".concat(e).concat(t)}("https:",s,"get"===r?d:{}),m=new XMLHttpRequest;m.open(r,v),f&&(m.responseType=f),Object.keys(l).forEach((function(e){m.setRequestHeader(e,l[e])})),y&&m.upload.addEventListener("progress",y),m.onreadystatechange=function(){var e={};if(4===m.readyState){var t=m.getAllResponseHeaders().trim().split(/[\r\n]+/),n={};t.forEach((function(e){var t=e.split(": "),r=t.shift().toLowerCase(),o=t.join(": ");n[r]=o})),e.header=n,e.statusCode=m.status;try{e.data="blob"===f?m.response:JSON.parse(m.responseText)}catch(t){e.data="blob"===f?m.response:m.responseText}clearTimeout(a),o(e)}},t&&n.timeout&&(a=setTimeout((function(){console.warn(n.timeoutMsg),m.abort()}),n.timeout)),c=d,i="[object FormData]"===Object.prototype.toString.call(c)?d:"application/x-www-form-urlencoded"===l["content-type"]?function(e){void 0===e&&(e={});var t=[];return Object.keys(e).forEach((function(n){t.push("".concat(n,"=").concat(encodeURIComponent(e[n])))})),t.join("&")}(d):h||(d?JSON.stringify(d):void 0),p&&(m.withCredentials=!0),m.send(i)}))}}((function(){})),function(e){e.WEB="web",e.WX_MP="wx_mp"}(d||(d={}));var v=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),m=function(e,t,n,r){return new(n||(n=Promise))((function(o,a){function i(e){try{s(r.next(e))}catch(e){a(e)}}function c(e){try{s(r.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,c)}s((r=r.apply(e,t||[])).next())}))},b=function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(c){return function(s){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,r=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=t.call(e,i)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,s])}}},w=function(e){function t(t){var n=e.call(this)||this;return n.root=t,t.tcbCacheObject||(t.tcbCacheObject={}),n}return v(t,e),t.prototype.setItem=function(e,t){this.root.tcbCacheObject[e]=t},t.prototype.getItem=function(e){return this.root.tcbCacheObject[e]},t.prototype.removeItem=function(e){delete this.root.tcbCacheObject[e]},t.prototype.clear=function(){delete this.root.tcbCacheObject},t}((function(){}));!function(){function e(e){this.keys={};var t=e.persistence,n=e.platformInfo,r=void 0===n?{}:n,o=e.keys,a=void 0===o?{}:o;this.platformInfo=r,this.storage||(this.persistenceTag=this.platformInfo.adapter.primaryStorage||t,this.storage=function(e,t){switch(e){case"local":default:return t.localStorage?t.localStorage:(u("INVALID_PARAMS","localStorage is not supported on current platform"),new w(t.root));case"none":return new w(t.root)}}(this.persistenceTag,this.platformInfo.adapter),this.keys=a)}Object.defineProperty(e.prototype,"mode",{get:function(){return this.storage.mode||"sync"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"persistence",{get:function(){return this.persistenceTag},enumerable:!1,configurable:!0}),e.prototype.setStore=function(e,t,n){if("async"!==this.mode){if(this.storage)try{var r={version:n||"localCachev1",content:t};this.storage.setItem(e,JSON.stringify(r))}catch(e){throw new Error(JSON.stringify({code:s,msg:"[".concat(a(),"][").concat(s,"]setStore failed"),info:e}))}}else u(c,"current platform's storage is asynchronous, please use setStoreAsync insteed")},e.prototype.setStoreAsync=function(e,t,n){return m(this,void 0,void 0,(function(){var r;return b(this,(function(o){switch(o.label){case 0:if(!this.storage)return[2];o.label=1;case 1:return o.trys.push([1,3,,4]),r={version:n||"localCachev1",content:t},[4,this.storage.setItem(e,JSON.stringify(r))];case 2:return o.sent(),[3,4];case 3:return o.sent(),[2];case 4:return[2]}}))}))},e.prototype.getStore=function(e,t){var n;if("async"!==this.mode){try{if("undefined"!=typeof process&&(null===(n={IS_MP_BUILD:!0})||void 0===n?void 0:n.tcb_token))return{IS_MP_BUILD:!0}.tcb_token;if(!this.storage)return""}catch(e){return""}t=t||"localCachev1";var r=this.storage.getItem(e);return r&&r.indexOf(t)>=0?JSON.parse(r).content:""}u(c,"current platform's storage is asynchronous, please use getStoreAsync insteed")},e.prototype.getStoreAsync=function(e,t){var n;return m(this,void 0,void 0,(function(){var r;return b(this,(function(o){switch(o.label){case 0:try{if("undefined"!=typeof process&&(null===(n={IS_MP_BUILD:!0})||void 0===n?void 0:n.tcb_token))return[2,{IS_MP_BUILD:!0}.tcb_token];if(!this.storage)return[2,""]}catch(e){return[2,""]}return t=t||"localCachev1",[4,this.storage.getItem(e)];case 1:return(r=o.sent())&&r.indexOf(t)>=0?[2,JSON.parse(r).content]:[2,""]}}))}))},e.prototype.removeStore=function(e){"async"!==this.mode?this.storage.removeItem(e):u(c,"current platform's storage is asynchronous, please use removeStoreAsync insteed")},e.prototype.removeStoreAsync=function(e){return m(this,void 0,void 0,(function(){return b(this,(function(t){switch(t.label){case 0:return[4,this.storage.removeItem(e)];case 1:return t.sent(),[2]}}))}))}}();var g=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),O=function(e,t){this.data=t||null,this.name=e},S=function(e){function t(t,n){var r=e.call(this,"error",{error:t,data:n})||this;return r.error=t,r}return g(t,e),t}(O),_=function(){function e(){this.listeners={}}return e.prototype.on=function(e,t){return function(e,t,n){n[e]=n[e]||[],n[e].push(t)}(e,t,this.listeners),this},e.prototype.off=function(e,t){return function(e,t,n){if(null==n?void 0:n[e]){var r=n[e].indexOf(t);-1!==r&&n[e].splice(r,1)}}(e,t,this.listeners),this},e.prototype.fire=function(e,t){if(e instanceof S)return console.error(e.error),this;var n="string"==typeof e?new O(e,t||{}):e,r=n.name;if(this.listens(r)){n.target=this;for(var o=0,a=this.listeners[r]?function(e,t,n){if(n||2===arguments.length)for(var r,o=0,a=t.length;o<a;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}([],this.listeners[r],!0):[];o<a.length;o++)a[o].call(this,n)}return this},e.prototype.listens=function(e){return this.listeners[e]&&this.listeners[e].length>0},e}();function j(e){this.message=e}function E(e){this.message=e}new _,"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.indexOf("Firefox"),j.prototype=new Error,j.prototype.name="InvalidCharacterError","undefined"!=typeof window&&window.atob&&window.atob.bind(window),E.prototype=new Error,E.prototype.name="InvalidTokenError"}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var a=t[r]={exports:{}};return e[r].call(a.exports,a,a.exports,n),a.exports}return n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n(530)})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("cloudbase_model",[],t):"object"==typeof exports?exports.cloudbase_model=t():e.cloudbase_model=t()}("undefined"!=typeof window?window:this,(()=>(()=>{var e={530:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(679),t)},276:function(e,t){!function(e){"use strict";var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},t(e,n)};var n=function(){return n=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},n.apply(this,arguments)};function r(e,t,n,r){return new(n||(n=Promise))((function(t,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function i(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var r;e.done?t(e.value):(r=e.value,r instanceof n?r:new n((function(e){e(r)}))).then(a,i)}c((r=r.apply(e,[])).next())}))}function o(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}var a=function(e){function n(t,n){var r=e.call(this,t)||this;return r.name="WxCloudSDKError",r.code=null==n?void 0:n.code,r.requestId=null==n?void 0:n.requestId,r.originError=null==n?void 0:n.originError,r}return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}(n,e),n}(Error);function i(){return"undefined"!=typeof window&&window||"undefined"!=typeof globalThis&&globalThis}function c(){try{var e=i();if(!e)return;return"undefined"==typeof wx?i().location.href:e.__wxRoute}catch(e){}}var s=function(e){var t=e.dataSourceName,n=e.methodName,s=e.params,u=e.realMethodName,l=e.callFunction,d=e.envType,f=void 0===d?"prod":d,p=e.mode;return r(void 0,0,void 0,(function(){var e,r,d,h,y,v;return o(this,(function(o){switch(o.label){case 0:e={data:{},requestId:""},o.label=1;case 1:return o.trys.push([1,3,,4]),[4,l({name:"lowcode-datasource",data:{dataSourceName:t,methodName:n,params:s,userAgent:(b=i(),(null==b?void 0:b.navigator)?b.navigator.userAgent:"undefined"!=typeof wx&&wx.getSystemInfo?(wx.getSystemInfo({success:function(e){e&&(m=["brand","model","version","system","platform","SDKVersion","language"].map((function(t){return"".concat(t,": ").concat(e[t])})).join(", "))}}),m):void 0),referrer:c(),"x-sdk-version":"1.5.0",envType:f,mode:p}})];case 2:if(r=o.sent(),d=(null===(y=null==r?void 0:r.result)||void 0===y?void 0:y.requestId)||(null==r?void 0:r.requestId)||(null==r?void 0:r.requestID),null==r?void 0:r.result.code)throw new a("【错误】".concat(null==r?void 0:r.result.message,"\n【操作】调用 models.").concat(t?"".concat(t,"."):"").concat(u,"\n【错误码】").concat(null==r?void 0:r.result.code,"\n【请求ID】").concat(d||"N/A"),{code:null==r?void 0:r.result.code,requestId:d});return e.data=(null===(v=null==r?void 0:r.result)||void 0===v?void 0:v.data)||{},e.requestId=d,[3,4];case 3:throw"WxCloudSDKError"===(h=o.sent()).name?h:(console.log(h),new a("【错误】".concat(h.message,"\n 【操作】调用 models.").concat(t?"".concat(t,"."):"").concat(u,"\n 【请求ID】N/A"),{code:"UnknownError",originError:h}));case 4:return[2,e]}var m,b}))}))},u=function(e){var t=e.sql,n=e.params,a=e.config,i=e.callFunction,c=e.unsafe,u=void 0!==c&&c;return r(void 0,0,void 0,(function(){return o(this,(function(e){return[2,s({realMethodName:"$runSQL",methodName:"callWedaApi",params:{action:"RunMysqlCommand",data:{sqlTemplate:t,config:a,parameter:u?"":Object.entries(n||{}).reduce((function(e,t){var n=t[0],r=t[1];if(void 0!==r){var o="OBJECT";switch(typeof r){case"boolean":o="BOOLEAN";break;case"number":o="NUMBER";break;case"string":o="STRING";break;default:o=Array.isArray(r)?"ARRAY":"OBJECT"}e.push({key:n,type:o,value:"STRING"===o?r:JSON.stringify(r)})}return e}),[])||[]}},callFunction:i,mode:"sdk"})]}))}))},l=function(e){return{$runSQL:function(t,a,i){return r(this,0,void 0,(function(){return o(this,(function(r){switch(r.label){case 0:return[4,u({sql:t,params:a,config:n(n({},i),{preparedStatements:!0}),callFunction:e})];case 1:return[2,r.sent()]}}))}))},$runSQLRaw:function(t,a){return r(this,0,void 0,(function(){return o(this,(function(r){switch(r.label){case 0:return[4,u({sql:t,params:[],config:n(n({},a),{preparedStatements:!1}),callFunction:e})];case 1:return[2,r.sent()]}}))}))}}},d={create:{methodName:"wedaCreateV2"},createMany:{methodName:"wedaBatchCreateV2"},update:{methodName:"wedaUpdateV2"},upsert:{methodName:"wedaUpsertV2"},updateMany:{methodName:"wedaBatchUpdateV2"},delete:{methodName:"wedaDeleteV2"},deleteMany:{methodName:"wedaBatchDeleteV2"},get:{methodName:"wedaGetItemV2",defaultParams:{filter:{where:{}},select:{$master:!0}}},list:{methodName:"wedaGetRecordsV2",defaultParams:{filter:{where:{}},select:{$master:!0}}}},f=function(e){var t=l(e);return new Proxy({},{get:function(i,c){if("string"==typeof c)return Object.prototype.hasOwnProperty.call(t,c)?t[c]:function(e,t){return new Proxy({},{get:function(i,c){var u=d[c];if(!u){var l=new Error("不支持的操作: ".concat(c));throw new a(l.message||"Unknown error occurred",{originError:l,code:"NotSupported",requestId:"N/A"})}return function(a){return r(void 0,0,void 0,(function(){var r,i,l,d,f;return o(this,(function(o){switch(o.label){case 0:return r=n(n({},u.defaultParams||{}),a||{}),[4,s({callFunction:t,dataSourceName:e,methodName:u.methodName,realMethodName:c,params:r,envType:null==a?void 0:a.envType})];case 1:return i=o.sent(),l={data:{}},d=u.responseKey,l.data=d?null===(f=null==i?void 0:i.data)||void 0===f?void 0:f[d]:null==i?void 0:i.data,[2,l]}}))}))}}})}(c,e)}})},p={filter:{where:{}},select:{$master:!0}};function h(e){return{getUrl:function(t){return"".concat(t,"/").concat(e)},method:"post"}}var y={get:n(n({},h("get")),{defaultParams:n({},p)}),list:n(n({},h("list")),{defaultParams:n({},p)}),create:h("create"),createMany:h("createMany"),update:n(n({},h("update")),{method:"put"}),updateMany:n(n({},h("updateMany")),{method:"put"}),upsert:h("upsert"),delete:h("delete"),deleteMany:h("deleteMany")},v="Unknown error occurred",m="NotSupported",b=function(e,t,n,r){var o=l(e);return new Proxy({},{get:function(e,a){if("string"==typeof a)return Object.prototype.hasOwnProperty.call(o,a)?o[a]:g(n,a,t,r)}})},w=function(e,t,n,r,o){return new a("【错误】".concat(e,"\n【操作】调用 models.").concat(t,".").concat(n,"\n【错误码】").concat(r,"\n【请求ID】").concat(o),{code:r,requestId:o})},g=function(e,t,i,c){return new Proxy({},{get:function(s,u){if("runSQLTemplate"!==u){var l=y[u];if(!l){var d=new Error("不支持的操作: ".concat(u));throw new a(d.message||v,{originError:d,code:m,requestId:"N/A"})}return function(n){return void 0===n&&(n={}),r(void 0,0,void 0,(function(){var r,c,s,d,f,p,h,y,m,b;return o(this,(function(o){switch(o.label){case 0:r=l.getUrl,c=l.method,s=l.defaultParams,d=void 0===s?{}:s,f=Object.assign({},d,n),p="pre"===f.envType?"pre":"prod",h=[e,p,r(t)].join("/"),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,i({url:h,body:JSON.stringify(f),method:c})];case 2:if((y=o.sent()).code)throw w(null==y?void 0:y.message,t,u,null==y?void 0:y.code,null==y?void 0:y.requestId);return"get"===u&&Object.assign(y,{data:null!==(b=y.data.record)&&void 0!==b?b:y.data}),[2,y];case 3:throw m=o.sent(),new a((null==m?void 0:m.message)||v,{originError:m});case 4:return[2]}}))}))}}if(!(null==c?void 0:c.sqlBaseUrl))throw d=new Error("不支持的操作: ".concat(u)),new a(d.message||v,{originError:d,code:m,requestId:"N/A"});return function(e){return r(void 0,0,void 0,(function(){var r,s,l,d,f,p,h,y,m,b,g,O,S,_,j,E;return o(this,(function(o){switch(o.label){case 0:r=e.params,s=e.templateName,l=e.envType,d="pre"===l?"pre":"prod",f=[c.sqlBaseUrl,d,s,"run"].join("/"),p=Object.entries(r||{}).reduce((function(e,t){var n=t[0],r=t[1];if(void 0!==r){var o="OBJECT";switch(typeof r){case"boolean":o="BOOLEAN";break;case"number":o="NUMBER";break;case"string":o="STRING";break;default:o=Array.isArray(r)?"ARRAY":"OBJECT"}e.push({key:n,type:o,value:"STRING"===o?r:JSON.stringify(r)})}return e}),[]),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,i({url:f,body:JSON.stringify({parameter:p}),method:"POST"})];case 2:if(h=o.sent(),null===(m=null==h?void 0:h.Response)||void 0===m?void 0:m.Error)throw w(null===(g=null===(b=null==h?void 0:h.Response)||void 0===b?void 0:b.Error)||void 0===g?void 0:g.Message,t,u,null===(S=null===(O=null==h?void 0:h.Response)||void 0===O?void 0:O.Error)||void 0===S?void 0:S.Code,null===(_=null==h?void 0:h.Response)||void 0===_?void 0:_.RequestId);return[2,n(n({},null!==(j=null==h?void 0:h.Response)&&void 0!==j?j:{}),{data:null===(E=null==h?void 0:h.Response)||void 0===E?void 0:E.Data})];case 3:throw y=o.sent(),new a((null==y?void 0:y.message)||v,{originError:y});case 4:return[2]}}))}))}}})};function O(e){if(!e)throw new Error("cloud is required");if(!e.callFunction)throw new Error("cloud.callFunction is required");var t=f(e.callFunction.bind(e));return e.models=t,e}var S={init:O,generateHTTPClient:b};e.default=S,e.generateHTTPClient=b,e.init=O,Object.defineProperty(e,"__esModule",{value:!0})}(t)},679:(e,t,n)=>{"use strict";n.r(t),n.d(t,{lazyGetEntity:()=>f,registerModel:()=>v});var r=n(276),o=n(142),a={};for(const e in r)["default","lazyGetEntity","registerModel"].indexOf(e)<0&&(a[e]=()=>r[e]);n.d(t,a);var i=function(){return i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},i.apply(this,arguments)},c=function(e,t,n,r){return new(n||(n=Promise))((function(o,a){function i(e){try{s(r.next(e))}catch(e){a(e)}}function c(e){try{s(r.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,c)}s((r=r.apply(e,t||[])).next())}))},s=function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(c){return function(s){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,r=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=t.call(e,i)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,s])}}},u=o.U3.yE,l="models",d=new WeakMap;function f(e){return new Proxy({},{get:function(t,n){var o=d.get(e);return o||(o=function(e){var t=this,n=e.callFunction.bind(e),o=e.request.fetch.bind(e.request),a=e.getEndPointWithKey("GATEWAY"),u=a.BASE_URL,l=a.PROTOCOL,d="".concat(l).concat(u,"/model"),f="".concat(l).concat(u,"/sql"),p=(0,r.generateHTTPClient)(n,(function(e){return c(t,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return[4,o(i(i({},e),{headers:i({"Content-Type":"application/json"},e.headers)}))];case 1:return[4,t.sent().data];case 2:return[2,t.sent()]}}))}))}),d,{sqlBaseUrl:f});return p}(e),d.set(e,o)),o[n]}})}var p="cloudbase_init",h=new u;h.on(p,(function(e){var t=e.data;Object.assign(t,{models:f(t)})}));var y={name:l,namespace:l,entity:new Proxy({},{get:function(e,t){console.warn("【deprecated】Accessing Cloudbase.prototype.models.".concat(t,"."))}}),injectEvents:{bus:h,events:[p]}};try{cloudbase.registerComponent(y)}catch(e){}function v(e){try{e.registerComponent(y)}catch(e){console.warn(e)}}},142:(e,t,n)=>{"use strict";n.d(t,{U3:()=>r});var r={};n.r(r),n.d(r,{yE:()=>_});var o="@cloudbase/js-sdk";function a(){return o}var i,c="INVALID_OPERATION",s="OPERATION_FAIL";!function(e){e.local="local",e.none="none",e.session="session"}(i||(i={}));function u(e,t){console.warn("[".concat(a(),"][").concat(e,"]:").concat(t))}var l,d,f=(l=function(e,t){return l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},l(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}l(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),p=function(){return p=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},p.apply(this,arguments)},h=function(e,t,n,r){return new(n||(n=Promise))((function(o,a){function i(e){try{s(r.next(e))}catch(e){a(e)}}function c(e){try{s(r.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,c)}s((r=r.apply(e,t||[])).next())}))},y=function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(c){return function(s){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,r=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=t.call(e,i)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,s])}}};!function(e){function t(t){var n=e.call(this)||this,r=t.timeout,o=t.timeoutMsg,a=t.restrictedMethods;return n.timeout=r||0,n.timeoutMsg=o||"请求超时",n.restrictedMethods=a||["get","post","upload","download"],n}f(t,e),t.prototype.get=function(e){return this.request(p(p({},e),{method:"get"}),this.restrictedMethods.includes("get"))},t.prototype.post=function(e){return this.request(p(p({},e),{method:"post"}),this.restrictedMethods.includes("post"))},t.prototype.put=function(e){return this.request(p(p({},e),{method:"put"}))},t.prototype.upload=function(e){var t=e.data,n=e.file,r=e.name,o=e.method,a=e.headers,i=void 0===a?{}:a,c={post:"post",put:"put"}[null==o?void 0:o.toLowerCase()]||"put",s=new FormData;return"post"===c?(Object.keys(t).forEach((function(e){s.append(e,t[e])})),s.append("key",r),s.append("file",n),this.request(p(p({},e),{data:s,method:c}),this.restrictedMethods.includes("upload"))):this.request(p(p({},e),{method:"put",headers:i,body:n}),this.restrictedMethods.includes("upload"))},t.prototype.download=function(e){return h(this,void 0,void 0,(function(){var t,n,r,o;return y(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this.get(p(p({},e),{headers:{},responseType:"blob"}))];case 1:return t=a.sent().data,n=window.URL.createObjectURL(new Blob([t])),r=decodeURIComponent(new URL(e.url).pathname.split("/").pop()||""),(o=document.createElement("a")).href=n,o.setAttribute("download",r),o.style.display="none",document.body.appendChild(o),o.click(),window.URL.revokeObjectURL(n),document.body.removeChild(o),[3,3];case 2:return a.sent(),[3,3];case 3:return[2,new Promise((function(t){t({statusCode:200,tempFilePath:e.url})}))]}}))}))},t.prototype.fetch=function(e){var t;return h(this,void 0,void 0,(function(){var n,r,o,a,i,c,s,u,l,d,f,v=this;return y(this,(function(m){switch(m.label){case 0:return n=new AbortController,r=e.url,o=e.enableAbort,a=void 0!==o&&o,i=e.stream,c=void 0!==i&&i,s=e.signal,u=e.timeout,l=null!=u?u:this.timeout,s&&(s.aborted&&n.abort(),s.addEventListener("abort",(function(){return n.abort()}))),d=null,a&&l&&(d=setTimeout((function(){console.warn(v.timeoutMsg),n.abort(new Error(v.timeoutMsg))}),l)),[4,fetch(r,p(p({},e),{signal:n.signal})).then((function(e){return h(v,void 0,void 0,(function(){var t,n,r;return y(this,(function(o){switch(o.label){case 0:return clearTimeout(d),e.ok?(t=e,[3,3]):[3,1];case 1:return r=(n=Promise).reject,[4,e.json()];case 2:t=r.apply(n,[o.sent()]),o.label=3;case 3:return[2,t]}}))}))})).catch((function(e){return clearTimeout(d),Promise.reject(e)}))];case 1:return f=m.sent(),[2,{data:c?f.body:(null===(t=f.headers.get("content-type"))||void 0===t?void 0:t.includes("application/json"))?f.json():f.text(),statusCode:f.status,header:f.headers}]}}))}))},t.prototype.request=function(e,t){var n=this;void 0===t&&(t=!1);var r=String(e.method).toLowerCase()||"get";return new Promise((function(o){var a,i,c,s=e.url,u=e.headers,l=void 0===u?{}:u,d=e.data,f=e.responseType,p=e.withCredentials,h=e.body,y=e.onUploadProgress,v=function(e,t,n){void 0===n&&(n={});var r=/\?/.test(t),o="";return Object.keys(n).forEach((function(e){""===o?!r&&(t+="?"):o+="&",o+="".concat(e,"=").concat(encodeURIComponent(n[e]))})),/^http(s)?:\/\//.test(t+=o)?t:"".concat(e).concat(t)}("https:",s,"get"===r?d:{}),m=new XMLHttpRequest;m.open(r,v),f&&(m.responseType=f),Object.keys(l).forEach((function(e){m.setRequestHeader(e,l[e])})),y&&m.upload.addEventListener("progress",y),m.onreadystatechange=function(){var e={};if(4===m.readyState){var t=m.getAllResponseHeaders().trim().split(/[\r\n]+/),n={};t.forEach((function(e){var t=e.split(": "),r=t.shift().toLowerCase(),o=t.join(": ");n[r]=o})),e.header=n,e.statusCode=m.status;try{e.data="blob"===f?m.response:JSON.parse(m.responseText)}catch(t){e.data="blob"===f?m.response:m.responseText}clearTimeout(a),o(e)}},t&&n.timeout&&(a=setTimeout((function(){console.warn(n.timeoutMsg),m.abort()}),n.timeout)),c=d,i="[object FormData]"===Object.prototype.toString.call(c)?d:"application/x-www-form-urlencoded"===l["content-type"]?function(e){void 0===e&&(e={});var t=[];return Object.keys(e).forEach((function(n){t.push("".concat(n,"=").concat(encodeURIComponent(e[n])))})),t.join("&")}(d):h||(d?JSON.stringify(d):void 0),p&&(m.withCredentials=!0),m.send(i)}))}}((function(){})),function(e){e.WEB="web",e.WX_MP="wx_mp"}(d||(d={}));var v=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),m=function(e,t,n,r){return new(n||(n=Promise))((function(o,a){function i(e){try{s(r.next(e))}catch(e){a(e)}}function c(e){try{s(r.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,c)}s((r=r.apply(e,t||[])).next())}))},b=function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(c){return function(s){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,r=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=t.call(e,i)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,s])}}},w=function(e){function t(t){var n=e.call(this)||this;return n.root=t,t.tcbCacheObject||(t.tcbCacheObject={}),n}return v(t,e),t.prototype.setItem=function(e,t){this.root.tcbCacheObject[e]=t},t.prototype.getItem=function(e){return this.root.tcbCacheObject[e]},t.prototype.removeItem=function(e){delete this.root.tcbCacheObject[e]},t.prototype.clear=function(){delete this.root.tcbCacheObject},t}((function(){}));!function(){function e(e){this.keys={};var t=e.persistence,n=e.platformInfo,r=void 0===n?{}:n,o=e.keys,a=void 0===o?{}:o;this.platformInfo=r,this.storage||(this.persistenceTag=this.platformInfo.adapter.primaryStorage||t,this.storage=function(e,t){switch(e){case"local":default:return t.localStorage?t.localStorage:(u("INVALID_PARAMS","localStorage is not supported on current platform"),new w(t.root));case"none":return new w(t.root)}}(this.persistenceTag,this.platformInfo.adapter),this.keys=a)}Object.defineProperty(e.prototype,"mode",{get:function(){return this.storage.mode||"sync"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"persistence",{get:function(){return this.persistenceTag},enumerable:!1,configurable:!0}),e.prototype.setStore=function(e,t,n){if("async"!==this.mode){if(this.storage)try{var r={version:n||"localCachev1",content:t};this.storage.setItem(e,JSON.stringify(r))}catch(e){throw new Error(JSON.stringify({code:s,msg:"[".concat(a(),"][").concat(s,"]setStore failed"),info:e}))}}else u(c,"current platform's storage is asynchronous, please use setStoreAsync insteed")},e.prototype.setStoreAsync=function(e,t,n){return m(this,void 0,void 0,(function(){var r;return b(this,(function(o){switch(o.label){case 0:if(!this.storage)return[2];o.label=1;case 1:return o.trys.push([1,3,,4]),r={version:n||"localCachev1",content:t},[4,this.storage.setItem(e,JSON.stringify(r))];case 2:return o.sent(),[3,4];case 3:return o.sent(),[2];case 4:return[2]}}))}))},e.prototype.getStore=function(e,t){var n;if("async"!==this.mode){try{if("undefined"!=typeof process&&(null===(n={IS_MP_BUILD:!0})||void 0===n?void 0:n.tcb_token))return{IS_MP_BUILD:!0}.tcb_token;if(!this.storage)return""}catch(e){return""}t=t||"localCachev1";var r=this.storage.getItem(e);return r&&r.indexOf(t)>=0?JSON.parse(r).content:""}u(c,"current platform's storage is asynchronous, please use getStoreAsync insteed")},e.prototype.getStoreAsync=function(e,t){var n;return m(this,void 0,void 0,(function(){var r;return b(this,(function(o){switch(o.label){case 0:try{if("undefined"!=typeof process&&(null===(n={IS_MP_BUILD:!0})||void 0===n?void 0:n.tcb_token))return[2,{IS_MP_BUILD:!0}.tcb_token];if(!this.storage)return[2,""]}catch(e){return[2,""]}return t=t||"localCachev1",[4,this.storage.getItem(e)];case 1:return(r=o.sent())&&r.indexOf(t)>=0?[2,JSON.parse(r).content]:[2,""]}}))}))},e.prototype.removeStore=function(e){"async"!==this.mode?this.storage.removeItem(e):u(c,"current platform's storage is asynchronous, please use removeStoreAsync insteed")},e.prototype.removeStoreAsync=function(e){return m(this,void 0,void 0,(function(){return b(this,(function(t){switch(t.label){case 0:return[4,this.storage.removeItem(e)];case 1:return t.sent(),[2]}}))}))}}();var g=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),O=function(e,t){this.data=t||null,this.name=e},S=function(e){function t(t,n){var r=e.call(this,"error",{error:t,data:n})||this;return r.error=t,r}return g(t,e),t}(O),_=function(){function e(){this.listeners={}}return e.prototype.on=function(e,t){return function(e,t,n){n[e]=n[e]||[],n[e].push(t)}(e,t,this.listeners),this},e.prototype.off=function(e,t){return function(e,t,n){if(null==n?void 0:n[e]){var r=n[e].indexOf(t);-1!==r&&n[e].splice(r,1)}}(e,t,this.listeners),this},e.prototype.fire=function(e,t){if(e instanceof S)return console.error(e.error),this;var n="string"==typeof e?new O(e,t||{}):e,r=n.name;if(this.listens(r)){n.target=this;for(var o=0,a=this.listeners[r]?function(e,t,n){if(n||2===arguments.length)for(var r,o=0,a=t.length;o<a;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}([],this.listeners[r],!0):[];o<a.length;o++)a[o].call(this,n)}return this},e.prototype.listens=function(e){return this.listeners[e]&&this.listeners[e].length>0},e}();function j(e){this.message=e}function E(e){this.message=e}new _,new _,"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.indexOf("Firefox"),j.prototype=new Error,j.prototype.name="InvalidCharacterError","undefined"!=typeof window&&window.atob&&window.atob.bind(window),E.prototype=new Error,E.prototype.name="InvalidTokenError"}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var a=t[r]={exports:{}};return e[r].call(a.exports,a,a.exports,n),a.exports}return n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n(530)})()));
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("cloudbase_oauth",[],e):"object"==typeof exports?exports.cloudbase_oauth=e():t.cloudbase_oauth=e()}("undefined"!=typeof window?window:this,(()=>(()=>{"use strict";var t={118:function(t,e,r){var i=this&&this.__createBinding||(Object.create?function(t,e,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(e,r);n&&!("get"in n?!e.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,i,n)}:function(t,e,r,i){void 0===i&&(i=r),t[i]=e[r]}),n=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||i(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),n(r(488),e)},488:(t,e,r)=>{r.r(e),r.d(e,{Auth:()=>K,CloudbaseOAuth:()=>Z,authModels:()=>h});var i,n,s,o,a,u,h={};function c(){return"xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,(t=>{var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)}))}r.r(h),function(t){t.AUTH_SIGN_UP_URL="/auth/v1/signup",t.AUTH_TOKEN_URL="/auth/v1/token",t.AUTH_REVOKE_URL="/auth/v1/revoke",t.WEDA_USER_URL="/auth/v1/plugin/weda/userinfo",t.AUTH_RESET_PASSWORD="/auth/v1/reset",t.AUTH_GET_DEVICE_CODE="/auth/v1/device/code",t.CHECK_USERNAME="/auth/v1/checkUsername",t.CHECK_IF_USER_EXIST="/auth/v1/checkIfUserExist",t.GET_PROVIDER_TYPE="/auth/v1/mgr/provider/providerSubType",t.AUTH_SIGN_IN_URL="/auth/v1/signin",t.AUTH_SIGN_IN_ANONYMOUSLY_URL="/auth/v1/signin/anonymously",t.AUTH_SIGN_IN_WITH_PROVIDER_URL="/auth/v1/signin/with/provider",t.AUTH_SIGN_IN_WITH_WECHAT_URL="/auth/v1/signin/wechat/noauth",t.AUTH_SIGN_IN_CUSTOM="/auth/v1/signin/custom",t.PROVIDER_TOKEN_URL="/auth/v1/provider/token",t.PROVIDER_URI_URL="/auth/v1/provider/uri",t.USER_ME_URL="/auth/v1/user/me",t.AUTH_SIGNOUT_URL="/auth/v1/user/signout",t.USER_QUERY_URL="/auth/v1/user/query",t.USER_PRIFILE_URL="/auth/v1/user/profile",t.USER_BASIC_EDIT_URL="/auth/v1/user/basic/edit",t.USER_TRANS_BY_PROVIDER_URL="/auth/v1/user/trans/by/provider",t.PROVIDER_LIST="/auth/v1/user/provider",t.PROVIDER_BIND_URL="/auth/v1/user/provider/bind",t.PROVIDER_UNBIND_URL="/auth/v1/user/provider",t.CHECK_PWD_URL="/auth/v1/user/sudo",t.SUDO_URL="/auth/v1/user/sudo",t.BIND_CONTACT_URL="/auth/v1/user/contact",t.AUTH_SET_PASSWORD="/auth/v1/user/password",t.AUTHORIZE_DEVICE_URL="/auth/v1/user/device/authorize",t.AUTHORIZE_URL="/auth/v1/user/authorize",t.AUTHORIZE_INFO_URL="/auth/v1/user/authorize/info",t.AUTHORIZED_DEVICES_DELETE_URL="/auth/v1/user/authorized/devices/",t.AUTH_REVOKE_ALL_URL="/auth/v1/user/revoke/all",t.GET_USER_BEHAVIOR_LOG="/auth/v1/user/security/history",t.VERIFICATION_URL="/auth/v1/verification",t.VERIFY_URL="/auth/v1/verification/verify",t.CAPTCHA_DATA_URL="/auth/v1/captcha/data",t.VERIFY_CAPTCHA_DATA_URL="/auth/v1/captcha/data/verify",t.GET_CAPTCHA_URL="/auth/v1/captcha/init",t.GET_MINIPROGRAM_QRCODE="/auth/v1/qrcode/generate",t.GET_MINIPROGRAM_QRCODE_STATUS="/auth/v1/qrcode/get/status"}(i||(i={})),function(t){t.AUTH_SIGN_IN_URL="/auth/v2/signin/username",t.AUTH_TOKEN_URL="/auth/v2/token",t.USER_ME_URL="/auth/v2/user/me",t.VERIFY_URL="/auth/v2/signin/verificationcode",t.AUTH_SIGN_IN_WITH_PROVIDER_URL="/auth/v2/signin/with/provider",t.AUTH_PUBLIC_KEY="/auth/v2/signin/publichkey",t.AUTH_RESET_PASSWORD="/auth/v2/signin/password/update"}(n||(n={})),function(t){t.REGISTER="REGISTER",t.SIGN_IN="SIGN_IN",t.PASSWORD_RESET="PASSWORD_RESET",t.EMAIL_ADDRESS_CHANGE="EMAIL_ADDRESS_CHANGE",t.PHONE_NUMBER_CHANGE="PHONE_NUMBER_CHANGE"}(s||(s={})),(u=o||(o={})).UNREACHABLE="unreachable",u.LOCAL="local",u.CANCELLED="cancelled",u.UNKNOWN="unknown",u.UNAUTHENTICATED="unauthenticated",u.RESOURCE_EXHAUSTED="resource_exhausted",u.FAILED_PRECONDITION="failed_precondition",u.INVALID_ARGUMENT="invalid_argument",u.DEADLINE_EXCEEDED="deadline_exceeded",u.NOT_FOUND="not_found",u.ALREADY_EXISTS="already_exists",u.PERMISSION_DENIED="permission_denied",u.ABORTED="aborted",u.OUT_OF_RANGE="out_of_range",u.UNIMPLEMENTED="unimplemented",u.INTERNAL="internal",u.UNAVAILABLE="unavailable",u.DATA_LOSS="data_loss",u.INVALID_PASSWORD="invalid_password",u.PASSWORD_NOT_SET="password_not_set",u.INVALID_STATUS="invalid_status",u.USER_PENDING="user_pending",u.USER_BLOCKED="user_blocked",u.INVALID_VERIFICATION_CODE="invalid_verification_code",u.TWO_FACTOR_REQUIRED="two_factor_required",u.INVALID_TWO_FACTOR="invalid_two_factor",u.INVALID_TWO_FACTOR_RECOVERY="invalid_two_factor_recovery",u.UNDER_REVIEW="under_review",u.INVALID_REQUEST="invalid_request",u.UNAUTHORIZED_CLIENT="unauthorized_client",u.ACCESS_DENIED="access_denied",u.UNSUPPORTED_RESPONSE_TYPE="unsupported_response_type",u.INVALID_SCOPE="invalid_scope",u.INVALID_GRANT="invalid_grant",u.SERVER_ERROR="server_error",u.TEMPORARILY_UNAVAILABLE="temporarily_unavailable",u.INTERACTION_REQUIRED="interaction_required",u.LOGIN_REQUIRED="login_required",u.ACCOUNT_SELECTION_REQUIRED="account_selection_required",u.CONSENT_REQUIRED="consent_required",u.INVALID_REQUEST_URI="invalid_request_uri",u.INVALID_REQUEST_OBJECT="invalid_request_object",u.REQUEST_NOT_SUPPORTED="request_not_supported",u.REQUEST_URI_NOT_SUPPORTED="request_uri_not_supported",u.REGISTRATION_NOT_SUPPORTED="registration_not_supported",u.CAPTCHA_REQUIRED="captcha_required",u.CAPTCHA_INVALID="captcha_invalid",function(t){t.CLIENT_ID="client_id",t.CLIENT_SECRET="client_secret",t.RESPONSE_TYPE="response_type",t.SCOPE="scope",t.STATE="state",t.REDIRECT_URI="redirect_uri",t.ERROR="error",t.ERROR_DESCRIPTION="error_description",t.ERROR_URI="error_uri",t.GRANT_TYPE="grant_type",t.CODE="code",t.ACCESS_TOKEN="access_token",t.TOKEN_TYPE="token_type",t.EXPIRES_IN="expires_in",t.USERNAME="username",t.PASSWORD="password",t.REFRESH_TOKEN="refresh_token"}(a||(a={}));var l=r(655);function d(t,e,r,i,n,s,o){try{var a=t[s](o),u=a.value}catch(t){return void r(t)}a.done?e(u):Promise.resolve(u).then(i,n)}function f(t){return function(){var e=this,r=arguments;return new Promise((function(i,n){var s=t.apply(e,r);function o(t){d(s,i,n,o,a,"next",t)}function a(t){d(s,i,n,o,a,"throw",t)}o(void 0)}))}}var p=new Map;class v{constructor(t){this.clientId=(null==t?void 0:t.clientId)||"",p=p||new Map}run(t,e){var r=this;return f((function*(){t="".concat(r.clientId,"_").concat(t);var i=p.get(t);return i||(i=new Promise(((i,n)=>{f((function*(){try{yield r.runIdlePromise();var s=e();i(yield s)}catch(t){n(t)}finally{p.delete(t)}}))()})),p.set(t,i)),i}))()}runIdlePromise(){return Promise.resolve()}}var g="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function m(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,i)}return r}function y(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?m(Object(r),!0).forEach((function(e){_(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):m(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function _(t,e,r){return(e=function(t){var e=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function T(t,e,r,i,n,s,o){try{var a=t[s](o),u=a.value}catch(t){return void r(t)}a.done?e(u):Promise.resolve(u).then(i,n)}function E(t){return function(){var e=this,r=arguments;return new Promise((function(i,n){var s=t.apply(e,r);function o(t){T(s,i,n,o,a,"next",t)}function a(t){T(s,i,n,o,a,"throw",t)}o(void 0)}))}}var S="x-request-id",b="x-device-id",I="device_id",w=function(){var t=E((function*(t,e){var r=null,i=null;try{var n=Object.assign({},e);n.method||(n.method="GET"),n.body&&"string"!=typeof n.body&&(n.body=JSON.stringify(n.body));var s=yield fetch(t,n),a=yield s.json();null!=a&&a.error?(i=a).error_uri=new URL(t).pathname:r=a}catch(e){i={error:o.UNREACHABLE,error_description:e.message,error_uri:new URL(t).pathname}}if(i)throw i;return r}));return function(e,r){return t.apply(this,arguments)}}(),R=new class{constructor(t){this._env=(null==t?void 0:t.env)||""}getItem(t){var e=this;return E((function*(){return window.localStorage.getItem("".concat(t).concat(e._env))}))()}removeItem(t){var e=this;return E((function*(){window.localStorage.removeItem("".concat(t).concat(e._env))}))()}setItem(t,e){var r=this;return E((function*(){window.localStorage.setItem("".concat(t).concat(r._env),e)}))()}getItemSync(t){return window.localStorage.getItem("".concat(t).concat(this._env))}removeItemSync(t){window.localStorage.removeItem("".concat(t).concat(this._env))}setItemSync(t,e){window.localStorage.setItem("".concat(t).concat(this._env),e)}};function O(t){var e=!0;return null!=t&&t.expires_at&&null!=t&&t.access_token&&(e=t.expires_at<new Date),e}class C{constructor(t){this.credentials=null,this.singlePromise=null,this.tokenSectionName=t.tokenSectionName,this.storage=t.storage,this.clientId=t.clientId,this.singlePromise=new v({clientId:this.clientId})}getStorageCredentialsSync(){var t=null,e=this.storage.getItemSync(this.tokenSectionName);if(null!=e)try{var r;null!==(r=t=JSON.parse(e))&&void 0!==r&&r.expires_at&&(t.expires_at=new Date(t.expires_at))}catch(e){this.storage.removeItem(this.tokenSectionName),t=null}return t}setCredentials(t){var e=this;return E((function*(){if(null!=t&&t.expires_in){if(null!=t&&t.expires_at||(t.expires_at=new Date(Date.now()+1e3*(t.expires_in-30))),e.storage){var r=JSON.stringify(t);yield e.storage.setItem(e.tokenSectionName,r)}e.credentials=t}else e.storage&&(yield e.storage.removeItem(e.tokenSectionName)),e.credentials=null}))()}getCredentials(){var t=this;return E((function*(){return t.singlePromise.run("getCredentials",E((function*(){return O(t.credentials)&&(t.credentials=yield t.getStorageCredentials()),t.credentials})))}))()}getStorageCredentials(){var t=this;return E((function*(){return t.singlePromise.run("_getStorageCredentials",E((function*(){var e=null,r=yield t.storage.getItem(t.tokenSectionName);if(null!=r)try{var i;null!==(i=e=JSON.parse(r))&&void 0!==i&&i.expires_at&&(e.expires_at=new Date(e.expires_at))}catch(r){yield t.storage.removeItem(t.tokenSectionName),e=null}return e})))}))()}}class A{constructor(t){this.singlePromise=null,t.clientSecret||(t.clientSecret=""),!t.clientId&&t.env&&(t.clientId=t.env),this.apiOrigin=t.apiOrigin,this.clientId=t.clientId,this.singlePromise=new v({clientId:this.clientId}),this.retry=this.formatRetry(t.retry,A.defaultRetry),t.baseRequest?this.baseRequest=t.baseRequest:this.baseRequest=w,this.tokenInURL=t.tokenInURL,this.headers=t.headers,this.storage=t.storage||R,this.localCredentials=new C({tokenSectionName:"credentials_".concat(t.clientId),storage:this.storage,clientId:t.clientId}),this.clientSecret=t.clientSecret,t.clientId&&(this.basicAuth="Basic ".concat(function(t){for(var e,r,i,n,s="",o=0,a=(t=String(t)).length%3;o<t.length;){if((r=t.charCodeAt(o++))>255||(i=t.charCodeAt(o++))>255||(n=t.charCodeAt(o++))>255)throw new TypeError("Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the Latin1 range.");s+=g.charAt((e=r<<16|i<<8|n)>>18&63)+g.charAt(e>>12&63)+g.charAt(e>>6&63)+g.charAt(63&e)}return a?s.slice(0,a-3)+"===".substring(a):s}("".concat(t.clientId,":").concat(this.clientSecret)))),this.wxCloud=t.wxCloud;try{(function(){if("undefined"==typeof wx)return!1;if("undefined"==typeof Page)return!1;if(!wx.getSystemInfoSync)return!1;if(!wx.getStorageSync)return!1;if(!wx.setStorageSync)return!1;if(!wx.connectSocket)return!1;if(!wx.request)return!1;try{if(!wx.getSystemInfoSync())return!1;if("qq"===wx.getSystemInfoSync().AppPlatform)return!1}catch(t){return!1}return!0})()&&void 0===this.wxCloud&&t.env&&(wx.cloud.init({env:t.env}),this.wxCloud=wx.cloud)}catch(t){}this.refreshTokenFunc=t.refreshTokenFunc||this.defaultRefreshTokenFunc,this.anonymousSignInFunc=t.anonymousSignInFunc}setCredentials(t){return this.localCredentials.setCredentials(t)}getAccessToken(){var t=this;return E((function*(){var e=yield t.getCredentials();if(null!=e&&e.access_token)return Promise.resolve(e.access_token);var r={error:o.UNAUTHENTICATED};return Promise.reject(r)}))()}request(t,e){var r=this;return E((function*(){var i,n;e||(e={});var s=r.formatRetry(e.retry,r.retry);if(e.headers=e.headers||{},r.headers&&(e.headers=y(y({},r.headers),e.headers)),e.headers[S]||(e.headers[S]=c()),!e.headers[b]){var a=yield r.getDeviceId();e.headers[b]=a}if(null!==(i=e)&&void 0!==i&&i.withBasicAuth&&r.basicAuth&&(e.headers.Authorization=r.basicAuth),null!==(n=e)&&void 0!==n&&n.withCredentials){var u=yield r.getCredentials();u&&(r.tokenInURL?(t.indexOf("?")<0&&(t+="?"),t+="access_token=".concat(u.access_token)):e.headers.Authorization="".concat(u.token_type," ").concat(u.access_token))}else r.clientId&&t.indexOf("client_id")<0&&(t+=t.indexOf("?")<0?"?":"&",t+="client_id=".concat(r.clientId));t.startsWith("/")&&(t=r.apiOrigin+t);for(var h=null,l=s+1,d=0;d<l;d++){try{h=e.useWxCloud?yield r.wxCloudCallFunction(t,e):yield r.baseRequest(t,e);break}catch(t){if(e.withCredentials&&t&&t.error===o.UNAUTHENTICATED)return yield r.setCredentials(null),Promise.reject(t);if(d===s||!t||"unreachable"!==t.error)return Promise.reject(t)}yield r.sleep(A.retryInterval)}return h}))()}wxCloudCallFunction(t,e){var r=this;return E((function*(){var i=null,n=null;try{var s,a="";try{a=yield wx.getRendererUserAgent()}catch(t){}var{result:u}=yield r.wxCloud.callFunction({name:"httpOverCallFunction",data:{url:t,method:e.method,headers:y({origin:"https://servicewechat.com","User-Agent":a},e.headers),body:e.body}});null!=u&&null!==(s=u.body)&&void 0!==s&&s.error_code?(n=null==u?void 0:u.body).error_uri=(0,l.y)(t):i=null==u?void 0:u.body}catch(e){n={error:o.UNREACHABLE,error_description:e.message,error_uri:(0,l.y)(t)}}if(n)throw n;return i}))()}getCredentials(){var t=this;return E((function*(){var e=yield t.localCredentials.getCredentials();if(!e)return t.unAuthenticatedError("credentials not found");if(O(e))if(e.refresh_token)try{e=yield t.refreshToken(e)}catch(r){if("anonymous"!==e.scope)return Promise.reject(r);e=yield t.anonymousLogin(e)}else{if("anonymous"!==e.scope)return t.unAuthenticatedError("no refresh token found in credentials");e=yield t.anonymousLogin(e)}return e}))()}getCredentialsSync(){return this.localCredentials.getStorageCredentialsSync()}getCredentialsAsync(){return this.getCredentials()}getScope(){var t=this;return E((function*(){var e=yield t.localCredentials.getCredentials();return e?e.scope:t.unAuthenticatedError("credentials not found")}))()}getGroups(){var t=this;return E((function*(){var e=yield t.localCredentials.getCredentials();return e?e.groups:t.unAuthenticatedError("credentials not found")}))()}refreshToken(t){var e=this;return E((function*(){return e.singlePromise.run("_refreshToken",E((function*(){if(!t||!t.refresh_token)return e.unAuthenticatedError("no refresh token found in credentials");try{var r=yield e.refreshTokenFunc(t.refresh_token,t);return yield e.localCredentials.setCredentials(r),r}catch(t){return t.error===o.INVALID_GRANT?(yield e.localCredentials.setCredentials(null),e.unAuthenticatedError(t.error_description)):Promise.reject(t)}})))}))()}anonymousLogin(t){var e=this;return E((function*(){return e.singlePromise.run("_anonymousLogin",E((function*(){if(e.anonymousSignInFunc){var r=yield e.anonymousSignInFunc(t);t=r||(yield e.localCredentials.getCredentials())}else t=yield e.anonymousSignIn(t);return t})))}))()}checkRetry(t){var e=null;if(("number"!=typeof t||t<A.minRetry||t>A.maxRetry)&&(e={error:o.UNREACHABLE,error_description:"wrong options param: retry"}),e)throw e;return t}formatRetry(t,e){return void 0===t?e:this.checkRetry(t)}sleep(t){return E((function*(){return new Promise((e=>{setTimeout((()=>{e()}),t)}))}))()}anonymousSignIn(t){var e=this;return E((function*(){return e.singlePromise.run("_anonymous",E((function*(){if(!t||"anonymous"!==t.scope)return e.unAuthenticatedError("no anonymous in credentials");try{var r=yield e.request(i.AUTH_SIGN_IN_ANONYMOUSLY_URL,{method:"POST",withBasicAuth:!0,body:{}});return yield e.localCredentials.setCredentials(r),r}catch(t){return t.error===o.INVALID_GRANT?(yield e.localCredentials.setCredentials(null),e.unAuthenticatedError(t.error_description)):Promise.reject(t)}})))}))()}defaultRefreshTokenFunc(t,e){var r=this;return E((function*(){if(void 0===t||""===t)return r.unAuthenticatedError("refresh token not found");var s=i.AUTH_TOKEN_URL;return"v2"===(null==e?void 0:e.version)&&(s=n.AUTH_TOKEN_URL),y(y({},yield r.request(s,{method:"POST",body:{client_id:r.clientId,client_secret:r.clientSecret,grant_type:"refresh_token",refresh_token:t}})),{},{version:(null==e?void 0:e.version)||"v1"})}))()}getDeviceId(){var t=this;return E((function*(){if(t.deviceID)return t.deviceID;var e=yield t.storage.getItem(I);return"string"==typeof e&&e.length>=16&&e.length<=48||(e=c(),yield t.storage.setItem(I,e)),t.deviceID=e,e}))()}unAuthenticatedError(t){var e={error:o.UNAUTHENTICATED,error_description:t};return Promise.reject(e)}}function P(){if("undefined"==typeof globalThis)return!1;var{wx:t}=globalThis;if(void 0===t)return!1;if(void 0===globalThis.Page)return!1;if(!t.getSystemInfoSync)return!1;if(!t.getStorageSync)return!1;if(!t.setStorageSync)return!1;if(!t.connectSocket)return!1;if(!t.request)return!1;try{if(!t.getSystemInfoSync())return!1;if("qq"===t.getSystemInfoSync().AppPlatform)return!1}catch(t){return!1}return!0}A.defaultRetry=2,A.minRetry=0,A.maxRetry=5,A.retryInterval=1e3;var U=!1;function D(){U=U||void 0!==typeof window&&"miniprogram"===window.__wxjs_environment}try{P()||(U=U||!!navigator.userAgent.match(/miniprogram/i)||"miniprogram"===window.__wxjs_environment,window&&window.WeixinJSBridge&&window.WeixinJSBridge.invoke?D():"undefined"!=typeof document&&document.addEventListener("WeixinJSBridgeReady",D,!1))}catch(t){}function N(){return U}const L=class{constructor(t){if(this.params={},"string"==typeof t)this.parse(t);else if(t&&"object"==typeof t)for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&this.append(e,t[e])}parse(t){t.split("&").forEach((t=>{var[e,r]=t.split("=").map(decodeURIComponent);this.append(e,r)}))}append(t,e){this.params[t]?this.params[t]=this.params[t].concat([e]):this.params[t]=[e]}get(t){return this.params[t]?this.params[t][0]:null}getAll(t){return this.params[t]||[]}delete(t){delete this.params[t]}has(t){return Object.prototype.hasOwnProperty.call(this.params,t)}set(t,e){this.params[t]=[e]}toString(){var t=this,e=[],r=function(r){Object.prototype.hasOwnProperty.call(t.params,r)&&t.params[r].forEach((t=>{e.push("".concat(encodeURIComponent(r),"=").concat(encodeURIComponent(t)))}))};for(var i in this.params)r(i);return e.join("&")}};function x(t,e,r,i,n,s,o){try{var a=t[s](o),u=a.value}catch(t){return void r(t)}a.done?e(u):Promise.resolve(u).then(i,n)}function k(t){return function(){var e=this,r=arguments;return new Promise((function(i,n){var s=t.apply(e,r);function o(t){x(s,i,n,o,a,"next",t)}function a(t){x(s,i,n,o,a,"throw",t)}o(void 0)}))}}class q{constructor(t){t.openURIWithCallback||(t.openURIWithCallback=this.getDefaultOpenURIWithCallback()),t.storage||(t.storage=R),this.config=t,this.tokenSectionName="captcha_".concat(t.clientId)}isMatch(){var t,e;return(null===(t=this.config)||void 0===t||null===(t=t.adapter)||void 0===t||null===(e=t.isMatch)||void 0===e?void 0:e.call(t))||P()}request(t,e){var r=this;return k((function*(){e||(e={}),e.method||(e.method="GET");var i,n="".concat(e.method,":").concat(t),s=t;e.withCaptcha&&(s=yield r.appendCaptchaTokenToURL(t,n,!1));try{i=yield r.config.request(s,e)}catch(i){return i.error===o.CAPTCHA_REQUIRED||i.error===o.CAPTCHA_INVALID?(t=yield r.appendCaptchaTokenToURL(t,n,i.error===o.CAPTCHA_INVALID),r.config.request(t,e)):Promise.reject(i)}return i}))()}getDefaultOpenURIWithCallback(){if(!this.isMatch()&&!N()&&(window.location.search.indexOf("__captcha")>0&&(document.body.style.display="none"),null===document.getElementById("captcha_panel_wrap"))){var t=document.createElement("div");t.style.cssText="background-color: rgba(0, 0, 0, 0.7);position: fixed;left: 0px;right: 0px;top: 0px;bottom: 0px;padding: 9vw 0 0 0;display: none;z-index:100;",t.setAttribute("id","captcha_panel_wrap"),setTimeout((()=>{document.body.appendChild(t)}),0)}return this.defaultOpenURIWithCallback}defaultOpenURIWithCallback(t,e){return k((function*(){var{width:r="355px",height:i="355px"}=e||{};if(t.match(/^(data:.*)$/))return Promise.reject({error:o.UNIMPLEMENTED,error_description:"need to impl captcha data"});var n=document.getElementById("captcha_panel_wrap"),s=document.createElement("iframe");return n.innerHTML="",s.setAttribute("src",t),s.setAttribute("id","review-panel-iframe"),s.style.cssText="min-width:".concat(r,";display:block;height:").concat(i,";margin:0 auto;background-color: rgb(255, 255, 255);border: none;"),n.appendChild(s),n.style.display="block",new Promise(((t,e)=>{s.onload=function(){try{var r=window.location,i=s.contentWindow.location;if(i.host+i.pathname===r.host+r.pathname){n.style.display="none";var o=new L(i.search),a=o.get("captcha_token");return a?t({captcha_token:a,expires_in:Number(o.get("expires_in"))}):e({error:o.get("error"),error_description:o.get("error_description")})}n.style.display="block"}catch(t){n.style.display="block"}}}))}))()}getCaptchaToken(t,e){var r=this;return k((function*(){if(!t){var n=yield r.findCaptchaToken();if(n)return n}var s;if(r.isMatch()||N()){var o=yield r.config.request(i.CAPTCHA_DATA_URL,{method:"POST",body:{state:e,redirect_uri:""},withCredentials:!1});s={url:"".concat(o.data,"?state=").concat(encodeURIComponent(e),"&token=").concat(encodeURIComponent(o.token))}}else{var a="".concat(window.location.origin+window.location.pathname,"?__captcha=on");if((s=yield r.config.request(i.GET_CAPTCHA_URL,{method:"POST",body:{client_id:r.config.clientId,redirect_uri:a,state:e},withCredentials:!1})).captcha_token){var u={captcha_token:s.captcha_token,expires_in:s.expires_in};return r.saveCaptchaToken(u),s.captcha_token}}var h=yield r.config.openURIWithCallback(s.url);return r.saveCaptchaToken(h),h.captcha_token}))()}appendCaptchaTokenToURL(t,e,r){var i=this;return k((function*(){var n=yield i.getCaptchaToken(r,e);return t.indexOf("?")>0?t+="&captcha_token=".concat(n):t+="?captcha_token=".concat(n),t}))()}saveCaptchaToken(t){var e=this;return k((function*(){t.expires_at=new Date(Date.now()+1e3*(t.expires_in-10));var r=JSON.stringify(t);yield e.config.storage.setItem(e.tokenSectionName,r)}))()}findCaptchaToken(){var t=this;return k((function*(){var e=yield t.config.storage.getItem(t.tokenSectionName);if(null!=e)try{var r=JSON.parse(e);return null!=r&&r.expires_at&&(r.expires_at=new Date(r.expires_at)),r.expires_at<new Date?null:r.captcha_token}catch(e){return yield t.config.storage.removeItem(t.tokenSectionName),null}return null}))()}}var B=["provider_redirect_uri","other_params"];function H(t,e,r,i,n,s,o){try{var a=t[s](o),u=a.value}catch(t){return void r(t)}a.done?e(u):Promise.resolve(u).then(i,n)}function V(t){return function(){var e=this,r=arguments;return new Promise((function(i,n){var s=t.apply(e,r);function o(t){H(s,i,n,o,a,"next",t)}function a(t){H(s,i,n,o,a,"throw",t)}o(void 0)}))}}function M(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,i)}return r}function j(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?M(Object(r),!0).forEach((function(e){G(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):M(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function G(t,e,r){return(e=function(t){var e=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function F(t,e){try{var r;if(((null==e||null===(r=e.root)||void 0===r?void 0:r.globalThis)||globalThis).IS_MP_BUILD)return}catch(t){}}class K{static parseParamsToSearch(t){return Object.keys(t).forEach((e=>{t[e]||delete t[e]})),new L(t).toString()}constructor(t){var{request:e}=t,r=t.credentialsClient;if(!r){var i={apiOrigin:t.apiOrigin,clientId:t.clientId,storage:t.storage,env:t.env,baseRequest:t.baseRequest,anonymousSignInFunc:t.anonymousSignInFunc,wxCloud:t.wxCloud};r=new A(i)}if(!e){var n=r.request.bind(r),s=new q(j({clientId:t.clientId,request:n,storage:t.storage,adapter:t.adapter},t.captchaOptions));e=s.request.bind(s)}this.config={env:t.env,apiOrigin:t.apiOrigin,clientId:t.clientId,request:e,credentialsClient:r,storage:t.storage||R,adapter:t.adapter}}getParamsByVersion(t,e){var r,s=(0,l.I)(t),o=(null===(r={v2:n}[null==s?void 0:s.version])||void 0===r?void 0:r[e])||i[e];return s&&delete s.version,{params:s,url:o}}signIn(t){var e=this;return V((function*(){var r=t.version||"v1",i=e.getParamsByVersion(t,"AUTH_SIGN_IN_URL");i.params.query&&delete i.params.query;var n=yield e.getEncryptParams(i.params),s=yield e.config.request(i.url,{method:"POST",body:n});return yield e.config.credentialsClient.setCredentials(j(j({},s),{},{version:r})),Promise.resolve(s)}))()}signInAnonymously(){var t=arguments,e=this;return V((function*(){var r=t.length>0&&void 0!==t[0]?t[0]:{},n=t.length>1&&void 0!==t[1]&&t[1],s=yield e.config.request(i.AUTH_SIGN_IN_ANONYMOUSLY_URL,{method:"POST",body:r,useWxCloud:n});return yield e.config.credentialsClient.setCredentials(s),Promise.resolve(s)}))()}signUp(t){var e=this;return V((function*(){var r=yield e.config.request(i.AUTH_SIGN_UP_URL,{method:"POST",body:t});return yield e.config.credentialsClient.setCredentials(r),Promise.resolve(r)}))()}signOut(t){var e=this;return V((function*(){var r={};if(t){try{r=yield e.config.request(i.AUTH_SIGNOUT_URL,{method:"POST",withCredentials:!0,body:t})}catch(t){t.error!==o.UNAUTHENTICATED&&console.log("sign_out_error",t)}return yield e.config.credentialsClient.setCredentials(),r}var n=yield e.config.credentialsClient.getAccessToken(),s=yield e.config.request(i.AUTH_REVOKE_URL,{method:"POST",body:{token:n}});return yield e.config.credentialsClient.setCredentials(),Promise.resolve(s)}))()}revokeAllDevices(){var t=this;return V((function*(){yield t.config.request(i.AUTH_REVOKE_ALL_URL,{method:"DELETE",withCredentials:!0})}))()}revokeDevice(t){var e=this;return V((function*(){yield e.config.request(i.AUTHORIZED_DEVICES_DELETE_URL+t.device_id,{method:"DELETE",withCredentials:!0})}))()}getVerification(t,e){var r=this;return V((function*(){var n=!1;return("CUR_USER"===t.target||(yield r.hasLoginState()))&&(n=!0),r.config.request(i.VERIFICATION_URL,{method:"POST",body:t,withCaptcha:(null==e?void 0:e.withCaptcha)||!1,withCredentials:n})}))()}verify(t){var e=this;return V((function*(){var r=e.getParamsByVersion(t,"VERIFY_URL"),i=yield e.config.request(r.url,{method:"POST",body:r.params});return"v2"===(null==t?void 0:t.version)&&(yield e.config.credentialsClient.setCredentials(j(j({},i),{},{version:"v2"}))),i}))()}genProviderRedirectUri(t){var e=this;return V((function*(){var{provider_redirect_uri:r,other_params:n={}}=t,s=function(t,e){if(null==t)return{};var r,i,n=function(t,e){if(null==t)return{};var r={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(e.includes(i))continue;r[i]=t[i]}return r}(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],e.includes(r)||{}.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}(t,B);r&&!s.redirect_uri&&(s.redirect_uri=r);var o="".concat(i.PROVIDER_URI_URL,"?").concat(K.parseParamsToSearch(s));return Object.keys(n).forEach((t=>{var e=n[t];("sign_out_uri"!==t||(null==e?void 0:e.length)>0)&&(o+="&other_params[".concat(t,"]=").concat(encodeURIComponent(e)))})),e.config.request(o,{method:"GET"})}))()}grantProviderToken(t){var e=arguments,r=this;return V((function*(){var n=e.length>1&&void 0!==e[1]&&e[1];return r.config.request(i.PROVIDER_TOKEN_URL,{method:"POST",body:t,useWxCloud:n})}))()}patchProviderToken(t){var e=this;return V((function*(){return e.config.request(i.PROVIDER_TOKEN_URL,{method:"PATCH",body:t})}))()}signInWithProvider(t){var e=arguments,r=this;return V((function*(){var i=e.length>1&&void 0!==e[1]&&e[1],n=r.getParamsByVersion(t,"AUTH_SIGN_IN_WITH_PROVIDER_URL"),s=yield r.config.request(n.url,{method:"POST",body:n.params,useWxCloud:i});return yield r.config.credentialsClient.setCredentials(j(j({},s),{},{version:(null==t?void 0:t.version)||"v1"})),Promise.resolve(s)}))()}signInCustom(t){var e=this;return V((function*(){var r=yield e.config.request(i.AUTH_SIGN_IN_CUSTOM,{method:"POST",body:t});return yield e.config.credentialsClient.setCredentials(r),Promise.resolve(r)}))()}signInWithWechat(){var t=arguments,e=this;return V((function*(){var r=t.length>0&&void 0!==t[0]?t[0]:{},n=yield e.config.request(i.AUTH_SIGN_IN_WITH_WECHAT_URL,{method:"POST",body:r});return yield e.config.credentialsClient.setCredentials(n),Promise.resolve(n)}))()}bindWithProvider(t){var e=this;return V((function*(){return e.config.request(i.PROVIDER_BIND_URL,{method:"POST",body:t,withCredentials:!0})}))()}getUserProfile(t){var e=this;return V((function*(){return e.getUserInfo(t)}))()}getUserInfo(){var t=arguments,e=this;return V((function*(){var r,i=t.length>0&&void 0!==t[0]?t[0]:{},n=e.getParamsByVersion(i,"USER_ME_URL");if(null!==(r=n.params)&&void 0!==r&&r.query){var s=new L(n.params.query);n.url+="?".concat(s.toString())}var o=yield e.config.request(n.url,{method:"GET",withCredentials:!0});return o.sub&&(o.uid=o.sub),o}))()}getWedaUserInfo(){var t=this;return V((function*(){return yield t.config.request(i.WEDA_USER_URL,{method:"GET",withCredentials:!0})}))()}deleteMe(t){var e=this;return V((function*(){var r=e.getParamsByVersion(t,"USER_ME_URL"),i="".concat(r.url,"?").concat(K.parseParamsToSearch(r.params));return e.config.request(i,{method:"DELETE",withCredentials:!0})}))()}hasLoginState(){var t=this;return V((function*(){try{return yield t.config.credentialsClient.getAccessToken(),!0}catch(t){return!1}}))()}hasLoginStateSync(){return this.config.credentialsClient.getCredentialsSync()}getLoginState(){var t=this;return V((function*(){return t.config.credentialsClient.getCredentialsAsync()}))()}transByProvider(t){var e=this;return V((function*(){return e.config.request(i.USER_TRANS_BY_PROVIDER_URL,{method:"PATCH",body:t,withCredentials:!0})}))()}grantToken(t){var e=this;return V((function*(){var r=e.getParamsByVersion(t,"AUTH_TOKEN_URL");return e.config.request(r.url,{method:"POST",body:r.params})}))()}getProviders(){var t=this;return V((function*(){return t.config.request(i.PROVIDER_LIST,{method:"GET",withCredentials:!0})}))()}unbindProvider(t){var e=this;return V((function*(){return e.config.request("".concat(i.PROVIDER_UNBIND_URL,"/").concat(t.provider_id),{method:"DELETE",withCredentials:!0})}))()}checkPassword(t){var e=this;return V((function*(){return e.config.request("".concat(i.CHECK_PWD_URL),{method:"POST",withCredentials:!0,body:t})}))()}editContact(t){var e=this;return V((function*(){return e.config.request("".concat(i.BIND_CONTACT_URL),{method:"PATCH",withCredentials:!0,body:t})}))()}setPassword(t){var e=this;return V((function*(){return e.config.request("".concat(i.AUTH_SET_PASSWORD),{method:"PATCH",withCredentials:!0,body:t})}))()}updatePasswordByOld(t){var e=this;return V((function*(){var r=yield e.sudo({password:t.old_password});return e.setPassword({sudo_token:r.sudo_token,new_password:t.new_password})}))()}sudo(t){var e=this;return V((function*(){return e.config.request("".concat(i.SUDO_URL),{method:"POST",withCredentials:!0,body:t})}))()}sendVerificationCodeToCurrentUser(t){var e=this;return V((function*(){return t.target="CUR_USER",e.config.request(i.VERIFICATION_URL,{method:"POST",body:t,withCredentials:!0,withCaptcha:!0})}))()}changeBoundProvider(t){var e=this;return V((function*(){return e.config.request("".concat(i.PROVIDER_LIST,"/").concat(t.provider_id,"/trans"),{method:"POST",body:{provider_trans_token:t.trans_token},withCredentials:!0})}))()}setUserProfile(t){var e=this;return V((function*(){return e.config.request(i.USER_PRIFILE_URL,{method:"PATCH",body:t,withCredentials:!0})}))()}updateUserBasicInfo(t){var e=this;return V((function*(){return e.config.request(i.USER_BASIC_EDIT_URL,{method:"POST",withCredentials:!0,body:t})}))()}queryUserProfile(t){var e=this;return V((function*(){var r=new L(t);return e.config.request("".concat(i.USER_QUERY_URL,"?").concat(r.toString()),{method:"GET",withCredentials:!0})}))()}setCustomSignFunc(t){this.getCustomSignTicketFn=t}signInWithCustomTicket(){var t=this;return V((function*(){var e=t.getCustomSignTicketFn;if(!e)return Promise.reject({error:"failed_precondition",error_description:"please use setCustomSignFunc to set custom sign function"});var r=yield e();return t.signInCustom({provider_id:"custom",ticket:r})}))()}resetPassword(t){var e=this;return V((function*(){return e.config.request(i.AUTH_RESET_PASSWORD,{method:"POST",body:t})}))()}authorize(t){var e=this;return V((function*(){return e.config.request(i.AUTHORIZE_URL,{method:"POST",withCredentials:!0,body:t})}))()}authorizeDevice(t){var e=this;return V((function*(){return e.config.request(i.AUTHORIZE_DEVICE_URL,{method:"POST",withCredentials:!0,body:t})}))()}deviceAuthorize(t){var e=this;return V((function*(){return e.config.request(i.AUTH_GET_DEVICE_CODE,{method:"POST",body:t,withCredentials:!0})}))()}authorizeInfo(t){var e=this;return V((function*(){var r="".concat(i.AUTHORIZE_INFO_URL,"?").concat(K.parseParamsToSearch(t)),n=!0,s=!1;return(yield e.hasLoginState())&&(s=!0,n=!1),e.config.request(r,{method:"GET",withBasicAuth:n,withCredentials:s})}))()}checkUsername(t){var e=this;return V((function*(){return e.config.request(i.CHECK_USERNAME,{method:"GET",body:t,withCredentials:!0})}))()}checkIfUserExist(t){var e=this;return V((function*(){var r=new L(t);return e.config.request("".concat(i.CHECK_IF_USER_EXIST,"?").concat(r.toString()),{method:"GET"})}))()}loginScope(){var t=this;return V((function*(){return t.config.credentialsClient.getScope()}))()}loginGroups(){var t=this;return V((function*(){return t.config.credentialsClient.getGroups()}))()}refreshTokenForce(t){var e=this;return V((function*(){var r=yield e.config.credentialsClient.getCredentials();return yield e.config.credentialsClient.refreshToken(j(j({},r),{},{version:(null==t?void 0:t.version)||"v1"}))}))()}getCredentials(){var t=this;return V((function*(){return t.config.credentialsClient.getCredentials()}))()}getPublicKey(){var t=this;return V((function*(){return t.config.request(n.AUTH_PUBLIC_KEY,{method:"POST",body:{}})}))()}getEncryptParams(t){var e=this;return V((function*(){var{isEncrypt:r}=t;delete t.isEncrypt;var i=(0,l.I)(t),n=F(0,e.config.adapter);if(!n)return t;var s="",o="";try{var a=yield e.getPublicKey();if(s=a.public_key,o=a.public_key_thumbprint,!s||!o)throw a}catch(t){throw t}return{params:n.getEncryptInfo({publicKey:s,payload:i}),public_key_thumbprint:o}}))()}getProviderSubType(){var t=this;return V((function*(){return t.config.request(i.GET_PROVIDER_TYPE,{method:"POST",body:{provider_id:"weda"}})}))()}verifyCaptchaData(t){var e=this;return V((function*(){var{token:r,key:n}=t;return e.config.request(i.VERIFY_CAPTCHA_DATA_URL,{method:"POST",body:{token:r,key:n},withCredentials:!1})}))()}createCaptchaData(t){var e=this;return V((function*(){var{state:r,redirect_uri:n}=t;return e.config.request(i.CAPTCHA_DATA_URL,{method:"POST",body:{state:r,redirect_uri:n},withCredentials:!1})}))()}getMiniProgramCode(t){var e=this;return V((function*(){return e.config.request(i.GET_MINIPROGRAM_QRCODE,{method:"POST",body:t})}))()}getMiniProgramQrCodeStatus(t){var e=this;return V((function*(){return e.config.request(i.GET_MINIPROGRAM_QRCODE_STATUS,{method:"POST",body:t})}))()}getUserBehaviorLog(t){var e=this;return V((function*(){var r="".concat(i.GET_USER_BEHAVIOR_LOG,"?").concat({LOGIN:"query[action]=USER_LOGIN",MODIFY:"ne_query[action]=USER_LOGIN"}[t.type],"&limit=").concat(t.limit).concat(t.page_token?"&page_token=".concat(t.page_token):"");return e.config.request(r,{method:"GET",withCredentials:!0})}))()}modifyPassword(t){var e=this;return V((function*(){var r="",n="",s=F(0,e.config.adapter);if(!s)throw new Error("do not support encrypt, a encrypt util required.");try{var o=yield e.getPublicKey();if(r=o.public_key,n=o.public_key_thumbprint,!r||!n)throw o}catch(t){throw t}var a=t.password?s.getEncryptInfo({publicKey:r,payload:t.password}):"",u=s.getEncryptInfo({publicKey:r,payload:t.new_password});return e.config.request(i.USER_BASIC_EDIT_URL,{method:"POST",withCredentials:!0,body:{user_id:t.user_id,encrypt_password:a,encrypt_new_password:u,public_key_thumbprint:n}})}))()}modifyPasswordWithoutLogin(t){var e=this;return V((function*(){var r="",i="",s=F(0,e.config.adapter);if(!s)throw new Error("do not support encrypt, a encrypt util required.");try{var o=yield e.getPublicKey();if(r=o.public_key,i=o.public_key_thumbprint,!r||!i)throw o}catch(t){throw t}var a=t.password?s.getEncryptInfo({publicKey:r,payload:t.password}):"",u=s.getEncryptInfo({publicKey:r,payload:t.new_password});return e.config.request(n.AUTH_RESET_PASSWORD,{method:"POST",body:{username:t.username,password:a,new_password:u,public_key_thumbprint:i}})}))()}}function W(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,i)}return r}function Y(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?W(Object(r),!0).forEach((function(e){z(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):W(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function z(t,e,r){return(e=function(t){var e=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}class Z{constructor(t){var{apiOrigin:e,clientId:r,env:i,storage:n,request:s,baseRequest:o,anonymousSignInFunc:a,wxCloud:u,adapter:h}=t;this.oauth2client=new A({apiOrigin:e,clientId:r,env:i,storage:n,baseRequest:o||s,anonymousSignInFunc:a,wxCloud:u}),this.authApi=new K(Y(Y({credentialsClient:this.oauth2client},t),{},{request:s?this.oauth2client.request.bind(this.oauth2client):void 0,adapter:h}))}}},171:(t,e,r)=>{var i;if(r.r(e),r.d(e,{getEncryptInfo:()=>H}),!globalThis.IS_MP_BUILD){var n="undefined"!=typeof globalThis?globalThis.navigator:window.globalThis,s="0123456789abcdefghijklmnopqrstuvwxyz";function V(t){return s.charAt(t)}function M(t,e){return t&e}function j(t,e){return t|e}function G(t,e){return t^e}function F(t,e){return t&~e}function K(t){if(0==t)return-1;var e=0;return 65535&t||(t>>=16,e+=16),255&t||(t>>=8,e+=8),15&t||(t>>=4,e+=4),3&t||(t>>=2,e+=2),1&t||++e,e}function W(t){for(var e=0;0!=t;)t&=t-1,++e;return e}var o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function Y(t){var e,r,i="";for(e=0;e+3<=t.length;e+=3)r=parseInt(t.substring(e,e+3),16),i+=o.charAt(r>>6)+o.charAt(63&r);for(e+1==t.length?(r=parseInt(t.substring(e,e+1),16),i+=o.charAt(r<<2)):e+2==t.length&&(r=parseInt(t.substring(e,e+2),16),i+=o.charAt(r>>2)+o.charAt((3&r)<<4));(3&i.length)>0;)i+="=";return i}function z(t){var e,r="",i=0,n=0;for(e=0;e<t.length&&"="!=t.charAt(e);++e){var s=o.indexOf(t.charAt(e));s<0||(0==i?(r+=V(s>>2),n=3&s,i=1):1==i?(r+=V(n<<2|s>>4),n=15&s,i=2):2==i?(r+=V(n),r+=V(s>>2),n=3&s,i=3):(r+=V(n<<2|s>>4),r+=V(15&s),i=0))}return 1==i&&(r+=V(n<<2)),r}var a,u,h={decode:function(t){var e;if(void 0===a){var r="0123456789ABCDEF";for(a={},e=0;e<16;++e)a[r.charAt(e)]=e;for(r=r.toLowerCase(),e=10;e<16;++e)a[r.charAt(e)]=e;for(e=0;e<8;++e)a[" \f\n\r\t \u2028\u2029".charAt(e)]=-1}var i=[],n=0,s=0;for(e=0;e<t.length;++e){var o=t.charAt(e);if("="==o)break;if(-1!=(o=a[o])){if(void 0===o)throw new Error("Illegal character at offset "+e);n|=o,++s>=2?(i[i.length]=n,n=0,s=0):n<<=4}}if(s)throw new Error("Hex encoding incomplete: 4 bits missing");return i}},c={decode:function(t){var e;if(void 0===u){for(u=Object.create(null),e=0;e<64;++e)u["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e)]=e;for(e=0;e<9;++e)u["= \f\n\r\t \u2028\u2029".charAt(e)]=-1}var r=[],i=0,n=0;for(e=0;e<t.length;++e){var s=t.charAt(e);if("="==s)break;if(-1!=(s=u[s])){if(void 0===s)throw new Error("Illegal character at offset "+e);i|=s,++n>=4?(r[r.length]=i>>16,r[r.length]=i>>8&255,r[r.length]=255&i,i=0,n=0):i<<=6}}switch(n){case 1:throw new Error("Base64 encoding incomplete: at least 2 bits missing");case 2:r[r.length]=i>>10;break;case 3:r[r.length]=i>>16,r[r.length]=i>>8&255}return r},re:/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,unarmor:function(t){var e=c.re.exec(t);if(e)if(e[1])t=e[1];else{if(!e[2])throw new Error("RegExp out of sync");t=e[2]}return c.decode(t)}},l=1e13;class Z{constructor(t){this.buf=[+t||0]}mulAdd(t,e){var r,i,n=this.buf,s=n.length;for(r=0;r<s;++r)(i=n[r]*t+e)<l?e=0:i-=(e=0|i/l)*l,n[r]=i;e>0&&(n[r]=e)}sub(t){var e,r,i=this.buf,n=i.length;for(e=0;e<n;++e)(r=i[e]-t)<0?(r+=l,t=1):t=0,i[e]=r;for(;0===i[i.length-1];)i.pop()}toString(t){if(10!=(t||10))throw new Error("only base 10 is supported");for(var e=this.buf,r=e[e.length-1].toString(),i=e.length-2;i>=0;--i)r+=(l+e[i]).toString().substring(1);return r}valueOf(){for(var t=this.buf,e=0,r=t.length-1;r>=0;--r)e=e*l+t[r];return e}simplify(){var t=this.buf;return 1==t.length?t[0]:this}}var d,f=/^(\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/,p=/^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/;function Q(t,e){return t.length>e&&(t=t.substring(0,e)+"…"),t}class J{constructor(t,e){this.hexDigits="0123456789ABCDEF",t instanceof J?(this.enc=t.enc,this.pos=t.pos):(this.enc=t,this.pos=e)}get(t){if(void 0===t&&(t=this.pos++),t>=this.enc.length)throw new Error("Requesting byte offset "+t+" on a stream of length "+this.enc.length);return"string"==typeof this.enc?this.enc.charCodeAt(t):this.enc[t]}hexByte(t){return this.hexDigits.charAt(t>>4&15)+this.hexDigits.charAt(15&t)}hexDump(t,e,r){for(var i="",n=t;n<e;++n)if(i+=this.hexByte(this.get(n)),!0!==r)switch(15&n){case 7:i+=" ";break;case 15:i+="\n";break;default:i+=" "}return i}isASCII(t,e){for(var r=t;r<e;++r){var i=this.get(r);if(i<32||i>176)return!1}return!0}parseStringISO(t,e){for(var r="",i=t;i<e;++i)r+=String.fromCharCode(this.get(i));return r}parseStringUTF(t,e){for(var r="",i=t;i<e;){var n=this.get(i++);r+=n<128?String.fromCharCode(n):n>191&&n<224?String.fromCharCode((31&n)<<6|63&this.get(i++)):String.fromCharCode((15&n)<<12|(63&this.get(i++))<<6|63&this.get(i++))}return r}parseStringBMP(t,e){for(var r,i,n="",s=t;s<e;)r=this.get(s++),i=this.get(s++),n+=String.fromCharCode(r<<8|i);return n}parseTime(t,e,r){var i=this.parseStringISO(t,e),n=(r?f:p).exec(i);return n?(r&&(n[1]=+n[1],n[1]+=+n[1]<70?2e3:1900),i=n[1]+"-"+n[2]+"-"+n[3]+" "+n[4],n[5]&&(i+=":"+n[5],n[6]&&(i+=":"+n[6],n[7]&&(i+="."+n[7]))),n[8]&&(i+=" UTC","Z"!=n[8]&&(i+=n[8],n[9]&&(i+=":"+n[9]))),i):"Unrecognized time: "+i}parseInteger(t,e){for(var r,i=this.get(t),n=i>127,s=n?255:0,o="";i==s&&++t<e;)i=this.get(t);if(0==(r=e-t))return n?-1:0;if(r>4){for(o=i,r<<=3;!(128&(+o^s));)o=+o<<1,--r;o="("+r+" bit)\n"}n&&(i-=256);for(var a=new Z(i),u=t+1;u<e;++u)a.mulAdd(256,this.get(u));return o+a.toString()}parseBitString(t,e,r){for(var i=this.get(t),n="("+((e-t-1<<3)-i)+" bit)\n",s="",o=t+1;o<e;++o){for(var a=this.get(o),u=o==e-1?i:0,h=7;h>=u;--h)s+=a>>h&1?"1":"0";if(s.length>r)return n+Q(s,r)}return n+s}parseOctetString(t,e,r){if(this.isASCII(t,e))return Q(this.parseStringISO(t,e),r);var i=e-t,n="("+i+" byte)\n";i>(r/=2)&&(e=t+r);for(var s=t;s<e;++s)n+=this.hexByte(this.get(s));return i>r&&(n+="…"),n}parseOID(t,e,r){for(var i="",n=new Z,s=0,o=t;o<e;++o){var a=this.get(o);if(n.mulAdd(128,127&a),s+=7,!(128&a)){if(""===i)if((n=n.simplify())instanceof Z)n.sub(80),i="2."+n.toString();else{var u=n<80?n<40?0:1:2;i=u+"."+(n-40*u)}else i+="."+n.toString();if(i.length>r)return Q(i,r);n=new Z,s=0}}return s>0&&(i+=".incomplete"),i}}class X{constructor(t,e,r,i,n){if(!(i instanceof $))throw new Error("Invalid tag value.");this.stream=t,this.header=e,this.length=r,this.tag=i,this.sub=n}typeName(){switch(this.tag.tagClass){case 0:switch(this.tag.tagNumber){case 0:return"EOC";case 1:return"BOOLEAN";case 2:return"INTEGER";case 3:return"BIT_STRING";case 4:return"OCTET_STRING";case 5:return"NULL";case 6:return"OBJECT_IDENTIFIER";case 7:return"ObjectDescriptor";case 8:return"EXTERNAL";case 9:return"REAL";case 10:return"ENUMERATED";case 11:return"EMBEDDED_PDV";case 12:return"UTF8String";case 16:return"SEQUENCE";case 17:return"SET";case 18:return"NumericString";case 19:return"PrintableString";case 20:return"TeletexString";case 21:return"VideotexString";case 22:return"IA5String";case 23:return"UTCTime";case 24:return"GeneralizedTime";case 25:return"GraphicString";case 26:return"VisibleString";case 27:return"GeneralString";case 28:return"UniversalString";case 30:return"BMPString"}return"Universal_"+this.tag.tagNumber.toString();case 1:return"Application_"+this.tag.tagNumber.toString();case 2:return"["+this.tag.tagNumber.toString()+"]";case 3:return"Private_"+this.tag.tagNumber.toString()}}content(t){if(void 0===this.tag)return null;void 0===t&&(t=1/0);var e=this.posContent(),r=Math.abs(this.length);if(!this.tag.isUniversal())return null!==this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(e,e+r,t);switch(this.tag.tagNumber){case 1:return 0===this.stream.get(e)?"false":"true";case 2:return this.stream.parseInteger(e,e+r);case 3:return this.sub?"("+this.sub.length+" elem)":this.stream.parseBitString(e,e+r,t);case 4:return this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(e,e+r,t);case 6:return this.stream.parseOID(e,e+r,t);case 16:case 17:return null!==this.sub?"("+this.sub.length+" elem)":"(no elem)";case 12:return Q(this.stream.parseStringUTF(e,e+r),t);case 18:case 19:case 20:case 21:case 22:case 26:return Q(this.stream.parseStringISO(e,e+r),t);case 30:return Q(this.stream.parseStringBMP(e,e+r),t);case 23:case 24:return this.stream.parseTime(e,e+r,23==this.tag.tagNumber)}return null}toString(){return this.typeName()+"@"+this.stream.pos+"[header:"+this.header+",length:"+this.length+",sub:"+(null===this.sub?"null":this.sub.length)+"]"}toPrettyString(t){void 0===t&&(t="");var e=t+this.typeName()+" @"+this.stream.pos;if(this.length>=0&&(e+="+"),e+=this.length,this.tag.tagConstructed?e+=" (constructed)":!this.tag.isUniversal()||3!=this.tag.tagNumber&&4!=this.tag.tagNumber||null===this.sub||(e+=" (encapsulates)"),e+="\n",null!==this.sub){t+=" ";for(var r=0,i=this.sub.length;r<i;++r)e+=this.sub[r].toPrettyString(t)}return e}posStart(){return this.stream.pos}posContent(){return this.stream.pos+this.header}posEnd(){return this.stream.pos+this.header+Math.abs(this.length)}toHexString(){return this.stream.hexDump(this.posStart(),this.posEnd(),!0)}static decodeLength(t){var e=t.get(),r=127&e;if(r==e)return r;if(r>6)throw new Error("Length over 48 bits not supported at position "+(t.pos-1));if(0===r)return null;e=0;for(var i=0;i<r;++i)e=256*e+t.get();return e}getHexStringValue(){var t=this.toHexString(),e=2*this.header,r=2*this.length;return t.substr(e,r)}static decode(t){var e;e=t instanceof J?t:new J(t,0);var r=new J(e),i=new $(e),n=X.decodeLength(e),s=e.pos,o=s-r.pos,a=null,u=function(){var t=[];if(null!==n){for(var r=s+n;e.pos<r;)t[t.length]=X.decode(e);if(e.pos!=r)throw new Error("Content size is not correct for container starting at offset "+s)}else try{for(;;){var i=X.decode(e);if(i.tag.isEOC())break;t[t.length]=i}n=s-e.pos}catch(t){throw new Error("Exception while decoding undefined length content: "+t)}return t};if(i.tagConstructed)a=u();else if(i.isUniversal()&&(3==i.tagNumber||4==i.tagNumber))try{if(3==i.tagNumber&&0!=e.get())throw new Error("BIT STRINGs with unused bits cannot encapsulate.");a=u();for(var h=0;h<a.length;++h)if(a[h].tag.isEOC())throw new Error("EOC is not supposed to be actual content.")}catch(t){a=null}if(null===a){if(null===n)throw new Error("We can't skip over an invalid tag with undefined length at offset "+s);e.pos=s+Math.abs(n)}return new X(r,o,n,i,a)}}class ${constructor(t){var e=t.get();if(this.tagClass=e>>6,this.tagConstructed=!!(32&e),this.tagNumber=31&e,31==this.tagNumber){var r=new Z;do{e=t.get(),r.mulAdd(128,127&e)}while(128&e);this.tagNumber=r.simplify()}}isUniversal(){return 0===this.tagClass}isEOC(){return 0===this.tagClass&&0===this.tagNumber}}var v=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],g=(1<<26)/v[v.length-1];class tt{constructor(t,e,r){null!=t&&("number"==typeof t?this.fromNumber(t,e,r):null==e&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,e))}toString(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(16==t)e=4;else if(8==t)e=3;else if(2==t)e=1;else if(32==t)e=5;else{if(4!=t)return this.toRadix(t);e=2}var r,i=(1<<e)-1,n=!1,s="",o=this.t,a=this.DB-o*this.DB%e;if(o-- >0)for(a<this.DB&&(r=this[o]>>a)>0&&(n=!0,s=V(r));o>=0;)a<e?(r=(this[o]&(1<<a)-1)<<e-a,r|=this[--o]>>(a+=this.DB-e)):(r=this[o]>>(a-=e)&i,a<=0&&(a+=this.DB,--o)),r>0&&(n=!0),n&&(s+=V(r));return n?s:"0"}negate(){var t=et();return tt.ZERO.subTo(this,t),t}abs(){return this.s<0?this.negate():this}compareTo(t){var e=this.s-t.s;if(0!=e)return e;var r=this.t;if(0!=(e=r-t.t))return this.s<0?-e:e;for(;--r>=0;)if(0!=(e=this[r]-t[r]))return e;return 0}bitLength(){return this.t<=0?0:this.DB*(this.t-1)+ut(this[this.t-1]^this.s&this.DM)}mod(t){var e=et();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(tt.ZERO)>0&&t.subTo(e,e),e}modPowInt(t,e){var r;return r=t<256||e.isEven()?new y(e):new _(e),this.exp(t,r)}clone(){var t=et();return this.copyTo(t),t}intValue(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]}byteValue(){return 0==this.t?this.s:this[0]<<24>>24}shortValue(){return 0==this.t?this.s:this[0]<<16>>16}signum(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1}toByteArray(){var t=this.t,e=[];e[0]=this.s;var r,i=this.DB-t*this.DB%8,n=0;if(t-- >0)for(i<this.DB&&(r=this[t]>>i)!=(this.s&this.DM)>>i&&(e[n++]=r|this.s<<this.DB-i);t>=0;)i<8?(r=(this[t]&(1<<i)-1)<<8-i,r|=this[--t]>>(i+=this.DB-8)):(r=this[t]>>(i-=8)&255,i<=0&&(i+=this.DB,--t)),128&r&&(r|=-256),0==n&&(128&this.s)!=(128&r)&&++n,(n>0||r!=this.s)&&(e[n++]=r);return e}equals(t){return 0==this.compareTo(t)}min(t){return this.compareTo(t)<0?this:t}max(t){return this.compareTo(t)>0?this:t}and(t){var e=et();return this.bitwiseTo(t,M,e),e}or(t){var e=et();return this.bitwiseTo(t,j,e),e}xor(t){var e=et();return this.bitwiseTo(t,G,e),e}andNot(t){var e=et();return this.bitwiseTo(t,F,e),e}not(){for(var t=et(),e=0;e<this.t;++e)t[e]=this.DM&~this[e];return t.t=this.t,t.s=~this.s,t}shiftLeft(t){var e=et();return t<0?this.rShiftTo(-t,e):this.lShiftTo(t,e),e}shiftRight(t){var e=et();return t<0?this.lShiftTo(-t,e):this.rShiftTo(t,e),e}getLowestSetBit(){for(var t=0;t<this.t;++t)if(0!=this[t])return t*this.DB+K(this[t]);return this.s<0?this.t*this.DB:-1}bitCount(){for(var t=0,e=this.s&this.DM,r=0;r<this.t;++r)t+=W(this[r]^e);return t}testBit(t){var e=Math.floor(t/this.DB);return e>=this.t?0!=this.s:!!(this[e]&1<<t%this.DB)}setBit(t){return this.changeBit(t,j)}clearBit(t){return this.changeBit(t,F)}flipBit(t){return this.changeBit(t,G)}add(t){var e=et();return this.addTo(t,e),e}subtract(t){var e=et();return this.subTo(t,e),e}multiply(t){var e=et();return this.multiplyTo(t,e),e}divide(t){var e=et();return this.divRemTo(t,e,null),e}remainder(t){var e=et();return this.divRemTo(t,null,e),e}divideAndRemainder(t){var e=et(),r=et();return this.divRemTo(t,e,r),[e,r]}modPow(t,e){var r,i,n=t.bitLength(),s=at(1);if(n<=0)return s;r=n<18?1:n<48?3:n<144?4:n<768?5:6,i=n<8?new y(e):e.isEven()?new T(e):new _(e);var o=[],a=3,u=r-1,h=(1<<r)-1;if(o[1]=i.convert(this),r>1){var c=et();for(i.sqrTo(o[1],c);a<=h;)o[a]=et(),i.mulTo(c,o[a-2],o[a]),a+=2}var l,d,f=t.t-1,p=!0,v=et();for(n=ut(t[f])-1;f>=0;){for(n>=u?l=t[f]>>n-u&h:(l=(t[f]&(1<<n+1)-1)<<u-n,f>0&&(l|=t[f-1]>>this.DB+n-u)),a=r;!(1&l);)l>>=1,--a;if((n-=a)<0&&(n+=this.DB,--f),p)o[l].copyTo(s),p=!1;else{for(;a>1;)i.sqrTo(s,v),i.sqrTo(v,s),a-=2;a>0?i.sqrTo(s,v):(d=s,s=v,v=d),i.mulTo(v,o[l],s)}for(;f>=0&&!(t[f]&1<<n);)i.sqrTo(s,v),d=s,s=v,v=d,--n<0&&(n=this.DB-1,--f)}return i.revert(s)}modInverse(t){var e=t.isEven();if(this.isEven()&&e||0==t.signum())return tt.ZERO;for(var r=t.clone(),i=this.clone(),n=at(1),s=at(0),o=at(0),a=at(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),e?(n.isEven()&&s.isEven()||(n.addTo(this,n),s.subTo(t,s)),n.rShiftTo(1,n)):s.isEven()||s.subTo(t,s),s.rShiftTo(1,s);for(;i.isEven();)i.rShiftTo(1,i),e?(o.isEven()&&a.isEven()||(o.addTo(this,o),a.subTo(t,a)),o.rShiftTo(1,o)):a.isEven()||a.subTo(t,a),a.rShiftTo(1,a);r.compareTo(i)>=0?(r.subTo(i,r),e&&n.subTo(o,n),s.subTo(a,s)):(i.subTo(r,i),e&&o.subTo(n,o),a.subTo(s,a))}return 0!=i.compareTo(tt.ONE)?tt.ZERO:a.compareTo(t)>=0?a.subtract(t):a.signum()<0?(a.addTo(t,a),a.signum()<0?a.add(t):a):a}pow(t){return this.exp(t,new m)}gcd(t){var e=this.s<0?this.negate():this.clone(),r=t.s<0?t.negate():t.clone();if(e.compareTo(r)<0){var i=e;e=r,r=i}var n=e.getLowestSetBit(),s=r.getLowestSetBit();if(s<0)return e;for(n<s&&(s=n),s>0&&(e.rShiftTo(s,e),r.rShiftTo(s,r));e.signum()>0;)(n=e.getLowestSetBit())>0&&e.rShiftTo(n,e),(n=r.getLowestSetBit())>0&&r.rShiftTo(n,r),e.compareTo(r)>=0?(e.subTo(r,e),e.rShiftTo(1,e)):(r.subTo(e,r),r.rShiftTo(1,r));return s>0&&r.lShiftTo(s,r),r}isProbablePrime(t){var e,r=this.abs();if(1==r.t&&r[0]<=v[v.length-1]){for(e=0;e<v.length;++e)if(r[0]==v[e])return!0;return!1}if(r.isEven())return!1;for(e=1;e<v.length;){for(var i=v[e],n=e+1;n<v.length&&i<g;)i*=v[n++];for(i=r.modInt(i);e<n;)if(i%v[e++]==0)return!1}return r.millerRabin(t)}copyTo(t){for(var e=this.t-1;e>=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s}fromInt(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+this.DV:this.t=0}fromString(t,e){var r;if(16==e)r=4;else if(8==e)r=3;else if(256==e)r=8;else if(2==e)r=1;else if(32==e)r=5;else{if(4!=e)return void this.fromRadix(t,e);r=2}this.t=0,this.s=0;for(var i=t.length,n=!1,s=0;--i>=0;){var o=8==r?255&+t[i]:ot(t,i);o<0?"-"==t.charAt(i)&&(n=!0):(n=!1,0==s?this[this.t++]=o:s+r>this.DB?(this[this.t-1]|=(o&(1<<this.DB-s)-1)<<s,this[this.t++]=o>>this.DB-s):this[this.t-1]|=o<<s,(s+=r)>=this.DB&&(s-=this.DB))}8==r&&128&+t[0]&&(this.s=-1,s>0&&(this[this.t-1]|=(1<<this.DB-s)-1<<s)),this.clamp(),n&&tt.ZERO.subTo(this,this)}clamp(){for(var t=this.s&this.DM;this.t>0&&this[this.t-1]==t;)--this.t}dlShiftTo(t,e){var r;for(r=this.t-1;r>=0;--r)e[r+t]=this[r];for(r=t-1;r>=0;--r)e[r]=0;e.t=this.t+t,e.s=this.s}drShiftTo(t,e){for(var r=t;r<this.t;++r)e[r-t]=this[r];e.t=Math.max(this.t-t,0),e.s=this.s}lShiftTo(t,e){for(var r=t%this.DB,i=this.DB-r,n=(1<<i)-1,s=Math.floor(t/this.DB),o=this.s<<r&this.DM,a=this.t-1;a>=0;--a)e[a+s+1]=this[a]>>i|o,o=(this[a]&n)<<r;for(a=s-1;a>=0;--a)e[a]=0;e[s]=o,e.t=this.t+s+1,e.s=this.s,e.clamp()}rShiftTo(t,e){e.s=this.s;var r=Math.floor(t/this.DB);if(r>=this.t)e.t=0;else{var i=t%this.DB,n=this.DB-i,s=(1<<i)-1;e[0]=this[r]>>i;for(var o=r+1;o<this.t;++o)e[o-r-1]|=(this[o]&s)<<n,e[o-r]=this[o]>>i;i>0&&(e[this.t-r-1]|=(this.s&s)<<n),e.t=this.t-r,e.clamp()}}subTo(t,e){for(var r=0,i=0,n=Math.min(t.t,this.t);r<n;)i+=this[r]-t[r],e[r++]=i&this.DM,i>>=this.DB;if(t.t<this.t){for(i-=t.s;r<this.t;)i+=this[r],e[r++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;r<t.t;)i-=t[r],e[r++]=i&this.DM,i>>=this.DB;i-=t.s}e.s=i<0?-1:0,i<-1?e[r++]=this.DV+i:i>0&&(e[r++]=i),e.t=r,e.clamp()}multiplyTo(t,e){var r=this.abs(),i=t.abs(),n=r.t;for(e.t=n+i.t;--n>=0;)e[n]=0;for(n=0;n<i.t;++n)e[n+r.t]=r.am(0,i[n],e,n,0,r.t);e.s=0,e.clamp(),this.s!=t.s&&tt.ZERO.subTo(e,e)}squareTo(t){for(var e=this.abs(),r=t.t=2*e.t;--r>=0;)t[r]=0;for(r=0;r<e.t-1;++r){var i=e.am(r,e[r],t,2*r,0,1);(t[r+e.t]+=e.am(r+1,2*e[r],t,2*r+1,i,e.t-r-1))>=e.DV&&(t[r+e.t]-=e.DV,t[r+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(r,e[r],t,2*r,0,1)),t.s=0,t.clamp()}divRemTo(t,e,r){var i=t.abs();if(!(i.t<=0)){var n=this.abs();if(n.t<i.t)return null!=e&&e.fromInt(0),void(null!=r&&this.copyTo(r));null==r&&(r=et());var s=et(),o=this.s,a=t.s,u=this.DB-ut(i[i.t-1]);u>0?(i.lShiftTo(u,s),n.lShiftTo(u,r)):(i.copyTo(s),n.copyTo(r));var h=s.t,c=s[h-1];if(0!=c){var l=c*(1<<this.F1)+(h>1?s[h-2]>>this.F2:0),d=this.FV/l,f=(1<<this.F1)/l,p=1<<this.F2,v=r.t,g=v-h,m=null==e?et():e;for(s.dlShiftTo(g,m),r.compareTo(m)>=0&&(r[r.t++]=1,r.subTo(m,r)),tt.ONE.dlShiftTo(h,m),m.subTo(s,s);s.t<h;)s[s.t++]=0;for(;--g>=0;){var y=r[--v]==c?this.DM:Math.floor(r[v]*d+(r[v-1]+p)*f);if((r[v]+=s.am(0,y,r,g,0,h))<y)for(s.dlShiftTo(g,m),r.subTo(m,r);r[v]<--y;)r.subTo(m,r)}null!=e&&(r.drShiftTo(h,e),o!=a&&tt.ZERO.subTo(e,e)),r.t=h,r.clamp(),u>0&&r.rShiftTo(u,r),o<0&&tt.ZERO.subTo(r,r)}}}invDigit(){if(this.t<1)return 0;var t=this[0];if(!(1&t))return 0;var e=3&t;return(e=(e=(e=(e=e*(2-(15&t)*e)&15)*(2-(255&t)*e)&255)*(2-((65535&t)*e&65535))&65535)*(2-t*e%this.DV)%this.DV)>0?this.DV-e:-e}isEven(){return 0==(this.t>0?1&this[0]:this.s)}exp(t,e){if(t>4294967295||t<1)return tt.ONE;var r=et(),i=et(),n=e.convert(this),s=ut(t)-1;for(n.copyTo(r);--s>=0;)if(e.sqrTo(r,i),(t&1<<s)>0)e.mulTo(i,n,r);else{var o=r;r=i,i=o}return e.revert(r)}chunkSize(t){return Math.floor(Math.LN2*this.DB/Math.log(t))}toRadix(t){if(null==t&&(t=10),0==this.signum()||t<2||t>36)return"0";var e=this.chunkSize(t),r=Math.pow(t,e),i=at(r),n=et(),s=et(),o="";for(this.divRemTo(i,n,s);n.signum()>0;)o=(r+s.intValue()).toString(t).substr(1)+o,n.divRemTo(i,n,s);return s.intValue().toString(t)+o}fromRadix(t,e){this.fromInt(0),null==e&&(e=10);for(var r=this.chunkSize(e),i=Math.pow(e,r),n=!1,s=0,o=0,a=0;a<t.length;++a){var u=ot(t,a);u<0?"-"==t.charAt(a)&&0==this.signum()&&(n=!0):(o=e*o+u,++s>=r&&(this.dMultiply(i),this.dAddOffset(o,0),s=0,o=0))}s>0&&(this.dMultiply(Math.pow(e,s)),this.dAddOffset(o,0)),n&&tt.ZERO.subTo(this,this)}fromNumber(t,e,r){if("number"==typeof e)if(t<2)this.fromInt(1);else for(this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(tt.ONE.shiftLeft(t-1),j,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(tt.ONE.shiftLeft(t-1),this);else{var i=[],n=7&t;i.length=1+(t>>3),e.nextBytes(i),n>0?i[0]&=(1<<n)-1:i[0]=0,this.fromString(i,256)}}bitwiseTo(t,e,r){var i,n,s=Math.min(t.t,this.t);for(i=0;i<s;++i)r[i]=e(this[i],t[i]);if(t.t<this.t){for(n=t.s&this.DM,i=s;i<this.t;++i)r[i]=e(this[i],n);r.t=this.t}else{for(n=this.s&this.DM,i=s;i<t.t;++i)r[i]=e(n,t[i]);r.t=t.t}r.s=e(this.s,t.s),r.clamp()}changeBit(t,e){var r=tt.ONE.shiftLeft(t);return this.bitwiseTo(r,e,r),r}addTo(t,e){for(var r=0,i=0,n=Math.min(t.t,this.t);r<n;)i+=this[r]+t[r],e[r++]=i&this.DM,i>>=this.DB;if(t.t<this.t){for(i+=t.s;r<this.t;)i+=this[r],e[r++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;r<t.t;)i+=t[r],e[r++]=i&this.DM,i>>=this.DB;i+=t.s}e.s=i<0?-1:0,i>0?e[r++]=i:i<-1&&(e[r++]=this.DV+i),e.t=r,e.clamp()}dMultiply(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()}dAddOffset(t,e){if(0!=t){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=t;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}}multiplyLowerTo(t,e,r){var i=Math.min(this.t+t.t,e);for(r.s=0,r.t=i;i>0;)r[--i]=0;for(var n=r.t-this.t;i<n;++i)r[i+this.t]=this.am(0,t[i],r,i,0,this.t);for(n=Math.min(t.t,e);i<n;++i)this.am(0,t[i],r,i,0,e-i);r.clamp()}multiplyUpperTo(t,e,r){--e;var i=r.t=this.t+t.t-e;for(r.s=0;--i>=0;)r[i]=0;for(i=Math.max(e-this.t,0);i<t.t;++i)r[this.t+i-e]=this.am(e-i,t[i],r,0,0,this.t+i-e);r.clamp(),r.drShiftTo(1,r)}modInt(t){if(t<=0)return 0;var e=this.DV%t,r=this.s<0?t-1:0;if(this.t>0)if(0==e)r=this[0]%t;else for(var i=this.t-1;i>=0;--i)r=(e*r+this[i])%t;return r}millerRabin(t){var e=this.subtract(tt.ONE),r=e.getLowestSetBit();if(r<=0)return!1;var i=e.shiftRight(r);(t=t+1>>1)>v.length&&(t=v.length);for(var n=et(),s=0;s<t;++s){n.fromInt(v[Math.floor(Math.random()*v.length)]);var o=n.modPow(i,this);if(0!=o.compareTo(tt.ONE)&&0!=o.compareTo(e)){for(var a=1;a++<r&&0!=o.compareTo(e);)if(0==(o=o.modPowInt(2,this)).compareTo(tt.ONE))return!1;if(0!=o.compareTo(e))return!1}}return!0}square(){var t=et();return this.squareTo(t),t}gcda(t,e){var r=this.s<0?this.negate():this.clone(),i=t.s<0?t.negate():t.clone();if(r.compareTo(i)<0){var n=r;r=i,i=n}var s=r.getLowestSetBit(),o=i.getLowestSetBit();if(o<0)e(r);else{s<o&&(o=s),o>0&&(r.rShiftTo(o,r),i.rShiftTo(o,i));var a=()=>{(s=r.getLowestSetBit())>0&&r.rShiftTo(s,r),(s=i.getLowestSetBit())>0&&i.rShiftTo(s,i),r.compareTo(i)>=0?(r.subTo(i,r),r.rShiftTo(1,r)):(i.subTo(r,i),i.rShiftTo(1,i)),r.signum()>0?setTimeout(a,0):(o>0&&i.lShiftTo(o,i),setTimeout((function(){e(i)}),0))};setTimeout(a,10)}}fromNumberAsync(t,e,r,i){if("number"==typeof e)if(t<2)this.fromInt(1);else{this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(tt.ONE.shiftLeft(t-1),j,this),this.isEven()&&this.dAddOffset(1,0);var n=this,s=function(){n.dAddOffset(2,0),n.bitLength()>t&&n.subTo(tt.ONE.shiftLeft(t-1),n),n.isProbablePrime(e)?setTimeout((function(){i()}),0):setTimeout(s,0)};setTimeout(s,0)}else{var o=[],a=7&t;o.length=1+(t>>3),e.nextBytes(o),a>0?o[0]&=(1<<a)-1:o[0]=0,this.fromString(o,256)}}}var m=function(){function t(){}return t.prototype.convert=function(t){return t},t.prototype.revert=function(t){return t},t.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r)},t.prototype.sqrTo=function(t,e){t.squareTo(e)},t}(),y=function(){function t(t){this.m=t}return t.prototype.convert=function(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t},t.prototype.revert=function(t){return t},t.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},t.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},t.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},t}(),_=function(){function t(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}return t.prototype.convert=function(t){var e=et();return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&e.compareTo(tt.ZERO)>0&&this.m.subTo(e,e),e},t.prototype.revert=function(t){var e=et();return t.copyTo(e),this.reduce(e),e},t.prototype.reduce=function(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e<this.m.t;++e){var r=32767&t[e],i=r*this.mpl+((r*this.mph+(t[e]>>15)*this.mpl&this.um)<<15)&t.DM;for(t[r=e+this.m.t]+=this.m.am(0,i,t,e,0,this.m.t);t[r]>=t.DV;)t[r]-=t.DV,t[++r]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)},t.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},t.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},t}(),T=function(){function t(t){this.m=t,this.r2=et(),this.q3=et(),tt.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t)}return t.prototype.convert=function(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=et();return t.copyTo(e),this.reduce(e),e},t.prototype.revert=function(t){return t},t.prototype.reduce=function(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)},t.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},t.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},t}();function et(){return new tt(null)}function rt(t,e){return new tt(t,e)}function it(t,e,r,i,n,s){for(;--s>=0;){var o=e*this[t++]+r[i]+n;n=Math.floor(o/67108864),r[i++]=67108863&o}return n}function nt(t,e,r,i,n,s){for(var o=32767&e,a=e>>15;--s>=0;){var u=32767&this[t],h=this[t++]>>15,c=a*u+h*o;n=((u=o*u+((32767&c)<<15)+r[i]+(1073741823&n))>>>30)+(c>>>15)+a*h+(n>>>30),r[i++]=1073741823&u}return n}function st(t,e,r,i,n,s){for(var o=16383&e,a=e>>14;--s>=0;){var u=16383&this[t],h=this[t++]>>14,c=a*u+h*o;n=((u=o*u+((16383&c)<<14)+r[i]+n)>>28)+(c>>14)+a*h,r[i++]=268435455&u}return n}void 0!==n&&"Microsoft Internet Explorer"==(null==n?void 0:n.appName)?(tt.prototype.am=nt,d=30):"Netscape"!=(null==n?void 0:n.appName)?(tt.prototype.am=it,d=26):(tt.prototype.am=st,d=28),tt.prototype.DB=d,tt.prototype.DM=(1<<d)-1,tt.prototype.DV=1<<d,tt.prototype.FV=Math.pow(2,52),tt.prototype.F1=52-d,tt.prototype.F2=2*d-52;var E,S,b=[];for(E="0".charCodeAt(0),S=0;S<=9;++S)b[E++]=S;for(E="a".charCodeAt(0),S=10;S<36;++S)b[E++]=S;for(E="A".charCodeAt(0),S=10;S<36;++S)b[E++]=S;function ot(t,e){var r=b[t.charCodeAt(e)];return null==r?-1:r}function at(t){var e=et();return e.fromInt(t),e}function ut(t){var e,r=1;return 0!=(e=t>>>16)&&(t=e,r+=16),0!=(e=t>>8)&&(t=e,r+=8),0!=(e=t>>4)&&(t=e,r+=4),0!=(e=t>>2)&&(t=e,r+=2),0!=(e=t>>1)&&(t=e,r+=1),r}tt.ZERO=at(0),tt.ONE=at(1);class ht{constructor(){this.i=0,this.j=0,this.S=[]}init(t){var e,r,i;for(e=0;e<256;++e)this.S[e]=e;for(r=0,e=0;e<256;++e)r=r+this.S[e]+t[e%t.length]&255,i=this.S[e],this.S[e]=this.S[r],this.S[r]=i;this.i=0,this.j=0}next(){var t;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,t=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=t,this.S[t+this.S[this.i]&255]}}var I,w,R=null;if(null==R){var O,C,A,P;R=[],w=0;var U=void 0;if(null!==(O=window)&&void 0!==O&&O.crypto&&null!==(C=window)&&void 0!==C&&C.crypto.getRandomValues){var D,N=new Uint32Array(256);for(null===(D=window)||void 0===D||D.crypto.getRandomValues(N),U=0;U<N.length;++U)R[w++]=255&N[U]}var L,x=function(t){var e,r,i;if(this.count=this.count||0,this.count>=256||w>=256){if(null!==(e=window)&&void 0!==e&&e.removeEventListener)null===(i=window)||void 0===i||i.removeEventListener("mousemove",x,!1);else if(null!==(r=window)&&void 0!==r&&r.detachEvent){var n;null===(n=window)||void 0===n||n.detachEvent("onmousemove",x)}}else try{var s=t.x+t.y;R[w++]=255&s,this.count+=1}catch(t){}};if(null!==(A=window)&&void 0!==A&&A.addEventListener)null===(L=window)||void 0===L||L.addEventListener("mousemove",x,!1);else if(null!==(P=window)&&void 0!==P&&P.attachEvent){var k;null===(k=window)||void 0===k||k.attachEvent("onmousemove",x)}}function ct(){if(null==I){for(I=new ht;w<256;){var t=Math.floor(65536*Math.random());R[w++]=255&t}for(I.init(R),w=0;w<R.length;++w)R[w]=0;w=0}return I.next()}class lt{constructor(){}nextBytes(t){for(var e=0;e<t.length;++e)t[e]=ct()}}function dt(t,e){if(e<t.length+11)return console.error("Message too long for RSA"),null;for(var r=[],i=t.length-1;i>=0&&e>0;){var n=t.charCodeAt(i--);n<128?r[--e]=n:n>127&&n<2048?(r[--e]=63&n|128,r[--e]=n>>6|192):(r[--e]=63&n|128,r[--e]=n>>6&63|128,r[--e]=n>>12|224)}r[--e]=0;for(var s=new lt,o=[];e>2;){for(o[0]=0;0==o[0];)s.nextBytes(o);r[--e]=o[0]}return r[--e]=2,r[--e]=0,new tt(r)}class ft{constructor(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}doPublic(t){return t.modPowInt(this.e,this.n)}doPrivate(t){if(null==this.p||null==this.q)return t.modPow(this.d,this.n);for(var e=t.mod(this.p).modPow(this.dmp1,this.p),r=t.mod(this.q).modPow(this.dmq1,this.q);e.compareTo(r)<0;)e=e.add(this.p);return e.subtract(r).multiply(this.coeff).mod(this.p).multiply(this.q).add(r)}setPublic(t,e){null!=t&&null!=e&&t.length>0&&e.length>0?(this.n=rt(t,16),this.e=parseInt(e,16)):console.error("Invalid RSA public key")}encrypt(t){var e=dt(t,this.n.bitLength()+7>>3);if(null==e)return null;var r=this.doPublic(e);if(null==r)return null;var i=r.toString(16);return 1&i.length?"0"+i:i}encryptLong(t){var e=this,r=(this.n.bitLength()+7>>3)-11;try{var i="";return t.length>r?(t.match(/.{1,117}/g).forEach((function(t){var r=e.encrypt(t);i+=r})),Y(i)):Y(this.encrypt(t))}catch(t){return!1}}decryptLong(t){var e=this,r=this.n.bitLength()+7>>3;t=z(t);try{if(t.length>r){var i="";return t.match(/.{1,256}/g).forEach((function(t){var r=e.decrypt(t);i+=r})),i}return this.decrypt(t)}catch(t){return!1}}setPrivate(t,e,r){null!=t&&null!=e&&t.length>0&&e.length>0?(this.n=rt(t,16),this.e=parseInt(e,16),this.d=rt(r,16)):console.error("Invalid RSA private key")}setPrivateEx(t,e,r,i,n,s,o,a){null!=t&&null!=e&&t.length>0&&e.length>0?(this.n=rt(t,16),this.e=parseInt(e,16),this.d=rt(r,16),this.p=rt(i,16),this.q=rt(n,16),this.dmp1=rt(s,16),this.dmq1=rt(o,16),this.coeff=rt(a,16)):console.error("Invalid RSA private key")}generate(t,e){var r=new lt,i=t>>1;this.e=parseInt(e,16);for(var n=new tt(e,16);;){for(;this.p=new tt(t-i,1,r),0!=this.p.subtract(tt.ONE).gcd(n).compareTo(tt.ONE)||!this.p.isProbablePrime(10););for(;this.q=new tt(i,1,r),0!=this.q.subtract(tt.ONE).gcd(n).compareTo(tt.ONE)||!this.q.isProbablePrime(10););if(this.p.compareTo(this.q)<=0){var s=this.p;this.p=this.q,this.q=s}var o=this.p.subtract(tt.ONE),a=this.q.subtract(tt.ONE),u=o.multiply(a);if(0==u.gcd(n).compareTo(tt.ONE)){this.n=this.p.multiply(this.q),this.d=n.modInverse(u),this.dmp1=this.d.mod(o),this.dmq1=this.d.mod(a),this.coeff=this.q.modInverse(this.p);break}}}decrypt(t){var e=rt(t,16),r=this.doPrivate(e);return null==r?null:pt(r,this.n.bitLength()+7>>3)}generateAsync(t,e,r){var i=new lt,n=t>>1;this.e=parseInt(e,16);var s=new tt(e,16),o=this,a=()=>{var e=()=>{if(o.p.compareTo(o.q)<=0){var t=o.p;o.p=o.q,o.q=t}var e=o.p.subtract(tt.ONE),i=o.q.subtract(tt.ONE),n=e.multiply(i);0==n.gcd(s).compareTo(tt.ONE)?(o.n=o.p.multiply(o.q),o.d=s.modInverse(n),o.dmp1=o.d.mod(e),o.dmq1=o.d.mod(i),o.coeff=o.q.modInverse(o.p),setTimeout((function(){r()}),0)):setTimeout(a,0)},u=()=>{o.q=et(),o.q.fromNumberAsync(n,1,i,(function(){o.q.subtract(tt.ONE).gcda(s,(function(t){0==t.compareTo(tt.ONE)&&o.q.isProbablePrime(10)?setTimeout(e,0):setTimeout(u,0)}))}))},h=()=>{o.p=et(),o.p.fromNumberAsync(t-n,1,i,(function(){o.p.subtract(tt.ONE).gcda(s,(function(t){0==t.compareTo(tt.ONE)&&o.p.isProbablePrime(10)?setTimeout(u,0):setTimeout(h,0)}))}))};setTimeout(h,0)};setTimeout(a,0)}}function pt(t,e){for(var r=t.toByteArray(),i=0;i<r.length&&0==r[i];)++i;if(r.length-i!=e-1||2!=r[i])return null;for(++i;0!=r[i];)if(++i>=r.length)return null;for(var n="";++i<r.length;){var s=255&r[i];s<128?n+=String.fromCharCode(s):s>191&&s<224?(n+=String.fromCharCode((31&s)<<6|63&r[i+1]),++i):(n+=String.fromCharCode((15&s)<<12|(63&r[i+1])<<6|63&r[i+2]),i+=2)}return n}class vt extends ft{constructor(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";super(),t&&("string"==typeof t?this.parseKey(t):(this.hasPrivateKeyProperty(t)||this.hasPublicKeyProperty(t))&&this.parsePropertiesFrom(t))}parseKey(t){try{var e=0,r=0,i=/^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/.test(t)?h.decode(t):c.unarmor(t),n=X.decode(i);if(3===n.sub.length&&(n=n.sub[2].sub[0]),9===n.sub.length){e=n.sub[1].getHexStringValue(),this.n=rt(e,16),r=n.sub[2].getHexStringValue(),this.e=parseInt(r,16);var s=n.sub[3].getHexStringValue();this.d=rt(s,16);var o=n.sub[4].getHexStringValue();this.p=rt(o,16);var a=n.sub[5].getHexStringValue();this.q=rt(a,16);var u=n.sub[6].getHexStringValue();this.dmp1=rt(u,16);var l=n.sub[7].getHexStringValue();this.dmq1=rt(l,16);var d=n.sub[8].getHexStringValue();this.coeff=rt(d,16)}else{if(2!==n.sub.length)return!1;var f=n.sub[1].sub[0];e=f.sub[0].getHexStringValue(),this.n=rt(e,16),r=f.sub[1].getHexStringValue(),this.e=parseInt(r,16)}return!0}catch(t){return!1}}hasPublicKeyProperty(t){return(t=t||{}).hasOwnProperty("n")&&t.hasOwnProperty("e")}hasPrivateKeyProperty(t){return(t=t||{}).hasOwnProperty("n")&&t.hasOwnProperty("e")&&t.hasOwnProperty("d")&&t.hasOwnProperty("p")&&t.hasOwnProperty("q")&&t.hasOwnProperty("dmp1")&&t.hasOwnProperty("dmq1")&&t.hasOwnProperty("coeff")}parsePropertiesFrom(t){this.n=t.n,this.e=t.e,t.hasOwnProperty("d")&&(this.d=t.d,this.p=t.p,this.q=t.q,this.dmp1=t.dmp1,this.dmq1=t.dmq1,this.coeff=t.coeff)}}(i=function(t){t=t||{},this.default_key_size=parseInt(t.default_key_size,10)||1024,this.default_public_exponent=t.default_public_exponent||"010001",this.log=t.log||!1,this.key=null}).prototype.setKey=function(t){this.log&&this.key&&console.warn("A key was already set, overriding existing."),this.key=new vt(t)},i.prototype.setPrivateKey=function(t){this.setKey(t)},i.prototype.setPublicKey=function(t){this.setKey(t)},i.prototype.decrypt=function(t){try{return this.getKey().decrypt(z(t))}catch(t){return!1}},i.prototype.encrypt=function(t){try{return Y(this.getKey().encrypt(t))}catch(t){return!1}},i.prototype.encryptLong=function(t){try{for(var e=this.getKey().encryptLong(t)||"",r=this.getKey().decryptLong(e)||"",i=0,n=/null$/g;n.test(r)&&(i++,e=this.getKey().encryptLong(t)||"",r=this.getKey().decryptLong(e)||"",!(i>10)););return e}catch(t){return!1}},i.prototype.getKey=function(t){if(!this.key){if(this.key=new vt,t&&"[object Function]"==={}.toString.call(t))return void this.key.generateAsync(this.default_key_size,this.default_public_exponent,t);this.key.generate(this.default_key_size,this.default_public_exponent)}return this.key},i.version="3.1.4"}const q=i;var B=r(655),H=function(){var{publicKey:t="",payload:e={}}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!t)return"";try{var r=(0,B.I)(e),i=new q;return i.setPublicKey(t),i.encryptLong("object"==typeof r?JSON.stringify(r):r)}catch(t){console.error("encrypt error:",t)}return""}},655:(t,e,r)=>{r.d(e,{I:()=>i,y:()=>n});var i=t=>{var e=e=>{for(var r in t)t.hasOwnProperty(r)&&(e[r]=i(t[r]));return e},r=null==t?"NullOrUndefined":Object.prototype.toString.call(t).slice(8,-1);if(["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"].includes(r))return t.slice();switch(r){case"Object":return e(Object.create(Object.getPrototypeOf(t)));case"Array":return e([]);case"Date":return new Date(t.valueOf());case"RegExp":return new RegExp(t.source,(t.global?"g":"")+(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.sticky?"y":"")+(t.unicode?"u":""));default:return t}},n=t=>{var e=t.match(/^(?:http(s)?:\/\/[^\/]+)?(\/[^\?#]*)/);return e&&e[2]||""}}},e={};function r(i){var n=e[i];if(void 0!==n)return n.exports;var s=e[i]={exports:{}};return t[i].call(s.exports,s,s.exports,r),s.exports}return r.d=(t,e)=>{for(var i in e)r.o(e,i)&&!r.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r(118)})()));
1
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("cloudbase_oauth",[],e):"object"==typeof exports?exports.cloudbase_oauth=e():t.cloudbase_oauth=e()}("undefined"!=typeof window?window:this,(()=>(()=>{"use strict";var t={118:function(t,e,r){var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),i(r(342),e)},342:(t,e,r)=>{r.r(e),r.d(e,{AUTH_API_PREFIX:()=>h,Auth:()=>vt,CloudbaseOAuth:()=>_t,authModels:()=>n});var n={};r.r(n);var i,o,s,a,u,c,h="/auth";function l(){return"xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,(t=>{var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)}))}!function(t){t.AUTH_SIGN_UP_URL="/v1/signup",t.AUTH_TOKEN_URL="/v1/token",t.AUTH_REVOKE_URL="/v1/revoke",t.WEDA_USER_URL="/v1/plugin/weda/userinfo",t.AUTH_RESET_PASSWORD="/v1/reset",t.AUTH_GET_DEVICE_CODE="/v1/device/code",t.CHECK_USERNAME="/v1/checkUsername",t.CHECK_IF_USER_EXIST="/v1/checkIfUserExist",t.GET_PROVIDER_TYPE="/v1/mgr/provider/providerSubType",t.AUTH_SIGN_IN_URL="/v1/signin",t.AUTH_SIGN_IN_ANONYMOUSLY_URL="/v1/signin/anonymously",t.AUTH_SIGN_IN_WITH_PROVIDER_URL="/v1/signin/with/provider",t.AUTH_SIGN_IN_WITH_WECHAT_URL="/v1/signin/wechat/noauth",t.AUTH_SIGN_IN_CUSTOM="/v1/signin/custom",t.PROVIDER_TOKEN_URL="/v1/provider/token",t.PROVIDER_URI_URL="/v1/provider/uri",t.USER_ME_URL="/v1/user/me",t.AUTH_SIGNOUT_URL="/v1/user/signout",t.USER_QUERY_URL="/v1/user/query",t.USER_PRIFILE_URL="/v1/user/profile",t.USER_BASIC_EDIT_URL="/v1/user/basic/edit",t.USER_TRANS_BY_PROVIDER_URL="/v1/user/trans/by/provider",t.PROVIDER_LIST="/v1/user/provider",t.PROVIDER_BIND_URL="/v1/user/provider/bind",t.PROVIDER_UNBIND_URL="/v1/user/provider",t.CHECK_PWD_URL="/v1/user/sudo",t.SUDO_URL="/v1/user/sudo",t.BIND_CONTACT_URL="/v1/user/contact",t.AUTH_SET_PASSWORD="/v1/user/password",t.AUTHORIZE_DEVICE_URL="/v1/user/device/authorize",t.AUTHORIZE_URL="/v1/user/authorize",t.AUTHORIZE_INFO_URL="/v1/user/authorize/info",t.AUTHORIZED_DEVICES_DELETE_URL="/v1/user/authorized/devices/",t.AUTH_REVOKE_ALL_URL="/v1/user/revoke/all",t.GET_USER_BEHAVIOR_LOG="/v1/user/security/history",t.VERIFICATION_URL="/v1/verification",t.VERIFY_URL="/v1/verification/verify",t.CAPTCHA_DATA_URL="/v1/captcha/data",t.VERIFY_CAPTCHA_DATA_URL="/v1/captcha/data/verify",t.GET_CAPTCHA_URL="/v1/captcha/init",t.GET_MINIPROGRAM_QRCODE="/v1/qrcode/generate",t.GET_MINIPROGRAM_QRCODE_STATUS="/v1/qrcode/get/status"}(i||(i={})),function(t){t.AUTH_SIGN_IN_URL="/v2/signin/username",t.AUTH_TOKEN_URL="/v2/token",t.USER_ME_URL="/v2/user/me",t.VERIFY_URL="/v2/signin/verificationcode",t.AUTH_SIGN_IN_WITH_PROVIDER_URL="/v2/signin/with/provider",t.AUTH_PUBLIC_KEY="/v2/signin/publichkey",t.AUTH_RESET_PASSWORD="/v2/signin/password/update"}(o||(o={})),function(t){t.REGISTER="REGISTER",t.SIGN_IN="SIGN_IN",t.PASSWORD_RESET="PASSWORD_RESET",t.EMAIL_ADDRESS_CHANGE="EMAIL_ADDRESS_CHANGE",t.PHONE_NUMBER_CHANGE="PHONE_NUMBER_CHANGE"}(s||(s={})),(c=a||(a={})).UNREACHABLE="unreachable",c.LOCAL="local",c.CANCELLED="cancelled",c.UNKNOWN="unknown",c.UNAUTHENTICATED="unauthenticated",c.RESOURCE_EXHAUSTED="resource_exhausted",c.FAILED_PRECONDITION="failed_precondition",c.INVALID_ARGUMENT="invalid_argument",c.DEADLINE_EXCEEDED="deadline_exceeded",c.NOT_FOUND="not_found",c.ALREADY_EXISTS="already_exists",c.PERMISSION_DENIED="permission_denied",c.ABORTED="aborted",c.OUT_OF_RANGE="out_of_range",c.UNIMPLEMENTED="unimplemented",c.INTERNAL="internal",c.UNAVAILABLE="unavailable",c.DATA_LOSS="data_loss",c.INVALID_PASSWORD="invalid_password",c.PASSWORD_NOT_SET="password_not_set",c.INVALID_STATUS="invalid_status",c.USER_PENDING="user_pending",c.USER_BLOCKED="user_blocked",c.INVALID_VERIFICATION_CODE="invalid_verification_code",c.TWO_FACTOR_REQUIRED="two_factor_required",c.INVALID_TWO_FACTOR="invalid_two_factor",c.INVALID_TWO_FACTOR_RECOVERY="invalid_two_factor_recovery",c.UNDER_REVIEW="under_review",c.INVALID_REQUEST="invalid_request",c.UNAUTHORIZED_CLIENT="unauthorized_client",c.ACCESS_DENIED="access_denied",c.UNSUPPORTED_RESPONSE_TYPE="unsupported_response_type",c.INVALID_SCOPE="invalid_scope",c.INVALID_GRANT="invalid_grant",c.SERVER_ERROR="server_error",c.TEMPORARILY_UNAVAILABLE="temporarily_unavailable",c.INTERACTION_REQUIRED="interaction_required",c.LOGIN_REQUIRED="login_required",c.ACCOUNT_SELECTION_REQUIRED="account_selection_required",c.CONSENT_REQUIRED="consent_required",c.INVALID_REQUEST_URI="invalid_request_uri",c.INVALID_REQUEST_OBJECT="invalid_request_object",c.REQUEST_NOT_SUPPORTED="request_not_supported",c.REQUEST_URI_NOT_SUPPORTED="request_uri_not_supported",c.REGISTRATION_NOT_SUPPORTED="registration_not_supported",c.CAPTCHA_REQUIRED="captcha_required",c.CAPTCHA_INVALID="captcha_invalid",function(t){t.CLIENT_ID="client_id",t.CLIENT_SECRET="client_secret",t.RESPONSE_TYPE="response_type",t.SCOPE="scope",t.STATE="state",t.REDIRECT_URI="redirect_uri",t.ERROR="error",t.ERROR_DESCRIPTION="error_description",t.ERROR_URI="error_uri",t.GRANT_TYPE="grant_type",t.CODE="code",t.ACCESS_TOKEN="access_token",t.TOKEN_TYPE="token_type",t.EXPIRES_IN="expires_in",t.USERNAME="username",t.PASSWORD="password",t.REFRESH_TOKEN="refresh_token"}(u||(u={}));var d=r(655);function f(t,e,r,n,i,o,s){try{var a=t[o](s),u=a.value}catch(t){return void r(t)}a.done?e(u):Promise.resolve(u).then(n,i)}function p(t){return function(){var e=this,r=arguments;return new Promise((function(n,i){var o=t.apply(e,r);function s(t){f(o,n,i,s,a,"next",t)}function a(t){f(o,n,i,s,a,"throw",t)}s(void 0)}))}}var v=new Map;class g{constructor(t){this.clientId=(null==t?void 0:t.clientId)||"",v=v||new Map}run(t,e){var r=this;return p((function*(){t="".concat(r.clientId,"_").concat(t);var n=v.get(t);return n||(n=new Promise(((n,i)=>{p((function*(){try{yield r.runIdlePromise();var o=e();n(yield o)}catch(t){i(t)}finally{v.delete(t)}}))()})),v.set(t,n)),n}))()}runIdlePromise(){return Promise.resolve()}}var m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",y="@cloudbase/js-sdk";function _(){return y}var b,T="INVALID_OPERATION",E="OPERATION_FAIL";!function(t){t.local="local",t.none="none",t.session="session"}(b||(b={}));function S(t,e){console.warn("[".concat(_(),"][").concat(t,"]:").concat(e))}var w,I,O=(w=function(t,e){return w=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},w(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}w(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),R=function(){return R=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},R.apply(this,arguments)},C=function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))},A=function(t,e){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],n=0}finally{r=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}};!function(t){function e(e){var r=t.call(this)||this,n=e.timeout,i=e.timeoutMsg,o=e.restrictedMethods;return r.timeout=n||0,r.timeoutMsg=i||"请求超时",r.restrictedMethods=o||["get","post","upload","download"],r}O(e,t),e.prototype.get=function(t){return this.request(R(R({},t),{method:"get"}),this.restrictedMethods.includes("get"))},e.prototype.post=function(t){return this.request(R(R({},t),{method:"post"}),this.restrictedMethods.includes("post"))},e.prototype.put=function(t){return this.request(R(R({},t),{method:"put"}))},e.prototype.upload=function(t){var e=t.data,r=t.file,n=t.name,i=t.method,o=t.headers,s=void 0===o?{}:o,a={post:"post",put:"put"}[null==i?void 0:i.toLowerCase()]||"put",u=new FormData;return"post"===a?(Object.keys(e).forEach((function(t){u.append(t,e[t])})),u.append("key",n),u.append("file",r),this.request(R(R({},t),{data:u,method:a}),this.restrictedMethods.includes("upload"))):this.request(R(R({},t),{method:"put",headers:s,body:r}),this.restrictedMethods.includes("upload"))},e.prototype.download=function(t){return C(this,void 0,void 0,(function(){var e,r,n,i;return A(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.get(R(R({},t),{headers:{},responseType:"blob"}))];case 1:return e=o.sent().data,r=window.URL.createObjectURL(new Blob([e])),n=decodeURIComponent(new URL(t.url).pathname.split("/").pop()||""),(i=document.createElement("a")).href=r,i.setAttribute("download",n),i.style.display="none",document.body.appendChild(i),i.click(),window.URL.revokeObjectURL(r),document.body.removeChild(i),[3,3];case 2:return o.sent(),[3,3];case 3:return[2,new Promise((function(e){e({statusCode:200,tempFilePath:t.url})}))]}}))}))},e.prototype.fetch=function(t){var e;return C(this,void 0,void 0,(function(){var r,n,i,o,s,a,u,c,h,l,d,f=this;return A(this,(function(p){switch(p.label){case 0:return r=new AbortController,n=t.url,i=t.enableAbort,o=void 0!==i&&i,s=t.stream,a=void 0!==s&&s,u=t.signal,c=t.timeout,h=null!=c?c:this.timeout,u&&(u.aborted&&r.abort(),u.addEventListener("abort",(function(){return r.abort()}))),l=null,o&&h&&(l=setTimeout((function(){console.warn(f.timeoutMsg),r.abort(new Error(f.timeoutMsg))}),h)),[4,fetch(n,R(R({},t),{signal:r.signal})).then((function(t){return C(f,void 0,void 0,(function(){var e,r,n;return A(this,(function(i){switch(i.label){case 0:return clearTimeout(l),t.ok?(e=t,[3,3]):[3,1];case 1:return n=(r=Promise).reject,[4,t.json()];case 2:e=n.apply(r,[i.sent()]),i.label=3;case 3:return[2,e]}}))}))})).catch((function(t){return clearTimeout(l),Promise.reject(t)}))];case 1:return d=p.sent(),[2,{data:a?d.body:(null===(e=d.headers.get("content-type"))||void 0===e?void 0:e.includes("application/json"))?d.json():d.text(),statusCode:d.status,header:d.headers}]}}))}))},e.prototype.request=function(t,e){var r=this;void 0===e&&(e=!1);var n=String(t.method).toLowerCase()||"get";return new Promise((function(i){var o,s,a,u=t.url,c=t.headers,h=void 0===c?{}:c,l=t.data,d=t.responseType,f=t.withCredentials,p=t.body,v=t.onUploadProgress,g=function(t,e,r){void 0===r&&(r={});var n=/\?/.test(e),i="";return Object.keys(r).forEach((function(t){""===i?!n&&(e+="?"):i+="&",i+="".concat(t,"=").concat(encodeURIComponent(r[t]))})),/^http(s)?:\/\//.test(e+=i)?e:"".concat(t).concat(e)}("https:",u,"get"===n?l:{}),m=new XMLHttpRequest;m.open(n,g),d&&(m.responseType=d),Object.keys(h).forEach((function(t){m.setRequestHeader(t,h[t])})),v&&m.upload.addEventListener("progress",v),m.onreadystatechange=function(){var t={};if(4===m.readyState){var e=m.getAllResponseHeaders().trim().split(/[\r\n]+/),r={};e.forEach((function(t){var e=t.split(": "),n=e.shift().toLowerCase(),i=e.join(": ");r[n]=i})),t.header=r,t.statusCode=m.status;try{t.data="blob"===d?m.response:JSON.parse(m.responseText)}catch(e){t.data="blob"===d?m.response:m.responseText}clearTimeout(o),i(t)}},e&&r.timeout&&(o=setTimeout((function(){console.warn(r.timeoutMsg),m.abort()}),r.timeout)),a=l,s="[object FormData]"===Object.prototype.toString.call(a)?l:"application/x-www-form-urlencoded"===h["content-type"]?function(t){void 0===t&&(t={});var e=[];return Object.keys(t).forEach((function(r){e.push("".concat(r,"=").concat(encodeURIComponent(t[r])))})),e.join("&")}(l):p||(l?JSON.stringify(l):void 0),f&&(m.withCredentials=!0),m.send(s)}))}}((function(){})),function(t){t.WEB="web",t.WX_MP="wx_mp"}(I||(I={}));var P=function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),U=function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))},D=function(t,e){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],n=0}finally{r=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},N=function(t){function e(e){var r=t.call(this)||this;return r.root=e,e.tcbCacheObject||(e.tcbCacheObject={}),r}return P(e,t),e.prototype.setItem=function(t,e){this.root.tcbCacheObject[t]=e},e.prototype.getItem=function(t){return this.root.tcbCacheObject[t]},e.prototype.removeItem=function(t){delete this.root.tcbCacheObject[t]},e.prototype.clear=function(){delete this.root.tcbCacheObject},e}((function(){}));!function(){function t(t){this.keys={};var e=t.persistence,r=t.platformInfo,n=void 0===r?{}:r,i=t.keys,o=void 0===i?{}:i;this.platformInfo=n,this.storage||(this.persistenceTag=this.platformInfo.adapter.primaryStorage||e,this.storage=function(t,e){switch(t){case"local":default:return e.localStorage?e.localStorage:(S("INVALID_PARAMS","localStorage is not supported on current platform"),new N(e.root));case"none":return new N(e.root)}}(this.persistenceTag,this.platformInfo.adapter),this.keys=o)}Object.defineProperty(t.prototype,"mode",{get:function(){return this.storage.mode||"sync"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"persistence",{get:function(){return this.persistenceTag},enumerable:!1,configurable:!0}),t.prototype.setStore=function(t,e,r){if("async"!==this.mode){if(this.storage)try{var n={version:r||"localCachev1",content:e};this.storage.setItem(t,JSON.stringify(n))}catch(t){throw new Error(JSON.stringify({code:E,msg:"[".concat(_(),"][").concat(E,"]setStore failed"),info:t}))}}else S(T,"current platform's storage is asynchronous, please use setStoreAsync insteed")},t.prototype.setStoreAsync=function(t,e,r){return U(this,void 0,void 0,(function(){var n;return D(this,(function(i){switch(i.label){case 0:if(!this.storage)return[2];i.label=1;case 1:return i.trys.push([1,3,,4]),n={version:r||"localCachev1",content:e},[4,this.storage.setItem(t,JSON.stringify(n))];case 2:return i.sent(),[3,4];case 3:return i.sent(),[2];case 4:return[2]}}))}))},t.prototype.getStore=function(t,e){var r;if("async"!==this.mode){try{if("undefined"!=typeof process&&(null===(r={IS_MP_BUILD:!0})||void 0===r?void 0:r.tcb_token))return{IS_MP_BUILD:!0}.tcb_token;if(!this.storage)return""}catch(t){return""}e=e||"localCachev1";var n=this.storage.getItem(t);return n&&n.indexOf(e)>=0?JSON.parse(n).content:""}S(T,"current platform's storage is asynchronous, please use getStoreAsync insteed")},t.prototype.getStoreAsync=function(t,e){var r;return U(this,void 0,void 0,(function(){var n;return D(this,(function(i){switch(i.label){case 0:try{if("undefined"!=typeof process&&(null===(r={IS_MP_BUILD:!0})||void 0===r?void 0:r.tcb_token))return[2,{IS_MP_BUILD:!0}.tcb_token];if(!this.storage)return[2,""]}catch(t){return[2,""]}return e=e||"localCachev1",[4,this.storage.getItem(t)];case 1:return(n=i.sent())&&n.indexOf(e)>=0?[2,JSON.parse(n).content]:[2,""]}}))}))},t.prototype.removeStore=function(t){"async"!==this.mode?this.storage.removeItem(t):S(T,"current platform's storage is asynchronous, please use removeStoreAsync insteed")},t.prototype.removeStoreAsync=function(t){return U(this,void 0,void 0,(function(){return D(this,(function(e){switch(e.label){case 0:return[4,this.storage.removeItem(t)];case 1:return e.sent(),[2]}}))}))}}();var L=function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),x=function(t,e){this.data=e||null,this.name=t},k=function(t){function e(e,r){var n=t.call(this,"error",{error:e,data:r})||this;return n.error=e,n}return L(e,t),e}(x),q=function(){function t(){this.listeners={}}return t.prototype.on=function(t,e){return function(t,e,r){r[t]=r[t]||[],r[t].push(e)}(t,e,this.listeners),this},t.prototype.off=function(t,e){return function(t,e,r){if(null==r?void 0:r[t]){var n=r[t].indexOf(e);-1!==n&&r[t].splice(n,1)}}(t,e,this.listeners),this},t.prototype.fire=function(t,e){if(t instanceof k)return console.error(t.error),this;var r="string"==typeof t?new x(t,e||{}):t,n=r.name;if(this.listens(n)){r.target=this;for(var i=0,o=this.listeners[n]?function(t,e,r){if(r||2===arguments.length)for(var n,i=0,o=e.length;i<o;i++)!n&&i in e||(n||(n=Array.prototype.slice.call(e,0,i)),n[i]=e[i]);return t.concat(n||Array.prototype.slice.call(e))}([],this.listeners[n],!0):[];i<o.length;i++)o[i].call(this,r)}return this},t.prototype.listens=function(t){return this.listeners[t]&&this.listeners[t].length>0},t}();new q;var B=new q;function j(t){this.message=t}function M(t){this.message=t}function H(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function V(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?H(Object(r),!0).forEach((function(e){G(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):H(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function G(t,e,r){return(e=function(t){var e=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function F(t,e,r,n,i,o,s){try{var a=t[o](s),u=a.value}catch(t){return void r(t)}a.done?e(u):Promise.resolve(u).then(n,i)}function K(t){return function(){var e=this,r=arguments;return new Promise((function(n,i){var o=t.apply(e,r);function s(t){F(o,n,i,s,a,"next",t)}function a(t){F(o,n,i,s,a,"throw",t)}s(void 0)}))}}"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.indexOf("Firefox"),j.prototype=new Error,j.prototype.name="InvalidCharacterError","undefined"!=typeof window&&window.atob&&window.atob.bind(window),M.prototype=new Error,M.prototype.name="InvalidTokenError";var W="x-request-id",Y="x-device-id",z="device_id",Z=function(){var t=K((function*(t,e){var r=null,n=null;try{var i=Object.assign({},e);i.method||(i.method="GET"),i.body&&"string"!=typeof i.body&&(i.body=JSON.stringify(i.body));var o=yield fetch(t,i),s=yield o.json();null!=s&&s.error?(n=s).error_uri=new URL(t).pathname:r=s}catch(e){n={error:a.UNREACHABLE,error_description:e.message,error_uri:new URL(t).pathname}}if(n)throw n;return r}));return function(e,r){return t.apply(this,arguments)}}(),Q=new class{constructor(t){this._env=(null==t?void 0:t.env)||""}getItem(t){var e=this;return K((function*(){return window.localStorage.getItem("".concat(t).concat(e._env))}))()}removeItem(t){var e=this;return K((function*(){window.localStorage.removeItem("".concat(t).concat(e._env))}))()}setItem(t,e){var r=this;return K((function*(){window.localStorage.setItem("".concat(t).concat(r._env),e)}))()}getItemSync(t){return window.localStorage.getItem("".concat(t).concat(this._env))}removeItemSync(t){window.localStorage.removeItem("".concat(t).concat(this._env))}setItemSync(t,e){window.localStorage.setItem("".concat(t).concat(this._env),e)}};function J(t){var e=!0;return null!=t&&t.expires_at&&null!=t&&t.access_token&&(e=t.expires_at<new Date),e}class X{constructor(t){this.credentials=null,this.singlePromise=null,this.tokenSectionName=t.tokenSectionName,this.storage=t.storage,this.clientId=t.clientId,this.singlePromise=new g({clientId:this.clientId})}getStorageCredentialsSync(){var t=null,e=this.storage.getItemSync(this.tokenSectionName);if(null!=e)try{var r;null!==(r=t=JSON.parse(e))&&void 0!==r&&r.expires_at&&(t.expires_at=new Date(t.expires_at))}catch(e){this.storage.removeItem(this.tokenSectionName),t=null}return t}setCredentials(t){var e=this;return K((function*(){if(null!=t&&t.expires_in){if(null!=t&&t.expires_at||(t.expires_at=new Date(Date.now()+1e3*(t.expires_in-30))),e.storage){var r=JSON.stringify(t);yield e.storage.setItem(e.tokenSectionName,r)}e.credentials=t}else e.storage&&(yield e.storage.removeItem(e.tokenSectionName)),e.credentials=null}))()}getCredentials(){var t=this;return K((function*(){return t.singlePromise.run("getCredentials",K((function*(){return J(t.credentials)&&(t.credentials=yield t.getStorageCredentials()),t.credentials})))}))()}getStorageCredentials(){var t=this;return K((function*(){return t.singlePromise.run("_getStorageCredentials",K((function*(){var e=null,r=yield t.storage.getItem(t.tokenSectionName);if(null!=r)try{var n;null!==(n=e=JSON.parse(r))&&void 0!==n&&n.expires_at&&(e.expires_at=new Date(e.expires_at))}catch(r){yield t.storage.removeItem(t.tokenSectionName),e=null}return e})))}))()}}class ${constructor(t){this.singlePromise=null,t.clientSecret||(t.clientSecret=""),!t.clientId&&t.env&&(t.clientId=t.env),this.apiOrigin=t.apiOrigin,this.apiPath=t.apiPath||h,this.clientId=t.clientId,this.i18n=t.i18n,this.singlePromise=new g({clientId:this.clientId}),this.retry=this.formatRetry(t.retry,$.defaultRetry),t.baseRequest?this.baseRequest=t.baseRequest:this.baseRequest=Z,this.tokenInURL=t.tokenInURL,this.headers=t.headers,this.storage=t.storage||Q,this.localCredentials=new X({tokenSectionName:"credentials_".concat(t.clientId),storage:this.storage,clientId:t.clientId}),this.clientSecret=t.clientSecret,t.clientId&&(this.basicAuth="Basic ".concat(function(t){for(var e,r,n,i,o="",s=0,a=(t=String(t)).length%3;s<t.length;){if((r=t.charCodeAt(s++))>255||(n=t.charCodeAt(s++))>255||(i=t.charCodeAt(s++))>255)throw new TypeError("Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the Latin1 range.");o+=m.charAt((e=r<<16|n<<8|i)>>18&63)+m.charAt(e>>12&63)+m.charAt(e>>6&63)+m.charAt(63&e)}return a?o.slice(0,a-3)+"===".substring(a):o}("".concat(t.clientId,":").concat(this.clientSecret)))),this.wxCloud=t.wxCloud;try{(function(){if("undefined"==typeof wx)return!1;if("undefined"==typeof Page)return!1;if(!wx.getSystemInfoSync)return!1;if(!wx.getStorageSync)return!1;if(!wx.setStorageSync)return!1;if(!wx.connectSocket)return!1;if(!wx.request)return!1;try{if(!wx.getSystemInfoSync())return!1;if("qq"===wx.getSystemInfoSync().AppPlatform)return!1}catch(t){return!1}return!0})()&&void 0===this.wxCloud&&t.env&&(wx.cloud.init({env:t.env}),this.wxCloud=wx.cloud)}catch(t){}this.refreshTokenFunc=t.refreshTokenFunc||this.defaultRefreshTokenFunc,this.anonymousSignInFunc=t.anonymousSignInFunc,this.onCredentialsError=t.onCredentialsError,B.on("lang_change",(t=>{var e;this.i18n=(null===(e=t.data)||void 0===e?void 0:e.i18n)||this.i18n}))}setCredentials(t){return this.localCredentials.setCredentials(t)}getAccessToken(){var t=this;return K((function*(){var e=yield t.getCredentials();if(null!=e&&e.access_token)return Promise.resolve(e.access_token);var r={error:a.UNAUTHENTICATED};return Promise.reject(r)}))()}request(t,e){var r=this;return K((function*(){var n,i,o,s;e||(e={});var u=r.formatRetry(e.retry,r.retry);if(e.headers=V(V({},e.headers),{},{[null===(n=r.i18n)||void 0===n?void 0:n.LANG_HEADER_KEY]:null===(i=r.i18n)||void 0===i?void 0:i.lang}),r.headers&&(e.headers=V(V({},r.headers),e.headers)),e.headers[W]||(e.headers[W]=l()),!e.headers[Y]){var c=yield r.getDeviceId();e.headers[Y]=c}if(null!==(o=e)&&void 0!==o&&o.withBasicAuth&&r.basicAuth&&(e.headers.Authorization=r.basicAuth),null!==(s=e)&&void 0!==s&&s.withCredentials){var h=yield r.getCredentials();h&&(r.tokenInURL?(t.indexOf("?")<0&&(t+="?"),t+="access_token=".concat(h.access_token)):e.headers.Authorization="".concat(h.token_type," ").concat(h.access_token))}else r.clientId&&t.indexOf("client_id")<0&&(t+=t.indexOf("?")<0?"?":"&",t+="client_id=".concat(r.clientId));t.startsWith("/")&&(t="".concat(r.apiOrigin).concat(r.apiPath).concat(t));for(var d=null,f=u+1,p=0;p<f;p++){try{d=e.useWxCloud?yield r.wxCloudCallFunction(t,e):yield r.baseRequest(t,e);break}catch(t){if(e.withCredentials&&t&&t.error===a.UNAUTHENTICATED)return yield r.setCredentials(null),Promise.reject(t);if(p===u||!t||"unreachable"!==t.error)return Promise.reject(t)}yield r.sleep($.retryInterval)}return d}))()}wxCloudCallFunction(t,e){var r=this;return K((function*(){var n=null,i=null;try{var o,s="";try{s=yield wx.getRendererUserAgent()}catch(t){}var{result:u}=yield r.wxCloud.callFunction({name:"httpOverCallFunction",data:{url:t,method:e.method,headers:V({origin:"https://servicewechat.com","User-Agent":s},e.headers),body:e.body}});null!=u&&null!==(o=u.body)&&void 0!==o&&o.error_code?(i=null==u?void 0:u.body).error_uri=(0,d.y)(t):n=null==u?void 0:u.body}catch(e){i={error:a.UNREACHABLE,error_description:e.message,error_uri:(0,d.y)(t)}}if(i)throw i;return n}))()}getCredentials(){var t=this;return K((function*(){var e=yield t.localCredentials.getCredentials();if(!e){var r,n="credentials not found";return null===(r=t.onCredentialsError)||void 0===r||r.call(t,{msg:n}),t.unAuthenticatedError(n)}if(J(e))if(e.refresh_token)try{e=yield t.refreshToken(e)}catch(r){var i;if("anonymous"!==e.scope)return null===(i=t.onCredentialsError)||void 0===i||i.call(t,{msg:r.error_description}),Promise.reject(r);e=yield t.anonymousLogin(e)}else{if("anonymous"!==e.scope){var o,s="no refresh token found in credentials";return null===(o=t.onCredentialsError)||void 0===o||o.call(t,{msg:s}),t.unAuthenticatedError(s)}e=yield t.anonymousLogin(e)}return e}))()}getCredentialsSync(){return this.localCredentials.getStorageCredentialsSync()}getCredentialsAsync(){return this.getCredentials()}getScope(){var t=this;return K((function*(){var e=yield t.localCredentials.getCredentials();if(!e){var r,n="credentials not found";return null===(r=t.onCredentialsError)||void 0===r||r.call(t,{msg:n}),t.unAuthenticatedError(n)}return e.scope}))()}getGroups(){var t=this;return K((function*(){var e=yield t.localCredentials.getCredentials();if(!e){var r,n="credentials not found";return null===(r=t.onCredentialsError)||void 0===r||r.call(t,{msg:n}),t.unAuthenticatedError(n)}return e.groups}))()}refreshToken(t){var e=this;return K((function*(){return e.singlePromise.run("_refreshToken",K((function*(){if(!t||!t.refresh_token){var r,n="no refresh token found in credentials";return null===(r=e.onCredentialsError)||void 0===r||r.call(e,{msg:n}),e.unAuthenticatedError(n)}try{var i=yield e.refreshTokenFunc(t.refresh_token,t);return yield e.localCredentials.setCredentials(i),i}catch(t){var o;if(t.error===a.INVALID_GRANT){var s;yield e.localCredentials.setCredentials(null);var u=t.error_description;return null===(s=e.onCredentialsError)||void 0===s||s.call(e,{msg:u}),e.unAuthenticatedError(u)}return null===(o=e.onCredentialsError)||void 0===o||o.call(e,{msg:t.error_description}),Promise.reject(t)}})))}))()}anonymousLogin(t){var e=this;return K((function*(){return e.singlePromise.run("_anonymousLogin",K((function*(){if(e.anonymousSignInFunc){var r=yield e.anonymousSignInFunc(t);t=r||(yield e.localCredentials.getCredentials())}else t=yield e.anonymousSignIn(t);return t})))}))()}checkRetry(t){var e=null;if(("number"!=typeof t||t<$.minRetry||t>$.maxRetry)&&(e={error:a.UNREACHABLE,error_description:"wrong options param: retry"}),e)throw e;return t}formatRetry(t,e){return void 0===t?e:this.checkRetry(t)}sleep(t){return K((function*(){return new Promise((e=>{setTimeout((()=>{e()}),t)}))}))()}anonymousSignIn(t){var e=this;return K((function*(){return e.singlePromise.run("_anonymous",K((function*(){if(!t||"anonymous"!==t.scope)return e.unAuthenticatedError("no anonymous in credentials");try{var r=yield e.request(i.AUTH_SIGN_IN_ANONYMOUSLY_URL,{method:"POST",withBasicAuth:!0,body:{}});return yield e.localCredentials.setCredentials(r),r}catch(t){return t.error===a.INVALID_GRANT?(yield e.localCredentials.setCredentials(null),e.unAuthenticatedError(t.error_description)):Promise.reject(t)}})))}))()}defaultRefreshTokenFunc(t,e){var r=this;return K((function*(){if(void 0===t||""===t){var n,s="refresh token not found";return null===(n=r.onCredentialsError)||void 0===n||n.call(r,{msg:s}),r.unAuthenticatedError(s)}var a=i.AUTH_TOKEN_URL;return"v2"===(null==e?void 0:e.version)&&(a=o.AUTH_TOKEN_URL),V(V({},yield r.request(a,{method:"POST",body:{client_id:r.clientId,client_secret:r.clientSecret,grant_type:"refresh_token",refresh_token:t}})),{},{version:(null==e?void 0:e.version)||"v1"})}))()}getDeviceId(){var t=this;return K((function*(){if(t.deviceID)return t.deviceID;var e=yield t.storage.getItem(z);return"string"==typeof e&&e.length>=16&&e.length<=48||(e=l(),yield t.storage.setItem(z,e)),t.deviceID=e,e}))()}unAuthenticatedError(t){var e={error:a.UNAUTHENTICATED,error_description:t};return Promise.reject(e)}}function tt(){if("undefined"==typeof globalThis)return!1;var{wx:t}=globalThis;if(void 0===t)return!1;if(void 0===globalThis.Page)return!1;if(!t.getSystemInfoSync)return!1;if(!t.getStorageSync)return!1;if(!t.setStorageSync)return!1;if(!t.connectSocket)return!1;if(!t.request)return!1;try{if(!t.getSystemInfoSync())return!1;if("qq"===t.getSystemInfoSync().AppPlatform)return!1}catch(t){return!1}return!0}$.defaultRetry=2,$.minRetry=0,$.maxRetry=5,$.retryInterval=1e3;var et=!1;function rt(){et=et||void 0!==typeof window&&"miniprogram"===window.__wxjs_environment}try{tt()||(et=et||!!navigator.userAgent.match(/miniprogram/i)||"miniprogram"===window.__wxjs_environment,window&&window.WeixinJSBridge&&window.WeixinJSBridge.invoke?rt():"undefined"!=typeof document&&document.addEventListener("WeixinJSBridgeReady",rt,!1))}catch(j){}function nt(){return et}const it=class{constructor(t){if(this.params={},"string"==typeof t)this.parse(t);else if(t&&"object"==typeof t)for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&this.append(e,t[e])}parse(t){t.split("&").forEach((t=>{var[e,r]=t.split("=").map(decodeURIComponent);this.append(e,r)}))}append(t,e){this.params[t]?this.params[t]=this.params[t].concat([e]):this.params[t]=[e]}get(t){return this.params[t]?this.params[t][0]:null}getAll(t){return this.params[t]||[]}delete(t){delete this.params[t]}has(t){return Object.prototype.hasOwnProperty.call(this.params,t)}set(t,e){this.params[t]=[e]}toString(){var t=this,e=[],r=function(r){Object.prototype.hasOwnProperty.call(t.params,r)&&t.params[r].forEach((t=>{e.push("".concat(encodeURIComponent(r),"=").concat(encodeURIComponent(t)))}))};for(var n in this.params)r(n);return e.join("&")}};function ot(t,e,r,n,i,o,s){try{var a=t[o](s),u=a.value}catch(t){return void r(t)}a.done?e(u):Promise.resolve(u).then(n,i)}function st(t){return function(){var e=this,r=arguments;return new Promise((function(n,i){var o=t.apply(e,r);function s(t){ot(o,n,i,s,a,"next",t)}function a(t){ot(o,n,i,s,a,"throw",t)}s(void 0)}))}}class at{constructor(t){t.openURIWithCallback||(t.openURIWithCallback=this.getDefaultOpenURIWithCallback()),t.storage||(t.storage=Q),this.config=t,this.tokenSectionName="captcha_".concat(t.clientId)}isMatch(){var t,e;return(null===(t=this.config)||void 0===t||null===(t=t.adapter)||void 0===t||null===(e=t.isMatch)||void 0===e?void 0:e.call(t))||tt()}request(t,e){var r=this;return st((function*(){e||(e={}),e.method||(e.method="GET");var n,i="".concat(e.method,":").concat(t),o=t;e.withCaptcha&&(o=yield r.appendCaptchaTokenToURL(t,i,!1));try{n=yield r.config.request(o,e)}catch(n){return n.error===a.CAPTCHA_REQUIRED||n.error===a.CAPTCHA_INVALID?(t=yield r.appendCaptchaTokenToURL(t,i,n.error===a.CAPTCHA_INVALID),r.config.request(t,e)):Promise.reject(n)}return n}))()}getDefaultOpenURIWithCallback(){if(!this.isMatch()&&!nt()&&(window.location.search.indexOf("__captcha")>0&&(document.body.style.display="none"),null===document.getElementById("captcha_panel_wrap"))){var t=document.createElement("div");t.style.cssText="background-color: rgba(0, 0, 0, 0.7);position: fixed;left: 0px;right: 0px;top: 0px;bottom: 0px;padding: 9vw 0 0 0;display: none;z-index:100;",t.setAttribute("id","captcha_panel_wrap"),setTimeout((()=>{document.body.appendChild(t)}),0)}return this.defaultOpenURIWithCallback}defaultOpenURIWithCallback(t,e){return st((function*(){var{width:r="355px",height:n="355px"}=e||{};if(t.match(/^(data:.*)$/))return Promise.reject({error:a.UNIMPLEMENTED,error_description:"need to impl captcha data"});var i=document.getElementById("captcha_panel_wrap"),o=document.createElement("iframe");return i.innerHTML="",o.setAttribute("src",t),o.setAttribute("id","review-panel-iframe"),o.style.cssText="min-width:".concat(r,";display:block;height:").concat(n,";margin:0 auto;background-color: rgb(255, 255, 255);border: none;"),i.appendChild(o),i.style.display="block",new Promise(((t,e)=>{o.onload=function(){try{var r=window.location,n=o.contentWindow.location;if(n.host+n.pathname===r.host+r.pathname){i.style.display="none";var s=new it(n.search),a=s.get("captcha_token");return a?t({captcha_token:a,expires_in:Number(s.get("expires_in"))}):e({error:s.get("error"),error_description:s.get("error_description")})}i.style.display="block"}catch(t){i.style.display="block"}}}))}))()}getCaptchaToken(t,e){var r=this;return st((function*(){if(!t){var n=yield r.findCaptchaToken();if(n)return n}var o;if(r.isMatch()||nt()){var s=yield r.config.request(i.CAPTCHA_DATA_URL,{method:"POST",body:{state:e,redirect_uri:""},withCredentials:!1});o={url:"".concat(s.data,"?state=").concat(encodeURIComponent(e),"&token=").concat(encodeURIComponent(s.token))}}else{var a="".concat(window.location.origin+window.location.pathname,"?__captcha=on");if((o=yield r.config.request(i.GET_CAPTCHA_URL,{method:"POST",body:{client_id:r.config.clientId,redirect_uri:a,state:e},withCredentials:!1})).captcha_token){var u={captcha_token:o.captcha_token,expires_in:o.expires_in};return r.saveCaptchaToken(u),o.captcha_token}}var c=yield r.config.openURIWithCallback(o.url);return r.saveCaptchaToken(c),c.captcha_token}))()}appendCaptchaTokenToURL(t,e,r){var n=this;return st((function*(){var i=yield n.getCaptchaToken(r,e);return t.indexOf("?")>0?t+="&captcha_token=".concat(i):t+="?captcha_token=".concat(i),t}))()}saveCaptchaToken(t){var e=this;return st((function*(){t.expires_at=new Date(Date.now()+1e3*(t.expires_in-10));var r=JSON.stringify(t);yield e.config.storage.setItem(e.tokenSectionName,r)}))()}findCaptchaToken(){var t=this;return st((function*(){var e=yield t.config.storage.getItem(t.tokenSectionName);if(null!=e)try{var r=JSON.parse(e);return null!=r&&r.expires_at&&(r.expires_at=new Date(r.expires_at)),r.expires_at<new Date?null:r.captcha_token}catch(e){return yield t.config.storage.removeItem(t.tokenSectionName),null}return null}))()}}var ut=["provider_redirect_uri","other_params"];function ct(t,e,r,n,i,o,s){try{var a=t[o](s),u=a.value}catch(t){return void r(t)}a.done?e(u):Promise.resolve(u).then(n,i)}function ht(t){return function(){var e=this,r=arguments;return new Promise((function(n,i){var o=t.apply(e,r);function s(t){ct(o,n,i,s,a,"next",t)}function a(t){ct(o,n,i,s,a,"throw",t)}s(void 0)}))}}function lt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function dt(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?lt(Object(r),!0).forEach((function(e){ft(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):lt(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function ft(t,e,r){return(e=function(t){var e=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function pt(t,e){try{var r;if(((null==e||null===(r=e.root)||void 0===r?void 0:r.globalThis)||globalThis).IS_MP_BUILD)return}catch(t){}}class vt{static parseParamsToSearch(t){return Object.keys(t).forEach((e=>{t[e]||delete t[e]})),new it(t).toString()}constructor(t){var{request:e}=t,r=t.credentialsClient;if(!r){var n={apiOrigin:t.apiOrigin,apiPath:t.apiPath,clientId:t.clientId,storage:t.storage,env:t.env,baseRequest:t.baseRequest,anonymousSignInFunc:t.anonymousSignInFunc,wxCloud:t.wxCloud,onCredentialsError:t.onCredentialsError,headers:t.headers||{},i18n:t.i18n};r=new $(n)}if(!e){var i=r.request.bind(r),o=new at(dt({clientId:t.clientId,request:i,storage:t.storage,adapter:t.adapter},t.captchaOptions));e=o.request.bind(o)}this.config={env:t.env,apiOrigin:t.apiOrigin,apiPath:t.apiPath,clientId:t.clientId,request:e,credentialsClient:r,storage:t.storage||Q,adapter:t.adapter}}getParamsByVersion(t,e){var r,n=(0,d.I)(t),s=(null===(r={v2:o}[null==n?void 0:n.version])||void 0===r?void 0:r[e])||i[e];return n&&delete n.version,{params:n,url:s}}signIn(t){var e=this;return ht((function*(){var r=t.version||"v1",n=e.getParamsByVersion(t,"AUTH_SIGN_IN_URL");n.params.query&&delete n.params.query;var i=yield e.getEncryptParams(n.params),o=yield e.config.request(n.url,{method:"POST",body:i});return yield e.config.credentialsClient.setCredentials(dt(dt({},o),{},{version:r})),Promise.resolve(o)}))()}signInAnonymously(){var t=arguments,e=this;return ht((function*(){var r=t.length>0&&void 0!==t[0]?t[0]:{},n=t.length>1&&void 0!==t[1]&&t[1],o=yield e.config.request(i.AUTH_SIGN_IN_ANONYMOUSLY_URL,{method:"POST",body:r,useWxCloud:n});return yield e.config.credentialsClient.setCredentials(o),Promise.resolve(o)}))()}signUp(t){var e=this;return ht((function*(){var r=yield e.config.request(i.AUTH_SIGN_UP_URL,{method:"POST",body:t});return yield e.config.credentialsClient.setCredentials(r),Promise.resolve(r)}))()}signOut(t){var e=this;return ht((function*(){var r={};if(t){try{r=yield e.config.request(i.AUTH_SIGNOUT_URL,{method:"POST",withCredentials:!0,body:t})}catch(t){t.error!==a.UNAUTHENTICATED&&console.log("sign_out_error",t)}return yield e.config.credentialsClient.setCredentials(),r}var n=yield e.config.credentialsClient.getAccessToken(),o=yield e.config.request(i.AUTH_REVOKE_URL,{method:"POST",body:{token:n}});return yield e.config.credentialsClient.setCredentials(),Promise.resolve(o)}))()}revokeAllDevices(){var t=this;return ht((function*(){yield t.config.request(i.AUTH_REVOKE_ALL_URL,{method:"DELETE",withCredentials:!0})}))()}revokeDevice(t){var e=this;return ht((function*(){yield e.config.request(i.AUTHORIZED_DEVICES_DELETE_URL+t.device_id,{method:"DELETE",withCredentials:!0})}))()}getVerification(t,e){var r=this;return ht((function*(){var n=!1;return("CUR_USER"===t.target||(yield r.hasLoginState()))&&(n=!0),r.config.request(i.VERIFICATION_URL,{method:"POST",body:t,withCaptcha:(null==e?void 0:e.withCaptcha)||!1,withCredentials:n})}))()}verify(t){var e=this;return ht((function*(){var r=e.getParamsByVersion(t,"VERIFY_URL"),n=yield e.config.request(r.url,{method:"POST",body:r.params});return"v2"===(null==t?void 0:t.version)&&(yield e.config.credentialsClient.setCredentials(dt(dt({},n),{},{version:"v2"}))),n}))()}genProviderRedirectUri(t){var e=this;return ht((function*(){var{provider_redirect_uri:r,other_params:n={}}=t,o=function(t,e){if(null==t)return{};var r,n,i=function(t,e){if(null==t)return{};var r={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(e.includes(n))continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n<o.length;n++)r=o[n],e.includes(r)||{}.propertyIsEnumerable.call(t,r)&&(i[r]=t[r])}return i}(t,ut);r&&!o.redirect_uri&&(o.redirect_uri=r);var s="".concat(i.PROVIDER_URI_URL,"?").concat(vt.parseParamsToSearch(o));return Object.keys(n).forEach((t=>{var e=n[t];("sign_out_uri"!==t||(null==e?void 0:e.length)>0)&&(s+="&other_params[".concat(t,"]=").concat(encodeURIComponent(e)))})),e.config.request(s,{method:"GET"})}))()}grantProviderToken(t){var e=arguments,r=this;return ht((function*(){var n=e.length>1&&void 0!==e[1]&&e[1];return r.config.request(i.PROVIDER_TOKEN_URL,{method:"POST",body:t,useWxCloud:n})}))()}patchProviderToken(t){var e=this;return ht((function*(){return e.config.request(i.PROVIDER_TOKEN_URL,{method:"PATCH",body:t})}))()}signInWithProvider(t){var e=arguments,r=this;return ht((function*(){var n=e.length>1&&void 0!==e[1]&&e[1],i=r.getParamsByVersion(t,"AUTH_SIGN_IN_WITH_PROVIDER_URL"),o=yield r.config.request(i.url,{method:"POST",body:i.params,useWxCloud:n});return yield r.config.credentialsClient.setCredentials(dt(dt({},o),{},{version:(null==t?void 0:t.version)||"v1"})),Promise.resolve(o)}))()}signInCustom(t){var e=this;return ht((function*(){var r=yield e.config.request(i.AUTH_SIGN_IN_CUSTOM,{method:"POST",body:t});return yield e.config.credentialsClient.setCredentials(r),Promise.resolve(r)}))()}signInWithWechat(){var t=arguments,e=this;return ht((function*(){var r=t.length>0&&void 0!==t[0]?t[0]:{},n=yield e.config.request(i.AUTH_SIGN_IN_WITH_WECHAT_URL,{method:"POST",body:r});return yield e.config.credentialsClient.setCredentials(n),Promise.resolve(n)}))()}bindWithProvider(t){var e=this;return ht((function*(){return e.config.request(i.PROVIDER_BIND_URL,{method:"POST",body:t,withCredentials:!0})}))()}getUserProfile(t){var e=this;return ht((function*(){return e.getUserInfo(t)}))()}getUserInfo(){var t=arguments,e=this;return ht((function*(){var r,n=t.length>0&&void 0!==t[0]?t[0]:{},i=e.getParamsByVersion(n,"USER_ME_URL");if(null!==(r=i.params)&&void 0!==r&&r.query){var o=new it(i.params.query);i.url+="?".concat(o.toString())}var s=yield e.config.request(i.url,{method:"GET",withCredentials:!0});return s.sub&&(s.uid=s.sub),s}))()}getWedaUserInfo(){var t=this;return ht((function*(){return yield t.config.request(i.WEDA_USER_URL,{method:"GET",withCredentials:!0})}))()}deleteMe(t){var e=this;return ht((function*(){var r=e.getParamsByVersion(t,"USER_ME_URL"),n="".concat(r.url,"?").concat(vt.parseParamsToSearch(r.params));return e.config.request(n,{method:"DELETE",withCredentials:!0})}))()}hasLoginState(){var t=this;return ht((function*(){try{return yield t.config.credentialsClient.getAccessToken(),!0}catch(t){return!1}}))()}hasLoginStateSync(){return this.config.credentialsClient.getCredentialsSync()}getLoginState(){var t=this;return ht((function*(){return t.config.credentialsClient.getCredentialsAsync()}))()}transByProvider(t){var e=this;return ht((function*(){return e.config.request(i.USER_TRANS_BY_PROVIDER_URL,{method:"PATCH",body:t,withCredentials:!0})}))()}grantToken(t){var e=this;return ht((function*(){var r=e.getParamsByVersion(t,"AUTH_TOKEN_URL");return e.config.request(r.url,{method:"POST",body:r.params})}))()}getProviders(){var t=this;return ht((function*(){return t.config.request(i.PROVIDER_LIST,{method:"GET",withCredentials:!0})}))()}unbindProvider(t){var e=this;return ht((function*(){return e.config.request("".concat(i.PROVIDER_UNBIND_URL,"/").concat(t.provider_id),{method:"DELETE",withCredentials:!0})}))()}checkPassword(t){var e=this;return ht((function*(){return e.config.request("".concat(i.CHECK_PWD_URL),{method:"POST",withCredentials:!0,body:t})}))()}editContact(t){var e=this;return ht((function*(){return e.config.request("".concat(i.BIND_CONTACT_URL),{method:"PATCH",withCredentials:!0,body:t})}))()}setPassword(t){var e=this;return ht((function*(){return e.config.request("".concat(i.AUTH_SET_PASSWORD),{method:"PATCH",withCredentials:!0,body:t})}))()}updatePasswordByOld(t){var e=this;return ht((function*(){var r=yield e.sudo({password:t.old_password});return e.setPassword({sudo_token:r.sudo_token,new_password:t.new_password})}))()}sudo(t){var e=this;return ht((function*(){return e.config.request("".concat(i.SUDO_URL),{method:"POST",withCredentials:!0,body:t})}))()}sendVerificationCodeToCurrentUser(t){var e=this;return ht((function*(){return t.target="CUR_USER",e.config.request(i.VERIFICATION_URL,{method:"POST",body:t,withCredentials:!0,withCaptcha:!0})}))()}changeBoundProvider(t){var e=this;return ht((function*(){return e.config.request("".concat(i.PROVIDER_LIST,"/").concat(t.provider_id,"/trans"),{method:"POST",body:{provider_trans_token:t.trans_token},withCredentials:!0})}))()}setUserProfile(t){var e=this;return ht((function*(){return e.config.request(i.USER_PRIFILE_URL,{method:"PATCH",body:t,withCredentials:!0})}))()}updateUserBasicInfo(t){var e=this;return ht((function*(){return e.config.request(i.USER_BASIC_EDIT_URL,{method:"POST",withCredentials:!0,body:t})}))()}queryUserProfile(t){var e=this;return ht((function*(){var r=new it(t);return e.config.request("".concat(i.USER_QUERY_URL,"?").concat(r.toString()),{method:"GET",withCredentials:!0})}))()}setCustomSignFunc(t){this.getCustomSignTicketFn=t}signInWithCustomTicket(){var t=this;return ht((function*(){var e=t.getCustomSignTicketFn;if(!e)return Promise.reject({error:"failed_precondition",error_description:"please use setCustomSignFunc to set custom sign function"});var r=yield e();return t.signInCustom({provider_id:"custom",ticket:r})}))()}resetPassword(t){var e=this;return ht((function*(){return e.config.request(i.AUTH_RESET_PASSWORD,{method:"POST",body:t})}))()}authorize(t){var e=this;return ht((function*(){return e.config.request(i.AUTHORIZE_URL,{method:"POST",withCredentials:!0,body:t})}))()}authorizeDevice(t){var e=this;return ht((function*(){return e.config.request(i.AUTHORIZE_DEVICE_URL,{method:"POST",withCredentials:!0,body:t})}))()}deviceAuthorize(t){var e=this;return ht((function*(){return e.config.request(i.AUTH_GET_DEVICE_CODE,{method:"POST",body:t,withCredentials:!0})}))()}authorizeInfo(t){var e=this;return ht((function*(){var r="".concat(i.AUTHORIZE_INFO_URL,"?").concat(vt.parseParamsToSearch(t)),n=!0,o=!1;return(yield e.hasLoginState())&&(o=!0,n=!1),e.config.request(r,{method:"GET",withBasicAuth:n,withCredentials:o})}))()}checkUsername(t){var e=this;return ht((function*(){return e.config.request(i.CHECK_USERNAME,{method:"GET",body:t,withCredentials:!0})}))()}checkIfUserExist(t){var e=this;return ht((function*(){var r=new it(t);return e.config.request("".concat(i.CHECK_IF_USER_EXIST,"?").concat(r.toString()),{method:"GET"})}))()}loginScope(){var t=this;return ht((function*(){return t.config.credentialsClient.getScope()}))()}loginGroups(){var t=this;return ht((function*(){return t.config.credentialsClient.getGroups()}))()}refreshTokenForce(t){var e=this;return ht((function*(){var r=yield e.config.credentialsClient.getCredentials();return yield e.config.credentialsClient.refreshToken(dt(dt({},r),{},{version:(null==t?void 0:t.version)||"v1"}))}))()}getCredentials(){var t=this;return ht((function*(){return t.config.credentialsClient.getCredentials()}))()}getPublicKey(){var t=this;return ht((function*(){return t.config.request(o.AUTH_PUBLIC_KEY,{method:"POST",body:{}})}))()}getEncryptParams(t){var e=this;return ht((function*(){var{isEncrypt:r}=t;delete t.isEncrypt;var n=(0,d.I)(t),i=pt(0,e.config.adapter);if(!i)return t;var o="",s="";try{var a=yield e.getPublicKey();if(o=a.public_key,s=a.public_key_thumbprint,!o||!s)throw a}catch(t){throw t}return{params:i.getEncryptInfo({publicKey:o,payload:n}),public_key_thumbprint:s}}))()}getProviderSubType(){var t=this;return ht((function*(){return t.config.request(i.GET_PROVIDER_TYPE,{method:"POST",body:{provider_id:"weda"}})}))()}verifyCaptchaData(t){var e=this;return ht((function*(){var{token:r,key:n}=t;return e.config.request(i.VERIFY_CAPTCHA_DATA_URL,{method:"POST",body:{token:r,key:n},withCredentials:!1})}))()}createCaptchaData(t){var e=this;return ht((function*(){var{state:r,redirect_uri:n}=t;return e.config.request(i.CAPTCHA_DATA_URL,{method:"POST",body:{state:r,redirect_uri:n},withCredentials:!1})}))()}getMiniProgramCode(t){var e=this;return ht((function*(){return e.config.request(i.GET_MINIPROGRAM_QRCODE,{method:"POST",body:t})}))()}getMiniProgramQrCodeStatus(t){var e=this;return ht((function*(){return e.config.request(i.GET_MINIPROGRAM_QRCODE_STATUS,{method:"POST",body:t})}))()}getUserBehaviorLog(t){var e=this;return ht((function*(){var r="".concat(i.GET_USER_BEHAVIOR_LOG,"?").concat({LOGIN:"query[action]=USER_LOGIN",MODIFY:"ne_query[action]=USER_LOGIN"}[t.type],"&limit=").concat(t.limit).concat(t.page_token?"&page_token=".concat(t.page_token):"");return e.config.request(r,{method:"GET",withCredentials:!0})}))()}modifyPassword(t){var e=this;return ht((function*(){var r="",n="",o=pt(0,e.config.adapter);if(!o)throw new Error("do not support encrypt, a encrypt util required.");try{var s=yield e.getPublicKey();if(r=s.public_key,n=s.public_key_thumbprint,!r||!n)throw s}catch(t){throw t}var a=t.password?o.getEncryptInfo({publicKey:r,payload:t.password}):"",u=o.getEncryptInfo({publicKey:r,payload:t.new_password});return e.config.request(i.USER_BASIC_EDIT_URL,{method:"POST",withCredentials:!0,body:{user_id:t.user_id,encrypt_password:a,encrypt_new_password:u,public_key_thumbprint:n}})}))()}modifyPasswordWithoutLogin(t){var e=this;return ht((function*(){var r="",n="",i=pt(0,e.config.adapter);if(!i)throw new Error("do not support encrypt, a encrypt util required.");try{var s=yield e.getPublicKey();if(r=s.public_key,n=s.public_key_thumbprint,!r||!n)throw s}catch(t){throw t}var a=t.password?i.getEncryptInfo({publicKey:r,payload:t.password}):"",u=i.getEncryptInfo({publicKey:r,payload:t.new_password});return e.config.request(o.AUTH_RESET_PASSWORD,{method:"POST",body:{username:t.username,password:a,new_password:u,public_key_thumbprint:n}})}))()}}function gt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function mt(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?gt(Object(r),!0).forEach((function(e){yt(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):gt(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function yt(t,e,r){return(e=function(t){var e=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}class _t{constructor(t){var{apiOrigin:e,apiPath:r=h,clientId:n,env:i,storage:o,request:s,baseRequest:a,anonymousSignInFunc:u,wxCloud:c,adapter:l,onCredentialsError:d,headers:f,i18n:p}=t;this.oauth2client=new $({apiOrigin:e,apiPath:r,clientId:n,env:i,storage:o,baseRequest:a||s,anonymousSignInFunc:u,wxCloud:c,onCredentialsError:d,headers:f||{},i18n:p}),this.authApi=new vt(mt(mt({credentialsClient:this.oauth2client},t),{},{request:s?this.oauth2client.request.bind(this.oauth2client):void 0,adapter:l}))}}},171:(t,e,r)=>{var n;if(r.r(e),r.d(e,{getEncryptInfo:()=>j}),!globalThis.IS_MP_BUILD){var i="undefined"!=typeof globalThis?globalThis.navigator:window.globalThis,o="0123456789abcdefghijklmnopqrstuvwxyz";function M(t){return o.charAt(t)}function H(t,e){return t&e}function V(t,e){return t|e}function G(t,e){return t^e}function F(t,e){return t&~e}function K(t){if(0==t)return-1;var e=0;return 65535&t||(t>>=16,e+=16),255&t||(t>>=8,e+=8),15&t||(t>>=4,e+=4),3&t||(t>>=2,e+=2),1&t||++e,e}function W(t){for(var e=0;0!=t;)t&=t-1,++e;return e}var s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function Y(t){var e,r,n="";for(e=0;e+3<=t.length;e+=3)r=parseInt(t.substring(e,e+3),16),n+=s.charAt(r>>6)+s.charAt(63&r);for(e+1==t.length?(r=parseInt(t.substring(e,e+1),16),n+=s.charAt(r<<2)):e+2==t.length&&(r=parseInt(t.substring(e,e+2),16),n+=s.charAt(r>>2)+s.charAt((3&r)<<4));(3&n.length)>0;)n+="=";return n}function z(t){var e,r="",n=0,i=0;for(e=0;e<t.length&&"="!=t.charAt(e);++e){var o=s.indexOf(t.charAt(e));o<0||(0==n?(r+=M(o>>2),i=3&o,n=1):1==n?(r+=M(i<<2|o>>4),i=15&o,n=2):2==n?(r+=M(i),r+=M(o>>2),i=3&o,n=3):(r+=M(i<<2|o>>4),r+=M(15&o),n=0))}return 1==n&&(r+=M(i<<2)),r}var a,u,c={decode:function(t){var e;if(void 0===a){var r="0123456789ABCDEF";for(a={},e=0;e<16;++e)a[r.charAt(e)]=e;for(r=r.toLowerCase(),e=10;e<16;++e)a[r.charAt(e)]=e;for(e=0;e<8;++e)a[" \f\n\r\t \u2028\u2029".charAt(e)]=-1}var n=[],i=0,o=0;for(e=0;e<t.length;++e){var s=t.charAt(e);if("="==s)break;if(-1!=(s=a[s])){if(void 0===s)throw new Error("Illegal character at offset "+e);i|=s,++o>=2?(n[n.length]=i,i=0,o=0):i<<=4}}if(o)throw new Error("Hex encoding incomplete: 4 bits missing");return n}},h={decode:function(t){var e;if(void 0===u){for(u=Object.create(null),e=0;e<64;++e)u["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e)]=e;for(e=0;e<9;++e)u["= \f\n\r\t \u2028\u2029".charAt(e)]=-1}var r=[],n=0,i=0;for(e=0;e<t.length;++e){var o=t.charAt(e);if("="==o)break;if(-1!=(o=u[o])){if(void 0===o)throw new Error("Illegal character at offset "+e);n|=o,++i>=4?(r[r.length]=n>>16,r[r.length]=n>>8&255,r[r.length]=255&n,n=0,i=0):n<<=6}}switch(i){case 1:throw new Error("Base64 encoding incomplete: at least 2 bits missing");case 2:r[r.length]=n>>10;break;case 3:r[r.length]=n>>16,r[r.length]=n>>8&255}return r},re:/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,unarmor:function(t){var e=h.re.exec(t);if(e)if(e[1])t=e[1];else{if(!e[2])throw new Error("RegExp out of sync");t=e[2]}return h.decode(t)}},l=1e13;class Z{constructor(t){this.buf=[+t||0]}mulAdd(t,e){var r,n,i=this.buf,o=i.length;for(r=0;r<o;++r)(n=i[r]*t+e)<l?e=0:n-=(e=0|n/l)*l,i[r]=n;e>0&&(i[r]=e)}sub(t){var e,r,n=this.buf,i=n.length;for(e=0;e<i;++e)(r=n[e]-t)<0?(r+=l,t=1):t=0,n[e]=r;for(;0===n[n.length-1];)n.pop()}toString(t){if(10!=(t||10))throw new Error("only base 10 is supported");for(var e=this.buf,r=e[e.length-1].toString(),n=e.length-2;n>=0;--n)r+=(l+e[n]).toString().substring(1);return r}valueOf(){for(var t=this.buf,e=0,r=t.length-1;r>=0;--r)e=e*l+t[r];return e}simplify(){var t=this.buf;return 1==t.length?t[0]:this}}var d,f=/^(\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/,p=/^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/;function Q(t,e){return t.length>e&&(t=t.substring(0,e)+"…"),t}class J{constructor(t,e){this.hexDigits="0123456789ABCDEF",t instanceof J?(this.enc=t.enc,this.pos=t.pos):(this.enc=t,this.pos=e)}get(t){if(void 0===t&&(t=this.pos++),t>=this.enc.length)throw new Error("Requesting byte offset "+t+" on a stream of length "+this.enc.length);return"string"==typeof this.enc?this.enc.charCodeAt(t):this.enc[t]}hexByte(t){return this.hexDigits.charAt(t>>4&15)+this.hexDigits.charAt(15&t)}hexDump(t,e,r){for(var n="",i=t;i<e;++i)if(n+=this.hexByte(this.get(i)),!0!==r)switch(15&i){case 7:n+=" ";break;case 15:n+="\n";break;default:n+=" "}return n}isASCII(t,e){for(var r=t;r<e;++r){var n=this.get(r);if(n<32||n>176)return!1}return!0}parseStringISO(t,e){for(var r="",n=t;n<e;++n)r+=String.fromCharCode(this.get(n));return r}parseStringUTF(t,e){for(var r="",n=t;n<e;){var i=this.get(n++);r+=i<128?String.fromCharCode(i):i>191&&i<224?String.fromCharCode((31&i)<<6|63&this.get(n++)):String.fromCharCode((15&i)<<12|(63&this.get(n++))<<6|63&this.get(n++))}return r}parseStringBMP(t,e){for(var r,n,i="",o=t;o<e;)r=this.get(o++),n=this.get(o++),i+=String.fromCharCode(r<<8|n);return i}parseTime(t,e,r){var n=this.parseStringISO(t,e),i=(r?f:p).exec(n);return i?(r&&(i[1]=+i[1],i[1]+=+i[1]<70?2e3:1900),n=i[1]+"-"+i[2]+"-"+i[3]+" "+i[4],i[5]&&(n+=":"+i[5],i[6]&&(n+=":"+i[6],i[7]&&(n+="."+i[7]))),i[8]&&(n+=" UTC","Z"!=i[8]&&(n+=i[8],i[9]&&(n+=":"+i[9]))),n):"Unrecognized time: "+n}parseInteger(t,e){for(var r,n=this.get(t),i=n>127,o=i?255:0,s="";n==o&&++t<e;)n=this.get(t);if(0==(r=e-t))return i?-1:0;if(r>4){for(s=n,r<<=3;!(128&(+s^o));)s=+s<<1,--r;s="("+r+" bit)\n"}i&&(n-=256);for(var a=new Z(n),u=t+1;u<e;++u)a.mulAdd(256,this.get(u));return s+a.toString()}parseBitString(t,e,r){for(var n=this.get(t),i="("+((e-t-1<<3)-n)+" bit)\n",o="",s=t+1;s<e;++s){for(var a=this.get(s),u=s==e-1?n:0,c=7;c>=u;--c)o+=a>>c&1?"1":"0";if(o.length>r)return i+Q(o,r)}return i+o}parseOctetString(t,e,r){if(this.isASCII(t,e))return Q(this.parseStringISO(t,e),r);var n=e-t,i="("+n+" byte)\n";n>(r/=2)&&(e=t+r);for(var o=t;o<e;++o)i+=this.hexByte(this.get(o));return n>r&&(i+="…"),i}parseOID(t,e,r){for(var n="",i=new Z,o=0,s=t;s<e;++s){var a=this.get(s);if(i.mulAdd(128,127&a),o+=7,!(128&a)){if(""===n)if((i=i.simplify())instanceof Z)i.sub(80),n="2."+i.toString();else{var u=i<80?i<40?0:1:2;n=u+"."+(i-40*u)}else n+="."+i.toString();if(n.length>r)return Q(n,r);i=new Z,o=0}}return o>0&&(n+=".incomplete"),n}}class X{constructor(t,e,r,n,i){if(!(n instanceof $))throw new Error("Invalid tag value.");this.stream=t,this.header=e,this.length=r,this.tag=n,this.sub=i}typeName(){switch(this.tag.tagClass){case 0:switch(this.tag.tagNumber){case 0:return"EOC";case 1:return"BOOLEAN";case 2:return"INTEGER";case 3:return"BIT_STRING";case 4:return"OCTET_STRING";case 5:return"NULL";case 6:return"OBJECT_IDENTIFIER";case 7:return"ObjectDescriptor";case 8:return"EXTERNAL";case 9:return"REAL";case 10:return"ENUMERATED";case 11:return"EMBEDDED_PDV";case 12:return"UTF8String";case 16:return"SEQUENCE";case 17:return"SET";case 18:return"NumericString";case 19:return"PrintableString";case 20:return"TeletexString";case 21:return"VideotexString";case 22:return"IA5String";case 23:return"UTCTime";case 24:return"GeneralizedTime";case 25:return"GraphicString";case 26:return"VisibleString";case 27:return"GeneralString";case 28:return"UniversalString";case 30:return"BMPString"}return"Universal_"+this.tag.tagNumber.toString();case 1:return"Application_"+this.tag.tagNumber.toString();case 2:return"["+this.tag.tagNumber.toString()+"]";case 3:return"Private_"+this.tag.tagNumber.toString()}}content(t){if(void 0===this.tag)return null;void 0===t&&(t=1/0);var e=this.posContent(),r=Math.abs(this.length);if(!this.tag.isUniversal())return null!==this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(e,e+r,t);switch(this.tag.tagNumber){case 1:return 0===this.stream.get(e)?"false":"true";case 2:return this.stream.parseInteger(e,e+r);case 3:return this.sub?"("+this.sub.length+" elem)":this.stream.parseBitString(e,e+r,t);case 4:return this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(e,e+r,t);case 6:return this.stream.parseOID(e,e+r,t);case 16:case 17:return null!==this.sub?"("+this.sub.length+" elem)":"(no elem)";case 12:return Q(this.stream.parseStringUTF(e,e+r),t);case 18:case 19:case 20:case 21:case 22:case 26:return Q(this.stream.parseStringISO(e,e+r),t);case 30:return Q(this.stream.parseStringBMP(e,e+r),t);case 23:case 24:return this.stream.parseTime(e,e+r,23==this.tag.tagNumber)}return null}toString(){return this.typeName()+"@"+this.stream.pos+"[header:"+this.header+",length:"+this.length+",sub:"+(null===this.sub?"null":this.sub.length)+"]"}toPrettyString(t){void 0===t&&(t="");var e=t+this.typeName()+" @"+this.stream.pos;if(this.length>=0&&(e+="+"),e+=this.length,this.tag.tagConstructed?e+=" (constructed)":!this.tag.isUniversal()||3!=this.tag.tagNumber&&4!=this.tag.tagNumber||null===this.sub||(e+=" (encapsulates)"),e+="\n",null!==this.sub){t+=" ";for(var r=0,n=this.sub.length;r<n;++r)e+=this.sub[r].toPrettyString(t)}return e}posStart(){return this.stream.pos}posContent(){return this.stream.pos+this.header}posEnd(){return this.stream.pos+this.header+Math.abs(this.length)}toHexString(){return this.stream.hexDump(this.posStart(),this.posEnd(),!0)}static decodeLength(t){var e=t.get(),r=127&e;if(r==e)return r;if(r>6)throw new Error("Length over 48 bits not supported at position "+(t.pos-1));if(0===r)return null;e=0;for(var n=0;n<r;++n)e=256*e+t.get();return e}getHexStringValue(){var t=this.toHexString(),e=2*this.header,r=2*this.length;return t.substr(e,r)}static decode(t){var e;e=t instanceof J?t:new J(t,0);var r=new J(e),n=new $(e),i=X.decodeLength(e),o=e.pos,s=o-r.pos,a=null,u=function(){var t=[];if(null!==i){for(var r=o+i;e.pos<r;)t[t.length]=X.decode(e);if(e.pos!=r)throw new Error("Content size is not correct for container starting at offset "+o)}else try{for(;;){var n=X.decode(e);if(n.tag.isEOC())break;t[t.length]=n}i=o-e.pos}catch(t){throw new Error("Exception while decoding undefined length content: "+t)}return t};if(n.tagConstructed)a=u();else if(n.isUniversal()&&(3==n.tagNumber||4==n.tagNumber))try{if(3==n.tagNumber&&0!=e.get())throw new Error("BIT STRINGs with unused bits cannot encapsulate.");a=u();for(var c=0;c<a.length;++c)if(a[c].tag.isEOC())throw new Error("EOC is not supposed to be actual content.")}catch(t){a=null}if(null===a){if(null===i)throw new Error("We can't skip over an invalid tag with undefined length at offset "+o);e.pos=o+Math.abs(i)}return new X(r,s,i,n,a)}}class ${constructor(t){var e=t.get();if(this.tagClass=e>>6,this.tagConstructed=!!(32&e),this.tagNumber=31&e,31==this.tagNumber){var r=new Z;do{e=t.get(),r.mulAdd(128,127&e)}while(128&e);this.tagNumber=r.simplify()}}isUniversal(){return 0===this.tagClass}isEOC(){return 0===this.tagClass&&0===this.tagNumber}}var v=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],g=(1<<26)/v[v.length-1];class tt{constructor(t,e,r){null!=t&&("number"==typeof t?this.fromNumber(t,e,r):null==e&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,e))}toString(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(16==t)e=4;else if(8==t)e=3;else if(2==t)e=1;else if(32==t)e=5;else{if(4!=t)return this.toRadix(t);e=2}var r,n=(1<<e)-1,i=!1,o="",s=this.t,a=this.DB-s*this.DB%e;if(s-- >0)for(a<this.DB&&(r=this[s]>>a)>0&&(i=!0,o=M(r));s>=0;)a<e?(r=(this[s]&(1<<a)-1)<<e-a,r|=this[--s]>>(a+=this.DB-e)):(r=this[s]>>(a-=e)&n,a<=0&&(a+=this.DB,--s)),r>0&&(i=!0),i&&(o+=M(r));return i?o:"0"}negate(){var t=et();return tt.ZERO.subTo(this,t),t}abs(){return this.s<0?this.negate():this}compareTo(t){var e=this.s-t.s;if(0!=e)return e;var r=this.t;if(0!=(e=r-t.t))return this.s<0?-e:e;for(;--r>=0;)if(0!=(e=this[r]-t[r]))return e;return 0}bitLength(){return this.t<=0?0:this.DB*(this.t-1)+ut(this[this.t-1]^this.s&this.DM)}mod(t){var e=et();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(tt.ZERO)>0&&t.subTo(e,e),e}modPowInt(t,e){var r;return r=t<256||e.isEven()?new y(e):new _(e),this.exp(t,r)}clone(){var t=et();return this.copyTo(t),t}intValue(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]}byteValue(){return 0==this.t?this.s:this[0]<<24>>24}shortValue(){return 0==this.t?this.s:this[0]<<16>>16}signum(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1}toByteArray(){var t=this.t,e=[];e[0]=this.s;var r,n=this.DB-t*this.DB%8,i=0;if(t-- >0)for(n<this.DB&&(r=this[t]>>n)!=(this.s&this.DM)>>n&&(e[i++]=r|this.s<<this.DB-n);t>=0;)n<8?(r=(this[t]&(1<<n)-1)<<8-n,r|=this[--t]>>(n+=this.DB-8)):(r=this[t]>>(n-=8)&255,n<=0&&(n+=this.DB,--t)),128&r&&(r|=-256),0==i&&(128&this.s)!=(128&r)&&++i,(i>0||r!=this.s)&&(e[i++]=r);return e}equals(t){return 0==this.compareTo(t)}min(t){return this.compareTo(t)<0?this:t}max(t){return this.compareTo(t)>0?this:t}and(t){var e=et();return this.bitwiseTo(t,H,e),e}or(t){var e=et();return this.bitwiseTo(t,V,e),e}xor(t){var e=et();return this.bitwiseTo(t,G,e),e}andNot(t){var e=et();return this.bitwiseTo(t,F,e),e}not(){for(var t=et(),e=0;e<this.t;++e)t[e]=this.DM&~this[e];return t.t=this.t,t.s=~this.s,t}shiftLeft(t){var e=et();return t<0?this.rShiftTo(-t,e):this.lShiftTo(t,e),e}shiftRight(t){var e=et();return t<0?this.lShiftTo(-t,e):this.rShiftTo(t,e),e}getLowestSetBit(){for(var t=0;t<this.t;++t)if(0!=this[t])return t*this.DB+K(this[t]);return this.s<0?this.t*this.DB:-1}bitCount(){for(var t=0,e=this.s&this.DM,r=0;r<this.t;++r)t+=W(this[r]^e);return t}testBit(t){var e=Math.floor(t/this.DB);return e>=this.t?0!=this.s:!!(this[e]&1<<t%this.DB)}setBit(t){return this.changeBit(t,V)}clearBit(t){return this.changeBit(t,F)}flipBit(t){return this.changeBit(t,G)}add(t){var e=et();return this.addTo(t,e),e}subtract(t){var e=et();return this.subTo(t,e),e}multiply(t){var e=et();return this.multiplyTo(t,e),e}divide(t){var e=et();return this.divRemTo(t,e,null),e}remainder(t){var e=et();return this.divRemTo(t,null,e),e}divideAndRemainder(t){var e=et(),r=et();return this.divRemTo(t,e,r),[e,r]}modPow(t,e){var r,n,i=t.bitLength(),o=at(1);if(i<=0)return o;r=i<18?1:i<48?3:i<144?4:i<768?5:6,n=i<8?new y(e):e.isEven()?new b(e):new _(e);var s=[],a=3,u=r-1,c=(1<<r)-1;if(s[1]=n.convert(this),r>1){var h=et();for(n.sqrTo(s[1],h);a<=c;)s[a]=et(),n.mulTo(h,s[a-2],s[a]),a+=2}var l,d,f=t.t-1,p=!0,v=et();for(i=ut(t[f])-1;f>=0;){for(i>=u?l=t[f]>>i-u&c:(l=(t[f]&(1<<i+1)-1)<<u-i,f>0&&(l|=t[f-1]>>this.DB+i-u)),a=r;!(1&l);)l>>=1,--a;if((i-=a)<0&&(i+=this.DB,--f),p)s[l].copyTo(o),p=!1;else{for(;a>1;)n.sqrTo(o,v),n.sqrTo(v,o),a-=2;a>0?n.sqrTo(o,v):(d=o,o=v,v=d),n.mulTo(v,s[l],o)}for(;f>=0&&!(t[f]&1<<i);)n.sqrTo(o,v),d=o,o=v,v=d,--i<0&&(i=this.DB-1,--f)}return n.revert(o)}modInverse(t){var e=t.isEven();if(this.isEven()&&e||0==t.signum())return tt.ZERO;for(var r=t.clone(),n=this.clone(),i=at(1),o=at(0),s=at(0),a=at(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),e?(i.isEven()&&o.isEven()||(i.addTo(this,i),o.subTo(t,o)),i.rShiftTo(1,i)):o.isEven()||o.subTo(t,o),o.rShiftTo(1,o);for(;n.isEven();)n.rShiftTo(1,n),e?(s.isEven()&&a.isEven()||(s.addTo(this,s),a.subTo(t,a)),s.rShiftTo(1,s)):a.isEven()||a.subTo(t,a),a.rShiftTo(1,a);r.compareTo(n)>=0?(r.subTo(n,r),e&&i.subTo(s,i),o.subTo(a,o)):(n.subTo(r,n),e&&s.subTo(i,s),a.subTo(o,a))}return 0!=n.compareTo(tt.ONE)?tt.ZERO:a.compareTo(t)>=0?a.subtract(t):a.signum()<0?(a.addTo(t,a),a.signum()<0?a.add(t):a):a}pow(t){return this.exp(t,new m)}gcd(t){var e=this.s<0?this.negate():this.clone(),r=t.s<0?t.negate():t.clone();if(e.compareTo(r)<0){var n=e;e=r,r=n}var i=e.getLowestSetBit(),o=r.getLowestSetBit();if(o<0)return e;for(i<o&&(o=i),o>0&&(e.rShiftTo(o,e),r.rShiftTo(o,r));e.signum()>0;)(i=e.getLowestSetBit())>0&&e.rShiftTo(i,e),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),e.compareTo(r)>=0?(e.subTo(r,e),e.rShiftTo(1,e)):(r.subTo(e,r),r.rShiftTo(1,r));return o>0&&r.lShiftTo(o,r),r}isProbablePrime(t){var e,r=this.abs();if(1==r.t&&r[0]<=v[v.length-1]){for(e=0;e<v.length;++e)if(r[0]==v[e])return!0;return!1}if(r.isEven())return!1;for(e=1;e<v.length;){for(var n=v[e],i=e+1;i<v.length&&n<g;)n*=v[i++];for(n=r.modInt(n);e<i;)if(n%v[e++]==0)return!1}return r.millerRabin(t)}copyTo(t){for(var e=this.t-1;e>=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s}fromInt(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+this.DV:this.t=0}fromString(t,e){var r;if(16==e)r=4;else if(8==e)r=3;else if(256==e)r=8;else if(2==e)r=1;else if(32==e)r=5;else{if(4!=e)return void this.fromRadix(t,e);r=2}this.t=0,this.s=0;for(var n=t.length,i=!1,o=0;--n>=0;){var s=8==r?255&+t[n]:st(t,n);s<0?"-"==t.charAt(n)&&(i=!0):(i=!1,0==o?this[this.t++]=s:o+r>this.DB?(this[this.t-1]|=(s&(1<<this.DB-o)-1)<<o,this[this.t++]=s>>this.DB-o):this[this.t-1]|=s<<o,(o+=r)>=this.DB&&(o-=this.DB))}8==r&&128&+t[0]&&(this.s=-1,o>0&&(this[this.t-1]|=(1<<this.DB-o)-1<<o)),this.clamp(),i&&tt.ZERO.subTo(this,this)}clamp(){for(var t=this.s&this.DM;this.t>0&&this[this.t-1]==t;)--this.t}dlShiftTo(t,e){var r;for(r=this.t-1;r>=0;--r)e[r+t]=this[r];for(r=t-1;r>=0;--r)e[r]=0;e.t=this.t+t,e.s=this.s}drShiftTo(t,e){for(var r=t;r<this.t;++r)e[r-t]=this[r];e.t=Math.max(this.t-t,0),e.s=this.s}lShiftTo(t,e){for(var r=t%this.DB,n=this.DB-r,i=(1<<n)-1,o=Math.floor(t/this.DB),s=this.s<<r&this.DM,a=this.t-1;a>=0;--a)e[a+o+1]=this[a]>>n|s,s=(this[a]&i)<<r;for(a=o-1;a>=0;--a)e[a]=0;e[o]=s,e.t=this.t+o+1,e.s=this.s,e.clamp()}rShiftTo(t,e){e.s=this.s;var r=Math.floor(t/this.DB);if(r>=this.t)e.t=0;else{var n=t%this.DB,i=this.DB-n,o=(1<<n)-1;e[0]=this[r]>>n;for(var s=r+1;s<this.t;++s)e[s-r-1]|=(this[s]&o)<<i,e[s-r]=this[s]>>n;n>0&&(e[this.t-r-1]|=(this.s&o)<<i),e.t=this.t-r,e.clamp()}}subTo(t,e){for(var r=0,n=0,i=Math.min(t.t,this.t);r<i;)n+=this[r]-t[r],e[r++]=n&this.DM,n>>=this.DB;if(t.t<this.t){for(n-=t.s;r<this.t;)n+=this[r],e[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<t.t;)n-=t[r],e[r++]=n&this.DM,n>>=this.DB;n-=t.s}e.s=n<0?-1:0,n<-1?e[r++]=this.DV+n:n>0&&(e[r++]=n),e.t=r,e.clamp()}multiplyTo(t,e){var r=this.abs(),n=t.abs(),i=r.t;for(e.t=i+n.t;--i>=0;)e[i]=0;for(i=0;i<n.t;++i)e[i+r.t]=r.am(0,n[i],e,i,0,r.t);e.s=0,e.clamp(),this.s!=t.s&&tt.ZERO.subTo(e,e)}squareTo(t){for(var e=this.abs(),r=t.t=2*e.t;--r>=0;)t[r]=0;for(r=0;r<e.t-1;++r){var n=e.am(r,e[r],t,2*r,0,1);(t[r+e.t]+=e.am(r+1,2*e[r],t,2*r+1,n,e.t-r-1))>=e.DV&&(t[r+e.t]-=e.DV,t[r+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(r,e[r],t,2*r,0,1)),t.s=0,t.clamp()}divRemTo(t,e,r){var n=t.abs();if(!(n.t<=0)){var i=this.abs();if(i.t<n.t)return null!=e&&e.fromInt(0),void(null!=r&&this.copyTo(r));null==r&&(r=et());var o=et(),s=this.s,a=t.s,u=this.DB-ut(n[n.t-1]);u>0?(n.lShiftTo(u,o),i.lShiftTo(u,r)):(n.copyTo(o),i.copyTo(r));var c=o.t,h=o[c-1];if(0!=h){var l=h*(1<<this.F1)+(c>1?o[c-2]>>this.F2:0),d=this.FV/l,f=(1<<this.F1)/l,p=1<<this.F2,v=r.t,g=v-c,m=null==e?et():e;for(o.dlShiftTo(g,m),r.compareTo(m)>=0&&(r[r.t++]=1,r.subTo(m,r)),tt.ONE.dlShiftTo(c,m),m.subTo(o,o);o.t<c;)o[o.t++]=0;for(;--g>=0;){var y=r[--v]==h?this.DM:Math.floor(r[v]*d+(r[v-1]+p)*f);if((r[v]+=o.am(0,y,r,g,0,c))<y)for(o.dlShiftTo(g,m),r.subTo(m,r);r[v]<--y;)r.subTo(m,r)}null!=e&&(r.drShiftTo(c,e),s!=a&&tt.ZERO.subTo(e,e)),r.t=c,r.clamp(),u>0&&r.rShiftTo(u,r),s<0&&tt.ZERO.subTo(r,r)}}}invDigit(){if(this.t<1)return 0;var t=this[0];if(!(1&t))return 0;var e=3&t;return(e=(e=(e=(e=e*(2-(15&t)*e)&15)*(2-(255&t)*e)&255)*(2-((65535&t)*e&65535))&65535)*(2-t*e%this.DV)%this.DV)>0?this.DV-e:-e}isEven(){return 0==(this.t>0?1&this[0]:this.s)}exp(t,e){if(t>4294967295||t<1)return tt.ONE;var r=et(),n=et(),i=e.convert(this),o=ut(t)-1;for(i.copyTo(r);--o>=0;)if(e.sqrTo(r,n),(t&1<<o)>0)e.mulTo(n,i,r);else{var s=r;r=n,n=s}return e.revert(r)}chunkSize(t){return Math.floor(Math.LN2*this.DB/Math.log(t))}toRadix(t){if(null==t&&(t=10),0==this.signum()||t<2||t>36)return"0";var e=this.chunkSize(t),r=Math.pow(t,e),n=at(r),i=et(),o=et(),s="";for(this.divRemTo(n,i,o);i.signum()>0;)s=(r+o.intValue()).toString(t).substr(1)+s,i.divRemTo(n,i,o);return o.intValue().toString(t)+s}fromRadix(t,e){this.fromInt(0),null==e&&(e=10);for(var r=this.chunkSize(e),n=Math.pow(e,r),i=!1,o=0,s=0,a=0;a<t.length;++a){var u=st(t,a);u<0?"-"==t.charAt(a)&&0==this.signum()&&(i=!0):(s=e*s+u,++o>=r&&(this.dMultiply(n),this.dAddOffset(s,0),o=0,s=0))}o>0&&(this.dMultiply(Math.pow(e,o)),this.dAddOffset(s,0)),i&&tt.ZERO.subTo(this,this)}fromNumber(t,e,r){if("number"==typeof e)if(t<2)this.fromInt(1);else for(this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(tt.ONE.shiftLeft(t-1),V,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(tt.ONE.shiftLeft(t-1),this);else{var n=[],i=7&t;n.length=1+(t>>3),e.nextBytes(n),i>0?n[0]&=(1<<i)-1:n[0]=0,this.fromString(n,256)}}bitwiseTo(t,e,r){var n,i,o=Math.min(t.t,this.t);for(n=0;n<o;++n)r[n]=e(this[n],t[n]);if(t.t<this.t){for(i=t.s&this.DM,n=o;n<this.t;++n)r[n]=e(this[n],i);r.t=this.t}else{for(i=this.s&this.DM,n=o;n<t.t;++n)r[n]=e(i,t[n]);r.t=t.t}r.s=e(this.s,t.s),r.clamp()}changeBit(t,e){var r=tt.ONE.shiftLeft(t);return this.bitwiseTo(r,e,r),r}addTo(t,e){for(var r=0,n=0,i=Math.min(t.t,this.t);r<i;)n+=this[r]+t[r],e[r++]=n&this.DM,n>>=this.DB;if(t.t<this.t){for(n+=t.s;r<this.t;)n+=this[r],e[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<t.t;)n+=t[r],e[r++]=n&this.DM,n>>=this.DB;n+=t.s}e.s=n<0?-1:0,n>0?e[r++]=n:n<-1&&(e[r++]=this.DV+n),e.t=r,e.clamp()}dMultiply(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()}dAddOffset(t,e){if(0!=t){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=t;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}}multiplyLowerTo(t,e,r){var n=Math.min(this.t+t.t,e);for(r.s=0,r.t=n;n>0;)r[--n]=0;for(var i=r.t-this.t;n<i;++n)r[n+this.t]=this.am(0,t[n],r,n,0,this.t);for(i=Math.min(t.t,e);n<i;++n)this.am(0,t[n],r,n,0,e-n);r.clamp()}multiplyUpperTo(t,e,r){--e;var n=r.t=this.t+t.t-e;for(r.s=0;--n>=0;)r[n]=0;for(n=Math.max(e-this.t,0);n<t.t;++n)r[this.t+n-e]=this.am(e-n,t[n],r,0,0,this.t+n-e);r.clamp(),r.drShiftTo(1,r)}modInt(t){if(t<=0)return 0;var e=this.DV%t,r=this.s<0?t-1:0;if(this.t>0)if(0==e)r=this[0]%t;else for(var n=this.t-1;n>=0;--n)r=(e*r+this[n])%t;return r}millerRabin(t){var e=this.subtract(tt.ONE),r=e.getLowestSetBit();if(r<=0)return!1;var n=e.shiftRight(r);(t=t+1>>1)>v.length&&(t=v.length);for(var i=et(),o=0;o<t;++o){i.fromInt(v[Math.floor(Math.random()*v.length)]);var s=i.modPow(n,this);if(0!=s.compareTo(tt.ONE)&&0!=s.compareTo(e)){for(var a=1;a++<r&&0!=s.compareTo(e);)if(0==(s=s.modPowInt(2,this)).compareTo(tt.ONE))return!1;if(0!=s.compareTo(e))return!1}}return!0}square(){var t=et();return this.squareTo(t),t}gcda(t,e){var r=this.s<0?this.negate():this.clone(),n=t.s<0?t.negate():t.clone();if(r.compareTo(n)<0){var i=r;r=n,n=i}var o=r.getLowestSetBit(),s=n.getLowestSetBit();if(s<0)e(r);else{o<s&&(s=o),s>0&&(r.rShiftTo(s,r),n.rShiftTo(s,n));var a=()=>{(o=r.getLowestSetBit())>0&&r.rShiftTo(o,r),(o=n.getLowestSetBit())>0&&n.rShiftTo(o,n),r.compareTo(n)>=0?(r.subTo(n,r),r.rShiftTo(1,r)):(n.subTo(r,n),n.rShiftTo(1,n)),r.signum()>0?setTimeout(a,0):(s>0&&n.lShiftTo(s,n),setTimeout((function(){e(n)}),0))};setTimeout(a,10)}}fromNumberAsync(t,e,r,n){if("number"==typeof e)if(t<2)this.fromInt(1);else{this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(tt.ONE.shiftLeft(t-1),V,this),this.isEven()&&this.dAddOffset(1,0);var i=this,o=function(){i.dAddOffset(2,0),i.bitLength()>t&&i.subTo(tt.ONE.shiftLeft(t-1),i),i.isProbablePrime(e)?setTimeout((function(){n()}),0):setTimeout(o,0)};setTimeout(o,0)}else{var s=[],a=7&t;s.length=1+(t>>3),e.nextBytes(s),a>0?s[0]&=(1<<a)-1:s[0]=0,this.fromString(s,256)}}}var m=function(){function t(){}return t.prototype.convert=function(t){return t},t.prototype.revert=function(t){return t},t.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r)},t.prototype.sqrTo=function(t,e){t.squareTo(e)},t}(),y=function(){function t(t){this.m=t}return t.prototype.convert=function(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t},t.prototype.revert=function(t){return t},t.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},t.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},t.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},t}(),_=function(){function t(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}return t.prototype.convert=function(t){var e=et();return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&e.compareTo(tt.ZERO)>0&&this.m.subTo(e,e),e},t.prototype.revert=function(t){var e=et();return t.copyTo(e),this.reduce(e),e},t.prototype.reduce=function(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e<this.m.t;++e){var r=32767&t[e],n=r*this.mpl+((r*this.mph+(t[e]>>15)*this.mpl&this.um)<<15)&t.DM;for(t[r=e+this.m.t]+=this.m.am(0,n,t,e,0,this.m.t);t[r]>=t.DV;)t[r]-=t.DV,t[++r]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)},t.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},t.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},t}(),b=function(){function t(t){this.m=t,this.r2=et(),this.q3=et(),tt.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t)}return t.prototype.convert=function(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=et();return t.copyTo(e),this.reduce(e),e},t.prototype.revert=function(t){return t},t.prototype.reduce=function(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)},t.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},t.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},t}();function et(){return new tt(null)}function rt(t,e){return new tt(t,e)}function nt(t,e,r,n,i,o){for(;--o>=0;){var s=e*this[t++]+r[n]+i;i=Math.floor(s/67108864),r[n++]=67108863&s}return i}function it(t,e,r,n,i,o){for(var s=32767&e,a=e>>15;--o>=0;){var u=32767&this[t],c=this[t++]>>15,h=a*u+c*s;i=((u=s*u+((32767&h)<<15)+r[n]+(1073741823&i))>>>30)+(h>>>15)+a*c+(i>>>30),r[n++]=1073741823&u}return i}function ot(t,e,r,n,i,o){for(var s=16383&e,a=e>>14;--o>=0;){var u=16383&this[t],c=this[t++]>>14,h=a*u+c*s;i=((u=s*u+((16383&h)<<14)+r[n]+i)>>28)+(h>>14)+a*c,r[n++]=268435455&u}return i}void 0!==i&&"Microsoft Internet Explorer"==(null==i?void 0:i.appName)?(tt.prototype.am=it,d=30):"Netscape"!=(null==i?void 0:i.appName)?(tt.prototype.am=nt,d=26):(tt.prototype.am=ot,d=28),tt.prototype.DB=d,tt.prototype.DM=(1<<d)-1,tt.prototype.DV=1<<d,tt.prototype.FV=Math.pow(2,52),tt.prototype.F1=52-d,tt.prototype.F2=2*d-52;var T,E,S=[];for(T="0".charCodeAt(0),E=0;E<=9;++E)S[T++]=E;for(T="a".charCodeAt(0),E=10;E<36;++E)S[T++]=E;for(T="A".charCodeAt(0),E=10;E<36;++E)S[T++]=E;function st(t,e){var r=S[t.charCodeAt(e)];return null==r?-1:r}function at(t){var e=et();return e.fromInt(t),e}function ut(t){var e,r=1;return 0!=(e=t>>>16)&&(t=e,r+=16),0!=(e=t>>8)&&(t=e,r+=8),0!=(e=t>>4)&&(t=e,r+=4),0!=(e=t>>2)&&(t=e,r+=2),0!=(e=t>>1)&&(t=e,r+=1),r}tt.ZERO=at(0),tt.ONE=at(1);class ct{constructor(){this.i=0,this.j=0,this.S=[]}init(t){var e,r,n;for(e=0;e<256;++e)this.S[e]=e;for(r=0,e=0;e<256;++e)r=r+this.S[e]+t[e%t.length]&255,n=this.S[e],this.S[e]=this.S[r],this.S[r]=n;this.i=0,this.j=0}next(){var t;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,t=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=t,this.S[t+this.S[this.i]&255]}}var w,I,O=null;if(null==O){var R,C,A,P;O=[],I=0;var U=void 0;if(null!==(R=window)&&void 0!==R&&R.crypto&&null!==(C=window)&&void 0!==C&&C.crypto.getRandomValues){var D,N=new Uint32Array(256);for(null===(D=window)||void 0===D||D.crypto.getRandomValues(N),U=0;U<N.length;++U)O[I++]=255&N[U]}var L,x=function(t){var e,r,n;if(this.count=this.count||0,this.count>=256||I>=256){if(null!==(e=window)&&void 0!==e&&e.removeEventListener)null===(n=window)||void 0===n||n.removeEventListener("mousemove",x,!1);else if(null!==(r=window)&&void 0!==r&&r.detachEvent){var i;null===(i=window)||void 0===i||i.detachEvent("onmousemove",x)}}else try{var o=t.x+t.y;O[I++]=255&o,this.count+=1}catch(t){}};if(null!==(A=window)&&void 0!==A&&A.addEventListener)null===(L=window)||void 0===L||L.addEventListener("mousemove",x,!1);else if(null!==(P=window)&&void 0!==P&&P.attachEvent){var k;null===(k=window)||void 0===k||k.attachEvent("onmousemove",x)}}function ht(){if(null==w){for(w=new ct;I<256;){var t=Math.floor(65536*Math.random());O[I++]=255&t}for(w.init(O),I=0;I<O.length;++I)O[I]=0;I=0}return w.next()}class lt{constructor(){}nextBytes(t){for(var e=0;e<t.length;++e)t[e]=ht()}}function dt(t,e){if(e<t.length+11)return console.error("Message too long for RSA"),null;for(var r=[],n=t.length-1;n>=0&&e>0;){var i=t.charCodeAt(n--);i<128?r[--e]=i:i>127&&i<2048?(r[--e]=63&i|128,r[--e]=i>>6|192):(r[--e]=63&i|128,r[--e]=i>>6&63|128,r[--e]=i>>12|224)}r[--e]=0;for(var o=new lt,s=[];e>2;){for(s[0]=0;0==s[0];)o.nextBytes(s);r[--e]=s[0]}return r[--e]=2,r[--e]=0,new tt(r)}class ft{constructor(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}doPublic(t){return t.modPowInt(this.e,this.n)}doPrivate(t){if(null==this.p||null==this.q)return t.modPow(this.d,this.n);for(var e=t.mod(this.p).modPow(this.dmp1,this.p),r=t.mod(this.q).modPow(this.dmq1,this.q);e.compareTo(r)<0;)e=e.add(this.p);return e.subtract(r).multiply(this.coeff).mod(this.p).multiply(this.q).add(r)}setPublic(t,e){null!=t&&null!=e&&t.length>0&&e.length>0?(this.n=rt(t,16),this.e=parseInt(e,16)):console.error("Invalid RSA public key")}encrypt(t){var e=dt(t,this.n.bitLength()+7>>3);if(null==e)return null;var r=this.doPublic(e);if(null==r)return null;var n=r.toString(16);return 1&n.length?"0"+n:n}encryptLong(t){var e=this,r=(this.n.bitLength()+7>>3)-11;try{var n="";return t.length>r?(t.match(/.{1,117}/g).forEach((function(t){var r=e.encrypt(t);n+=r})),Y(n)):Y(this.encrypt(t))}catch(t){return!1}}decryptLong(t){var e=this,r=this.n.bitLength()+7>>3;t=z(t);try{if(t.length>r){var n="";return t.match(/.{1,256}/g).forEach((function(t){var r=e.decrypt(t);n+=r})),n}return this.decrypt(t)}catch(t){return!1}}setPrivate(t,e,r){null!=t&&null!=e&&t.length>0&&e.length>0?(this.n=rt(t,16),this.e=parseInt(e,16),this.d=rt(r,16)):console.error("Invalid RSA private key")}setPrivateEx(t,e,r,n,i,o,s,a){null!=t&&null!=e&&t.length>0&&e.length>0?(this.n=rt(t,16),this.e=parseInt(e,16),this.d=rt(r,16),this.p=rt(n,16),this.q=rt(i,16),this.dmp1=rt(o,16),this.dmq1=rt(s,16),this.coeff=rt(a,16)):console.error("Invalid RSA private key")}generate(t,e){var r=new lt,n=t>>1;this.e=parseInt(e,16);for(var i=new tt(e,16);;){for(;this.p=new tt(t-n,1,r),0!=this.p.subtract(tt.ONE).gcd(i).compareTo(tt.ONE)||!this.p.isProbablePrime(10););for(;this.q=new tt(n,1,r),0!=this.q.subtract(tt.ONE).gcd(i).compareTo(tt.ONE)||!this.q.isProbablePrime(10););if(this.p.compareTo(this.q)<=0){var o=this.p;this.p=this.q,this.q=o}var s=this.p.subtract(tt.ONE),a=this.q.subtract(tt.ONE),u=s.multiply(a);if(0==u.gcd(i).compareTo(tt.ONE)){this.n=this.p.multiply(this.q),this.d=i.modInverse(u),this.dmp1=this.d.mod(s),this.dmq1=this.d.mod(a),this.coeff=this.q.modInverse(this.p);break}}}decrypt(t){var e=rt(t,16),r=this.doPrivate(e);return null==r?null:pt(r,this.n.bitLength()+7>>3)}generateAsync(t,e,r){var n=new lt,i=t>>1;this.e=parseInt(e,16);var o=new tt(e,16),s=this,a=()=>{var e=()=>{if(s.p.compareTo(s.q)<=0){var t=s.p;s.p=s.q,s.q=t}var e=s.p.subtract(tt.ONE),n=s.q.subtract(tt.ONE),i=e.multiply(n);0==i.gcd(o).compareTo(tt.ONE)?(s.n=s.p.multiply(s.q),s.d=o.modInverse(i),s.dmp1=s.d.mod(e),s.dmq1=s.d.mod(n),s.coeff=s.q.modInverse(s.p),setTimeout((function(){r()}),0)):setTimeout(a,0)},u=()=>{s.q=et(),s.q.fromNumberAsync(i,1,n,(function(){s.q.subtract(tt.ONE).gcda(o,(function(t){0==t.compareTo(tt.ONE)&&s.q.isProbablePrime(10)?setTimeout(e,0):setTimeout(u,0)}))}))},c=()=>{s.p=et(),s.p.fromNumberAsync(t-i,1,n,(function(){s.p.subtract(tt.ONE).gcda(o,(function(t){0==t.compareTo(tt.ONE)&&s.p.isProbablePrime(10)?setTimeout(u,0):setTimeout(c,0)}))}))};setTimeout(c,0)};setTimeout(a,0)}}function pt(t,e){for(var r=t.toByteArray(),n=0;n<r.length&&0==r[n];)++n;if(r.length-n!=e-1||2!=r[n])return null;for(++n;0!=r[n];)if(++n>=r.length)return null;for(var i="";++n<r.length;){var o=255&r[n];o<128?i+=String.fromCharCode(o):o>191&&o<224?(i+=String.fromCharCode((31&o)<<6|63&r[n+1]),++n):(i+=String.fromCharCode((15&o)<<12|(63&r[n+1])<<6|63&r[n+2]),n+=2)}return i}class vt extends ft{constructor(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";super(),t&&("string"==typeof t?this.parseKey(t):(this.hasPrivateKeyProperty(t)||this.hasPublicKeyProperty(t))&&this.parsePropertiesFrom(t))}parseKey(t){try{var e=0,r=0,n=/^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/.test(t)?c.decode(t):h.unarmor(t),i=X.decode(n);if(3===i.sub.length&&(i=i.sub[2].sub[0]),9===i.sub.length){e=i.sub[1].getHexStringValue(),this.n=rt(e,16),r=i.sub[2].getHexStringValue(),this.e=parseInt(r,16);var o=i.sub[3].getHexStringValue();this.d=rt(o,16);var s=i.sub[4].getHexStringValue();this.p=rt(s,16);var a=i.sub[5].getHexStringValue();this.q=rt(a,16);var u=i.sub[6].getHexStringValue();this.dmp1=rt(u,16);var l=i.sub[7].getHexStringValue();this.dmq1=rt(l,16);var d=i.sub[8].getHexStringValue();this.coeff=rt(d,16)}else{if(2!==i.sub.length)return!1;var f=i.sub[1].sub[0];e=f.sub[0].getHexStringValue(),this.n=rt(e,16),r=f.sub[1].getHexStringValue(),this.e=parseInt(r,16)}return!0}catch(t){return!1}}hasPublicKeyProperty(t){return(t=t||{}).hasOwnProperty("n")&&t.hasOwnProperty("e")}hasPrivateKeyProperty(t){return(t=t||{}).hasOwnProperty("n")&&t.hasOwnProperty("e")&&t.hasOwnProperty("d")&&t.hasOwnProperty("p")&&t.hasOwnProperty("q")&&t.hasOwnProperty("dmp1")&&t.hasOwnProperty("dmq1")&&t.hasOwnProperty("coeff")}parsePropertiesFrom(t){this.n=t.n,this.e=t.e,t.hasOwnProperty("d")&&(this.d=t.d,this.p=t.p,this.q=t.q,this.dmp1=t.dmp1,this.dmq1=t.dmq1,this.coeff=t.coeff)}}(n=function(t){t=t||{},this.default_key_size=parseInt(t.default_key_size,10)||1024,this.default_public_exponent=t.default_public_exponent||"010001",this.log=t.log||!1,this.key=null}).prototype.setKey=function(t){this.log&&this.key&&console.warn("A key was already set, overriding existing."),this.key=new vt(t)},n.prototype.setPrivateKey=function(t){this.setKey(t)},n.prototype.setPublicKey=function(t){this.setKey(t)},n.prototype.decrypt=function(t){try{return this.getKey().decrypt(z(t))}catch(t){return!1}},n.prototype.encrypt=function(t){try{return Y(this.getKey().encrypt(t))}catch(t){return!1}},n.prototype.encryptLong=function(t){try{for(var e=this.getKey().encryptLong(t)||"",r=this.getKey().decryptLong(e)||"",n=0,i=/null$/g;i.test(r)&&(n++,e=this.getKey().encryptLong(t)||"",r=this.getKey().decryptLong(e)||"",!(n>10)););return e}catch(t){return!1}},n.prototype.getKey=function(t){if(!this.key){if(this.key=new vt,t&&"[object Function]"==={}.toString.call(t))return void this.key.generateAsync(this.default_key_size,this.default_public_exponent,t);this.key.generate(this.default_key_size,this.default_public_exponent)}return this.key},n.version="3.1.4"}const q=n;var B=r(655),j=function(){var{publicKey:t="",payload:e={}}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!t)return"";try{var r=(0,B.I)(e),n=new q;return n.setPublicKey(t),n.encryptLong("object"==typeof r?JSON.stringify(r):r)}catch(t){console.error("encrypt error:",t)}return""}},655:(t,e,r)=>{r.d(e,{I:()=>n,y:()=>i});var n=t=>{var e=e=>{for(var r in t)t.hasOwnProperty(r)&&(e[r]=n(t[r]));return e},r=null==t?"NullOrUndefined":Object.prototype.toString.call(t).slice(8,-1);if(["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"].includes(r))return t.slice();switch(r){case"Object":return e(Object.create(Object.getPrototypeOf(t)));case"Array":return e([]);case"Date":return new Date(t.valueOf());case"RegExp":return new RegExp(t.source,(t.global?"g":"")+(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.sticky?"y":"")+(t.unicode?"u":""));default:return t}},i=t=>{var e=t.match(/^(?:http(s)?:\/\/[^\/]+)?(\/[^\?#]*)/);return e&&e[2]||""}}},e={};function r(n){var i=e[n];if(void 0!==i)return i.exports;var o=e[n]={exports:{}};return t[n].call(o.exports,o,o.exports,r),o.exports}return r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r(118)})()));