parse
Version:
Parse JavaScript SDK
1 lines • 913 kB
JavaScript
!function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";function _mergeNamespaces(e,t){for(var r=0;r<t.length;r++){const i=t[r];if("string"!=typeof i&&!Array.isArray(i))for(const t in i)if("default"!==t&&!(t in e)){const r=Object.getOwnPropertyDescriptor(i,t);r&&Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>i[t]})}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}function getDefaultExportFromCjs$1(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var browser$d={exports:{}},process=browser$d.exports={},cachedSetTimeout,cachedClearTimeout;function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}function runTimeout(e){if(cachedSetTimeout===setTimeout)return setTimeout(e,0);if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout)return cachedSetTimeout=setTimeout,setTimeout(e,0);try{return cachedSetTimeout(e,0)}catch(t){try{return cachedSetTimeout.call(null,e,0)}catch(t){return cachedSetTimeout.call(this,e,0)}}}function runClearTimeout(e){if(cachedClearTimeout===clearTimeout)return clearTimeout(e);if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout)return cachedClearTimeout=clearTimeout,clearTimeout(e);try{return cachedClearTimeout(e)}catch(t){try{return cachedClearTimeout.call(null,e)}catch(t){return cachedClearTimeout.call(this,e)}}}!function(){try{cachedSetTimeout="function"==typeof setTimeout?setTimeout:defaultSetTimout}catch(e){cachedSetTimeout=defaultSetTimout}try{cachedClearTimeout="function"==typeof clearTimeout?clearTimeout:defaultClearTimeout}catch(e){cachedClearTimeout=defaultClearTimeout}}();var queue=[],draining=!1,currentQueue,queueIndex=-1;function cleanUpNextTick(){draining&¤tQueue&&(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue())}function drainQueue(){if(!draining){var e=runTimeout(cleanUpNextTick);draining=!0;for(var t=queue.length;t;){for(currentQueue=queue,queue=[];++queueIndex<t;)currentQueue&¤tQueue[queueIndex].run();queueIndex=-1,t=queue.length}currentQueue=null,draining=!1,runClearTimeout(e)}}function Item(e,t){this.fun=e,this.array=t}function noop(){}process.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];queue.push(new Item(e,t)),1!==queue.length||draining||runTimeout(drainQueue)},Item.prototype.run=function(){this.fun.apply(null,this.array)},process.title="browser",process.browser=!0,process.env={},process.argv=[],process.version="",process.versions={},process.on=noop,process.addListener=noop,process.once=noop,process.off=noop,process.removeListener=noop,process.removeAllListeners=noop,process.emit=noop,process.prependListener=noop,process.prependOnceListener=noop,process.listeners=function(e){return[]},process.binding=function(e){throw new Error("process.binding is not supported")},process.cwd=function(){return"/"},process.chdir=function(e){throw new Error("process.chdir is not supported")},process.umask=function(){return 0};var browserExports$1=browser$d.exports;const process$1=getDefaultExportFromCjs$1(browserExports$1),config={IS_NODE:void 0!==process$1&&!!process$1.versions&&!!process$1.versions.node&&!process$1.versions.electron,REQUEST_ATTEMPT_LIMIT:5,REQUEST_BATCH_SIZE:20,REQUEST_HEADERS:{},SERVER_URL:"https://api.parse.com/1",LIVEQUERY_SERVER_URL:null,ENCRYPTED_KEY:null,VERSION:"js8.0.0",APPLICATION_ID:null,JAVASCRIPT_KEY:null,MAINTENANCE_KEY:null,MASTER_KEY:null,USE_MASTER_KEY:!1,PERFORM_USER_REWRITE:!0,FORCE_REVOCABLE_SESSION:!1,ENCRYPTED_USER:!1,IDEMPOTENCY:!1,ALLOW_CUSTOM_OBJECT_ID:!1,PARSE_ERRORS:[],NODE_LOGGING:!1};function requireMethods(e,t,r){t.forEach((t=>{if("function"!=typeof r[t])throw new Error(`${e} must implement ${t}()`)}))}const CoreManager={get:function(e){if(Object.hasOwn(config,e))return config[e];throw new Error("Configuration key not found: "+e)},set:function(e,t){config[e]=t},setIfNeeded:function(e,t){return Object.hasOwn(config,e)||(config[e]=t),config[e]},setAnalyticsController(e){requireMethods("AnalyticsController",["track"],e),config.AnalyticsController=e},getAnalyticsController:()=>config.AnalyticsController,setCloudController(e){requireMethods("CloudController",["run","getJobsData","startJob"],e),config.CloudController=e},getCloudController:()=>config.CloudController,setConfigController(e){requireMethods("ConfigController",["current","get","save"],e),config.ConfigController=e},getConfigController:()=>config.ConfigController,setCryptoController(e){requireMethods("CryptoController",["encrypt","decrypt"],e),config.CryptoController=e},getCryptoController:()=>config.CryptoController,setEventEmitter(e){config.EventEmitter=e},getEventEmitter:()=>config.EventEmitter,setFileController(e){requireMethods("FileController",["saveFile","saveBase64"],e),config.FileController=e},setEventuallyQueue(e){requireMethods("EventuallyQueue",["poll","save","destroy"],e),config.EventuallyQueue=e},getEventuallyQueue:()=>config.EventuallyQueue,getFileController:()=>config.FileController,setInstallationController(e){requireMethods("InstallationController",["currentInstallationId","currentInstallation","updateInstallationOnDisk"],e),config.InstallationController=e},getInstallationController:()=>config.InstallationController,setLiveQuery(e){config.LiveQuery=e},getLiveQuery:()=>config.LiveQuery,setObjectController(e){requireMethods("ObjectController",["save","fetch","destroy"],e),config.ObjectController=e},getObjectController:()=>config.ObjectController,setObjectStateController(e){requireMethods("ObjectStateController",["getState","initializeState","removeState","getServerData","setServerData","getPendingOps","setPendingOp","pushPendingState","popPendingState","mergeFirstPendingState","getObjectCache","estimateAttribute","estimateAttributes","commitServerChanges","enqueueTask","clearAllState"],e),config.ObjectStateController=e},getObjectStateController:()=>config.ObjectStateController,setPushController(e){requireMethods("PushController",["send"],e),config.PushController=e},getPushController:()=>config.PushController,setQueryController(e){requireMethods("QueryController",["find","aggregate"],e),config.QueryController=e},getQueryController:()=>config.QueryController,setRESTController(e){requireMethods("RESTController",["request","ajax"],e),config.RESTController=e},getRESTController:()=>config.RESTController,setSchemaController(e){requireMethods("SchemaController",["get","create","update","delete","send","purge"],e),config.SchemaController=e},getSchemaController:()=>config.SchemaController,setSessionController(e){requireMethods("SessionController",["getSession"],e),config.SessionController=e},getSessionController:()=>config.SessionController,setStorageController(e){e.async?requireMethods("An async StorageController",["getItemAsync","setItemAsync","removeItemAsync","getAllKeysAsync"],e):requireMethods("A synchronous StorageController",["getItem","setItem","removeItem","getAllKeys"],e),config.StorageController=e},setLocalDatastoreController(e){requireMethods("LocalDatastoreController",["pinWithName","fromPinWithName","unPinWithName","getAllContents","clear"],e),config.LocalDatastoreController=e},getLocalDatastoreController:()=>config.LocalDatastoreController,setLocalDatastore(e){config.LocalDatastore=e},getLocalDatastore:()=>config.LocalDatastore,getStorageController:()=>config.StorageController,setAsyncStorage(e){config.AsyncStorage=e},getAsyncStorage:()=>config.AsyncStorage,setWebSocketController(e){config.WebSocketController=e},getWebSocketController:()=>config.WebSocketController,setUserController(e){requireMethods("UserController",["setCurrentUser","currentUser","currentUserAsync","signUp","logIn","become","logOut","me","requestPasswordReset","upgradeToRevocableSession","requestEmailVerification","verifyPassword","linkWith"],e),config.UserController=e},getUserController:()=>config.UserController,setLiveQueryController(e){requireMethods("LiveQueryController",["setDefaultLiveQueryClient","getDefaultLiveQueryClient","_clearCachedDefaultClient"],e),config.LiveQueryController=e},getLiveQueryController:()=>config.LiveQueryController,setHooksController(e){requireMethods("HooksController",["create","get","update","remove"],e),config.HooksController=e},getHooksController:()=>config.HooksController,setParseOp(e){config.ParseOp=e},getParseOp:()=>config.ParseOp,setParseObject(e){config.ParseObject=e},getParseObject:()=>config.ParseObject,setParseQuery(e){config.ParseQuery=e},getParseQuery:()=>config.ParseQuery,setParseRole(e){config.ParseRole=e},getParseRole:()=>config.ParseRole,setParseUser(e){config.ParseUser=e},getParseUser:()=>config.ParseUser},_ParseError=class extends Error{constructor(e,t){super(t),this.code=e;let r=t;CoreManager.get("PARSE_ERRORS").forEach((t=>{t.code===e&&t.code&&(r=t.message)})),Object.defineProperty(this,"message",{enumerable:!0,value:r})}toString(){return"ParseError: "+this.code+" "+this.message}};_ParseError.OTHER_CAUSE=-1,_ParseError.INTERNAL_SERVER_ERROR=1,_ParseError.CONNECTION_FAILED=100,_ParseError.OBJECT_NOT_FOUND=101,_ParseError.INVALID_QUERY=102,_ParseError.INVALID_CLASS_NAME=103,_ParseError.MISSING_OBJECT_ID=104,_ParseError.INVALID_KEY_NAME=105,_ParseError.INVALID_POINTER=106,_ParseError.INVALID_JSON=107,_ParseError.COMMAND_UNAVAILABLE=108,_ParseError.NOT_INITIALIZED=109,_ParseError.INCORRECT_TYPE=111,_ParseError.INVALID_CHANNEL_NAME=112,_ParseError.PUSH_MISCONFIGURED=115,_ParseError.OBJECT_TOO_LARGE=116,_ParseError.OPERATION_FORBIDDEN=119,_ParseError.CACHE_MISS=120,_ParseError.INVALID_NESTED_KEY=121,_ParseError.INVALID_FILE_NAME=122,_ParseError.INVALID_ACL=123,_ParseError.TIMEOUT=124,_ParseError.INVALID_EMAIL_ADDRESS=125,_ParseError.MISSING_CONTENT_TYPE=126,_ParseError.MISSING_CONTENT_LENGTH=127,_ParseError.INVALID_CONTENT_LENGTH=128,_ParseError.FILE_TOO_LARGE=129,_ParseError.FILE_SAVE_ERROR=130,_ParseError.DUPLICATE_VALUE=137,_ParseError.INVALID_ROLE_NAME=139,_ParseError.EXCEEDED_QUOTA=140,_ParseError.SCRIPT_FAILED=141,_ParseError.VALIDATION_ERROR=142,_ParseError.INVALID_IMAGE_DATA=143,_ParseError.UNSAVED_FILE_ERROR=151,_ParseError.INVALID_PUSH_TIME_ERROR=152,_ParseError.FILE_DELETE_ERROR=153,_ParseError.FILE_DELETE_UNNAMED_ERROR=161,_ParseError.REQUEST_LIMIT_EXCEEDED=155,_ParseError.DUPLICATE_REQUEST=159,_ParseError.INVALID_EVENT_NAME=160,_ParseError.INVALID_VALUE=162,_ParseError.USERNAME_MISSING=200,_ParseError.PASSWORD_MISSING=201,_ParseError.USERNAME_TAKEN=202,_ParseError.EMAIL_TAKEN=203,_ParseError.EMAIL_MISSING=204,_ParseError.EMAIL_NOT_FOUND=205,_ParseError.SESSION_MISSING=206,_ParseError.MUST_CREATE_USER_THROUGH_SIGNUP=207,_ParseError.ACCOUNT_ALREADY_LINKED=208,_ParseError.INVALID_SESSION_TOKEN=209,_ParseError.MFA_ERROR=210,_ParseError.MFA_TOKEN_REQUIRED=211,_ParseError.LINKED_ID_MISSING=250,_ParseError.INVALID_LINKED_SESSION=251,_ParseError.UNSUPPORTED_SERVICE=252,_ParseError.INVALID_SCHEMA_OPERATION=255,_ParseError.AGGREGATE_ERROR=600,_ParseError.FILE_READ_ERROR=601,_ParseError.X_DOMAIN_REQUEST=602;let ParseError=_ParseError;function b64Digit(e){if(e<26)return String.fromCharCode(65+e);if(e<52)return String.fromCharCode(e-26+97);if(e<62)return String.fromCharCode(e-52+48);if(62===e)return"+";if(63===e)return"/";throw new TypeError("Tried to encode large digit "+e+" in base64.")}class ParseFile{constructor(e,t,r,i,n){const o=r||"";if(this._name=e,this._metadata=i||{},this._tags=n||{},void 0!==t)if(Array.isArray(t)||t instanceof Uint8Array)this._data=ParseFile.encodeBase64(t),this._source={format:"base64",base64:this._data,type:o};else if("undefined"!=typeof Blob&&t instanceof Blob)this._source={format:"file",file:t,type:o};else if(t&&"string"==typeof t.uri&&void 0!==t.uri)this._source={format:"uri",uri:t.uri,type:o};else{if(!t||"string"!=typeof t.base64)throw new TypeError("Cannot create a Parse.File with that data.");{const e=t.base64.split(",").slice(-1)[0],r=o||t.base64.split(";").slice(0,1)[0].split(":").slice(1,2)[0]||"text/plain";this._data=e,this._source={format:"base64",base64:e,type:r}}}}async getData(e){if(e=e||{},this._data)return this._data;if(!this._url)throw new Error("Cannot retrieve data for unsaved ParseFile.");e.requestTask=e=>this._requestTask=e;const t=CoreManager.getFileController(),r=await t.download(this._url,e);return this._data=r.base64,this._data}name(){return this._name}url(e){if(e=e||{},this._url)return e.forceSecure?this._url.replace(/^http:\/\//i,"https://"):this._url}metadata(){return this._metadata}tags(){return this._tags}save(e){(e=e||{}).requestTask=e=>this._requestTask=e,e.metadata=this._metadata,e.tags=this._tags;const t=CoreManager.getFileController();if(this._previousSave||("file"===this._source.format?this._previousSave=t.saveFile(this._name,this._source,e).then((e=>(this._name=e.name,this._url=e.url,this._data=null,this._requestTask=null,this))):"uri"===this._source.format?this._previousSave=t.download(this._source.uri,e).then((r=>{if(!r||!r.base64)return{};const i={format:"base64",base64:r.base64,type:r.contentType};return this._data=r.base64,this._requestTask=null,t.saveBase64(this._name,i,e)})).then((e=>(this._name=e.name,this._url=e.url,this._requestTask=null,this))):this._previousSave=t.saveBase64(this._name,this._source,e).then((e=>(this._name=e.name,this._url=e.url,this._requestTask=null,this)))),this._previousSave)return this._previousSave}cancel(){this._requestTask&&"function"==typeof this._requestTask.abort&&(this._requestTask._aborted=!0,this._requestTask.abort()),this._requestTask=null}destroy(e={}){if(!this._name)throw new ParseError(ParseError.FILE_DELETE_UNNAMED_ERROR,"Cannot delete an unnamed file.");const t={useMasterKey:!0};Object.hasOwn(e,"useMasterKey")&&(t.useMasterKey=!!e.useMasterKey);return CoreManager.getFileController().deleteFile(this._name,t).then((()=>(this._data=void 0,this._requestTask=null,this)))}toJSON(){return{__type:"File",name:this._name,url:this._url}}equals(e){return this===e||e instanceof ParseFile&&this.name()===e.name()&&this.url()===e.url()&&void 0!==this.url()}setMetadata(e){e&&"object"==typeof e&&Object.keys(e).forEach((t=>{this.addMetadata(t,e[t])}))}addMetadata(e,t){"string"==typeof e&&(this._metadata[e]=t)}setTags(e){e&&"object"==typeof e&&Object.keys(e).forEach((t=>{this.addTag(t,e[t])}))}addTag(e,t){"string"==typeof e&&(this._tags[e]=t)}static fromJSON(e){if("File"!==e.__type)throw new TypeError("JSON object does not represent a ParseFile");const t=new ParseFile(e.name);return t._url=e.url,t}static encodeBase64(e){const t=[];t.length=Math.ceil(e.length/3);for(let r=0;r<t.length;r++){const i=e[3*r],n=e[3*r+1]||0,o=e[3*r+2]||0,s=3*r+1<e.length,a=3*r+2<e.length;t[r]=[b64Digit(i>>2&63),b64Digit(i<<4&48|n>>4&15),s?b64Digit(n<<2&60|o>>6&3):"=",a?b64Digit(63&o):"="].join("")}return t.join("")}}const DefaultController$a={saveFile:async function(e,t,r){if("file"!==t.format)throw new Error("saveFile can only be used with File-type sources.");const i=await new Promise(((e,r)=>{const i=new FileReader;i.onload=()=>e(i.result),i.onerror=e=>r(e),i.readAsDataURL(t.file)})),[n,o]=i.split(","),s={format:"base64",base64:o||n,type:t.type||(t.file?t.file.type:void 0)};return await DefaultController$a.saveBase64(e,s,r)},saveBase64:function(e,t,r={}){if("base64"!==t.format)throw new Error("saveBase64 can only be used with Base64-type sources.");const i={base64:t.base64,fileData:{metadata:{...r.metadata},tags:{...r.tags}}};delete r.metadata,delete r.tags,t.type&&(i._ContentType=t.type);const n="files/"+e;return CoreManager.getRESTController().request("POST",n,i,r)},download:async function(e,t){const r=new AbortController;t.requestTask(r);const{signal:i}=r;try{const r=await fetch(e,{signal:i}),n=r.body.getReader(),o=+r.headers.get("Content-Length")||0,s=r.headers.get("Content-Type");if(0===o)return t.progress?.(null,null,null),{base64:"",contentType:s};let a=0;const u=[];for(;;){const{done:e,value:r}=await n.read();if(e)break;u.push(r),a+=r?.length||0,t.progress?.(a/o,a,o)}const h=new Uint8Array(a);let f=0;for(const e of u)h.set(e,f),f+=e.length;return{base64:ParseFile.encodeBase64(h),contentType:s}}catch(e){if("AbortError"===e.name)return{};throw e}},deleteFile:function(e,t){const r={"X-Parse-Application-ID":CoreManager.get("APPLICATION_ID")};t.useMasterKey&&(r["X-Parse-Master-Key"]=CoreManager.get("MASTER_KEY"));let i=CoreManager.get("SERVER_URL");return"/"!==i[i.length-1]&&(i+="/"),i+="files/"+e,CoreManager.getRESTController().ajax("DELETE",i,"",r).catch((e=>e&&"SyntaxError: Unexpected end of JSON input"!==e.toString()?CoreManager.getRESTController().handleError(e):Promise.resolve()))}};CoreManager.setFileController(DefaultController$a);class ParseGeoPoint{constructor(e,t){Array.isArray(e)?(ParseGeoPoint._validate(e[0],e[1]),this._latitude=e[0],this._longitude=e[1]):"object"==typeof e?(ParseGeoPoint._validate(e.latitude,e.longitude),this._latitude=e.latitude,this._longitude=e.longitude):void 0!==e&&void 0!==t?(ParseGeoPoint._validate(e,t),this._latitude=e,this._longitude=t):(this._latitude=0,this._longitude=0)}get latitude(){return this._latitude}set latitude(e){ParseGeoPoint._validate(e,this.longitude),this._latitude=e}get longitude(){return this._longitude}set longitude(e){ParseGeoPoint._validate(this.latitude,e),this._longitude=e}toJSON(){return ParseGeoPoint._validate(this._latitude,this._longitude),{__type:"GeoPoint",latitude:this._latitude,longitude:this._longitude}}equals(e){return e instanceof ParseGeoPoint&&this.latitude===e.latitude&&this.longitude===e.longitude}radiansTo(e){const t=Math.PI/180,r=this.latitude*t,i=this.longitude*t,n=e.latitude*t,o=r-n,s=i-e.longitude*t,a=Math.sin(o/2),u=Math.sin(s/2);let h=a*a+Math.cos(r)*Math.cos(n)*u*u;return h=Math.min(1,h),2*Math.asin(Math.sqrt(h))}kilometersTo(e){return 6371*this.radiansTo(e)}milesTo(e){return 3958.8*this.radiansTo(e)}static _validate(e,t){if(isNaN(e)||isNaN(t)||"number"!=typeof e||"number"!=typeof t)throw new TypeError("GeoPoint latitude and longitude must be valid numbers");if(e<-90)throw new TypeError("GeoPoint latitude out of bounds: "+e+" < -90.0.");if(e>90)throw new TypeError("GeoPoint latitude out of bounds: "+e+" > 90.0.");if(t<-180)throw new TypeError("GeoPoint longitude out of bounds: "+t+" < -180.0.");if(t>180)throw new TypeError("GeoPoint longitude out of bounds: "+t+" > 180.0.")}static current(e){return new Promise(((t,r)=>{navigator.geolocation.getCurrentPosition((e=>{t(new ParseGeoPoint(e.coords.latitude,e.coords.longitude))}),r,e)}))}}class ParsePolygon{constructor(e){this._coordinates=ParsePolygon._validate(e)}get coordinates(){return this._coordinates}set coordinates(e){this._coordinates=ParsePolygon._validate(e)}toJSON(){return ParsePolygon._validate(this._coordinates),{__type:"Polygon",coordinates:this._coordinates}}equals(e){if(!(e instanceof ParsePolygon)||this.coordinates.length!==e.coordinates.length)return!1;let t=!0;for(let r=1;r<this._coordinates.length;r+=1)if(this._coordinates[r][0]!=e.coordinates[r][0]||this._coordinates[r][1]!=e.coordinates[r][1]){t=!1;break}return t}containsPoint(e){let t=this._coordinates[0][0],r=this._coordinates[0][0],i=this._coordinates[0][1],n=this._coordinates[0][1];for(let e=1;e<this._coordinates.length;e+=1){const o=this._coordinates[e];t=Math.min(o[0],t),r=Math.max(o[0],r),i=Math.min(o[1],i),n=Math.max(o[1],n)}if(e.latitude<t||e.latitude>r||e.longitude<i||e.longitude>n)return!1;let o=!1;for(let t=0,r=this._coordinates.length-1;t<this._coordinates.length;r=t++){const i=this._coordinates[t][0],n=this._coordinates[t][1],s=this._coordinates[r][0],a=this._coordinates[r][1];n>e.longitude!=a>e.longitude&&e.latitude<(s-i)*(e.longitude-n)/(a-n)+i&&(o=!o)}return o}static _validate(e){if(!Array.isArray(e))throw new TypeError("Coordinates must be an Array");if(e.length<3)throw new TypeError("Polygon must have at least 3 GeoPoints or Points");const t=[];for(let r=0;r<e.length;r+=1){const i=e[r];let n;if(i instanceof ParseGeoPoint)n=i;else{if(!Array.isArray(i)||2!==i.length)throw new TypeError("Coordinates must be an Array of GeoPoints or Points");n=new ParseGeoPoint(i[0],i[1])}t.push([n.latitude,n.longitude])}return t}}class ParseRelation{constructor(e,t){this.parent=e,this.key=t,this.targetClassName=null}_ensureParentAndKey(e,t){if(this.key=this.key||t,this.key!==t)throw new Error("Internal Error. Relation retrieved from two different keys.");if(this.parent){if(this.parent.className!==e.className)throw new Error("Internal Error. Relation retrieved from two different Objects.");if(this.parent.id){if(this.parent.id!==e.id)throw new Error("Internal Error. Relation retrieved from two different Objects.")}else e.id&&(this.parent=e)}else this.parent=e}add(e){Array.isArray(e)||(e=[e]);const{RelationOp:t}=CoreManager.getParseOp(),r=new t(e,[]),i=this.parent;if(!i)throw new Error("Cannot add to a Relation without a parent");return 0===e.length||(i.set(this.key,r),this.targetClassName=r._targetClassName),i}remove(e){Array.isArray(e)||(e=[e]);const{RelationOp:t}=CoreManager.getParseOp(),r=new t([],e);if(!this.parent)throw new Error("Cannot remove from a Relation without a parent");0!==e.length&&(this.parent.set(this.key,r),this.targetClassName=r._targetClassName)}toJSON(){return{__type:"Relation",className:this.targetClassName}}query(){let e;const t=this.parent;if(!t)throw new Error("Cannot construct a query for a Relation without a parent");const r=CoreManager.getParseQuery();return this.targetClassName?e=new r(this.targetClassName):(e=new r(t.className),e._extraOptions.redirectClassNameForKey=this.key),e._addCondition("$relatedTo","object",{__type:"Pointer",className:t.className,objectId:t.id}),e._addCondition("$relatedTo","key",this.key),e}}function isDangerousKey(e){const t=["__proto__","constructor","prototype"];if(t.includes(e))return!0;if(e.includes(".")){return e.split(".").some((e=>t.includes(e)))}return!1}function decode(e){if(null===e||"object"!=typeof e||e instanceof Date)return e;if(Array.isArray(e)){const t=[];return e.forEach(((e,r)=>{t[r]=decode(e)})),t}if("string"==typeof e.__op){const{opFromJSON:t}=CoreManager.getParseOp();return t(e)}const t=CoreManager.getParseObject();if("Pointer"===e.__type&&e.className)return t.fromJSON(e);if("Object"===e.__type&&e.className)return t.fromJSON(e);if("Relation"===e.__type){const t=new ParseRelation(null,null);return t.targetClassName=e.className,t}if("Date"===e.__type)return new Date(e.iso);if("File"===e.__type)return ParseFile.fromJSON(e);if("GeoPoint"===e.__type)return new ParseGeoPoint({latitude:e.latitude,longitude:e.longitude});if("Polygon"===e.__type)return new ParsePolygon(e.coordinates);const r={};for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){if(isDangerousKey(t))continue;r[t]=decode(e[t])}return r}const PUBLIC_KEY$1="*";class ParseACL{constructor(e){if(this.permissionsById={},e&&"object"==typeof e){if(e instanceof CoreManager.getParseUser())this.setReadAccess(e,!0),this.setWriteAccess(e,!0);else for(const t in e){const r=e[t];this.permissionsById[t]={};for(const e in r){const i=r[e];if("read"!==e&&"write"!==e)throw new TypeError("Tried to create an ACL with an invalid permission type.");if("boolean"!=typeof i)throw new TypeError("Tried to create an ACL with an invalid permission value.");this.permissionsById[t][e]=i}}}else if("function"==typeof e)throw new TypeError("ParseACL constructed with a function. Did you forget ()?")}toJSON(){const e={};for(const t in this.permissionsById)e[t]=this.permissionsById[t];return e}equals(e){if(!(e instanceof ParseACL))return!1;const t=Object.keys(this.permissionsById),r=Object.keys(e.permissionsById);if(t.length!==r.length)return!1;for(const t in this.permissionsById){if(!e.permissionsById[t])return!1;if(this.permissionsById[t].read!==e.permissionsById[t].read)return!1;if(this.permissionsById[t].write!==e.permissionsById[t].write)return!1}return!0}_setAccess(e,t,r){const i=CoreManager.getParseRole();if(t instanceof CoreManager.getParseUser())t=t.id;else if(t instanceof i){const e=t.getName();if(!e)throw new TypeError("Role must have a name");t="role:"+e}if("string"!=typeof t)throw new TypeError("userId must be a string.");if("boolean"!=typeof r)throw new TypeError("allowed must be either true or false.");let n=this.permissionsById[t];if(!n){if(!r)return;n={},this.permissionsById[t]=n}r?this.permissionsById[t][e]=!0:(delete n[e],0===Object.keys(n).length&&delete this.permissionsById[t])}_getAccess(e,t){const r=CoreManager.getParseRole();if(t instanceof CoreManager.getParseUser()){if(!(t=t.id))throw new Error("Cannot get access for a ParseUser without an ID")}else if(t instanceof r){const e=t.getName();if(!e)throw new TypeError("Role must have a name");t="role:"+e}const i=this.permissionsById[t];return!!i&&!!i[e]}setReadAccess(e,t){this._setAccess("read",e,t)}getReadAccess(e){return this._getAccess("read",e)}setWriteAccess(e,t){this._setAccess("write",e,t)}getWriteAccess(e){return this._getAccess("write",e)}setPublicReadAccess(e){this.setReadAccess(PUBLIC_KEY$1,e)}getPublicReadAccess(){return this.getReadAccess(PUBLIC_KEY$1)}setPublicWriteAccess(e){this.setWriteAccess(PUBLIC_KEY$1,e)}getPublicWriteAccess(){return this.getWriteAccess(PUBLIC_KEY$1)}getRoleReadAccess(e){if(e instanceof CoreManager.getParseRole()&&(e=e.getName()),"string"!=typeof e)throw new TypeError("role must be a ParseRole or a String");return this.getReadAccess("role:"+e)}getRoleWriteAccess(e){if(e instanceof CoreManager.getParseRole()&&(e=e.getName()),"string"!=typeof e)throw new TypeError("role must be a ParseRole or a String");return this.getWriteAccess("role:"+e)}setRoleReadAccess(e,t){if(e instanceof CoreManager.getParseRole()&&(e=e.getName()),"string"!=typeof e)throw new TypeError("role must be a ParseRole or a String");this.setReadAccess("role:"+e,t)}setRoleWriteAccess(e,t){if(e instanceof CoreManager.getParseRole()&&(e=e.getName()),"string"!=typeof e)throw new TypeError("role must be a ParseRole or a String");this.setWriteAccess("role:"+e,t)}}function encode$1(e,t,r,i,n){if(e instanceof CoreManager.getParseObject()){if(t)throw new Error("Parse Objects not allowed here");const o=e.id?e.className+":"+e.id:e;return r||!i||i.indexOf(o)>-1||e.dirty()||Object.keys(e._getServerData()).length<1?n&&e._getId().startsWith("local")?e.toOfflinePointer():e.toPointer():(i=i.concat(o),e._toFullJSON(i,n))}const{Op:o}=CoreManager.getParseOp();if(e instanceof o||e instanceof ParseACL||e instanceof ParseGeoPoint||e instanceof ParsePolygon||e instanceof ParseRelation)return e.toJSON();if(e instanceof ParseFile){if(!e.url())throw new Error("Tried to encode an unsaved file.");return e.toJSON()}if("[object Date]"===Object.prototype.toString.call(e)){if(isNaN(e))throw new Error("Tried to encode an invalid date.");return{__type:"Date",iso:e.toJSON()}}if("[object RegExp]"===Object.prototype.toString.call(e)&&"string"==typeof e.source)return e.source;if(Array.isArray(e))return e.map((e=>encode$1(e,t,r,i,n)));if(e&&"object"==typeof e){const o={};for(const s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(isDangerousKey(s))continue;o[s]=encode$1(e[s],t,r,i,n)}return o}return e}function encode(e,t,r,i,n){return encode$1(e,!!t,!!r,i||[],n)}var commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},CryptoJS_1,hasRequiredCryptoJS;function getDefaultExportFromCjs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function requireCryptoJS(){if(hasRequiredCryptoJS)return CryptoJS_1;hasRequiredCryptoJS=1;let e=function(e){var t={},r=t.lib={},i=function(){},n=r.Base={extend:function(e){i.prototype=this;var t=new i;return e&&t.mixIn(e),t.hasOwnProperty("init")||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},o=r.WordArray=n.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||a).stringify(this)},concat:function(e){var t=this.words,r=e.words,i=this.sigBytes;if(e=e.sigBytes,this.clamp(),i%4)for(var n=0;n<e;n++)t[i+n>>>2]|=(r[n>>>2]>>>24-n%4*8&255)<<24-(i+n)%4*8;else if(65535<r.length)for(n=0;n<e;n+=4)t[i+n>>>2]=r[n>>>2];else t.push.apply(t,r);return this.sigBytes+=e,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=n.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var r=[],i=0;i<t;i+=4)r.push(4294967296*e.random()|0);return new o.init(r,t)}}),s=t.enc={},a=s.Hex={stringify:function(e){var t=e.words;e=e.sigBytes;for(var r=[],i=0;i<e;i++){var n=t[i>>>2]>>>24-i%4*8&255;r.push((n>>>4).toString(16)),r.push((15&n).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i<t;i+=2)r[i>>>3]|=parseInt(e.substr(i,2),16)<<24-i%8*4;return new o.init(r,t/2)}},u=s.Latin1={stringify:function(e){var t=e.words;e=e.sigBytes;for(var r=[],i=0;i<e;i++)r.push(String.fromCharCode(t[i>>>2]>>>24-i%4*8&255));return r.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i<t;i++)r[i>>>2]|=(255&e.charCodeAt(i))<<24-i%4*8;return new o.init(r,t)}},h=s.Utf8={stringify:function(e){try{return decodeURIComponent(escape(u.stringify(e)))}catch(e){throw Error("Malformed UTF-8 data")}},parse:function(e){return u.parse(unescape(encodeURIComponent(e)))}},f=r.BufferedBlockAlgorithm=n.extend({reset:function(){this._data=new o.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=h.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r=this._data,i=r.words,n=r.sigBytes,s=this.blockSize,a=n/(4*s);if(t=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*s,n=e.min(4*t,n),t){for(var u=0;u<t;u+=s)this._doProcessBlock(i,u);u=i.splice(0,t),r.sigBytes-=n}return new o.init(u,n)},clone:function(){var e=n.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});r.Hasher=f.extend({cfg:n.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){f.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,r){return new e.init(r).finalize(t)}},_createHmacHelper:function(e){return function(t,r){return new l.HMAC.init(e,r).finalize(t)}}});var l=t.algo={};return t}(Math);var t,r;return r=(t=e).lib.WordArray,t.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,i=this._map;e.clamp(),e=[];for(var n=0;n<r;n+=3)for(var o=(t[n>>>2]>>>24-n%4*8&255)<<16|(t[n+1>>>2]>>>24-(n+1)%4*8&255)<<8|t[n+2>>>2]>>>24-(n+2)%4*8&255,s=0;4>s&&n+.75*s<r;s++)e.push(i.charAt(o>>>6*(3-s)&63));if(t=i.charAt(64))for(;e.length%4;)e.push(t);return e.join("")},parse:function(e){var t=e.length,i=this._map;(n=i.charAt(64))&&-1!=(n=e.indexOf(n))&&(t=n);for(var n=[],o=0,s=0;s<t;s++)if(s%4){var a=i.indexOf(e.charAt(s-1))<<s%4*2,u=i.indexOf(e.charAt(s))>>>6-s%4*2;n[o>>>2]|=(a|u)<<24-o%4*8,o++}return r.create(n,o)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},function(t){function r(e,t,r,i,n,o,s){return((e=e+(t&r|~t&i)+n+s)<<o|e>>>32-o)+t}function i(e,t,r,i,n,o,s){return((e=e+(t&i|r&~i)+n+s)<<o|e>>>32-o)+t}function n(e,t,r,i,n,o,s){return((e=e+(t^r^i)+n+s)<<o|e>>>32-o)+t}function o(e,t,r,i,n,o,s){return((e=e+(r^(t|~i))+n+s)<<o|e>>>32-o)+t}for(var s=e,a=(h=s.lib).WordArray,u=h.Hasher,h=s.algo,f=[],l=0;64>l;l++)f[l]=4294967296*t.abs(t.sin(l+1))|0;h=h.MD5=u.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var s=0;16>s;s++){var a=e[u=t+s];e[u]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8)}s=this._hash.words;var u=e[t+0],h=(a=e[t+1],e[t+2]),l=e[t+3],c=e[t+4],d=e[t+5],p=e[t+6],m=e[t+7],g=e[t+8],y=e[t+9],b=e[t+10],v=e[t+11],w=e[t+12],_=e[t+13],M=e[t+14],S=e[t+15],E=r(E=s[0],q=s[1],A=s[2],R=s[3],u,7,f[0]),R=r(R,E,q,A,a,12,f[1]),A=r(A,R,E,q,h,17,f[2]),q=r(q,A,R,E,l,22,f[3]);E=r(E,q,A,R,c,7,f[4]),R=r(R,E,q,A,d,12,f[5]),A=r(A,R,E,q,p,17,f[6]),q=r(q,A,R,E,m,22,f[7]),E=r(E,q,A,R,g,7,f[8]),R=r(R,E,q,A,y,12,f[9]),A=r(A,R,E,q,b,17,f[10]),q=r(q,A,R,E,v,22,f[11]),E=r(E,q,A,R,w,7,f[12]),R=r(R,E,q,A,_,12,f[13]),A=r(A,R,E,q,M,17,f[14]),E=i(E,q=r(q,A,R,E,S,22,f[15]),A,R,a,5,f[16]),R=i(R,E,q,A,p,9,f[17]),A=i(A,R,E,q,v,14,f[18]),q=i(q,A,R,E,u,20,f[19]),E=i(E,q,A,R,d,5,f[20]),R=i(R,E,q,A,b,9,f[21]),A=i(A,R,E,q,S,14,f[22]),q=i(q,A,R,E,c,20,f[23]),E=i(E,q,A,R,y,5,f[24]),R=i(R,E,q,A,M,9,f[25]),A=i(A,R,E,q,l,14,f[26]),q=i(q,A,R,E,g,20,f[27]),E=i(E,q,A,R,_,5,f[28]),R=i(R,E,q,A,h,9,f[29]),A=i(A,R,E,q,m,14,f[30]),E=n(E,q=i(q,A,R,E,w,20,f[31]),A,R,d,4,f[32]),R=n(R,E,q,A,g,11,f[33]),A=n(A,R,E,q,v,16,f[34]),q=n(q,A,R,E,M,23,f[35]),E=n(E,q,A,R,a,4,f[36]),R=n(R,E,q,A,c,11,f[37]),A=n(A,R,E,q,m,16,f[38]),q=n(q,A,R,E,b,23,f[39]),E=n(E,q,A,R,_,4,f[40]),R=n(R,E,q,A,u,11,f[41]),A=n(A,R,E,q,l,16,f[42]),q=n(q,A,R,E,p,23,f[43]),E=n(E,q,A,R,y,4,f[44]),R=n(R,E,q,A,w,11,f[45]),A=n(A,R,E,q,S,16,f[46]),E=o(E,q=n(q,A,R,E,h,23,f[47]),A,R,u,6,f[48]),R=o(R,E,q,A,m,10,f[49]),A=o(A,R,E,q,M,15,f[50]),q=o(q,A,R,E,d,21,f[51]),E=o(E,q,A,R,w,6,f[52]),R=o(R,E,q,A,l,10,f[53]),A=o(A,R,E,q,b,15,f[54]),q=o(q,A,R,E,a,21,f[55]),E=o(E,q,A,R,g,6,f[56]),R=o(R,E,q,A,S,10,f[57]),A=o(A,R,E,q,p,15,f[58]),q=o(q,A,R,E,_,21,f[59]),E=o(E,q,A,R,c,6,f[60]),R=o(R,E,q,A,v,10,f[61]),A=o(A,R,E,q,h,15,f[62]),q=o(q,A,R,E,y,21,f[63]);s[0]=s[0]+E|0,s[1]=s[1]+q|0,s[2]=s[2]+A|0,s[3]=s[3]+R|0},_doFinalize:function(){var e=this._data,r=e.words,i=8*this._nDataBytes,n=8*e.sigBytes;r[n>>>5]|=128<<24-n%32;var o=t.floor(i/4294967296);for(r[15+(n+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),r[14+(n+64>>>9<<4)]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),e.sigBytes=4*(r.length+1),this._process(),r=(e=this._hash).words,i=0;4>i;i++)n=r[i],r[i]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8);return e},clone:function(){var e=u.clone.call(this);return e._hash=this._hash.clone(),e}}),s.MD5=u._createHelper(h),s.HmacMD5=u._createHmacHelper(h)}(Math),function(){var t,r=e,i=(t=r.lib).Base,n=t.WordArray,o=(t=r.algo).EvpKDF=i.extend({cfg:i.extend({keySize:4,hasher:t.MD5,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var r=(a=this.cfg).hasher.create(),i=n.create(),o=i.words,s=a.keySize,a=a.iterations;o.length<s;){u&&r.update(u);var u=r.update(e).finalize(t);r.reset();for(var h=1;h<a;h++)u=r.finalize(u),r.reset();i.concat(u)}return i.sigBytes=4*s,i}});r.EvpKDF=function(e,t,r){return o.create(r).compute(e,t)}}(),e.lib.Cipher||function(){var t=(d=e).lib,r=t.Base,i=t.WordArray,n=t.BufferedBlockAlgorithm,o=d.enc.Base64,s=d.algo.EvpKDF,a=t.Cipher=n.extend({cfg:r.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,r){this.cfg=this.cfg.extend(r),this._xformMode=e,this._key=t,this.reset()},reset:function(){n.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){return e&&this._append(e),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(e){return{encrypt:function(t,r,i){return("string"==typeof r?p:c).encrypt(e,t,r,i)},decrypt:function(t,r,i){return("string"==typeof r?p:c).decrypt(e,t,r,i)}}}});t.StreamCipher=a.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var u=d.mode={},h=function(e,t,r){var i=this._iv;i?this._iv=undefined:i=this._prevBlock;for(var n=0;n<r;n++)e[t+n]^=i[n]},f=(t.BlockCipherMode=r.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}})).extend();f.Encryptor=f.extend({processBlock:function(e,t){var r=this._cipher,i=r.blockSize;h.call(this,e,t,i),r.encryptBlock(e,t),this._prevBlock=e.slice(t,t+i)}}),f.Decryptor=f.extend({processBlock:function(e,t){var r=this._cipher,i=r.blockSize,n=e.slice(t,t+i);r.decryptBlock(e,t),h.call(this,e,t,i),this._prevBlock=n}}),u=u.CBC=f,f=(d.pad={}).Pkcs7={pad:function(e,t){for(var r,n=(r=(r=4*t)-e.sigBytes%r)<<24|r<<16|r<<8|r,o=[],s=0;s<r;s+=4)o.push(n);r=i.create(o,r),e.concat(r)},unpad:function(e){e.sigBytes-=255&e.words[e.sigBytes-1>>>2]}},t.BlockCipher=a.extend({cfg:a.cfg.extend({mode:u,padding:f}),reset:function(){a.reset.call(this);var e=(t=this.cfg).iv,t=t.mode;if(this._xformMode==this._ENC_XFORM_MODE)var r=t.createEncryptor;else r=t.createDecryptor,this._minBufferSize=1;this._mode=r.call(t,this,e&&e.words)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){e.pad(this._data,this.blockSize);var t=this._process(!0)}else t=this._process(!0),e.unpad(t);return t},blockSize:4});var l=t.CipherParams=r.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),c=(u=(d.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext;return((e=e.salt)?i.create([1398893684,1701076831]).concat(e).concat(t):t).toString(o)},parse:function(e){var t=(e=o.parse(e)).words;if(1398893684==t[0]&&1701076831==t[1]){var r=i.create(t.slice(2,4));t.splice(0,4),e.sigBytes-=16}return l.create({ciphertext:e,salt:r})}},t.SerializableCipher=r.extend({cfg:r.extend({format:u}),encrypt:function(e,t,r,i){i=this.cfg.extend(i);var n=e.createEncryptor(r,i);return t=n.finalize(t),n=n.cfg,l.create({ciphertext:t,key:r,iv:n.iv,algorithm:e,mode:n.mode,padding:n.padding,blockSize:e.blockSize,formatter:i.format})},decrypt:function(e,t,r,i){return i=this.cfg.extend(i),t=this._parse(t,i.format),e.createDecryptor(r,i).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}})),d=(d.kdf={}).OpenSSL={execute:function(e,t,r,n){return n||(n=i.random(8)),e=s.create({keySize:t+r}).compute(e,n),r=i.create(e.words.slice(t),4*r),e.sigBytes=4*t,l.create({key:e,iv:r,salt:n})}},p=t.PasswordBasedCipher=c.extend({cfg:c.cfg.extend({kdf:d}),encrypt:function(e,t,r,i){return r=(i=this.cfg.extend(i)).kdf.execute(r,e.keySize,e.ivSize),i.iv=r.iv,(e=c.encrypt.call(this,e,t,r.key,i)).mixIn(r),e},decrypt:function(e,t,r,i){return i=this.cfg.extend(i),t=this._parse(t,i.format),r=i.kdf.execute(r,e.keySize,e.ivSize,t.salt),i.iv=r.iv,c.decrypt.call(this,e,t,r.key,i)}})}(),function(){for(var t=e,r=t.lib.BlockCipher,i=t.algo,n=[],o=[],s=[],a=[],u=[],h=[],f=[],l=[],c=[],d=[],p=[],m=0;256>m;m++)p[m]=128>m?m<<1:m<<1^283;var g=0,y=0;for(m=0;256>m;m++){var b=(b=y^y<<1^y<<2^y<<3^y<<4)>>>8^255&b^99;n[g]=b,o[b]=g;var v=p[g],w=p[v],_=p[w],M=257*p[b]^16843008*b;s[g]=M<<24|M>>>8,a[g]=M<<16|M>>>16,u[g]=M<<8|M>>>24,h[g]=M,M=16843009*_^65537*w^257*v^16843008*g,f[b]=M<<24|M>>>8,l[b]=M<<16|M>>>16,c[b]=M<<8|M>>>24,d[b]=M,g?(g=v^p[p[p[_^v]]],y^=p[p[y]]):g=y=1}var S=[0,1,2,4,8,16,32,64,128,27,54];i=i.AES=r.extend({_doReset:function(){for(var e=(r=this._key).words,t=r.sigBytes/4,r=4*((this._nRounds=t+6)+1),i=this._keySchedule=[],o=0;o<r;o++)if(o<t)i[o]=e[o];else{var s=i[o-1];o%t?6<t&&4==o%t&&(s=n[s>>>24]<<24|n[s>>>16&255]<<16|n[s>>>8&255]<<8|n[255&s]):(s=n[(s=s<<8|s>>>24)>>>24]<<24|n[s>>>16&255]<<16|n[s>>>8&255]<<8|n[255&s],s^=S[o/t|0]<<24),i[o]=i[o-t]^s}for(e=this._invKeySchedule=[],t=0;t<r;t++)o=r-t,s=t%4?i[o]:i[o-4],e[t]=4>t||4>=o?s:f[n[s>>>24]]^l[n[s>>>16&255]]^c[n[s>>>8&255]]^d[n[255&s]]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,s,a,u,h,n)},decryptBlock:function(e,t){var r=e[t+1];e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,f,l,c,d,o),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r},_doCryptBlock:function(e,t,r,i,n,o,s,a){for(var u=this._nRounds,h=e[t]^r[0],f=e[t+1]^r[1],l=e[t+2]^r[2],c=e[t+3]^r[3],d=4,p=1;p<u;p++){var m=i[h>>>24]^n[f>>>16&255]^o[l>>>8&255]^s[255&c]^r[d++],g=i[f>>>24]^n[l>>>16&255]^o[c>>>8&255]^s[255&h]^r[d++],y=i[l>>>24]^n[c>>>16&255]^o[h>>>8&255]^s[255&f]^r[d++];c=i[c>>>24]^n[h>>>16&255]^o[f>>>8&255]^s[255&l]^r[d++],h=m,f=g,l=y}m=(a[h>>>24]<<24|a[f>>>16&255]<<16|a[l>>>8&255]<<8|a[255&c])^r[d++],g=(a[f>>>24]<<24|a[l>>>16&255]<<16|a[c>>>8&255]<<8|a[255&h])^r[d++],y=(a[l>>>24]<<24|a[c>>>16&255]<<16|a[h>>>8&255]<<8|a[255&f])^r[d++],c=(a[c>>>24]<<24|a[h>>>16&255]<<16|a[f>>>8&255]<<8|a[255&l])^r[d++],e[t]=m,e[t+1]=g,e[t+2]=y,e[t+3]=c},keySize:8});t.AES=r._createHelper(i)}(),CryptoJS_1=e}requireCryptoJS();var aes$3={exports:{}};function commonjsRequire(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var core$1={exports:{}},cryptoBrowserify={},browser$c={exports:{}},safeBuffer$a={exports:{}},dist={},hasRequiredDist,hasRequiredSafeBuffer$a,hasRequiredBrowser$c;function requireDist(){return hasRequiredDist||(hasRequiredDist=1,function(e){Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});for(var t={},r={byteLength:function(e){var t=u(e),r=t[0],i=t[1];return 3*(r+i)/4-i},toByteArray:function(e){var t,r,i=u(e),s=i[0],a=i[1],h=new o(function(e,t,r){return 3*(t+r)/4-r}(0,s,a)),f=0,l=a>0?s-4:s;for(r=0;r<l;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],h[f++]=t>>16&255,h[f++]=t>>8&255,h[f++]=255&t;2===a&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,h[f++]=255&t);1===a&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,h[f++]=t>>8&255,h[f++]=255&t);return h},fromByteArray:function(e){for(var t,r=e.length,n=r%3,o=[],s=16383,a=0,u=r-n;a<u;a+=s)o.push(h(e,a,a+s>u?u:a+s));1===n?(t=e[r-1],o.push(i[t>>2]+i[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],o.push(i[t>>10]+i[t>>4&63]+i[t<<2&63]+"="));return o.join("")}},i=[],n=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0;a<64;++a)i[a]=s[a],n[s.charCodeAt(a)]=a;function u(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function h(e,t,r){for(var n,o,s=[],a=t;a<r;a+=3)n=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),s.push(i[(o=n)>>18&63]+i[o>>12&63]+i[o>>6&63]+i[63&o]);return s.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63;var f={read:function(e,t,r,i,n){var o,s,a=8*n-i-1,u=(1<<a)-1,h=u>>1,f=-7,l=r?n-1:0,c=r?-1:1,d=e[t+l];for(l+=c,o=d&(1<<-f)-1,d>>=-f,f+=a;f>0;o=256*o+e[t+l],l+=c,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=i;f>0;s=256*s+e[t+l],l+=c,f-=8);if(0===o)o=1-h;else{if(o===u)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,i),o-=h}return(d?-1:1)*s*Math.pow(2,o-i)},write:function(e,t,r,i,n,o){var s,a,u,h=8*o-n-1,f=(1<<h)-1,l=f>>1,c=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,d=i?0:o-1,p=i?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=f):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),(t+=s+l>=1?c/u:c*Math.pow(2,1-l))*u>=2&&(s++,u/=2),s+l>=f?(a=0,s=f):s+l>=1?(a=(t*u-1)*Math.pow(2,n),s+=l):(a=t*Math.pow(2,l-1)*Math.pow(2,n),s=0));n>=8;e[r+d]=255&a,d+=p,a/=256,n-=8);for(s=s<<n|a,h+=n;h>0;e[r+d]=255&s,d+=p,s/=256,h-=8);e[r+d-p]|=128*m}};!function(e){const t=r,i=f,n="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=l,e.SlowBuffer=function(e){+e!=e&&(e=0);return l.alloc(+e)},e.INSPECT_MAX_BYTES=50;const o=2147483647;e.kMaxLength=o;const{Uint8Array:s,ArrayBuffer:a,SharedArrayBuffer:u}=globalThis;function h(e){if(e>o)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new s(e);return Object.setPrototypeOf(t,l.prototype),t}function l(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return p(e)}return c(e,t,r)}function c(e,t,r){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!l.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const r=0|b(e,t);let i=h(r);const n=i.write(e,t);n!==r&&(i=i.slice(0,n));return i}(e,t);if(a.isView(e))return function(e){if(Y(e,s)){const t=new s(e);return g(t.buffer,t.byteOffset,t.byteLength)}return m(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(Y(e,a)||e&&Y(e.buffer,a))return g(e,t,r);if(void 0!==u&&(Y(e,u)||e&&Y(e.buffer,u)))return g(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const i=e.valueOf&&e.valueOf();if(null!=i&&i!==e)return l.from(i,t,r);const n=function(e){if(l.isBuffer(e)){const t=0|y(e.length),r=h(t);return 0===r.length||e.copy(r,0,0,t),r}if(void 0!==e.length)return"number"!=typeof e.length||X(e.length)?h(0):m(e);if("Buffer"===e.type&&Array.isArray(e.data))return m(e.data)}(e);if(n)return n;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return l.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function d(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function p(e){return d(e),h(e<0?0:0|y(e))}function m(e){const t=e.length<0?0:0|y(e.length),r=h(t);for(let i=0;i<t;i+=1)r[i]=255&e[i];return r}function g(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let i;return i=void 0===t&&void 0===r?new s(e):void 0===r?new s(e,t):new s(e,t,r),Object.setPrototypeOf(i,l.prototype),i}function y(e){if(e>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|e}function b(e,t){if(l.isBuffer(e))return e.length;if(a.isView(e)||Y(e,a))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const r=e.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===r)return 0;let n=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return V(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Q(e).length;default:if(n)return i?-1:V(e).length;t=(""+t).toLowerCase(),n=!0}}function v(e,t,r){let i=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return k(this,t,r);case"utf8":case"utf-8":return P(this,t,r);case"ascii":return I(this,t,r);case"latin1":case"binary":return O(this,t,r);case"base64":return C(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,t,r);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}function w(e,t,r){const i=e[t];e[t]=e[r],e[r]=i}function _(e,t,r,i,n){if(0===e.length)return-1;if("string"==typeof r?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),X(r=+r)&&(r=n?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(n)return-1;r=e.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof t&&(t=l.from(t,i)),l.isBuffer(t))return 0===t.length?-1:M(e,t,r,i,n);if("number"==typeof t)return t&=255,"function"==typeof s.prototype.indexOf?n?s.prototype.indexOf.call(e,t,r):s.prototype.lastIndexOf.call(e,t,r):M(e,[t],r,i,n);throw new TypeError("val must be string, number or Buffer")}function M(e,t,r,i,n){let o,s=1,a=e.length,u=t.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(e.length<2||t.length<2)return-1;s=2,a/=2,u/=2,r/=2}function h(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(n){let i=-1;for(o=r;o<a;o++)if(h(e,o)===h(t,-1===i?0:o-i)){if(-1===i&&(i=o),o-i+1===u)return i*s}else-1!==i&&(o-=o-i),i=-1}else for(r+u>a&&(r=a-u),o=r;o>=0;o--){let r=!0;for(let i=0;i<u;i++)if(h(e,o+i)!==h(t,i)){r=!1;break}if(r)return o}return-1}function S(e,t,r,i){r=Number(r)||0;const n=e.length-r;i?(i=Number(i))>n&&(i=n):i=n;const o=t.length;let s;for(i>o/2&&(i=o/2),s=0;s<i;++s){const i=parseInt(t.substr(2*s,2),16);if(X(i))return s;e[r+s]=i}return s}function E(e,t,r,i){return Z(V(t,e.length-r),e,r,i)}function R(e,t,r,i){return Z(function(e){const t=[];for(let r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,i)}function A(e,t,r,i){return Z(Q(t),e,r,i)}function q(e,t,r,i){return Z(function(e,t){let r,i,n;const o=[];for(let s=0;s<e.length&&!((t-=2)<0);++s)r=e.charCodeAt(s),i=r>>8,n=r%256,o.push(n),o.push(i);return o}(t,e.length-r),e,r,i)}function C(e,r,i){return 0===r&&i===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(r,i))}function P(e,t,r){r=Math.min(e.length,r);const i=[];let n=t;for(;n<r;){const t=e[n];let o=null,s=t>239?4:t>223?3:t>191?2:1;if(n+s<=r){let r,i,a,u;switch(s){case 1:t<128&&(o=t);break;case 2:r=e[n+1],128==(192&r)&&(u=(31&t)<<6|63&r,u>127&&(o=u));break;case 3:r=e[n+1],i=e[n+2],128==(192&r)&&128==(192&i)&&(u=(15&t)<<12|(63&r)<<6|63&i,u>2047&&(u<55296||u>57343)&&(o=u));break;case 4:r=e[n+1],i=e[n+2],a=e[n+3],128==(192&r)&&128==(192&i)&&128==(192&a)&&(u=(15&t)<<18|(63&r)<<12|(63&i)<<6|63&a,u>65535&&u<1114112&&(o=u))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,i.push(o>>>10&1023|5529