Plugin Directory

Changeset 3214536


Ignore:
Timestamp:
12/29/2024 07:54:58 PM (15 months ago)
Author:
davisshaver
Message:

Update to version 0.0.43 from GitHub

Location:
frames-integration-for-farcaster
Files:
2 added
20 edited
1 copied

Legend:

Unmodified
Added
Removed
  • frames-integration-for-farcaster/tags/0.0.43/build/index.asset.php

    r3214439 r3214536  
    1 <?php return array('dependencies' => array('react', 'react-jsx-runtime', 'wp-api-fetch', 'wp-components', 'wp-data', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-media-utils', 'wp-notices', 'wp-primitives'), 'version' => 'd5a0d08d88cf6685a71f');
     1<?php return array('dependencies' => array('react', 'react-jsx-runtime', 'wp-api-fetch', 'wp-components', 'wp-data', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-media-utils', 'wp-notices', 'wp-primitives'), 'version' => 'a8b48df405aa0c297a41');
  • frames-integration-for-farcaster/tags/0.0.43/build/index.js

    r3214439 r3214536  
    1 (()=>{"use strict";var e={2017:e=>{e.exports=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;var n,s,i;if(Array.isArray(t)){if((n=t.length)!=r.length)return!1;for(s=n;0!=s--;)if(!e(t[s],r[s]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((n=(i=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(s=n;0!=s--;)if(!Object.prototype.hasOwnProperty.call(r,i[s]))return!1;for(s=n;0!=s--;){var a=i[s];if(!e(t[a],r[a]))return!1}return!0}return t!=t&&r!=r}}},t={};function r(n){var s=t[n];if(void 0!==s)return s.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};r.r(n),r.d(n,{FILE:()=>Dn,HTML:()=>Nn,TEXT:()=>jn,URL:()=>En});const s=window.wp.domReady;var i=r.n(s);const a=window.wp.element,o=window.wp.i18n,c=window.wp.components,d=window.wp.apiFetch;var u=r.n(d);const l=window.wp.notices,h=window.wp.data;var f,p;!function(e){e.assertEqual=e=>e,e.assertIs=function(e){},e.assertNever=function(_x){throw new Error},e.arrayToEnum=e=>{const t={};for(const r of e)t[r]=r;return t},e.getValidEnumValues=t=>{const r=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),n={};for(const e of r)n[e]=t[e];return e.objectValues(n)},e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]})),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t},e.find=(e,t)=>{for(const r of e)if(t(r))return r},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(f||(f={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(p||(p={}));const g=f.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),m=e=>{switch(typeof e){case"undefined":return g.undefined;case"string":return g.string;case"number":return isNaN(e)?g.nan:g.number;case"boolean":return g.boolean;case"function":return g.function;case"bigint":return g.bigint;case"symbol":return g.symbol;case"object":return Array.isArray(e)?g.array:null===e?g.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?g.promise:"undefined"!=typeof Map&&e instanceof Map?g.map:"undefined"!=typeof Set&&e instanceof Set?g.set:"undefined"!=typeof Date&&e instanceof Date?g.date:g.object;default:return g.unknown}},v=f.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class y extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},r={_errors:[]},n=e=>{for(const s of e.issues)if("invalid_union"===s.code)s.unionErrors.map(n);else if("invalid_return_type"===s.code)n(s.returnTypeError);else if("invalid_arguments"===s.code)n(s.argumentsError);else if(0===s.path.length)r._errors.push(t(s));else{let e=r,n=0;for(;n<s.path.length;){const r=s.path[n];n===s.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(s))):e[r]=e[r]||{_errors:[]},e=e[r],n++}}};return n(this),r}static assert(e){if(!(e instanceof y))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,f.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},r=[];for(const n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):r.push(e(n));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}y.create=e=>new y(e);const _=(e,t)=>{let r;switch(e.code){case v.invalid_type:r=e.received===g.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case v.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,f.jsonStringifyReplacer)}`;break;case v.unrecognized_keys:r=`Unrecognized key(s) in object: ${f.joinValues(e.keys,", ")}`;break;case v.invalid_union:r="Invalid input";break;case v.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${f.joinValues(e.options)}`;break;case v.invalid_enum_value:r=`Invalid enum value. Expected ${f.joinValues(e.options)}, received '${e.received}'`;break;case v.invalid_arguments:r="Invalid function arguments";break;case v.invalid_return_type:r="Invalid function return type";break;case v.invalid_date:r="Invalid date";break;case v.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:f.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case v.too_small:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case v.too_big:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case v.custom:r="Invalid input";break;case v.invalid_intersection_types:r="Intersection results could not be merged";break;case v.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case v.not_finite:r="Number must be finite";break;default:r=t.defaultError,f.assertNever(e)}return{message:r}};let b=_;function x(){return b}const w=e=>{const{data:t,path:r,errorMaps:n,issueData:s}=e,i=[...r,...s.path||[]],a={...s,path:i};if(void 0!==s.message)return{...s,path:i,message:s.message};let o="";const c=n.filter((e=>!!e)).slice().reverse();for(const e of c)o=e(a,{data:t,defaultError:o}).message;return{...s,path:i,message:o}};function T(e,t){const r=x(),n=w({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===_?void 0:_].filter((e=>!!e))});e.common.issues.push(n)}class O{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const r=[];for(const n of t){if("aborted"===n.status)return S;"dirty"===n.status&&e.dirty(),r.push(n.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){const r=[];for(const e of t){const t=await e.key,n=await e.value;r.push({key:t,value:n})}return O.mergeObjectSync(e,r)}static mergeObjectSync(e,t){const r={};for(const n of t){const{key:t,value:s}=n;if("aborted"===t.status)return S;if("aborted"===s.status)return S;"dirty"===t.status&&e.dirty(),"dirty"===s.status&&e.dirty(),"__proto__"===t.value||void 0===s.value&&!n.alwaysSet||(r[t.value]=s.value)}return{status:e.value,value:r}}}const S=Object.freeze({status:"aborted"}),k=e=>({status:"dirty",value:e}),I=e=>({status:"valid",value:e}),C=e=>"aborted"===e.status,D=e=>"dirty"===e.status,E=e=>"valid"===e.status,j=e=>"undefined"!=typeof Promise&&e instanceof Promise;function N(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}function P(e,t,r,n,s){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?s.call(e,r):s?s.value=r:t.set(e,r),r}var R,A,M;"function"==typeof SuppressedError&&SuppressedError,function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(R||(R={}));class Z{constructor(e,t,r,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=n}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const L=(e,t)=>{if(E(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new y(e.common.issues);return this._error=t,this._error}}};function U(e){if(!e)return{};const{errorMap:t,invalid_type_error:r,required_error:n,description:s}=e;if(t&&(r||n))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:s}:{errorMap:(t,s)=>{var i,a;const{message:o}=e;return"invalid_enum_value"===t.code?{message:null!=o?o:s.defaultError}:void 0===s.data?{message:null!==(i=null!=o?o:n)&&void 0!==i?i:s.defaultError}:"invalid_type"!==t.code?{message:s.defaultError}:{message:null!==(a=null!=o?o:r)&&void 0!==a?a:s.defaultError}},description:s}}class ${get description(){return this._def.description}_getType(e){return m(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:m(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new O,ctx:{common:e.parent.common,data:e.data,parsedType:m(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(j(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){var r;const n={common:{issues:[],async:null!==(r=null==t?void 0:t.async)&&void 0!==r&&r,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:m(e)},s=this._parseSync({data:e,path:n.path,parent:n});return L(n,s)}"~validate"(e){var t,r;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:m(e)};if(!this["~standard"].async)try{const t=this._parseSync({data:e,path:[],parent:n});return E(t)?{value:t.value}:{issues:n.common.issues}}catch(e){(null===(r=null===(t=null==e?void 0:e.message)||void 0===t?void 0:t.toLowerCase())||void 0===r?void 0:r.includes("encountered"))&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then((e=>E(e)?{value:e.value}:{issues:n.common.issues}))}async parseAsync(e,t){const r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){const r={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:m(e)},n=this._parse({data:e,path:r.path,parent:r}),s=await(j(n)?n:Promise.resolve(n));return L(r,s)}refine(e,t){const r=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,n)=>{const s=e(t),i=()=>n.addIssue({code:v.custom,...r(t)});return"undefined"!=typeof Promise&&s instanceof Promise?s.then((e=>!!e||(i(),!1))):!!s||(i(),!1)}))}refinement(e,t){return this._refinement(((r,n)=>!!e(r)||(n.addIssue("function"==typeof t?t(r,n):t),!1)))}_refinement(e){return new Be({schema:this,typeName:Qe.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return Fe.create(this,this._def)}nullable(){return ze.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return we.create(this)}promise(){return $e.create(this,this._def)}or(e){return Se.create([this,e],this._def)}and(e){return De.create(this,e,this._def)}transform(e){return new Be({...U(this._def),schema:this,typeName:Qe.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new He({...U(this._def),innerType:this,defaultValue:t,typeName:Qe.ZodDefault})}brand(){return new Ke({typeName:Qe.ZodBranded,type:this,...U(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new Ve({...U(this._def),innerType:this,catchValue:t,typeName:Qe.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return Xe.create(this,e)}readonly(){return Ge.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const B=/^c[^\s-]{8,}$/i,F=/^[0-9a-z]+$/,z=/^[0-9A-HJKMNP-TV-Z]{26}$/i,H=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,V=/^[a-z0-9_-]{21}$/i,q=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,W=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,K=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let X;const G=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Y=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,J=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Q=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ee=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,te=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,re="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",ne=new RegExp(`^${re}$`);function se(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function ie(e){let t=`${re}T${se(e)}`;const r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function ae(e,t){return!("v4"!==t&&t||!G.test(e))||!("v6"!==t&&t||!J.test(e))}function oe(e,t){if(!q.test(e))return!1;try{const[r]=e.split("."),n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),s=JSON.parse(atob(n));return!("object"!=typeof s||null===s||!s.typ||!s.alg||t&&s.alg!==t)}catch(e){return!1}}function ce(e,t){return!("v4"!==t&&t||!Y.test(e))||!("v6"!==t&&t||!Q.test(e))}class de extends ${_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==g.string){const t=this._getOrReturnCtx(e);return T(t,{code:v.invalid_type,expected:g.string,received:t.parsedType}),S}const t=new O;let r;for(const n of this._def.checks)if("min"===n.kind)e.data.length<n.value&&(r=this._getOrReturnCtx(e,r),T(r,{code:v.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),t.dirty());else if("max"===n.kind)e.data.length>n.value&&(r=this._getOrReturnCtx(e,r),T(r,{code:v.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),t.dirty());else if("length"===n.kind){const s=e.data.length>n.value,i=e.data.length<n.value;(s||i)&&(r=this._getOrReturnCtx(e,r),s?T(r,{code:v.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):i&&T(r,{code:v.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),t.dirty())}else if("email"===n.kind)K.test(e.data)||(r=this._getOrReturnCtx(e,r),T(r,{validation:"email",code:v.invalid_string,message:n.message}),t.dirty());else if("emoji"===n.kind)X||(X=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),X.test(e.data)||(r=this._getOrReturnCtx(e,r),T(r,{validation:"emoji",code:v.invalid_string,message:n.message}),t.dirty());else if("uuid"===n.kind)H.test(e.data)||(r=this._getOrReturnCtx(e,r),T(r,{validation:"uuid",code:v.invalid_string,message:n.message}),t.dirty());else if("nanoid"===n.kind)V.test(e.data)||(r=this._getOrReturnCtx(e,r),T(r,{validation:"nanoid",code:v.invalid_string,message:n.message}),t.dirty());else if("cuid"===n.kind)B.test(e.data)||(r=this._getOrReturnCtx(e,r),T(r,{validation:"cuid",code:v.invalid_string,message:n.message}),t.dirty());else if("cuid2"===n.kind)F.test(e.data)||(r=this._getOrReturnCtx(e,r),T(r,{validation:"cuid2",code:v.invalid_string,message:n.message}),t.dirty());else if("ulid"===n.kind)z.test(e.data)||(r=this._getOrReturnCtx(e,r),T(r,{validation:"ulid",code:v.invalid_string,message:n.message}),t.dirty());else if("url"===n.kind)try{new URL(e.data)}catch(s){r=this._getOrReturnCtx(e,r),T(r,{validation:"url",code:v.invalid_string,message:n.message}),t.dirty()}else"regex"===n.kind?(n.regex.lastIndex=0,n.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),T(r,{validation:"regex",code:v.invalid_string,message:n.message}),t.dirty())):"trim"===n.kind?e.data=e.data.trim():"includes"===n.kind?e.data.includes(n.value,n.position)||(r=this._getOrReturnCtx(e,r),T(r,{code:v.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),t.dirty()):"toLowerCase"===n.kind?e.data=e.data.toLowerCase():"toUpperCase"===n.kind?e.data=e.data.toUpperCase():"startsWith"===n.kind?e.data.startsWith(n.value)||(r=this._getOrReturnCtx(e,r),T(r,{code:v.invalid_string,validation:{startsWith:n.value},message:n.message}),t.dirty()):"endsWith"===n.kind?e.data.endsWith(n.value)||(r=this._getOrReturnCtx(e,r),T(r,{code:v.invalid_string,validation:{endsWith:n.value},message:n.message}),t.dirty()):"datetime"===n.kind?ie(n).test(e.data)||(r=this._getOrReturnCtx(e,r),T(r,{code:v.invalid_string,validation:"datetime",message:n.message}),t.dirty()):"date"===n.kind?ne.test(e.data)||(r=this._getOrReturnCtx(e,r),T(r,{code:v.invalid_string,validation:"date",message:n.message}),t.dirty()):"time"===n.kind?new RegExp(`^${se(n)}$`).test(e.data)||(r=this._getOrReturnCtx(e,r),T(r,{code:v.invalid_string,validation:"time",message:n.message}),t.dirty()):"duration"===n.kind?W.test(e.data)||(r=this._getOrReturnCtx(e,r),T(r,{validation:"duration",code:v.invalid_string,message:n.message}),t.dirty()):"ip"===n.kind?ae(e.data,n.version)||(r=this._getOrReturnCtx(e,r),T(r,{validation:"ip",code:v.invalid_string,message:n.message}),t.dirty()):"jwt"===n.kind?oe(e.data,n.alg)||(r=this._getOrReturnCtx(e,r),T(r,{validation:"jwt",code:v.invalid_string,message:n.message}),t.dirty()):"cidr"===n.kind?ce(e.data,n.version)||(r=this._getOrReturnCtx(e,r),T(r,{validation:"cidr",code:v.invalid_string,message:n.message}),t.dirty()):"base64"===n.kind?ee.test(e.data)||(r=this._getOrReturnCtx(e,r),T(r,{validation:"base64",code:v.invalid_string,message:n.message}),t.dirty()):"base64url"===n.kind?te.test(e.data)||(r=this._getOrReturnCtx(e,r),T(r,{validation:"base64url",code:v.invalid_string,message:n.message}),t.dirty()):f.assertNever(n);return{status:t.value,value:e.data}}_regex(e,t,r){return this.refinement((t=>e.test(t)),{validation:t,code:v.invalid_string,...R.errToObj(r)})}_addCheck(e){return new de({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...R.errToObj(e)})}url(e){return this._addCheck({kind:"url",...R.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...R.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...R.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...R.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...R.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...R.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...R.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...R.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...R.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...R.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...R.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...R.errToObj(e)})}datetime(e){var t,r;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(r=null==e?void 0:e.local)&&void 0!==r&&r,...R.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...R.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...R.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...R.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...R.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...R.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...R.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...R.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...R.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...R.errToObj(t)})}nonempty(e){return this.min(1,R.errToObj(e))}trim(){return new de({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new de({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new de({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isCIDR(){return!!this._def.checks.find((e=>"cidr"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get isBase64url(){return!!this._def.checks.find((e=>"base64url"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function ue(e,t){const r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,s=r>n?r:n;return parseInt(e.toFixed(s).replace(".",""))%parseInt(t.toFixed(s).replace(".",""))/Math.pow(10,s)}de.create=e=>{var t;return new de({checks:[],typeName:Qe.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...U(e)})};class le extends ${constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==g.number){const t=this._getOrReturnCtx(e);return T(t,{code:v.invalid_type,expected:g.number,received:t.parsedType}),S}let t;const r=new O;for(const n of this._def.checks)"int"===n.kind?f.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),T(t,{code:v.invalid_type,expected:"integer",received:"float",message:n.message}),r.dirty()):"min"===n.kind?(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),T(t,{code:v.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):"max"===n.kind?(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),T(t,{code:v.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):"multipleOf"===n.kind?0!==ue(e.data,n.value)&&(t=this._getOrReturnCtx(e,t),T(t,{code:v.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):"finite"===n.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),T(t,{code:v.not_finite,message:n.message}),r.dirty()):f.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,R.toString(t))}gt(e,t){return this.setLimit("min",e,!1,R.toString(t))}lte(e,t){return this.setLimit("max",e,!0,R.toString(t))}lt(e,t){return this.setLimit("max",e,!1,R.toString(t))}setLimit(e,t,r,n){return new le({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:R.toString(n)}]})}_addCheck(e){return new le({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:R.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:R.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:R.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:R.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:R.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:R.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:R.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:R.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:R.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find((e=>"int"===e.kind||"multipleOf"===e.kind&&f.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const r of this._def.checks){if("finite"===r.kind||"int"===r.kind||"multipleOf"===r.kind)return!0;"min"===r.kind?(null===t||r.value>t)&&(t=r.value):"max"===r.kind&&(null===e||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}}le.create=e=>new le({checks:[],typeName:Qe.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...U(e)});class he extends ${constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch(t){return this._getInvalidInput(e)}if(this._getType(e)!==g.bigint)return this._getInvalidInput(e);let t;const r=new O;for(const n of this._def.checks)"min"===n.kind?(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),T(t,{code:v.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):"max"===n.kind?(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),T(t,{code:v.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):"multipleOf"===n.kind?e.data%n.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),T(t,{code:v.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):f.assertNever(n);return{status:r.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return T(t,{code:v.invalid_type,expected:g.bigint,received:t.parsedType}),S}gte(e,t){return this.setLimit("min",e,!0,R.toString(t))}gt(e,t){return this.setLimit("min",e,!1,R.toString(t))}lte(e,t){return this.setLimit("max",e,!0,R.toString(t))}lt(e,t){return this.setLimit("max",e,!1,R.toString(t))}setLimit(e,t,r,n){return new he({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:R.toString(n)}]})}_addCheck(e){return new he({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:R.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:R.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:R.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:R.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:R.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}he.create=e=>{var t;return new he({checks:[],typeName:Qe.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...U(e)})};class fe extends ${_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==g.boolean){const t=this._getOrReturnCtx(e);return T(t,{code:v.invalid_type,expected:g.boolean,received:t.parsedType}),S}return I(e.data)}}fe.create=e=>new fe({typeName:Qe.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...U(e)});class pe extends ${_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==g.date){const t=this._getOrReturnCtx(e);return T(t,{code:v.invalid_type,expected:g.date,received:t.parsedType}),S}if(isNaN(e.data.getTime()))return T(this._getOrReturnCtx(e),{code:v.invalid_date}),S;const t=new O;let r;for(const n of this._def.checks)"min"===n.kind?e.data.getTime()<n.value&&(r=this._getOrReturnCtx(e,r),T(r,{code:v.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),t.dirty()):"max"===n.kind?e.data.getTime()>n.value&&(r=this._getOrReturnCtx(e,r),T(r,{code:v.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),t.dirty()):f.assertNever(n);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new pe({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:R.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:R.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}pe.create=e=>new pe({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Qe.ZodDate,...U(e)});class ge extends ${_parse(e){if(this._getType(e)!==g.symbol){const t=this._getOrReturnCtx(e);return T(t,{code:v.invalid_type,expected:g.symbol,received:t.parsedType}),S}return I(e.data)}}ge.create=e=>new ge({typeName:Qe.ZodSymbol,...U(e)});class me extends ${_parse(e){if(this._getType(e)!==g.undefined){const t=this._getOrReturnCtx(e);return T(t,{code:v.invalid_type,expected:g.undefined,received:t.parsedType}),S}return I(e.data)}}me.create=e=>new me({typeName:Qe.ZodUndefined,...U(e)});class ve extends ${_parse(e){if(this._getType(e)!==g.null){const t=this._getOrReturnCtx(e);return T(t,{code:v.invalid_type,expected:g.null,received:t.parsedType}),S}return I(e.data)}}ve.create=e=>new ve({typeName:Qe.ZodNull,...U(e)});class ye extends ${constructor(){super(...arguments),this._any=!0}_parse(e){return I(e.data)}}ye.create=e=>new ye({typeName:Qe.ZodAny,...U(e)});class _e extends ${constructor(){super(...arguments),this._unknown=!0}_parse(e){return I(e.data)}}_e.create=e=>new _e({typeName:Qe.ZodUnknown,...U(e)});class be extends ${_parse(e){const t=this._getOrReturnCtx(e);return T(t,{code:v.invalid_type,expected:g.never,received:t.parsedType}),S}}be.create=e=>new be({typeName:Qe.ZodNever,...U(e)});class xe extends ${_parse(e){if(this._getType(e)!==g.undefined){const t=this._getOrReturnCtx(e);return T(t,{code:v.invalid_type,expected:g.void,received:t.parsedType}),S}return I(e.data)}}xe.create=e=>new xe({typeName:Qe.ZodVoid,...U(e)});class we extends ${_parse(e){const{ctx:t,status:r}=this._processInputParams(e),n=this._def;if(t.parsedType!==g.array)return T(t,{code:v.invalid_type,expected:g.array,received:t.parsedType}),S;if(null!==n.exactLength){const e=t.data.length>n.exactLength.value,s=t.data.length<n.exactLength.value;(e||s)&&(T(t,{code:e?v.too_big:v.too_small,minimum:s?n.exactLength.value:void 0,maximum:e?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),r.dirty())}if(null!==n.minLength&&t.data.length<n.minLength.value&&(T(t,{code:v.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),r.dirty()),null!==n.maxLength&&t.data.length>n.maxLength.value&&(T(t,{code:v.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map(((e,r)=>n.type._parseAsync(new Z(t,e,t.path,r))))).then((e=>O.mergeArray(r,e)));const s=[...t.data].map(((e,r)=>n.type._parseSync(new Z(t,e,t.path,r))));return O.mergeArray(r,s)}get element(){return this._def.type}min(e,t){return new we({...this._def,minLength:{value:e,message:R.toString(t)}})}max(e,t){return new we({...this._def,maxLength:{value:e,message:R.toString(t)}})}length(e,t){return new we({...this._def,exactLength:{value:e,message:R.toString(t)}})}nonempty(e){return this.min(1,e)}}function Te(e){if(e instanceof Oe){const t={};for(const r in e.shape){const n=e.shape[r];t[r]=Fe.create(Te(n))}return new Oe({...e._def,shape:()=>t})}return e instanceof we?new we({...e._def,type:Te(e.element)}):e instanceof Fe?Fe.create(Te(e.unwrap())):e instanceof ze?ze.create(Te(e.unwrap())):e instanceof Ee?Ee.create(e.items.map((e=>Te(e)))):e}we.create=(e,t)=>new we({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Qe.ZodArray,...U(t)});class Oe extends ${constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=f.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==g.object){const t=this._getOrReturnCtx(e);return T(t,{code:v.invalid_type,expected:g.object,received:t.parsedType}),S}const{status:t,ctx:r}=this._processInputParams(e),{shape:n,keys:s}=this._getCached(),i=[];if(!(this._def.catchall instanceof be&&"strip"===this._def.unknownKeys))for(const e in r.data)s.includes(e)||i.push(e);const a=[];for(const e of s){const t=n[e],s=r.data[e];a.push({key:{status:"valid",value:e},value:t._parse(new Z(r,s,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof be){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of i)a.push({key:{status:"valid",value:e},value:{status:"valid",value:r.data[e]}});else if("strict"===e)i.length>0&&(T(r,{code:v.unrecognized_keys,keys:i}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of i){const n=r.data[t];a.push({key:{status:"valid",value:t},value:e._parse(new Z(r,n,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of a){const r=await t.key,n=await t.value;e.push({key:r,value:n,alwaysSet:t.alwaysSet})}return e})).then((e=>O.mergeObjectSync(t,e))):O.mergeObjectSync(t,a)}get shape(){return this._def.shape()}strict(e){return R.errToObj,new Oe({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,r)=>{var n,s,i,a;const o=null!==(i=null===(s=(n=this._def).errorMap)||void 0===s?void 0:s.call(n,t,r).message)&&void 0!==i?i:r.defaultError;return"unrecognized_keys"===t.code?{message:null!==(a=R.errToObj(e).message)&&void 0!==a?a:o}:{message:o}}}:{}})}strip(){return new Oe({...this._def,unknownKeys:"strip"})}passthrough(){return new Oe({...this._def,unknownKeys:"passthrough"})}extend(e){return new Oe({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Oe({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Qe.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Oe({...this._def,catchall:e})}pick(e){const t={};return f.objectKeys(e).forEach((r=>{e[r]&&this.shape[r]&&(t[r]=this.shape[r])})),new Oe({...this._def,shape:()=>t})}omit(e){const t={};return f.objectKeys(this.shape).forEach((r=>{e[r]||(t[r]=this.shape[r])})),new Oe({...this._def,shape:()=>t})}deepPartial(){return Te(this)}partial(e){const t={};return f.objectKeys(this.shape).forEach((r=>{const n=this.shape[r];e&&!e[r]?t[r]=n:t[r]=n.optional()})),new Oe({...this._def,shape:()=>t})}required(e){const t={};return f.objectKeys(this.shape).forEach((r=>{if(e&&!e[r])t[r]=this.shape[r];else{let e=this.shape[r];for(;e instanceof Fe;)e=e._def.innerType;t[r]=e}})),new Oe({...this._def,shape:()=>t})}keyof(){return Ze(f.objectKeys(this.shape))}}Oe.create=(e,t)=>new Oe({shape:()=>e,unknownKeys:"strip",catchall:be.create(),typeName:Qe.ZodObject,...U(t)}),Oe.strictCreate=(e,t)=>new Oe({shape:()=>e,unknownKeys:"strict",catchall:be.create(),typeName:Qe.ZodObject,...U(t)}),Oe.lazycreate=(e,t)=>new Oe({shape:e,unknownKeys:"strip",catchall:be.create(),typeName:Qe.ZodObject,...U(t)});class Se extends ${_parse(e){const{ctx:t}=this._processInputParams(e),r=this._def.options;if(t.common.async)return Promise.all(r.map((async e=>{const r={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;const r=e.map((e=>new y(e.ctx.common.issues)));return T(t,{code:v.invalid_union,unionErrors:r}),S}));{let e;const n=[];for(const s of r){const r={...t,common:{...t.common,issues:[]},parent:null},i=s._parseSync({data:t.data,path:t.path,parent:r});if("valid"===i.status)return i;"dirty"!==i.status||e||(e={result:i,ctx:r}),r.common.issues.length&&n.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const s=n.map((e=>new y(e)));return T(t,{code:v.invalid_union,unionErrors:s}),S}}get options(){return this._def.options}}Se.create=(e,t)=>new Se({options:e,typeName:Qe.ZodUnion,...U(t)});const ke=e=>e instanceof Ae?ke(e.schema):e instanceof Be?ke(e.innerType()):e instanceof Me?[e.value]:e instanceof Le?e.options:e instanceof Ue?f.objectValues(e.enum):e instanceof He?ke(e._def.innerType):e instanceof me?[void 0]:e instanceof ve?[null]:e instanceof Fe?[void 0,...ke(e.unwrap())]:e instanceof ze?[null,...ke(e.unwrap())]:e instanceof Ke||e instanceof Ge?ke(e.unwrap()):e instanceof Ve?ke(e._def.innerType):[];class Ie extends ${_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==g.object)return T(t,{code:v.invalid_type,expected:g.object,received:t.parsedType}),S;const r=this.discriminator,n=t.data[r],s=this.optionsMap.get(n);return s?t.common.async?s._parseAsync({data:t.data,path:t.path,parent:t}):s._parseSync({data:t.data,path:t.path,parent:t}):(T(t,{code:v.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),S)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){const n=new Map;for(const r of t){const t=ke(r.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const s of t){if(n.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);n.set(s,r)}}return new Ie({typeName:Qe.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...U(r)})}}function Ce(e,t){const r=m(e),n=m(t);if(e===t)return{valid:!0,data:e};if(r===g.object&&n===g.object){const r=f.objectKeys(t),n=f.objectKeys(e).filter((e=>-1!==r.indexOf(e))),s={...e,...t};for(const r of n){const n=Ce(e[r],t[r]);if(!n.valid)return{valid:!1};s[r]=n.data}return{valid:!0,data:s}}if(r===g.array&&n===g.array){if(e.length!==t.length)return{valid:!1};const r=[];for(let n=0;n<e.length;n++){const s=Ce(e[n],t[n]);if(!s.valid)return{valid:!1};r.push(s.data)}return{valid:!0,data:r}}return r===g.date&&n===g.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class De extends ${_parse(e){const{status:t,ctx:r}=this._processInputParams(e),n=(e,n)=>{if(C(e)||C(n))return S;const s=Ce(e.value,n.value);return s.valid?((D(e)||D(n))&&t.dirty(),{status:t.value,value:s.data}):(T(r,{code:v.invalid_intersection_types}),S)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then((([e,t])=>n(e,t))):n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}De.create=(e,t,r)=>new De({left:e,right:t,typeName:Qe.ZodIntersection,...U(r)});class Ee extends ${_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==g.array)return T(r,{code:v.invalid_type,expected:g.array,received:r.parsedType}),S;if(r.data.length<this._def.items.length)return T(r,{code:v.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),S;!this._def.rest&&r.data.length>this._def.items.length&&(T(r,{code:v.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const n=[...r.data].map(((e,t)=>{const n=this._def.items[t]||this._def.rest;return n?n._parse(new Z(r,e,r.path,t)):null})).filter((e=>!!e));return r.common.async?Promise.all(n).then((e=>O.mergeArray(t,e))):O.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new Ee({...this._def,rest:e})}}Ee.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ee({items:e,typeName:Qe.ZodTuple,rest:null,...U(t)})};class je extends ${get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==g.object)return T(r,{code:v.invalid_type,expected:g.object,received:r.parsedType}),S;const n=[],s=this._def.keyType,i=this._def.valueType;for(const e in r.data)n.push({key:s._parse(new Z(r,e,r.path,e)),value:i._parse(new Z(r,r.data[e],r.path,e)),alwaysSet:e in r.data});return r.common.async?O.mergeObjectAsync(t,n):O.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,r){return new je(t instanceof $?{keyType:e,valueType:t,typeName:Qe.ZodRecord,...U(r)}:{keyType:de.create(),valueType:e,typeName:Qe.ZodRecord,...U(t)})}}class Ne extends ${get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==g.map)return T(r,{code:v.invalid_type,expected:g.map,received:r.parsedType}),S;const n=this._def.keyType,s=this._def.valueType,i=[...r.data.entries()].map((([e,t],i)=>({key:n._parse(new Z(r,e,r.path,[i,"key"])),value:s._parse(new Z(r,t,r.path,[i,"value"]))})));if(r.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const r of i){const n=await r.key,s=await r.value;if("aborted"===n.status||"aborted"===s.status)return S;"dirty"!==n.status&&"dirty"!==s.status||t.dirty(),e.set(n.value,s.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const r of i){const n=r.key,s=r.value;if("aborted"===n.status||"aborted"===s.status)return S;"dirty"!==n.status&&"dirty"!==s.status||t.dirty(),e.set(n.value,s.value)}return{status:t.value,value:e}}}}Ne.create=(e,t,r)=>new Ne({valueType:t,keyType:e,typeName:Qe.ZodMap,...U(r)});class Pe extends ${_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==g.set)return T(r,{code:v.invalid_type,expected:g.set,received:r.parsedType}),S;const n=this._def;null!==n.minSize&&r.data.size<n.minSize.value&&(T(r,{code:v.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),null!==n.maxSize&&r.data.size>n.maxSize.value&&(T(r,{code:v.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());const s=this._def.valueType;function i(e){const r=new Set;for(const n of e){if("aborted"===n.status)return S;"dirty"===n.status&&t.dirty(),r.add(n.value)}return{status:t.value,value:r}}const a=[...r.data.values()].map(((e,t)=>s._parse(new Z(r,e,r.path,t))));return r.common.async?Promise.all(a).then((e=>i(e))):i(a)}min(e,t){return new Pe({...this._def,minSize:{value:e,message:R.toString(t)}})}max(e,t){return new Pe({...this._def,maxSize:{value:e,message:R.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Pe.create=(e,t)=>new Pe({valueType:e,minSize:null,maxSize:null,typeName:Qe.ZodSet,...U(t)});class Re extends ${constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==g.function)return T(t,{code:v.invalid_type,expected:g.function,received:t.parsedType}),S;function r(e,r){return w({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,x(),_].filter((e=>!!e)),issueData:{code:v.invalid_arguments,argumentsError:r}})}function n(e,r){return w({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,x(),_].filter((e=>!!e)),issueData:{code:v.invalid_return_type,returnTypeError:r}})}const s={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof $e){const e=this;return I((async function(...t){const a=new y([]),o=await e._def.args.parseAsync(t,s).catch((e=>{throw a.addIssue(r(t,e)),a})),c=await Reflect.apply(i,this,o);return await e._def.returns._def.type.parseAsync(c,s).catch((e=>{throw a.addIssue(n(c,e)),a}))}))}{const e=this;return I((function(...t){const a=e._def.args.safeParse(t,s);if(!a.success)throw new y([r(t,a.error)]);const o=Reflect.apply(i,this,a.data),c=e._def.returns.safeParse(o,s);if(!c.success)throw new y([n(o,c.error)]);return c.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Re({...this._def,args:Ee.create(e).rest(_e.create())})}returns(e){return new Re({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new Re({args:e||Ee.create([]).rest(_e.create()),returns:t||_e.create(),typeName:Qe.ZodFunction,...U(r)})}}class Ae extends ${get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}Ae.create=(e,t)=>new Ae({getter:e,typeName:Qe.ZodLazy,...U(t)});class Me extends ${_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return T(t,{received:t.data,code:v.invalid_literal,expected:this._def.value}),S}return{status:"valid",value:e.data}}get value(){return this._def.value}}function Ze(e,t){return new Le({values:e,typeName:Qe.ZodEnum,...U(t)})}Me.create=(e,t)=>new Me({value:e,typeName:Qe.ZodLiteral,...U(t)});class Le extends ${constructor(){super(...arguments),A.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),r=this._def.values;return T(t,{expected:f.joinValues(r),received:t.parsedType,code:v.invalid_type}),S}if(N(this,A,"f")||P(this,A,new Set(this._def.values),"f"),!N(this,A,"f").has(e.data)){const t=this._getOrReturnCtx(e),r=this._def.values;return T(t,{received:t.data,code:v.invalid_enum_value,options:r}),S}return I(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return Le.create(e,{...this._def,...t})}exclude(e,t=this._def){return Le.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}A=new WeakMap,Le.create=Ze;class Ue extends ${constructor(){super(...arguments),M.set(this,void 0)}_parse(e){const t=f.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==g.string&&r.parsedType!==g.number){const e=f.objectValues(t);return T(r,{expected:f.joinValues(e),received:r.parsedType,code:v.invalid_type}),S}if(N(this,M,"f")||P(this,M,new Set(f.getValidEnumValues(this._def.values)),"f"),!N(this,M,"f").has(e.data)){const e=f.objectValues(t);return T(r,{received:r.data,code:v.invalid_enum_value,options:e}),S}return I(e.data)}get enum(){return this._def.values}}M=new WeakMap,Ue.create=(e,t)=>new Ue({values:e,typeName:Qe.ZodNativeEnum,...U(t)});class $e extends ${unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==g.promise&&!1===t.common.async)return T(t,{code:v.invalid_type,expected:g.promise,received:t.parsedType}),S;const r=t.parsedType===g.promise?t.data:Promise.resolve(t.data);return I(r.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}$e.create=(e,t)=>new $e({type:e,typeName:Qe.ZodPromise,...U(t)});class Be extends ${innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Qe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:r}=this._processInputParams(e),n=this._def.effect||null,s={addIssue:e=>{T(r,e),e.fatal?t.abort():t.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),"preprocess"===n.type){const e=n.transform(r.data,s);if(r.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return S;const n=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return"aborted"===n.status?S:"dirty"===n.status||"dirty"===t.value?k(n.value):n}));{if("aborted"===t.value)return S;const n=this._def.schema._parseSync({data:e,path:r.path,parent:r});return"aborted"===n.status?S:"dirty"===n.status||"dirty"===t.value?k(n.value):n}}if("refinement"===n.type){const e=e=>{const t=n.refinement(e,s);if(r.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===r.common.async){const n=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===n.status?S:("dirty"===n.status&&t.dirty(),e(n.value),{status:t.value,value:n.value})}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((r=>"aborted"===r.status?S:("dirty"===r.status&&t.dirty(),e(r.value).then((()=>({status:t.value,value:r.value}))))))}if("transform"===n.type){if(!1===r.common.async){const e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!E(e))return e;const i=n.transform(e.value,s);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((e=>E(e)?Promise.resolve(n.transform(e.value,s)).then((e=>({status:t.value,value:e}))):e))}f.assertNever(n)}}Be.create=(e,t,r)=>new Be({schema:e,typeName:Qe.ZodEffects,effect:t,...U(r)}),Be.createWithPreprocess=(e,t,r)=>new Be({schema:t,effect:{type:"preprocess",transform:e},typeName:Qe.ZodEffects,...U(r)});class Fe extends ${_parse(e){return this._getType(e)===g.undefined?I(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Fe.create=(e,t)=>new Fe({innerType:e,typeName:Qe.ZodOptional,...U(t)});class ze extends ${_parse(e){return this._getType(e)===g.null?I(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ze.create=(e,t)=>new ze({innerType:e,typeName:Qe.ZodNullable,...U(t)});class He extends ${_parse(e){const{ctx:t}=this._processInputParams(e);let r=t.data;return t.parsedType===g.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}He.create=(e,t)=>new He({innerType:e,typeName:Qe.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...U(t)});class Ve extends ${_parse(e){const{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return j(n)?n.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new y(r.common.issues)},input:r.data})}))):{status:"valid",value:"valid"===n.status?n.value:this._def.catchValue({get error(){return new y(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Ve.create=(e,t)=>new Ve({innerType:e,typeName:Qe.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...U(t)});class qe extends ${_parse(e){if(this._getType(e)!==g.nan){const t=this._getOrReturnCtx(e);return T(t,{code:v.invalid_type,expected:g.nan,received:t.parsedType}),S}return{status:"valid",value:e.data}}}qe.create=e=>new qe({typeName:Qe.ZodNaN,...U(e)});const We=Symbol("zod_brand");class Ke extends ${_parse(e){const{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class Xe extends ${_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const e=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?S:"dirty"===e.status?(t.dirty(),k(e.value)):this._def.out._parseAsync({data:e.value,path:r.path,parent:r})})();{const e=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?S:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:r.path,parent:r})}}static create(e,t){return new Xe({in:e,out:t,typeName:Qe.ZodPipeline})}}class Ge extends ${_parse(e){const t=this._def.innerType._parse(e),r=e=>(E(e)&&(e.value=Object.freeze(e.value)),e);return j(t)?t.then((e=>r(e))):r(t)}unwrap(){return this._def.innerType}}function Ye(e,t={},r){return e?ye.create().superRefine(((n,s)=>{var i,a;if(!e(n)){const e="function"==typeof t?t(n):"string"==typeof t?{message:t}:t,o=null===(a=null!==(i=e.fatal)&&void 0!==i?i:r)||void 0===a||a,c="string"==typeof e?{message:e}:e;s.addIssue({code:"custom",...c,fatal:o})}})):ye.create()}Ge.create=(e,t)=>new Ge({innerType:e,typeName:Qe.ZodReadonly,...U(t)});const Je={object:Oe.lazycreate};var Qe;!function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(Qe||(Qe={}));const et=de.create,tt=le.create,rt=qe.create,nt=he.create,st=fe.create,it=pe.create,at=ge.create,ot=me.create,ct=ve.create,dt=ye.create,ut=_e.create,lt=be.create,ht=xe.create,ft=we.create,pt=Oe.create,gt=Oe.strictCreate,mt=Se.create,vt=Ie.create,yt=De.create,_t=Ee.create,bt=je.create,xt=Ne.create,wt=Pe.create,Tt=Re.create,Ot=Ae.create,St=Me.create,kt=Le.create,It=Ue.create,Ct=$e.create,Dt=Be.create,Et=Fe.create,jt=ze.create,Nt=Be.createWithPreprocess,Pt=Xe.create,Rt={string:e=>de.create({...e,coerce:!0}),number:e=>le.create({...e,coerce:!0}),boolean:e=>fe.create({...e,coerce:!0}),bigint:e=>he.create({...e,coerce:!0}),date:e=>pe.create({...e,coerce:!0})},At=S;var Mt=Object.freeze({__proto__:null,defaultErrorMap:_,setErrorMap:function(e){b=e},getErrorMap:x,makeIssue:w,EMPTY_PATH:[],addIssueToContext:T,ParseStatus:O,INVALID:S,DIRTY:k,OK:I,isAborted:C,isDirty:D,isValid:E,isAsync:j,get util(){return f},get objectUtil(){return p},ZodParsedType:g,getParsedType:m,ZodType:$,datetimeRegex:ie,ZodString:de,ZodNumber:le,ZodBigInt:he,ZodBoolean:fe,ZodDate:pe,ZodSymbol:ge,ZodUndefined:me,ZodNull:ve,ZodAny:ye,ZodUnknown:_e,ZodNever:be,ZodVoid:xe,ZodArray:we,ZodObject:Oe,ZodUnion:Se,ZodDiscriminatedUnion:Ie,ZodIntersection:De,ZodTuple:Ee,ZodRecord:je,ZodMap:Ne,ZodSet:Pe,ZodFunction:Re,ZodLazy:Ae,ZodLiteral:Me,ZodEnum:Le,ZodNativeEnum:Ue,ZodPromise:$e,ZodEffects:Be,ZodTransformer:Be,ZodOptional:Fe,ZodNullable:ze,ZodDefault:He,ZodCatch:Ve,ZodNaN:qe,BRAND:We,ZodBranded:Ke,ZodPipeline:Xe,ZodReadonly:Ge,custom:Ye,Schema:$,ZodSchema:$,late:Je,get ZodFirstPartyTypeKind(){return Qe},coerce:Rt,any:dt,array:ft,bigint:nt,boolean:st,date:it,discriminatedUnion:vt,effect:Dt,enum:kt,function:Tt,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>Ye((t=>t instanceof e),t),intersection:yt,lazy:Ot,literal:St,map:xt,nan:rt,nativeEnum:It,never:lt,null:ct,nullable:jt,number:tt,object:pt,oboolean:()=>st().optional(),onumber:()=>tt().optional(),optional:Et,ostring:()=>et().optional(),pipeline:Pt,preprocess:Nt,promise:Ct,record:bt,set:wt,strictObject:gt,string:et,symbol:at,transformer:Dt,tuple:_t,undefined:ot,union:mt,unknown:ut,void:ht,NEVER:At,ZodIssueCode:v,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:y});const Zt=Mt.object({version:Mt.literal("1",{message:"Version must be 1"}),name:Mt.string({invalid_type_error:"Name must be a string",required_error:"Name is required"}).max(32,{message:"Name must be 32 characters or less"}),homeUrl:Mt.string({invalid_type_error:"Home URL must be a string",required_error:"Home URL is required"}).max(512,{message:"Home URL must be 512 characters or less"}),iconUrl:Mt.string({invalid_type_error:"Icon URL must be a string",required_error:"Icon URL is required"}).max(512,{message:"Icon URL must be 512 characters or less"}),splashImageUrl:Mt.string({invalid_type_error:"Splash image URL must be a string"}).max(512,{message:"Splash image URL must be 512 characters or less"}).optional(),imageUrl:Mt.string({invalid_type_error:"Image URL must be a string",required_error:"Image URL is required"}).max(512,{message:"Splash image URL must be 512 characters or less"}),buttonTitle:Mt.string({invalid_type_error:"Button title must be a string",required_error:"Button title is required"}).max(32,{message:"Button title must be 32 characters or less"}),splashBackgroundColor:Mt.string({invalid_type_error:"Splash background color must be a string"}).regex(/^#[0-9A-Fa-f]{3,6}$/,{message:"Splash background color must be a valid hex color"}).optional(),webhookUrl:Mt.string({invalid_type_error:"Webhook URL must be a string"}).max(512,{message:"Webhook URL must be 512 characters or less"}).optional()}),Lt=Mt.discriminatedUnion("type",[Mt.object({type:Mt.literal("cast",{message:"Trigger type must be cast"}),id:Mt.string({required_error:"Trigger ID is required"}),url:Mt.string({required_error:"Trigger URL is required"}),name:Mt.string({invalid_type_error:"Trigger name must be a string"}).optional()}),Mt.object({type:Mt.literal("composer",{message:"Trigger type must be composer"}),id:Mt.string({invalid_type_error:"Trigger ID must be a string",required_error:"Trigger ID is required"}),url:Mt.string({invalid_type_error:"Trigger URL must be a string",required_error:"Trigger URL is required"}),name:Mt.string({invalid_type_error:"Trigger name must be a string"}).optional()})]),Ut=Mt.object({accountAssociation:Mt.object({header:Mt.string({invalid_type_error:"Header must be a string",required_error:"Header is required"}),payload:Mt.string({invalid_type_error:"Payload must be a string",required_error:"Payload is required"}),signature:Mt.string({invalid_type_error:"Signature must be a string",required_error:"Signature is required"})},{invalid_type_error:"Account association must be an object"}),frame:Zt,triggers:Mt.array(Lt,{invalid_type_error:"Triggers must be an array"}).optional()}),$t=window.ReactJSXRuntime,Bt=()=>{const{removeNotice:e}=(0,h.useDispatch)(l.store),t=(0,h.useSelect)((e=>e(l.store).getNotices()),[]);if(0===t.length)return null;const r=t.map((e=>({id:e.id,content:e.content})));return(0,$t.jsx)(c.NoticeList,{notices:r,onRemove:e})},Ft=window.wp.mediaUtils;function zt(e,t,...r){if("undefined"!=typeof process&&void 0===t)throw new Error("invariant requires an error message argument");if(!e){let e;if(void 0===t)e=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{let n=0;e=new Error(t.replace(/%s/g,(function(){return r[n++]}))),e.name="Invariant Violation"}throw e.framesToPop=1,e}}var Ht=r(2017);const Vt=window.React,qt="undefined"!=typeof window?Vt.useLayoutEffect:Vt.useEffect;function Wt(e,t,r){return function(e,t,r){const[n,s]=function(e,t,r){const[n,s]=(0,Vt.useState)((()=>t(e))),i=(0,Vt.useCallback)((()=>{const i=t(e);Ht(n,i)||(s(i),r&&r())}),[n,e,r]);return qt(i),[n,i]}(e,t,r);return qt((function(){const t=e.getHandlerId();if(null!=t)return e.subscribeToStateChange(s,{handlerIds:[t]})}),[e,s]),n}(t,e||(()=>({})),(()=>r.reconnect()))}function Kt(e,t){const r=[...t||[]];return null==t&&"function"!=typeof e&&r.push(e),(0,Vt.useMemo)((()=>"function"==typeof e?e():e),r)}function Xt(e){return(0,Vt.useMemo)((()=>e.hooks.dragSource()),[e])}function Gt(e){return(0,Vt.useMemo)((()=>e.hooks.dragPreview()),[e])}function Yt(e,t,r,n){let s=r?r.call(n,e,t):void 0;if(void 0!==s)return!!s;if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;const i=Object.keys(e),a=Object.keys(t);if(i.length!==a.length)return!1;const o=Object.prototype.hasOwnProperty.bind(t);for(let a=0;a<i.length;a++){const c=i[a];if(!o(c))return!1;const d=e[c],u=t[c];if(s=r?r.call(n,d,u,c):void 0,!1===s||void 0===s&&d!==u)return!1}return!0}function Jt(e){return null!==e&&"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"current")}function Qt(e){const t={};return Object.keys(e).forEach((r=>{const n=e[r];if(r.endsWith("Ref"))t[r]=e[r];else{const e=function(e){return(t=null,r=null)=>{if(!(0,Vt.isValidElement)(t)){const n=t;return e(n,r),n}const n=t;return function(e){if("string"==typeof e.type)return;const t=e.type.displayName||e.type.name||"the component";throw new Error(`Only native element nodes can now be passed to React DnD connectors.You can either wrap ${t} into a <div>, or turn it into a drag source or a drop target itself.`)}(n),function(e,t){const r=e.ref;return zt("string"!=typeof r,"Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"),r?(0,Vt.cloneElement)(e,{ref:e=>{er(r,e),er(t,e)}}):(0,Vt.cloneElement)(e,{ref:t})}(n,r?t=>e(t,r):e)}}(n);t[r]=()=>e}})),t}function er(e,t){"function"==typeof e?e(t):e.current=t}class tr{receiveHandlerId(e){this.handlerId!==e&&(this.handlerId=e,this.reconnect())}get connectTarget(){return this.dragSource}get dragSourceOptions(){return this.dragSourceOptionsInternal}set dragSourceOptions(e){this.dragSourceOptionsInternal=e}get dragPreviewOptions(){return this.dragPreviewOptionsInternal}set dragPreviewOptions(e){this.dragPreviewOptionsInternal=e}reconnect(){const e=this.reconnectDragSource();this.reconnectDragPreview(e)}reconnectDragSource(){const e=this.dragSource,t=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();return t&&this.disconnectDragSource(),this.handlerId?e?(t&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragSource=e,this.lastConnectedDragSourceOptions=this.dragSourceOptions,this.dragSourceUnsubscribe=this.backend.connectDragSource(this.handlerId,e,this.dragSourceOptions)),t):(this.lastConnectedDragSource=e,t):t}reconnectDragPreview(e=!1){const t=this.dragPreview,r=e||this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();r&&this.disconnectDragPreview(),this.handlerId&&(t?r&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragPreview=t,this.lastConnectedDragPreviewOptions=this.dragPreviewOptions,this.dragPreviewUnsubscribe=this.backend.connectDragPreview(this.handlerId,t,this.dragPreviewOptions)):this.lastConnectedDragPreview=t)}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didConnectedDragSourceChange(){return this.lastConnectedDragSource!==this.dragSource}didConnectedDragPreviewChange(){return this.lastConnectedDragPreview!==this.dragPreview}didDragSourceOptionsChange(){return!Yt(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}didDragPreviewOptionsChange(){return!Yt(this.lastConnectedDragPreviewOptions,this.dragPreviewOptions)}disconnectDragSource(){this.dragSourceUnsubscribe&&(this.dragSourceUnsubscribe(),this.dragSourceUnsubscribe=void 0)}disconnectDragPreview(){this.dragPreviewUnsubscribe&&(this.dragPreviewUnsubscribe(),this.dragPreviewUnsubscribe=void 0,this.dragPreviewNode=null,this.dragPreviewRef=null)}get dragSource(){return this.dragSourceNode||this.dragSourceRef&&this.dragSourceRef.current}get dragPreview(){return this.dragPreviewNode||this.dragPreviewRef&&this.dragPreviewRef.current}clearDragSource(){this.dragSourceNode=null,this.dragSourceRef=null}clearDragPreview(){this.dragPreviewNode=null,this.dragPreviewRef=null}constructor(e){this.hooks=Qt({dragSource:(e,t)=>{this.clearDragSource(),this.dragSourceOptions=t||null,Jt(e)?this.dragSourceRef=e:this.dragSourceNode=e,this.reconnectDragSource()},dragPreview:(e,t)=>{this.clearDragPreview(),this.dragPreviewOptions=t||null,Jt(e)?this.dragPreviewRef=e:this.dragPreviewNode=e,this.reconnectDragPreview()}}),this.handlerId=null,this.dragSourceRef=null,this.dragSourceOptionsInternal=null,this.dragPreviewRef=null,this.dragPreviewOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDragSource=null,this.lastConnectedDragSourceOptions=null,this.lastConnectedDragPreview=null,this.lastConnectedDragPreviewOptions=null,this.backend=e}}const rr=(0,Vt.createContext)({dragDropManager:void 0});function nr(){const{dragDropManager:e}=(0,Vt.useContext)(rr);return zt(null!=e,"Expected drag drop context"),e}let sr=!1,ir=!1;class ar{receiveHandlerId(e){this.sourceId=e}getHandlerId(){return this.sourceId}canDrag(){zt(!sr,"You may not call monitor.canDrag() inside your canDrag() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return sr=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{sr=!1}}isDragging(){if(!this.sourceId)return!1;zt(!ir,"You may not call monitor.isDragging() inside your isDragging() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return ir=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{ir=!1}}subscribeToStateChange(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}isDraggingSource(e){return this.internalMonitor.isDraggingSource(e)}isOverTarget(e,t){return this.internalMonitor.isOverTarget(e,t)}getTargetIds(){return this.internalMonitor.getTargetIds()}isSourcePublic(){return this.internalMonitor.isSourcePublic()}getSourceId(){return this.internalMonitor.getSourceId()}subscribeToOffsetChange(e){return this.internalMonitor.subscribeToOffsetChange(e)}canDragSource(e){return this.internalMonitor.canDragSource(e)}canDropOnTarget(e){return this.internalMonitor.canDropOnTarget(e)}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(e){this.sourceId=null,this.internalMonitor=e.getMonitor()}}class or{beginDrag(){const e=this.spec,t=this.monitor;let r=null;return r="object"==typeof e.item?e.item:"function"==typeof e.item?e.item(t):{},null!=r?r:null}canDrag(){const e=this.spec,t=this.monitor;return"boolean"==typeof e.canDrag?e.canDrag:"function"!=typeof e.canDrag||e.canDrag(t)}isDragging(e,t){const r=this.spec,n=this.monitor,{isDragging:s}=r;return s?s(n):t===e.getSourceId()}endDrag(){const e=this.spec,t=this.monitor,r=this.connector,{end:n}=e;n&&n(t.getItem(),t),r.reconnect()}constructor(e,t,r){this.spec=e,this.monitor=t,this.connector=r}}function cr(e,t){const r=Kt(e,t);zt(!r.begin,"useDrag::spec.begin was deprecated in v14. Replace spec.begin() with spec.item(). (see more here - https://react-dnd.github.io/react-dnd/docs/api/use-drag)");const n=function(){const e=nr();return(0,Vt.useMemo)((()=>new ar(e)),[e])}(),s=function(e,t){const r=nr(),n=(0,Vt.useMemo)((()=>new tr(r.getBackend())),[r]);return qt((()=>(n.dragSourceOptions=e||null,n.reconnect(),()=>n.disconnectDragSource())),[n,e]),qt((()=>(n.dragPreviewOptions=t||null,n.reconnect(),()=>n.disconnectDragPreview())),[n,t]),n}(r.options,r.previewOptions);return function(e,t,r){const n=nr(),s=function(e,t,r){const n=(0,Vt.useMemo)((()=>new or(e,t,r)),[t,r]);return(0,Vt.useEffect)((()=>{n.spec=e}),[e]),n}(e,t,r),i=function(e){return(0,Vt.useMemo)((()=>{const t=e.type;return zt(null!=t,"spec.type must be defined"),t}),[e])}(e);qt((function(){if(null!=i){const[e,a]=function(e,t,r){const n=r.getRegistry(),s=n.addSource(e,t);return[s,()=>n.removeSource(s)]}(i,s,n);return t.receiveHandlerId(e),r.receiveHandlerId(e),a}}),[n,t,r,s,i])}(r,n,s),[Wt(r.collect,n,s),Xt(s),Gt(s)]}function dr(e){return(0,Vt.useMemo)((()=>e.hooks.dropTarget()),[e])}class ur{get connectTarget(){return this.dropTarget}reconnect(){const e=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();e&&this.disconnectDropTarget();const t=this.dropTarget;this.handlerId&&(t?e&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=t,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,t,this.dropTargetOptions)):this.lastConnectedDropTarget=t)}receiveHandlerId(e){e!==this.handlerId&&(this.handlerId=e,this.reconnect())}get dropTargetOptions(){return this.dropTargetOptionsInternal}set dropTargetOptions(e){this.dropTargetOptionsInternal=e}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didDropTargetChange(){return this.lastConnectedDropTarget!==this.dropTarget}didOptionsChange(){return!Yt(this.lastConnectedDropTargetOptions,this.dropTargetOptions)}disconnectDropTarget(){this.unsubscribeDropTarget&&(this.unsubscribeDropTarget(),this.unsubscribeDropTarget=void 0)}get dropTarget(){return this.dropTargetNode||this.dropTargetRef&&this.dropTargetRef.current}clearDropTarget(){this.dropTargetRef=null,this.dropTargetNode=null}constructor(e){this.hooks=Qt({dropTarget:(e,t)=>{this.clearDropTarget(),this.dropTargetOptions=t,Jt(e)?this.dropTargetRef=e:this.dropTargetNode=e,this.reconnect()}}),this.handlerId=null,this.dropTargetRef=null,this.dropTargetOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDropTarget=null,this.lastConnectedDropTargetOptions=null,this.backend=e}}let lr=!1;class hr{receiveHandlerId(e){this.targetId=e}getHandlerId(){return this.targetId}subscribeToStateChange(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}canDrop(){if(!this.targetId)return!1;zt(!lr,"You may not call monitor.canDrop() inside your canDrop() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor");try{return lr=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{lr=!1}}isOver(e){return!!this.targetId&&this.internalMonitor.isOverTarget(this.targetId,e)}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(e){this.targetId=null,this.internalMonitor=e.getMonitor()}}class fr{canDrop(){const e=this.spec,t=this.monitor;return!e.canDrop||e.canDrop(t.getItem(),t)}hover(){const e=this.spec,t=this.monitor;e.hover&&e.hover(t.getItem(),t)}drop(){const e=this.spec,t=this.monitor;if(e.drop)return e.drop(t.getItem(),t)}constructor(e,t){this.spec=e,this.monitor=t}}function pr(e,t){const r=Kt(e,t),n=function(){const e=nr();return(0,Vt.useMemo)((()=>new hr(e)),[e])}(),s=function(e){const t=nr(),r=(0,Vt.useMemo)((()=>new ur(t.getBackend())),[t]);return qt((()=>(r.dropTargetOptions=e||null,r.reconnect(),()=>r.disconnectDropTarget())),[e]),r}(r.options);return function(e,t,r){const n=nr(),s=function(e,t){const r=(0,Vt.useMemo)((()=>new fr(e,t)),[t]);return(0,Vt.useEffect)((()=>{r.spec=e}),[e]),r}(e,t),i=function(e){const{accept:t}=e;return(0,Vt.useMemo)((()=>(zt(null!=e.accept,"accept must be defined"),Array.isArray(t)?t:[t])),[t])}(e);qt((function(){const[e,a]=function(e,t,r){const n=r.getRegistry(),s=n.addTarget(e,t);return[s,()=>n.removeTarget(s)]}(i,s,n);return t.receiveHandlerId(e),r.receiveHandlerId(e),a}),[n,t,s,r,i.map((e=>e.toString())).join("|")])}(r,n,s),[Wt(r.collect,n,s),dr(s)]}function gr(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var mr="function"==typeof Symbol&&Symbol.observable||"@@observable",vr=function(){return Math.random().toString(36).substring(7).split("").join(".")},yr={INIT:"@@redux/INIT"+vr(),REPLACE:"@@redux/REPLACE"+vr(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+vr()}};function _r(e,t,r){var n;if("function"==typeof t&&"function"==typeof r||"function"==typeof r&&"function"==typeof arguments[3])throw new Error(gr(0));if("function"==typeof t&&void 0===r&&(r=t,t=void 0),void 0!==r){if("function"!=typeof r)throw new Error(gr(1));return r(_r)(e,t)}if("function"!=typeof e)throw new Error(gr(2));var s=e,i=t,a=[],o=a,c=!1;function d(){o===a&&(o=a.slice())}function u(){if(c)throw new Error(gr(3));return i}function l(e){if("function"!=typeof e)throw new Error(gr(4));if(c)throw new Error(gr(5));var t=!0;return d(),o.push(e),function(){if(t){if(c)throw new Error(gr(6));t=!1,d();var r=o.indexOf(e);o.splice(r,1),a=null}}}function h(e){if(!function(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}(e))throw new Error(gr(7));if(void 0===e.type)throw new Error(gr(8));if(c)throw new Error(gr(9));try{c=!0,i=s(i,e)}finally{c=!1}for(var t=a=o,r=0;r<t.length;r++)(0,t[r])();return e}return h({type:yr.INIT}),(n={dispatch:h,subscribe:l,getState:u,replaceReducer:function(e){if("function"!=typeof e)throw new Error(gr(10));s=e,h({type:yr.REPLACE})}})[mr]=function(){var e,t=l;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(gr(11));function r(){e.next&&e.next(u())}return r(),{unsubscribe:t(r)}}})[mr]=function(){return this},e},n}function br(e){return"object"==typeof e}const xr="dnd-core/INIT_COORDS",wr="dnd-core/BEGIN_DRAG",Tr="dnd-core/PUBLISH_DRAG_SOURCE",Or="dnd-core/HOVER",Sr="dnd-core/DROP",kr="dnd-core/END_DRAG";function Ir(e,t){return{type:xr,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}const Cr={type:xr,payload:{clientOffset:null,sourceClientOffset:null}};function Dr(e){return function(t=[],r={publishSource:!0}){const{publishSource:n=!0,clientOffset:s,getSourceClientOffset:i}=r,a=e.getMonitor(),o=e.getRegistry();e.dispatch(Ir(s)),function(e,t,r){zt(!t.isDragging(),"Cannot call beginDrag while dragging."),e.forEach((function(e){zt(r.getSource(e),"Expected sourceIds to be registered.")}))}(t,a,o);const c=function(e,t){let r=null;for(let n=e.length-1;n>=0;n--)if(t.canDragSource(e[n])){r=e[n];break}return r}(t,a);if(null==c)return void e.dispatch(Cr);let d=null;if(s){if(!i)throw new Error("getSourceClientOffset must be defined");!function(e){zt("function"==typeof e,"When clientOffset is provided, getSourceClientOffset must be a function.")}(i),d=i(c)}e.dispatch(Ir(s,d));const u=o.getSource(c).beginDrag(a,c);if(null==u)return;!function(e){zt(br(e),"Item must be an object.")}(u),o.pinSource(c);const l=o.getSourceType(c);return{type:wr,payload:{itemType:l,item:u,sourceId:c,clientOffset:s||null,sourceClientOffset:d||null,isSourcePublic:!!n}}}}function Er(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function jr(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){Er(e,t,r[t])}))}return e}function Nr(e){return function(t={}){const r=e.getMonitor(),n=e.getRegistry();!function(e){zt(e.isDragging(),"Cannot call drop while not dragging."),zt(!e.didDrop(),"Cannot call drop twice during one drag operation.")}(r);const s=function(e){const t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}(r);s.forEach(((s,i)=>{const a=function(e,t,r,n){const s=r.getTarget(e);let i=s?s.drop(n,e):void 0;return function(e){zt(void 0===e||br(e),"Drop result must either be an object or undefined.")}(i),void 0===i&&(i=0===t?{}:n.getDropResult()),i}(s,i,n,r),o={type:Sr,payload:{dropResult:jr({},t,a)}};e.dispatch(o)}))}}function Pr(e){return function(){const t=e.getMonitor(),r=e.getRegistry();!function(e){zt(e.isDragging(),"Cannot call endDrag while not dragging.")}(t);const n=t.getSourceId();return null!=n&&(r.getSource(n,!0).endDrag(t,n),r.unpinSource()),{type:kr}}}function Rr(e,t){return null===t?null===e:Array.isArray(e)?e.some((e=>e===t)):e===t}function Ar(e){return function(t,{clientOffset:r}={}){!function(e){zt(Array.isArray(e),"Expected targetIds to be an array.")}(t);const n=t.slice(0),s=e.getMonitor(),i=e.getRegistry();return function(e,t,r){for(let n=e.length-1;n>=0;n--){const s=e[n];Rr(t.getTargetType(s),r)||e.splice(n,1)}}(n,i,s.getItemType()),function(e,t,r){zt(t.isDragging(),"Cannot call hover while not dragging."),zt(!t.didDrop(),"Cannot call hover after drop.");for(let t=0;t<e.length;t++){const n=e[t];zt(e.lastIndexOf(n)===t,"Expected targetIds to be unique in the passed array."),zt(r.getTarget(n),"Expected targetIds to be registered.")}}(n,s,i),function(e,t,r){e.forEach((function(e){r.getTarget(e).hover(t,e)}))}(n,s,i),{type:Or,payload:{targetIds:n,clientOffset:r||null}}}}function Mr(e){return function(){if(e.getMonitor().isDragging())return{type:Tr}}}class Zr{receiveBackend(e){this.backend=e}getMonitor(){return this.monitor}getBackend(){return this.backend}getRegistry(){return this.monitor.registry}getActions(){const e=this,{dispatch:t}=this.store,r=function(e){return{beginDrag:Dr(e),publishDragSource:Mr(e),hover:Ar(e),drop:Nr(e),endDrag:Pr(e)}}(this);return Object.keys(r).reduce(((n,s)=>{const i=r[s];var a;return n[s]=(a=i,(...r)=>{const n=a.apply(e,r);void 0!==n&&t(n)}),n}),{})}dispatch(e){this.store.dispatch(e)}constructor(e,t){this.isSetUp=!1,this.handleRefCountChange=()=>{const e=this.store.getState().refCount>0;this.backend&&(e&&!this.isSetUp?(this.backend.setup(),this.isSetUp=!0):!e&&this.isSetUp&&(this.backend.teardown(),this.isSetUp=!1))},this.store=e,this.monitor=t,e.subscribe(this.handleRefCountChange)}}function Lr(e,t){return{x:e.x-t.x,y:e.y-t.y}}const Ur=[],$r=[];Ur.__IS_NONE__=!0,$r.__IS_ALL__=!0;class Br{subscribeToStateChange(e,t={}){const{handlerIds:r}=t;zt("function"==typeof e,"listener must be a function."),zt(void 0===r||Array.isArray(r),"handlerIds, when specified, must be an array of strings.");let n=this.store.getState().stateId;return this.store.subscribe((()=>{const t=this.store.getState(),s=t.stateId;try{const i=s===n||s===n+1&&!function(e,t){return e!==Ur&&(e===$r||void 0===t||(r=e,t.filter((e=>r.indexOf(e)>-1))).length>0);var r}(t.dirtyHandlerIds,r);i||e()}finally{n=s}}))}subscribeToOffsetChange(e){zt("function"==typeof e,"listener must be a function.");let t=this.store.getState().dragOffset;return this.store.subscribe((()=>{const r=this.store.getState().dragOffset;r!==t&&(t=r,e())}))}canDragSource(e){if(!e)return!1;const t=this.registry.getSource(e);return zt(t,`Expected to find a valid source. sourceId=${e}`),!this.isDragging()&&t.canDrag(this,e)}canDropOnTarget(e){if(!e)return!1;const t=this.registry.getTarget(e);return zt(t,`Expected to find a valid target. targetId=${e}`),!(!this.isDragging()||this.didDrop())&&(Rr(this.registry.getTargetType(e),this.getItemType())&&t.canDrop(this,e))}isDragging(){return Boolean(this.getItemType())}isDraggingSource(e){if(!e)return!1;const t=this.registry.getSource(e,!0);return zt(t,`Expected to find a valid source. sourceId=${e}`),!(!this.isDragging()||!this.isSourcePublic())&&(this.registry.getSourceType(e)===this.getItemType()&&t.isDragging(this,e))}isOverTarget(e,t={shallow:!1}){if(!e)return!1;const{shallow:r}=t;if(!this.isDragging())return!1;const n=this.registry.getTargetType(e),s=this.getItemType();if(s&&!Rr(n,s))return!1;const i=this.getTargetIds();if(!i.length)return!1;const a=i.indexOf(e);return r?a===i.length-1:a>-1}getItemType(){return this.store.getState().dragOperation.itemType}getItem(){return this.store.getState().dragOperation.item}getSourceId(){return this.store.getState().dragOperation.sourceId}getTargetIds(){return this.store.getState().dragOperation.targetIds}getDropResult(){return this.store.getState().dragOperation.dropResult}didDrop(){return this.store.getState().dragOperation.didDrop}isSourcePublic(){return Boolean(this.store.getState().dragOperation.isSourcePublic)}getInitialClientOffset(){return this.store.getState().dragOffset.initialClientOffset}getInitialSourceClientOffset(){return this.store.getState().dragOffset.initialSourceClientOffset}getClientOffset(){return this.store.getState().dragOffset.clientOffset}getSourceClientOffset(){return function(e){const{clientOffset:t,initialClientOffset:r,initialSourceClientOffset:n}=e;return t&&r&&n?Lr((i=n,{x:(s=t).x+i.x,y:s.y+i.y}),r):null;var s,i}(this.store.getState().dragOffset)}getDifferenceFromInitialOffset(){return function(e){const{clientOffset:t,initialClientOffset:r}=e;return t&&r?Lr(t,r):null}(this.store.getState().dragOffset)}constructor(e,t){this.store=e,this.registry=t}}const Fr="undefined"!=typeof global?global:self,zr=Fr.MutationObserver||Fr.WebKitMutationObserver;function Hr(e){return function(){const t=setTimeout(n,0),r=setInterval(n,50);function n(){clearTimeout(t),clearInterval(r),e()}}}const Vr="function"==typeof zr?function(e){let t=1;const r=new zr(e),n=document.createTextNode("");return r.observe(n,{characterData:!0}),function(){t=-t,n.data=t}}:Hr;class qr{call(){try{this.task&&this.task()}catch(e){this.onError(e)}finally{this.task=null,this.release(this)}}constructor(e,t){this.onError=e,this.release=t,this.task=null}}const Wr=new class{enqueueTask(e){const{queue:t,requestFlush:r}=this;t.length||(r(),this.flushing=!0),t[t.length]=e}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{const{queue:e}=this;for(;this.index<e.length;){const t=this.index;if(this.index++,e[t].call(),this.index>this.capacity){for(let t=0,r=e.length-this.index;t<r;t++)e[t]=e[t+this.index];e.length-=this.index,this.index=0}}e.length=0,this.index=0,this.flushing=!1},this.registerPendingError=e=>{this.pendingErrors.push(e),this.requestErrorThrow()},this.requestFlush=Vr(this.flush),this.requestErrorThrow=Hr((()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()}))}},Kr=new class{create(e){const t=this.freeTasks,r=t.length?t.pop():new qr(this.onError,(e=>t[t.length]=e));return r.task=e,r}constructor(e){this.onError=e,this.freeTasks=[]}}(Wr.registerPendingError),Xr="dnd-core/ADD_SOURCE",Gr="dnd-core/ADD_TARGET",Yr="dnd-core/REMOVE_SOURCE",Jr="dnd-core/REMOVE_TARGET";function Qr(e,t){t&&Array.isArray(e)?e.forEach((e=>Qr(e,!1))):zt("string"==typeof e||"symbol"==typeof e,t?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}var en;!function(e){e.SOURCE="SOURCE",e.TARGET="TARGET"}(en||(en={}));let tn=0;function rn(e){switch(e[0]){case"S":return en.SOURCE;case"T":return en.TARGET;default:throw new Error(`Cannot parse handler ID: ${e}`)}}function nn(e,t){const r=e.entries();let n=!1;do{const{done:e,value:[,s]}=r.next();if(s===t)return!0;n=!!e}while(!n);return!1}class sn{addSource(e,t){Qr(e),function(e){zt("function"==typeof e.canDrag,"Expected canDrag to be a function."),zt("function"==typeof e.beginDrag,"Expected beginDrag to be a function."),zt("function"==typeof e.endDrag,"Expected endDrag to be a function.")}(t);const r=this.addHandler(en.SOURCE,e,t);return this.store.dispatch(function(e){return{type:Xr,payload:{sourceId:e}}}(r)),r}addTarget(e,t){Qr(e,!0),function(e){zt("function"==typeof e.canDrop,"Expected canDrop to be a function."),zt("function"==typeof e.hover,"Expected hover to be a function."),zt("function"==typeof e.drop,"Expected beginDrag to be a function.")}(t);const r=this.addHandler(en.TARGET,e,t);return this.store.dispatch(function(e){return{type:Gr,payload:{targetId:e}}}(r)),r}containsHandler(e){return nn(this.dragSources,e)||nn(this.dropTargets,e)}getSource(e,t=!1){return zt(this.isSourceId(e),"Expected a valid source ID."),t&&e===this.pinnedSourceId?this.pinnedSource:this.dragSources.get(e)}getTarget(e){return zt(this.isTargetId(e),"Expected a valid target ID."),this.dropTargets.get(e)}getSourceType(e){return zt(this.isSourceId(e),"Expected a valid source ID."),this.types.get(e)}getTargetType(e){return zt(this.isTargetId(e),"Expected a valid target ID."),this.types.get(e)}isSourceId(e){return rn(e)===en.SOURCE}isTargetId(e){return rn(e)===en.TARGET}removeSource(e){var t;zt(this.getSource(e),"Expected an existing source."),this.store.dispatch(function(e){return{type:Yr,payload:{sourceId:e}}}(e)),t=()=>{this.dragSources.delete(e),this.types.delete(e)},Wr.enqueueTask(Kr.create(t))}removeTarget(e){zt(this.getTarget(e),"Expected an existing target."),this.store.dispatch(function(e){return{type:Jr,payload:{targetId:e}}}(e)),this.dropTargets.delete(e),this.types.delete(e)}pinSource(e){const t=this.getSource(e);zt(t,"Expected an existing source."),this.pinnedSourceId=e,this.pinnedSource=t}unpinSource(){zt(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}addHandler(e,t,r){const n=function(e){const t=(tn++).toString();switch(e){case en.SOURCE:return`S${t}`;case en.TARGET:return`T${t}`;default:throw new Error(`Unknown Handler Role: ${e}`)}}(e);return this.types.set(n,t),e===en.SOURCE?this.dragSources.set(n,r):e===en.TARGET&&this.dropTargets.set(n,r),n}constructor(e){this.types=new Map,this.dragSources=new Map,this.dropTargets=new Map,this.pinnedSourceId=null,this.pinnedSource=null,this.store=e}}const an=(e,t)=>e===t;function on(e=Ur,t){switch(t.type){case Or:break;case Xr:case Gr:case Jr:case Yr:return Ur;default:return $r}const{targetIds:r=[],prevTargetIds:n=[]}=t.payload,s=function(e,t){const r=new Map,n=e=>{r.set(e,r.has(e)?r.get(e)+1:1)};e.forEach(n),t.forEach(n);const s=[];return r.forEach(((e,t)=>{1===e&&s.push(t)})),s}(r,n);if(!(s.length>0)&&function(e,t,r=an){if(e.length!==t.length)return!1;for(let n=0;n<e.length;++n)if(!r(e[n],t[n]))return!1;return!0}(r,n))return Ur;const i=n[n.length-1],a=r[r.length-1];return i!==a&&(i&&s.push(i),a&&s.push(a)),s}function cn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const dn={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function un(e=dn,t){const{payload:r}=t;switch(t.type){case xr:case wr:return{initialSourceClientOffset:r.sourceClientOffset,initialClientOffset:r.clientOffset,clientOffset:r.clientOffset};case Or:return n=e.clientOffset,s=r.clientOffset,!n&&!s||n&&s&&n.x===s.x&&n.y===s.y?e:function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){cn(e,t,r[t])}))}return e}({},e,{clientOffset:r.clientOffset});case kr:case Sr:return dn;default:return e}var n,s}function ln(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function hn(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){ln(e,t,r[t])}))}return e}const fn={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function pn(e=fn,t){const{payload:r}=t;switch(t.type){case wr:return hn({},e,{itemType:r.itemType,item:r.item,sourceId:r.sourceId,isSourcePublic:r.isSourcePublic,dropResult:null,didDrop:!1});case Tr:return hn({},e,{isSourcePublic:!0});case Or:return hn({},e,{targetIds:r.targetIds});case Jr:return-1===e.targetIds.indexOf(r.targetId)?e:hn({},e,{targetIds:(n=e.targetIds,s=r.targetId,n.filter((e=>e!==s)))});case Sr:return hn({},e,{dropResult:r.dropResult,didDrop:!0,targetIds:[]});case kr:return hn({},e,{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}var n,s}function gn(e=0,t){switch(t.type){case Xr:case Gr:return e+1;case Yr:case Jr:return e-1;default:return e}}function mn(e=0){return e+1}function vn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function yn(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){vn(e,t,r[t])}))}return e}function bn(e={},t){return{dirtyHandlerIds:on(e.dirtyHandlerIds,{type:t.type,payload:yn({},t.payload,{prevTargetIds:(r=e,n=[],"dragOperation.targetIds".split(".").reduce(((e,t)=>e&&e[t]?e[t]:n||null),r))})}),dragOffset:un(e.dragOffset,t),refCount:gn(e.refCount,t),dragOperation:pn(e.dragOperation,t),stateId:mn(e.stateId)};var r,n}function xn(e,t=void 0,r={},n=!1){const s=function(e){const t="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__;return _r(bn,e&&t&&t({name:"dnd-core",instanceId:"dnd-core"}))}(n),i=new Br(s,new sn(s)),a=new Zr(s,i),o=e(a,t,r);return a.receiveBackend(o),a}let wn=0;const Tn=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__");var On=(0,Vt.memo)((function(e){var{children:t}=e,r=function(e,t){if(null==e)return{};var r,n,s=function(e,t){if(null==e)return{};var r,n,s={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(s[r]=e[r]);return s}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}(e,["children"]);const[n,s]=function(e){if("manager"in e)return[{dragDropManager:e.manager},!1];return[function(e,t=Sn(),r,n){const s=t;return s[Tn]||(s[Tn]={dragDropManager:xn(e,t,r,n)}),s[Tn]}(e.backend,e.context,e.options,e.debugMode),!e.context]}(r);return(0,Vt.useEffect)((()=>{if(s){const e=Sn();return++wn,()=>{0==--wn&&(e[Tn]=null)}}}),[]),(0,$t.jsx)(rr.Provider,{value:n,children:t})}));function Sn(){return"undefined"!=typeof global?global:window}function kn(e){let t=null;return()=>(null==t&&(t=e()),t)}class In{enter(e){const t=this.entered.length;return this.entered=function(e,t){const r=new Set,n=e=>r.add(e);e.forEach(n),t.forEach(n);const s=[];return r.forEach((e=>s.push(e))),s}(this.entered.filter((t=>this.isNodeInDocument(t)&&(!t.contains||t.contains(e)))),[e]),0===t&&this.entered.length>0}leave(e){const t=this.entered.length;var r,n;return this.entered=(r=this.entered.filter(this.isNodeInDocument),n=e,r.filter((e=>e!==n))),t>0&&0===this.entered.length}reset(){this.entered=[]}constructor(e){this.entered=[],this.isNodeInDocument=e}}class Cn{initializeExposedProperties(){Object.keys(this.config.exposeProperties).forEach((e=>{Object.defineProperty(this.item,e,{configurable:!0,enumerable:!0,get:()=>(console.warn(`Browser doesn't allow reading "${e}" until the drop event.`),null)})}))}loadDataTransfer(e){if(e){const t={};Object.keys(this.config.exposeProperties).forEach((r=>{const n=this.config.exposeProperties[r];null!=n&&(t[r]={value:n(e,this.config.matchesTypes),configurable:!0,enumerable:!0})})),Object.defineProperties(this.item,t)}}canDrag(){return!0}beginDrag(){return this.item}isDragging(e,t){return t===e.getSourceId()}endDrag(){}constructor(e){this.config=e,this.item={},this.initializeExposedProperties()}}const Dn="__NATIVE_FILE__",En="__NATIVE_URL__",jn="__NATIVE_TEXT__",Nn="__NATIVE_HTML__";function Pn(e,t,r){const n=t.reduce(((t,r)=>t||e.getData(r)),"");return null!=n?n:r}const Rn={[Dn]:{exposeProperties:{files:e=>Array.prototype.slice.call(e.files),items:e=>e.items,dataTransfer:e=>e},matchesTypes:["Files"]},[Nn]:{exposeProperties:{html:(e,t)=>Pn(e,t,""),dataTransfer:e=>e},matchesTypes:["Html","text/html"]},[En]:{exposeProperties:{urls:(e,t)=>Pn(e,t,"").split("\n"),dataTransfer:e=>e},matchesTypes:["Url","text/uri-list"]},[jn]:{exposeProperties:{text:(e,t)=>Pn(e,t,""),dataTransfer:e=>e},matchesTypes:["Text","text/plain"]}};function An(e){if(!e)return null;const t=Array.prototype.slice.call(e.types||[]);return Object.keys(Rn).filter((e=>{const r=Rn[e];return!!(null==r?void 0:r.matchesTypes)&&r.matchesTypes.some((e=>t.indexOf(e)>-1))}))[0]||null}const Mn=kn((()=>/firefox/i.test(navigator.userAgent))),Zn=kn((()=>Boolean(window.safari)));class Ln{interpolate(e){const{xs:t,ys:r,c1s:n,c2s:s,c3s:i}=this;let a=t.length-1;if(e===t[a])return r[a];let o,c=0,d=i.length-1;for(;c<=d;){o=Math.floor(.5*(c+d));const n=t[o];if(n<e)c=o+1;else{if(!(n>e))return r[o];d=o-1}}a=Math.max(0,d);const u=e-t[a],l=u*u;return r[a]+n[a]*u+s[a]*l+i[a]*u*l}constructor(e,t){const{length:r}=e,n=[];for(let e=0;e<r;e++)n.push(e);n.sort(((t,r)=>e[t]<e[r]?-1:1));const s=[],i=[],a=[];let o,c;for(let n=0;n<r-1;n++)o=e[n+1]-e[n],c=t[n+1]-t[n],i.push(o),s.push(c),a.push(c/o);const d=[a[0]];for(let e=0;e<i.length-1;e++){const t=a[e],r=a[e+1];if(t*r<=0)d.push(0);else{o=i[e];const n=i[e+1],s=o+n;d.push(3*s/((s+n)/t+(s+o)/r))}}d.push(a[a.length-1]);const u=[],l=[];let h;for(let e=0;e<d.length-1;e++){h=a[e];const t=d[e],r=1/i[e],n=t+d[e+1]-h-h;u.push((h-t-n)*r),l.push(n*r*r)}this.xs=e,this.ys=t,this.c1s=d,this.c2s=u,this.c3s=l}}function Un(e){const t=1===e.nodeType?e:e.parentElement;if(!t)return null;const{top:r,left:n}=t.getBoundingClientRect();return{x:n,y:r}}function $n(e){return{x:e.clientX,y:e.clientY}}class Bn{get window(){return this.globalContext?this.globalContext:"undefined"!=typeof window?window:void 0}get document(){var e;return(null===(e=this.globalContext)||void 0===e?void 0:e.document)?this.globalContext.document:this.window?this.window.document:void 0}get rootElement(){var e;return(null===(e=this.optionsArgs)||void 0===e?void 0:e.rootElement)||this.window}constructor(e,t){this.ownerDocument=null,this.globalContext=e,this.optionsArgs=t}}function Fn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function zn(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){Fn(e,t,r[t])}))}return e}class Hn{profile(){var e,t;return{sourcePreviewNodes:this.sourcePreviewNodes.size,sourcePreviewNodeOptions:this.sourcePreviewNodeOptions.size,sourceNodeOptions:this.sourceNodeOptions.size,sourceNodes:this.sourceNodes.size,dragStartSourceIds:(null===(e=this.dragStartSourceIds)||void 0===e?void 0:e.length)||0,dropTargetIds:this.dropTargetIds.length,dragEnterTargetIds:this.dragEnterTargetIds.length,dragOverTargetIds:(null===(t=this.dragOverTargetIds)||void 0===t?void 0:t.length)||0}}get window(){return this.options.window}get document(){return this.options.document}get rootElement(){return this.options.rootElement}setup(){const e=this.rootElement;if(void 0!==e){if(e.__isReactDndBackendSetUp)throw new Error("Cannot have two HTML5 backends at the same time.");e.__isReactDndBackendSetUp=!0,this.addEventListeners(e)}}teardown(){const e=this.rootElement;var t;void 0!==e&&(e.__isReactDndBackendSetUp=!1,this.removeEventListeners(this.rootElement),this.clearCurrentDragSourceNode(),this.asyncEndDragFrameId&&(null===(t=this.window)||void 0===t||t.cancelAnimationFrame(this.asyncEndDragFrameId)))}connectDragPreview(e,t,r){return this.sourcePreviewNodeOptions.set(e,r),this.sourcePreviewNodes.set(e,t),()=>{this.sourcePreviewNodes.delete(e),this.sourcePreviewNodeOptions.delete(e)}}connectDragSource(e,t,r){this.sourceNodes.set(e,t),this.sourceNodeOptions.set(e,r);const n=t=>this.handleDragStart(t,e),s=e=>this.handleSelectStart(e);return t.setAttribute("draggable","true"),t.addEventListener("dragstart",n),t.addEventListener("selectstart",s),()=>{this.sourceNodes.delete(e),this.sourceNodeOptions.delete(e),t.removeEventListener("dragstart",n),t.removeEventListener("selectstart",s),t.setAttribute("draggable","false")}}connectDropTarget(e,t){const r=t=>this.handleDragEnter(t,e),n=t=>this.handleDragOver(t,e),s=t=>this.handleDrop(t,e);return t.addEventListener("dragenter",r),t.addEventListener("dragover",n),t.addEventListener("drop",s),()=>{t.removeEventListener("dragenter",r),t.removeEventListener("dragover",n),t.removeEventListener("drop",s)}}addEventListeners(e){e.addEventListener&&(e.addEventListener("dragstart",this.handleTopDragStart),e.addEventListener("dragstart",this.handleTopDragStartCapture,!0),e.addEventListener("dragend",this.handleTopDragEndCapture,!0),e.addEventListener("dragenter",this.handleTopDragEnter),e.addEventListener("dragenter",this.handleTopDragEnterCapture,!0),e.addEventListener("dragleave",this.handleTopDragLeaveCapture,!0),e.addEventListener("dragover",this.handleTopDragOver),e.addEventListener("dragover",this.handleTopDragOverCapture,!0),e.addEventListener("drop",this.handleTopDrop),e.addEventListener("drop",this.handleTopDropCapture,!0))}removeEventListeners(e){e.removeEventListener&&(e.removeEventListener("dragstart",this.handleTopDragStart),e.removeEventListener("dragstart",this.handleTopDragStartCapture,!0),e.removeEventListener("dragend",this.handleTopDragEndCapture,!0),e.removeEventListener("dragenter",this.handleTopDragEnter),e.removeEventListener("dragenter",this.handleTopDragEnterCapture,!0),e.removeEventListener("dragleave",this.handleTopDragLeaveCapture,!0),e.removeEventListener("dragover",this.handleTopDragOver),e.removeEventListener("dragover",this.handleTopDragOverCapture,!0),e.removeEventListener("drop",this.handleTopDrop),e.removeEventListener("drop",this.handleTopDropCapture,!0))}getCurrentSourceNodeOptions(){const e=this.monitor.getSourceId(),t=this.sourceNodeOptions.get(e);return zn({dropEffect:this.altKeyPressed?"copy":"move"},t||{})}getCurrentDropEffect(){return this.isDraggingNativeItem()?"copy":this.getCurrentSourceNodeOptions().dropEffect}getCurrentSourcePreviewNodeOptions(){const e=this.monitor.getSourceId();return zn({anchorX:.5,anchorY:.5,captureDraggingState:!1},this.sourcePreviewNodeOptions.get(e)||{})}isDraggingNativeItem(){const e=this.monitor.getItemType();return Object.keys(n).some((t=>n[t]===e))}beginDragNativeItem(e,t){this.clearCurrentDragSourceNode(),this.currentNativeSource=function(e,t){const r=Rn[e];if(!r)throw new Error(`native type ${e} has no configuration`);const n=new Cn(r);return n.loadDataTransfer(t),n}(e,t),this.currentNativeHandle=this.registry.addSource(e,this.currentNativeSource),this.actions.beginDrag([this.currentNativeHandle])}setCurrentDragSourceNode(e){this.clearCurrentDragSourceNode(),this.currentDragSourceNode=e,this.mouseMoveTimeoutTimer=setTimeout((()=>{var e;return null===(e=this.rootElement)||void 0===e?void 0:e.addEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)}),1e3)}clearCurrentDragSourceNode(){var e;return!!this.currentDragSourceNode&&(this.currentDragSourceNode=null,this.rootElement&&(null===(e=this.window)||void 0===e||e.clearTimeout(this.mouseMoveTimeoutTimer||void 0),this.rootElement.removeEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)),this.mouseMoveTimeoutTimer=null,!0)}handleDragStart(e,t){e.defaultPrevented||(this.dragStartSourceIds||(this.dragStartSourceIds=[]),this.dragStartSourceIds.unshift(t))}handleDragEnter(e,t){this.dragEnterTargetIds.unshift(t)}handleDragOver(e,t){null===this.dragOverTargetIds&&(this.dragOverTargetIds=[]),this.dragOverTargetIds.unshift(t)}handleDrop(e,t){this.dropTargetIds.unshift(t)}constructor(e,t,r){this.sourcePreviewNodes=new Map,this.sourcePreviewNodeOptions=new Map,this.sourceNodes=new Map,this.sourceNodeOptions=new Map,this.dragStartSourceIds=null,this.dropTargetIds=[],this.dragEnterTargetIds=[],this.currentNativeSource=null,this.currentNativeHandle=null,this.currentDragSourceNode=null,this.altKeyPressed=!1,this.mouseMoveTimeoutTimer=null,this.asyncEndDragFrameId=null,this.dragOverTargetIds=null,this.lastClientOffset=null,this.hoverRafId=null,this.getSourceClientOffset=e=>{const t=this.sourceNodes.get(e);return t&&Un(t)||null},this.endDragNativeItem=()=>{this.isDraggingNativeItem()&&(this.actions.endDrag(),this.currentNativeHandle&&this.registry.removeSource(this.currentNativeHandle),this.currentNativeHandle=null,this.currentNativeSource=null)},this.isNodeInDocument=e=>Boolean(e&&this.document&&this.document.body&&this.document.body.contains(e)),this.endDragIfSourceWasRemovedFromDOM=()=>{const e=this.currentDragSourceNode;null==e||this.isNodeInDocument(e)||(this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover())},this.scheduleHover=e=>{null===this.hoverRafId&&"undefined"!=typeof requestAnimationFrame&&(this.hoverRafId=requestAnimationFrame((()=>{this.monitor.isDragging()&&this.actions.hover(e||[],{clientOffset:this.lastClientOffset}),this.hoverRafId=null})))},this.cancelHover=()=>{null!==this.hoverRafId&&"undefined"!=typeof cancelAnimationFrame&&(cancelAnimationFrame(this.hoverRafId),this.hoverRafId=null)},this.handleTopDragStartCapture=()=>{this.clearCurrentDragSourceNode(),this.dragStartSourceIds=[]},this.handleTopDragStart=e=>{if(e.defaultPrevented)return;const{dragStartSourceIds:t}=this;this.dragStartSourceIds=null;const r=$n(e);this.monitor.isDragging()&&(this.actions.endDrag(),this.cancelHover()),this.actions.beginDrag(t||[],{publishSource:!1,getSourceClientOffset:this.getSourceClientOffset,clientOffset:r});const{dataTransfer:n}=e,s=An(n);if(this.monitor.isDragging()){if(n&&"function"==typeof n.setDragImage){const e=this.monitor.getSourceId(),t=this.sourceNodes.get(e),s=this.sourcePreviewNodes.get(e)||t;if(s){const{anchorX:e,anchorY:i,offsetX:a,offsetY:o}=this.getCurrentSourcePreviewNodeOptions(),c=function(e,t,r,n,s){const i="IMG"===(a=t).nodeName&&(Mn()||!(null===(o=document.documentElement)||void 0===o?void 0:o.contains(a)));var a,o;const c=Un(i?e:t),d={x:r.x-c.x,y:r.y-c.y},{offsetWidth:u,offsetHeight:l}=e,{anchorX:h,anchorY:f}=n,{dragPreviewWidth:p,dragPreviewHeight:g}=function(e,t,r,n){let s=e?t.width:r,i=e?t.height:n;return Zn()&&e&&(i/=window.devicePixelRatio,s/=window.devicePixelRatio),{dragPreviewWidth:s,dragPreviewHeight:i}}(i,t,u,l),{offsetX:m,offsetY:v}=s,y=0===v||v;return{x:0===m||m?m:new Ln([0,.5,1],[d.x,d.x/u*p,d.x+p-u]).interpolate(h),y:y?v:(()=>{let e=new Ln([0,.5,1],[d.y,d.y/l*g,d.y+g-l]).interpolate(f);return Zn()&&i&&(e+=(window.devicePixelRatio-1)*g),e})()}}(t,s,r,{anchorX:e,anchorY:i},{offsetX:a,offsetY:o});n.setDragImage(s,c.x,c.y)}}try{null==n||n.setData("application/json",{})}catch(e){}this.setCurrentDragSourceNode(e.target);const{captureDraggingState:t}=this.getCurrentSourcePreviewNodeOptions();t?this.actions.publishDragSource():setTimeout((()=>this.actions.publishDragSource()),0)}else if(s)this.beginDragNativeItem(s);else{if(n&&!n.types&&(e.target&&!e.target.hasAttribute||!e.target.hasAttribute("draggable")))return;e.preventDefault()}},this.handleTopDragEndCapture=()=>{this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleTopDragEnterCapture=e=>{var t;if(this.dragEnterTargetIds=[],this.isDraggingNativeItem()&&(null===(t=this.currentNativeSource)||void 0===t||t.loadDataTransfer(e.dataTransfer)),!this.enterLeaveCounter.enter(e.target)||this.monitor.isDragging())return;const{dataTransfer:r}=e,n=An(r);n&&this.beginDragNativeItem(n,r)},this.handleTopDragEnter=e=>{const{dragEnterTargetIds:t}=this;this.dragEnterTargetIds=[],this.monitor.isDragging()&&(this.altKeyPressed=e.altKey,t.length>0&&this.actions.hover(t,{clientOffset:$n(e)}),t.some((e=>this.monitor.canDropOnTarget(e)))&&(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=this.getCurrentDropEffect())))},this.handleTopDragOverCapture=e=>{var t;this.dragOverTargetIds=[],this.isDraggingNativeItem()&&(null===(t=this.currentNativeSource)||void 0===t||t.loadDataTransfer(e.dataTransfer))},this.handleTopDragOver=e=>{const{dragOverTargetIds:t}=this;if(this.dragOverTargetIds=[],!this.monitor.isDragging())return e.preventDefault(),void(e.dataTransfer&&(e.dataTransfer.dropEffect="none"));this.altKeyPressed=e.altKey,this.lastClientOffset=$n(e),this.scheduleHover(t),(t||[]).some((e=>this.monitor.canDropOnTarget(e)))?(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=this.getCurrentDropEffect())):this.isDraggingNativeItem()?e.preventDefault():(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="none"))},this.handleTopDragLeaveCapture=e=>{this.isDraggingNativeItem()&&e.preventDefault(),this.enterLeaveCounter.leave(e.target)&&(this.isDraggingNativeItem()&&setTimeout((()=>this.endDragNativeItem()),0),this.cancelHover())},this.handleTopDropCapture=e=>{var t;this.dropTargetIds=[],this.isDraggingNativeItem()?(e.preventDefault(),null===(t=this.currentNativeSource)||void 0===t||t.loadDataTransfer(e.dataTransfer)):An(e.dataTransfer)&&e.preventDefault(),this.enterLeaveCounter.reset()},this.handleTopDrop=e=>{const{dropTargetIds:t}=this;this.dropTargetIds=[],this.actions.hover(t,{clientOffset:$n(e)}),this.actions.drop({dropEffect:this.getCurrentDropEffect()}),this.isDraggingNativeItem()?this.endDragNativeItem():this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleSelectStart=e=>{const t=e.target;"function"==typeof t.dragDrop&&("INPUT"===t.tagName||"SELECT"===t.tagName||"TEXTAREA"===t.tagName||t.isContentEditable||(e.preventDefault(),t.dragDrop()))},this.options=new Bn(t,r),this.actions=e.getActions(),this.monitor=e.getMonitor(),this.registry=e.getRegistry(),this.enterLeaveCounter=new In(this.isNodeInDocument)}}const Vn=function(e,t,r){return new Hn(e,t,r)};class qn extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const t=super.get(e);return super.has(e)&&void 0!==t&&(this.delete(e),super.set(e,t)),t}set(e,t){if(super.set(e,t),this.maxSize&&this.size>this.maxSize){const e=this.keys().next().value;e&&this.delete(e)}return this}}const Wn="2.21.55";let Kn=({docsBaseUrl:e,docsPath:t="",docsSlug:r})=>t?`${e??"https://viem.sh"}${t}${r?`#${r}`:""}`:void 0,Xn=`viem@${Wn}`;class Gn extends Error{constructor(e,t={}){const r=t.cause instanceof Gn?t.cause.details:t.cause?.message?t.cause.message:t.details,n=t.cause instanceof Gn&&t.cause.docsPath||t.docsPath,s=Kn?.({...t,docsPath:n});super([e||"An error occurred.","",...t.metaMessages?[...t.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...r?[`Details: ${r}`]:[],...Xn?[`Version: ${Xn}`]:[]].join("\n"),t.cause?{cause:t.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=r,this.docsPath=n,this.metaMessages=t.metaMessages,this.name=t.name??this.name,this.shortMessage=e,this.version=Wn}walk(e){return Yn(this,e)}}function Yn(e,t){return t?.(e)?e:e&&"object"==typeof e&&"cause"in e&&void 0!==e.cause?Yn(e.cause,t):t?null:e}function Jn(e,{strict:t=!0}={}){return!!e&&"string"==typeof e&&(t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x"))}class Qn extends Gn{constructor({size:e,targetSize:t,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${e}) exceeds padding size (${t}).`,{name:"SizeExceedsPaddingSizeError"})}}function es(e,{dir:t,size:r=32}={}){return"string"==typeof e?function(e,{dir:t,size:r=32}={}){if(null===r)return e;const n=e.replace("0x","");if(n.length>2*r)throw new Qn({size:Math.ceil(n.length/2),targetSize:r,type:"hex"});return`0x${n["right"===t?"padEnd":"padStart"](2*r,"0")}`}(e,{dir:t,size:r}):function(e,{dir:t,size:r=32}={}){if(null===r)return e;if(e.length>r)throw new Qn({size:e.length,targetSize:r,type:"bytes"});const n=new Uint8Array(r);for(let s=0;s<r;s++){const i="right"===t;n[i?s:r-s-1]=e[i?s:e.length-s-1]}return n}(e,{dir:t,size:r})}class ts extends Gn{constructor({max:e,min:t,signed:r,size:n,value:s}){super(`Number "${s}" is not in safe ${n?`${8*n}-bit ${r?"signed":"unsigned"} `:""}integer range ${e?`(${t} to ${e})`:`(above ${t})`}`,{name:"IntegerOutOfRangeError"})}}class rs extends Gn{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed ${t} bytes. Given size: ${e} bytes.`,{name:"SizeOverflowError"})}}function ns(e){return Jn(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}function ss(e,{size:t}){if(ns(e)>t)throw new rs({givenSize:ns(e),maxSize:t})}function is(e,t={}){const{signed:r,size:n}=t,s=BigInt(e);let i;n?i=r?(1n<<8n*BigInt(n)-1n)-1n:2n**(8n*BigInt(n))-1n:"number"==typeof e&&(i=BigInt(Number.MAX_SAFE_INTEGER));const a="bigint"==typeof i&&r?-i-1n:0;if(i&&s>i||s<a){const t="bigint"==typeof e?"n":"";throw new ts({max:i?`${i}${t}`:void 0,min:`${a}${t}`,signed:r,size:n,value:`${e}${t}`})}const o=`0x${(r&&s<0?(1n<<BigInt(8*n))+BigInt(s):s).toString(16)}`;return n?es(o,{size:n}):o}const as=new TextEncoder;const os={zero:48,nine:57,A:65,F:70,a:97,f:102};function cs(e){return e>=os.zero&&e<=os.nine?e-os.zero:e>=os.A&&e<=os.F?e-(os.A-10):e>=os.a&&e<=os.f?e-(os.a-10):void 0}function ds(e,t={}){let r=e;t.size&&(ss(r,{size:t.size}),r=es(r,{dir:"right",size:t.size}));let n=r.slice(2);n.length%2&&(n=`0${n}`);const s=n.length/2,i=new Uint8Array(s);for(let e=0,t=0;e<s;e++){const r=cs(n.charCodeAt(t++)),s=cs(n.charCodeAt(t++));if(void 0===r||void 0===s)throw new Gn(`Invalid byte sequence ("${n[t-2]}${n[t-1]}" in "${n}").`);i[e]=16*r+s}return i}function us(e,t={}){const r=as.encode(e);return"number"==typeof t.size?(ss(r,{size:t.size}),es(r,{dir:"right",size:t.size})):r}function ls(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function hs(e,...t){if(!((r=e)instanceof Uint8Array||ArrayBuffer.isView(r)&&"Uint8Array"===r.constructor.name))throw new Error("Uint8Array expected");var r;if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function fs(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}const ps=BigInt(2**32-1),gs=BigInt(32);function ms(e,t=!1){return t?{h:Number(e&ps),l:Number(e>>gs&ps)}:{h:0|Number(e>>gs&ps),l:0|Number(e&ps)}}function vs(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let s=0;s<e.length;s++){const{h:i,l:a}=ms(e[s],t);[r[s],n[s]]=[i,a]}return[r,n]}const ys=(()=>68===new Uint8Array(new Uint32Array([287454020]).buffer)[0])();function _s(e){for(let r=0;r<e.length;r++)e[r]=(t=e[r])<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255;var t}function bs(e){return"string"==typeof e&&(e=function(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}(e)),hs(e),e}class xs{clone(){return this._cloneInto()}}const ws=[],Ts=[],Os=[],Ss=BigInt(0),ks=BigInt(1),Is=BigInt(2),Cs=BigInt(7),Ds=BigInt(256),Es=BigInt(113);for(let e=0,t=ks,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],ws.push(2*(5*n+r)),Ts.push((e+1)*(e+2)/2%64);let s=Ss;for(let e=0;e<7;e++)t=(t<<ks^(t>>Cs)*Es)%Ds,t&Is&&(s^=ks<<(ks<<BigInt(e))-ks);Os.push(s)}const[js,Ns]=vs(Os,!0),Ps=(e,t,r)=>r>32?((e,t,r)=>t<<r-32|e>>>64-r)(e,t,r):((e,t,r)=>e<<r|t>>>32-r)(e,t,r),Rs=(e,t,r)=>r>32?((e,t,r)=>e<<r-32|t>>>64-r)(e,t,r):((e,t,r)=>t<<r|e>>>32-r)(e,t,r);class As extends xs{constructor(e,t,r,n=!1,s=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=n,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,ls(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");var i;this.state=new Uint8Array(200),this.state32=(i=this.state,new Uint32Array(i.buffer,i.byteOffset,Math.floor(i.byteLength/4)))}keccak(){ys||_s(this.state32),function(e,t=24){const r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let t=0;t<10;t++)r[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){const n=(t+8)%10,s=(t+2)%10,i=r[s],a=r[s+1],o=Ps(i,a,1)^r[n],c=Rs(i,a,1)^r[n+1];for(let r=0;r<50;r+=10)e[t+r]^=o,e[t+r+1]^=c}let t=e[2],s=e[3];for(let r=0;r<24;r++){const n=Ts[r],i=Ps(t,s,n),a=Rs(t,s,n),o=ws[r];t=e[o],s=e[o+1],e[o]=i,e[o+1]=a}for(let t=0;t<50;t+=10){for(let n=0;n<10;n++)r[n]=e[t+n];for(let n=0;n<10;n++)e[t+n]^=~r[(n+2)%10]&r[(n+4)%10]}e[0]^=js[n],e[1]^=Ns[n]}r.fill(0)}(this.state32,this.rounds),ys||_s(this.state32),this.posOut=0,this.pos=0}update(e){fs(this);const{blockLen:t,state:r}=this,n=(e=bs(e)).length;for(let s=0;s<n;){const i=Math.min(t-this.pos,n-s);for(let t=0;t<i;t++)r[this.pos++]^=e[s++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:t,pos:r,blockLen:n}=this;e[r]^=t,128&t&&r===n-1&&this.keccak(),e[n-1]^=128,this.keccak()}writeInto(e){fs(this,!1),hs(e),this.finish();const t=this.state,{blockLen:r}=this;for(let n=0,s=e.length;n<s;){this.posOut>=r&&this.keccak();const i=Math.min(r-this.posOut,s-n);e.set(t.subarray(this.posOut,this.posOut+i),n),this.posOut+=i,n+=i}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return ls(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(function(e,t){hs(e);const r=t.outputLen;if(e.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:t,suffix:r,outputLen:n,rounds:s,enableXOF:i}=this;return e||(e=new As(t,r,n,i,s)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=s,e.suffix=r,e.outputLen=n,e.enableXOF=i,e.destroyed=this.destroyed,e}}const Ms=((e,t,r)=>function(e){const t=t=>e().update(bs(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}((()=>new As(t,e,r))))(1,136,32),Zs=new qn(8192);function Ls(e,t){if(Zs.has(`${e}.${t}`))return Zs.get(`${e}.${t}`);const r=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),n=function(e){const t=Ms(Jn(e,{strict:!1})?function(e,t={}){return"number"==typeof e||"bigint"==typeof e?function(e,t){return ds(is(e,t))}(e,t):"boolean"==typeof e?function(e,t={}){const r=new Uint8Array(1);return r[0]=Number(e),"number"==typeof t.size?(ss(r,{size:t.size}),es(r,{size:t.size})):r}(e,t):Jn(e)?ds(e,t):us(e,t)}(e):e);return t}(us(r)),s=(t?r.substring(`${t}0x`.length):r).split("");for(let e=0;e<40;e+=2)n[e>>1]>>4>=8&&s[e]&&(s[e]=s[e].toUpperCase()),(15&n[e>>1])>=8&&s[e+1]&&(s[e+1]=s[e+1].toUpperCase());const i=`0x${s.join("")}`;return Zs.set(`${e}.${t}`,i),i}const Us=/^0x[a-fA-F0-9]{40}$/,$s=new qn(8192),Bs=[{id:"optimism",name:"Optimism"},{id:"base",name:"Base"},{id:"mainnet",name:"Ethereum Mainnet"},{id:"zora",name:"Zora"}],Fs=({dragType:e,index:t,item:r,moveItem:n,renderContent:s})=>{const[{isDragging:i},a]=cr({type:e,item:{index:t},collect:e=>({isDragging:e.isDragging()})}),[,o]=pr({accept:e,hover:e=>{e.index!==t&&(n(e.index,t),e.index=t)}});return(0,$t.jsxs)("div",{ref:e=>a(o(e)),style:{alignItems:"center",cursor:"move",display:"flex",gap:"8px",marginBottom:"8px",opacity:i?.5:1},children:[(0,$t.jsx)("span",{className:"dashicons dashicons-menu"}),(0,$t.jsx)("div",{style:{alignItems:"center",display:"flex",flex:1,justifyContent:"space-between"},children:s(r,t)})]})},zs=({chain:e,index:t,moveItem:r,removeChain:n})=>(0,$t.jsx)(Fs,{dragType:"chain",index:t,item:e,moveItem:r,renderContent:(e,t)=>(0,$t.jsxs)($t.Fragment,{children:[(0,$t.jsx)("span",{children:e.name}),(0,$t.jsx)(c.Button,{variant:"secondary",isDestructive:!0,onClick:()=>n(t),icon:"trash"})]})}),Hs=({value:e=[],onChange:t})=>{const r=e.map((e=>Bs.find((t=>t.id===e)))).filter(Boolean),n=r=>{const n=[...e];n.splice(r,1),t(n)},s=(r,n)=>{const s=[...e],[i]=s.splice(r,1);s.splice(n,0,i),t(s)},i=Bs.filter((t=>!e.includes(t.id)));return(0,$t.jsx)(On,{backend:Vn,children:(0,$t.jsxs)("div",{style:{width:"100%"},children:[(0,$t.jsx)("div",{className:"components-base-control",children:(0,$t.jsxs)("div",{className:"components-base-control__field",children:[(0,$t.jsx)("label",{htmlFor:"chains-control",className:"components-base-control__label",children:(0,o.__)("Supported Chains","frames-integration-for-farcaster")}),(0,$t.jsx)("div",{id:"chains-control",children:r.length>0?r.map(((e,t)=>(0,$t.jsx)(zs,{chain:e,index:t,moveItem:s,removeChain:n},e.id))):(0,$t.jsx)("div",{style:{background:"#f0f0f0",borderRadius:"4px",color:"#757575",margin:"8px 0",padding:"12px",textAlign:"center"},children:(0,o.__)("No chains selected. Add a chain below to get started.","frames-integration-for-farcaster")})})]})}),i.length>0&&(0,$t.jsx)("div",{className:"components-base-control",children:(0,$t.jsx)(c.SelectControl,{label:(0,o.__)("Add Chain","frames-integration-for-farcaster"),value:"",options:[{value:"",label:(0,o.__)("Select a chain to add…","frames-integration-for-farcaster")},...i.map((e=>({value:e.id,label:e.name})))],onChange:r=>{r&&(r=>{e.includes(r)||t([...e,r])})(r)}})})]})})},Vs=({value:e,onChange:t})=>(0,$t.jsx)(c.ColorPicker,{color:e,onChange:t}),qs=({value:e,onChange:t})=>(0,$t.jsx)(c.TextareaControl,{label:(0,o.__)("Domain Manifest","frames-integration-for-farcaster"),value:e,onChange:t}),Ws=({value:e=[],onChange:t})=>{const r=r=>{const n=[...e];n.splice(r,1),t(n)},n=(r,n)=>{const s=[...e];s[r]=Math.max(0,parseInt(n)||0),t(s)},s=(r,n)=>{const s=[...e],[i]=s.splice(r,1);s.splice(n,0,i),t(s)};return(0,$t.jsx)(On,{backend:Vn,children:(0,$t.jsxs)("div",{style:{width:"100%"},children:[(0,$t.jsx)("div",{className:"components-base-control",children:(0,$t.jsxs)("div",{className:"components-base-control__field",children:[(0,$t.jsxs)("label",{htmlFor:"tipping-amounts-control",className:"components-base-control__label",children:[(0,o.__)("Tipping Amounts (in","frames-integration-for-farcaster")," ",(0,$t.jsx)("a",{href:"https://zora.co/writings/sparks",target:"_blank",rel:"noopener noreferrer",children:(0,o.__)("Sparks","frames-integration-for-farcaster")}),(0,o.__)(")","frames-integration-for-farcaster")]}),(0,$t.jsx)("div",{id:"tipping-amounts-control",children:e.length>0?e.map(((e,t)=>(0,$t.jsx)(ri,{amount:e,index:t,moveItem:s,updateAmount:n,removeAmount:r},t))):(0,$t.jsx)("div",{style:{padding:"12px",background:"#f0f0f0",borderRadius:"4px",textAlign:"center",color:"#757575",margin:"8px 0"},children:(0,o.__)("No tipping amounts configured. Add an amount below to get started.","frames-integration-for-farcaster")})})]})}),(0,$t.jsx)(c.Button,{variant:"secondary",onClick:()=>{t([...e,0])},icon:"plus",children:(0,o.__)("Add Amount","frames-integration-for-farcaster")})]})})},Ks=({value:e,onChange:t,useTitleAsButtonText:r})=>(0,$t.jsx)(c.TextControl,{label:(0,o.__)("Button Text","frames-integration-for-farcaster"),value:e,help:r?(0,o.__)("This text will be used as the button text when frame is used outside of casts. Limited to 32 characters.","frames-integration-for-farcaster"):(0,o.__)("This text will be used as the button text for all posts. Limited to 32 characters.","frames-integration-for-farcaster"),onChange:t,__nextHasNoMarginBottom:!0,maxLength:32}),Xs=({value:e,onChange:t})=>{const r=e&&""!==e&&!function(e){const{strict:t=!0}={},r=`${e}.${t}`;if($s.has(r))return $s.get(r);const n=!(!Us.test(e)||e.toLowerCase()!==e&&t&&Ls(e)!==e);return $s.set(r,n),n}(e);return(0,$t.jsx)("div",{style:{width:"100%"},children:(0,$t.jsx)(c.TextControl,{label:(0,o.__)("Tipping Address","frames-integration-for-farcaster"),value:e,onChange:t,help:r?(0,o.__)("Please enter a valid Ethereum address","frames-integration-for-farcaster"):(0,o.__)("Enter the Ethereum address that will receive tips","frames-integration-for-farcaster"),className:r?"has-error":""})})},Gs=({value:e,onChange:t})=>(0,$t.jsx)(c.ToggleControl,{checked:e,label:(0,o.__)("Use Post Title as Button Text","frames-integration-for-farcaster"),onChange:t,__nextHasNoMarginBottom:!0}),Ys=({value:e,onChange:t})=>(0,$t.jsx)(c.ToggleControl,{checked:e,label:(0,o.__)("Enable Notifications","frames-integration-for-farcaster"),onChange:t,__nextHasNoMarginBottom:!0}),Js=({value:e,onChange:t})=>(0,$t.jsx)(c.ToggleControl,{checked:e,label:(0,o.__)("Enable SDK Logging","frames-integration-for-farcaster"),onChange:t,__nextHasNoMarginBottom:!0}),Qs=({value:e,onChange:t})=>(0,$t.jsx)(c.ToggleControl,{checked:e,label:(0,o.__)("Enable Farcaster Frames","frames-integration-for-farcaster"),onChange:t,__nextHasNoMarginBottom:!0}),ei=({value:e,onChange:t})=>(0,$t.jsx)(c.ToggleControl,{checked:e,label:(0,o.__)("Enable Tipping","frames-integration-for-farcaster"),onChange:t,__nextHasNoMarginBottom:!0}),ti=({value:e,onChange:t,buttonText:r="Select Image",labelText:n=""})=>(0,$t.jsx)(Ft.MediaUpload,{onSelect:e=>t({id:e.id,url:e.url}),help:(0,o.__)("This image will be used as the splash image for all posts.","frames-integration-for-farcaster"),allowedTypes:["image"],value:e,render:({open:s})=>(0,$t.jsx)("div",{children:e&&e.url?(0,$t.jsxs)("div",{style:{marginBottom:"10px"},children:[(0,$t.jsx)("img",{src:e.url,alt:"Selected",style:{maxWidth:"200px",height:"auto",display:"block",marginBottom:"8px"}}),(0,$t.jsxs)("div",{children:[(0,$t.jsx)(c.Button,{onClick:s,variant:"secondary",style:{marginRight:"8px"},children:"Replace Image"}),(0,$t.jsx)(c.Button,{onClick:()=>t({id:null,url:""}),variant:"link",isDestructive:!0,children:"Remove Image"})]})]}):(0,$t.jsx)(c.Button,{label:n,showTooltip:!0,onClick:s,variant:"secondary",children:r})})}),ri=({amount:e,index:t,moveItem:r,removeAmount:n,updateAmount:s})=>(0,$t.jsx)(Fs,{dragType:"amount",index:t,item:e,moveItem:r,renderContent:(e,t)=>(0,$t.jsxs)($t.Fragment,{children:[(0,$t.jsx)(c.TextControl,{type:"number",value:e,onChange:e=>s(t,e),min:0}),(0,$t.jsx)(c.Button,{icon:"trash",isDestructive:!0,onClick:()=>n(t),variant:"secondary"})]})}),ni=({value:e,onChange:t})=>(0,$t.jsx)("div",{style:{width:"100%"},children:(0,$t.jsx)(c.TextControl,{label:(0,o.__)("RPC URL for Optimism","frames-integration-for-farcaster"),value:e,onChange:t,help:e&&""!==e?(0,o.__)("Enter the URL of your Ethereum RPC for the Optimism chain.","frames-integration-for-farcaster"):(0,o.__)("Enter the URL of your Ethereum RPC for the Optimism chain. Required for complete key verification.","frames-integration-for-farcaster"),className:e&&""!==e?"":"has-error",type:"url",__nextHasNoMarginBottom:!0})}),si=window.wp.primitives,ii=(0,$t.jsx)(si.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,$t.jsx)(si.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M5 4.5h11a.5.5 0 0 1 .5.5v11a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V5a.5.5 0 0 1 .5-.5ZM3 5a2 2 0 0 1 2-2h11a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5Zm17 3v10.75c0 .69-.56 1.25-1.25 1.25H6v1.5h12.75a2.75 2.75 0 0 0 2.75-2.75V8H20Z"})}),ai=(0,$t.jsx)(si.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,$t.jsx)(si.Path,{d:"M18 11.3l-1-1.1-4 4V3h-1.5v11.3L7 10.2l-1 1.1 6.2 5.8 5.8-5.8zm.5 3.7v3.5h-13V15H4v5h16v-5h-1.5z"})}),oi=({content:e,showCopyButton:t=!0,showDownloadButton:r=!1,downloadFilename:n="download.json"})=>{const[s,i]=(0,a.useState)(!1);return(0,$t.jsxs)("div",{style:{position:"relative",maxWidth:"100%"},children:[(0,$t.jsx)("pre",{style:{background:"#f0f0f0",padding:"1rem",borderRadius:"4px",overflow:"auto",whiteSpace:"break-spaces",lineBreak:"anywhere"},children:e}),t&&(0,$t.jsx)(c.Button,{icon:ii,onClick:async()=>{await navigator.clipboard.writeText(e),i(!0),setTimeout((()=>i(!1)),2e3)},style:{position:"absolute",top:"8px",right:"8px",background:"white",border:"1px solid #ccc"},children:s?(0,o.__)("Copied!","frames-integration-for-farcaster"):(0,o.__)("Copy","frames-integration-for-farcaster")}),r&&(0,$t.jsx)(c.Button,{icon:ai,onClick:()=>{const t=new Blob([e],{type:"application/json"}),r=URL.createObjectURL(t),s=document.createElement("a");s.href=r,s.download=n,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(r)},style:{position:"absolute",bottom:"8px",right:"8px",background:"white",border:"1px solid #ccc"},children:(0,o.__)("Download","frames-integration-for-farcaster")})]})},ci=({currentManifest:e,domainManifest:t,setDomainManifest:r})=>{const[n,s]=(0,a.useState)(null),[i,d]=(0,a.useState)(""),[u,l]=(0,a.useState)(""),[h,f]=(0,a.useState)(!0),p=(0,a.useMemo)((()=>{if(!t)return null;let e=null;try{e=JSON.parse(t)}catch{}return e}),[t]),g=(0,a.useMemo)((()=>{if(!n||!e)return null;const t=p&&"object"==typeof p&&0!==Object.keys(p).length,r={name:n?.frame?.name!==e?.frame?.name,homeUrl:n?.frame?.homeUrl!==e?.frame?.homeUrl,iconUrl:n?.frame?.iconUrl!==e?.frame?.iconUrl,splashImageUrl:n?.frame?.splashImageUrl!==e?.frame?.splashImageUrl,splashBackgroundColor:n?.frame?.splashBackgroundColor!==e?.frame?.splashBackgroundColor,buttonTitle:n?.frame?.buttonTitle!==e?.frame?.buttonTitle,imageUrl:n?.frame?.imageUrl!==e?.frame?.imageUrl,...e?.frame?.webhookUrl?{webhookUrl:e?.frame?.webhookUrl!==n?.frame?.webhookUrl}:{},...t?{header:p?.accountAssociation?.header!==n?.accountAssociation?.header,payload:p?.accountAssociation?.payload!==n?.accountAssociation?.payload,signature:p?.accountAssociation?.signature!==n?.accountAssociation?.signature}:{}};return{count:Object.values(r).filter(Boolean).length,details:r}}),[n,e,p]);return(0,a.useEffect)((()=>{(async()=>{try{const e=new AbortController,t=setTimeout((()=>e.abort("Manifest retrieval timed out")),2e3),r=await fetch("/.well-known/farcaster.json",{signal:e.signal});if(clearTimeout(t),!r.ok)throw new Error("Manifest file not found");const n=(e=>{const t=Ut.safeParse(e);return t.success?(d(""),t.data):(d(t.error.message),e)})(await r.json());s(n),l("")}catch(e){l(e instanceof Error?`${(0,o.__)("Error:","frames-integration-for-farcaster")} ${e.message}`:(0,o.__)("Farcaster manifest file not found or request timed out at /.well-known/farcaster.json","frames-integration-for-farcaster"))}finally{f(!1)}})()}),[]),h?(0,$t.jsx)(c.__experimentalText,{children:(0,o.__)("Loading manifest…","frames-integration-for-farcaster")}):(0,$t.jsxs)("div",{className:"manifest-viewer",children:[u&&(0,$t.jsxs)($t.Fragment,{children:[(0,$t.jsx)(c.Notice,{status:"error",isDismissible:!1,children:u}),(0,$t.jsx)("div",{style:{marginTop:"8px"}})]}),(0,$t.jsxs)(c.__experimentalText,{children:[(0,o.__)("The Farcaster manifest file declares metadata for your frame application and defines supported triggers.","frames-integration-for-farcaster")," ",(0,$t.jsx)("a",{href:"https://docs.farcaster.xyz/developers/frames/v2/spec#frame-manifest",target:"_blank",rel:"noopener noreferrer",children:(0,o.__)("Learn more about the manifest specification.","frames-integration-for-farcaster")})," ",(0,o.__)("Frames Integration for Farcaster can help you manage your manifest file. To start, enter the domain manifest obtained from the Warpcast app.","frames-integration-for-farcaster")," ",(0,$t.jsx)("a",{href:"https://docs.farcaster.xyz/developers/frames/v2/notifications_webhooks#create-a-farcaster-domain-manifest",target:"_blank",rel:"noopener noreferrer",children:(0,o.__)("Follow the instructions here to create a domain manifest.","frames-integration-for-farcaster")})]}),(0,$t.jsx)("div",{style:{marginTop:"16px"},children:(0,$t.jsx)(qs,{value:t,onChange:r})}),n&&(0,$t.jsxs)($t.Fragment,{children:[(0,$t.jsx)("div",{style:{marginTop:"16px"},children:(0,$t.jsx)(c.__experimentalText,{children:(0,o.__)("Here is the current manifest on your site:","frames-integration-for-farcaster")})}),(0,$t.jsx)("div",{style:{marginTop:"8px"}}),(0,$t.jsx)(oi,{content:JSON.stringify(n,null,2),showCopyButton:!1}),i&&(0,$t.jsxs)(c.Notice,{status:"error",isDismissible:!1,children:[(0,o.__)("Validation complete, manifest is not valid. Errors:","frames-integration-for-farcaster")," ",(0,$t.jsx)("ul",{style:{margin:0,paddingLeft:"1rem"},children:JSON.parse(i).map(((e,t)=>(0,$t.jsxs)("li",{children:[(0,$t.jsx)("strong",{children:e.path.join(".")}),": ",e.message]},t)))})]}),!i&&(0,$t.jsx)(c.Notice,{status:"info",isDismissible:!1,children:e&&g?(0,o.sprintf)(/* translators: %d: number of mismatches */ /* translators: %d: number of mismatches */
    2 (0,o.__)("Validation complete, manifest is valid. %d mismatches found with current settings.","frames-integration-for-farcaster"),g.count):(0,o.__)("Validation complete, manifest is valid.","frames-integration-for-farcaster")}),e&&g?.count>0&&(0,$t.jsxs)($t.Fragment,{children:[g.details.name&&(0,$t.jsx)(c.Notice,{status:"warning",isDismissible:!1,children:(0,o.__)("The manifest name does not match the current site name.","frames-integration-for-farcaster")}),g.details.homeUrl&&(0,$t.jsx)(c.Notice,{status:"warning",isDismissible:!1,children:(0,o.__)("The manifest home URL does not match the current site home URL.","frames-integration-for-farcaster")}),g.details.iconUrl&&(0,$t.jsx)(c.Notice,{status:"warning",isDismissible:!1,children:(0,o.__)("The manifest icon URL does not match the current site icon URL.","frames-integration-for-farcaster")}),g.details.imageUrl&&(0,$t.jsx)(c.Notice,{status:"warning",isDismissible:!1,children:(0,o.__)("The manifest image URL does not match the current site image URL.","frames-integration-for-farcaster")}),g.details.buttonTitle&&(0,$t.jsx)(c.Notice,{status:"warning",isDismissible:!1,children:(0,o.__)("The manifest button title does not match the current site button title.","frames-integration-for-farcaster")}),g.details.splashImageUrl&&(0,$t.jsx)(c.Notice,{status:"warning",isDismissible:!1,children:(0,o.__)("The manifest splash image URL does not match the current site splash image URL.","frames-integration-for-farcaster")}),g.details.splashBackgroundColor&&(0,$t.jsx)(c.Notice,{status:"warning",isDismissible:!1,children:(0,o.__)("The manifest splash background color does not match the current site splash background color.","frames-integration-for-farcaster")}),g.details.webhookUrl&&(0,$t.jsx)(c.Notice,{status:"warning",isDismissible:!1,children:(0,o.__)("The manifest webhook URL does not match the current site webhook URL.","frames-integration-for-farcaster")}),g.details.header&&(0,$t.jsx)(c.Notice,{status:"warning",isDismissible:!1,children:(0,o.__)("The manifest header does not match the domain manifest header.","frames-integration-for-farcaster")}),g.details.payload&&(0,$t.jsx)(c.Notice,{status:"warning",isDismissible:!1,children:(0,o.__)("The manifest payload does not match the domain manifest payload.","frames-integration-for-farcaster")}),g.details.signature&&(0,$t.jsx)(c.Notice,{status:"warning",isDismissible:!1,children:(0,o.__)("The manifest signature does not match the domain manifest signature.","frames-integration-for-farcaster")})]})]}),(0,$t.jsxs)($t.Fragment,{children:[(0,$t.jsx)("div",{style:{marginTop:"16px"},children:(0,$t.jsx)(c.__experimentalText,{children:(0,o.__)("Are you going to update the manifest to match current settings? Here is the manifest data to reference. This should be available at /.well-known/farcaster.json on your site.","frames-integration-for-farcaster")})}),(0,$t.jsx)(oi,{showDownloadButton:!0,downloadFilename:"farcaster.json",content:JSON.stringify(e,null,2)})]})]})},di=()=>{const{subscriptions:e}=(()=>{const[e,t]=(0,a.useState)(),r=(0,a.useCallback)((()=>{u()({path:"/farcaster-wp/v1/subscriptions"}).then((e=>{t(e)}))}),[]);return(0,a.useEffect)((()=>{r()}),[r]),{subscriptions:e,fetchSubscriptions:r}})();return(0,$t.jsxs)("div",{children:[(0,$t.jsx)("div",{style:{marginTop:"16px"},children:(0,$t.jsxs)(c.__experimentalText,{children:[(0,o.__)("You have","frames-integration-for-farcaster")," ",e?.length," ",(0,o.__)("subscriptions on your site:","frames-integration-for-farcaster")]})}),(0,$t.jsx)("div",{style:{marginTop:"8px"}}),(0,$t.jsx)("pre",{children:JSON.stringify(e,null,2)})]})},ui=()=>(0,$t.jsx)(c.__experimentalHeading,{level:1,children:(0,o.__)("Frames Integration for Farcaster Settings","frames-integration-for-farcaster")}),li=({onClick:e})=>(0,$t.jsx)(c.Button,{variant:"primary",onClick:e,__next40pxDefaultSize:!0,children:(0,o.__)("Save","frames-integration-for-farcaster")}),hi=()=>{const{saveSettings:e,framesEnabled:t,setFramesEnabled:r,splashBackgroundColor:n,setSplashBackgroundColor:s,buttonText:i,setButtonText:d,splashImage:f,setSplashImage:p,fallbackImage:g,setFallbackImage:m,useTitleAsButtonText:v,setUseTitleAsButtonText:y,domainManifest:_,setDomainManifest:b,notificationsEnabled:x,setNotificationsEnabled:w,debugEnabled:T,setDebugEnabled:O,tippingEnabled:S,setTippingEnabled:k,tippingAddress:I,setTippingAddress:C,tippingAmounts:D,setTippingAmounts:E,tippingChains:j,setTippingChains:N,rpcURL:P,setRpcURL:R}=(()=>{const[e,t]=(0,a.useState)(),[r,n]=(0,a.useState)(),[s,i]=(0,a.useState)(),[c,d]=(0,a.useState)(!1),[f,p]=(0,a.useState)(!1),[g,m]=(0,a.useState)(!1),[v,y]=(0,a.useState)(),[_,b]=(0,a.useState)([]),[x,w]=(0,a.useState)([]),[T,O]=(0,a.useState)(),[S,k]=(0,a.useState)(),[I,C]=(0,a.useState)({id:0,url:""}),[D,E]=(0,a.useState)({id:0,url:""}),[j,N]=(0,a.useState)(!1),{createSuccessNotice:P,createErrorNotice:R,removeNotice:A}=(0,h.useDispatch)(l.store);return(0,a.useEffect)((()=>{u()({path:"/wp/v2/settings"}).then((e=>{i(e.farcaster_wp?.frames_enabled),O(e.farcaster_wp?.splash_background_color),k(e.farcaster_wp?.button_text),C(e.farcaster_wp?.splash_image),E(e.farcaster_wp?.fallback_image),N(e.farcaster_wp?.use_title_as_button_text),t(e.farcaster_wp?.domain_manifest),d(e.farcaster_wp?.notifications_enabled),p(e.farcaster_wp?.debug_enabled),m(e.farcaster_wp?.tipping_enabled),y(e.farcaster_wp?.tipping_address),b(e.farcaster_wp?.tipping_amounts),w(e.farcaster_wp?.tipping_chains),n(e.farcaster_wp?.rpc_url)}))}),[]),(0,a.useEffect)((()=>{let e;return async function(){if(void 0===r||""!==r||e)void 0!==r&&""!==r&&e&&(A(e),e=void 0);else{const t=await R((0,o.__)("RPC URL is required for key validation. Currently, signatures will be validated, but keys will not be verified using contract.","frames-integration-for-farcaster"));e=t?.notice?.id}}(),()=>{e&&A(e)}}),[R,A,r]),{saveSettings:t=>{if(e){let t=null;try{t=JSON.parse(e)}catch{}if(!Ut.safeParse(t).success)return void R((0,o.__)("Did not save settings, domain manifest is invalid.","frames-integration-for-farcaster")).then((()=>document.scrollingElement?.scrollTo({top:0,behavior:"smooth"})))}if(r)try{new URL(r)}catch{return void R((0,o.__)("RPC URL is invalid.","frames-integration-for-farcaster")).then((()=>document.scrollingElement?.scrollTo({top:0,behavior:"smooth"})))}u()({path:"/wp/v2/settings",method:"POST",data:{farcaster_wp:{frames_enabled:s,splash_background_color:T,button_text:S,splash_image:I,fallback_image:D,use_title_as_button_text:j,domain_manifest:e,notifications_enabled:c,debug_enabled:f,tipping_enabled:g,tipping_address:v,tipping_amounts:_,tipping_chains:x,rpc_url:r}}}).then((()=>{P((0,o.__)("Settings saved.","frames-integration-for-farcaster")).then((()=>{t&&t(),document.scrollingElement?.scrollTo({top:0,behavior:"smooth"})}))})).catch((e=>{console.error(e),R((0,o.__)("Failed to save settings.","frames-integration-for-farcaster")).then((()=>document.scrollingElement?.scrollTo({top:0,behavior:"smooth"})))}))},framesEnabled:s,setFramesEnabled:i,splashBackgroundColor:T,setSplashBackgroundColor:O,buttonText:S,setButtonText:k,splashImage:I,setSplashImage:C,fallbackImage:D,setFallbackImage:E,useTitleAsButtonText:j,setUseTitleAsButtonText:N,domainManifest:e,setDomainManifest:t,notificationsEnabled:c,setNotificationsEnabled:d,debugEnabled:f,setDebugEnabled:p,tippingEnabled:g,setTippingEnabled:m,tippingAddress:v,setTippingAddress:y,tippingAmounts:_,setTippingAmounts:b,tippingChains:x,setTippingChains:w,rpcURL:r,setRpcURL:n}})(),{manifest:A,fetchManifest:M}=(()=>{const[e,t]=(0,a.useState)(),r=(0,a.useCallback)((()=>{u()({path:"/farcaster-wp/v1/manifest"}).then((e=>{t(e)}))}),[]);return(0,a.useEffect)((()=>{r()}),[r]),{manifest:e,fetchManifest:r}})();return(0,$t.jsxs)($t.Fragment,{children:[(0,$t.jsx)(ui,{}),(0,$t.jsx)(Bt,{}),(0,$t.jsxs)(c.Panel,{header:"Frames",children:[(0,$t.jsx)(c.PanelBody,{children:(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsx)(Qs,{value:t,onChange:e=>r(e)})})}),(0,$t.jsx)(c.PanelBody,{title:(0,o.__)("Frame Button","frames-integration-for-farcaster"),initialOpen:t,children:(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsxs)(c.__experimentalVStack,{spacing:4,children:[(0,$t.jsx)(Gs,{value:v,onChange:y}),(0,$t.jsx)(Ks,{useTitleAsButtonText:v,value:i,onChange:d})]})})}),(0,$t.jsx)(c.PanelBody,{title:(0,o.__)("Splash Background Color","frames-integration-for-farcaster"),initialOpen:t,children:(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsx)(Vs,{value:n,onChange:s})})}),(0,$t.jsx)(c.PanelBody,{title:(0,o.__)("Frame Splash Image","frames-integration-for-farcaster"),initialOpen:t,children:(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsx)(ti,{value:f,onChange:p,labelText:(0,o.__)("Image will be displayed as 200x200px.","frames-integration-for-farcaster")})})}),(0,$t.jsx)(c.PanelBody,{title:(0,o.__)("Fallback Frame Image","frames-integration-for-farcaster"),initialOpen:t,children:(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsx)(ti,{labelText:(0,o.__)("Image will be displayed in 3:2 aspect ratio.","frames-integration-for-farcaster"),value:g,onChange:m})})})]}),(0,$t.jsxs)(c.Panel,{header:"Tipping",children:[(0,$t.jsxs)(c.PanelBody,{children:[(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsx)(ei,{value:S,onChange:k})}),(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsx)(Xs,{value:I,onChange:C})})]}),(0,$t.jsx)(c.PanelBody,{title:(0,o.__)("Tipping Chains","frames-integration-for-farcaster"),initialOpen:S,children:(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsx)(Hs,{value:j,onChange:N})})}),(0,$t.jsx)(c.PanelBody,{title:(0,o.__)("Tipping Amounts","frames-integration-for-farcaster"),initialOpen:S,children:(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsx)(Ws,{value:D,onChange:E})})})]}),(0,$t.jsx)(c.Panel,{header:"Notifications",children:(0,$t.jsxs)(c.PanelBody,{children:[(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsx)(Ys,{value:x,onChange:w})}),(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsx)(ni,{value:P,onChange:R})}),(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsx)(Js,{value:T,onChange:O})}),(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsx)(di,{})})]})}),(0,$t.jsx)(c.Panel,{header:"Manifest",children:(0,$t.jsx)(c.PanelBody,{title:(0,o.__)("Manifest Validation","frames-integration-for-farcaster"),children:(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsx)(ci,{currentManifest:A,domainManifest:_,setDomainManifest:b})})})}),(0,$t.jsx)(li,{onClick:()=>e(M)})]})};i()((()=>{const e=document.getElementById("farcaster-wp-settings");e&&(0,a.createRoot)(e).render((0,$t.jsx)(hi,{}))}))})();
     1(()=>{"use strict";var e={2017:e=>{e.exports=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;var n,s,i;if(Array.isArray(t)){if((n=t.length)!=r.length)return!1;for(s=n;0!=s--;)if(!e(t[s],r[s]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((n=(i=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(s=n;0!=s--;)if(!Object.prototype.hasOwnProperty.call(r,i[s]))return!1;for(s=n;0!=s--;){var a=i[s];if(!e(t[a],r[a]))return!1}return!0}return t!=t&&r!=r}}},t={};function r(n){var s=t[n];if(void 0!==s)return s.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};r.r(n),r.d(n,{FILE:()=>Dn,HTML:()=>Nn,TEXT:()=>jn,URL:()=>En});const s=window.wp.domReady;var i=r.n(s);const a=window.wp.element,o=window.wp.i18n,c=window.wp.components,d=window.wp.apiFetch;var u=r.n(d);const l=window.wp.notices,h=window.wp.data;var f,p;!function(e){e.assertEqual=e=>e,e.assertIs=function(e){},e.assertNever=function(_x){throw new Error},e.arrayToEnum=e=>{const t={};for(const r of e)t[r]=r;return t},e.getValidEnumValues=t=>{const r=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),n={};for(const e of r)n[e]=t[e];return e.objectValues(n)},e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]})),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t},e.find=(e,t)=>{for(const r of e)if(t(r))return r},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(f||(f={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(p||(p={}));const g=f.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),m=e=>{switch(typeof e){case"undefined":return g.undefined;case"string":return g.string;case"number":return isNaN(e)?g.nan:g.number;case"boolean":return g.boolean;case"function":return g.function;case"bigint":return g.bigint;case"symbol":return g.symbol;case"object":return Array.isArray(e)?g.array:null===e?g.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?g.promise:"undefined"!=typeof Map&&e instanceof Map?g.map:"undefined"!=typeof Set&&e instanceof Set?g.set:"undefined"!=typeof Date&&e instanceof Date?g.date:g.object;default:return g.unknown}},v=f.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class y extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},r={_errors:[]},n=e=>{for(const s of e.issues)if("invalid_union"===s.code)s.unionErrors.map(n);else if("invalid_return_type"===s.code)n(s.returnTypeError);else if("invalid_arguments"===s.code)n(s.argumentsError);else if(0===s.path.length)r._errors.push(t(s));else{let e=r,n=0;for(;n<s.path.length;){const r=s.path[n];n===s.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(s))):e[r]=e[r]||{_errors:[]},e=e[r],n++}}};return n(this),r}static assert(e){if(!(e instanceof y))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,f.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},r=[];for(const n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):r.push(e(n));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}y.create=e=>new y(e);const _=(e,t)=>{let r;switch(e.code){case v.invalid_type:r=e.received===g.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case v.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,f.jsonStringifyReplacer)}`;break;case v.unrecognized_keys:r=`Unrecognized key(s) in object: ${f.joinValues(e.keys,", ")}`;break;case v.invalid_union:r="Invalid input";break;case v.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${f.joinValues(e.options)}`;break;case v.invalid_enum_value:r=`Invalid enum value. Expected ${f.joinValues(e.options)}, received '${e.received}'`;break;case v.invalid_arguments:r="Invalid function arguments";break;case v.invalid_return_type:r="Invalid function return type";break;case v.invalid_date:r="Invalid date";break;case v.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:f.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case v.too_small:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case v.too_big:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case v.custom:r="Invalid input";break;case v.invalid_intersection_types:r="Intersection results could not be merged";break;case v.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case v.not_finite:r="Number must be finite";break;default:r=t.defaultError,f.assertNever(e)}return{message:r}};let b=_;function x(){return b}const w=e=>{const{data:t,path:r,errorMaps:n,issueData:s}=e,i=[...r,...s.path||[]],a={...s,path:i};if(void 0!==s.message)return{...s,path:i,message:s.message};let o="";const c=n.filter((e=>!!e)).slice().reverse();for(const e of c)o=e(a,{data:t,defaultError:o}).message;return{...s,path:i,message:o}};function T(e,t){const r=x(),n=w({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===_?void 0:_].filter((e=>!!e))});e.common.issues.push(n)}class S{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const r=[];for(const n of t){if("aborted"===n.status)return O;"dirty"===n.status&&e.dirty(),r.push(n.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){const r=[];for(const e of t){const t=await e.key,n=await e.value;r.push({key:t,value:n})}return S.mergeObjectSync(e,r)}static mergeObjectSync(e,t){const r={};for(const n of t){const{key:t,value:s}=n;if("aborted"===t.status)return O;if("aborted"===s.status)return O;"dirty"===t.status&&e.dirty(),"dirty"===s.status&&e.dirty(),"__proto__"===t.value||void 0===s.value&&!n.alwaysSet||(r[t.value]=s.value)}return{status:e.value,value:r}}}const O=Object.freeze({status:"aborted"}),k=e=>({status:"dirty",value:e}),I=e=>({status:"valid",value:e}),C=e=>"aborted"===e.status,D=e=>"dirty"===e.status,E=e=>"valid"===e.status,j=e=>"undefined"!=typeof Promise&&e instanceof Promise;function N(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}function P(e,t,r,n,s){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?s.call(e,r):s?s.value=r:t.set(e,r),r}var R,A,M;"function"==typeof SuppressedError&&SuppressedError,function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(R||(R={}));class Z{constructor(e,t,r,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=n}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const L=(e,t)=>{if(E(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new y(e.common.issues);return this._error=t,this._error}}};function U(e){if(!e)return{};const{errorMap:t,invalid_type_error:r,required_error:n,description:s}=e;if(t&&(r||n))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:s}:{errorMap:(t,s)=>{var i,a;const{message:o}=e;return"invalid_enum_value"===t.code?{message:null!=o?o:s.defaultError}:void 0===s.data?{message:null!==(i=null!=o?o:n)&&void 0!==i?i:s.defaultError}:"invalid_type"!==t.code?{message:s.defaultError}:{message:null!==(a=null!=o?o:r)&&void 0!==a?a:s.defaultError}},description:s}}class ${get description(){return this._def.description}_getType(e){return m(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:m(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new S,ctx:{common:e.parent.common,data:e.data,parsedType:m(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(j(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){var r;const n={common:{issues:[],async:null!==(r=null==t?void 0:t.async)&&void 0!==r&&r,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:m(e)},s=this._parseSync({data:e,path:n.path,parent:n});return L(n,s)}"~validate"(e){var t,r;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:m(e)};if(!this["~standard"].async)try{const t=this._parseSync({data:e,path:[],parent:n});return E(t)?{value:t.value}:{issues:n.common.issues}}catch(e){(null===(r=null===(t=null==e?void 0:e.message)||void 0===t?void 0:t.toLowerCase())||void 0===r?void 0:r.includes("encountered"))&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then((e=>E(e)?{value:e.value}:{issues:n.common.issues}))}async parseAsync(e,t){const r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){const r={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:m(e)},n=this._parse({data:e,path:r.path,parent:r}),s=await(j(n)?n:Promise.resolve(n));return L(r,s)}refine(e,t){const r=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,n)=>{const s=e(t),i=()=>n.addIssue({code:v.custom,...r(t)});return"undefined"!=typeof Promise&&s instanceof Promise?s.then((e=>!!e||(i(),!1))):!!s||(i(),!1)}))}refinement(e,t){return this._refinement(((r,n)=>!!e(r)||(n.addIssue("function"==typeof t?t(r,n):t),!1)))}_refinement(e){return new Be({schema:this,typeName:Qe.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return Fe.create(this,this._def)}nullable(){return ze.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return we.create(this)}promise(){return $e.create(this,this._def)}or(e){return Oe.create([this,e],this._def)}and(e){return De.create(this,e,this._def)}transform(e){return new Be({...U(this._def),schema:this,typeName:Qe.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new He({...U(this._def),innerType:this,defaultValue:t,typeName:Qe.ZodDefault})}brand(){return new Ke({typeName:Qe.ZodBranded,type:this,...U(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new Ve({...U(this._def),innerType:this,catchValue:t,typeName:Qe.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return Xe.create(this,e)}readonly(){return Ge.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const B=/^c[^\s-]{8,}$/i,F=/^[0-9a-z]+$/,z=/^[0-9A-HJKMNP-TV-Z]{26}$/i,H=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,V=/^[a-z0-9_-]{21}$/i,q=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,W=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,K=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let X;const G=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Y=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,J=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Q=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ee=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,te=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,re="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",ne=new RegExp(`^${re}$`);function se(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function ie(e){let t=`${re}T${se(e)}`;const r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function ae(e,t){return!("v4"!==t&&t||!G.test(e))||!("v6"!==t&&t||!J.test(e))}function oe(e,t){if(!q.test(e))return!1;try{const[r]=e.split("."),n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),s=JSON.parse(atob(n));return!("object"!=typeof s||null===s||!s.typ||!s.alg||t&&s.alg!==t)}catch(e){return!1}}function ce(e,t){return!("v4"!==t&&t||!Y.test(e))||!("v6"!==t&&t||!Q.test(e))}class de extends ${_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==g.string){const t=this._getOrReturnCtx(e);return T(t,{code:v.invalid_type,expected:g.string,received:t.parsedType}),O}const t=new S;let r;for(const n of this._def.checks)if("min"===n.kind)e.data.length<n.value&&(r=this._getOrReturnCtx(e,r),T(r,{code:v.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),t.dirty());else if("max"===n.kind)e.data.length>n.value&&(r=this._getOrReturnCtx(e,r),T(r,{code:v.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),t.dirty());else if("length"===n.kind){const s=e.data.length>n.value,i=e.data.length<n.value;(s||i)&&(r=this._getOrReturnCtx(e,r),s?T(r,{code:v.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):i&&T(r,{code:v.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),t.dirty())}else if("email"===n.kind)K.test(e.data)||(r=this._getOrReturnCtx(e,r),T(r,{validation:"email",code:v.invalid_string,message:n.message}),t.dirty());else if("emoji"===n.kind)X||(X=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),X.test(e.data)||(r=this._getOrReturnCtx(e,r),T(r,{validation:"emoji",code:v.invalid_string,message:n.message}),t.dirty());else if("uuid"===n.kind)H.test(e.data)||(r=this._getOrReturnCtx(e,r),T(r,{validation:"uuid",code:v.invalid_string,message:n.message}),t.dirty());else if("nanoid"===n.kind)V.test(e.data)||(r=this._getOrReturnCtx(e,r),T(r,{validation:"nanoid",code:v.invalid_string,message:n.message}),t.dirty());else if("cuid"===n.kind)B.test(e.data)||(r=this._getOrReturnCtx(e,r),T(r,{validation:"cuid",code:v.invalid_string,message:n.message}),t.dirty());else if("cuid2"===n.kind)F.test(e.data)||(r=this._getOrReturnCtx(e,r),T(r,{validation:"cuid2",code:v.invalid_string,message:n.message}),t.dirty());else if("ulid"===n.kind)z.test(e.data)||(r=this._getOrReturnCtx(e,r),T(r,{validation:"ulid",code:v.invalid_string,message:n.message}),t.dirty());else if("url"===n.kind)try{new URL(e.data)}catch(s){r=this._getOrReturnCtx(e,r),T(r,{validation:"url",code:v.invalid_string,message:n.message}),t.dirty()}else"regex"===n.kind?(n.regex.lastIndex=0,n.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),T(r,{validation:"regex",code:v.invalid_string,message:n.message}),t.dirty())):"trim"===n.kind?e.data=e.data.trim():"includes"===n.kind?e.data.includes(n.value,n.position)||(r=this._getOrReturnCtx(e,r),T(r,{code:v.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),t.dirty()):"toLowerCase"===n.kind?e.data=e.data.toLowerCase():"toUpperCase"===n.kind?e.data=e.data.toUpperCase():"startsWith"===n.kind?e.data.startsWith(n.value)||(r=this._getOrReturnCtx(e,r),T(r,{code:v.invalid_string,validation:{startsWith:n.value},message:n.message}),t.dirty()):"endsWith"===n.kind?e.data.endsWith(n.value)||(r=this._getOrReturnCtx(e,r),T(r,{code:v.invalid_string,validation:{endsWith:n.value},message:n.message}),t.dirty()):"datetime"===n.kind?ie(n).test(e.data)||(r=this._getOrReturnCtx(e,r),T(r,{code:v.invalid_string,validation:"datetime",message:n.message}),t.dirty()):"date"===n.kind?ne.test(e.data)||(r=this._getOrReturnCtx(e,r),T(r,{code:v.invalid_string,validation:"date",message:n.message}),t.dirty()):"time"===n.kind?new RegExp(`^${se(n)}$`).test(e.data)||(r=this._getOrReturnCtx(e,r),T(r,{code:v.invalid_string,validation:"time",message:n.message}),t.dirty()):"duration"===n.kind?W.test(e.data)||(r=this._getOrReturnCtx(e,r),T(r,{validation:"duration",code:v.invalid_string,message:n.message}),t.dirty()):"ip"===n.kind?ae(e.data,n.version)||(r=this._getOrReturnCtx(e,r),T(r,{validation:"ip",code:v.invalid_string,message:n.message}),t.dirty()):"jwt"===n.kind?oe(e.data,n.alg)||(r=this._getOrReturnCtx(e,r),T(r,{validation:"jwt",code:v.invalid_string,message:n.message}),t.dirty()):"cidr"===n.kind?ce(e.data,n.version)||(r=this._getOrReturnCtx(e,r),T(r,{validation:"cidr",code:v.invalid_string,message:n.message}),t.dirty()):"base64"===n.kind?ee.test(e.data)||(r=this._getOrReturnCtx(e,r),T(r,{validation:"base64",code:v.invalid_string,message:n.message}),t.dirty()):"base64url"===n.kind?te.test(e.data)||(r=this._getOrReturnCtx(e,r),T(r,{validation:"base64url",code:v.invalid_string,message:n.message}),t.dirty()):f.assertNever(n);return{status:t.value,value:e.data}}_regex(e,t,r){return this.refinement((t=>e.test(t)),{validation:t,code:v.invalid_string,...R.errToObj(r)})}_addCheck(e){return new de({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...R.errToObj(e)})}url(e){return this._addCheck({kind:"url",...R.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...R.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...R.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...R.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...R.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...R.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...R.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...R.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...R.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...R.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...R.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...R.errToObj(e)})}datetime(e){var t,r;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(r=null==e?void 0:e.local)&&void 0!==r&&r,...R.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...R.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...R.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...R.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...R.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...R.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...R.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...R.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...R.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...R.errToObj(t)})}nonempty(e){return this.min(1,R.errToObj(e))}trim(){return new de({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new de({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new de({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isCIDR(){return!!this._def.checks.find((e=>"cidr"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get isBase64url(){return!!this._def.checks.find((e=>"base64url"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function ue(e,t){const r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,s=r>n?r:n;return parseInt(e.toFixed(s).replace(".",""))%parseInt(t.toFixed(s).replace(".",""))/Math.pow(10,s)}de.create=e=>{var t;return new de({checks:[],typeName:Qe.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...U(e)})};class le extends ${constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==g.number){const t=this._getOrReturnCtx(e);return T(t,{code:v.invalid_type,expected:g.number,received:t.parsedType}),O}let t;const r=new S;for(const n of this._def.checks)"int"===n.kind?f.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),T(t,{code:v.invalid_type,expected:"integer",received:"float",message:n.message}),r.dirty()):"min"===n.kind?(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),T(t,{code:v.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):"max"===n.kind?(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),T(t,{code:v.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):"multipleOf"===n.kind?0!==ue(e.data,n.value)&&(t=this._getOrReturnCtx(e,t),T(t,{code:v.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):"finite"===n.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),T(t,{code:v.not_finite,message:n.message}),r.dirty()):f.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,R.toString(t))}gt(e,t){return this.setLimit("min",e,!1,R.toString(t))}lte(e,t){return this.setLimit("max",e,!0,R.toString(t))}lt(e,t){return this.setLimit("max",e,!1,R.toString(t))}setLimit(e,t,r,n){return new le({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:R.toString(n)}]})}_addCheck(e){return new le({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:R.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:R.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:R.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:R.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:R.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:R.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:R.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:R.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:R.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find((e=>"int"===e.kind||"multipleOf"===e.kind&&f.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const r of this._def.checks){if("finite"===r.kind||"int"===r.kind||"multipleOf"===r.kind)return!0;"min"===r.kind?(null===t||r.value>t)&&(t=r.value):"max"===r.kind&&(null===e||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}}le.create=e=>new le({checks:[],typeName:Qe.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...U(e)});class he extends ${constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch(t){return this._getInvalidInput(e)}if(this._getType(e)!==g.bigint)return this._getInvalidInput(e);let t;const r=new S;for(const n of this._def.checks)"min"===n.kind?(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),T(t,{code:v.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):"max"===n.kind?(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),T(t,{code:v.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):"multipleOf"===n.kind?e.data%n.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),T(t,{code:v.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):f.assertNever(n);return{status:r.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return T(t,{code:v.invalid_type,expected:g.bigint,received:t.parsedType}),O}gte(e,t){return this.setLimit("min",e,!0,R.toString(t))}gt(e,t){return this.setLimit("min",e,!1,R.toString(t))}lte(e,t){return this.setLimit("max",e,!0,R.toString(t))}lt(e,t){return this.setLimit("max",e,!1,R.toString(t))}setLimit(e,t,r,n){return new he({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:R.toString(n)}]})}_addCheck(e){return new he({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:R.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:R.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:R.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:R.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:R.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}he.create=e=>{var t;return new he({checks:[],typeName:Qe.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...U(e)})};class fe extends ${_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==g.boolean){const t=this._getOrReturnCtx(e);return T(t,{code:v.invalid_type,expected:g.boolean,received:t.parsedType}),O}return I(e.data)}}fe.create=e=>new fe({typeName:Qe.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...U(e)});class pe extends ${_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==g.date){const t=this._getOrReturnCtx(e);return T(t,{code:v.invalid_type,expected:g.date,received:t.parsedType}),O}if(isNaN(e.data.getTime()))return T(this._getOrReturnCtx(e),{code:v.invalid_date}),O;const t=new S;let r;for(const n of this._def.checks)"min"===n.kind?e.data.getTime()<n.value&&(r=this._getOrReturnCtx(e,r),T(r,{code:v.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),t.dirty()):"max"===n.kind?e.data.getTime()>n.value&&(r=this._getOrReturnCtx(e,r),T(r,{code:v.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),t.dirty()):f.assertNever(n);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new pe({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:R.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:R.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}pe.create=e=>new pe({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Qe.ZodDate,...U(e)});class ge extends ${_parse(e){if(this._getType(e)!==g.symbol){const t=this._getOrReturnCtx(e);return T(t,{code:v.invalid_type,expected:g.symbol,received:t.parsedType}),O}return I(e.data)}}ge.create=e=>new ge({typeName:Qe.ZodSymbol,...U(e)});class me extends ${_parse(e){if(this._getType(e)!==g.undefined){const t=this._getOrReturnCtx(e);return T(t,{code:v.invalid_type,expected:g.undefined,received:t.parsedType}),O}return I(e.data)}}me.create=e=>new me({typeName:Qe.ZodUndefined,...U(e)});class ve extends ${_parse(e){if(this._getType(e)!==g.null){const t=this._getOrReturnCtx(e);return T(t,{code:v.invalid_type,expected:g.null,received:t.parsedType}),O}return I(e.data)}}ve.create=e=>new ve({typeName:Qe.ZodNull,...U(e)});class ye extends ${constructor(){super(...arguments),this._any=!0}_parse(e){return I(e.data)}}ye.create=e=>new ye({typeName:Qe.ZodAny,...U(e)});class _e extends ${constructor(){super(...arguments),this._unknown=!0}_parse(e){return I(e.data)}}_e.create=e=>new _e({typeName:Qe.ZodUnknown,...U(e)});class be extends ${_parse(e){const t=this._getOrReturnCtx(e);return T(t,{code:v.invalid_type,expected:g.never,received:t.parsedType}),O}}be.create=e=>new be({typeName:Qe.ZodNever,...U(e)});class xe extends ${_parse(e){if(this._getType(e)!==g.undefined){const t=this._getOrReturnCtx(e);return T(t,{code:v.invalid_type,expected:g.void,received:t.parsedType}),O}return I(e.data)}}xe.create=e=>new xe({typeName:Qe.ZodVoid,...U(e)});class we extends ${_parse(e){const{ctx:t,status:r}=this._processInputParams(e),n=this._def;if(t.parsedType!==g.array)return T(t,{code:v.invalid_type,expected:g.array,received:t.parsedType}),O;if(null!==n.exactLength){const e=t.data.length>n.exactLength.value,s=t.data.length<n.exactLength.value;(e||s)&&(T(t,{code:e?v.too_big:v.too_small,minimum:s?n.exactLength.value:void 0,maximum:e?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),r.dirty())}if(null!==n.minLength&&t.data.length<n.minLength.value&&(T(t,{code:v.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),r.dirty()),null!==n.maxLength&&t.data.length>n.maxLength.value&&(T(t,{code:v.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map(((e,r)=>n.type._parseAsync(new Z(t,e,t.path,r))))).then((e=>S.mergeArray(r,e)));const s=[...t.data].map(((e,r)=>n.type._parseSync(new Z(t,e,t.path,r))));return S.mergeArray(r,s)}get element(){return this._def.type}min(e,t){return new we({...this._def,minLength:{value:e,message:R.toString(t)}})}max(e,t){return new we({...this._def,maxLength:{value:e,message:R.toString(t)}})}length(e,t){return new we({...this._def,exactLength:{value:e,message:R.toString(t)}})}nonempty(e){return this.min(1,e)}}function Te(e){if(e instanceof Se){const t={};for(const r in e.shape){const n=e.shape[r];t[r]=Fe.create(Te(n))}return new Se({...e._def,shape:()=>t})}return e instanceof we?new we({...e._def,type:Te(e.element)}):e instanceof Fe?Fe.create(Te(e.unwrap())):e instanceof ze?ze.create(Te(e.unwrap())):e instanceof Ee?Ee.create(e.items.map((e=>Te(e)))):e}we.create=(e,t)=>new we({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Qe.ZodArray,...U(t)});class Se extends ${constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=f.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==g.object){const t=this._getOrReturnCtx(e);return T(t,{code:v.invalid_type,expected:g.object,received:t.parsedType}),O}const{status:t,ctx:r}=this._processInputParams(e),{shape:n,keys:s}=this._getCached(),i=[];if(!(this._def.catchall instanceof be&&"strip"===this._def.unknownKeys))for(const e in r.data)s.includes(e)||i.push(e);const a=[];for(const e of s){const t=n[e],s=r.data[e];a.push({key:{status:"valid",value:e},value:t._parse(new Z(r,s,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof be){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of i)a.push({key:{status:"valid",value:e},value:{status:"valid",value:r.data[e]}});else if("strict"===e)i.length>0&&(T(r,{code:v.unrecognized_keys,keys:i}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of i){const n=r.data[t];a.push({key:{status:"valid",value:t},value:e._parse(new Z(r,n,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of a){const r=await t.key,n=await t.value;e.push({key:r,value:n,alwaysSet:t.alwaysSet})}return e})).then((e=>S.mergeObjectSync(t,e))):S.mergeObjectSync(t,a)}get shape(){return this._def.shape()}strict(e){return R.errToObj,new Se({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,r)=>{var n,s,i,a;const o=null!==(i=null===(s=(n=this._def).errorMap)||void 0===s?void 0:s.call(n,t,r).message)&&void 0!==i?i:r.defaultError;return"unrecognized_keys"===t.code?{message:null!==(a=R.errToObj(e).message)&&void 0!==a?a:o}:{message:o}}}:{}})}strip(){return new Se({...this._def,unknownKeys:"strip"})}passthrough(){return new Se({...this._def,unknownKeys:"passthrough"})}extend(e){return new Se({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Se({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Qe.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Se({...this._def,catchall:e})}pick(e){const t={};return f.objectKeys(e).forEach((r=>{e[r]&&this.shape[r]&&(t[r]=this.shape[r])})),new Se({...this._def,shape:()=>t})}omit(e){const t={};return f.objectKeys(this.shape).forEach((r=>{e[r]||(t[r]=this.shape[r])})),new Se({...this._def,shape:()=>t})}deepPartial(){return Te(this)}partial(e){const t={};return f.objectKeys(this.shape).forEach((r=>{const n=this.shape[r];e&&!e[r]?t[r]=n:t[r]=n.optional()})),new Se({...this._def,shape:()=>t})}required(e){const t={};return f.objectKeys(this.shape).forEach((r=>{if(e&&!e[r])t[r]=this.shape[r];else{let e=this.shape[r];for(;e instanceof Fe;)e=e._def.innerType;t[r]=e}})),new Se({...this._def,shape:()=>t})}keyof(){return Ze(f.objectKeys(this.shape))}}Se.create=(e,t)=>new Se({shape:()=>e,unknownKeys:"strip",catchall:be.create(),typeName:Qe.ZodObject,...U(t)}),Se.strictCreate=(e,t)=>new Se({shape:()=>e,unknownKeys:"strict",catchall:be.create(),typeName:Qe.ZodObject,...U(t)}),Se.lazycreate=(e,t)=>new Se({shape:e,unknownKeys:"strip",catchall:be.create(),typeName:Qe.ZodObject,...U(t)});class Oe extends ${_parse(e){const{ctx:t}=this._processInputParams(e),r=this._def.options;if(t.common.async)return Promise.all(r.map((async e=>{const r={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;const r=e.map((e=>new y(e.ctx.common.issues)));return T(t,{code:v.invalid_union,unionErrors:r}),O}));{let e;const n=[];for(const s of r){const r={...t,common:{...t.common,issues:[]},parent:null},i=s._parseSync({data:t.data,path:t.path,parent:r});if("valid"===i.status)return i;"dirty"!==i.status||e||(e={result:i,ctx:r}),r.common.issues.length&&n.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const s=n.map((e=>new y(e)));return T(t,{code:v.invalid_union,unionErrors:s}),O}}get options(){return this._def.options}}Oe.create=(e,t)=>new Oe({options:e,typeName:Qe.ZodUnion,...U(t)});const ke=e=>e instanceof Ae?ke(e.schema):e instanceof Be?ke(e.innerType()):e instanceof Me?[e.value]:e instanceof Le?e.options:e instanceof Ue?f.objectValues(e.enum):e instanceof He?ke(e._def.innerType):e instanceof me?[void 0]:e instanceof ve?[null]:e instanceof Fe?[void 0,...ke(e.unwrap())]:e instanceof ze?[null,...ke(e.unwrap())]:e instanceof Ke||e instanceof Ge?ke(e.unwrap()):e instanceof Ve?ke(e._def.innerType):[];class Ie extends ${_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==g.object)return T(t,{code:v.invalid_type,expected:g.object,received:t.parsedType}),O;const r=this.discriminator,n=t.data[r],s=this.optionsMap.get(n);return s?t.common.async?s._parseAsync({data:t.data,path:t.path,parent:t}):s._parseSync({data:t.data,path:t.path,parent:t}):(T(t,{code:v.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),O)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){const n=new Map;for(const r of t){const t=ke(r.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const s of t){if(n.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);n.set(s,r)}}return new Ie({typeName:Qe.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...U(r)})}}function Ce(e,t){const r=m(e),n=m(t);if(e===t)return{valid:!0,data:e};if(r===g.object&&n===g.object){const r=f.objectKeys(t),n=f.objectKeys(e).filter((e=>-1!==r.indexOf(e))),s={...e,...t};for(const r of n){const n=Ce(e[r],t[r]);if(!n.valid)return{valid:!1};s[r]=n.data}return{valid:!0,data:s}}if(r===g.array&&n===g.array){if(e.length!==t.length)return{valid:!1};const r=[];for(let n=0;n<e.length;n++){const s=Ce(e[n],t[n]);if(!s.valid)return{valid:!1};r.push(s.data)}return{valid:!0,data:r}}return r===g.date&&n===g.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class De extends ${_parse(e){const{status:t,ctx:r}=this._processInputParams(e),n=(e,n)=>{if(C(e)||C(n))return O;const s=Ce(e.value,n.value);return s.valid?((D(e)||D(n))&&t.dirty(),{status:t.value,value:s.data}):(T(r,{code:v.invalid_intersection_types}),O)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then((([e,t])=>n(e,t))):n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}De.create=(e,t,r)=>new De({left:e,right:t,typeName:Qe.ZodIntersection,...U(r)});class Ee extends ${_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==g.array)return T(r,{code:v.invalid_type,expected:g.array,received:r.parsedType}),O;if(r.data.length<this._def.items.length)return T(r,{code:v.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),O;!this._def.rest&&r.data.length>this._def.items.length&&(T(r,{code:v.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const n=[...r.data].map(((e,t)=>{const n=this._def.items[t]||this._def.rest;return n?n._parse(new Z(r,e,r.path,t)):null})).filter((e=>!!e));return r.common.async?Promise.all(n).then((e=>S.mergeArray(t,e))):S.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new Ee({...this._def,rest:e})}}Ee.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ee({items:e,typeName:Qe.ZodTuple,rest:null,...U(t)})};class je extends ${get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==g.object)return T(r,{code:v.invalid_type,expected:g.object,received:r.parsedType}),O;const n=[],s=this._def.keyType,i=this._def.valueType;for(const e in r.data)n.push({key:s._parse(new Z(r,e,r.path,e)),value:i._parse(new Z(r,r.data[e],r.path,e)),alwaysSet:e in r.data});return r.common.async?S.mergeObjectAsync(t,n):S.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,r){return new je(t instanceof $?{keyType:e,valueType:t,typeName:Qe.ZodRecord,...U(r)}:{keyType:de.create(),valueType:e,typeName:Qe.ZodRecord,...U(t)})}}class Ne extends ${get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==g.map)return T(r,{code:v.invalid_type,expected:g.map,received:r.parsedType}),O;const n=this._def.keyType,s=this._def.valueType,i=[...r.data.entries()].map((([e,t],i)=>({key:n._parse(new Z(r,e,r.path,[i,"key"])),value:s._parse(new Z(r,t,r.path,[i,"value"]))})));if(r.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const r of i){const n=await r.key,s=await r.value;if("aborted"===n.status||"aborted"===s.status)return O;"dirty"!==n.status&&"dirty"!==s.status||t.dirty(),e.set(n.value,s.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const r of i){const n=r.key,s=r.value;if("aborted"===n.status||"aborted"===s.status)return O;"dirty"!==n.status&&"dirty"!==s.status||t.dirty(),e.set(n.value,s.value)}return{status:t.value,value:e}}}}Ne.create=(e,t,r)=>new Ne({valueType:t,keyType:e,typeName:Qe.ZodMap,...U(r)});class Pe extends ${_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==g.set)return T(r,{code:v.invalid_type,expected:g.set,received:r.parsedType}),O;const n=this._def;null!==n.minSize&&r.data.size<n.minSize.value&&(T(r,{code:v.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),null!==n.maxSize&&r.data.size>n.maxSize.value&&(T(r,{code:v.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());const s=this._def.valueType;function i(e){const r=new Set;for(const n of e){if("aborted"===n.status)return O;"dirty"===n.status&&t.dirty(),r.add(n.value)}return{status:t.value,value:r}}const a=[...r.data.values()].map(((e,t)=>s._parse(new Z(r,e,r.path,t))));return r.common.async?Promise.all(a).then((e=>i(e))):i(a)}min(e,t){return new Pe({...this._def,minSize:{value:e,message:R.toString(t)}})}max(e,t){return new Pe({...this._def,maxSize:{value:e,message:R.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Pe.create=(e,t)=>new Pe({valueType:e,minSize:null,maxSize:null,typeName:Qe.ZodSet,...U(t)});class Re extends ${constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==g.function)return T(t,{code:v.invalid_type,expected:g.function,received:t.parsedType}),O;function r(e,r){return w({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,x(),_].filter((e=>!!e)),issueData:{code:v.invalid_arguments,argumentsError:r}})}function n(e,r){return w({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,x(),_].filter((e=>!!e)),issueData:{code:v.invalid_return_type,returnTypeError:r}})}const s={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof $e){const e=this;return I((async function(...t){const a=new y([]),o=await e._def.args.parseAsync(t,s).catch((e=>{throw a.addIssue(r(t,e)),a})),c=await Reflect.apply(i,this,o);return await e._def.returns._def.type.parseAsync(c,s).catch((e=>{throw a.addIssue(n(c,e)),a}))}))}{const e=this;return I((function(...t){const a=e._def.args.safeParse(t,s);if(!a.success)throw new y([r(t,a.error)]);const o=Reflect.apply(i,this,a.data),c=e._def.returns.safeParse(o,s);if(!c.success)throw new y([n(o,c.error)]);return c.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Re({...this._def,args:Ee.create(e).rest(_e.create())})}returns(e){return new Re({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new Re({args:e||Ee.create([]).rest(_e.create()),returns:t||_e.create(),typeName:Qe.ZodFunction,...U(r)})}}class Ae extends ${get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}Ae.create=(e,t)=>new Ae({getter:e,typeName:Qe.ZodLazy,...U(t)});class Me extends ${_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return T(t,{received:t.data,code:v.invalid_literal,expected:this._def.value}),O}return{status:"valid",value:e.data}}get value(){return this._def.value}}function Ze(e,t){return new Le({values:e,typeName:Qe.ZodEnum,...U(t)})}Me.create=(e,t)=>new Me({value:e,typeName:Qe.ZodLiteral,...U(t)});class Le extends ${constructor(){super(...arguments),A.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),r=this._def.values;return T(t,{expected:f.joinValues(r),received:t.parsedType,code:v.invalid_type}),O}if(N(this,A,"f")||P(this,A,new Set(this._def.values),"f"),!N(this,A,"f").has(e.data)){const t=this._getOrReturnCtx(e),r=this._def.values;return T(t,{received:t.data,code:v.invalid_enum_value,options:r}),O}return I(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return Le.create(e,{...this._def,...t})}exclude(e,t=this._def){return Le.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}A=new WeakMap,Le.create=Ze;class Ue extends ${constructor(){super(...arguments),M.set(this,void 0)}_parse(e){const t=f.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==g.string&&r.parsedType!==g.number){const e=f.objectValues(t);return T(r,{expected:f.joinValues(e),received:r.parsedType,code:v.invalid_type}),O}if(N(this,M,"f")||P(this,M,new Set(f.getValidEnumValues(this._def.values)),"f"),!N(this,M,"f").has(e.data)){const e=f.objectValues(t);return T(r,{received:r.data,code:v.invalid_enum_value,options:e}),O}return I(e.data)}get enum(){return this._def.values}}M=new WeakMap,Ue.create=(e,t)=>new Ue({values:e,typeName:Qe.ZodNativeEnum,...U(t)});class $e extends ${unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==g.promise&&!1===t.common.async)return T(t,{code:v.invalid_type,expected:g.promise,received:t.parsedType}),O;const r=t.parsedType===g.promise?t.data:Promise.resolve(t.data);return I(r.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}$e.create=(e,t)=>new $e({type:e,typeName:Qe.ZodPromise,...U(t)});class Be extends ${innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Qe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:r}=this._processInputParams(e),n=this._def.effect||null,s={addIssue:e=>{T(r,e),e.fatal?t.abort():t.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),"preprocess"===n.type){const e=n.transform(r.data,s);if(r.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return O;const n=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return"aborted"===n.status?O:"dirty"===n.status||"dirty"===t.value?k(n.value):n}));{if("aborted"===t.value)return O;const n=this._def.schema._parseSync({data:e,path:r.path,parent:r});return"aborted"===n.status?O:"dirty"===n.status||"dirty"===t.value?k(n.value):n}}if("refinement"===n.type){const e=e=>{const t=n.refinement(e,s);if(r.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===r.common.async){const n=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===n.status?O:("dirty"===n.status&&t.dirty(),e(n.value),{status:t.value,value:n.value})}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((r=>"aborted"===r.status?O:("dirty"===r.status&&t.dirty(),e(r.value).then((()=>({status:t.value,value:r.value}))))))}if("transform"===n.type){if(!1===r.common.async){const e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!E(e))return e;const i=n.transform(e.value,s);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((e=>E(e)?Promise.resolve(n.transform(e.value,s)).then((e=>({status:t.value,value:e}))):e))}f.assertNever(n)}}Be.create=(e,t,r)=>new Be({schema:e,typeName:Qe.ZodEffects,effect:t,...U(r)}),Be.createWithPreprocess=(e,t,r)=>new Be({schema:t,effect:{type:"preprocess",transform:e},typeName:Qe.ZodEffects,...U(r)});class Fe extends ${_parse(e){return this._getType(e)===g.undefined?I(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Fe.create=(e,t)=>new Fe({innerType:e,typeName:Qe.ZodOptional,...U(t)});class ze extends ${_parse(e){return this._getType(e)===g.null?I(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ze.create=(e,t)=>new ze({innerType:e,typeName:Qe.ZodNullable,...U(t)});class He extends ${_parse(e){const{ctx:t}=this._processInputParams(e);let r=t.data;return t.parsedType===g.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}He.create=(e,t)=>new He({innerType:e,typeName:Qe.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...U(t)});class Ve extends ${_parse(e){const{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return j(n)?n.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new y(r.common.issues)},input:r.data})}))):{status:"valid",value:"valid"===n.status?n.value:this._def.catchValue({get error(){return new y(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Ve.create=(e,t)=>new Ve({innerType:e,typeName:Qe.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...U(t)});class qe extends ${_parse(e){if(this._getType(e)!==g.nan){const t=this._getOrReturnCtx(e);return T(t,{code:v.invalid_type,expected:g.nan,received:t.parsedType}),O}return{status:"valid",value:e.data}}}qe.create=e=>new qe({typeName:Qe.ZodNaN,...U(e)});const We=Symbol("zod_brand");class Ke extends ${_parse(e){const{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class Xe extends ${_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const e=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?O:"dirty"===e.status?(t.dirty(),k(e.value)):this._def.out._parseAsync({data:e.value,path:r.path,parent:r})})();{const e=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?O:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:r.path,parent:r})}}static create(e,t){return new Xe({in:e,out:t,typeName:Qe.ZodPipeline})}}class Ge extends ${_parse(e){const t=this._def.innerType._parse(e),r=e=>(E(e)&&(e.value=Object.freeze(e.value)),e);return j(t)?t.then((e=>r(e))):r(t)}unwrap(){return this._def.innerType}}function Ye(e,t={},r){return e?ye.create().superRefine(((n,s)=>{var i,a;if(!e(n)){const e="function"==typeof t?t(n):"string"==typeof t?{message:t}:t,o=null===(a=null!==(i=e.fatal)&&void 0!==i?i:r)||void 0===a||a,c="string"==typeof e?{message:e}:e;s.addIssue({code:"custom",...c,fatal:o})}})):ye.create()}Ge.create=(e,t)=>new Ge({innerType:e,typeName:Qe.ZodReadonly,...U(t)});const Je={object:Se.lazycreate};var Qe;!function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(Qe||(Qe={}));const et=de.create,tt=le.create,rt=qe.create,nt=he.create,st=fe.create,it=pe.create,at=ge.create,ot=me.create,ct=ve.create,dt=ye.create,ut=_e.create,lt=be.create,ht=xe.create,ft=we.create,pt=Se.create,gt=Se.strictCreate,mt=Oe.create,vt=Ie.create,yt=De.create,_t=Ee.create,bt=je.create,xt=Ne.create,wt=Pe.create,Tt=Re.create,St=Ae.create,Ot=Me.create,kt=Le.create,It=Ue.create,Ct=$e.create,Dt=Be.create,Et=Fe.create,jt=ze.create,Nt=Be.createWithPreprocess,Pt=Xe.create,Rt={string:e=>de.create({...e,coerce:!0}),number:e=>le.create({...e,coerce:!0}),boolean:e=>fe.create({...e,coerce:!0}),bigint:e=>he.create({...e,coerce:!0}),date:e=>pe.create({...e,coerce:!0})},At=O;var Mt=Object.freeze({__proto__:null,defaultErrorMap:_,setErrorMap:function(e){b=e},getErrorMap:x,makeIssue:w,EMPTY_PATH:[],addIssueToContext:T,ParseStatus:S,INVALID:O,DIRTY:k,OK:I,isAborted:C,isDirty:D,isValid:E,isAsync:j,get util(){return f},get objectUtil(){return p},ZodParsedType:g,getParsedType:m,ZodType:$,datetimeRegex:ie,ZodString:de,ZodNumber:le,ZodBigInt:he,ZodBoolean:fe,ZodDate:pe,ZodSymbol:ge,ZodUndefined:me,ZodNull:ve,ZodAny:ye,ZodUnknown:_e,ZodNever:be,ZodVoid:xe,ZodArray:we,ZodObject:Se,ZodUnion:Oe,ZodDiscriminatedUnion:Ie,ZodIntersection:De,ZodTuple:Ee,ZodRecord:je,ZodMap:Ne,ZodSet:Pe,ZodFunction:Re,ZodLazy:Ae,ZodLiteral:Me,ZodEnum:Le,ZodNativeEnum:Ue,ZodPromise:$e,ZodEffects:Be,ZodTransformer:Be,ZodOptional:Fe,ZodNullable:ze,ZodDefault:He,ZodCatch:Ve,ZodNaN:qe,BRAND:We,ZodBranded:Ke,ZodPipeline:Xe,ZodReadonly:Ge,custom:Ye,Schema:$,ZodSchema:$,late:Je,get ZodFirstPartyTypeKind(){return Qe},coerce:Rt,any:dt,array:ft,bigint:nt,boolean:st,date:it,discriminatedUnion:vt,effect:Dt,enum:kt,function:Tt,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>Ye((t=>t instanceof e),t),intersection:yt,lazy:St,literal:Ot,map:xt,nan:rt,nativeEnum:It,never:lt,null:ct,nullable:jt,number:tt,object:pt,oboolean:()=>st().optional(),onumber:()=>tt().optional(),optional:Et,ostring:()=>et().optional(),pipeline:Pt,preprocess:Nt,promise:Ct,record:bt,set:wt,strictObject:gt,string:et,symbol:at,transformer:Dt,tuple:_t,undefined:ot,union:mt,unknown:ut,void:ht,NEVER:At,ZodIssueCode:v,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:y});const Zt=Mt.object({version:Mt.literal("1",{message:"Version must be 1"}),name:Mt.string({invalid_type_error:"Name must be a string",required_error:"Name is required"}).max(32,{message:"Name must be 32 characters or less"}),homeUrl:Mt.string({invalid_type_error:"Home URL must be a string",required_error:"Home URL is required"}).max(512,{message:"Home URL must be 512 characters or less"}),iconUrl:Mt.string({invalid_type_error:"Icon URL must be a string",required_error:"Icon URL is required"}).max(512,{message:"Icon URL must be 512 characters or less"}),splashImageUrl:Mt.string({invalid_type_error:"Splash image URL must be a string"}).max(512,{message:"Splash image URL must be 512 characters or less"}).optional(),imageUrl:Mt.string({invalid_type_error:"Image URL must be a string",required_error:"Image URL is required"}).max(512,{message:"Splash image URL must be 512 characters or less"}),buttonTitle:Mt.string({invalid_type_error:"Button title must be a string",required_error:"Button title is required"}).max(32,{message:"Button title must be 32 characters or less"}),splashBackgroundColor:Mt.string({invalid_type_error:"Splash background color must be a string"}).regex(/^#[0-9A-Fa-f]{3,6}$/,{message:"Splash background color must be a valid hex color"}).optional(),webhookUrl:Mt.string({invalid_type_error:"Webhook URL must be a string"}).max(512,{message:"Webhook URL must be 512 characters or less"}).optional()}),Lt=Mt.discriminatedUnion("type",[Mt.object({type:Mt.literal("cast",{message:"Trigger type must be cast"}),id:Mt.string({required_error:"Trigger ID is required"}),url:Mt.string({required_error:"Trigger URL is required"}),name:Mt.string({invalid_type_error:"Trigger name must be a string"}).optional()}),Mt.object({type:Mt.literal("composer",{message:"Trigger type must be composer"}),id:Mt.string({invalid_type_error:"Trigger ID must be a string",required_error:"Trigger ID is required"}),url:Mt.string({invalid_type_error:"Trigger URL must be a string",required_error:"Trigger URL is required"}),name:Mt.string({invalid_type_error:"Trigger name must be a string"}).optional()})]),Ut=Mt.object({accountAssociation:Mt.object({header:Mt.string({invalid_type_error:"Header must be a string",required_error:"Header is required"}),payload:Mt.string({invalid_type_error:"Payload must be a string",required_error:"Payload is required"}),signature:Mt.string({invalid_type_error:"Signature must be a string",required_error:"Signature is required"})},{invalid_type_error:"Account association must be an object"}),frame:Zt,triggers:Mt.array(Lt,{invalid_type_error:"Triggers must be an array"}).optional()}),$t=window.ReactJSXRuntime,Bt=()=>{const{removeNotice:e}=(0,h.useDispatch)(l.store),t=(0,h.useSelect)((e=>e(l.store).getNotices()),[]);if(0===t.length)return null;const r=t.map((e=>({id:e.id,content:e.content})));return(0,$t.jsx)(c.NoticeList,{notices:r,onRemove:e})},Ft=window.wp.mediaUtils;function zt(e,t,...r){if("undefined"!=typeof process&&void 0===t)throw new Error("invariant requires an error message argument");if(!e){let e;if(void 0===t)e=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{let n=0;e=new Error(t.replace(/%s/g,(function(){return r[n++]}))),e.name="Invariant Violation"}throw e.framesToPop=1,e}}var Ht=r(2017);const Vt=window.React,qt="undefined"!=typeof window?Vt.useLayoutEffect:Vt.useEffect;function Wt(e,t,r){return function(e,t,r){const[n,s]=function(e,t,r){const[n,s]=(0,Vt.useState)((()=>t(e))),i=(0,Vt.useCallback)((()=>{const i=t(e);Ht(n,i)||(s(i),r&&r())}),[n,e,r]);return qt(i),[n,i]}(e,t,r);return qt((function(){const t=e.getHandlerId();if(null!=t)return e.subscribeToStateChange(s,{handlerIds:[t]})}),[e,s]),n}(t,e||(()=>({})),(()=>r.reconnect()))}function Kt(e,t){const r=[...t||[]];return null==t&&"function"!=typeof e&&r.push(e),(0,Vt.useMemo)((()=>"function"==typeof e?e():e),r)}function Xt(e){return(0,Vt.useMemo)((()=>e.hooks.dragSource()),[e])}function Gt(e){return(0,Vt.useMemo)((()=>e.hooks.dragPreview()),[e])}function Yt(e,t,r,n){let s=r?r.call(n,e,t):void 0;if(void 0!==s)return!!s;if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;const i=Object.keys(e),a=Object.keys(t);if(i.length!==a.length)return!1;const o=Object.prototype.hasOwnProperty.bind(t);for(let a=0;a<i.length;a++){const c=i[a];if(!o(c))return!1;const d=e[c],u=t[c];if(s=r?r.call(n,d,u,c):void 0,!1===s||void 0===s&&d!==u)return!1}return!0}function Jt(e){return null!==e&&"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"current")}function Qt(e){const t={};return Object.keys(e).forEach((r=>{const n=e[r];if(r.endsWith("Ref"))t[r]=e[r];else{const e=function(e){return(t=null,r=null)=>{if(!(0,Vt.isValidElement)(t)){const n=t;return e(n,r),n}const n=t;return function(e){if("string"==typeof e.type)return;const t=e.type.displayName||e.type.name||"the component";throw new Error(`Only native element nodes can now be passed to React DnD connectors.You can either wrap ${t} into a <div>, or turn it into a drag source or a drop target itself.`)}(n),function(e,t){const r=e.ref;return zt("string"!=typeof r,"Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"),r?(0,Vt.cloneElement)(e,{ref:e=>{er(r,e),er(t,e)}}):(0,Vt.cloneElement)(e,{ref:t})}(n,r?t=>e(t,r):e)}}(n);t[r]=()=>e}})),t}function er(e,t){"function"==typeof e?e(t):e.current=t}class tr{receiveHandlerId(e){this.handlerId!==e&&(this.handlerId=e,this.reconnect())}get connectTarget(){return this.dragSource}get dragSourceOptions(){return this.dragSourceOptionsInternal}set dragSourceOptions(e){this.dragSourceOptionsInternal=e}get dragPreviewOptions(){return this.dragPreviewOptionsInternal}set dragPreviewOptions(e){this.dragPreviewOptionsInternal=e}reconnect(){const e=this.reconnectDragSource();this.reconnectDragPreview(e)}reconnectDragSource(){const e=this.dragSource,t=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();return t&&this.disconnectDragSource(),this.handlerId?e?(t&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragSource=e,this.lastConnectedDragSourceOptions=this.dragSourceOptions,this.dragSourceUnsubscribe=this.backend.connectDragSource(this.handlerId,e,this.dragSourceOptions)),t):(this.lastConnectedDragSource=e,t):t}reconnectDragPreview(e=!1){const t=this.dragPreview,r=e||this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();r&&this.disconnectDragPreview(),this.handlerId&&(t?r&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragPreview=t,this.lastConnectedDragPreviewOptions=this.dragPreviewOptions,this.dragPreviewUnsubscribe=this.backend.connectDragPreview(this.handlerId,t,this.dragPreviewOptions)):this.lastConnectedDragPreview=t)}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didConnectedDragSourceChange(){return this.lastConnectedDragSource!==this.dragSource}didConnectedDragPreviewChange(){return this.lastConnectedDragPreview!==this.dragPreview}didDragSourceOptionsChange(){return!Yt(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}didDragPreviewOptionsChange(){return!Yt(this.lastConnectedDragPreviewOptions,this.dragPreviewOptions)}disconnectDragSource(){this.dragSourceUnsubscribe&&(this.dragSourceUnsubscribe(),this.dragSourceUnsubscribe=void 0)}disconnectDragPreview(){this.dragPreviewUnsubscribe&&(this.dragPreviewUnsubscribe(),this.dragPreviewUnsubscribe=void 0,this.dragPreviewNode=null,this.dragPreviewRef=null)}get dragSource(){return this.dragSourceNode||this.dragSourceRef&&this.dragSourceRef.current}get dragPreview(){return this.dragPreviewNode||this.dragPreviewRef&&this.dragPreviewRef.current}clearDragSource(){this.dragSourceNode=null,this.dragSourceRef=null}clearDragPreview(){this.dragPreviewNode=null,this.dragPreviewRef=null}constructor(e){this.hooks=Qt({dragSource:(e,t)=>{this.clearDragSource(),this.dragSourceOptions=t||null,Jt(e)?this.dragSourceRef=e:this.dragSourceNode=e,this.reconnectDragSource()},dragPreview:(e,t)=>{this.clearDragPreview(),this.dragPreviewOptions=t||null,Jt(e)?this.dragPreviewRef=e:this.dragPreviewNode=e,this.reconnectDragPreview()}}),this.handlerId=null,this.dragSourceRef=null,this.dragSourceOptionsInternal=null,this.dragPreviewRef=null,this.dragPreviewOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDragSource=null,this.lastConnectedDragSourceOptions=null,this.lastConnectedDragPreview=null,this.lastConnectedDragPreviewOptions=null,this.backend=e}}const rr=(0,Vt.createContext)({dragDropManager:void 0});function nr(){const{dragDropManager:e}=(0,Vt.useContext)(rr);return zt(null!=e,"Expected drag drop context"),e}let sr=!1,ir=!1;class ar{receiveHandlerId(e){this.sourceId=e}getHandlerId(){return this.sourceId}canDrag(){zt(!sr,"You may not call monitor.canDrag() inside your canDrag() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return sr=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{sr=!1}}isDragging(){if(!this.sourceId)return!1;zt(!ir,"You may not call monitor.isDragging() inside your isDragging() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return ir=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{ir=!1}}subscribeToStateChange(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}isDraggingSource(e){return this.internalMonitor.isDraggingSource(e)}isOverTarget(e,t){return this.internalMonitor.isOverTarget(e,t)}getTargetIds(){return this.internalMonitor.getTargetIds()}isSourcePublic(){return this.internalMonitor.isSourcePublic()}getSourceId(){return this.internalMonitor.getSourceId()}subscribeToOffsetChange(e){return this.internalMonitor.subscribeToOffsetChange(e)}canDragSource(e){return this.internalMonitor.canDragSource(e)}canDropOnTarget(e){return this.internalMonitor.canDropOnTarget(e)}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(e){this.sourceId=null,this.internalMonitor=e.getMonitor()}}class or{beginDrag(){const e=this.spec,t=this.monitor;let r=null;return r="object"==typeof e.item?e.item:"function"==typeof e.item?e.item(t):{},null!=r?r:null}canDrag(){const e=this.spec,t=this.monitor;return"boolean"==typeof e.canDrag?e.canDrag:"function"!=typeof e.canDrag||e.canDrag(t)}isDragging(e,t){const r=this.spec,n=this.monitor,{isDragging:s}=r;return s?s(n):t===e.getSourceId()}endDrag(){const e=this.spec,t=this.monitor,r=this.connector,{end:n}=e;n&&n(t.getItem(),t),r.reconnect()}constructor(e,t,r){this.spec=e,this.monitor=t,this.connector=r}}function cr(e,t){const r=Kt(e,t);zt(!r.begin,"useDrag::spec.begin was deprecated in v14. Replace spec.begin() with spec.item(). (see more here - https://react-dnd.github.io/react-dnd/docs/api/use-drag)");const n=function(){const e=nr();return(0,Vt.useMemo)((()=>new ar(e)),[e])}(),s=function(e,t){const r=nr(),n=(0,Vt.useMemo)((()=>new tr(r.getBackend())),[r]);return qt((()=>(n.dragSourceOptions=e||null,n.reconnect(),()=>n.disconnectDragSource())),[n,e]),qt((()=>(n.dragPreviewOptions=t||null,n.reconnect(),()=>n.disconnectDragPreview())),[n,t]),n}(r.options,r.previewOptions);return function(e,t,r){const n=nr(),s=function(e,t,r){const n=(0,Vt.useMemo)((()=>new or(e,t,r)),[t,r]);return(0,Vt.useEffect)((()=>{n.spec=e}),[e]),n}(e,t,r),i=function(e){return(0,Vt.useMemo)((()=>{const t=e.type;return zt(null!=t,"spec.type must be defined"),t}),[e])}(e);qt((function(){if(null!=i){const[e,a]=function(e,t,r){const n=r.getRegistry(),s=n.addSource(e,t);return[s,()=>n.removeSource(s)]}(i,s,n);return t.receiveHandlerId(e),r.receiveHandlerId(e),a}}),[n,t,r,s,i])}(r,n,s),[Wt(r.collect,n,s),Xt(s),Gt(s)]}function dr(e){return(0,Vt.useMemo)((()=>e.hooks.dropTarget()),[e])}class ur{get connectTarget(){return this.dropTarget}reconnect(){const e=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();e&&this.disconnectDropTarget();const t=this.dropTarget;this.handlerId&&(t?e&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=t,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,t,this.dropTargetOptions)):this.lastConnectedDropTarget=t)}receiveHandlerId(e){e!==this.handlerId&&(this.handlerId=e,this.reconnect())}get dropTargetOptions(){return this.dropTargetOptionsInternal}set dropTargetOptions(e){this.dropTargetOptionsInternal=e}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didDropTargetChange(){return this.lastConnectedDropTarget!==this.dropTarget}didOptionsChange(){return!Yt(this.lastConnectedDropTargetOptions,this.dropTargetOptions)}disconnectDropTarget(){this.unsubscribeDropTarget&&(this.unsubscribeDropTarget(),this.unsubscribeDropTarget=void 0)}get dropTarget(){return this.dropTargetNode||this.dropTargetRef&&this.dropTargetRef.current}clearDropTarget(){this.dropTargetRef=null,this.dropTargetNode=null}constructor(e){this.hooks=Qt({dropTarget:(e,t)=>{this.clearDropTarget(),this.dropTargetOptions=t,Jt(e)?this.dropTargetRef=e:this.dropTargetNode=e,this.reconnect()}}),this.handlerId=null,this.dropTargetRef=null,this.dropTargetOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDropTarget=null,this.lastConnectedDropTargetOptions=null,this.backend=e}}let lr=!1;class hr{receiveHandlerId(e){this.targetId=e}getHandlerId(){return this.targetId}subscribeToStateChange(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}canDrop(){if(!this.targetId)return!1;zt(!lr,"You may not call monitor.canDrop() inside your canDrop() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor");try{return lr=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{lr=!1}}isOver(e){return!!this.targetId&&this.internalMonitor.isOverTarget(this.targetId,e)}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(e){this.targetId=null,this.internalMonitor=e.getMonitor()}}class fr{canDrop(){const e=this.spec,t=this.monitor;return!e.canDrop||e.canDrop(t.getItem(),t)}hover(){const e=this.spec,t=this.monitor;e.hover&&e.hover(t.getItem(),t)}drop(){const e=this.spec,t=this.monitor;if(e.drop)return e.drop(t.getItem(),t)}constructor(e,t){this.spec=e,this.monitor=t}}function pr(e,t){const r=Kt(e,t),n=function(){const e=nr();return(0,Vt.useMemo)((()=>new hr(e)),[e])}(),s=function(e){const t=nr(),r=(0,Vt.useMemo)((()=>new ur(t.getBackend())),[t]);return qt((()=>(r.dropTargetOptions=e||null,r.reconnect(),()=>r.disconnectDropTarget())),[e]),r}(r.options);return function(e,t,r){const n=nr(),s=function(e,t){const r=(0,Vt.useMemo)((()=>new fr(e,t)),[t]);return(0,Vt.useEffect)((()=>{r.spec=e}),[e]),r}(e,t),i=function(e){const{accept:t}=e;return(0,Vt.useMemo)((()=>(zt(null!=e.accept,"accept must be defined"),Array.isArray(t)?t:[t])),[t])}(e);qt((function(){const[e,a]=function(e,t,r){const n=r.getRegistry(),s=n.addTarget(e,t);return[s,()=>n.removeTarget(s)]}(i,s,n);return t.receiveHandlerId(e),r.receiveHandlerId(e),a}),[n,t,s,r,i.map((e=>e.toString())).join("|")])}(r,n,s),[Wt(r.collect,n,s),dr(s)]}function gr(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var mr="function"==typeof Symbol&&Symbol.observable||"@@observable",vr=function(){return Math.random().toString(36).substring(7).split("").join(".")},yr={INIT:"@@redux/INIT"+vr(),REPLACE:"@@redux/REPLACE"+vr(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+vr()}};function _r(e,t,r){var n;if("function"==typeof t&&"function"==typeof r||"function"==typeof r&&"function"==typeof arguments[3])throw new Error(gr(0));if("function"==typeof t&&void 0===r&&(r=t,t=void 0),void 0!==r){if("function"!=typeof r)throw new Error(gr(1));return r(_r)(e,t)}if("function"!=typeof e)throw new Error(gr(2));var s=e,i=t,a=[],o=a,c=!1;function d(){o===a&&(o=a.slice())}function u(){if(c)throw new Error(gr(3));return i}function l(e){if("function"!=typeof e)throw new Error(gr(4));if(c)throw new Error(gr(5));var t=!0;return d(),o.push(e),function(){if(t){if(c)throw new Error(gr(6));t=!1,d();var r=o.indexOf(e);o.splice(r,1),a=null}}}function h(e){if(!function(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}(e))throw new Error(gr(7));if(void 0===e.type)throw new Error(gr(8));if(c)throw new Error(gr(9));try{c=!0,i=s(i,e)}finally{c=!1}for(var t=a=o,r=0;r<t.length;r++)(0,t[r])();return e}return h({type:yr.INIT}),(n={dispatch:h,subscribe:l,getState:u,replaceReducer:function(e){if("function"!=typeof e)throw new Error(gr(10));s=e,h({type:yr.REPLACE})}})[mr]=function(){var e,t=l;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(gr(11));function r(){e.next&&e.next(u())}return r(),{unsubscribe:t(r)}}})[mr]=function(){return this},e},n}function br(e){return"object"==typeof e}const xr="dnd-core/INIT_COORDS",wr="dnd-core/BEGIN_DRAG",Tr="dnd-core/PUBLISH_DRAG_SOURCE",Sr="dnd-core/HOVER",Or="dnd-core/DROP",kr="dnd-core/END_DRAG";function Ir(e,t){return{type:xr,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}const Cr={type:xr,payload:{clientOffset:null,sourceClientOffset:null}};function Dr(e){return function(t=[],r={publishSource:!0}){const{publishSource:n=!0,clientOffset:s,getSourceClientOffset:i}=r,a=e.getMonitor(),o=e.getRegistry();e.dispatch(Ir(s)),function(e,t,r){zt(!t.isDragging(),"Cannot call beginDrag while dragging."),e.forEach((function(e){zt(r.getSource(e),"Expected sourceIds to be registered.")}))}(t,a,o);const c=function(e,t){let r=null;for(let n=e.length-1;n>=0;n--)if(t.canDragSource(e[n])){r=e[n];break}return r}(t,a);if(null==c)return void e.dispatch(Cr);let d=null;if(s){if(!i)throw new Error("getSourceClientOffset must be defined");!function(e){zt("function"==typeof e,"When clientOffset is provided, getSourceClientOffset must be a function.")}(i),d=i(c)}e.dispatch(Ir(s,d));const u=o.getSource(c).beginDrag(a,c);if(null==u)return;!function(e){zt(br(e),"Item must be an object.")}(u),o.pinSource(c);const l=o.getSourceType(c);return{type:wr,payload:{itemType:l,item:u,sourceId:c,clientOffset:s||null,sourceClientOffset:d||null,isSourcePublic:!!n}}}}function Er(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function jr(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){Er(e,t,r[t])}))}return e}function Nr(e){return function(t={}){const r=e.getMonitor(),n=e.getRegistry();!function(e){zt(e.isDragging(),"Cannot call drop while not dragging."),zt(!e.didDrop(),"Cannot call drop twice during one drag operation.")}(r);const s=function(e){const t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}(r);s.forEach(((s,i)=>{const a=function(e,t,r,n){const s=r.getTarget(e);let i=s?s.drop(n,e):void 0;return function(e){zt(void 0===e||br(e),"Drop result must either be an object or undefined.")}(i),void 0===i&&(i=0===t?{}:n.getDropResult()),i}(s,i,n,r),o={type:Or,payload:{dropResult:jr({},t,a)}};e.dispatch(o)}))}}function Pr(e){return function(){const t=e.getMonitor(),r=e.getRegistry();!function(e){zt(e.isDragging(),"Cannot call endDrag while not dragging.")}(t);const n=t.getSourceId();return null!=n&&(r.getSource(n,!0).endDrag(t,n),r.unpinSource()),{type:kr}}}function Rr(e,t){return null===t?null===e:Array.isArray(e)?e.some((e=>e===t)):e===t}function Ar(e){return function(t,{clientOffset:r}={}){!function(e){zt(Array.isArray(e),"Expected targetIds to be an array.")}(t);const n=t.slice(0),s=e.getMonitor(),i=e.getRegistry();return function(e,t,r){for(let n=e.length-1;n>=0;n--){const s=e[n];Rr(t.getTargetType(s),r)||e.splice(n,1)}}(n,i,s.getItemType()),function(e,t,r){zt(t.isDragging(),"Cannot call hover while not dragging."),zt(!t.didDrop(),"Cannot call hover after drop.");for(let t=0;t<e.length;t++){const n=e[t];zt(e.lastIndexOf(n)===t,"Expected targetIds to be unique in the passed array."),zt(r.getTarget(n),"Expected targetIds to be registered.")}}(n,s,i),function(e,t,r){e.forEach((function(e){r.getTarget(e).hover(t,e)}))}(n,s,i),{type:Sr,payload:{targetIds:n,clientOffset:r||null}}}}function Mr(e){return function(){if(e.getMonitor().isDragging())return{type:Tr}}}class Zr{receiveBackend(e){this.backend=e}getMonitor(){return this.monitor}getBackend(){return this.backend}getRegistry(){return this.monitor.registry}getActions(){const e=this,{dispatch:t}=this.store,r=function(e){return{beginDrag:Dr(e),publishDragSource:Mr(e),hover:Ar(e),drop:Nr(e),endDrag:Pr(e)}}(this);return Object.keys(r).reduce(((n,s)=>{const i=r[s];var a;return n[s]=(a=i,(...r)=>{const n=a.apply(e,r);void 0!==n&&t(n)}),n}),{})}dispatch(e){this.store.dispatch(e)}constructor(e,t){this.isSetUp=!1,this.handleRefCountChange=()=>{const e=this.store.getState().refCount>0;this.backend&&(e&&!this.isSetUp?(this.backend.setup(),this.isSetUp=!0):!e&&this.isSetUp&&(this.backend.teardown(),this.isSetUp=!1))},this.store=e,this.monitor=t,e.subscribe(this.handleRefCountChange)}}function Lr(e,t){return{x:e.x-t.x,y:e.y-t.y}}const Ur=[],$r=[];Ur.__IS_NONE__=!0,$r.__IS_ALL__=!0;class Br{subscribeToStateChange(e,t={}){const{handlerIds:r}=t;zt("function"==typeof e,"listener must be a function."),zt(void 0===r||Array.isArray(r),"handlerIds, when specified, must be an array of strings.");let n=this.store.getState().stateId;return this.store.subscribe((()=>{const t=this.store.getState(),s=t.stateId;try{const i=s===n||s===n+1&&!function(e,t){return e!==Ur&&(e===$r||void 0===t||(r=e,t.filter((e=>r.indexOf(e)>-1))).length>0);var r}(t.dirtyHandlerIds,r);i||e()}finally{n=s}}))}subscribeToOffsetChange(e){zt("function"==typeof e,"listener must be a function.");let t=this.store.getState().dragOffset;return this.store.subscribe((()=>{const r=this.store.getState().dragOffset;r!==t&&(t=r,e())}))}canDragSource(e){if(!e)return!1;const t=this.registry.getSource(e);return zt(t,`Expected to find a valid source. sourceId=${e}`),!this.isDragging()&&t.canDrag(this,e)}canDropOnTarget(e){if(!e)return!1;const t=this.registry.getTarget(e);return zt(t,`Expected to find a valid target. targetId=${e}`),!(!this.isDragging()||this.didDrop())&&(Rr(this.registry.getTargetType(e),this.getItemType())&&t.canDrop(this,e))}isDragging(){return Boolean(this.getItemType())}isDraggingSource(e){if(!e)return!1;const t=this.registry.getSource(e,!0);return zt(t,`Expected to find a valid source. sourceId=${e}`),!(!this.isDragging()||!this.isSourcePublic())&&(this.registry.getSourceType(e)===this.getItemType()&&t.isDragging(this,e))}isOverTarget(e,t={shallow:!1}){if(!e)return!1;const{shallow:r}=t;if(!this.isDragging())return!1;const n=this.registry.getTargetType(e),s=this.getItemType();if(s&&!Rr(n,s))return!1;const i=this.getTargetIds();if(!i.length)return!1;const a=i.indexOf(e);return r?a===i.length-1:a>-1}getItemType(){return this.store.getState().dragOperation.itemType}getItem(){return this.store.getState().dragOperation.item}getSourceId(){return this.store.getState().dragOperation.sourceId}getTargetIds(){return this.store.getState().dragOperation.targetIds}getDropResult(){return this.store.getState().dragOperation.dropResult}didDrop(){return this.store.getState().dragOperation.didDrop}isSourcePublic(){return Boolean(this.store.getState().dragOperation.isSourcePublic)}getInitialClientOffset(){return this.store.getState().dragOffset.initialClientOffset}getInitialSourceClientOffset(){return this.store.getState().dragOffset.initialSourceClientOffset}getClientOffset(){return this.store.getState().dragOffset.clientOffset}getSourceClientOffset(){return function(e){const{clientOffset:t,initialClientOffset:r,initialSourceClientOffset:n}=e;return t&&r&&n?Lr((i=n,{x:(s=t).x+i.x,y:s.y+i.y}),r):null;var s,i}(this.store.getState().dragOffset)}getDifferenceFromInitialOffset(){return function(e){const{clientOffset:t,initialClientOffset:r}=e;return t&&r?Lr(t,r):null}(this.store.getState().dragOffset)}constructor(e,t){this.store=e,this.registry=t}}const Fr="undefined"!=typeof global?global:self,zr=Fr.MutationObserver||Fr.WebKitMutationObserver;function Hr(e){return function(){const t=setTimeout(n,0),r=setInterval(n,50);function n(){clearTimeout(t),clearInterval(r),e()}}}const Vr="function"==typeof zr?function(e){let t=1;const r=new zr(e),n=document.createTextNode("");return r.observe(n,{characterData:!0}),function(){t=-t,n.data=t}}:Hr;class qr{call(){try{this.task&&this.task()}catch(e){this.onError(e)}finally{this.task=null,this.release(this)}}constructor(e,t){this.onError=e,this.release=t,this.task=null}}const Wr=new class{enqueueTask(e){const{queue:t,requestFlush:r}=this;t.length||(r(),this.flushing=!0),t[t.length]=e}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{const{queue:e}=this;for(;this.index<e.length;){const t=this.index;if(this.index++,e[t].call(),this.index>this.capacity){for(let t=0,r=e.length-this.index;t<r;t++)e[t]=e[t+this.index];e.length-=this.index,this.index=0}}e.length=0,this.index=0,this.flushing=!1},this.registerPendingError=e=>{this.pendingErrors.push(e),this.requestErrorThrow()},this.requestFlush=Vr(this.flush),this.requestErrorThrow=Hr((()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()}))}},Kr=new class{create(e){const t=this.freeTasks,r=t.length?t.pop():new qr(this.onError,(e=>t[t.length]=e));return r.task=e,r}constructor(e){this.onError=e,this.freeTasks=[]}}(Wr.registerPendingError),Xr="dnd-core/ADD_SOURCE",Gr="dnd-core/ADD_TARGET",Yr="dnd-core/REMOVE_SOURCE",Jr="dnd-core/REMOVE_TARGET";function Qr(e,t){t&&Array.isArray(e)?e.forEach((e=>Qr(e,!1))):zt("string"==typeof e||"symbol"==typeof e,t?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}var en;!function(e){e.SOURCE="SOURCE",e.TARGET="TARGET"}(en||(en={}));let tn=0;function rn(e){switch(e[0]){case"S":return en.SOURCE;case"T":return en.TARGET;default:throw new Error(`Cannot parse handler ID: ${e}`)}}function nn(e,t){const r=e.entries();let n=!1;do{const{done:e,value:[,s]}=r.next();if(s===t)return!0;n=!!e}while(!n);return!1}class sn{addSource(e,t){Qr(e),function(e){zt("function"==typeof e.canDrag,"Expected canDrag to be a function."),zt("function"==typeof e.beginDrag,"Expected beginDrag to be a function."),zt("function"==typeof e.endDrag,"Expected endDrag to be a function.")}(t);const r=this.addHandler(en.SOURCE,e,t);return this.store.dispatch(function(e){return{type:Xr,payload:{sourceId:e}}}(r)),r}addTarget(e,t){Qr(e,!0),function(e){zt("function"==typeof e.canDrop,"Expected canDrop to be a function."),zt("function"==typeof e.hover,"Expected hover to be a function."),zt("function"==typeof e.drop,"Expected beginDrag to be a function.")}(t);const r=this.addHandler(en.TARGET,e,t);return this.store.dispatch(function(e){return{type:Gr,payload:{targetId:e}}}(r)),r}containsHandler(e){return nn(this.dragSources,e)||nn(this.dropTargets,e)}getSource(e,t=!1){return zt(this.isSourceId(e),"Expected a valid source ID."),t&&e===this.pinnedSourceId?this.pinnedSource:this.dragSources.get(e)}getTarget(e){return zt(this.isTargetId(e),"Expected a valid target ID."),this.dropTargets.get(e)}getSourceType(e){return zt(this.isSourceId(e),"Expected a valid source ID."),this.types.get(e)}getTargetType(e){return zt(this.isTargetId(e),"Expected a valid target ID."),this.types.get(e)}isSourceId(e){return rn(e)===en.SOURCE}isTargetId(e){return rn(e)===en.TARGET}removeSource(e){var t;zt(this.getSource(e),"Expected an existing source."),this.store.dispatch(function(e){return{type:Yr,payload:{sourceId:e}}}(e)),t=()=>{this.dragSources.delete(e),this.types.delete(e)},Wr.enqueueTask(Kr.create(t))}removeTarget(e){zt(this.getTarget(e),"Expected an existing target."),this.store.dispatch(function(e){return{type:Jr,payload:{targetId:e}}}(e)),this.dropTargets.delete(e),this.types.delete(e)}pinSource(e){const t=this.getSource(e);zt(t,"Expected an existing source."),this.pinnedSourceId=e,this.pinnedSource=t}unpinSource(){zt(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}addHandler(e,t,r){const n=function(e){const t=(tn++).toString();switch(e){case en.SOURCE:return`S${t}`;case en.TARGET:return`T${t}`;default:throw new Error(`Unknown Handler Role: ${e}`)}}(e);return this.types.set(n,t),e===en.SOURCE?this.dragSources.set(n,r):e===en.TARGET&&this.dropTargets.set(n,r),n}constructor(e){this.types=new Map,this.dragSources=new Map,this.dropTargets=new Map,this.pinnedSourceId=null,this.pinnedSource=null,this.store=e}}const an=(e,t)=>e===t;function on(e=Ur,t){switch(t.type){case Sr:break;case Xr:case Gr:case Jr:case Yr:return Ur;default:return $r}const{targetIds:r=[],prevTargetIds:n=[]}=t.payload,s=function(e,t){const r=new Map,n=e=>{r.set(e,r.has(e)?r.get(e)+1:1)};e.forEach(n),t.forEach(n);const s=[];return r.forEach(((e,t)=>{1===e&&s.push(t)})),s}(r,n);if(!(s.length>0)&&function(e,t,r=an){if(e.length!==t.length)return!1;for(let n=0;n<e.length;++n)if(!r(e[n],t[n]))return!1;return!0}(r,n))return Ur;const i=n[n.length-1],a=r[r.length-1];return i!==a&&(i&&s.push(i),a&&s.push(a)),s}function cn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const dn={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function un(e=dn,t){const{payload:r}=t;switch(t.type){case xr:case wr:return{initialSourceClientOffset:r.sourceClientOffset,initialClientOffset:r.clientOffset,clientOffset:r.clientOffset};case Sr:return n=e.clientOffset,s=r.clientOffset,!n&&!s||n&&s&&n.x===s.x&&n.y===s.y?e:function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){cn(e,t,r[t])}))}return e}({},e,{clientOffset:r.clientOffset});case kr:case Or:return dn;default:return e}var n,s}function ln(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function hn(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){ln(e,t,r[t])}))}return e}const fn={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function pn(e=fn,t){const{payload:r}=t;switch(t.type){case wr:return hn({},e,{itemType:r.itemType,item:r.item,sourceId:r.sourceId,isSourcePublic:r.isSourcePublic,dropResult:null,didDrop:!1});case Tr:return hn({},e,{isSourcePublic:!0});case Sr:return hn({},e,{targetIds:r.targetIds});case Jr:return-1===e.targetIds.indexOf(r.targetId)?e:hn({},e,{targetIds:(n=e.targetIds,s=r.targetId,n.filter((e=>e!==s)))});case Or:return hn({},e,{dropResult:r.dropResult,didDrop:!0,targetIds:[]});case kr:return hn({},e,{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}var n,s}function gn(e=0,t){switch(t.type){case Xr:case Gr:return e+1;case Yr:case Jr:return e-1;default:return e}}function mn(e=0){return e+1}function vn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function yn(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){vn(e,t,r[t])}))}return e}function bn(e={},t){return{dirtyHandlerIds:on(e.dirtyHandlerIds,{type:t.type,payload:yn({},t.payload,{prevTargetIds:(r=e,n=[],"dragOperation.targetIds".split(".").reduce(((e,t)=>e&&e[t]?e[t]:n||null),r))})}),dragOffset:un(e.dragOffset,t),refCount:gn(e.refCount,t),dragOperation:pn(e.dragOperation,t),stateId:mn(e.stateId)};var r,n}function xn(e,t=void 0,r={},n=!1){const s=function(e){const t="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__;return _r(bn,e&&t&&t({name:"dnd-core",instanceId:"dnd-core"}))}(n),i=new Br(s,new sn(s)),a=new Zr(s,i),o=e(a,t,r);return a.receiveBackend(o),a}let wn=0;const Tn=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__");var Sn=(0,Vt.memo)((function(e){var{children:t}=e,r=function(e,t){if(null==e)return{};var r,n,s=function(e,t){if(null==e)return{};var r,n,s={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(s[r]=e[r]);return s}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}(e,["children"]);const[n,s]=function(e){if("manager"in e)return[{dragDropManager:e.manager},!1];return[function(e,t=On(),r,n){const s=t;return s[Tn]||(s[Tn]={dragDropManager:xn(e,t,r,n)}),s[Tn]}(e.backend,e.context,e.options,e.debugMode),!e.context]}(r);return(0,Vt.useEffect)((()=>{if(s){const e=On();return++wn,()=>{0==--wn&&(e[Tn]=null)}}}),[]),(0,$t.jsx)(rr.Provider,{value:n,children:t})}));function On(){return"undefined"!=typeof global?global:window}function kn(e){let t=null;return()=>(null==t&&(t=e()),t)}class In{enter(e){const t=this.entered.length;return this.entered=function(e,t){const r=new Set,n=e=>r.add(e);e.forEach(n),t.forEach(n);const s=[];return r.forEach((e=>s.push(e))),s}(this.entered.filter((t=>this.isNodeInDocument(t)&&(!t.contains||t.contains(e)))),[e]),0===t&&this.entered.length>0}leave(e){const t=this.entered.length;var r,n;return this.entered=(r=this.entered.filter(this.isNodeInDocument),n=e,r.filter((e=>e!==n))),t>0&&0===this.entered.length}reset(){this.entered=[]}constructor(e){this.entered=[],this.isNodeInDocument=e}}class Cn{initializeExposedProperties(){Object.keys(this.config.exposeProperties).forEach((e=>{Object.defineProperty(this.item,e,{configurable:!0,enumerable:!0,get:()=>(console.warn(`Browser doesn't allow reading "${e}" until the drop event.`),null)})}))}loadDataTransfer(e){if(e){const t={};Object.keys(this.config.exposeProperties).forEach((r=>{const n=this.config.exposeProperties[r];null!=n&&(t[r]={value:n(e,this.config.matchesTypes),configurable:!0,enumerable:!0})})),Object.defineProperties(this.item,t)}}canDrag(){return!0}beginDrag(){return this.item}isDragging(e,t){return t===e.getSourceId()}endDrag(){}constructor(e){this.config=e,this.item={},this.initializeExposedProperties()}}const Dn="__NATIVE_FILE__",En="__NATIVE_URL__",jn="__NATIVE_TEXT__",Nn="__NATIVE_HTML__";function Pn(e,t,r){const n=t.reduce(((t,r)=>t||e.getData(r)),"");return null!=n?n:r}const Rn={[Dn]:{exposeProperties:{files:e=>Array.prototype.slice.call(e.files),items:e=>e.items,dataTransfer:e=>e},matchesTypes:["Files"]},[Nn]:{exposeProperties:{html:(e,t)=>Pn(e,t,""),dataTransfer:e=>e},matchesTypes:["Html","text/html"]},[En]:{exposeProperties:{urls:(e,t)=>Pn(e,t,"").split("\n"),dataTransfer:e=>e},matchesTypes:["Url","text/uri-list"]},[jn]:{exposeProperties:{text:(e,t)=>Pn(e,t,""),dataTransfer:e=>e},matchesTypes:["Text","text/plain"]}};function An(e){if(!e)return null;const t=Array.prototype.slice.call(e.types||[]);return Object.keys(Rn).filter((e=>{const r=Rn[e];return!!(null==r?void 0:r.matchesTypes)&&r.matchesTypes.some((e=>t.indexOf(e)>-1))}))[0]||null}const Mn=kn((()=>/firefox/i.test(navigator.userAgent))),Zn=kn((()=>Boolean(window.safari)));class Ln{interpolate(e){const{xs:t,ys:r,c1s:n,c2s:s,c3s:i}=this;let a=t.length-1;if(e===t[a])return r[a];let o,c=0,d=i.length-1;for(;c<=d;){o=Math.floor(.5*(c+d));const n=t[o];if(n<e)c=o+1;else{if(!(n>e))return r[o];d=o-1}}a=Math.max(0,d);const u=e-t[a],l=u*u;return r[a]+n[a]*u+s[a]*l+i[a]*u*l}constructor(e,t){const{length:r}=e,n=[];for(let e=0;e<r;e++)n.push(e);n.sort(((t,r)=>e[t]<e[r]?-1:1));const s=[],i=[],a=[];let o,c;for(let n=0;n<r-1;n++)o=e[n+1]-e[n],c=t[n+1]-t[n],i.push(o),s.push(c),a.push(c/o);const d=[a[0]];for(let e=0;e<i.length-1;e++){const t=a[e],r=a[e+1];if(t*r<=0)d.push(0);else{o=i[e];const n=i[e+1],s=o+n;d.push(3*s/((s+n)/t+(s+o)/r))}}d.push(a[a.length-1]);const u=[],l=[];let h;for(let e=0;e<d.length-1;e++){h=a[e];const t=d[e],r=1/i[e],n=t+d[e+1]-h-h;u.push((h-t-n)*r),l.push(n*r*r)}this.xs=e,this.ys=t,this.c1s=d,this.c2s=u,this.c3s=l}}function Un(e){const t=1===e.nodeType?e:e.parentElement;if(!t)return null;const{top:r,left:n}=t.getBoundingClientRect();return{x:n,y:r}}function $n(e){return{x:e.clientX,y:e.clientY}}class Bn{get window(){return this.globalContext?this.globalContext:"undefined"!=typeof window?window:void 0}get document(){var e;return(null===(e=this.globalContext)||void 0===e?void 0:e.document)?this.globalContext.document:this.window?this.window.document:void 0}get rootElement(){var e;return(null===(e=this.optionsArgs)||void 0===e?void 0:e.rootElement)||this.window}constructor(e,t){this.ownerDocument=null,this.globalContext=e,this.optionsArgs=t}}function Fn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function zn(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){Fn(e,t,r[t])}))}return e}class Hn{profile(){var e,t;return{sourcePreviewNodes:this.sourcePreviewNodes.size,sourcePreviewNodeOptions:this.sourcePreviewNodeOptions.size,sourceNodeOptions:this.sourceNodeOptions.size,sourceNodes:this.sourceNodes.size,dragStartSourceIds:(null===(e=this.dragStartSourceIds)||void 0===e?void 0:e.length)||0,dropTargetIds:this.dropTargetIds.length,dragEnterTargetIds:this.dragEnterTargetIds.length,dragOverTargetIds:(null===(t=this.dragOverTargetIds)||void 0===t?void 0:t.length)||0}}get window(){return this.options.window}get document(){return this.options.document}get rootElement(){return this.options.rootElement}setup(){const e=this.rootElement;if(void 0!==e){if(e.__isReactDndBackendSetUp)throw new Error("Cannot have two HTML5 backends at the same time.");e.__isReactDndBackendSetUp=!0,this.addEventListeners(e)}}teardown(){const e=this.rootElement;var t;void 0!==e&&(e.__isReactDndBackendSetUp=!1,this.removeEventListeners(this.rootElement),this.clearCurrentDragSourceNode(),this.asyncEndDragFrameId&&(null===(t=this.window)||void 0===t||t.cancelAnimationFrame(this.asyncEndDragFrameId)))}connectDragPreview(e,t,r){return this.sourcePreviewNodeOptions.set(e,r),this.sourcePreviewNodes.set(e,t),()=>{this.sourcePreviewNodes.delete(e),this.sourcePreviewNodeOptions.delete(e)}}connectDragSource(e,t,r){this.sourceNodes.set(e,t),this.sourceNodeOptions.set(e,r);const n=t=>this.handleDragStart(t,e),s=e=>this.handleSelectStart(e);return t.setAttribute("draggable","true"),t.addEventListener("dragstart",n),t.addEventListener("selectstart",s),()=>{this.sourceNodes.delete(e),this.sourceNodeOptions.delete(e),t.removeEventListener("dragstart",n),t.removeEventListener("selectstart",s),t.setAttribute("draggable","false")}}connectDropTarget(e,t){const r=t=>this.handleDragEnter(t,e),n=t=>this.handleDragOver(t,e),s=t=>this.handleDrop(t,e);return t.addEventListener("dragenter",r),t.addEventListener("dragover",n),t.addEventListener("drop",s),()=>{t.removeEventListener("dragenter",r),t.removeEventListener("dragover",n),t.removeEventListener("drop",s)}}addEventListeners(e){e.addEventListener&&(e.addEventListener("dragstart",this.handleTopDragStart),e.addEventListener("dragstart",this.handleTopDragStartCapture,!0),e.addEventListener("dragend",this.handleTopDragEndCapture,!0),e.addEventListener("dragenter",this.handleTopDragEnter),e.addEventListener("dragenter",this.handleTopDragEnterCapture,!0),e.addEventListener("dragleave",this.handleTopDragLeaveCapture,!0),e.addEventListener("dragover",this.handleTopDragOver),e.addEventListener("dragover",this.handleTopDragOverCapture,!0),e.addEventListener("drop",this.handleTopDrop),e.addEventListener("drop",this.handleTopDropCapture,!0))}removeEventListeners(e){e.removeEventListener&&(e.removeEventListener("dragstart",this.handleTopDragStart),e.removeEventListener("dragstart",this.handleTopDragStartCapture,!0),e.removeEventListener("dragend",this.handleTopDragEndCapture,!0),e.removeEventListener("dragenter",this.handleTopDragEnter),e.removeEventListener("dragenter",this.handleTopDragEnterCapture,!0),e.removeEventListener("dragleave",this.handleTopDragLeaveCapture,!0),e.removeEventListener("dragover",this.handleTopDragOver),e.removeEventListener("dragover",this.handleTopDragOverCapture,!0),e.removeEventListener("drop",this.handleTopDrop),e.removeEventListener("drop",this.handleTopDropCapture,!0))}getCurrentSourceNodeOptions(){const e=this.monitor.getSourceId(),t=this.sourceNodeOptions.get(e);return zn({dropEffect:this.altKeyPressed?"copy":"move"},t||{})}getCurrentDropEffect(){return this.isDraggingNativeItem()?"copy":this.getCurrentSourceNodeOptions().dropEffect}getCurrentSourcePreviewNodeOptions(){const e=this.monitor.getSourceId();return zn({anchorX:.5,anchorY:.5,captureDraggingState:!1},this.sourcePreviewNodeOptions.get(e)||{})}isDraggingNativeItem(){const e=this.monitor.getItemType();return Object.keys(n).some((t=>n[t]===e))}beginDragNativeItem(e,t){this.clearCurrentDragSourceNode(),this.currentNativeSource=function(e,t){const r=Rn[e];if(!r)throw new Error(`native type ${e} has no configuration`);const n=new Cn(r);return n.loadDataTransfer(t),n}(e,t),this.currentNativeHandle=this.registry.addSource(e,this.currentNativeSource),this.actions.beginDrag([this.currentNativeHandle])}setCurrentDragSourceNode(e){this.clearCurrentDragSourceNode(),this.currentDragSourceNode=e,this.mouseMoveTimeoutTimer=setTimeout((()=>{var e;return null===(e=this.rootElement)||void 0===e?void 0:e.addEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)}),1e3)}clearCurrentDragSourceNode(){var e;return!!this.currentDragSourceNode&&(this.currentDragSourceNode=null,this.rootElement&&(null===(e=this.window)||void 0===e||e.clearTimeout(this.mouseMoveTimeoutTimer||void 0),this.rootElement.removeEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)),this.mouseMoveTimeoutTimer=null,!0)}handleDragStart(e,t){e.defaultPrevented||(this.dragStartSourceIds||(this.dragStartSourceIds=[]),this.dragStartSourceIds.unshift(t))}handleDragEnter(e,t){this.dragEnterTargetIds.unshift(t)}handleDragOver(e,t){null===this.dragOverTargetIds&&(this.dragOverTargetIds=[]),this.dragOverTargetIds.unshift(t)}handleDrop(e,t){this.dropTargetIds.unshift(t)}constructor(e,t,r){this.sourcePreviewNodes=new Map,this.sourcePreviewNodeOptions=new Map,this.sourceNodes=new Map,this.sourceNodeOptions=new Map,this.dragStartSourceIds=null,this.dropTargetIds=[],this.dragEnterTargetIds=[],this.currentNativeSource=null,this.currentNativeHandle=null,this.currentDragSourceNode=null,this.altKeyPressed=!1,this.mouseMoveTimeoutTimer=null,this.asyncEndDragFrameId=null,this.dragOverTargetIds=null,this.lastClientOffset=null,this.hoverRafId=null,this.getSourceClientOffset=e=>{const t=this.sourceNodes.get(e);return t&&Un(t)||null},this.endDragNativeItem=()=>{this.isDraggingNativeItem()&&(this.actions.endDrag(),this.currentNativeHandle&&this.registry.removeSource(this.currentNativeHandle),this.currentNativeHandle=null,this.currentNativeSource=null)},this.isNodeInDocument=e=>Boolean(e&&this.document&&this.document.body&&this.document.body.contains(e)),this.endDragIfSourceWasRemovedFromDOM=()=>{const e=this.currentDragSourceNode;null==e||this.isNodeInDocument(e)||(this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover())},this.scheduleHover=e=>{null===this.hoverRafId&&"undefined"!=typeof requestAnimationFrame&&(this.hoverRafId=requestAnimationFrame((()=>{this.monitor.isDragging()&&this.actions.hover(e||[],{clientOffset:this.lastClientOffset}),this.hoverRafId=null})))},this.cancelHover=()=>{null!==this.hoverRafId&&"undefined"!=typeof cancelAnimationFrame&&(cancelAnimationFrame(this.hoverRafId),this.hoverRafId=null)},this.handleTopDragStartCapture=()=>{this.clearCurrentDragSourceNode(),this.dragStartSourceIds=[]},this.handleTopDragStart=e=>{if(e.defaultPrevented)return;const{dragStartSourceIds:t}=this;this.dragStartSourceIds=null;const r=$n(e);this.monitor.isDragging()&&(this.actions.endDrag(),this.cancelHover()),this.actions.beginDrag(t||[],{publishSource:!1,getSourceClientOffset:this.getSourceClientOffset,clientOffset:r});const{dataTransfer:n}=e,s=An(n);if(this.monitor.isDragging()){if(n&&"function"==typeof n.setDragImage){const e=this.monitor.getSourceId(),t=this.sourceNodes.get(e),s=this.sourcePreviewNodes.get(e)||t;if(s){const{anchorX:e,anchorY:i,offsetX:a,offsetY:o}=this.getCurrentSourcePreviewNodeOptions(),c=function(e,t,r,n,s){const i="IMG"===(a=t).nodeName&&(Mn()||!(null===(o=document.documentElement)||void 0===o?void 0:o.contains(a)));var a,o;const c=Un(i?e:t),d={x:r.x-c.x,y:r.y-c.y},{offsetWidth:u,offsetHeight:l}=e,{anchorX:h,anchorY:f}=n,{dragPreviewWidth:p,dragPreviewHeight:g}=function(e,t,r,n){let s=e?t.width:r,i=e?t.height:n;return Zn()&&e&&(i/=window.devicePixelRatio,s/=window.devicePixelRatio),{dragPreviewWidth:s,dragPreviewHeight:i}}(i,t,u,l),{offsetX:m,offsetY:v}=s,y=0===v||v;return{x:0===m||m?m:new Ln([0,.5,1],[d.x,d.x/u*p,d.x+p-u]).interpolate(h),y:y?v:(()=>{let e=new Ln([0,.5,1],[d.y,d.y/l*g,d.y+g-l]).interpolate(f);return Zn()&&i&&(e+=(window.devicePixelRatio-1)*g),e})()}}(t,s,r,{anchorX:e,anchorY:i},{offsetX:a,offsetY:o});n.setDragImage(s,c.x,c.y)}}try{null==n||n.setData("application/json",{})}catch(e){}this.setCurrentDragSourceNode(e.target);const{captureDraggingState:t}=this.getCurrentSourcePreviewNodeOptions();t?this.actions.publishDragSource():setTimeout((()=>this.actions.publishDragSource()),0)}else if(s)this.beginDragNativeItem(s);else{if(n&&!n.types&&(e.target&&!e.target.hasAttribute||!e.target.hasAttribute("draggable")))return;e.preventDefault()}},this.handleTopDragEndCapture=()=>{this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleTopDragEnterCapture=e=>{var t;if(this.dragEnterTargetIds=[],this.isDraggingNativeItem()&&(null===(t=this.currentNativeSource)||void 0===t||t.loadDataTransfer(e.dataTransfer)),!this.enterLeaveCounter.enter(e.target)||this.monitor.isDragging())return;const{dataTransfer:r}=e,n=An(r);n&&this.beginDragNativeItem(n,r)},this.handleTopDragEnter=e=>{const{dragEnterTargetIds:t}=this;this.dragEnterTargetIds=[],this.monitor.isDragging()&&(this.altKeyPressed=e.altKey,t.length>0&&this.actions.hover(t,{clientOffset:$n(e)}),t.some((e=>this.monitor.canDropOnTarget(e)))&&(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=this.getCurrentDropEffect())))},this.handleTopDragOverCapture=e=>{var t;this.dragOverTargetIds=[],this.isDraggingNativeItem()&&(null===(t=this.currentNativeSource)||void 0===t||t.loadDataTransfer(e.dataTransfer))},this.handleTopDragOver=e=>{const{dragOverTargetIds:t}=this;if(this.dragOverTargetIds=[],!this.monitor.isDragging())return e.preventDefault(),void(e.dataTransfer&&(e.dataTransfer.dropEffect="none"));this.altKeyPressed=e.altKey,this.lastClientOffset=$n(e),this.scheduleHover(t),(t||[]).some((e=>this.monitor.canDropOnTarget(e)))?(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=this.getCurrentDropEffect())):this.isDraggingNativeItem()?e.preventDefault():(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="none"))},this.handleTopDragLeaveCapture=e=>{this.isDraggingNativeItem()&&e.preventDefault(),this.enterLeaveCounter.leave(e.target)&&(this.isDraggingNativeItem()&&setTimeout((()=>this.endDragNativeItem()),0),this.cancelHover())},this.handleTopDropCapture=e=>{var t;this.dropTargetIds=[],this.isDraggingNativeItem()?(e.preventDefault(),null===(t=this.currentNativeSource)||void 0===t||t.loadDataTransfer(e.dataTransfer)):An(e.dataTransfer)&&e.preventDefault(),this.enterLeaveCounter.reset()},this.handleTopDrop=e=>{const{dropTargetIds:t}=this;this.dropTargetIds=[],this.actions.hover(t,{clientOffset:$n(e)}),this.actions.drop({dropEffect:this.getCurrentDropEffect()}),this.isDraggingNativeItem()?this.endDragNativeItem():this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleSelectStart=e=>{const t=e.target;"function"==typeof t.dragDrop&&("INPUT"===t.tagName||"SELECT"===t.tagName||"TEXTAREA"===t.tagName||t.isContentEditable||(e.preventDefault(),t.dragDrop()))},this.options=new Bn(t,r),this.actions=e.getActions(),this.monitor=e.getMonitor(),this.registry=e.getRegistry(),this.enterLeaveCounter=new In(this.isNodeInDocument)}}const Vn=function(e,t,r){return new Hn(e,t,r)};class qn extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const t=super.get(e);return super.has(e)&&void 0!==t&&(this.delete(e),super.set(e,t)),t}set(e,t){if(super.set(e,t),this.maxSize&&this.size>this.maxSize){const e=this.keys().next().value;e&&this.delete(e)}return this}}const Wn="2.21.55";let Kn=({docsBaseUrl:e,docsPath:t="",docsSlug:r})=>t?`${e??"https://viem.sh"}${t}${r?`#${r}`:""}`:void 0,Xn=`viem@${Wn}`;class Gn extends Error{constructor(e,t={}){const r=t.cause instanceof Gn?t.cause.details:t.cause?.message?t.cause.message:t.details,n=t.cause instanceof Gn&&t.cause.docsPath||t.docsPath,s=Kn?.({...t,docsPath:n});super([e||"An error occurred.","",...t.metaMessages?[...t.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...r?[`Details: ${r}`]:[],...Xn?[`Version: ${Xn}`]:[]].join("\n"),t.cause?{cause:t.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=r,this.docsPath=n,this.metaMessages=t.metaMessages,this.name=t.name??this.name,this.shortMessage=e,this.version=Wn}walk(e){return Yn(this,e)}}function Yn(e,t){return t?.(e)?e:e&&"object"==typeof e&&"cause"in e&&void 0!==e.cause?Yn(e.cause,t):t?null:e}function Jn(e,{strict:t=!0}={}){return!!e&&"string"==typeof e&&(t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x"))}class Qn extends Gn{constructor({size:e,targetSize:t,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${e}) exceeds padding size (${t}).`,{name:"SizeExceedsPaddingSizeError"})}}function es(e,{dir:t,size:r=32}={}){return"string"==typeof e?function(e,{dir:t,size:r=32}={}){if(null===r)return e;const n=e.replace("0x","");if(n.length>2*r)throw new Qn({size:Math.ceil(n.length/2),targetSize:r,type:"hex"});return`0x${n["right"===t?"padEnd":"padStart"](2*r,"0")}`}(e,{dir:t,size:r}):function(e,{dir:t,size:r=32}={}){if(null===r)return e;if(e.length>r)throw new Qn({size:e.length,targetSize:r,type:"bytes"});const n=new Uint8Array(r);for(let s=0;s<r;s++){const i="right"===t;n[i?s:r-s-1]=e[i?s:e.length-s-1]}return n}(e,{dir:t,size:r})}class ts extends Gn{constructor({max:e,min:t,signed:r,size:n,value:s}){super(`Number "${s}" is not in safe ${n?`${8*n}-bit ${r?"signed":"unsigned"} `:""}integer range ${e?`(${t} to ${e})`:`(above ${t})`}`,{name:"IntegerOutOfRangeError"})}}class rs extends Gn{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed ${t} bytes. Given size: ${e} bytes.`,{name:"SizeOverflowError"})}}function ns(e){return Jn(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}function ss(e,{size:t}){if(ns(e)>t)throw new rs({givenSize:ns(e),maxSize:t})}function is(e,t={}){const{signed:r,size:n}=t,s=BigInt(e);let i;n?i=r?(1n<<8n*BigInt(n)-1n)-1n:2n**(8n*BigInt(n))-1n:"number"==typeof e&&(i=BigInt(Number.MAX_SAFE_INTEGER));const a="bigint"==typeof i&&r?-i-1n:0;if(i&&s>i||s<a){const t="bigint"==typeof e?"n":"";throw new ts({max:i?`${i}${t}`:void 0,min:`${a}${t}`,signed:r,size:n,value:`${e}${t}`})}const o=`0x${(r&&s<0?(1n<<BigInt(8*n))+BigInt(s):s).toString(16)}`;return n?es(o,{size:n}):o}const as=new TextEncoder;const os={zero:48,nine:57,A:65,F:70,a:97,f:102};function cs(e){return e>=os.zero&&e<=os.nine?e-os.zero:e>=os.A&&e<=os.F?e-(os.A-10):e>=os.a&&e<=os.f?e-(os.a-10):void 0}function ds(e,t={}){let r=e;t.size&&(ss(r,{size:t.size}),r=es(r,{dir:"right",size:t.size}));let n=r.slice(2);n.length%2&&(n=`0${n}`);const s=n.length/2,i=new Uint8Array(s);for(let e=0,t=0;e<s;e++){const r=cs(n.charCodeAt(t++)),s=cs(n.charCodeAt(t++));if(void 0===r||void 0===s)throw new Gn(`Invalid byte sequence ("${n[t-2]}${n[t-1]}" in "${n}").`);i[e]=16*r+s}return i}function us(e,t={}){const r=as.encode(e);return"number"==typeof t.size?(ss(r,{size:t.size}),es(r,{dir:"right",size:t.size})):r}function ls(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function hs(e,...t){if(!((r=e)instanceof Uint8Array||ArrayBuffer.isView(r)&&"Uint8Array"===r.constructor.name))throw new Error("Uint8Array expected");var r;if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function fs(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}const ps=BigInt(2**32-1),gs=BigInt(32);function ms(e,t=!1){return t?{h:Number(e&ps),l:Number(e>>gs&ps)}:{h:0|Number(e>>gs&ps),l:0|Number(e&ps)}}function vs(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let s=0;s<e.length;s++){const{h:i,l:a}=ms(e[s],t);[r[s],n[s]]=[i,a]}return[r,n]}const ys=(()=>68===new Uint8Array(new Uint32Array([287454020]).buffer)[0])();function _s(e){for(let r=0;r<e.length;r++)e[r]=(t=e[r])<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255;var t}function bs(e){return"string"==typeof e&&(e=function(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}(e)),hs(e),e}class xs{clone(){return this._cloneInto()}}const ws=[],Ts=[],Ss=[],Os=BigInt(0),ks=BigInt(1),Is=BigInt(2),Cs=BigInt(7),Ds=BigInt(256),Es=BigInt(113);for(let e=0,t=ks,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],ws.push(2*(5*n+r)),Ts.push((e+1)*(e+2)/2%64);let s=Os;for(let e=0;e<7;e++)t=(t<<ks^(t>>Cs)*Es)%Ds,t&Is&&(s^=ks<<(ks<<BigInt(e))-ks);Ss.push(s)}const[js,Ns]=vs(Ss,!0),Ps=(e,t,r)=>r>32?((e,t,r)=>t<<r-32|e>>>64-r)(e,t,r):((e,t,r)=>e<<r|t>>>32-r)(e,t,r),Rs=(e,t,r)=>r>32?((e,t,r)=>e<<r-32|t>>>64-r)(e,t,r):((e,t,r)=>t<<r|e>>>32-r)(e,t,r);class As extends xs{constructor(e,t,r,n=!1,s=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=n,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,ls(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");var i;this.state=new Uint8Array(200),this.state32=(i=this.state,new Uint32Array(i.buffer,i.byteOffset,Math.floor(i.byteLength/4)))}keccak(){ys||_s(this.state32),function(e,t=24){const r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let t=0;t<10;t++)r[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){const n=(t+8)%10,s=(t+2)%10,i=r[s],a=r[s+1],o=Ps(i,a,1)^r[n],c=Rs(i,a,1)^r[n+1];for(let r=0;r<50;r+=10)e[t+r]^=o,e[t+r+1]^=c}let t=e[2],s=e[3];for(let r=0;r<24;r++){const n=Ts[r],i=Ps(t,s,n),a=Rs(t,s,n),o=ws[r];t=e[o],s=e[o+1],e[o]=i,e[o+1]=a}for(let t=0;t<50;t+=10){for(let n=0;n<10;n++)r[n]=e[t+n];for(let n=0;n<10;n++)e[t+n]^=~r[(n+2)%10]&r[(n+4)%10]}e[0]^=js[n],e[1]^=Ns[n]}r.fill(0)}(this.state32,this.rounds),ys||_s(this.state32),this.posOut=0,this.pos=0}update(e){fs(this);const{blockLen:t,state:r}=this,n=(e=bs(e)).length;for(let s=0;s<n;){const i=Math.min(t-this.pos,n-s);for(let t=0;t<i;t++)r[this.pos++]^=e[s++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:t,pos:r,blockLen:n}=this;e[r]^=t,128&t&&r===n-1&&this.keccak(),e[n-1]^=128,this.keccak()}writeInto(e){fs(this,!1),hs(e),this.finish();const t=this.state,{blockLen:r}=this;for(let n=0,s=e.length;n<s;){this.posOut>=r&&this.keccak();const i=Math.min(r-this.posOut,s-n);e.set(t.subarray(this.posOut,this.posOut+i),n),this.posOut+=i,n+=i}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return ls(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(function(e,t){hs(e);const r=t.outputLen;if(e.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:t,suffix:r,outputLen:n,rounds:s,enableXOF:i}=this;return e||(e=new As(t,r,n,i,s)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=s,e.suffix=r,e.outputLen=n,e.enableXOF=i,e.destroyed=this.destroyed,e}}const Ms=((e,t,r)=>function(e){const t=t=>e().update(bs(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}((()=>new As(t,e,r))))(1,136,32),Zs=new qn(8192);function Ls(e,t){if(Zs.has(`${e}.${t}`))return Zs.get(`${e}.${t}`);const r=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),n=function(e){const t=Ms(Jn(e,{strict:!1})?function(e,t={}){return"number"==typeof e||"bigint"==typeof e?function(e,t){return ds(is(e,t))}(e,t):"boolean"==typeof e?function(e,t={}){const r=new Uint8Array(1);return r[0]=Number(e),"number"==typeof t.size?(ss(r,{size:t.size}),es(r,{size:t.size})):r}(e,t):Jn(e)?ds(e,t):us(e,t)}(e):e);return t}(us(r)),s=(t?r.substring(`${t}0x`.length):r).split("");for(let e=0;e<40;e+=2)n[e>>1]>>4>=8&&s[e]&&(s[e]=s[e].toUpperCase()),(15&n[e>>1])>=8&&s[e+1]&&(s[e+1]=s[e+1].toUpperCase());const i=`0x${s.join("")}`;return Zs.set(`${e}.${t}`,i),i}const Us=/^0x[a-fA-F0-9]{40}$/,$s=new qn(8192),Bs=[{id:"optimism",name:"Optimism"},{id:"base",name:"Base"},{id:"mainnet",name:"Ethereum Mainnet"},{id:"zora",name:"Zora"}],Fs=({dragType:e,index:t,item:r,moveItem:n,renderContent:s})=>{const[{isDragging:i},a]=cr({type:e,item:{index:t},collect:e=>({isDragging:e.isDragging()})}),[,o]=pr({accept:e,hover:e=>{e.index!==t&&(n(e.index,t),e.index=t)}});return(0,$t.jsxs)("div",{ref:e=>a(o(e)),style:{alignItems:"center",cursor:"move",display:"flex",gap:"8px",marginBottom:"8px",opacity:i?.5:1},children:[(0,$t.jsx)("span",{className:"dashicons dashicons-menu"}),(0,$t.jsx)("div",{style:{alignItems:"center",display:"flex",flex:1,justifyContent:"space-between"},children:s(r,t)})]})},zs=({chain:e,index:t,moveItem:r,removeChain:n})=>(0,$t.jsx)(Fs,{dragType:"chain",index:t,item:e,moveItem:r,renderContent:(e,t)=>(0,$t.jsxs)($t.Fragment,{children:[(0,$t.jsx)("span",{children:e.name}),(0,$t.jsx)(c.Button,{variant:"secondary",isDestructive:!0,onClick:()=>n(t),icon:"trash"})]})}),Hs=({value:e=[],onChange:t})=>{const r=e.map((e=>Bs.find((t=>t.id===e)))).filter(Boolean),n=r=>{const n=[...e];n.splice(r,1),t(n)},s=(r,n)=>{const s=[...e],[i]=s.splice(r,1);s.splice(n,0,i),t(s)},i=Bs.filter((t=>!e.includes(t.id)));return(0,$t.jsx)(Sn,{backend:Vn,children:(0,$t.jsxs)("div",{style:{width:"100%"},children:[(0,$t.jsx)("div",{className:"components-base-control",children:(0,$t.jsxs)("div",{className:"components-base-control__field",children:[(0,$t.jsx)("label",{htmlFor:"chains-control",className:"components-base-control__label",children:(0,o.__)("Supported Chains","frames-integration-for-farcaster")}),(0,$t.jsx)("div",{id:"chains-control",children:r.length>0?r.map(((e,t)=>(0,$t.jsx)(zs,{chain:e,index:t,moveItem:s,removeChain:n},e.id))):(0,$t.jsx)("div",{style:{background:"#f0f0f0",borderRadius:"4px",color:"#757575",margin:"8px 0",padding:"12px",textAlign:"center"},children:(0,o.__)("No chains selected. Add a chain below to get started.","frames-integration-for-farcaster")})})]})}),i.length>0&&(0,$t.jsx)("div",{className:"components-base-control",children:(0,$t.jsx)(c.SelectControl,{label:(0,o.__)("Add Chain","frames-integration-for-farcaster"),value:"",options:[{value:"",label:(0,o.__)("Select a chain to add…","frames-integration-for-farcaster")},...i.map((e=>({value:e.id,label:e.name})))],onChange:r=>{r&&(r=>{e.includes(r)||t([...e,r])})(r)}})})]})})},Vs=({value:e,onChange:t})=>(0,$t.jsx)(c.ColorPicker,{color:e,onChange:t}),qs=({value:e,onChange:t})=>(0,$t.jsx)(c.TextareaControl,{label:(0,o.__)("Domain Manifest","frames-integration-for-farcaster"),value:e,onChange:t}),Ws=({value:e=[],onChange:t})=>{const r=r=>{const n=[...e];n.splice(r,1),t(n)},n=(r,n)=>{const s=[...e];s[r]=Math.max(0,parseInt(n)||0),t(s)},s=(r,n)=>{const s=[...e],[i]=s.splice(r,1);s.splice(n,0,i),t(s)};return(0,$t.jsx)(Sn,{backend:Vn,children:(0,$t.jsxs)("div",{style:{width:"100%"},children:[(0,$t.jsx)("div",{className:"components-base-control",children:(0,$t.jsxs)("div",{className:"components-base-control__field",children:[(0,$t.jsxs)("label",{htmlFor:"tipping-amounts-control",className:"components-base-control__label",children:[(0,o.__)("Tipping Amounts (in","frames-integration-for-farcaster")," ",(0,$t.jsx)("a",{href:"https://zora.co/writings/sparks",target:"_blank",rel:"noopener noreferrer",children:(0,o.__)("Sparks","frames-integration-for-farcaster")}),(0,o.__)(")","frames-integration-for-farcaster")]}),(0,$t.jsx)("div",{id:"tipping-amounts-control",children:e.length>0?e.map(((e,t)=>(0,$t.jsx)(ri,{amount:e,index:t,moveItem:s,updateAmount:n,removeAmount:r},t))):(0,$t.jsx)("div",{style:{padding:"12px",background:"#f0f0f0",borderRadius:"4px",textAlign:"center",color:"#757575",margin:"8px 0"},children:(0,o.__)("No tipping amounts configured. Add an amount below to get started.","frames-integration-for-farcaster")})})]})}),(0,$t.jsx)(c.Button,{variant:"secondary",onClick:()=>{t([...e,0])},icon:"plus",children:(0,o.__)("Add Amount","frames-integration-for-farcaster")})]})})},Ks=({value:e,onChange:t,useTitleAsButtonText:r})=>(0,$t.jsx)(c.TextControl,{label:(0,o.__)("Button Text","frames-integration-for-farcaster"),value:e,help:r?(0,o.__)("This text will be used as the button text when frame is used outside of casts. Limited to 32 characters.","frames-integration-for-farcaster"):(0,o.__)("This text will be used as the button text for all posts. Limited to 32 characters.","frames-integration-for-farcaster"),onChange:t,__nextHasNoMarginBottom:!0,maxLength:32}),Xs=({value:e,onChange:t})=>{const r=e&&""!==e&&!function(e){const{strict:t=!0}={},r=`${e}.${t}`;if($s.has(r))return $s.get(r);const n=!(!Us.test(e)||e.toLowerCase()!==e&&t&&Ls(e)!==e);return $s.set(r,n),n}(e);return(0,$t.jsx)("div",{style:{width:"100%"},children:(0,$t.jsx)(c.TextControl,{label:(0,o.__)("Tipping Address","frames-integration-for-farcaster"),value:e,onChange:t,help:r?(0,o.__)("Please enter a valid Ethereum address","frames-integration-for-farcaster"):(0,o.__)("Enter the Ethereum address that will receive tips","frames-integration-for-farcaster"),className:r?"has-error":""})})},Gs=({value:e,onChange:t})=>(0,$t.jsx)(c.ToggleControl,{checked:e,label:(0,o.__)("Use Post Title as Button Text","frames-integration-for-farcaster"),onChange:t,__nextHasNoMarginBottom:!0}),Ys=({value:e,onChange:t})=>(0,$t.jsx)(c.ToggleControl,{checked:e,label:(0,o.__)("Enable Notifications","frames-integration-for-farcaster"),onChange:t,__nextHasNoMarginBottom:!0}),Js=({value:e,onChange:t})=>(0,$t.jsx)(c.ToggleControl,{checked:e,label:(0,o.__)("Enable SDK Logging","frames-integration-for-farcaster"),onChange:t,__nextHasNoMarginBottom:!0}),Qs=({value:e,onChange:t})=>(0,$t.jsx)(c.ToggleControl,{checked:e,label:(0,o.__)("Enable Farcaster Frames","frames-integration-for-farcaster"),onChange:t,__nextHasNoMarginBottom:!0}),ei=({value:e,onChange:t})=>(0,$t.jsx)(c.ToggleControl,{checked:e,label:(0,o.__)("Enable Tipping","frames-integration-for-farcaster"),onChange:t,__nextHasNoMarginBottom:!0}),ti=({value:e,onChange:t,buttonText:r="Select Image",labelText:n=""})=>(0,$t.jsx)(Ft.MediaUpload,{onSelect:e=>t({id:e.id,url:e.url}),help:(0,o.__)("This image will be used as the splash image for all posts.","frames-integration-for-farcaster"),allowedTypes:["image"],value:e,render:({open:s})=>(0,$t.jsx)("div",{children:e&&e.url?(0,$t.jsxs)("div",{style:{marginBottom:"10px"},children:[(0,$t.jsx)("img",{src:e.url,alt:"Selected",style:{maxWidth:"200px",height:"auto",display:"block",marginBottom:"8px"}}),(0,$t.jsxs)("div",{children:[(0,$t.jsx)(c.Button,{onClick:s,variant:"secondary",style:{marginRight:"8px"},children:"Replace Image"}),(0,$t.jsx)(c.Button,{onClick:()=>t({id:null,url:""}),variant:"link",isDestructive:!0,children:"Remove Image"})]})]}):(0,$t.jsx)(c.Button,{label:n,showTooltip:!0,onClick:s,variant:"secondary",children:r})})}),ri=({amount:e,index:t,moveItem:r,removeAmount:n,updateAmount:s})=>(0,$t.jsx)(Fs,{dragType:"amount",index:t,item:e,moveItem:r,renderContent:(e,t)=>(0,$t.jsxs)($t.Fragment,{children:[(0,$t.jsx)(c.TextControl,{type:"number",value:e,onChange:e=>s(t,e),min:0}),(0,$t.jsx)(c.Button,{icon:"trash",isDestructive:!0,onClick:()=>n(t),variant:"secondary"})]})}),ni=({value:e,onChange:t})=>(0,$t.jsx)("div",{style:{width:"100%"},children:(0,$t.jsx)(c.TextControl,{label:(0,o.__)("RPC URL for Optimism","frames-integration-for-farcaster"),value:e,onChange:t,help:e&&""!==e?(0,o.__)("Enter the URL of your Ethereum RPC for the Optimism chain.","frames-integration-for-farcaster"):(0,o.__)("Enter the URL of your Ethereum RPC for the Optimism chain. Required for complete key verification.","frames-integration-for-farcaster"),className:e&&""!==e?"":"has-error",type:"url",__nextHasNoMarginBottom:!0})}),si=window.wp.primitives,ii=(0,$t.jsx)(si.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,$t.jsx)(si.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M5 4.5h11a.5.5 0 0 1 .5.5v11a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V5a.5.5 0 0 1 .5-.5ZM3 5a2 2 0 0 1 2-2h11a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5Zm17 3v10.75c0 .69-.56 1.25-1.25 1.25H6v1.5h12.75a2.75 2.75 0 0 0 2.75-2.75V8H20Z"})}),ai=(0,$t.jsx)(si.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,$t.jsx)(si.Path,{d:"M18 11.3l-1-1.1-4 4V3h-1.5v11.3L7 10.2l-1 1.1 6.2 5.8 5.8-5.8zm.5 3.7v3.5h-13V15H4v5h16v-5h-1.5z"})}),oi=({content:e,showCopyButton:t=!0,showDownloadButton:r=!1,downloadFilename:n="download.json"})=>{const[s,i]=(0,a.useState)(!1);return(0,$t.jsxs)("div",{style:{position:"relative",maxWidth:"100%"},children:[(0,$t.jsx)("pre",{style:{background:"#f0f0f0",padding:"1rem",borderRadius:"4px",overflow:"auto",whiteSpace:"break-spaces",lineBreak:"anywhere"},children:e}),t&&(0,$t.jsx)(c.Button,{icon:ii,onClick:async()=>{await navigator.clipboard.writeText(e),i(!0),setTimeout((()=>i(!1)),2e3)},style:{position:"absolute",top:"8px",right:"8px",background:"white",border:"1px solid #ccc"},children:s?(0,o.__)("Copied!","frames-integration-for-farcaster"):(0,o.__)("Copy","frames-integration-for-farcaster")}),r&&(0,$t.jsx)(c.Button,{icon:ai,onClick:()=>{const t=new Blob([e],{type:"application/json"}),r=URL.createObjectURL(t),s=document.createElement("a");s.href=r,s.download=n,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(r)},style:{position:"absolute",bottom:"8px",right:"8px",background:"white",border:"1px solid #ccc"},children:(0,o.__)("Download","frames-integration-for-farcaster")})]})},ci=({currentManifest:e,domainManifest:t,setDomainManifest:r})=>{const[n,s]=(0,a.useState)(null),[i,d]=(0,a.useState)(""),[u,l]=(0,a.useState)(""),[h,f]=(0,a.useState)(!0),p=(0,a.useMemo)((()=>{if(!t)return null;let e=null;try{e=JSON.parse(t)}catch{}return e}),[t]),g=(0,a.useMemo)((()=>{if(!n||!e)return null;const t=p&&"object"==typeof p&&0!==Object.keys(p).length,r={name:n?.frame?.name!==e?.frame?.name,homeUrl:n?.frame?.homeUrl!==e?.frame?.homeUrl,iconUrl:n?.frame?.iconUrl!==e?.frame?.iconUrl,splashImageUrl:n?.frame?.splashImageUrl!==e?.frame?.splashImageUrl,splashBackgroundColor:n?.frame?.splashBackgroundColor!==e?.frame?.splashBackgroundColor,buttonTitle:n?.frame?.buttonTitle!==e?.frame?.buttonTitle,imageUrl:n?.frame?.imageUrl!==e?.frame?.imageUrl,...e?.frame?.webhookUrl?{webhookUrl:e?.frame?.webhookUrl!==n?.frame?.webhookUrl}:{},...t?{header:p?.accountAssociation?.header!==n?.accountAssociation?.header,payload:p?.accountAssociation?.payload!==n?.accountAssociation?.payload,signature:p?.accountAssociation?.signature!==n?.accountAssociation?.signature}:{}};return{count:Object.values(r).filter(Boolean).length,details:r}}),[n,e,p]);return(0,a.useEffect)((()=>{(async()=>{try{const e=new AbortController,t=setTimeout((()=>e.abort("Manifest retrieval timed out")),2e3),r=await fetch("/.well-known/farcaster.json",{signal:e.signal});if(clearTimeout(t),!r.ok)throw new Error("Manifest file not found");const n=(e=>{const t=Ut.safeParse(e);return t.success?(d(""),t.data):(d(t.error.message),e)})(await r.json());s(n),l("")}catch(e){l(e instanceof Error?`${(0,o.__)("Error:","frames-integration-for-farcaster")} ${e.message}`:(0,o.__)("Farcaster manifest file not found or request timed out at /.well-known/farcaster.json","frames-integration-for-farcaster"))}finally{f(!1)}})()}),[]),h?(0,$t.jsx)(c.__experimentalText,{children:(0,o.__)("Loading manifest…","frames-integration-for-farcaster")}):(0,$t.jsxs)("div",{className:"manifest-viewer",children:[u&&(0,$t.jsxs)($t.Fragment,{children:[(0,$t.jsx)(c.Notice,{status:"error",isDismissible:!1,children:u}),(0,$t.jsx)("div",{style:{marginTop:"8px"}})]}),(0,$t.jsxs)(c.__experimentalText,{children:[(0,o.__)("The Farcaster manifest file declares metadata for your frame application and defines supported triggers.","frames-integration-for-farcaster")," ",(0,$t.jsx)("a",{href:"https://docs.farcaster.xyz/developers/frames/v2/spec#frame-manifest",target:"_blank",rel:"noopener noreferrer",children:(0,o.__)("Learn more about the manifest specification.","frames-integration-for-farcaster")})," ",(0,o.__)("Frames Integration for Farcaster can help you manage your manifest file. To start, enter the domain manifest obtained from the Warpcast app.","frames-integration-for-farcaster")," ",(0,$t.jsx)("a",{href:"https://docs.farcaster.xyz/developers/frames/v2/notifications_webhooks#create-a-farcaster-domain-manifest",target:"_blank",rel:"noopener noreferrer",children:(0,o.__)("Follow the instructions here to create a domain manifest.","frames-integration-for-farcaster")})]}),(0,$t.jsx)("div",{style:{marginTop:"16px"},children:(0,$t.jsx)(qs,{value:t,onChange:r})}),n&&(0,$t.jsxs)($t.Fragment,{children:[(0,$t.jsx)("div",{style:{marginTop:"16px"},children:(0,$t.jsx)(c.__experimentalText,{children:(0,o.__)("Here is the current manifest on your site:","frames-integration-for-farcaster")})}),(0,$t.jsx)("div",{style:{marginTop:"8px"}}),(0,$t.jsx)(oi,{content:JSON.stringify(n,null,2),showCopyButton:!1}),i&&(0,$t.jsxs)(c.Notice,{status:"error",isDismissible:!1,children:[(0,o.__)("Validation complete, manifest is not valid. Errors:","frames-integration-for-farcaster")," ",(0,$t.jsx)("ul",{style:{margin:0,paddingLeft:"1rem"},children:JSON.parse(i).map(((e,t)=>(0,$t.jsxs)("li",{children:[(0,$t.jsx)("strong",{children:e.path.join(".")}),": ",e.message]},t)))})]}),!i&&(0,$t.jsx)(c.Notice,{status:"info",isDismissible:!1,children:e&&g?(0,o.sprintf)(/* translators: %d: number of mismatches */ /* translators: %d: number of mismatches */
     2(0,o.__)("Validation complete, manifest is valid. %d mismatches found with current settings.","frames-integration-for-farcaster"),g.count):(0,o.__)("Validation complete, manifest is valid.","frames-integration-for-farcaster")}),e&&g?.count>0&&(0,$t.jsxs)($t.Fragment,{children:[g.details.name&&(0,$t.jsx)(c.Notice,{status:"warning",isDismissible:!1,children:(0,o.__)("The manifest name does not match the current site name.","frames-integration-for-farcaster")}),g.details.homeUrl&&(0,$t.jsx)(c.Notice,{status:"warning",isDismissible:!1,children:(0,o.__)("The manifest home URL does not match the current site home URL.","frames-integration-for-farcaster")}),g.details.iconUrl&&(0,$t.jsx)(c.Notice,{status:"warning",isDismissible:!1,children:(0,o.__)("The manifest icon URL does not match the current site icon URL.","frames-integration-for-farcaster")}),g.details.imageUrl&&(0,$t.jsx)(c.Notice,{status:"warning",isDismissible:!1,children:(0,o.__)("The manifest image URL does not match the current site image URL.","frames-integration-for-farcaster")}),g.details.buttonTitle&&(0,$t.jsx)(c.Notice,{status:"warning",isDismissible:!1,children:(0,o.__)("The manifest button title does not match the current site button title.","frames-integration-for-farcaster")}),g.details.splashImageUrl&&(0,$t.jsx)(c.Notice,{status:"warning",isDismissible:!1,children:(0,o.__)("The manifest splash image URL does not match the current site splash image URL.","frames-integration-for-farcaster")}),g.details.splashBackgroundColor&&(0,$t.jsx)(c.Notice,{status:"warning",isDismissible:!1,children:(0,o.__)("The manifest splash background color does not match the current site splash background color.","frames-integration-for-farcaster")}),g.details.webhookUrl&&(0,$t.jsx)(c.Notice,{status:"warning",isDismissible:!1,children:(0,o.__)("The manifest webhook URL does not match the current site webhook URL.","frames-integration-for-farcaster")}),g.details.header&&(0,$t.jsx)(c.Notice,{status:"warning",isDismissible:!1,children:(0,o.__)("The manifest header does not match the domain manifest header.","frames-integration-for-farcaster")}),g.details.payload&&(0,$t.jsx)(c.Notice,{status:"warning",isDismissible:!1,children:(0,o.__)("The manifest payload does not match the domain manifest payload.","frames-integration-for-farcaster")}),g.details.signature&&(0,$t.jsx)(c.Notice,{status:"warning",isDismissible:!1,children:(0,o.__)("The manifest signature does not match the domain manifest signature.","frames-integration-for-farcaster")})]})]}),(0,$t.jsxs)($t.Fragment,{children:[(0,$t.jsx)("div",{style:{marginTop:"16px"},children:(0,$t.jsx)(c.__experimentalText,{children:(0,o.__)("Are you going to update the manifest to match current settings? Here is the manifest data to reference. This should be available at /.well-known/farcaster.json on your site.","frames-integration-for-farcaster")})}),(0,$t.jsx)(oi,{showDownloadButton:!0,downloadFilename:"farcaster.json",content:JSON.stringify(e,null,2)})]})]})},di=()=>{const{subscriptions:e}=(()=>{const[e,t]=(0,a.useState)(),r=(0,a.useCallback)((()=>{u()({path:"/farcaster-wp/v1/subscriptions"}).then((e=>{t(e)}))}),[]);return(0,a.useEffect)((()=>{r()}),[r]),{subscriptions:e,fetchSubscriptions:r}})();return(0,$t.jsxs)("div",{style:{width:"100%"},children:[(0,$t.jsx)("div",{style:{marginTop:"16px"},children:(0,$t.jsxs)(c.__experimentalText,{children:[(0,o.__)("You have","frames-integration-for-farcaster")," ",e?.length," ",(0,o.__)("subscriptions on your site:","frames-integration-for-farcaster")]})}),(0,$t.jsx)("div",{style:{marginTop:"8px"}}),(0,$t.jsx)("pre",{style:{maxHeight:"500px",overflow:"auto",border:"1px solid #ddd",borderRadius:"4px",padding:"8px",backgroundColor:"#f9f9f9"},children:JSON.stringify(e,null,2)})]})},ui=()=>{const{events:e}=(()=>{const[e,t]=(0,a.useState)(),r=(0,a.useCallback)((()=>{u()({path:"/farcaster-wp/v1/events"}).then((e=>{t(e)}))}),[]);return(0,a.useEffect)((()=>{r()}),[r]),{events:e,fetchEvents:r}})();return(0,$t.jsxs)("div",{style:{width:"100%"},children:[(0,$t.jsx)("div",{style:{marginTop:"16px"},children:(0,$t.jsxs)(c.__experimentalText,{children:[(0,o.__)("You have","frames-integration-for-farcaster")," ",e?.length," ",(0,o.__)("events on your site:","frames-integration-for-farcaster")]})}),(0,$t.jsx)("div",{style:{marginTop:"8px"}}),(0,$t.jsx)("pre",{style:{maxHeight:"500px",overflow:"auto",border:"1px solid #ddd",borderRadius:"4px",padding:"8px",backgroundColor:"#f9f9f9"},children:JSON.stringify(e,null,2)})]})},li=()=>(0,$t.jsx)(c.__experimentalHeading,{level:1,children:(0,o.__)("Frames Integration for Farcaster Settings","frames-integration-for-farcaster")}),hi=({onClick:e})=>(0,$t.jsx)(c.Button,{variant:"primary",onClick:e,__next40pxDefaultSize:!0,children:(0,o.__)("Save","frames-integration-for-farcaster")}),fi=()=>{const{saveSettings:e,framesEnabled:t,setFramesEnabled:r,splashBackgroundColor:n,setSplashBackgroundColor:s,buttonText:i,setButtonText:d,splashImage:f,setSplashImage:p,fallbackImage:g,setFallbackImage:m,useTitleAsButtonText:v,setUseTitleAsButtonText:y,domainManifest:_,setDomainManifest:b,notificationsEnabled:x,setNotificationsEnabled:w,debugEnabled:T,setDebugEnabled:S,tippingEnabled:O,setTippingEnabled:k,tippingAddress:I,setTippingAddress:C,tippingAmounts:D,setTippingAmounts:E,tippingChains:j,setTippingChains:N,rpcURL:P,setRpcURL:R}=(()=>{const[e,t]=(0,a.useState)(),[r,n]=(0,a.useState)(),[s,i]=(0,a.useState)(),[c,d]=(0,a.useState)(!1),[f,p]=(0,a.useState)(!1),[g,m]=(0,a.useState)(!1),[v,y]=(0,a.useState)(),[_,b]=(0,a.useState)([]),[x,w]=(0,a.useState)([]),[T,S]=(0,a.useState)(),[O,k]=(0,a.useState)(),[I,C]=(0,a.useState)({id:0,url:""}),[D,E]=(0,a.useState)({id:0,url:""}),[j,N]=(0,a.useState)(!1),{createSuccessNotice:P,createErrorNotice:R,removeNotice:A}=(0,h.useDispatch)(l.store);return(0,a.useEffect)((()=>{u()({path:"/wp/v2/settings"}).then((e=>{i(e.farcaster_wp?.frames_enabled),S(e.farcaster_wp?.splash_background_color),k(e.farcaster_wp?.button_text),C(e.farcaster_wp?.splash_image),E(e.farcaster_wp?.fallback_image),N(e.farcaster_wp?.use_title_as_button_text),t(e.farcaster_wp?.domain_manifest),d(e.farcaster_wp?.notifications_enabled),p(e.farcaster_wp?.debug_enabled),m(e.farcaster_wp?.tipping_enabled),y(e.farcaster_wp?.tipping_address),b(e.farcaster_wp?.tipping_amounts),w(e.farcaster_wp?.tipping_chains),n(e.farcaster_wp?.rpc_url)}))}),[]),(0,a.useEffect)((()=>{let e;return async function(){if(void 0===r||""!==r||e)void 0!==r&&""!==r&&e&&(A(e),e=void 0);else{const t=await R((0,o.__)("RPC URL is required for key validation. Currently, signatures will be validated, but keys will not be verified using contract.","frames-integration-for-farcaster"));e=t?.notice?.id}}(),()=>{e&&A(e)}}),[R,A,r]),{saveSettings:t=>{if(e){let t=null;try{t=JSON.parse(e)}catch{}if(!Ut.safeParse(t).success)return void R((0,o.__)("Did not save settings, domain manifest is invalid.","frames-integration-for-farcaster")).then((()=>document.scrollingElement?.scrollTo({top:0,behavior:"smooth"})))}if(r)try{new URL(r)}catch{return void R((0,o.__)("RPC URL is invalid.","frames-integration-for-farcaster")).then((()=>document.scrollingElement?.scrollTo({top:0,behavior:"smooth"})))}u()({path:"/wp/v2/settings",method:"POST",data:{farcaster_wp:{frames_enabled:s,splash_background_color:T,button_text:O,splash_image:I,fallback_image:D,use_title_as_button_text:j,domain_manifest:e,notifications_enabled:c,debug_enabled:f,tipping_enabled:g,tipping_address:v,tipping_amounts:_,tipping_chains:x,rpc_url:r}}}).then((()=>{P((0,o.__)("Settings saved.","frames-integration-for-farcaster")).then((()=>{t&&t(),document.scrollingElement?.scrollTo({top:0,behavior:"smooth"})}))})).catch((e=>{console.error(e),R((0,o.__)("Failed to save settings.","frames-integration-for-farcaster")).then((()=>document.scrollingElement?.scrollTo({top:0,behavior:"smooth"})))}))},framesEnabled:s,setFramesEnabled:i,splashBackgroundColor:T,setSplashBackgroundColor:S,buttonText:O,setButtonText:k,splashImage:I,setSplashImage:C,fallbackImage:D,setFallbackImage:E,useTitleAsButtonText:j,setUseTitleAsButtonText:N,domainManifest:e,setDomainManifest:t,notificationsEnabled:c,setNotificationsEnabled:d,debugEnabled:f,setDebugEnabled:p,tippingEnabled:g,setTippingEnabled:m,tippingAddress:v,setTippingAddress:y,tippingAmounts:_,setTippingAmounts:b,tippingChains:x,setTippingChains:w,rpcURL:r,setRpcURL:n}})(),{manifest:A,fetchManifest:M}=(()=>{const[e,t]=(0,a.useState)(),r=(0,a.useCallback)((()=>{u()({path:"/farcaster-wp/v1/manifest"}).then((e=>{t(e)}))}),[]);return(0,a.useEffect)((()=>{r()}),[r]),{manifest:e,fetchManifest:r}})();return(0,$t.jsxs)($t.Fragment,{children:[(0,$t.jsx)(li,{}),(0,$t.jsx)(Bt,{}),(0,$t.jsxs)(c.Panel,{header:"Frames",children:[(0,$t.jsx)(c.PanelBody,{children:(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsx)(Qs,{value:t,onChange:e=>r(e)})})}),(0,$t.jsx)(c.PanelBody,{title:(0,o.__)("Frame Button","frames-integration-for-farcaster"),initialOpen:t,children:(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsxs)(c.__experimentalVStack,{spacing:4,children:[(0,$t.jsx)(Gs,{value:v,onChange:y}),(0,$t.jsx)(Ks,{useTitleAsButtonText:v,value:i,onChange:d})]})})}),(0,$t.jsx)(c.PanelBody,{title:(0,o.__)("Splash Background Color","frames-integration-for-farcaster"),initialOpen:t,children:(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsx)(Vs,{value:n,onChange:s})})}),(0,$t.jsx)(c.PanelBody,{title:(0,o.__)("Frame Splash Image","frames-integration-for-farcaster"),initialOpen:t,children:(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsx)(ti,{value:f,onChange:p,labelText:(0,o.__)("Image will be displayed as 200x200px.","frames-integration-for-farcaster")})})}),(0,$t.jsx)(c.PanelBody,{title:(0,o.__)("Fallback Frame Image","frames-integration-for-farcaster"),initialOpen:t,children:(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsx)(ti,{labelText:(0,o.__)("Image will be displayed in 3:2 aspect ratio.","frames-integration-for-farcaster"),value:g,onChange:m})})})]}),(0,$t.jsxs)(c.Panel,{header:"Tipping",children:[(0,$t.jsxs)(c.PanelBody,{children:[(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsx)(ei,{value:O,onChange:k})}),(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsx)(Xs,{value:I,onChange:C})})]}),(0,$t.jsx)(c.PanelBody,{title:(0,o.__)("Tipping Chains","frames-integration-for-farcaster"),initialOpen:O,children:(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsx)(Hs,{value:j,onChange:N})})}),(0,$t.jsx)(c.PanelBody,{title:(0,o.__)("Tipping Amounts","frames-integration-for-farcaster"),initialOpen:O,children:(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsx)(Ws,{value:D,onChange:E})})})]}),(0,$t.jsx)(c.Panel,{header:"Notifications",children:(0,$t.jsxs)(c.PanelBody,{children:[(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsx)(Ys,{value:x,onChange:w})}),(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsx)(ni,{value:P,onChange:R})}),(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsx)(Js,{value:T,onChange:S})}),(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsx)(di,{})}),(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsx)(ui,{})})]})}),(0,$t.jsx)(c.Panel,{header:"Manifest",children:(0,$t.jsx)(c.PanelBody,{title:(0,o.__)("Manifest Validation","frames-integration-for-farcaster"),children:(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsx)(ci,{currentManifest:A,domainManifest:_,setDomainManifest:b})})})}),(0,$t.jsx)(hi,{onClick:()=>e(M)})]})};i()((()=>{const e=document.getElementById("farcaster-wp-settings");e&&(0,a.createRoot)(e).render((0,$t.jsx)(fi,{}))}))})();
  • frames-integration-for-farcaster/tags/0.0.43/frames-integration-for-farcaster.php

    r3214459 r3214536  
    1111 * Plugin URI:        https://davisshaver.com/frames-integration-for-farcaster/
    1212 * Description:       Frames Integration for Farcaster connects your WordPress site to Farcaster.
    13  * Version:           0.0.42
     13 * Version:           0.0.43
    1414 * Author:            Davis Shaver
    1515 * Author URI:        https://davisshaver.com/
     
    2323defined( 'ABSPATH' ) || exit;
    2424
    25 define( 'FARCASTER_WP_VERSION', '0.0.42' );
     25define( 'FARCASTER_WP_VERSION', '0.0.43' );
    2626
    2727define( 'FARCASTER_WP_API_NAMESPACE', 'farcaster-wp/v1' );
  • frames-integration-for-farcaster/tags/0.0.43/includes/api/class-subscriptions-controller.php

    r3214439 r3214536  
    1212use WP_REST_Response;
    1313use Farcaster_WP\Storage;
     14
    1415defined( 'ABSPATH' ) || exit;
    1516
  • frames-integration-for-farcaster/tags/0.0.43/includes/class-api.php

    r3214439 r3214536  
    1111use Farcaster_WP\API\Webhook_Controller;
    1212use Farcaster_WP\API\Subscriptions_Controller;
     13use Farcaster_WP\API\Events_Controller;
    1314
    1415defined( 'ABSPATH' ) || exit;
     
    3536            $subscriptions_api = new Subscriptions_Controller();
    3637            add_action( 'rest_api_init', [ $subscriptions_api, 'register_routes' ] );
     38
     39            include_once 'api/class-events-controller.php';
     40            $events_api = new Events_Controller();
     41            add_action( 'rest_api_init', [ $events_api, 'register_routes' ] );
    3742        }
    3843    }
  • frames-integration-for-farcaster/tags/0.0.43/includes/class-storage.php

    r3214439 r3214536  
    178178
    179179    /**
     180     * Get events.
     181     *
     182     * @return array The events.
     183     */
     184    public static function get_events() {
     185        global $wpdb;
     186        $table_name = self::get_events_table_name();
     187        $results    = $wpdb->get_results( $wpdb->prepare( 'SELECT * FROM %1$s', [ $table_name ] ), ARRAY_A ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQLPlaceholders.UnquotedComplexPlaceholder, WordPress.DB.DirectDatabaseQuery.DirectQuery
     188        return $results ? $results : [];
     189    }
     190
     191    /**
    180192     * Get active subscriptions.
    181193     *
     
    186198        $table_name = self::get_fids_table_name();
    187199
    188         $results = $wpdb->get_results( $wpdb->prepare( 'SELECT * FROM %1$s WHERE status = \'active\'', [ $table_name ] ), ARRAY_A );  // phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQLPlaceholders.UnquotedComplexPlaceholder, WordPress.DB.DirectDatabaseQuery.DirectQuery
     200        $results = $wpdb->get_results( $wpdb->prepare( 'SELECT * FROM %1$s WHERE status = \'active\'', [ $table_name ] ), ARRAY_A ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQLPlaceholders.UnquotedComplexPlaceholder, WordPress.DB.DirectDatabaseQuery.DirectQuery
    189201
    190202        return $results ? $results : [];
  • frames-integration-for-farcaster/tags/0.0.43/readme.txt

    r3214459 r3214536  
    55Requires at least: 6.7.0
    66Requires PHP: 7.0
    7 Stable tag: 0.0.42
     7Stable tag: 0.0.43
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    3030
    3131== Changelog ==
     32
     33= 0.0.43 =
     34* Add basic events viewer to settings page
    3235
    3336= 0.0.42 =
  • frames-integration-for-farcaster/tags/0.0.43/vendor/composer/autoload_classmap.php

    r3214439 r3214536  
    8585    'FG\\X509\\SAN\\SubjectAlternativeNames' => $vendorDir . '/fgrosse/phpasn1/lib/X509/SAN/SubjectAlternativeNames.php',
    8686    'Farcaster_WP\\API' => $baseDir . '/includes/class-api.php',
     87    'Farcaster_WP\\API\\Events_Controller' => $baseDir . '/includes/api/class-events-controller.php',
    8788    'Farcaster_WP\\API\\Manifest_Controller' => $baseDir . '/includes/api/class-manifest-controller.php',
    8889    'Farcaster_WP\\API\\Subscriptions_Controller' => $baseDir . '/includes/api/class-subscriptions-controller.php',
  • frames-integration-for-farcaster/tags/0.0.43/vendor/composer/autoload_static.php

    r3214439 r3214536  
    186186        'FG\\X509\\SAN\\SubjectAlternativeNames' => __DIR__ . '/..' . '/fgrosse/phpasn1/lib/X509/SAN/SubjectAlternativeNames.php',
    187187        'Farcaster_WP\\API' => __DIR__ . '/../..' . '/includes/class-api.php',
     188        'Farcaster_WP\\API\\Events_Controller' => __DIR__ . '/../..' . '/includes/api/class-events-controller.php',
    188189        'Farcaster_WP\\API\\Manifest_Controller' => __DIR__ . '/../..' . '/includes/api/class-manifest-controller.php',
    189190        'Farcaster_WP\\API\\Subscriptions_Controller' => __DIR__ . '/../..' . '/includes/api/class-subscriptions-controller.php',
  • frames-integration-for-farcaster/tags/0.0.43/vendor/composer/installed.php

    r3214459 r3214536  
    22    'root' => array(
    33        'name' => 'davisshaver/frames-integration-for-farcaster',
    4         'pretty_version' => '0.0.42',
    5         'version' => '0.0.42.0',
    6         'reference' => 'f710f879bc23f826f2a9358c1716a34796e3db9f',
     4        'pretty_version' => '0.0.43',
     5        'version' => '0.0.43.0',
     6        'reference' => 'e00b308e764ef6ba03f2dab10af115b02fd4009c',
    77        'type' => 'wordpress-plugin',
    88        'install_path' => __DIR__ . '/../../',
     
    1212    'versions' => array(
    1313        'davisshaver/frames-integration-for-farcaster' => array(
    14             'pretty_version' => '0.0.42',
    15             'version' => '0.0.42.0',
    16             'reference' => 'f710f879bc23f826f2a9358c1716a34796e3db9f',
     14            'pretty_version' => '0.0.43',
     15            'version' => '0.0.43.0',
     16            'reference' => 'e00b308e764ef6ba03f2dab10af115b02fd4009c',
    1717            'type' => 'wordpress-plugin',
    1818            'install_path' => __DIR__ . '/../../',
  • frames-integration-for-farcaster/trunk/build/index.asset.php

    r3214439 r3214536  
    1 <?php return array('dependencies' => array('react', 'react-jsx-runtime', 'wp-api-fetch', 'wp-components', 'wp-data', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-media-utils', 'wp-notices', 'wp-primitives'), 'version' => 'd5a0d08d88cf6685a71f');
     1<?php return array('dependencies' => array('react', 'react-jsx-runtime', 'wp-api-fetch', 'wp-components', 'wp-data', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-media-utils', 'wp-notices', 'wp-primitives'), 'version' => 'a8b48df405aa0c297a41');
  • frames-integration-for-farcaster/trunk/build/index.js

    r3214439 r3214536  
    1 (()=>{"use strict";var e={2017:e=>{e.exports=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;var n,s,i;if(Array.isArray(t)){if((n=t.length)!=r.length)return!1;for(s=n;0!=s--;)if(!e(t[s],r[s]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((n=(i=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(s=n;0!=s--;)if(!Object.prototype.hasOwnProperty.call(r,i[s]))return!1;for(s=n;0!=s--;){var a=i[s];if(!e(t[a],r[a]))return!1}return!0}return t!=t&&r!=r}}},t={};function r(n){var s=t[n];if(void 0!==s)return s.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};r.r(n),r.d(n,{FILE:()=>Dn,HTML:()=>Nn,TEXT:()=>jn,URL:()=>En});const s=window.wp.domReady;var i=r.n(s);const a=window.wp.element,o=window.wp.i18n,c=window.wp.components,d=window.wp.apiFetch;var u=r.n(d);const l=window.wp.notices,h=window.wp.data;var f,p;!function(e){e.assertEqual=e=>e,e.assertIs=function(e){},e.assertNever=function(_x){throw new Error},e.arrayToEnum=e=>{const t={};for(const r of e)t[r]=r;return t},e.getValidEnumValues=t=>{const r=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),n={};for(const e of r)n[e]=t[e];return e.objectValues(n)},e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]})),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t},e.find=(e,t)=>{for(const r of e)if(t(r))return r},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(f||(f={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(p||(p={}));const g=f.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),m=e=>{switch(typeof e){case"undefined":return g.undefined;case"string":return g.string;case"number":return isNaN(e)?g.nan:g.number;case"boolean":return g.boolean;case"function":return g.function;case"bigint":return g.bigint;case"symbol":return g.symbol;case"object":return Array.isArray(e)?g.array:null===e?g.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?g.promise:"undefined"!=typeof Map&&e instanceof Map?g.map:"undefined"!=typeof Set&&e instanceof Set?g.set:"undefined"!=typeof Date&&e instanceof Date?g.date:g.object;default:return g.unknown}},v=f.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class y extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},r={_errors:[]},n=e=>{for(const s of e.issues)if("invalid_union"===s.code)s.unionErrors.map(n);else if("invalid_return_type"===s.code)n(s.returnTypeError);else if("invalid_arguments"===s.code)n(s.argumentsError);else if(0===s.path.length)r._errors.push(t(s));else{let e=r,n=0;for(;n<s.path.length;){const r=s.path[n];n===s.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(s))):e[r]=e[r]||{_errors:[]},e=e[r],n++}}};return n(this),r}static assert(e){if(!(e instanceof y))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,f.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},r=[];for(const n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):r.push(e(n));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}y.create=e=>new y(e);const _=(e,t)=>{let r;switch(e.code){case v.invalid_type:r=e.received===g.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case v.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,f.jsonStringifyReplacer)}`;break;case v.unrecognized_keys:r=`Unrecognized key(s) in object: ${f.joinValues(e.keys,", ")}`;break;case v.invalid_union:r="Invalid input";break;case v.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${f.joinValues(e.options)}`;break;case v.invalid_enum_value:r=`Invalid enum value. Expected ${f.joinValues(e.options)}, received '${e.received}'`;break;case v.invalid_arguments:r="Invalid function arguments";break;case v.invalid_return_type:r="Invalid function return type";break;case v.invalid_date:r="Invalid date";break;case v.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:f.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case v.too_small:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case v.too_big:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case v.custom:r="Invalid input";break;case v.invalid_intersection_types:r="Intersection results could not be merged";break;case v.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case v.not_finite:r="Number must be finite";break;default:r=t.defaultError,f.assertNever(e)}return{message:r}};let b=_;function x(){return b}const w=e=>{const{data:t,path:r,errorMaps:n,issueData:s}=e,i=[...r,...s.path||[]],a={...s,path:i};if(void 0!==s.message)return{...s,path:i,message:s.message};let o="";const c=n.filter((e=>!!e)).slice().reverse();for(const e of c)o=e(a,{data:t,defaultError:o}).message;return{...s,path:i,message:o}};function T(e,t){const r=x(),n=w({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===_?void 0:_].filter((e=>!!e))});e.common.issues.push(n)}class O{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const r=[];for(const n of t){if("aborted"===n.status)return S;"dirty"===n.status&&e.dirty(),r.push(n.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){const r=[];for(const e of t){const t=await e.key,n=await e.value;r.push({key:t,value:n})}return O.mergeObjectSync(e,r)}static mergeObjectSync(e,t){const r={};for(const n of t){const{key:t,value:s}=n;if("aborted"===t.status)return S;if("aborted"===s.status)return S;"dirty"===t.status&&e.dirty(),"dirty"===s.status&&e.dirty(),"__proto__"===t.value||void 0===s.value&&!n.alwaysSet||(r[t.value]=s.value)}return{status:e.value,value:r}}}const S=Object.freeze({status:"aborted"}),k=e=>({status:"dirty",value:e}),I=e=>({status:"valid",value:e}),C=e=>"aborted"===e.status,D=e=>"dirty"===e.status,E=e=>"valid"===e.status,j=e=>"undefined"!=typeof Promise&&e instanceof Promise;function N(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}function P(e,t,r,n,s){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?s.call(e,r):s?s.value=r:t.set(e,r),r}var R,A,M;"function"==typeof SuppressedError&&SuppressedError,function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(R||(R={}));class Z{constructor(e,t,r,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=n}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const L=(e,t)=>{if(E(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new y(e.common.issues);return this._error=t,this._error}}};function U(e){if(!e)return{};const{errorMap:t,invalid_type_error:r,required_error:n,description:s}=e;if(t&&(r||n))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:s}:{errorMap:(t,s)=>{var i,a;const{message:o}=e;return"invalid_enum_value"===t.code?{message:null!=o?o:s.defaultError}:void 0===s.data?{message:null!==(i=null!=o?o:n)&&void 0!==i?i:s.defaultError}:"invalid_type"!==t.code?{message:s.defaultError}:{message:null!==(a=null!=o?o:r)&&void 0!==a?a:s.defaultError}},description:s}}class ${get description(){return this._def.description}_getType(e){return m(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:m(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new O,ctx:{common:e.parent.common,data:e.data,parsedType:m(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(j(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){var r;const n={common:{issues:[],async:null!==(r=null==t?void 0:t.async)&&void 0!==r&&r,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:m(e)},s=this._parseSync({data:e,path:n.path,parent:n});return L(n,s)}"~validate"(e){var t,r;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:m(e)};if(!this["~standard"].async)try{const t=this._parseSync({data:e,path:[],parent:n});return E(t)?{value:t.value}:{issues:n.common.issues}}catch(e){(null===(r=null===(t=null==e?void 0:e.message)||void 0===t?void 0:t.toLowerCase())||void 0===r?void 0:r.includes("encountered"))&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then((e=>E(e)?{value:e.value}:{issues:n.common.issues}))}async parseAsync(e,t){const r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){const r={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:m(e)},n=this._parse({data:e,path:r.path,parent:r}),s=await(j(n)?n:Promise.resolve(n));return L(r,s)}refine(e,t){const r=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,n)=>{const s=e(t),i=()=>n.addIssue({code:v.custom,...r(t)});return"undefined"!=typeof Promise&&s instanceof Promise?s.then((e=>!!e||(i(),!1))):!!s||(i(),!1)}))}refinement(e,t){return this._refinement(((r,n)=>!!e(r)||(n.addIssue("function"==typeof t?t(r,n):t),!1)))}_refinement(e){return new Be({schema:this,typeName:Qe.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return Fe.create(this,this._def)}nullable(){return ze.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return we.create(this)}promise(){return $e.create(this,this._def)}or(e){return Se.create([this,e],this._def)}and(e){return De.create(this,e,this._def)}transform(e){return new Be({...U(this._def),schema:this,typeName:Qe.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new He({...U(this._def),innerType:this,defaultValue:t,typeName:Qe.ZodDefault})}brand(){return new Ke({typeName:Qe.ZodBranded,type:this,...U(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new Ve({...U(this._def),innerType:this,catchValue:t,typeName:Qe.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return Xe.create(this,e)}readonly(){return Ge.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const B=/^c[^\s-]{8,}$/i,F=/^[0-9a-z]+$/,z=/^[0-9A-HJKMNP-TV-Z]{26}$/i,H=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,V=/^[a-z0-9_-]{21}$/i,q=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,W=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,K=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let X;const G=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Y=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,J=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Q=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ee=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,te=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,re="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",ne=new RegExp(`^${re}$`);function se(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function ie(e){let t=`${re}T${se(e)}`;const r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function ae(e,t){return!("v4"!==t&&t||!G.test(e))||!("v6"!==t&&t||!J.test(e))}function oe(e,t){if(!q.test(e))return!1;try{const[r]=e.split("."),n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),s=JSON.parse(atob(n));return!("object"!=typeof s||null===s||!s.typ||!s.alg||t&&s.alg!==t)}catch(e){return!1}}function ce(e,t){return!("v4"!==t&&t||!Y.test(e))||!("v6"!==t&&t||!Q.test(e))}class de extends ${_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==g.string){const t=this._getOrReturnCtx(e);return T(t,{code:v.invalid_type,expected:g.string,received:t.parsedType}),S}const t=new O;let r;for(const n of this._def.checks)if("min"===n.kind)e.data.length<n.value&&(r=this._getOrReturnCtx(e,r),T(r,{code:v.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),t.dirty());else if("max"===n.kind)e.data.length>n.value&&(r=this._getOrReturnCtx(e,r),T(r,{code:v.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),t.dirty());else if("length"===n.kind){const s=e.data.length>n.value,i=e.data.length<n.value;(s||i)&&(r=this._getOrReturnCtx(e,r),s?T(r,{code:v.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):i&&T(r,{code:v.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),t.dirty())}else if("email"===n.kind)K.test(e.data)||(r=this._getOrReturnCtx(e,r),T(r,{validation:"email",code:v.invalid_string,message:n.message}),t.dirty());else if("emoji"===n.kind)X||(X=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),X.test(e.data)||(r=this._getOrReturnCtx(e,r),T(r,{validation:"emoji",code:v.invalid_string,message:n.message}),t.dirty());else if("uuid"===n.kind)H.test(e.data)||(r=this._getOrReturnCtx(e,r),T(r,{validation:"uuid",code:v.invalid_string,message:n.message}),t.dirty());else if("nanoid"===n.kind)V.test(e.data)||(r=this._getOrReturnCtx(e,r),T(r,{validation:"nanoid",code:v.invalid_string,message:n.message}),t.dirty());else if("cuid"===n.kind)B.test(e.data)||(r=this._getOrReturnCtx(e,r),T(r,{validation:"cuid",code:v.invalid_string,message:n.message}),t.dirty());else if("cuid2"===n.kind)F.test(e.data)||(r=this._getOrReturnCtx(e,r),T(r,{validation:"cuid2",code:v.invalid_string,message:n.message}),t.dirty());else if("ulid"===n.kind)z.test(e.data)||(r=this._getOrReturnCtx(e,r),T(r,{validation:"ulid",code:v.invalid_string,message:n.message}),t.dirty());else if("url"===n.kind)try{new URL(e.data)}catch(s){r=this._getOrReturnCtx(e,r),T(r,{validation:"url",code:v.invalid_string,message:n.message}),t.dirty()}else"regex"===n.kind?(n.regex.lastIndex=0,n.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),T(r,{validation:"regex",code:v.invalid_string,message:n.message}),t.dirty())):"trim"===n.kind?e.data=e.data.trim():"includes"===n.kind?e.data.includes(n.value,n.position)||(r=this._getOrReturnCtx(e,r),T(r,{code:v.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),t.dirty()):"toLowerCase"===n.kind?e.data=e.data.toLowerCase():"toUpperCase"===n.kind?e.data=e.data.toUpperCase():"startsWith"===n.kind?e.data.startsWith(n.value)||(r=this._getOrReturnCtx(e,r),T(r,{code:v.invalid_string,validation:{startsWith:n.value},message:n.message}),t.dirty()):"endsWith"===n.kind?e.data.endsWith(n.value)||(r=this._getOrReturnCtx(e,r),T(r,{code:v.invalid_string,validation:{endsWith:n.value},message:n.message}),t.dirty()):"datetime"===n.kind?ie(n).test(e.data)||(r=this._getOrReturnCtx(e,r),T(r,{code:v.invalid_string,validation:"datetime",message:n.message}),t.dirty()):"date"===n.kind?ne.test(e.data)||(r=this._getOrReturnCtx(e,r),T(r,{code:v.invalid_string,validation:"date",message:n.message}),t.dirty()):"time"===n.kind?new RegExp(`^${se(n)}$`).test(e.data)||(r=this._getOrReturnCtx(e,r),T(r,{code:v.invalid_string,validation:"time",message:n.message}),t.dirty()):"duration"===n.kind?W.test(e.data)||(r=this._getOrReturnCtx(e,r),T(r,{validation:"duration",code:v.invalid_string,message:n.message}),t.dirty()):"ip"===n.kind?ae(e.data,n.version)||(r=this._getOrReturnCtx(e,r),T(r,{validation:"ip",code:v.invalid_string,message:n.message}),t.dirty()):"jwt"===n.kind?oe(e.data,n.alg)||(r=this._getOrReturnCtx(e,r),T(r,{validation:"jwt",code:v.invalid_string,message:n.message}),t.dirty()):"cidr"===n.kind?ce(e.data,n.version)||(r=this._getOrReturnCtx(e,r),T(r,{validation:"cidr",code:v.invalid_string,message:n.message}),t.dirty()):"base64"===n.kind?ee.test(e.data)||(r=this._getOrReturnCtx(e,r),T(r,{validation:"base64",code:v.invalid_string,message:n.message}),t.dirty()):"base64url"===n.kind?te.test(e.data)||(r=this._getOrReturnCtx(e,r),T(r,{validation:"base64url",code:v.invalid_string,message:n.message}),t.dirty()):f.assertNever(n);return{status:t.value,value:e.data}}_regex(e,t,r){return this.refinement((t=>e.test(t)),{validation:t,code:v.invalid_string,...R.errToObj(r)})}_addCheck(e){return new de({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...R.errToObj(e)})}url(e){return this._addCheck({kind:"url",...R.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...R.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...R.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...R.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...R.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...R.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...R.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...R.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...R.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...R.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...R.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...R.errToObj(e)})}datetime(e){var t,r;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(r=null==e?void 0:e.local)&&void 0!==r&&r,...R.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...R.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...R.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...R.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...R.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...R.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...R.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...R.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...R.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...R.errToObj(t)})}nonempty(e){return this.min(1,R.errToObj(e))}trim(){return new de({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new de({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new de({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isCIDR(){return!!this._def.checks.find((e=>"cidr"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get isBase64url(){return!!this._def.checks.find((e=>"base64url"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function ue(e,t){const r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,s=r>n?r:n;return parseInt(e.toFixed(s).replace(".",""))%parseInt(t.toFixed(s).replace(".",""))/Math.pow(10,s)}de.create=e=>{var t;return new de({checks:[],typeName:Qe.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...U(e)})};class le extends ${constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==g.number){const t=this._getOrReturnCtx(e);return T(t,{code:v.invalid_type,expected:g.number,received:t.parsedType}),S}let t;const r=new O;for(const n of this._def.checks)"int"===n.kind?f.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),T(t,{code:v.invalid_type,expected:"integer",received:"float",message:n.message}),r.dirty()):"min"===n.kind?(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),T(t,{code:v.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):"max"===n.kind?(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),T(t,{code:v.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):"multipleOf"===n.kind?0!==ue(e.data,n.value)&&(t=this._getOrReturnCtx(e,t),T(t,{code:v.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):"finite"===n.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),T(t,{code:v.not_finite,message:n.message}),r.dirty()):f.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,R.toString(t))}gt(e,t){return this.setLimit("min",e,!1,R.toString(t))}lte(e,t){return this.setLimit("max",e,!0,R.toString(t))}lt(e,t){return this.setLimit("max",e,!1,R.toString(t))}setLimit(e,t,r,n){return new le({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:R.toString(n)}]})}_addCheck(e){return new le({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:R.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:R.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:R.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:R.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:R.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:R.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:R.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:R.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:R.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find((e=>"int"===e.kind||"multipleOf"===e.kind&&f.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const r of this._def.checks){if("finite"===r.kind||"int"===r.kind||"multipleOf"===r.kind)return!0;"min"===r.kind?(null===t||r.value>t)&&(t=r.value):"max"===r.kind&&(null===e||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}}le.create=e=>new le({checks:[],typeName:Qe.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...U(e)});class he extends ${constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch(t){return this._getInvalidInput(e)}if(this._getType(e)!==g.bigint)return this._getInvalidInput(e);let t;const r=new O;for(const n of this._def.checks)"min"===n.kind?(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),T(t,{code:v.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):"max"===n.kind?(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),T(t,{code:v.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):"multipleOf"===n.kind?e.data%n.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),T(t,{code:v.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):f.assertNever(n);return{status:r.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return T(t,{code:v.invalid_type,expected:g.bigint,received:t.parsedType}),S}gte(e,t){return this.setLimit("min",e,!0,R.toString(t))}gt(e,t){return this.setLimit("min",e,!1,R.toString(t))}lte(e,t){return this.setLimit("max",e,!0,R.toString(t))}lt(e,t){return this.setLimit("max",e,!1,R.toString(t))}setLimit(e,t,r,n){return new he({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:R.toString(n)}]})}_addCheck(e){return new he({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:R.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:R.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:R.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:R.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:R.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}he.create=e=>{var t;return new he({checks:[],typeName:Qe.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...U(e)})};class fe extends ${_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==g.boolean){const t=this._getOrReturnCtx(e);return T(t,{code:v.invalid_type,expected:g.boolean,received:t.parsedType}),S}return I(e.data)}}fe.create=e=>new fe({typeName:Qe.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...U(e)});class pe extends ${_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==g.date){const t=this._getOrReturnCtx(e);return T(t,{code:v.invalid_type,expected:g.date,received:t.parsedType}),S}if(isNaN(e.data.getTime()))return T(this._getOrReturnCtx(e),{code:v.invalid_date}),S;const t=new O;let r;for(const n of this._def.checks)"min"===n.kind?e.data.getTime()<n.value&&(r=this._getOrReturnCtx(e,r),T(r,{code:v.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),t.dirty()):"max"===n.kind?e.data.getTime()>n.value&&(r=this._getOrReturnCtx(e,r),T(r,{code:v.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),t.dirty()):f.assertNever(n);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new pe({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:R.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:R.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}pe.create=e=>new pe({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Qe.ZodDate,...U(e)});class ge extends ${_parse(e){if(this._getType(e)!==g.symbol){const t=this._getOrReturnCtx(e);return T(t,{code:v.invalid_type,expected:g.symbol,received:t.parsedType}),S}return I(e.data)}}ge.create=e=>new ge({typeName:Qe.ZodSymbol,...U(e)});class me extends ${_parse(e){if(this._getType(e)!==g.undefined){const t=this._getOrReturnCtx(e);return T(t,{code:v.invalid_type,expected:g.undefined,received:t.parsedType}),S}return I(e.data)}}me.create=e=>new me({typeName:Qe.ZodUndefined,...U(e)});class ve extends ${_parse(e){if(this._getType(e)!==g.null){const t=this._getOrReturnCtx(e);return T(t,{code:v.invalid_type,expected:g.null,received:t.parsedType}),S}return I(e.data)}}ve.create=e=>new ve({typeName:Qe.ZodNull,...U(e)});class ye extends ${constructor(){super(...arguments),this._any=!0}_parse(e){return I(e.data)}}ye.create=e=>new ye({typeName:Qe.ZodAny,...U(e)});class _e extends ${constructor(){super(...arguments),this._unknown=!0}_parse(e){return I(e.data)}}_e.create=e=>new _e({typeName:Qe.ZodUnknown,...U(e)});class be extends ${_parse(e){const t=this._getOrReturnCtx(e);return T(t,{code:v.invalid_type,expected:g.never,received:t.parsedType}),S}}be.create=e=>new be({typeName:Qe.ZodNever,...U(e)});class xe extends ${_parse(e){if(this._getType(e)!==g.undefined){const t=this._getOrReturnCtx(e);return T(t,{code:v.invalid_type,expected:g.void,received:t.parsedType}),S}return I(e.data)}}xe.create=e=>new xe({typeName:Qe.ZodVoid,...U(e)});class we extends ${_parse(e){const{ctx:t,status:r}=this._processInputParams(e),n=this._def;if(t.parsedType!==g.array)return T(t,{code:v.invalid_type,expected:g.array,received:t.parsedType}),S;if(null!==n.exactLength){const e=t.data.length>n.exactLength.value,s=t.data.length<n.exactLength.value;(e||s)&&(T(t,{code:e?v.too_big:v.too_small,minimum:s?n.exactLength.value:void 0,maximum:e?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),r.dirty())}if(null!==n.minLength&&t.data.length<n.minLength.value&&(T(t,{code:v.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),r.dirty()),null!==n.maxLength&&t.data.length>n.maxLength.value&&(T(t,{code:v.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map(((e,r)=>n.type._parseAsync(new Z(t,e,t.path,r))))).then((e=>O.mergeArray(r,e)));const s=[...t.data].map(((e,r)=>n.type._parseSync(new Z(t,e,t.path,r))));return O.mergeArray(r,s)}get element(){return this._def.type}min(e,t){return new we({...this._def,minLength:{value:e,message:R.toString(t)}})}max(e,t){return new we({...this._def,maxLength:{value:e,message:R.toString(t)}})}length(e,t){return new we({...this._def,exactLength:{value:e,message:R.toString(t)}})}nonempty(e){return this.min(1,e)}}function Te(e){if(e instanceof Oe){const t={};for(const r in e.shape){const n=e.shape[r];t[r]=Fe.create(Te(n))}return new Oe({...e._def,shape:()=>t})}return e instanceof we?new we({...e._def,type:Te(e.element)}):e instanceof Fe?Fe.create(Te(e.unwrap())):e instanceof ze?ze.create(Te(e.unwrap())):e instanceof Ee?Ee.create(e.items.map((e=>Te(e)))):e}we.create=(e,t)=>new we({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Qe.ZodArray,...U(t)});class Oe extends ${constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=f.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==g.object){const t=this._getOrReturnCtx(e);return T(t,{code:v.invalid_type,expected:g.object,received:t.parsedType}),S}const{status:t,ctx:r}=this._processInputParams(e),{shape:n,keys:s}=this._getCached(),i=[];if(!(this._def.catchall instanceof be&&"strip"===this._def.unknownKeys))for(const e in r.data)s.includes(e)||i.push(e);const a=[];for(const e of s){const t=n[e],s=r.data[e];a.push({key:{status:"valid",value:e},value:t._parse(new Z(r,s,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof be){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of i)a.push({key:{status:"valid",value:e},value:{status:"valid",value:r.data[e]}});else if("strict"===e)i.length>0&&(T(r,{code:v.unrecognized_keys,keys:i}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of i){const n=r.data[t];a.push({key:{status:"valid",value:t},value:e._parse(new Z(r,n,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of a){const r=await t.key,n=await t.value;e.push({key:r,value:n,alwaysSet:t.alwaysSet})}return e})).then((e=>O.mergeObjectSync(t,e))):O.mergeObjectSync(t,a)}get shape(){return this._def.shape()}strict(e){return R.errToObj,new Oe({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,r)=>{var n,s,i,a;const o=null!==(i=null===(s=(n=this._def).errorMap)||void 0===s?void 0:s.call(n,t,r).message)&&void 0!==i?i:r.defaultError;return"unrecognized_keys"===t.code?{message:null!==(a=R.errToObj(e).message)&&void 0!==a?a:o}:{message:o}}}:{}})}strip(){return new Oe({...this._def,unknownKeys:"strip"})}passthrough(){return new Oe({...this._def,unknownKeys:"passthrough"})}extend(e){return new Oe({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Oe({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Qe.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Oe({...this._def,catchall:e})}pick(e){const t={};return f.objectKeys(e).forEach((r=>{e[r]&&this.shape[r]&&(t[r]=this.shape[r])})),new Oe({...this._def,shape:()=>t})}omit(e){const t={};return f.objectKeys(this.shape).forEach((r=>{e[r]||(t[r]=this.shape[r])})),new Oe({...this._def,shape:()=>t})}deepPartial(){return Te(this)}partial(e){const t={};return f.objectKeys(this.shape).forEach((r=>{const n=this.shape[r];e&&!e[r]?t[r]=n:t[r]=n.optional()})),new Oe({...this._def,shape:()=>t})}required(e){const t={};return f.objectKeys(this.shape).forEach((r=>{if(e&&!e[r])t[r]=this.shape[r];else{let e=this.shape[r];for(;e instanceof Fe;)e=e._def.innerType;t[r]=e}})),new Oe({...this._def,shape:()=>t})}keyof(){return Ze(f.objectKeys(this.shape))}}Oe.create=(e,t)=>new Oe({shape:()=>e,unknownKeys:"strip",catchall:be.create(),typeName:Qe.ZodObject,...U(t)}),Oe.strictCreate=(e,t)=>new Oe({shape:()=>e,unknownKeys:"strict",catchall:be.create(),typeName:Qe.ZodObject,...U(t)}),Oe.lazycreate=(e,t)=>new Oe({shape:e,unknownKeys:"strip",catchall:be.create(),typeName:Qe.ZodObject,...U(t)});class Se extends ${_parse(e){const{ctx:t}=this._processInputParams(e),r=this._def.options;if(t.common.async)return Promise.all(r.map((async e=>{const r={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;const r=e.map((e=>new y(e.ctx.common.issues)));return T(t,{code:v.invalid_union,unionErrors:r}),S}));{let e;const n=[];for(const s of r){const r={...t,common:{...t.common,issues:[]},parent:null},i=s._parseSync({data:t.data,path:t.path,parent:r});if("valid"===i.status)return i;"dirty"!==i.status||e||(e={result:i,ctx:r}),r.common.issues.length&&n.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const s=n.map((e=>new y(e)));return T(t,{code:v.invalid_union,unionErrors:s}),S}}get options(){return this._def.options}}Se.create=(e,t)=>new Se({options:e,typeName:Qe.ZodUnion,...U(t)});const ke=e=>e instanceof Ae?ke(e.schema):e instanceof Be?ke(e.innerType()):e instanceof Me?[e.value]:e instanceof Le?e.options:e instanceof Ue?f.objectValues(e.enum):e instanceof He?ke(e._def.innerType):e instanceof me?[void 0]:e instanceof ve?[null]:e instanceof Fe?[void 0,...ke(e.unwrap())]:e instanceof ze?[null,...ke(e.unwrap())]:e instanceof Ke||e instanceof Ge?ke(e.unwrap()):e instanceof Ve?ke(e._def.innerType):[];class Ie extends ${_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==g.object)return T(t,{code:v.invalid_type,expected:g.object,received:t.parsedType}),S;const r=this.discriminator,n=t.data[r],s=this.optionsMap.get(n);return s?t.common.async?s._parseAsync({data:t.data,path:t.path,parent:t}):s._parseSync({data:t.data,path:t.path,parent:t}):(T(t,{code:v.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),S)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){const n=new Map;for(const r of t){const t=ke(r.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const s of t){if(n.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);n.set(s,r)}}return new Ie({typeName:Qe.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...U(r)})}}function Ce(e,t){const r=m(e),n=m(t);if(e===t)return{valid:!0,data:e};if(r===g.object&&n===g.object){const r=f.objectKeys(t),n=f.objectKeys(e).filter((e=>-1!==r.indexOf(e))),s={...e,...t};for(const r of n){const n=Ce(e[r],t[r]);if(!n.valid)return{valid:!1};s[r]=n.data}return{valid:!0,data:s}}if(r===g.array&&n===g.array){if(e.length!==t.length)return{valid:!1};const r=[];for(let n=0;n<e.length;n++){const s=Ce(e[n],t[n]);if(!s.valid)return{valid:!1};r.push(s.data)}return{valid:!0,data:r}}return r===g.date&&n===g.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class De extends ${_parse(e){const{status:t,ctx:r}=this._processInputParams(e),n=(e,n)=>{if(C(e)||C(n))return S;const s=Ce(e.value,n.value);return s.valid?((D(e)||D(n))&&t.dirty(),{status:t.value,value:s.data}):(T(r,{code:v.invalid_intersection_types}),S)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then((([e,t])=>n(e,t))):n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}De.create=(e,t,r)=>new De({left:e,right:t,typeName:Qe.ZodIntersection,...U(r)});class Ee extends ${_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==g.array)return T(r,{code:v.invalid_type,expected:g.array,received:r.parsedType}),S;if(r.data.length<this._def.items.length)return T(r,{code:v.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),S;!this._def.rest&&r.data.length>this._def.items.length&&(T(r,{code:v.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const n=[...r.data].map(((e,t)=>{const n=this._def.items[t]||this._def.rest;return n?n._parse(new Z(r,e,r.path,t)):null})).filter((e=>!!e));return r.common.async?Promise.all(n).then((e=>O.mergeArray(t,e))):O.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new Ee({...this._def,rest:e})}}Ee.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ee({items:e,typeName:Qe.ZodTuple,rest:null,...U(t)})};class je extends ${get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==g.object)return T(r,{code:v.invalid_type,expected:g.object,received:r.parsedType}),S;const n=[],s=this._def.keyType,i=this._def.valueType;for(const e in r.data)n.push({key:s._parse(new Z(r,e,r.path,e)),value:i._parse(new Z(r,r.data[e],r.path,e)),alwaysSet:e in r.data});return r.common.async?O.mergeObjectAsync(t,n):O.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,r){return new je(t instanceof $?{keyType:e,valueType:t,typeName:Qe.ZodRecord,...U(r)}:{keyType:de.create(),valueType:e,typeName:Qe.ZodRecord,...U(t)})}}class Ne extends ${get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==g.map)return T(r,{code:v.invalid_type,expected:g.map,received:r.parsedType}),S;const n=this._def.keyType,s=this._def.valueType,i=[...r.data.entries()].map((([e,t],i)=>({key:n._parse(new Z(r,e,r.path,[i,"key"])),value:s._parse(new Z(r,t,r.path,[i,"value"]))})));if(r.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const r of i){const n=await r.key,s=await r.value;if("aborted"===n.status||"aborted"===s.status)return S;"dirty"!==n.status&&"dirty"!==s.status||t.dirty(),e.set(n.value,s.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const r of i){const n=r.key,s=r.value;if("aborted"===n.status||"aborted"===s.status)return S;"dirty"!==n.status&&"dirty"!==s.status||t.dirty(),e.set(n.value,s.value)}return{status:t.value,value:e}}}}Ne.create=(e,t,r)=>new Ne({valueType:t,keyType:e,typeName:Qe.ZodMap,...U(r)});class Pe extends ${_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==g.set)return T(r,{code:v.invalid_type,expected:g.set,received:r.parsedType}),S;const n=this._def;null!==n.minSize&&r.data.size<n.minSize.value&&(T(r,{code:v.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),null!==n.maxSize&&r.data.size>n.maxSize.value&&(T(r,{code:v.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());const s=this._def.valueType;function i(e){const r=new Set;for(const n of e){if("aborted"===n.status)return S;"dirty"===n.status&&t.dirty(),r.add(n.value)}return{status:t.value,value:r}}const a=[...r.data.values()].map(((e,t)=>s._parse(new Z(r,e,r.path,t))));return r.common.async?Promise.all(a).then((e=>i(e))):i(a)}min(e,t){return new Pe({...this._def,minSize:{value:e,message:R.toString(t)}})}max(e,t){return new Pe({...this._def,maxSize:{value:e,message:R.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Pe.create=(e,t)=>new Pe({valueType:e,minSize:null,maxSize:null,typeName:Qe.ZodSet,...U(t)});class Re extends ${constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==g.function)return T(t,{code:v.invalid_type,expected:g.function,received:t.parsedType}),S;function r(e,r){return w({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,x(),_].filter((e=>!!e)),issueData:{code:v.invalid_arguments,argumentsError:r}})}function n(e,r){return w({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,x(),_].filter((e=>!!e)),issueData:{code:v.invalid_return_type,returnTypeError:r}})}const s={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof $e){const e=this;return I((async function(...t){const a=new y([]),o=await e._def.args.parseAsync(t,s).catch((e=>{throw a.addIssue(r(t,e)),a})),c=await Reflect.apply(i,this,o);return await e._def.returns._def.type.parseAsync(c,s).catch((e=>{throw a.addIssue(n(c,e)),a}))}))}{const e=this;return I((function(...t){const a=e._def.args.safeParse(t,s);if(!a.success)throw new y([r(t,a.error)]);const o=Reflect.apply(i,this,a.data),c=e._def.returns.safeParse(o,s);if(!c.success)throw new y([n(o,c.error)]);return c.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Re({...this._def,args:Ee.create(e).rest(_e.create())})}returns(e){return new Re({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new Re({args:e||Ee.create([]).rest(_e.create()),returns:t||_e.create(),typeName:Qe.ZodFunction,...U(r)})}}class Ae extends ${get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}Ae.create=(e,t)=>new Ae({getter:e,typeName:Qe.ZodLazy,...U(t)});class Me extends ${_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return T(t,{received:t.data,code:v.invalid_literal,expected:this._def.value}),S}return{status:"valid",value:e.data}}get value(){return this._def.value}}function Ze(e,t){return new Le({values:e,typeName:Qe.ZodEnum,...U(t)})}Me.create=(e,t)=>new Me({value:e,typeName:Qe.ZodLiteral,...U(t)});class Le extends ${constructor(){super(...arguments),A.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),r=this._def.values;return T(t,{expected:f.joinValues(r),received:t.parsedType,code:v.invalid_type}),S}if(N(this,A,"f")||P(this,A,new Set(this._def.values),"f"),!N(this,A,"f").has(e.data)){const t=this._getOrReturnCtx(e),r=this._def.values;return T(t,{received:t.data,code:v.invalid_enum_value,options:r}),S}return I(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return Le.create(e,{...this._def,...t})}exclude(e,t=this._def){return Le.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}A=new WeakMap,Le.create=Ze;class Ue extends ${constructor(){super(...arguments),M.set(this,void 0)}_parse(e){const t=f.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==g.string&&r.parsedType!==g.number){const e=f.objectValues(t);return T(r,{expected:f.joinValues(e),received:r.parsedType,code:v.invalid_type}),S}if(N(this,M,"f")||P(this,M,new Set(f.getValidEnumValues(this._def.values)),"f"),!N(this,M,"f").has(e.data)){const e=f.objectValues(t);return T(r,{received:r.data,code:v.invalid_enum_value,options:e}),S}return I(e.data)}get enum(){return this._def.values}}M=new WeakMap,Ue.create=(e,t)=>new Ue({values:e,typeName:Qe.ZodNativeEnum,...U(t)});class $e extends ${unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==g.promise&&!1===t.common.async)return T(t,{code:v.invalid_type,expected:g.promise,received:t.parsedType}),S;const r=t.parsedType===g.promise?t.data:Promise.resolve(t.data);return I(r.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}$e.create=(e,t)=>new $e({type:e,typeName:Qe.ZodPromise,...U(t)});class Be extends ${innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Qe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:r}=this._processInputParams(e),n=this._def.effect||null,s={addIssue:e=>{T(r,e),e.fatal?t.abort():t.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),"preprocess"===n.type){const e=n.transform(r.data,s);if(r.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return S;const n=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return"aborted"===n.status?S:"dirty"===n.status||"dirty"===t.value?k(n.value):n}));{if("aborted"===t.value)return S;const n=this._def.schema._parseSync({data:e,path:r.path,parent:r});return"aborted"===n.status?S:"dirty"===n.status||"dirty"===t.value?k(n.value):n}}if("refinement"===n.type){const e=e=>{const t=n.refinement(e,s);if(r.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===r.common.async){const n=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===n.status?S:("dirty"===n.status&&t.dirty(),e(n.value),{status:t.value,value:n.value})}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((r=>"aborted"===r.status?S:("dirty"===r.status&&t.dirty(),e(r.value).then((()=>({status:t.value,value:r.value}))))))}if("transform"===n.type){if(!1===r.common.async){const e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!E(e))return e;const i=n.transform(e.value,s);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((e=>E(e)?Promise.resolve(n.transform(e.value,s)).then((e=>({status:t.value,value:e}))):e))}f.assertNever(n)}}Be.create=(e,t,r)=>new Be({schema:e,typeName:Qe.ZodEffects,effect:t,...U(r)}),Be.createWithPreprocess=(e,t,r)=>new Be({schema:t,effect:{type:"preprocess",transform:e},typeName:Qe.ZodEffects,...U(r)});class Fe extends ${_parse(e){return this._getType(e)===g.undefined?I(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Fe.create=(e,t)=>new Fe({innerType:e,typeName:Qe.ZodOptional,...U(t)});class ze extends ${_parse(e){return this._getType(e)===g.null?I(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ze.create=(e,t)=>new ze({innerType:e,typeName:Qe.ZodNullable,...U(t)});class He extends ${_parse(e){const{ctx:t}=this._processInputParams(e);let r=t.data;return t.parsedType===g.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}He.create=(e,t)=>new He({innerType:e,typeName:Qe.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...U(t)});class Ve extends ${_parse(e){const{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return j(n)?n.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new y(r.common.issues)},input:r.data})}))):{status:"valid",value:"valid"===n.status?n.value:this._def.catchValue({get error(){return new y(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Ve.create=(e,t)=>new Ve({innerType:e,typeName:Qe.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...U(t)});class qe extends ${_parse(e){if(this._getType(e)!==g.nan){const t=this._getOrReturnCtx(e);return T(t,{code:v.invalid_type,expected:g.nan,received:t.parsedType}),S}return{status:"valid",value:e.data}}}qe.create=e=>new qe({typeName:Qe.ZodNaN,...U(e)});const We=Symbol("zod_brand");class Ke extends ${_parse(e){const{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class Xe extends ${_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const e=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?S:"dirty"===e.status?(t.dirty(),k(e.value)):this._def.out._parseAsync({data:e.value,path:r.path,parent:r})})();{const e=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?S:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:r.path,parent:r})}}static create(e,t){return new Xe({in:e,out:t,typeName:Qe.ZodPipeline})}}class Ge extends ${_parse(e){const t=this._def.innerType._parse(e),r=e=>(E(e)&&(e.value=Object.freeze(e.value)),e);return j(t)?t.then((e=>r(e))):r(t)}unwrap(){return this._def.innerType}}function Ye(e,t={},r){return e?ye.create().superRefine(((n,s)=>{var i,a;if(!e(n)){const e="function"==typeof t?t(n):"string"==typeof t?{message:t}:t,o=null===(a=null!==(i=e.fatal)&&void 0!==i?i:r)||void 0===a||a,c="string"==typeof e?{message:e}:e;s.addIssue({code:"custom",...c,fatal:o})}})):ye.create()}Ge.create=(e,t)=>new Ge({innerType:e,typeName:Qe.ZodReadonly,...U(t)});const Je={object:Oe.lazycreate};var Qe;!function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(Qe||(Qe={}));const et=de.create,tt=le.create,rt=qe.create,nt=he.create,st=fe.create,it=pe.create,at=ge.create,ot=me.create,ct=ve.create,dt=ye.create,ut=_e.create,lt=be.create,ht=xe.create,ft=we.create,pt=Oe.create,gt=Oe.strictCreate,mt=Se.create,vt=Ie.create,yt=De.create,_t=Ee.create,bt=je.create,xt=Ne.create,wt=Pe.create,Tt=Re.create,Ot=Ae.create,St=Me.create,kt=Le.create,It=Ue.create,Ct=$e.create,Dt=Be.create,Et=Fe.create,jt=ze.create,Nt=Be.createWithPreprocess,Pt=Xe.create,Rt={string:e=>de.create({...e,coerce:!0}),number:e=>le.create({...e,coerce:!0}),boolean:e=>fe.create({...e,coerce:!0}),bigint:e=>he.create({...e,coerce:!0}),date:e=>pe.create({...e,coerce:!0})},At=S;var Mt=Object.freeze({__proto__:null,defaultErrorMap:_,setErrorMap:function(e){b=e},getErrorMap:x,makeIssue:w,EMPTY_PATH:[],addIssueToContext:T,ParseStatus:O,INVALID:S,DIRTY:k,OK:I,isAborted:C,isDirty:D,isValid:E,isAsync:j,get util(){return f},get objectUtil(){return p},ZodParsedType:g,getParsedType:m,ZodType:$,datetimeRegex:ie,ZodString:de,ZodNumber:le,ZodBigInt:he,ZodBoolean:fe,ZodDate:pe,ZodSymbol:ge,ZodUndefined:me,ZodNull:ve,ZodAny:ye,ZodUnknown:_e,ZodNever:be,ZodVoid:xe,ZodArray:we,ZodObject:Oe,ZodUnion:Se,ZodDiscriminatedUnion:Ie,ZodIntersection:De,ZodTuple:Ee,ZodRecord:je,ZodMap:Ne,ZodSet:Pe,ZodFunction:Re,ZodLazy:Ae,ZodLiteral:Me,ZodEnum:Le,ZodNativeEnum:Ue,ZodPromise:$e,ZodEffects:Be,ZodTransformer:Be,ZodOptional:Fe,ZodNullable:ze,ZodDefault:He,ZodCatch:Ve,ZodNaN:qe,BRAND:We,ZodBranded:Ke,ZodPipeline:Xe,ZodReadonly:Ge,custom:Ye,Schema:$,ZodSchema:$,late:Je,get ZodFirstPartyTypeKind(){return Qe},coerce:Rt,any:dt,array:ft,bigint:nt,boolean:st,date:it,discriminatedUnion:vt,effect:Dt,enum:kt,function:Tt,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>Ye((t=>t instanceof e),t),intersection:yt,lazy:Ot,literal:St,map:xt,nan:rt,nativeEnum:It,never:lt,null:ct,nullable:jt,number:tt,object:pt,oboolean:()=>st().optional(),onumber:()=>tt().optional(),optional:Et,ostring:()=>et().optional(),pipeline:Pt,preprocess:Nt,promise:Ct,record:bt,set:wt,strictObject:gt,string:et,symbol:at,transformer:Dt,tuple:_t,undefined:ot,union:mt,unknown:ut,void:ht,NEVER:At,ZodIssueCode:v,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:y});const Zt=Mt.object({version:Mt.literal("1",{message:"Version must be 1"}),name:Mt.string({invalid_type_error:"Name must be a string",required_error:"Name is required"}).max(32,{message:"Name must be 32 characters or less"}),homeUrl:Mt.string({invalid_type_error:"Home URL must be a string",required_error:"Home URL is required"}).max(512,{message:"Home URL must be 512 characters or less"}),iconUrl:Mt.string({invalid_type_error:"Icon URL must be a string",required_error:"Icon URL is required"}).max(512,{message:"Icon URL must be 512 characters or less"}),splashImageUrl:Mt.string({invalid_type_error:"Splash image URL must be a string"}).max(512,{message:"Splash image URL must be 512 characters or less"}).optional(),imageUrl:Mt.string({invalid_type_error:"Image URL must be a string",required_error:"Image URL is required"}).max(512,{message:"Splash image URL must be 512 characters or less"}),buttonTitle:Mt.string({invalid_type_error:"Button title must be a string",required_error:"Button title is required"}).max(32,{message:"Button title must be 32 characters or less"}),splashBackgroundColor:Mt.string({invalid_type_error:"Splash background color must be a string"}).regex(/^#[0-9A-Fa-f]{3,6}$/,{message:"Splash background color must be a valid hex color"}).optional(),webhookUrl:Mt.string({invalid_type_error:"Webhook URL must be a string"}).max(512,{message:"Webhook URL must be 512 characters or less"}).optional()}),Lt=Mt.discriminatedUnion("type",[Mt.object({type:Mt.literal("cast",{message:"Trigger type must be cast"}),id:Mt.string({required_error:"Trigger ID is required"}),url:Mt.string({required_error:"Trigger URL is required"}),name:Mt.string({invalid_type_error:"Trigger name must be a string"}).optional()}),Mt.object({type:Mt.literal("composer",{message:"Trigger type must be composer"}),id:Mt.string({invalid_type_error:"Trigger ID must be a string",required_error:"Trigger ID is required"}),url:Mt.string({invalid_type_error:"Trigger URL must be a string",required_error:"Trigger URL is required"}),name:Mt.string({invalid_type_error:"Trigger name must be a string"}).optional()})]),Ut=Mt.object({accountAssociation:Mt.object({header:Mt.string({invalid_type_error:"Header must be a string",required_error:"Header is required"}),payload:Mt.string({invalid_type_error:"Payload must be a string",required_error:"Payload is required"}),signature:Mt.string({invalid_type_error:"Signature must be a string",required_error:"Signature is required"})},{invalid_type_error:"Account association must be an object"}),frame:Zt,triggers:Mt.array(Lt,{invalid_type_error:"Triggers must be an array"}).optional()}),$t=window.ReactJSXRuntime,Bt=()=>{const{removeNotice:e}=(0,h.useDispatch)(l.store),t=(0,h.useSelect)((e=>e(l.store).getNotices()),[]);if(0===t.length)return null;const r=t.map((e=>({id:e.id,content:e.content})));return(0,$t.jsx)(c.NoticeList,{notices:r,onRemove:e})},Ft=window.wp.mediaUtils;function zt(e,t,...r){if("undefined"!=typeof process&&void 0===t)throw new Error("invariant requires an error message argument");if(!e){let e;if(void 0===t)e=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{let n=0;e=new Error(t.replace(/%s/g,(function(){return r[n++]}))),e.name="Invariant Violation"}throw e.framesToPop=1,e}}var Ht=r(2017);const Vt=window.React,qt="undefined"!=typeof window?Vt.useLayoutEffect:Vt.useEffect;function Wt(e,t,r){return function(e,t,r){const[n,s]=function(e,t,r){const[n,s]=(0,Vt.useState)((()=>t(e))),i=(0,Vt.useCallback)((()=>{const i=t(e);Ht(n,i)||(s(i),r&&r())}),[n,e,r]);return qt(i),[n,i]}(e,t,r);return qt((function(){const t=e.getHandlerId();if(null!=t)return e.subscribeToStateChange(s,{handlerIds:[t]})}),[e,s]),n}(t,e||(()=>({})),(()=>r.reconnect()))}function Kt(e,t){const r=[...t||[]];return null==t&&"function"!=typeof e&&r.push(e),(0,Vt.useMemo)((()=>"function"==typeof e?e():e),r)}function Xt(e){return(0,Vt.useMemo)((()=>e.hooks.dragSource()),[e])}function Gt(e){return(0,Vt.useMemo)((()=>e.hooks.dragPreview()),[e])}function Yt(e,t,r,n){let s=r?r.call(n,e,t):void 0;if(void 0!==s)return!!s;if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;const i=Object.keys(e),a=Object.keys(t);if(i.length!==a.length)return!1;const o=Object.prototype.hasOwnProperty.bind(t);for(let a=0;a<i.length;a++){const c=i[a];if(!o(c))return!1;const d=e[c],u=t[c];if(s=r?r.call(n,d,u,c):void 0,!1===s||void 0===s&&d!==u)return!1}return!0}function Jt(e){return null!==e&&"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"current")}function Qt(e){const t={};return Object.keys(e).forEach((r=>{const n=e[r];if(r.endsWith("Ref"))t[r]=e[r];else{const e=function(e){return(t=null,r=null)=>{if(!(0,Vt.isValidElement)(t)){const n=t;return e(n,r),n}const n=t;return function(e){if("string"==typeof e.type)return;const t=e.type.displayName||e.type.name||"the component";throw new Error(`Only native element nodes can now be passed to React DnD connectors.You can either wrap ${t} into a <div>, or turn it into a drag source or a drop target itself.`)}(n),function(e,t){const r=e.ref;return zt("string"!=typeof r,"Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"),r?(0,Vt.cloneElement)(e,{ref:e=>{er(r,e),er(t,e)}}):(0,Vt.cloneElement)(e,{ref:t})}(n,r?t=>e(t,r):e)}}(n);t[r]=()=>e}})),t}function er(e,t){"function"==typeof e?e(t):e.current=t}class tr{receiveHandlerId(e){this.handlerId!==e&&(this.handlerId=e,this.reconnect())}get connectTarget(){return this.dragSource}get dragSourceOptions(){return this.dragSourceOptionsInternal}set dragSourceOptions(e){this.dragSourceOptionsInternal=e}get dragPreviewOptions(){return this.dragPreviewOptionsInternal}set dragPreviewOptions(e){this.dragPreviewOptionsInternal=e}reconnect(){const e=this.reconnectDragSource();this.reconnectDragPreview(e)}reconnectDragSource(){const e=this.dragSource,t=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();return t&&this.disconnectDragSource(),this.handlerId?e?(t&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragSource=e,this.lastConnectedDragSourceOptions=this.dragSourceOptions,this.dragSourceUnsubscribe=this.backend.connectDragSource(this.handlerId,e,this.dragSourceOptions)),t):(this.lastConnectedDragSource=e,t):t}reconnectDragPreview(e=!1){const t=this.dragPreview,r=e||this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();r&&this.disconnectDragPreview(),this.handlerId&&(t?r&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragPreview=t,this.lastConnectedDragPreviewOptions=this.dragPreviewOptions,this.dragPreviewUnsubscribe=this.backend.connectDragPreview(this.handlerId,t,this.dragPreviewOptions)):this.lastConnectedDragPreview=t)}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didConnectedDragSourceChange(){return this.lastConnectedDragSource!==this.dragSource}didConnectedDragPreviewChange(){return this.lastConnectedDragPreview!==this.dragPreview}didDragSourceOptionsChange(){return!Yt(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}didDragPreviewOptionsChange(){return!Yt(this.lastConnectedDragPreviewOptions,this.dragPreviewOptions)}disconnectDragSource(){this.dragSourceUnsubscribe&&(this.dragSourceUnsubscribe(),this.dragSourceUnsubscribe=void 0)}disconnectDragPreview(){this.dragPreviewUnsubscribe&&(this.dragPreviewUnsubscribe(),this.dragPreviewUnsubscribe=void 0,this.dragPreviewNode=null,this.dragPreviewRef=null)}get dragSource(){return this.dragSourceNode||this.dragSourceRef&&this.dragSourceRef.current}get dragPreview(){return this.dragPreviewNode||this.dragPreviewRef&&this.dragPreviewRef.current}clearDragSource(){this.dragSourceNode=null,this.dragSourceRef=null}clearDragPreview(){this.dragPreviewNode=null,this.dragPreviewRef=null}constructor(e){this.hooks=Qt({dragSource:(e,t)=>{this.clearDragSource(),this.dragSourceOptions=t||null,Jt(e)?this.dragSourceRef=e:this.dragSourceNode=e,this.reconnectDragSource()},dragPreview:(e,t)=>{this.clearDragPreview(),this.dragPreviewOptions=t||null,Jt(e)?this.dragPreviewRef=e:this.dragPreviewNode=e,this.reconnectDragPreview()}}),this.handlerId=null,this.dragSourceRef=null,this.dragSourceOptionsInternal=null,this.dragPreviewRef=null,this.dragPreviewOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDragSource=null,this.lastConnectedDragSourceOptions=null,this.lastConnectedDragPreview=null,this.lastConnectedDragPreviewOptions=null,this.backend=e}}const rr=(0,Vt.createContext)({dragDropManager:void 0});function nr(){const{dragDropManager:e}=(0,Vt.useContext)(rr);return zt(null!=e,"Expected drag drop context"),e}let sr=!1,ir=!1;class ar{receiveHandlerId(e){this.sourceId=e}getHandlerId(){return this.sourceId}canDrag(){zt(!sr,"You may not call monitor.canDrag() inside your canDrag() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return sr=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{sr=!1}}isDragging(){if(!this.sourceId)return!1;zt(!ir,"You may not call monitor.isDragging() inside your isDragging() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return ir=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{ir=!1}}subscribeToStateChange(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}isDraggingSource(e){return this.internalMonitor.isDraggingSource(e)}isOverTarget(e,t){return this.internalMonitor.isOverTarget(e,t)}getTargetIds(){return this.internalMonitor.getTargetIds()}isSourcePublic(){return this.internalMonitor.isSourcePublic()}getSourceId(){return this.internalMonitor.getSourceId()}subscribeToOffsetChange(e){return this.internalMonitor.subscribeToOffsetChange(e)}canDragSource(e){return this.internalMonitor.canDragSource(e)}canDropOnTarget(e){return this.internalMonitor.canDropOnTarget(e)}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(e){this.sourceId=null,this.internalMonitor=e.getMonitor()}}class or{beginDrag(){const e=this.spec,t=this.monitor;let r=null;return r="object"==typeof e.item?e.item:"function"==typeof e.item?e.item(t):{},null!=r?r:null}canDrag(){const e=this.spec,t=this.monitor;return"boolean"==typeof e.canDrag?e.canDrag:"function"!=typeof e.canDrag||e.canDrag(t)}isDragging(e,t){const r=this.spec,n=this.monitor,{isDragging:s}=r;return s?s(n):t===e.getSourceId()}endDrag(){const e=this.spec,t=this.monitor,r=this.connector,{end:n}=e;n&&n(t.getItem(),t),r.reconnect()}constructor(e,t,r){this.spec=e,this.monitor=t,this.connector=r}}function cr(e,t){const r=Kt(e,t);zt(!r.begin,"useDrag::spec.begin was deprecated in v14. Replace spec.begin() with spec.item(). (see more here - https://react-dnd.github.io/react-dnd/docs/api/use-drag)");const n=function(){const e=nr();return(0,Vt.useMemo)((()=>new ar(e)),[e])}(),s=function(e,t){const r=nr(),n=(0,Vt.useMemo)((()=>new tr(r.getBackend())),[r]);return qt((()=>(n.dragSourceOptions=e||null,n.reconnect(),()=>n.disconnectDragSource())),[n,e]),qt((()=>(n.dragPreviewOptions=t||null,n.reconnect(),()=>n.disconnectDragPreview())),[n,t]),n}(r.options,r.previewOptions);return function(e,t,r){const n=nr(),s=function(e,t,r){const n=(0,Vt.useMemo)((()=>new or(e,t,r)),[t,r]);return(0,Vt.useEffect)((()=>{n.spec=e}),[e]),n}(e,t,r),i=function(e){return(0,Vt.useMemo)((()=>{const t=e.type;return zt(null!=t,"spec.type must be defined"),t}),[e])}(e);qt((function(){if(null!=i){const[e,a]=function(e,t,r){const n=r.getRegistry(),s=n.addSource(e,t);return[s,()=>n.removeSource(s)]}(i,s,n);return t.receiveHandlerId(e),r.receiveHandlerId(e),a}}),[n,t,r,s,i])}(r,n,s),[Wt(r.collect,n,s),Xt(s),Gt(s)]}function dr(e){return(0,Vt.useMemo)((()=>e.hooks.dropTarget()),[e])}class ur{get connectTarget(){return this.dropTarget}reconnect(){const e=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();e&&this.disconnectDropTarget();const t=this.dropTarget;this.handlerId&&(t?e&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=t,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,t,this.dropTargetOptions)):this.lastConnectedDropTarget=t)}receiveHandlerId(e){e!==this.handlerId&&(this.handlerId=e,this.reconnect())}get dropTargetOptions(){return this.dropTargetOptionsInternal}set dropTargetOptions(e){this.dropTargetOptionsInternal=e}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didDropTargetChange(){return this.lastConnectedDropTarget!==this.dropTarget}didOptionsChange(){return!Yt(this.lastConnectedDropTargetOptions,this.dropTargetOptions)}disconnectDropTarget(){this.unsubscribeDropTarget&&(this.unsubscribeDropTarget(),this.unsubscribeDropTarget=void 0)}get dropTarget(){return this.dropTargetNode||this.dropTargetRef&&this.dropTargetRef.current}clearDropTarget(){this.dropTargetRef=null,this.dropTargetNode=null}constructor(e){this.hooks=Qt({dropTarget:(e,t)=>{this.clearDropTarget(),this.dropTargetOptions=t,Jt(e)?this.dropTargetRef=e:this.dropTargetNode=e,this.reconnect()}}),this.handlerId=null,this.dropTargetRef=null,this.dropTargetOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDropTarget=null,this.lastConnectedDropTargetOptions=null,this.backend=e}}let lr=!1;class hr{receiveHandlerId(e){this.targetId=e}getHandlerId(){return this.targetId}subscribeToStateChange(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}canDrop(){if(!this.targetId)return!1;zt(!lr,"You may not call monitor.canDrop() inside your canDrop() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor");try{return lr=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{lr=!1}}isOver(e){return!!this.targetId&&this.internalMonitor.isOverTarget(this.targetId,e)}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(e){this.targetId=null,this.internalMonitor=e.getMonitor()}}class fr{canDrop(){const e=this.spec,t=this.monitor;return!e.canDrop||e.canDrop(t.getItem(),t)}hover(){const e=this.spec,t=this.monitor;e.hover&&e.hover(t.getItem(),t)}drop(){const e=this.spec,t=this.monitor;if(e.drop)return e.drop(t.getItem(),t)}constructor(e,t){this.spec=e,this.monitor=t}}function pr(e,t){const r=Kt(e,t),n=function(){const e=nr();return(0,Vt.useMemo)((()=>new hr(e)),[e])}(),s=function(e){const t=nr(),r=(0,Vt.useMemo)((()=>new ur(t.getBackend())),[t]);return qt((()=>(r.dropTargetOptions=e||null,r.reconnect(),()=>r.disconnectDropTarget())),[e]),r}(r.options);return function(e,t,r){const n=nr(),s=function(e,t){const r=(0,Vt.useMemo)((()=>new fr(e,t)),[t]);return(0,Vt.useEffect)((()=>{r.spec=e}),[e]),r}(e,t),i=function(e){const{accept:t}=e;return(0,Vt.useMemo)((()=>(zt(null!=e.accept,"accept must be defined"),Array.isArray(t)?t:[t])),[t])}(e);qt((function(){const[e,a]=function(e,t,r){const n=r.getRegistry(),s=n.addTarget(e,t);return[s,()=>n.removeTarget(s)]}(i,s,n);return t.receiveHandlerId(e),r.receiveHandlerId(e),a}),[n,t,s,r,i.map((e=>e.toString())).join("|")])}(r,n,s),[Wt(r.collect,n,s),dr(s)]}function gr(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var mr="function"==typeof Symbol&&Symbol.observable||"@@observable",vr=function(){return Math.random().toString(36).substring(7).split("").join(".")},yr={INIT:"@@redux/INIT"+vr(),REPLACE:"@@redux/REPLACE"+vr(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+vr()}};function _r(e,t,r){var n;if("function"==typeof t&&"function"==typeof r||"function"==typeof r&&"function"==typeof arguments[3])throw new Error(gr(0));if("function"==typeof t&&void 0===r&&(r=t,t=void 0),void 0!==r){if("function"!=typeof r)throw new Error(gr(1));return r(_r)(e,t)}if("function"!=typeof e)throw new Error(gr(2));var s=e,i=t,a=[],o=a,c=!1;function d(){o===a&&(o=a.slice())}function u(){if(c)throw new Error(gr(3));return i}function l(e){if("function"!=typeof e)throw new Error(gr(4));if(c)throw new Error(gr(5));var t=!0;return d(),o.push(e),function(){if(t){if(c)throw new Error(gr(6));t=!1,d();var r=o.indexOf(e);o.splice(r,1),a=null}}}function h(e){if(!function(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}(e))throw new Error(gr(7));if(void 0===e.type)throw new Error(gr(8));if(c)throw new Error(gr(9));try{c=!0,i=s(i,e)}finally{c=!1}for(var t=a=o,r=0;r<t.length;r++)(0,t[r])();return e}return h({type:yr.INIT}),(n={dispatch:h,subscribe:l,getState:u,replaceReducer:function(e){if("function"!=typeof e)throw new Error(gr(10));s=e,h({type:yr.REPLACE})}})[mr]=function(){var e,t=l;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(gr(11));function r(){e.next&&e.next(u())}return r(),{unsubscribe:t(r)}}})[mr]=function(){return this},e},n}function br(e){return"object"==typeof e}const xr="dnd-core/INIT_COORDS",wr="dnd-core/BEGIN_DRAG",Tr="dnd-core/PUBLISH_DRAG_SOURCE",Or="dnd-core/HOVER",Sr="dnd-core/DROP",kr="dnd-core/END_DRAG";function Ir(e,t){return{type:xr,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}const Cr={type:xr,payload:{clientOffset:null,sourceClientOffset:null}};function Dr(e){return function(t=[],r={publishSource:!0}){const{publishSource:n=!0,clientOffset:s,getSourceClientOffset:i}=r,a=e.getMonitor(),o=e.getRegistry();e.dispatch(Ir(s)),function(e,t,r){zt(!t.isDragging(),"Cannot call beginDrag while dragging."),e.forEach((function(e){zt(r.getSource(e),"Expected sourceIds to be registered.")}))}(t,a,o);const c=function(e,t){let r=null;for(let n=e.length-1;n>=0;n--)if(t.canDragSource(e[n])){r=e[n];break}return r}(t,a);if(null==c)return void e.dispatch(Cr);let d=null;if(s){if(!i)throw new Error("getSourceClientOffset must be defined");!function(e){zt("function"==typeof e,"When clientOffset is provided, getSourceClientOffset must be a function.")}(i),d=i(c)}e.dispatch(Ir(s,d));const u=o.getSource(c).beginDrag(a,c);if(null==u)return;!function(e){zt(br(e),"Item must be an object.")}(u),o.pinSource(c);const l=o.getSourceType(c);return{type:wr,payload:{itemType:l,item:u,sourceId:c,clientOffset:s||null,sourceClientOffset:d||null,isSourcePublic:!!n}}}}function Er(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function jr(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){Er(e,t,r[t])}))}return e}function Nr(e){return function(t={}){const r=e.getMonitor(),n=e.getRegistry();!function(e){zt(e.isDragging(),"Cannot call drop while not dragging."),zt(!e.didDrop(),"Cannot call drop twice during one drag operation.")}(r);const s=function(e){const t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}(r);s.forEach(((s,i)=>{const a=function(e,t,r,n){const s=r.getTarget(e);let i=s?s.drop(n,e):void 0;return function(e){zt(void 0===e||br(e),"Drop result must either be an object or undefined.")}(i),void 0===i&&(i=0===t?{}:n.getDropResult()),i}(s,i,n,r),o={type:Sr,payload:{dropResult:jr({},t,a)}};e.dispatch(o)}))}}function Pr(e){return function(){const t=e.getMonitor(),r=e.getRegistry();!function(e){zt(e.isDragging(),"Cannot call endDrag while not dragging.")}(t);const n=t.getSourceId();return null!=n&&(r.getSource(n,!0).endDrag(t,n),r.unpinSource()),{type:kr}}}function Rr(e,t){return null===t?null===e:Array.isArray(e)?e.some((e=>e===t)):e===t}function Ar(e){return function(t,{clientOffset:r}={}){!function(e){zt(Array.isArray(e),"Expected targetIds to be an array.")}(t);const n=t.slice(0),s=e.getMonitor(),i=e.getRegistry();return function(e,t,r){for(let n=e.length-1;n>=0;n--){const s=e[n];Rr(t.getTargetType(s),r)||e.splice(n,1)}}(n,i,s.getItemType()),function(e,t,r){zt(t.isDragging(),"Cannot call hover while not dragging."),zt(!t.didDrop(),"Cannot call hover after drop.");for(let t=0;t<e.length;t++){const n=e[t];zt(e.lastIndexOf(n)===t,"Expected targetIds to be unique in the passed array."),zt(r.getTarget(n),"Expected targetIds to be registered.")}}(n,s,i),function(e,t,r){e.forEach((function(e){r.getTarget(e).hover(t,e)}))}(n,s,i),{type:Or,payload:{targetIds:n,clientOffset:r||null}}}}function Mr(e){return function(){if(e.getMonitor().isDragging())return{type:Tr}}}class Zr{receiveBackend(e){this.backend=e}getMonitor(){return this.monitor}getBackend(){return this.backend}getRegistry(){return this.monitor.registry}getActions(){const e=this,{dispatch:t}=this.store,r=function(e){return{beginDrag:Dr(e),publishDragSource:Mr(e),hover:Ar(e),drop:Nr(e),endDrag:Pr(e)}}(this);return Object.keys(r).reduce(((n,s)=>{const i=r[s];var a;return n[s]=(a=i,(...r)=>{const n=a.apply(e,r);void 0!==n&&t(n)}),n}),{})}dispatch(e){this.store.dispatch(e)}constructor(e,t){this.isSetUp=!1,this.handleRefCountChange=()=>{const e=this.store.getState().refCount>0;this.backend&&(e&&!this.isSetUp?(this.backend.setup(),this.isSetUp=!0):!e&&this.isSetUp&&(this.backend.teardown(),this.isSetUp=!1))},this.store=e,this.monitor=t,e.subscribe(this.handleRefCountChange)}}function Lr(e,t){return{x:e.x-t.x,y:e.y-t.y}}const Ur=[],$r=[];Ur.__IS_NONE__=!0,$r.__IS_ALL__=!0;class Br{subscribeToStateChange(e,t={}){const{handlerIds:r}=t;zt("function"==typeof e,"listener must be a function."),zt(void 0===r||Array.isArray(r),"handlerIds, when specified, must be an array of strings.");let n=this.store.getState().stateId;return this.store.subscribe((()=>{const t=this.store.getState(),s=t.stateId;try{const i=s===n||s===n+1&&!function(e,t){return e!==Ur&&(e===$r||void 0===t||(r=e,t.filter((e=>r.indexOf(e)>-1))).length>0);var r}(t.dirtyHandlerIds,r);i||e()}finally{n=s}}))}subscribeToOffsetChange(e){zt("function"==typeof e,"listener must be a function.");let t=this.store.getState().dragOffset;return this.store.subscribe((()=>{const r=this.store.getState().dragOffset;r!==t&&(t=r,e())}))}canDragSource(e){if(!e)return!1;const t=this.registry.getSource(e);return zt(t,`Expected to find a valid source. sourceId=${e}`),!this.isDragging()&&t.canDrag(this,e)}canDropOnTarget(e){if(!e)return!1;const t=this.registry.getTarget(e);return zt(t,`Expected to find a valid target. targetId=${e}`),!(!this.isDragging()||this.didDrop())&&(Rr(this.registry.getTargetType(e),this.getItemType())&&t.canDrop(this,e))}isDragging(){return Boolean(this.getItemType())}isDraggingSource(e){if(!e)return!1;const t=this.registry.getSource(e,!0);return zt(t,`Expected to find a valid source. sourceId=${e}`),!(!this.isDragging()||!this.isSourcePublic())&&(this.registry.getSourceType(e)===this.getItemType()&&t.isDragging(this,e))}isOverTarget(e,t={shallow:!1}){if(!e)return!1;const{shallow:r}=t;if(!this.isDragging())return!1;const n=this.registry.getTargetType(e),s=this.getItemType();if(s&&!Rr(n,s))return!1;const i=this.getTargetIds();if(!i.length)return!1;const a=i.indexOf(e);return r?a===i.length-1:a>-1}getItemType(){return this.store.getState().dragOperation.itemType}getItem(){return this.store.getState().dragOperation.item}getSourceId(){return this.store.getState().dragOperation.sourceId}getTargetIds(){return this.store.getState().dragOperation.targetIds}getDropResult(){return this.store.getState().dragOperation.dropResult}didDrop(){return this.store.getState().dragOperation.didDrop}isSourcePublic(){return Boolean(this.store.getState().dragOperation.isSourcePublic)}getInitialClientOffset(){return this.store.getState().dragOffset.initialClientOffset}getInitialSourceClientOffset(){return this.store.getState().dragOffset.initialSourceClientOffset}getClientOffset(){return this.store.getState().dragOffset.clientOffset}getSourceClientOffset(){return function(e){const{clientOffset:t,initialClientOffset:r,initialSourceClientOffset:n}=e;return t&&r&&n?Lr((i=n,{x:(s=t).x+i.x,y:s.y+i.y}),r):null;var s,i}(this.store.getState().dragOffset)}getDifferenceFromInitialOffset(){return function(e){const{clientOffset:t,initialClientOffset:r}=e;return t&&r?Lr(t,r):null}(this.store.getState().dragOffset)}constructor(e,t){this.store=e,this.registry=t}}const Fr="undefined"!=typeof global?global:self,zr=Fr.MutationObserver||Fr.WebKitMutationObserver;function Hr(e){return function(){const t=setTimeout(n,0),r=setInterval(n,50);function n(){clearTimeout(t),clearInterval(r),e()}}}const Vr="function"==typeof zr?function(e){let t=1;const r=new zr(e),n=document.createTextNode("");return r.observe(n,{characterData:!0}),function(){t=-t,n.data=t}}:Hr;class qr{call(){try{this.task&&this.task()}catch(e){this.onError(e)}finally{this.task=null,this.release(this)}}constructor(e,t){this.onError=e,this.release=t,this.task=null}}const Wr=new class{enqueueTask(e){const{queue:t,requestFlush:r}=this;t.length||(r(),this.flushing=!0),t[t.length]=e}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{const{queue:e}=this;for(;this.index<e.length;){const t=this.index;if(this.index++,e[t].call(),this.index>this.capacity){for(let t=0,r=e.length-this.index;t<r;t++)e[t]=e[t+this.index];e.length-=this.index,this.index=0}}e.length=0,this.index=0,this.flushing=!1},this.registerPendingError=e=>{this.pendingErrors.push(e),this.requestErrorThrow()},this.requestFlush=Vr(this.flush),this.requestErrorThrow=Hr((()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()}))}},Kr=new class{create(e){const t=this.freeTasks,r=t.length?t.pop():new qr(this.onError,(e=>t[t.length]=e));return r.task=e,r}constructor(e){this.onError=e,this.freeTasks=[]}}(Wr.registerPendingError),Xr="dnd-core/ADD_SOURCE",Gr="dnd-core/ADD_TARGET",Yr="dnd-core/REMOVE_SOURCE",Jr="dnd-core/REMOVE_TARGET";function Qr(e,t){t&&Array.isArray(e)?e.forEach((e=>Qr(e,!1))):zt("string"==typeof e||"symbol"==typeof e,t?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}var en;!function(e){e.SOURCE="SOURCE",e.TARGET="TARGET"}(en||(en={}));let tn=0;function rn(e){switch(e[0]){case"S":return en.SOURCE;case"T":return en.TARGET;default:throw new Error(`Cannot parse handler ID: ${e}`)}}function nn(e,t){const r=e.entries();let n=!1;do{const{done:e,value:[,s]}=r.next();if(s===t)return!0;n=!!e}while(!n);return!1}class sn{addSource(e,t){Qr(e),function(e){zt("function"==typeof e.canDrag,"Expected canDrag to be a function."),zt("function"==typeof e.beginDrag,"Expected beginDrag to be a function."),zt("function"==typeof e.endDrag,"Expected endDrag to be a function.")}(t);const r=this.addHandler(en.SOURCE,e,t);return this.store.dispatch(function(e){return{type:Xr,payload:{sourceId:e}}}(r)),r}addTarget(e,t){Qr(e,!0),function(e){zt("function"==typeof e.canDrop,"Expected canDrop to be a function."),zt("function"==typeof e.hover,"Expected hover to be a function."),zt("function"==typeof e.drop,"Expected beginDrag to be a function.")}(t);const r=this.addHandler(en.TARGET,e,t);return this.store.dispatch(function(e){return{type:Gr,payload:{targetId:e}}}(r)),r}containsHandler(e){return nn(this.dragSources,e)||nn(this.dropTargets,e)}getSource(e,t=!1){return zt(this.isSourceId(e),"Expected a valid source ID."),t&&e===this.pinnedSourceId?this.pinnedSource:this.dragSources.get(e)}getTarget(e){return zt(this.isTargetId(e),"Expected a valid target ID."),this.dropTargets.get(e)}getSourceType(e){return zt(this.isSourceId(e),"Expected a valid source ID."),this.types.get(e)}getTargetType(e){return zt(this.isTargetId(e),"Expected a valid target ID."),this.types.get(e)}isSourceId(e){return rn(e)===en.SOURCE}isTargetId(e){return rn(e)===en.TARGET}removeSource(e){var t;zt(this.getSource(e),"Expected an existing source."),this.store.dispatch(function(e){return{type:Yr,payload:{sourceId:e}}}(e)),t=()=>{this.dragSources.delete(e),this.types.delete(e)},Wr.enqueueTask(Kr.create(t))}removeTarget(e){zt(this.getTarget(e),"Expected an existing target."),this.store.dispatch(function(e){return{type:Jr,payload:{targetId:e}}}(e)),this.dropTargets.delete(e),this.types.delete(e)}pinSource(e){const t=this.getSource(e);zt(t,"Expected an existing source."),this.pinnedSourceId=e,this.pinnedSource=t}unpinSource(){zt(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}addHandler(e,t,r){const n=function(e){const t=(tn++).toString();switch(e){case en.SOURCE:return`S${t}`;case en.TARGET:return`T${t}`;default:throw new Error(`Unknown Handler Role: ${e}`)}}(e);return this.types.set(n,t),e===en.SOURCE?this.dragSources.set(n,r):e===en.TARGET&&this.dropTargets.set(n,r),n}constructor(e){this.types=new Map,this.dragSources=new Map,this.dropTargets=new Map,this.pinnedSourceId=null,this.pinnedSource=null,this.store=e}}const an=(e,t)=>e===t;function on(e=Ur,t){switch(t.type){case Or:break;case Xr:case Gr:case Jr:case Yr:return Ur;default:return $r}const{targetIds:r=[],prevTargetIds:n=[]}=t.payload,s=function(e,t){const r=new Map,n=e=>{r.set(e,r.has(e)?r.get(e)+1:1)};e.forEach(n),t.forEach(n);const s=[];return r.forEach(((e,t)=>{1===e&&s.push(t)})),s}(r,n);if(!(s.length>0)&&function(e,t,r=an){if(e.length!==t.length)return!1;for(let n=0;n<e.length;++n)if(!r(e[n],t[n]))return!1;return!0}(r,n))return Ur;const i=n[n.length-1],a=r[r.length-1];return i!==a&&(i&&s.push(i),a&&s.push(a)),s}function cn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const dn={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function un(e=dn,t){const{payload:r}=t;switch(t.type){case xr:case wr:return{initialSourceClientOffset:r.sourceClientOffset,initialClientOffset:r.clientOffset,clientOffset:r.clientOffset};case Or:return n=e.clientOffset,s=r.clientOffset,!n&&!s||n&&s&&n.x===s.x&&n.y===s.y?e:function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){cn(e,t,r[t])}))}return e}({},e,{clientOffset:r.clientOffset});case kr:case Sr:return dn;default:return e}var n,s}function ln(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function hn(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){ln(e,t,r[t])}))}return e}const fn={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function pn(e=fn,t){const{payload:r}=t;switch(t.type){case wr:return hn({},e,{itemType:r.itemType,item:r.item,sourceId:r.sourceId,isSourcePublic:r.isSourcePublic,dropResult:null,didDrop:!1});case Tr:return hn({},e,{isSourcePublic:!0});case Or:return hn({},e,{targetIds:r.targetIds});case Jr:return-1===e.targetIds.indexOf(r.targetId)?e:hn({},e,{targetIds:(n=e.targetIds,s=r.targetId,n.filter((e=>e!==s)))});case Sr:return hn({},e,{dropResult:r.dropResult,didDrop:!0,targetIds:[]});case kr:return hn({},e,{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}var n,s}function gn(e=0,t){switch(t.type){case Xr:case Gr:return e+1;case Yr:case Jr:return e-1;default:return e}}function mn(e=0){return e+1}function vn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function yn(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){vn(e,t,r[t])}))}return e}function bn(e={},t){return{dirtyHandlerIds:on(e.dirtyHandlerIds,{type:t.type,payload:yn({},t.payload,{prevTargetIds:(r=e,n=[],"dragOperation.targetIds".split(".").reduce(((e,t)=>e&&e[t]?e[t]:n||null),r))})}),dragOffset:un(e.dragOffset,t),refCount:gn(e.refCount,t),dragOperation:pn(e.dragOperation,t),stateId:mn(e.stateId)};var r,n}function xn(e,t=void 0,r={},n=!1){const s=function(e){const t="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__;return _r(bn,e&&t&&t({name:"dnd-core",instanceId:"dnd-core"}))}(n),i=new Br(s,new sn(s)),a=new Zr(s,i),o=e(a,t,r);return a.receiveBackend(o),a}let wn=0;const Tn=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__");var On=(0,Vt.memo)((function(e){var{children:t}=e,r=function(e,t){if(null==e)return{};var r,n,s=function(e,t){if(null==e)return{};var r,n,s={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(s[r]=e[r]);return s}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}(e,["children"]);const[n,s]=function(e){if("manager"in e)return[{dragDropManager:e.manager},!1];return[function(e,t=Sn(),r,n){const s=t;return s[Tn]||(s[Tn]={dragDropManager:xn(e,t,r,n)}),s[Tn]}(e.backend,e.context,e.options,e.debugMode),!e.context]}(r);return(0,Vt.useEffect)((()=>{if(s){const e=Sn();return++wn,()=>{0==--wn&&(e[Tn]=null)}}}),[]),(0,$t.jsx)(rr.Provider,{value:n,children:t})}));function Sn(){return"undefined"!=typeof global?global:window}function kn(e){let t=null;return()=>(null==t&&(t=e()),t)}class In{enter(e){const t=this.entered.length;return this.entered=function(e,t){const r=new Set,n=e=>r.add(e);e.forEach(n),t.forEach(n);const s=[];return r.forEach((e=>s.push(e))),s}(this.entered.filter((t=>this.isNodeInDocument(t)&&(!t.contains||t.contains(e)))),[e]),0===t&&this.entered.length>0}leave(e){const t=this.entered.length;var r,n;return this.entered=(r=this.entered.filter(this.isNodeInDocument),n=e,r.filter((e=>e!==n))),t>0&&0===this.entered.length}reset(){this.entered=[]}constructor(e){this.entered=[],this.isNodeInDocument=e}}class Cn{initializeExposedProperties(){Object.keys(this.config.exposeProperties).forEach((e=>{Object.defineProperty(this.item,e,{configurable:!0,enumerable:!0,get:()=>(console.warn(`Browser doesn't allow reading "${e}" until the drop event.`),null)})}))}loadDataTransfer(e){if(e){const t={};Object.keys(this.config.exposeProperties).forEach((r=>{const n=this.config.exposeProperties[r];null!=n&&(t[r]={value:n(e,this.config.matchesTypes),configurable:!0,enumerable:!0})})),Object.defineProperties(this.item,t)}}canDrag(){return!0}beginDrag(){return this.item}isDragging(e,t){return t===e.getSourceId()}endDrag(){}constructor(e){this.config=e,this.item={},this.initializeExposedProperties()}}const Dn="__NATIVE_FILE__",En="__NATIVE_URL__",jn="__NATIVE_TEXT__",Nn="__NATIVE_HTML__";function Pn(e,t,r){const n=t.reduce(((t,r)=>t||e.getData(r)),"");return null!=n?n:r}const Rn={[Dn]:{exposeProperties:{files:e=>Array.prototype.slice.call(e.files),items:e=>e.items,dataTransfer:e=>e},matchesTypes:["Files"]},[Nn]:{exposeProperties:{html:(e,t)=>Pn(e,t,""),dataTransfer:e=>e},matchesTypes:["Html","text/html"]},[En]:{exposeProperties:{urls:(e,t)=>Pn(e,t,"").split("\n"),dataTransfer:e=>e},matchesTypes:["Url","text/uri-list"]},[jn]:{exposeProperties:{text:(e,t)=>Pn(e,t,""),dataTransfer:e=>e},matchesTypes:["Text","text/plain"]}};function An(e){if(!e)return null;const t=Array.prototype.slice.call(e.types||[]);return Object.keys(Rn).filter((e=>{const r=Rn[e];return!!(null==r?void 0:r.matchesTypes)&&r.matchesTypes.some((e=>t.indexOf(e)>-1))}))[0]||null}const Mn=kn((()=>/firefox/i.test(navigator.userAgent))),Zn=kn((()=>Boolean(window.safari)));class Ln{interpolate(e){const{xs:t,ys:r,c1s:n,c2s:s,c3s:i}=this;let a=t.length-1;if(e===t[a])return r[a];let o,c=0,d=i.length-1;for(;c<=d;){o=Math.floor(.5*(c+d));const n=t[o];if(n<e)c=o+1;else{if(!(n>e))return r[o];d=o-1}}a=Math.max(0,d);const u=e-t[a],l=u*u;return r[a]+n[a]*u+s[a]*l+i[a]*u*l}constructor(e,t){const{length:r}=e,n=[];for(let e=0;e<r;e++)n.push(e);n.sort(((t,r)=>e[t]<e[r]?-1:1));const s=[],i=[],a=[];let o,c;for(let n=0;n<r-1;n++)o=e[n+1]-e[n],c=t[n+1]-t[n],i.push(o),s.push(c),a.push(c/o);const d=[a[0]];for(let e=0;e<i.length-1;e++){const t=a[e],r=a[e+1];if(t*r<=0)d.push(0);else{o=i[e];const n=i[e+1],s=o+n;d.push(3*s/((s+n)/t+(s+o)/r))}}d.push(a[a.length-1]);const u=[],l=[];let h;for(let e=0;e<d.length-1;e++){h=a[e];const t=d[e],r=1/i[e],n=t+d[e+1]-h-h;u.push((h-t-n)*r),l.push(n*r*r)}this.xs=e,this.ys=t,this.c1s=d,this.c2s=u,this.c3s=l}}function Un(e){const t=1===e.nodeType?e:e.parentElement;if(!t)return null;const{top:r,left:n}=t.getBoundingClientRect();return{x:n,y:r}}function $n(e){return{x:e.clientX,y:e.clientY}}class Bn{get window(){return this.globalContext?this.globalContext:"undefined"!=typeof window?window:void 0}get document(){var e;return(null===(e=this.globalContext)||void 0===e?void 0:e.document)?this.globalContext.document:this.window?this.window.document:void 0}get rootElement(){var e;return(null===(e=this.optionsArgs)||void 0===e?void 0:e.rootElement)||this.window}constructor(e,t){this.ownerDocument=null,this.globalContext=e,this.optionsArgs=t}}function Fn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function zn(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){Fn(e,t,r[t])}))}return e}class Hn{profile(){var e,t;return{sourcePreviewNodes:this.sourcePreviewNodes.size,sourcePreviewNodeOptions:this.sourcePreviewNodeOptions.size,sourceNodeOptions:this.sourceNodeOptions.size,sourceNodes:this.sourceNodes.size,dragStartSourceIds:(null===(e=this.dragStartSourceIds)||void 0===e?void 0:e.length)||0,dropTargetIds:this.dropTargetIds.length,dragEnterTargetIds:this.dragEnterTargetIds.length,dragOverTargetIds:(null===(t=this.dragOverTargetIds)||void 0===t?void 0:t.length)||0}}get window(){return this.options.window}get document(){return this.options.document}get rootElement(){return this.options.rootElement}setup(){const e=this.rootElement;if(void 0!==e){if(e.__isReactDndBackendSetUp)throw new Error("Cannot have two HTML5 backends at the same time.");e.__isReactDndBackendSetUp=!0,this.addEventListeners(e)}}teardown(){const e=this.rootElement;var t;void 0!==e&&(e.__isReactDndBackendSetUp=!1,this.removeEventListeners(this.rootElement),this.clearCurrentDragSourceNode(),this.asyncEndDragFrameId&&(null===(t=this.window)||void 0===t||t.cancelAnimationFrame(this.asyncEndDragFrameId)))}connectDragPreview(e,t,r){return this.sourcePreviewNodeOptions.set(e,r),this.sourcePreviewNodes.set(e,t),()=>{this.sourcePreviewNodes.delete(e),this.sourcePreviewNodeOptions.delete(e)}}connectDragSource(e,t,r){this.sourceNodes.set(e,t),this.sourceNodeOptions.set(e,r);const n=t=>this.handleDragStart(t,e),s=e=>this.handleSelectStart(e);return t.setAttribute("draggable","true"),t.addEventListener("dragstart",n),t.addEventListener("selectstart",s),()=>{this.sourceNodes.delete(e),this.sourceNodeOptions.delete(e),t.removeEventListener("dragstart",n),t.removeEventListener("selectstart",s),t.setAttribute("draggable","false")}}connectDropTarget(e,t){const r=t=>this.handleDragEnter(t,e),n=t=>this.handleDragOver(t,e),s=t=>this.handleDrop(t,e);return t.addEventListener("dragenter",r),t.addEventListener("dragover",n),t.addEventListener("drop",s),()=>{t.removeEventListener("dragenter",r),t.removeEventListener("dragover",n),t.removeEventListener("drop",s)}}addEventListeners(e){e.addEventListener&&(e.addEventListener("dragstart",this.handleTopDragStart),e.addEventListener("dragstart",this.handleTopDragStartCapture,!0),e.addEventListener("dragend",this.handleTopDragEndCapture,!0),e.addEventListener("dragenter",this.handleTopDragEnter),e.addEventListener("dragenter",this.handleTopDragEnterCapture,!0),e.addEventListener("dragleave",this.handleTopDragLeaveCapture,!0),e.addEventListener("dragover",this.handleTopDragOver),e.addEventListener("dragover",this.handleTopDragOverCapture,!0),e.addEventListener("drop",this.handleTopDrop),e.addEventListener("drop",this.handleTopDropCapture,!0))}removeEventListeners(e){e.removeEventListener&&(e.removeEventListener("dragstart",this.handleTopDragStart),e.removeEventListener("dragstart",this.handleTopDragStartCapture,!0),e.removeEventListener("dragend",this.handleTopDragEndCapture,!0),e.removeEventListener("dragenter",this.handleTopDragEnter),e.removeEventListener("dragenter",this.handleTopDragEnterCapture,!0),e.removeEventListener("dragleave",this.handleTopDragLeaveCapture,!0),e.removeEventListener("dragover",this.handleTopDragOver),e.removeEventListener("dragover",this.handleTopDragOverCapture,!0),e.removeEventListener("drop",this.handleTopDrop),e.removeEventListener("drop",this.handleTopDropCapture,!0))}getCurrentSourceNodeOptions(){const e=this.monitor.getSourceId(),t=this.sourceNodeOptions.get(e);return zn({dropEffect:this.altKeyPressed?"copy":"move"},t||{})}getCurrentDropEffect(){return this.isDraggingNativeItem()?"copy":this.getCurrentSourceNodeOptions().dropEffect}getCurrentSourcePreviewNodeOptions(){const e=this.monitor.getSourceId();return zn({anchorX:.5,anchorY:.5,captureDraggingState:!1},this.sourcePreviewNodeOptions.get(e)||{})}isDraggingNativeItem(){const e=this.monitor.getItemType();return Object.keys(n).some((t=>n[t]===e))}beginDragNativeItem(e,t){this.clearCurrentDragSourceNode(),this.currentNativeSource=function(e,t){const r=Rn[e];if(!r)throw new Error(`native type ${e} has no configuration`);const n=new Cn(r);return n.loadDataTransfer(t),n}(e,t),this.currentNativeHandle=this.registry.addSource(e,this.currentNativeSource),this.actions.beginDrag([this.currentNativeHandle])}setCurrentDragSourceNode(e){this.clearCurrentDragSourceNode(),this.currentDragSourceNode=e,this.mouseMoveTimeoutTimer=setTimeout((()=>{var e;return null===(e=this.rootElement)||void 0===e?void 0:e.addEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)}),1e3)}clearCurrentDragSourceNode(){var e;return!!this.currentDragSourceNode&&(this.currentDragSourceNode=null,this.rootElement&&(null===(e=this.window)||void 0===e||e.clearTimeout(this.mouseMoveTimeoutTimer||void 0),this.rootElement.removeEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)),this.mouseMoveTimeoutTimer=null,!0)}handleDragStart(e,t){e.defaultPrevented||(this.dragStartSourceIds||(this.dragStartSourceIds=[]),this.dragStartSourceIds.unshift(t))}handleDragEnter(e,t){this.dragEnterTargetIds.unshift(t)}handleDragOver(e,t){null===this.dragOverTargetIds&&(this.dragOverTargetIds=[]),this.dragOverTargetIds.unshift(t)}handleDrop(e,t){this.dropTargetIds.unshift(t)}constructor(e,t,r){this.sourcePreviewNodes=new Map,this.sourcePreviewNodeOptions=new Map,this.sourceNodes=new Map,this.sourceNodeOptions=new Map,this.dragStartSourceIds=null,this.dropTargetIds=[],this.dragEnterTargetIds=[],this.currentNativeSource=null,this.currentNativeHandle=null,this.currentDragSourceNode=null,this.altKeyPressed=!1,this.mouseMoveTimeoutTimer=null,this.asyncEndDragFrameId=null,this.dragOverTargetIds=null,this.lastClientOffset=null,this.hoverRafId=null,this.getSourceClientOffset=e=>{const t=this.sourceNodes.get(e);return t&&Un(t)||null},this.endDragNativeItem=()=>{this.isDraggingNativeItem()&&(this.actions.endDrag(),this.currentNativeHandle&&this.registry.removeSource(this.currentNativeHandle),this.currentNativeHandle=null,this.currentNativeSource=null)},this.isNodeInDocument=e=>Boolean(e&&this.document&&this.document.body&&this.document.body.contains(e)),this.endDragIfSourceWasRemovedFromDOM=()=>{const e=this.currentDragSourceNode;null==e||this.isNodeInDocument(e)||(this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover())},this.scheduleHover=e=>{null===this.hoverRafId&&"undefined"!=typeof requestAnimationFrame&&(this.hoverRafId=requestAnimationFrame((()=>{this.monitor.isDragging()&&this.actions.hover(e||[],{clientOffset:this.lastClientOffset}),this.hoverRafId=null})))},this.cancelHover=()=>{null!==this.hoverRafId&&"undefined"!=typeof cancelAnimationFrame&&(cancelAnimationFrame(this.hoverRafId),this.hoverRafId=null)},this.handleTopDragStartCapture=()=>{this.clearCurrentDragSourceNode(),this.dragStartSourceIds=[]},this.handleTopDragStart=e=>{if(e.defaultPrevented)return;const{dragStartSourceIds:t}=this;this.dragStartSourceIds=null;const r=$n(e);this.monitor.isDragging()&&(this.actions.endDrag(),this.cancelHover()),this.actions.beginDrag(t||[],{publishSource:!1,getSourceClientOffset:this.getSourceClientOffset,clientOffset:r});const{dataTransfer:n}=e,s=An(n);if(this.monitor.isDragging()){if(n&&"function"==typeof n.setDragImage){const e=this.monitor.getSourceId(),t=this.sourceNodes.get(e),s=this.sourcePreviewNodes.get(e)||t;if(s){const{anchorX:e,anchorY:i,offsetX:a,offsetY:o}=this.getCurrentSourcePreviewNodeOptions(),c=function(e,t,r,n,s){const i="IMG"===(a=t).nodeName&&(Mn()||!(null===(o=document.documentElement)||void 0===o?void 0:o.contains(a)));var a,o;const c=Un(i?e:t),d={x:r.x-c.x,y:r.y-c.y},{offsetWidth:u,offsetHeight:l}=e,{anchorX:h,anchorY:f}=n,{dragPreviewWidth:p,dragPreviewHeight:g}=function(e,t,r,n){let s=e?t.width:r,i=e?t.height:n;return Zn()&&e&&(i/=window.devicePixelRatio,s/=window.devicePixelRatio),{dragPreviewWidth:s,dragPreviewHeight:i}}(i,t,u,l),{offsetX:m,offsetY:v}=s,y=0===v||v;return{x:0===m||m?m:new Ln([0,.5,1],[d.x,d.x/u*p,d.x+p-u]).interpolate(h),y:y?v:(()=>{let e=new Ln([0,.5,1],[d.y,d.y/l*g,d.y+g-l]).interpolate(f);return Zn()&&i&&(e+=(window.devicePixelRatio-1)*g),e})()}}(t,s,r,{anchorX:e,anchorY:i},{offsetX:a,offsetY:o});n.setDragImage(s,c.x,c.y)}}try{null==n||n.setData("application/json",{})}catch(e){}this.setCurrentDragSourceNode(e.target);const{captureDraggingState:t}=this.getCurrentSourcePreviewNodeOptions();t?this.actions.publishDragSource():setTimeout((()=>this.actions.publishDragSource()),0)}else if(s)this.beginDragNativeItem(s);else{if(n&&!n.types&&(e.target&&!e.target.hasAttribute||!e.target.hasAttribute("draggable")))return;e.preventDefault()}},this.handleTopDragEndCapture=()=>{this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleTopDragEnterCapture=e=>{var t;if(this.dragEnterTargetIds=[],this.isDraggingNativeItem()&&(null===(t=this.currentNativeSource)||void 0===t||t.loadDataTransfer(e.dataTransfer)),!this.enterLeaveCounter.enter(e.target)||this.monitor.isDragging())return;const{dataTransfer:r}=e,n=An(r);n&&this.beginDragNativeItem(n,r)},this.handleTopDragEnter=e=>{const{dragEnterTargetIds:t}=this;this.dragEnterTargetIds=[],this.monitor.isDragging()&&(this.altKeyPressed=e.altKey,t.length>0&&this.actions.hover(t,{clientOffset:$n(e)}),t.some((e=>this.monitor.canDropOnTarget(e)))&&(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=this.getCurrentDropEffect())))},this.handleTopDragOverCapture=e=>{var t;this.dragOverTargetIds=[],this.isDraggingNativeItem()&&(null===(t=this.currentNativeSource)||void 0===t||t.loadDataTransfer(e.dataTransfer))},this.handleTopDragOver=e=>{const{dragOverTargetIds:t}=this;if(this.dragOverTargetIds=[],!this.monitor.isDragging())return e.preventDefault(),void(e.dataTransfer&&(e.dataTransfer.dropEffect="none"));this.altKeyPressed=e.altKey,this.lastClientOffset=$n(e),this.scheduleHover(t),(t||[]).some((e=>this.monitor.canDropOnTarget(e)))?(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=this.getCurrentDropEffect())):this.isDraggingNativeItem()?e.preventDefault():(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="none"))},this.handleTopDragLeaveCapture=e=>{this.isDraggingNativeItem()&&e.preventDefault(),this.enterLeaveCounter.leave(e.target)&&(this.isDraggingNativeItem()&&setTimeout((()=>this.endDragNativeItem()),0),this.cancelHover())},this.handleTopDropCapture=e=>{var t;this.dropTargetIds=[],this.isDraggingNativeItem()?(e.preventDefault(),null===(t=this.currentNativeSource)||void 0===t||t.loadDataTransfer(e.dataTransfer)):An(e.dataTransfer)&&e.preventDefault(),this.enterLeaveCounter.reset()},this.handleTopDrop=e=>{const{dropTargetIds:t}=this;this.dropTargetIds=[],this.actions.hover(t,{clientOffset:$n(e)}),this.actions.drop({dropEffect:this.getCurrentDropEffect()}),this.isDraggingNativeItem()?this.endDragNativeItem():this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleSelectStart=e=>{const t=e.target;"function"==typeof t.dragDrop&&("INPUT"===t.tagName||"SELECT"===t.tagName||"TEXTAREA"===t.tagName||t.isContentEditable||(e.preventDefault(),t.dragDrop()))},this.options=new Bn(t,r),this.actions=e.getActions(),this.monitor=e.getMonitor(),this.registry=e.getRegistry(),this.enterLeaveCounter=new In(this.isNodeInDocument)}}const Vn=function(e,t,r){return new Hn(e,t,r)};class qn extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const t=super.get(e);return super.has(e)&&void 0!==t&&(this.delete(e),super.set(e,t)),t}set(e,t){if(super.set(e,t),this.maxSize&&this.size>this.maxSize){const e=this.keys().next().value;e&&this.delete(e)}return this}}const Wn="2.21.55";let Kn=({docsBaseUrl:e,docsPath:t="",docsSlug:r})=>t?`${e??"https://viem.sh"}${t}${r?`#${r}`:""}`:void 0,Xn=`viem@${Wn}`;class Gn extends Error{constructor(e,t={}){const r=t.cause instanceof Gn?t.cause.details:t.cause?.message?t.cause.message:t.details,n=t.cause instanceof Gn&&t.cause.docsPath||t.docsPath,s=Kn?.({...t,docsPath:n});super([e||"An error occurred.","",...t.metaMessages?[...t.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...r?[`Details: ${r}`]:[],...Xn?[`Version: ${Xn}`]:[]].join("\n"),t.cause?{cause:t.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=r,this.docsPath=n,this.metaMessages=t.metaMessages,this.name=t.name??this.name,this.shortMessage=e,this.version=Wn}walk(e){return Yn(this,e)}}function Yn(e,t){return t?.(e)?e:e&&"object"==typeof e&&"cause"in e&&void 0!==e.cause?Yn(e.cause,t):t?null:e}function Jn(e,{strict:t=!0}={}){return!!e&&"string"==typeof e&&(t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x"))}class Qn extends Gn{constructor({size:e,targetSize:t,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${e}) exceeds padding size (${t}).`,{name:"SizeExceedsPaddingSizeError"})}}function es(e,{dir:t,size:r=32}={}){return"string"==typeof e?function(e,{dir:t,size:r=32}={}){if(null===r)return e;const n=e.replace("0x","");if(n.length>2*r)throw new Qn({size:Math.ceil(n.length/2),targetSize:r,type:"hex"});return`0x${n["right"===t?"padEnd":"padStart"](2*r,"0")}`}(e,{dir:t,size:r}):function(e,{dir:t,size:r=32}={}){if(null===r)return e;if(e.length>r)throw new Qn({size:e.length,targetSize:r,type:"bytes"});const n=new Uint8Array(r);for(let s=0;s<r;s++){const i="right"===t;n[i?s:r-s-1]=e[i?s:e.length-s-1]}return n}(e,{dir:t,size:r})}class ts extends Gn{constructor({max:e,min:t,signed:r,size:n,value:s}){super(`Number "${s}" is not in safe ${n?`${8*n}-bit ${r?"signed":"unsigned"} `:""}integer range ${e?`(${t} to ${e})`:`(above ${t})`}`,{name:"IntegerOutOfRangeError"})}}class rs extends Gn{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed ${t} bytes. Given size: ${e} bytes.`,{name:"SizeOverflowError"})}}function ns(e){return Jn(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}function ss(e,{size:t}){if(ns(e)>t)throw new rs({givenSize:ns(e),maxSize:t})}function is(e,t={}){const{signed:r,size:n}=t,s=BigInt(e);let i;n?i=r?(1n<<8n*BigInt(n)-1n)-1n:2n**(8n*BigInt(n))-1n:"number"==typeof e&&(i=BigInt(Number.MAX_SAFE_INTEGER));const a="bigint"==typeof i&&r?-i-1n:0;if(i&&s>i||s<a){const t="bigint"==typeof e?"n":"";throw new ts({max:i?`${i}${t}`:void 0,min:`${a}${t}`,signed:r,size:n,value:`${e}${t}`})}const o=`0x${(r&&s<0?(1n<<BigInt(8*n))+BigInt(s):s).toString(16)}`;return n?es(o,{size:n}):o}const as=new TextEncoder;const os={zero:48,nine:57,A:65,F:70,a:97,f:102};function cs(e){return e>=os.zero&&e<=os.nine?e-os.zero:e>=os.A&&e<=os.F?e-(os.A-10):e>=os.a&&e<=os.f?e-(os.a-10):void 0}function ds(e,t={}){let r=e;t.size&&(ss(r,{size:t.size}),r=es(r,{dir:"right",size:t.size}));let n=r.slice(2);n.length%2&&(n=`0${n}`);const s=n.length/2,i=new Uint8Array(s);for(let e=0,t=0;e<s;e++){const r=cs(n.charCodeAt(t++)),s=cs(n.charCodeAt(t++));if(void 0===r||void 0===s)throw new Gn(`Invalid byte sequence ("${n[t-2]}${n[t-1]}" in "${n}").`);i[e]=16*r+s}return i}function us(e,t={}){const r=as.encode(e);return"number"==typeof t.size?(ss(r,{size:t.size}),es(r,{dir:"right",size:t.size})):r}function ls(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function hs(e,...t){if(!((r=e)instanceof Uint8Array||ArrayBuffer.isView(r)&&"Uint8Array"===r.constructor.name))throw new Error("Uint8Array expected");var r;if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function fs(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}const ps=BigInt(2**32-1),gs=BigInt(32);function ms(e,t=!1){return t?{h:Number(e&ps),l:Number(e>>gs&ps)}:{h:0|Number(e>>gs&ps),l:0|Number(e&ps)}}function vs(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let s=0;s<e.length;s++){const{h:i,l:a}=ms(e[s],t);[r[s],n[s]]=[i,a]}return[r,n]}const ys=(()=>68===new Uint8Array(new Uint32Array([287454020]).buffer)[0])();function _s(e){for(let r=0;r<e.length;r++)e[r]=(t=e[r])<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255;var t}function bs(e){return"string"==typeof e&&(e=function(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}(e)),hs(e),e}class xs{clone(){return this._cloneInto()}}const ws=[],Ts=[],Os=[],Ss=BigInt(0),ks=BigInt(1),Is=BigInt(2),Cs=BigInt(7),Ds=BigInt(256),Es=BigInt(113);for(let e=0,t=ks,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],ws.push(2*(5*n+r)),Ts.push((e+1)*(e+2)/2%64);let s=Ss;for(let e=0;e<7;e++)t=(t<<ks^(t>>Cs)*Es)%Ds,t&Is&&(s^=ks<<(ks<<BigInt(e))-ks);Os.push(s)}const[js,Ns]=vs(Os,!0),Ps=(e,t,r)=>r>32?((e,t,r)=>t<<r-32|e>>>64-r)(e,t,r):((e,t,r)=>e<<r|t>>>32-r)(e,t,r),Rs=(e,t,r)=>r>32?((e,t,r)=>e<<r-32|t>>>64-r)(e,t,r):((e,t,r)=>t<<r|e>>>32-r)(e,t,r);class As extends xs{constructor(e,t,r,n=!1,s=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=n,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,ls(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");var i;this.state=new Uint8Array(200),this.state32=(i=this.state,new Uint32Array(i.buffer,i.byteOffset,Math.floor(i.byteLength/4)))}keccak(){ys||_s(this.state32),function(e,t=24){const r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let t=0;t<10;t++)r[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){const n=(t+8)%10,s=(t+2)%10,i=r[s],a=r[s+1],o=Ps(i,a,1)^r[n],c=Rs(i,a,1)^r[n+1];for(let r=0;r<50;r+=10)e[t+r]^=o,e[t+r+1]^=c}let t=e[2],s=e[3];for(let r=0;r<24;r++){const n=Ts[r],i=Ps(t,s,n),a=Rs(t,s,n),o=ws[r];t=e[o],s=e[o+1],e[o]=i,e[o+1]=a}for(let t=0;t<50;t+=10){for(let n=0;n<10;n++)r[n]=e[t+n];for(let n=0;n<10;n++)e[t+n]^=~r[(n+2)%10]&r[(n+4)%10]}e[0]^=js[n],e[1]^=Ns[n]}r.fill(0)}(this.state32,this.rounds),ys||_s(this.state32),this.posOut=0,this.pos=0}update(e){fs(this);const{blockLen:t,state:r}=this,n=(e=bs(e)).length;for(let s=0;s<n;){const i=Math.min(t-this.pos,n-s);for(let t=0;t<i;t++)r[this.pos++]^=e[s++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:t,pos:r,blockLen:n}=this;e[r]^=t,128&t&&r===n-1&&this.keccak(),e[n-1]^=128,this.keccak()}writeInto(e){fs(this,!1),hs(e),this.finish();const t=this.state,{blockLen:r}=this;for(let n=0,s=e.length;n<s;){this.posOut>=r&&this.keccak();const i=Math.min(r-this.posOut,s-n);e.set(t.subarray(this.posOut,this.posOut+i),n),this.posOut+=i,n+=i}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return ls(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(function(e,t){hs(e);const r=t.outputLen;if(e.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:t,suffix:r,outputLen:n,rounds:s,enableXOF:i}=this;return e||(e=new As(t,r,n,i,s)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=s,e.suffix=r,e.outputLen=n,e.enableXOF=i,e.destroyed=this.destroyed,e}}const Ms=((e,t,r)=>function(e){const t=t=>e().update(bs(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}((()=>new As(t,e,r))))(1,136,32),Zs=new qn(8192);function Ls(e,t){if(Zs.has(`${e}.${t}`))return Zs.get(`${e}.${t}`);const r=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),n=function(e){const t=Ms(Jn(e,{strict:!1})?function(e,t={}){return"number"==typeof e||"bigint"==typeof e?function(e,t){return ds(is(e,t))}(e,t):"boolean"==typeof e?function(e,t={}){const r=new Uint8Array(1);return r[0]=Number(e),"number"==typeof t.size?(ss(r,{size:t.size}),es(r,{size:t.size})):r}(e,t):Jn(e)?ds(e,t):us(e,t)}(e):e);return t}(us(r)),s=(t?r.substring(`${t}0x`.length):r).split("");for(let e=0;e<40;e+=2)n[e>>1]>>4>=8&&s[e]&&(s[e]=s[e].toUpperCase()),(15&n[e>>1])>=8&&s[e+1]&&(s[e+1]=s[e+1].toUpperCase());const i=`0x${s.join("")}`;return Zs.set(`${e}.${t}`,i),i}const Us=/^0x[a-fA-F0-9]{40}$/,$s=new qn(8192),Bs=[{id:"optimism",name:"Optimism"},{id:"base",name:"Base"},{id:"mainnet",name:"Ethereum Mainnet"},{id:"zora",name:"Zora"}],Fs=({dragType:e,index:t,item:r,moveItem:n,renderContent:s})=>{const[{isDragging:i},a]=cr({type:e,item:{index:t},collect:e=>({isDragging:e.isDragging()})}),[,o]=pr({accept:e,hover:e=>{e.index!==t&&(n(e.index,t),e.index=t)}});return(0,$t.jsxs)("div",{ref:e=>a(o(e)),style:{alignItems:"center",cursor:"move",display:"flex",gap:"8px",marginBottom:"8px",opacity:i?.5:1},children:[(0,$t.jsx)("span",{className:"dashicons dashicons-menu"}),(0,$t.jsx)("div",{style:{alignItems:"center",display:"flex",flex:1,justifyContent:"space-between"},children:s(r,t)})]})},zs=({chain:e,index:t,moveItem:r,removeChain:n})=>(0,$t.jsx)(Fs,{dragType:"chain",index:t,item:e,moveItem:r,renderContent:(e,t)=>(0,$t.jsxs)($t.Fragment,{children:[(0,$t.jsx)("span",{children:e.name}),(0,$t.jsx)(c.Button,{variant:"secondary",isDestructive:!0,onClick:()=>n(t),icon:"trash"})]})}),Hs=({value:e=[],onChange:t})=>{const r=e.map((e=>Bs.find((t=>t.id===e)))).filter(Boolean),n=r=>{const n=[...e];n.splice(r,1),t(n)},s=(r,n)=>{const s=[...e],[i]=s.splice(r,1);s.splice(n,0,i),t(s)},i=Bs.filter((t=>!e.includes(t.id)));return(0,$t.jsx)(On,{backend:Vn,children:(0,$t.jsxs)("div",{style:{width:"100%"},children:[(0,$t.jsx)("div",{className:"components-base-control",children:(0,$t.jsxs)("div",{className:"components-base-control__field",children:[(0,$t.jsx)("label",{htmlFor:"chains-control",className:"components-base-control__label",children:(0,o.__)("Supported Chains","frames-integration-for-farcaster")}),(0,$t.jsx)("div",{id:"chains-control",children:r.length>0?r.map(((e,t)=>(0,$t.jsx)(zs,{chain:e,index:t,moveItem:s,removeChain:n},e.id))):(0,$t.jsx)("div",{style:{background:"#f0f0f0",borderRadius:"4px",color:"#757575",margin:"8px 0",padding:"12px",textAlign:"center"},children:(0,o.__)("No chains selected. Add a chain below to get started.","frames-integration-for-farcaster")})})]})}),i.length>0&&(0,$t.jsx)("div",{className:"components-base-control",children:(0,$t.jsx)(c.SelectControl,{label:(0,o.__)("Add Chain","frames-integration-for-farcaster"),value:"",options:[{value:"",label:(0,o.__)("Select a chain to add…","frames-integration-for-farcaster")},...i.map((e=>({value:e.id,label:e.name})))],onChange:r=>{r&&(r=>{e.includes(r)||t([...e,r])})(r)}})})]})})},Vs=({value:e,onChange:t})=>(0,$t.jsx)(c.ColorPicker,{color:e,onChange:t}),qs=({value:e,onChange:t})=>(0,$t.jsx)(c.TextareaControl,{label:(0,o.__)("Domain Manifest","frames-integration-for-farcaster"),value:e,onChange:t}),Ws=({value:e=[],onChange:t})=>{const r=r=>{const n=[...e];n.splice(r,1),t(n)},n=(r,n)=>{const s=[...e];s[r]=Math.max(0,parseInt(n)||0),t(s)},s=(r,n)=>{const s=[...e],[i]=s.splice(r,1);s.splice(n,0,i),t(s)};return(0,$t.jsx)(On,{backend:Vn,children:(0,$t.jsxs)("div",{style:{width:"100%"},children:[(0,$t.jsx)("div",{className:"components-base-control",children:(0,$t.jsxs)("div",{className:"components-base-control__field",children:[(0,$t.jsxs)("label",{htmlFor:"tipping-amounts-control",className:"components-base-control__label",children:[(0,o.__)("Tipping Amounts (in","frames-integration-for-farcaster")," ",(0,$t.jsx)("a",{href:"https://zora.co/writings/sparks",target:"_blank",rel:"noopener noreferrer",children:(0,o.__)("Sparks","frames-integration-for-farcaster")}),(0,o.__)(")","frames-integration-for-farcaster")]}),(0,$t.jsx)("div",{id:"tipping-amounts-control",children:e.length>0?e.map(((e,t)=>(0,$t.jsx)(ri,{amount:e,index:t,moveItem:s,updateAmount:n,removeAmount:r},t))):(0,$t.jsx)("div",{style:{padding:"12px",background:"#f0f0f0",borderRadius:"4px",textAlign:"center",color:"#757575",margin:"8px 0"},children:(0,o.__)("No tipping amounts configured. Add an amount below to get started.","frames-integration-for-farcaster")})})]})}),(0,$t.jsx)(c.Button,{variant:"secondary",onClick:()=>{t([...e,0])},icon:"plus",children:(0,o.__)("Add Amount","frames-integration-for-farcaster")})]})})},Ks=({value:e,onChange:t,useTitleAsButtonText:r})=>(0,$t.jsx)(c.TextControl,{label:(0,o.__)("Button Text","frames-integration-for-farcaster"),value:e,help:r?(0,o.__)("This text will be used as the button text when frame is used outside of casts. Limited to 32 characters.","frames-integration-for-farcaster"):(0,o.__)("This text will be used as the button text for all posts. Limited to 32 characters.","frames-integration-for-farcaster"),onChange:t,__nextHasNoMarginBottom:!0,maxLength:32}),Xs=({value:e,onChange:t})=>{const r=e&&""!==e&&!function(e){const{strict:t=!0}={},r=`${e}.${t}`;if($s.has(r))return $s.get(r);const n=!(!Us.test(e)||e.toLowerCase()!==e&&t&&Ls(e)!==e);return $s.set(r,n),n}(e);return(0,$t.jsx)("div",{style:{width:"100%"},children:(0,$t.jsx)(c.TextControl,{label:(0,o.__)("Tipping Address","frames-integration-for-farcaster"),value:e,onChange:t,help:r?(0,o.__)("Please enter a valid Ethereum address","frames-integration-for-farcaster"):(0,o.__)("Enter the Ethereum address that will receive tips","frames-integration-for-farcaster"),className:r?"has-error":""})})},Gs=({value:e,onChange:t})=>(0,$t.jsx)(c.ToggleControl,{checked:e,label:(0,o.__)("Use Post Title as Button Text","frames-integration-for-farcaster"),onChange:t,__nextHasNoMarginBottom:!0}),Ys=({value:e,onChange:t})=>(0,$t.jsx)(c.ToggleControl,{checked:e,label:(0,o.__)("Enable Notifications","frames-integration-for-farcaster"),onChange:t,__nextHasNoMarginBottom:!0}),Js=({value:e,onChange:t})=>(0,$t.jsx)(c.ToggleControl,{checked:e,label:(0,o.__)("Enable SDK Logging","frames-integration-for-farcaster"),onChange:t,__nextHasNoMarginBottom:!0}),Qs=({value:e,onChange:t})=>(0,$t.jsx)(c.ToggleControl,{checked:e,label:(0,o.__)("Enable Farcaster Frames","frames-integration-for-farcaster"),onChange:t,__nextHasNoMarginBottom:!0}),ei=({value:e,onChange:t})=>(0,$t.jsx)(c.ToggleControl,{checked:e,label:(0,o.__)("Enable Tipping","frames-integration-for-farcaster"),onChange:t,__nextHasNoMarginBottom:!0}),ti=({value:e,onChange:t,buttonText:r="Select Image",labelText:n=""})=>(0,$t.jsx)(Ft.MediaUpload,{onSelect:e=>t({id:e.id,url:e.url}),help:(0,o.__)("This image will be used as the splash image for all posts.","frames-integration-for-farcaster"),allowedTypes:["image"],value:e,render:({open:s})=>(0,$t.jsx)("div",{children:e&&e.url?(0,$t.jsxs)("div",{style:{marginBottom:"10px"},children:[(0,$t.jsx)("img",{src:e.url,alt:"Selected",style:{maxWidth:"200px",height:"auto",display:"block",marginBottom:"8px"}}),(0,$t.jsxs)("div",{children:[(0,$t.jsx)(c.Button,{onClick:s,variant:"secondary",style:{marginRight:"8px"},children:"Replace Image"}),(0,$t.jsx)(c.Button,{onClick:()=>t({id:null,url:""}),variant:"link",isDestructive:!0,children:"Remove Image"})]})]}):(0,$t.jsx)(c.Button,{label:n,showTooltip:!0,onClick:s,variant:"secondary",children:r})})}),ri=({amount:e,index:t,moveItem:r,removeAmount:n,updateAmount:s})=>(0,$t.jsx)(Fs,{dragType:"amount",index:t,item:e,moveItem:r,renderContent:(e,t)=>(0,$t.jsxs)($t.Fragment,{children:[(0,$t.jsx)(c.TextControl,{type:"number",value:e,onChange:e=>s(t,e),min:0}),(0,$t.jsx)(c.Button,{icon:"trash",isDestructive:!0,onClick:()=>n(t),variant:"secondary"})]})}),ni=({value:e,onChange:t})=>(0,$t.jsx)("div",{style:{width:"100%"},children:(0,$t.jsx)(c.TextControl,{label:(0,o.__)("RPC URL for Optimism","frames-integration-for-farcaster"),value:e,onChange:t,help:e&&""!==e?(0,o.__)("Enter the URL of your Ethereum RPC for the Optimism chain.","frames-integration-for-farcaster"):(0,o.__)("Enter the URL of your Ethereum RPC for the Optimism chain. Required for complete key verification.","frames-integration-for-farcaster"),className:e&&""!==e?"":"has-error",type:"url",__nextHasNoMarginBottom:!0})}),si=window.wp.primitives,ii=(0,$t.jsx)(si.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,$t.jsx)(si.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M5 4.5h11a.5.5 0 0 1 .5.5v11a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V5a.5.5 0 0 1 .5-.5ZM3 5a2 2 0 0 1 2-2h11a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5Zm17 3v10.75c0 .69-.56 1.25-1.25 1.25H6v1.5h12.75a2.75 2.75 0 0 0 2.75-2.75V8H20Z"})}),ai=(0,$t.jsx)(si.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,$t.jsx)(si.Path,{d:"M18 11.3l-1-1.1-4 4V3h-1.5v11.3L7 10.2l-1 1.1 6.2 5.8 5.8-5.8zm.5 3.7v3.5h-13V15H4v5h16v-5h-1.5z"})}),oi=({content:e,showCopyButton:t=!0,showDownloadButton:r=!1,downloadFilename:n="download.json"})=>{const[s,i]=(0,a.useState)(!1);return(0,$t.jsxs)("div",{style:{position:"relative",maxWidth:"100%"},children:[(0,$t.jsx)("pre",{style:{background:"#f0f0f0",padding:"1rem",borderRadius:"4px",overflow:"auto",whiteSpace:"break-spaces",lineBreak:"anywhere"},children:e}),t&&(0,$t.jsx)(c.Button,{icon:ii,onClick:async()=>{await navigator.clipboard.writeText(e),i(!0),setTimeout((()=>i(!1)),2e3)},style:{position:"absolute",top:"8px",right:"8px",background:"white",border:"1px solid #ccc"},children:s?(0,o.__)("Copied!","frames-integration-for-farcaster"):(0,o.__)("Copy","frames-integration-for-farcaster")}),r&&(0,$t.jsx)(c.Button,{icon:ai,onClick:()=>{const t=new Blob([e],{type:"application/json"}),r=URL.createObjectURL(t),s=document.createElement("a");s.href=r,s.download=n,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(r)},style:{position:"absolute",bottom:"8px",right:"8px",background:"white",border:"1px solid #ccc"},children:(0,o.__)("Download","frames-integration-for-farcaster")})]})},ci=({currentManifest:e,domainManifest:t,setDomainManifest:r})=>{const[n,s]=(0,a.useState)(null),[i,d]=(0,a.useState)(""),[u,l]=(0,a.useState)(""),[h,f]=(0,a.useState)(!0),p=(0,a.useMemo)((()=>{if(!t)return null;let e=null;try{e=JSON.parse(t)}catch{}return e}),[t]),g=(0,a.useMemo)((()=>{if(!n||!e)return null;const t=p&&"object"==typeof p&&0!==Object.keys(p).length,r={name:n?.frame?.name!==e?.frame?.name,homeUrl:n?.frame?.homeUrl!==e?.frame?.homeUrl,iconUrl:n?.frame?.iconUrl!==e?.frame?.iconUrl,splashImageUrl:n?.frame?.splashImageUrl!==e?.frame?.splashImageUrl,splashBackgroundColor:n?.frame?.splashBackgroundColor!==e?.frame?.splashBackgroundColor,buttonTitle:n?.frame?.buttonTitle!==e?.frame?.buttonTitle,imageUrl:n?.frame?.imageUrl!==e?.frame?.imageUrl,...e?.frame?.webhookUrl?{webhookUrl:e?.frame?.webhookUrl!==n?.frame?.webhookUrl}:{},...t?{header:p?.accountAssociation?.header!==n?.accountAssociation?.header,payload:p?.accountAssociation?.payload!==n?.accountAssociation?.payload,signature:p?.accountAssociation?.signature!==n?.accountAssociation?.signature}:{}};return{count:Object.values(r).filter(Boolean).length,details:r}}),[n,e,p]);return(0,a.useEffect)((()=>{(async()=>{try{const e=new AbortController,t=setTimeout((()=>e.abort("Manifest retrieval timed out")),2e3),r=await fetch("/.well-known/farcaster.json",{signal:e.signal});if(clearTimeout(t),!r.ok)throw new Error("Manifest file not found");const n=(e=>{const t=Ut.safeParse(e);return t.success?(d(""),t.data):(d(t.error.message),e)})(await r.json());s(n),l("")}catch(e){l(e instanceof Error?`${(0,o.__)("Error:","frames-integration-for-farcaster")} ${e.message}`:(0,o.__)("Farcaster manifest file not found or request timed out at /.well-known/farcaster.json","frames-integration-for-farcaster"))}finally{f(!1)}})()}),[]),h?(0,$t.jsx)(c.__experimentalText,{children:(0,o.__)("Loading manifest…","frames-integration-for-farcaster")}):(0,$t.jsxs)("div",{className:"manifest-viewer",children:[u&&(0,$t.jsxs)($t.Fragment,{children:[(0,$t.jsx)(c.Notice,{status:"error",isDismissible:!1,children:u}),(0,$t.jsx)("div",{style:{marginTop:"8px"}})]}),(0,$t.jsxs)(c.__experimentalText,{children:[(0,o.__)("The Farcaster manifest file declares metadata for your frame application and defines supported triggers.","frames-integration-for-farcaster")," ",(0,$t.jsx)("a",{href:"https://docs.farcaster.xyz/developers/frames/v2/spec#frame-manifest",target:"_blank",rel:"noopener noreferrer",children:(0,o.__)("Learn more about the manifest specification.","frames-integration-for-farcaster")})," ",(0,o.__)("Frames Integration for Farcaster can help you manage your manifest file. To start, enter the domain manifest obtained from the Warpcast app.","frames-integration-for-farcaster")," ",(0,$t.jsx)("a",{href:"https://docs.farcaster.xyz/developers/frames/v2/notifications_webhooks#create-a-farcaster-domain-manifest",target:"_blank",rel:"noopener noreferrer",children:(0,o.__)("Follow the instructions here to create a domain manifest.","frames-integration-for-farcaster")})]}),(0,$t.jsx)("div",{style:{marginTop:"16px"},children:(0,$t.jsx)(qs,{value:t,onChange:r})}),n&&(0,$t.jsxs)($t.Fragment,{children:[(0,$t.jsx)("div",{style:{marginTop:"16px"},children:(0,$t.jsx)(c.__experimentalText,{children:(0,o.__)("Here is the current manifest on your site:","frames-integration-for-farcaster")})}),(0,$t.jsx)("div",{style:{marginTop:"8px"}}),(0,$t.jsx)(oi,{content:JSON.stringify(n,null,2),showCopyButton:!1}),i&&(0,$t.jsxs)(c.Notice,{status:"error",isDismissible:!1,children:[(0,o.__)("Validation complete, manifest is not valid. Errors:","frames-integration-for-farcaster")," ",(0,$t.jsx)("ul",{style:{margin:0,paddingLeft:"1rem"},children:JSON.parse(i).map(((e,t)=>(0,$t.jsxs)("li",{children:[(0,$t.jsx)("strong",{children:e.path.join(".")}),": ",e.message]},t)))})]}),!i&&(0,$t.jsx)(c.Notice,{status:"info",isDismissible:!1,children:e&&g?(0,o.sprintf)(/* translators: %d: number of mismatches */ /* translators: %d: number of mismatches */
    2 (0,o.__)("Validation complete, manifest is valid. %d mismatches found with current settings.","frames-integration-for-farcaster"),g.count):(0,o.__)("Validation complete, manifest is valid.","frames-integration-for-farcaster")}),e&&g?.count>0&&(0,$t.jsxs)($t.Fragment,{children:[g.details.name&&(0,$t.jsx)(c.Notice,{status:"warning",isDismissible:!1,children:(0,o.__)("The manifest name does not match the current site name.","frames-integration-for-farcaster")}),g.details.homeUrl&&(0,$t.jsx)(c.Notice,{status:"warning",isDismissible:!1,children:(0,o.__)("The manifest home URL does not match the current site home URL.","frames-integration-for-farcaster")}),g.details.iconUrl&&(0,$t.jsx)(c.Notice,{status:"warning",isDismissible:!1,children:(0,o.__)("The manifest icon URL does not match the current site icon URL.","frames-integration-for-farcaster")}),g.details.imageUrl&&(0,$t.jsx)(c.Notice,{status:"warning",isDismissible:!1,children:(0,o.__)("The manifest image URL does not match the current site image URL.","frames-integration-for-farcaster")}),g.details.buttonTitle&&(0,$t.jsx)(c.Notice,{status:"warning",isDismissible:!1,children:(0,o.__)("The manifest button title does not match the current site button title.","frames-integration-for-farcaster")}),g.details.splashImageUrl&&(0,$t.jsx)(c.Notice,{status:"warning",isDismissible:!1,children:(0,o.__)("The manifest splash image URL does not match the current site splash image URL.","frames-integration-for-farcaster")}),g.details.splashBackgroundColor&&(0,$t.jsx)(c.Notice,{status:"warning",isDismissible:!1,children:(0,o.__)("The manifest splash background color does not match the current site splash background color.","frames-integration-for-farcaster")}),g.details.webhookUrl&&(0,$t.jsx)(c.Notice,{status:"warning",isDismissible:!1,children:(0,o.__)("The manifest webhook URL does not match the current site webhook URL.","frames-integration-for-farcaster")}),g.details.header&&(0,$t.jsx)(c.Notice,{status:"warning",isDismissible:!1,children:(0,o.__)("The manifest header does not match the domain manifest header.","frames-integration-for-farcaster")}),g.details.payload&&(0,$t.jsx)(c.Notice,{status:"warning",isDismissible:!1,children:(0,o.__)("The manifest payload does not match the domain manifest payload.","frames-integration-for-farcaster")}),g.details.signature&&(0,$t.jsx)(c.Notice,{status:"warning",isDismissible:!1,children:(0,o.__)("The manifest signature does not match the domain manifest signature.","frames-integration-for-farcaster")})]})]}),(0,$t.jsxs)($t.Fragment,{children:[(0,$t.jsx)("div",{style:{marginTop:"16px"},children:(0,$t.jsx)(c.__experimentalText,{children:(0,o.__)("Are you going to update the manifest to match current settings? Here is the manifest data to reference. This should be available at /.well-known/farcaster.json on your site.","frames-integration-for-farcaster")})}),(0,$t.jsx)(oi,{showDownloadButton:!0,downloadFilename:"farcaster.json",content:JSON.stringify(e,null,2)})]})]})},di=()=>{const{subscriptions:e}=(()=>{const[e,t]=(0,a.useState)(),r=(0,a.useCallback)((()=>{u()({path:"/farcaster-wp/v1/subscriptions"}).then((e=>{t(e)}))}),[]);return(0,a.useEffect)((()=>{r()}),[r]),{subscriptions:e,fetchSubscriptions:r}})();return(0,$t.jsxs)("div",{children:[(0,$t.jsx)("div",{style:{marginTop:"16px"},children:(0,$t.jsxs)(c.__experimentalText,{children:[(0,o.__)("You have","frames-integration-for-farcaster")," ",e?.length," ",(0,o.__)("subscriptions on your site:","frames-integration-for-farcaster")]})}),(0,$t.jsx)("div",{style:{marginTop:"8px"}}),(0,$t.jsx)("pre",{children:JSON.stringify(e,null,2)})]})},ui=()=>(0,$t.jsx)(c.__experimentalHeading,{level:1,children:(0,o.__)("Frames Integration for Farcaster Settings","frames-integration-for-farcaster")}),li=({onClick:e})=>(0,$t.jsx)(c.Button,{variant:"primary",onClick:e,__next40pxDefaultSize:!0,children:(0,o.__)("Save","frames-integration-for-farcaster")}),hi=()=>{const{saveSettings:e,framesEnabled:t,setFramesEnabled:r,splashBackgroundColor:n,setSplashBackgroundColor:s,buttonText:i,setButtonText:d,splashImage:f,setSplashImage:p,fallbackImage:g,setFallbackImage:m,useTitleAsButtonText:v,setUseTitleAsButtonText:y,domainManifest:_,setDomainManifest:b,notificationsEnabled:x,setNotificationsEnabled:w,debugEnabled:T,setDebugEnabled:O,tippingEnabled:S,setTippingEnabled:k,tippingAddress:I,setTippingAddress:C,tippingAmounts:D,setTippingAmounts:E,tippingChains:j,setTippingChains:N,rpcURL:P,setRpcURL:R}=(()=>{const[e,t]=(0,a.useState)(),[r,n]=(0,a.useState)(),[s,i]=(0,a.useState)(),[c,d]=(0,a.useState)(!1),[f,p]=(0,a.useState)(!1),[g,m]=(0,a.useState)(!1),[v,y]=(0,a.useState)(),[_,b]=(0,a.useState)([]),[x,w]=(0,a.useState)([]),[T,O]=(0,a.useState)(),[S,k]=(0,a.useState)(),[I,C]=(0,a.useState)({id:0,url:""}),[D,E]=(0,a.useState)({id:0,url:""}),[j,N]=(0,a.useState)(!1),{createSuccessNotice:P,createErrorNotice:R,removeNotice:A}=(0,h.useDispatch)(l.store);return(0,a.useEffect)((()=>{u()({path:"/wp/v2/settings"}).then((e=>{i(e.farcaster_wp?.frames_enabled),O(e.farcaster_wp?.splash_background_color),k(e.farcaster_wp?.button_text),C(e.farcaster_wp?.splash_image),E(e.farcaster_wp?.fallback_image),N(e.farcaster_wp?.use_title_as_button_text),t(e.farcaster_wp?.domain_manifest),d(e.farcaster_wp?.notifications_enabled),p(e.farcaster_wp?.debug_enabled),m(e.farcaster_wp?.tipping_enabled),y(e.farcaster_wp?.tipping_address),b(e.farcaster_wp?.tipping_amounts),w(e.farcaster_wp?.tipping_chains),n(e.farcaster_wp?.rpc_url)}))}),[]),(0,a.useEffect)((()=>{let e;return async function(){if(void 0===r||""!==r||e)void 0!==r&&""!==r&&e&&(A(e),e=void 0);else{const t=await R((0,o.__)("RPC URL is required for key validation. Currently, signatures will be validated, but keys will not be verified using contract.","frames-integration-for-farcaster"));e=t?.notice?.id}}(),()=>{e&&A(e)}}),[R,A,r]),{saveSettings:t=>{if(e){let t=null;try{t=JSON.parse(e)}catch{}if(!Ut.safeParse(t).success)return void R((0,o.__)("Did not save settings, domain manifest is invalid.","frames-integration-for-farcaster")).then((()=>document.scrollingElement?.scrollTo({top:0,behavior:"smooth"})))}if(r)try{new URL(r)}catch{return void R((0,o.__)("RPC URL is invalid.","frames-integration-for-farcaster")).then((()=>document.scrollingElement?.scrollTo({top:0,behavior:"smooth"})))}u()({path:"/wp/v2/settings",method:"POST",data:{farcaster_wp:{frames_enabled:s,splash_background_color:T,button_text:S,splash_image:I,fallback_image:D,use_title_as_button_text:j,domain_manifest:e,notifications_enabled:c,debug_enabled:f,tipping_enabled:g,tipping_address:v,tipping_amounts:_,tipping_chains:x,rpc_url:r}}}).then((()=>{P((0,o.__)("Settings saved.","frames-integration-for-farcaster")).then((()=>{t&&t(),document.scrollingElement?.scrollTo({top:0,behavior:"smooth"})}))})).catch((e=>{console.error(e),R((0,o.__)("Failed to save settings.","frames-integration-for-farcaster")).then((()=>document.scrollingElement?.scrollTo({top:0,behavior:"smooth"})))}))},framesEnabled:s,setFramesEnabled:i,splashBackgroundColor:T,setSplashBackgroundColor:O,buttonText:S,setButtonText:k,splashImage:I,setSplashImage:C,fallbackImage:D,setFallbackImage:E,useTitleAsButtonText:j,setUseTitleAsButtonText:N,domainManifest:e,setDomainManifest:t,notificationsEnabled:c,setNotificationsEnabled:d,debugEnabled:f,setDebugEnabled:p,tippingEnabled:g,setTippingEnabled:m,tippingAddress:v,setTippingAddress:y,tippingAmounts:_,setTippingAmounts:b,tippingChains:x,setTippingChains:w,rpcURL:r,setRpcURL:n}})(),{manifest:A,fetchManifest:M}=(()=>{const[e,t]=(0,a.useState)(),r=(0,a.useCallback)((()=>{u()({path:"/farcaster-wp/v1/manifest"}).then((e=>{t(e)}))}),[]);return(0,a.useEffect)((()=>{r()}),[r]),{manifest:e,fetchManifest:r}})();return(0,$t.jsxs)($t.Fragment,{children:[(0,$t.jsx)(ui,{}),(0,$t.jsx)(Bt,{}),(0,$t.jsxs)(c.Panel,{header:"Frames",children:[(0,$t.jsx)(c.PanelBody,{children:(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsx)(Qs,{value:t,onChange:e=>r(e)})})}),(0,$t.jsx)(c.PanelBody,{title:(0,o.__)("Frame Button","frames-integration-for-farcaster"),initialOpen:t,children:(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsxs)(c.__experimentalVStack,{spacing:4,children:[(0,$t.jsx)(Gs,{value:v,onChange:y}),(0,$t.jsx)(Ks,{useTitleAsButtonText:v,value:i,onChange:d})]})})}),(0,$t.jsx)(c.PanelBody,{title:(0,o.__)("Splash Background Color","frames-integration-for-farcaster"),initialOpen:t,children:(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsx)(Vs,{value:n,onChange:s})})}),(0,$t.jsx)(c.PanelBody,{title:(0,o.__)("Frame Splash Image","frames-integration-for-farcaster"),initialOpen:t,children:(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsx)(ti,{value:f,onChange:p,labelText:(0,o.__)("Image will be displayed as 200x200px.","frames-integration-for-farcaster")})})}),(0,$t.jsx)(c.PanelBody,{title:(0,o.__)("Fallback Frame Image","frames-integration-for-farcaster"),initialOpen:t,children:(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsx)(ti,{labelText:(0,o.__)("Image will be displayed in 3:2 aspect ratio.","frames-integration-for-farcaster"),value:g,onChange:m})})})]}),(0,$t.jsxs)(c.Panel,{header:"Tipping",children:[(0,$t.jsxs)(c.PanelBody,{children:[(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsx)(ei,{value:S,onChange:k})}),(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsx)(Xs,{value:I,onChange:C})})]}),(0,$t.jsx)(c.PanelBody,{title:(0,o.__)("Tipping Chains","frames-integration-for-farcaster"),initialOpen:S,children:(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsx)(Hs,{value:j,onChange:N})})}),(0,$t.jsx)(c.PanelBody,{title:(0,o.__)("Tipping Amounts","frames-integration-for-farcaster"),initialOpen:S,children:(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsx)(Ws,{value:D,onChange:E})})})]}),(0,$t.jsx)(c.Panel,{header:"Notifications",children:(0,$t.jsxs)(c.PanelBody,{children:[(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsx)(Ys,{value:x,onChange:w})}),(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsx)(ni,{value:P,onChange:R})}),(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsx)(Js,{value:T,onChange:O})}),(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsx)(di,{})})]})}),(0,$t.jsx)(c.Panel,{header:"Manifest",children:(0,$t.jsx)(c.PanelBody,{title:(0,o.__)("Manifest Validation","frames-integration-for-farcaster"),children:(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsx)(ci,{currentManifest:A,domainManifest:_,setDomainManifest:b})})})}),(0,$t.jsx)(li,{onClick:()=>e(M)})]})};i()((()=>{const e=document.getElementById("farcaster-wp-settings");e&&(0,a.createRoot)(e).render((0,$t.jsx)(hi,{}))}))})();
     1(()=>{"use strict";var e={2017:e=>{e.exports=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;var n,s,i;if(Array.isArray(t)){if((n=t.length)!=r.length)return!1;for(s=n;0!=s--;)if(!e(t[s],r[s]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((n=(i=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(s=n;0!=s--;)if(!Object.prototype.hasOwnProperty.call(r,i[s]))return!1;for(s=n;0!=s--;){var a=i[s];if(!e(t[a],r[a]))return!1}return!0}return t!=t&&r!=r}}},t={};function r(n){var s=t[n];if(void 0!==s)return s.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};r.r(n),r.d(n,{FILE:()=>Dn,HTML:()=>Nn,TEXT:()=>jn,URL:()=>En});const s=window.wp.domReady;var i=r.n(s);const a=window.wp.element,o=window.wp.i18n,c=window.wp.components,d=window.wp.apiFetch;var u=r.n(d);const l=window.wp.notices,h=window.wp.data;var f,p;!function(e){e.assertEqual=e=>e,e.assertIs=function(e){},e.assertNever=function(_x){throw new Error},e.arrayToEnum=e=>{const t={};for(const r of e)t[r]=r;return t},e.getValidEnumValues=t=>{const r=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),n={};for(const e of r)n[e]=t[e];return e.objectValues(n)},e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]})),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t},e.find=(e,t)=>{for(const r of e)if(t(r))return r},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(f||(f={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(p||(p={}));const g=f.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),m=e=>{switch(typeof e){case"undefined":return g.undefined;case"string":return g.string;case"number":return isNaN(e)?g.nan:g.number;case"boolean":return g.boolean;case"function":return g.function;case"bigint":return g.bigint;case"symbol":return g.symbol;case"object":return Array.isArray(e)?g.array:null===e?g.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?g.promise:"undefined"!=typeof Map&&e instanceof Map?g.map:"undefined"!=typeof Set&&e instanceof Set?g.set:"undefined"!=typeof Date&&e instanceof Date?g.date:g.object;default:return g.unknown}},v=f.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class y extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},r={_errors:[]},n=e=>{for(const s of e.issues)if("invalid_union"===s.code)s.unionErrors.map(n);else if("invalid_return_type"===s.code)n(s.returnTypeError);else if("invalid_arguments"===s.code)n(s.argumentsError);else if(0===s.path.length)r._errors.push(t(s));else{let e=r,n=0;for(;n<s.path.length;){const r=s.path[n];n===s.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(s))):e[r]=e[r]||{_errors:[]},e=e[r],n++}}};return n(this),r}static assert(e){if(!(e instanceof y))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,f.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},r=[];for(const n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):r.push(e(n));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}y.create=e=>new y(e);const _=(e,t)=>{let r;switch(e.code){case v.invalid_type:r=e.received===g.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case v.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,f.jsonStringifyReplacer)}`;break;case v.unrecognized_keys:r=`Unrecognized key(s) in object: ${f.joinValues(e.keys,", ")}`;break;case v.invalid_union:r="Invalid input";break;case v.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${f.joinValues(e.options)}`;break;case v.invalid_enum_value:r=`Invalid enum value. Expected ${f.joinValues(e.options)}, received '${e.received}'`;break;case v.invalid_arguments:r="Invalid function arguments";break;case v.invalid_return_type:r="Invalid function return type";break;case v.invalid_date:r="Invalid date";break;case v.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:f.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case v.too_small:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case v.too_big:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case v.custom:r="Invalid input";break;case v.invalid_intersection_types:r="Intersection results could not be merged";break;case v.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case v.not_finite:r="Number must be finite";break;default:r=t.defaultError,f.assertNever(e)}return{message:r}};let b=_;function x(){return b}const w=e=>{const{data:t,path:r,errorMaps:n,issueData:s}=e,i=[...r,...s.path||[]],a={...s,path:i};if(void 0!==s.message)return{...s,path:i,message:s.message};let o="";const c=n.filter((e=>!!e)).slice().reverse();for(const e of c)o=e(a,{data:t,defaultError:o}).message;return{...s,path:i,message:o}};function T(e,t){const r=x(),n=w({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===_?void 0:_].filter((e=>!!e))});e.common.issues.push(n)}class S{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const r=[];for(const n of t){if("aborted"===n.status)return O;"dirty"===n.status&&e.dirty(),r.push(n.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){const r=[];for(const e of t){const t=await e.key,n=await e.value;r.push({key:t,value:n})}return S.mergeObjectSync(e,r)}static mergeObjectSync(e,t){const r={};for(const n of t){const{key:t,value:s}=n;if("aborted"===t.status)return O;if("aborted"===s.status)return O;"dirty"===t.status&&e.dirty(),"dirty"===s.status&&e.dirty(),"__proto__"===t.value||void 0===s.value&&!n.alwaysSet||(r[t.value]=s.value)}return{status:e.value,value:r}}}const O=Object.freeze({status:"aborted"}),k=e=>({status:"dirty",value:e}),I=e=>({status:"valid",value:e}),C=e=>"aborted"===e.status,D=e=>"dirty"===e.status,E=e=>"valid"===e.status,j=e=>"undefined"!=typeof Promise&&e instanceof Promise;function N(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}function P(e,t,r,n,s){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?s.call(e,r):s?s.value=r:t.set(e,r),r}var R,A,M;"function"==typeof SuppressedError&&SuppressedError,function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(R||(R={}));class Z{constructor(e,t,r,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=n}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const L=(e,t)=>{if(E(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new y(e.common.issues);return this._error=t,this._error}}};function U(e){if(!e)return{};const{errorMap:t,invalid_type_error:r,required_error:n,description:s}=e;if(t&&(r||n))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:s}:{errorMap:(t,s)=>{var i,a;const{message:o}=e;return"invalid_enum_value"===t.code?{message:null!=o?o:s.defaultError}:void 0===s.data?{message:null!==(i=null!=o?o:n)&&void 0!==i?i:s.defaultError}:"invalid_type"!==t.code?{message:s.defaultError}:{message:null!==(a=null!=o?o:r)&&void 0!==a?a:s.defaultError}},description:s}}class ${get description(){return this._def.description}_getType(e){return m(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:m(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new S,ctx:{common:e.parent.common,data:e.data,parsedType:m(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(j(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){var r;const n={common:{issues:[],async:null!==(r=null==t?void 0:t.async)&&void 0!==r&&r,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:m(e)},s=this._parseSync({data:e,path:n.path,parent:n});return L(n,s)}"~validate"(e){var t,r;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:m(e)};if(!this["~standard"].async)try{const t=this._parseSync({data:e,path:[],parent:n});return E(t)?{value:t.value}:{issues:n.common.issues}}catch(e){(null===(r=null===(t=null==e?void 0:e.message)||void 0===t?void 0:t.toLowerCase())||void 0===r?void 0:r.includes("encountered"))&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then((e=>E(e)?{value:e.value}:{issues:n.common.issues}))}async parseAsync(e,t){const r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){const r={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:m(e)},n=this._parse({data:e,path:r.path,parent:r}),s=await(j(n)?n:Promise.resolve(n));return L(r,s)}refine(e,t){const r=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,n)=>{const s=e(t),i=()=>n.addIssue({code:v.custom,...r(t)});return"undefined"!=typeof Promise&&s instanceof Promise?s.then((e=>!!e||(i(),!1))):!!s||(i(),!1)}))}refinement(e,t){return this._refinement(((r,n)=>!!e(r)||(n.addIssue("function"==typeof t?t(r,n):t),!1)))}_refinement(e){return new Be({schema:this,typeName:Qe.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return Fe.create(this,this._def)}nullable(){return ze.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return we.create(this)}promise(){return $e.create(this,this._def)}or(e){return Oe.create([this,e],this._def)}and(e){return De.create(this,e,this._def)}transform(e){return new Be({...U(this._def),schema:this,typeName:Qe.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new He({...U(this._def),innerType:this,defaultValue:t,typeName:Qe.ZodDefault})}brand(){return new Ke({typeName:Qe.ZodBranded,type:this,...U(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new Ve({...U(this._def),innerType:this,catchValue:t,typeName:Qe.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return Xe.create(this,e)}readonly(){return Ge.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const B=/^c[^\s-]{8,}$/i,F=/^[0-9a-z]+$/,z=/^[0-9A-HJKMNP-TV-Z]{26}$/i,H=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,V=/^[a-z0-9_-]{21}$/i,q=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,W=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,K=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let X;const G=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Y=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,J=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Q=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ee=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,te=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,re="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",ne=new RegExp(`^${re}$`);function se(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function ie(e){let t=`${re}T${se(e)}`;const r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function ae(e,t){return!("v4"!==t&&t||!G.test(e))||!("v6"!==t&&t||!J.test(e))}function oe(e,t){if(!q.test(e))return!1;try{const[r]=e.split("."),n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),s=JSON.parse(atob(n));return!("object"!=typeof s||null===s||!s.typ||!s.alg||t&&s.alg!==t)}catch(e){return!1}}function ce(e,t){return!("v4"!==t&&t||!Y.test(e))||!("v6"!==t&&t||!Q.test(e))}class de extends ${_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==g.string){const t=this._getOrReturnCtx(e);return T(t,{code:v.invalid_type,expected:g.string,received:t.parsedType}),O}const t=new S;let r;for(const n of this._def.checks)if("min"===n.kind)e.data.length<n.value&&(r=this._getOrReturnCtx(e,r),T(r,{code:v.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),t.dirty());else if("max"===n.kind)e.data.length>n.value&&(r=this._getOrReturnCtx(e,r),T(r,{code:v.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),t.dirty());else if("length"===n.kind){const s=e.data.length>n.value,i=e.data.length<n.value;(s||i)&&(r=this._getOrReturnCtx(e,r),s?T(r,{code:v.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):i&&T(r,{code:v.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),t.dirty())}else if("email"===n.kind)K.test(e.data)||(r=this._getOrReturnCtx(e,r),T(r,{validation:"email",code:v.invalid_string,message:n.message}),t.dirty());else if("emoji"===n.kind)X||(X=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),X.test(e.data)||(r=this._getOrReturnCtx(e,r),T(r,{validation:"emoji",code:v.invalid_string,message:n.message}),t.dirty());else if("uuid"===n.kind)H.test(e.data)||(r=this._getOrReturnCtx(e,r),T(r,{validation:"uuid",code:v.invalid_string,message:n.message}),t.dirty());else if("nanoid"===n.kind)V.test(e.data)||(r=this._getOrReturnCtx(e,r),T(r,{validation:"nanoid",code:v.invalid_string,message:n.message}),t.dirty());else if("cuid"===n.kind)B.test(e.data)||(r=this._getOrReturnCtx(e,r),T(r,{validation:"cuid",code:v.invalid_string,message:n.message}),t.dirty());else if("cuid2"===n.kind)F.test(e.data)||(r=this._getOrReturnCtx(e,r),T(r,{validation:"cuid2",code:v.invalid_string,message:n.message}),t.dirty());else if("ulid"===n.kind)z.test(e.data)||(r=this._getOrReturnCtx(e,r),T(r,{validation:"ulid",code:v.invalid_string,message:n.message}),t.dirty());else if("url"===n.kind)try{new URL(e.data)}catch(s){r=this._getOrReturnCtx(e,r),T(r,{validation:"url",code:v.invalid_string,message:n.message}),t.dirty()}else"regex"===n.kind?(n.regex.lastIndex=0,n.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),T(r,{validation:"regex",code:v.invalid_string,message:n.message}),t.dirty())):"trim"===n.kind?e.data=e.data.trim():"includes"===n.kind?e.data.includes(n.value,n.position)||(r=this._getOrReturnCtx(e,r),T(r,{code:v.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),t.dirty()):"toLowerCase"===n.kind?e.data=e.data.toLowerCase():"toUpperCase"===n.kind?e.data=e.data.toUpperCase():"startsWith"===n.kind?e.data.startsWith(n.value)||(r=this._getOrReturnCtx(e,r),T(r,{code:v.invalid_string,validation:{startsWith:n.value},message:n.message}),t.dirty()):"endsWith"===n.kind?e.data.endsWith(n.value)||(r=this._getOrReturnCtx(e,r),T(r,{code:v.invalid_string,validation:{endsWith:n.value},message:n.message}),t.dirty()):"datetime"===n.kind?ie(n).test(e.data)||(r=this._getOrReturnCtx(e,r),T(r,{code:v.invalid_string,validation:"datetime",message:n.message}),t.dirty()):"date"===n.kind?ne.test(e.data)||(r=this._getOrReturnCtx(e,r),T(r,{code:v.invalid_string,validation:"date",message:n.message}),t.dirty()):"time"===n.kind?new RegExp(`^${se(n)}$`).test(e.data)||(r=this._getOrReturnCtx(e,r),T(r,{code:v.invalid_string,validation:"time",message:n.message}),t.dirty()):"duration"===n.kind?W.test(e.data)||(r=this._getOrReturnCtx(e,r),T(r,{validation:"duration",code:v.invalid_string,message:n.message}),t.dirty()):"ip"===n.kind?ae(e.data,n.version)||(r=this._getOrReturnCtx(e,r),T(r,{validation:"ip",code:v.invalid_string,message:n.message}),t.dirty()):"jwt"===n.kind?oe(e.data,n.alg)||(r=this._getOrReturnCtx(e,r),T(r,{validation:"jwt",code:v.invalid_string,message:n.message}),t.dirty()):"cidr"===n.kind?ce(e.data,n.version)||(r=this._getOrReturnCtx(e,r),T(r,{validation:"cidr",code:v.invalid_string,message:n.message}),t.dirty()):"base64"===n.kind?ee.test(e.data)||(r=this._getOrReturnCtx(e,r),T(r,{validation:"base64",code:v.invalid_string,message:n.message}),t.dirty()):"base64url"===n.kind?te.test(e.data)||(r=this._getOrReturnCtx(e,r),T(r,{validation:"base64url",code:v.invalid_string,message:n.message}),t.dirty()):f.assertNever(n);return{status:t.value,value:e.data}}_regex(e,t,r){return this.refinement((t=>e.test(t)),{validation:t,code:v.invalid_string,...R.errToObj(r)})}_addCheck(e){return new de({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...R.errToObj(e)})}url(e){return this._addCheck({kind:"url",...R.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...R.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...R.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...R.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...R.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...R.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...R.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...R.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...R.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...R.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...R.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...R.errToObj(e)})}datetime(e){var t,r;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(r=null==e?void 0:e.local)&&void 0!==r&&r,...R.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...R.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...R.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...R.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...R.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...R.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...R.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...R.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...R.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...R.errToObj(t)})}nonempty(e){return this.min(1,R.errToObj(e))}trim(){return new de({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new de({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new de({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isCIDR(){return!!this._def.checks.find((e=>"cidr"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get isBase64url(){return!!this._def.checks.find((e=>"base64url"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function ue(e,t){const r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,s=r>n?r:n;return parseInt(e.toFixed(s).replace(".",""))%parseInt(t.toFixed(s).replace(".",""))/Math.pow(10,s)}de.create=e=>{var t;return new de({checks:[],typeName:Qe.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...U(e)})};class le extends ${constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==g.number){const t=this._getOrReturnCtx(e);return T(t,{code:v.invalid_type,expected:g.number,received:t.parsedType}),O}let t;const r=new S;for(const n of this._def.checks)"int"===n.kind?f.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),T(t,{code:v.invalid_type,expected:"integer",received:"float",message:n.message}),r.dirty()):"min"===n.kind?(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),T(t,{code:v.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):"max"===n.kind?(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),T(t,{code:v.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):"multipleOf"===n.kind?0!==ue(e.data,n.value)&&(t=this._getOrReturnCtx(e,t),T(t,{code:v.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):"finite"===n.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),T(t,{code:v.not_finite,message:n.message}),r.dirty()):f.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,R.toString(t))}gt(e,t){return this.setLimit("min",e,!1,R.toString(t))}lte(e,t){return this.setLimit("max",e,!0,R.toString(t))}lt(e,t){return this.setLimit("max",e,!1,R.toString(t))}setLimit(e,t,r,n){return new le({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:R.toString(n)}]})}_addCheck(e){return new le({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:R.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:R.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:R.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:R.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:R.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:R.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:R.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:R.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:R.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find((e=>"int"===e.kind||"multipleOf"===e.kind&&f.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const r of this._def.checks){if("finite"===r.kind||"int"===r.kind||"multipleOf"===r.kind)return!0;"min"===r.kind?(null===t||r.value>t)&&(t=r.value):"max"===r.kind&&(null===e||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}}le.create=e=>new le({checks:[],typeName:Qe.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...U(e)});class he extends ${constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch(t){return this._getInvalidInput(e)}if(this._getType(e)!==g.bigint)return this._getInvalidInput(e);let t;const r=new S;for(const n of this._def.checks)"min"===n.kind?(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),T(t,{code:v.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):"max"===n.kind?(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),T(t,{code:v.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):"multipleOf"===n.kind?e.data%n.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),T(t,{code:v.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):f.assertNever(n);return{status:r.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return T(t,{code:v.invalid_type,expected:g.bigint,received:t.parsedType}),O}gte(e,t){return this.setLimit("min",e,!0,R.toString(t))}gt(e,t){return this.setLimit("min",e,!1,R.toString(t))}lte(e,t){return this.setLimit("max",e,!0,R.toString(t))}lt(e,t){return this.setLimit("max",e,!1,R.toString(t))}setLimit(e,t,r,n){return new he({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:R.toString(n)}]})}_addCheck(e){return new he({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:R.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:R.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:R.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:R.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:R.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}he.create=e=>{var t;return new he({checks:[],typeName:Qe.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...U(e)})};class fe extends ${_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==g.boolean){const t=this._getOrReturnCtx(e);return T(t,{code:v.invalid_type,expected:g.boolean,received:t.parsedType}),O}return I(e.data)}}fe.create=e=>new fe({typeName:Qe.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...U(e)});class pe extends ${_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==g.date){const t=this._getOrReturnCtx(e);return T(t,{code:v.invalid_type,expected:g.date,received:t.parsedType}),O}if(isNaN(e.data.getTime()))return T(this._getOrReturnCtx(e),{code:v.invalid_date}),O;const t=new S;let r;for(const n of this._def.checks)"min"===n.kind?e.data.getTime()<n.value&&(r=this._getOrReturnCtx(e,r),T(r,{code:v.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),t.dirty()):"max"===n.kind?e.data.getTime()>n.value&&(r=this._getOrReturnCtx(e,r),T(r,{code:v.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),t.dirty()):f.assertNever(n);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new pe({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:R.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:R.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}pe.create=e=>new pe({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Qe.ZodDate,...U(e)});class ge extends ${_parse(e){if(this._getType(e)!==g.symbol){const t=this._getOrReturnCtx(e);return T(t,{code:v.invalid_type,expected:g.symbol,received:t.parsedType}),O}return I(e.data)}}ge.create=e=>new ge({typeName:Qe.ZodSymbol,...U(e)});class me extends ${_parse(e){if(this._getType(e)!==g.undefined){const t=this._getOrReturnCtx(e);return T(t,{code:v.invalid_type,expected:g.undefined,received:t.parsedType}),O}return I(e.data)}}me.create=e=>new me({typeName:Qe.ZodUndefined,...U(e)});class ve extends ${_parse(e){if(this._getType(e)!==g.null){const t=this._getOrReturnCtx(e);return T(t,{code:v.invalid_type,expected:g.null,received:t.parsedType}),O}return I(e.data)}}ve.create=e=>new ve({typeName:Qe.ZodNull,...U(e)});class ye extends ${constructor(){super(...arguments),this._any=!0}_parse(e){return I(e.data)}}ye.create=e=>new ye({typeName:Qe.ZodAny,...U(e)});class _e extends ${constructor(){super(...arguments),this._unknown=!0}_parse(e){return I(e.data)}}_e.create=e=>new _e({typeName:Qe.ZodUnknown,...U(e)});class be extends ${_parse(e){const t=this._getOrReturnCtx(e);return T(t,{code:v.invalid_type,expected:g.never,received:t.parsedType}),O}}be.create=e=>new be({typeName:Qe.ZodNever,...U(e)});class xe extends ${_parse(e){if(this._getType(e)!==g.undefined){const t=this._getOrReturnCtx(e);return T(t,{code:v.invalid_type,expected:g.void,received:t.parsedType}),O}return I(e.data)}}xe.create=e=>new xe({typeName:Qe.ZodVoid,...U(e)});class we extends ${_parse(e){const{ctx:t,status:r}=this._processInputParams(e),n=this._def;if(t.parsedType!==g.array)return T(t,{code:v.invalid_type,expected:g.array,received:t.parsedType}),O;if(null!==n.exactLength){const e=t.data.length>n.exactLength.value,s=t.data.length<n.exactLength.value;(e||s)&&(T(t,{code:e?v.too_big:v.too_small,minimum:s?n.exactLength.value:void 0,maximum:e?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),r.dirty())}if(null!==n.minLength&&t.data.length<n.minLength.value&&(T(t,{code:v.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),r.dirty()),null!==n.maxLength&&t.data.length>n.maxLength.value&&(T(t,{code:v.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map(((e,r)=>n.type._parseAsync(new Z(t,e,t.path,r))))).then((e=>S.mergeArray(r,e)));const s=[...t.data].map(((e,r)=>n.type._parseSync(new Z(t,e,t.path,r))));return S.mergeArray(r,s)}get element(){return this._def.type}min(e,t){return new we({...this._def,minLength:{value:e,message:R.toString(t)}})}max(e,t){return new we({...this._def,maxLength:{value:e,message:R.toString(t)}})}length(e,t){return new we({...this._def,exactLength:{value:e,message:R.toString(t)}})}nonempty(e){return this.min(1,e)}}function Te(e){if(e instanceof Se){const t={};for(const r in e.shape){const n=e.shape[r];t[r]=Fe.create(Te(n))}return new Se({...e._def,shape:()=>t})}return e instanceof we?new we({...e._def,type:Te(e.element)}):e instanceof Fe?Fe.create(Te(e.unwrap())):e instanceof ze?ze.create(Te(e.unwrap())):e instanceof Ee?Ee.create(e.items.map((e=>Te(e)))):e}we.create=(e,t)=>new we({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Qe.ZodArray,...U(t)});class Se extends ${constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=f.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==g.object){const t=this._getOrReturnCtx(e);return T(t,{code:v.invalid_type,expected:g.object,received:t.parsedType}),O}const{status:t,ctx:r}=this._processInputParams(e),{shape:n,keys:s}=this._getCached(),i=[];if(!(this._def.catchall instanceof be&&"strip"===this._def.unknownKeys))for(const e in r.data)s.includes(e)||i.push(e);const a=[];for(const e of s){const t=n[e],s=r.data[e];a.push({key:{status:"valid",value:e},value:t._parse(new Z(r,s,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof be){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of i)a.push({key:{status:"valid",value:e},value:{status:"valid",value:r.data[e]}});else if("strict"===e)i.length>0&&(T(r,{code:v.unrecognized_keys,keys:i}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of i){const n=r.data[t];a.push({key:{status:"valid",value:t},value:e._parse(new Z(r,n,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of a){const r=await t.key,n=await t.value;e.push({key:r,value:n,alwaysSet:t.alwaysSet})}return e})).then((e=>S.mergeObjectSync(t,e))):S.mergeObjectSync(t,a)}get shape(){return this._def.shape()}strict(e){return R.errToObj,new Se({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,r)=>{var n,s,i,a;const o=null!==(i=null===(s=(n=this._def).errorMap)||void 0===s?void 0:s.call(n,t,r).message)&&void 0!==i?i:r.defaultError;return"unrecognized_keys"===t.code?{message:null!==(a=R.errToObj(e).message)&&void 0!==a?a:o}:{message:o}}}:{}})}strip(){return new Se({...this._def,unknownKeys:"strip"})}passthrough(){return new Se({...this._def,unknownKeys:"passthrough"})}extend(e){return new Se({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Se({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Qe.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Se({...this._def,catchall:e})}pick(e){const t={};return f.objectKeys(e).forEach((r=>{e[r]&&this.shape[r]&&(t[r]=this.shape[r])})),new Se({...this._def,shape:()=>t})}omit(e){const t={};return f.objectKeys(this.shape).forEach((r=>{e[r]||(t[r]=this.shape[r])})),new Se({...this._def,shape:()=>t})}deepPartial(){return Te(this)}partial(e){const t={};return f.objectKeys(this.shape).forEach((r=>{const n=this.shape[r];e&&!e[r]?t[r]=n:t[r]=n.optional()})),new Se({...this._def,shape:()=>t})}required(e){const t={};return f.objectKeys(this.shape).forEach((r=>{if(e&&!e[r])t[r]=this.shape[r];else{let e=this.shape[r];for(;e instanceof Fe;)e=e._def.innerType;t[r]=e}})),new Se({...this._def,shape:()=>t})}keyof(){return Ze(f.objectKeys(this.shape))}}Se.create=(e,t)=>new Se({shape:()=>e,unknownKeys:"strip",catchall:be.create(),typeName:Qe.ZodObject,...U(t)}),Se.strictCreate=(e,t)=>new Se({shape:()=>e,unknownKeys:"strict",catchall:be.create(),typeName:Qe.ZodObject,...U(t)}),Se.lazycreate=(e,t)=>new Se({shape:e,unknownKeys:"strip",catchall:be.create(),typeName:Qe.ZodObject,...U(t)});class Oe extends ${_parse(e){const{ctx:t}=this._processInputParams(e),r=this._def.options;if(t.common.async)return Promise.all(r.map((async e=>{const r={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;const r=e.map((e=>new y(e.ctx.common.issues)));return T(t,{code:v.invalid_union,unionErrors:r}),O}));{let e;const n=[];for(const s of r){const r={...t,common:{...t.common,issues:[]},parent:null},i=s._parseSync({data:t.data,path:t.path,parent:r});if("valid"===i.status)return i;"dirty"!==i.status||e||(e={result:i,ctx:r}),r.common.issues.length&&n.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const s=n.map((e=>new y(e)));return T(t,{code:v.invalid_union,unionErrors:s}),O}}get options(){return this._def.options}}Oe.create=(e,t)=>new Oe({options:e,typeName:Qe.ZodUnion,...U(t)});const ke=e=>e instanceof Ae?ke(e.schema):e instanceof Be?ke(e.innerType()):e instanceof Me?[e.value]:e instanceof Le?e.options:e instanceof Ue?f.objectValues(e.enum):e instanceof He?ke(e._def.innerType):e instanceof me?[void 0]:e instanceof ve?[null]:e instanceof Fe?[void 0,...ke(e.unwrap())]:e instanceof ze?[null,...ke(e.unwrap())]:e instanceof Ke||e instanceof Ge?ke(e.unwrap()):e instanceof Ve?ke(e._def.innerType):[];class Ie extends ${_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==g.object)return T(t,{code:v.invalid_type,expected:g.object,received:t.parsedType}),O;const r=this.discriminator,n=t.data[r],s=this.optionsMap.get(n);return s?t.common.async?s._parseAsync({data:t.data,path:t.path,parent:t}):s._parseSync({data:t.data,path:t.path,parent:t}):(T(t,{code:v.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),O)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){const n=new Map;for(const r of t){const t=ke(r.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const s of t){if(n.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);n.set(s,r)}}return new Ie({typeName:Qe.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...U(r)})}}function Ce(e,t){const r=m(e),n=m(t);if(e===t)return{valid:!0,data:e};if(r===g.object&&n===g.object){const r=f.objectKeys(t),n=f.objectKeys(e).filter((e=>-1!==r.indexOf(e))),s={...e,...t};for(const r of n){const n=Ce(e[r],t[r]);if(!n.valid)return{valid:!1};s[r]=n.data}return{valid:!0,data:s}}if(r===g.array&&n===g.array){if(e.length!==t.length)return{valid:!1};const r=[];for(let n=0;n<e.length;n++){const s=Ce(e[n],t[n]);if(!s.valid)return{valid:!1};r.push(s.data)}return{valid:!0,data:r}}return r===g.date&&n===g.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class De extends ${_parse(e){const{status:t,ctx:r}=this._processInputParams(e),n=(e,n)=>{if(C(e)||C(n))return O;const s=Ce(e.value,n.value);return s.valid?((D(e)||D(n))&&t.dirty(),{status:t.value,value:s.data}):(T(r,{code:v.invalid_intersection_types}),O)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then((([e,t])=>n(e,t))):n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}De.create=(e,t,r)=>new De({left:e,right:t,typeName:Qe.ZodIntersection,...U(r)});class Ee extends ${_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==g.array)return T(r,{code:v.invalid_type,expected:g.array,received:r.parsedType}),O;if(r.data.length<this._def.items.length)return T(r,{code:v.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),O;!this._def.rest&&r.data.length>this._def.items.length&&(T(r,{code:v.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const n=[...r.data].map(((e,t)=>{const n=this._def.items[t]||this._def.rest;return n?n._parse(new Z(r,e,r.path,t)):null})).filter((e=>!!e));return r.common.async?Promise.all(n).then((e=>S.mergeArray(t,e))):S.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new Ee({...this._def,rest:e})}}Ee.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ee({items:e,typeName:Qe.ZodTuple,rest:null,...U(t)})};class je extends ${get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==g.object)return T(r,{code:v.invalid_type,expected:g.object,received:r.parsedType}),O;const n=[],s=this._def.keyType,i=this._def.valueType;for(const e in r.data)n.push({key:s._parse(new Z(r,e,r.path,e)),value:i._parse(new Z(r,r.data[e],r.path,e)),alwaysSet:e in r.data});return r.common.async?S.mergeObjectAsync(t,n):S.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,r){return new je(t instanceof $?{keyType:e,valueType:t,typeName:Qe.ZodRecord,...U(r)}:{keyType:de.create(),valueType:e,typeName:Qe.ZodRecord,...U(t)})}}class Ne extends ${get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==g.map)return T(r,{code:v.invalid_type,expected:g.map,received:r.parsedType}),O;const n=this._def.keyType,s=this._def.valueType,i=[...r.data.entries()].map((([e,t],i)=>({key:n._parse(new Z(r,e,r.path,[i,"key"])),value:s._parse(new Z(r,t,r.path,[i,"value"]))})));if(r.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const r of i){const n=await r.key,s=await r.value;if("aborted"===n.status||"aborted"===s.status)return O;"dirty"!==n.status&&"dirty"!==s.status||t.dirty(),e.set(n.value,s.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const r of i){const n=r.key,s=r.value;if("aborted"===n.status||"aborted"===s.status)return O;"dirty"!==n.status&&"dirty"!==s.status||t.dirty(),e.set(n.value,s.value)}return{status:t.value,value:e}}}}Ne.create=(e,t,r)=>new Ne({valueType:t,keyType:e,typeName:Qe.ZodMap,...U(r)});class Pe extends ${_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==g.set)return T(r,{code:v.invalid_type,expected:g.set,received:r.parsedType}),O;const n=this._def;null!==n.minSize&&r.data.size<n.minSize.value&&(T(r,{code:v.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),null!==n.maxSize&&r.data.size>n.maxSize.value&&(T(r,{code:v.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());const s=this._def.valueType;function i(e){const r=new Set;for(const n of e){if("aborted"===n.status)return O;"dirty"===n.status&&t.dirty(),r.add(n.value)}return{status:t.value,value:r}}const a=[...r.data.values()].map(((e,t)=>s._parse(new Z(r,e,r.path,t))));return r.common.async?Promise.all(a).then((e=>i(e))):i(a)}min(e,t){return new Pe({...this._def,minSize:{value:e,message:R.toString(t)}})}max(e,t){return new Pe({...this._def,maxSize:{value:e,message:R.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Pe.create=(e,t)=>new Pe({valueType:e,minSize:null,maxSize:null,typeName:Qe.ZodSet,...U(t)});class Re extends ${constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==g.function)return T(t,{code:v.invalid_type,expected:g.function,received:t.parsedType}),O;function r(e,r){return w({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,x(),_].filter((e=>!!e)),issueData:{code:v.invalid_arguments,argumentsError:r}})}function n(e,r){return w({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,x(),_].filter((e=>!!e)),issueData:{code:v.invalid_return_type,returnTypeError:r}})}const s={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof $e){const e=this;return I((async function(...t){const a=new y([]),o=await e._def.args.parseAsync(t,s).catch((e=>{throw a.addIssue(r(t,e)),a})),c=await Reflect.apply(i,this,o);return await e._def.returns._def.type.parseAsync(c,s).catch((e=>{throw a.addIssue(n(c,e)),a}))}))}{const e=this;return I((function(...t){const a=e._def.args.safeParse(t,s);if(!a.success)throw new y([r(t,a.error)]);const o=Reflect.apply(i,this,a.data),c=e._def.returns.safeParse(o,s);if(!c.success)throw new y([n(o,c.error)]);return c.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Re({...this._def,args:Ee.create(e).rest(_e.create())})}returns(e){return new Re({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new Re({args:e||Ee.create([]).rest(_e.create()),returns:t||_e.create(),typeName:Qe.ZodFunction,...U(r)})}}class Ae extends ${get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}Ae.create=(e,t)=>new Ae({getter:e,typeName:Qe.ZodLazy,...U(t)});class Me extends ${_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return T(t,{received:t.data,code:v.invalid_literal,expected:this._def.value}),O}return{status:"valid",value:e.data}}get value(){return this._def.value}}function Ze(e,t){return new Le({values:e,typeName:Qe.ZodEnum,...U(t)})}Me.create=(e,t)=>new Me({value:e,typeName:Qe.ZodLiteral,...U(t)});class Le extends ${constructor(){super(...arguments),A.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),r=this._def.values;return T(t,{expected:f.joinValues(r),received:t.parsedType,code:v.invalid_type}),O}if(N(this,A,"f")||P(this,A,new Set(this._def.values),"f"),!N(this,A,"f").has(e.data)){const t=this._getOrReturnCtx(e),r=this._def.values;return T(t,{received:t.data,code:v.invalid_enum_value,options:r}),O}return I(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return Le.create(e,{...this._def,...t})}exclude(e,t=this._def){return Le.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}A=new WeakMap,Le.create=Ze;class Ue extends ${constructor(){super(...arguments),M.set(this,void 0)}_parse(e){const t=f.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==g.string&&r.parsedType!==g.number){const e=f.objectValues(t);return T(r,{expected:f.joinValues(e),received:r.parsedType,code:v.invalid_type}),O}if(N(this,M,"f")||P(this,M,new Set(f.getValidEnumValues(this._def.values)),"f"),!N(this,M,"f").has(e.data)){const e=f.objectValues(t);return T(r,{received:r.data,code:v.invalid_enum_value,options:e}),O}return I(e.data)}get enum(){return this._def.values}}M=new WeakMap,Ue.create=(e,t)=>new Ue({values:e,typeName:Qe.ZodNativeEnum,...U(t)});class $e extends ${unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==g.promise&&!1===t.common.async)return T(t,{code:v.invalid_type,expected:g.promise,received:t.parsedType}),O;const r=t.parsedType===g.promise?t.data:Promise.resolve(t.data);return I(r.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}$e.create=(e,t)=>new $e({type:e,typeName:Qe.ZodPromise,...U(t)});class Be extends ${innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Qe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:r}=this._processInputParams(e),n=this._def.effect||null,s={addIssue:e=>{T(r,e),e.fatal?t.abort():t.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),"preprocess"===n.type){const e=n.transform(r.data,s);if(r.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return O;const n=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return"aborted"===n.status?O:"dirty"===n.status||"dirty"===t.value?k(n.value):n}));{if("aborted"===t.value)return O;const n=this._def.schema._parseSync({data:e,path:r.path,parent:r});return"aborted"===n.status?O:"dirty"===n.status||"dirty"===t.value?k(n.value):n}}if("refinement"===n.type){const e=e=>{const t=n.refinement(e,s);if(r.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===r.common.async){const n=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===n.status?O:("dirty"===n.status&&t.dirty(),e(n.value),{status:t.value,value:n.value})}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((r=>"aborted"===r.status?O:("dirty"===r.status&&t.dirty(),e(r.value).then((()=>({status:t.value,value:r.value}))))))}if("transform"===n.type){if(!1===r.common.async){const e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!E(e))return e;const i=n.transform(e.value,s);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((e=>E(e)?Promise.resolve(n.transform(e.value,s)).then((e=>({status:t.value,value:e}))):e))}f.assertNever(n)}}Be.create=(e,t,r)=>new Be({schema:e,typeName:Qe.ZodEffects,effect:t,...U(r)}),Be.createWithPreprocess=(e,t,r)=>new Be({schema:t,effect:{type:"preprocess",transform:e},typeName:Qe.ZodEffects,...U(r)});class Fe extends ${_parse(e){return this._getType(e)===g.undefined?I(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Fe.create=(e,t)=>new Fe({innerType:e,typeName:Qe.ZodOptional,...U(t)});class ze extends ${_parse(e){return this._getType(e)===g.null?I(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ze.create=(e,t)=>new ze({innerType:e,typeName:Qe.ZodNullable,...U(t)});class He extends ${_parse(e){const{ctx:t}=this._processInputParams(e);let r=t.data;return t.parsedType===g.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}He.create=(e,t)=>new He({innerType:e,typeName:Qe.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...U(t)});class Ve extends ${_parse(e){const{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return j(n)?n.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new y(r.common.issues)},input:r.data})}))):{status:"valid",value:"valid"===n.status?n.value:this._def.catchValue({get error(){return new y(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Ve.create=(e,t)=>new Ve({innerType:e,typeName:Qe.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...U(t)});class qe extends ${_parse(e){if(this._getType(e)!==g.nan){const t=this._getOrReturnCtx(e);return T(t,{code:v.invalid_type,expected:g.nan,received:t.parsedType}),O}return{status:"valid",value:e.data}}}qe.create=e=>new qe({typeName:Qe.ZodNaN,...U(e)});const We=Symbol("zod_brand");class Ke extends ${_parse(e){const{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class Xe extends ${_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const e=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?O:"dirty"===e.status?(t.dirty(),k(e.value)):this._def.out._parseAsync({data:e.value,path:r.path,parent:r})})();{const e=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?O:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:r.path,parent:r})}}static create(e,t){return new Xe({in:e,out:t,typeName:Qe.ZodPipeline})}}class Ge extends ${_parse(e){const t=this._def.innerType._parse(e),r=e=>(E(e)&&(e.value=Object.freeze(e.value)),e);return j(t)?t.then((e=>r(e))):r(t)}unwrap(){return this._def.innerType}}function Ye(e,t={},r){return e?ye.create().superRefine(((n,s)=>{var i,a;if(!e(n)){const e="function"==typeof t?t(n):"string"==typeof t?{message:t}:t,o=null===(a=null!==(i=e.fatal)&&void 0!==i?i:r)||void 0===a||a,c="string"==typeof e?{message:e}:e;s.addIssue({code:"custom",...c,fatal:o})}})):ye.create()}Ge.create=(e,t)=>new Ge({innerType:e,typeName:Qe.ZodReadonly,...U(t)});const Je={object:Se.lazycreate};var Qe;!function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(Qe||(Qe={}));const et=de.create,tt=le.create,rt=qe.create,nt=he.create,st=fe.create,it=pe.create,at=ge.create,ot=me.create,ct=ve.create,dt=ye.create,ut=_e.create,lt=be.create,ht=xe.create,ft=we.create,pt=Se.create,gt=Se.strictCreate,mt=Oe.create,vt=Ie.create,yt=De.create,_t=Ee.create,bt=je.create,xt=Ne.create,wt=Pe.create,Tt=Re.create,St=Ae.create,Ot=Me.create,kt=Le.create,It=Ue.create,Ct=$e.create,Dt=Be.create,Et=Fe.create,jt=ze.create,Nt=Be.createWithPreprocess,Pt=Xe.create,Rt={string:e=>de.create({...e,coerce:!0}),number:e=>le.create({...e,coerce:!0}),boolean:e=>fe.create({...e,coerce:!0}),bigint:e=>he.create({...e,coerce:!0}),date:e=>pe.create({...e,coerce:!0})},At=O;var Mt=Object.freeze({__proto__:null,defaultErrorMap:_,setErrorMap:function(e){b=e},getErrorMap:x,makeIssue:w,EMPTY_PATH:[],addIssueToContext:T,ParseStatus:S,INVALID:O,DIRTY:k,OK:I,isAborted:C,isDirty:D,isValid:E,isAsync:j,get util(){return f},get objectUtil(){return p},ZodParsedType:g,getParsedType:m,ZodType:$,datetimeRegex:ie,ZodString:de,ZodNumber:le,ZodBigInt:he,ZodBoolean:fe,ZodDate:pe,ZodSymbol:ge,ZodUndefined:me,ZodNull:ve,ZodAny:ye,ZodUnknown:_e,ZodNever:be,ZodVoid:xe,ZodArray:we,ZodObject:Se,ZodUnion:Oe,ZodDiscriminatedUnion:Ie,ZodIntersection:De,ZodTuple:Ee,ZodRecord:je,ZodMap:Ne,ZodSet:Pe,ZodFunction:Re,ZodLazy:Ae,ZodLiteral:Me,ZodEnum:Le,ZodNativeEnum:Ue,ZodPromise:$e,ZodEffects:Be,ZodTransformer:Be,ZodOptional:Fe,ZodNullable:ze,ZodDefault:He,ZodCatch:Ve,ZodNaN:qe,BRAND:We,ZodBranded:Ke,ZodPipeline:Xe,ZodReadonly:Ge,custom:Ye,Schema:$,ZodSchema:$,late:Je,get ZodFirstPartyTypeKind(){return Qe},coerce:Rt,any:dt,array:ft,bigint:nt,boolean:st,date:it,discriminatedUnion:vt,effect:Dt,enum:kt,function:Tt,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>Ye((t=>t instanceof e),t),intersection:yt,lazy:St,literal:Ot,map:xt,nan:rt,nativeEnum:It,never:lt,null:ct,nullable:jt,number:tt,object:pt,oboolean:()=>st().optional(),onumber:()=>tt().optional(),optional:Et,ostring:()=>et().optional(),pipeline:Pt,preprocess:Nt,promise:Ct,record:bt,set:wt,strictObject:gt,string:et,symbol:at,transformer:Dt,tuple:_t,undefined:ot,union:mt,unknown:ut,void:ht,NEVER:At,ZodIssueCode:v,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:y});const Zt=Mt.object({version:Mt.literal("1",{message:"Version must be 1"}),name:Mt.string({invalid_type_error:"Name must be a string",required_error:"Name is required"}).max(32,{message:"Name must be 32 characters or less"}),homeUrl:Mt.string({invalid_type_error:"Home URL must be a string",required_error:"Home URL is required"}).max(512,{message:"Home URL must be 512 characters or less"}),iconUrl:Mt.string({invalid_type_error:"Icon URL must be a string",required_error:"Icon URL is required"}).max(512,{message:"Icon URL must be 512 characters or less"}),splashImageUrl:Mt.string({invalid_type_error:"Splash image URL must be a string"}).max(512,{message:"Splash image URL must be 512 characters or less"}).optional(),imageUrl:Mt.string({invalid_type_error:"Image URL must be a string",required_error:"Image URL is required"}).max(512,{message:"Splash image URL must be 512 characters or less"}),buttonTitle:Mt.string({invalid_type_error:"Button title must be a string",required_error:"Button title is required"}).max(32,{message:"Button title must be 32 characters or less"}),splashBackgroundColor:Mt.string({invalid_type_error:"Splash background color must be a string"}).regex(/^#[0-9A-Fa-f]{3,6}$/,{message:"Splash background color must be a valid hex color"}).optional(),webhookUrl:Mt.string({invalid_type_error:"Webhook URL must be a string"}).max(512,{message:"Webhook URL must be 512 characters or less"}).optional()}),Lt=Mt.discriminatedUnion("type",[Mt.object({type:Mt.literal("cast",{message:"Trigger type must be cast"}),id:Mt.string({required_error:"Trigger ID is required"}),url:Mt.string({required_error:"Trigger URL is required"}),name:Mt.string({invalid_type_error:"Trigger name must be a string"}).optional()}),Mt.object({type:Mt.literal("composer",{message:"Trigger type must be composer"}),id:Mt.string({invalid_type_error:"Trigger ID must be a string",required_error:"Trigger ID is required"}),url:Mt.string({invalid_type_error:"Trigger URL must be a string",required_error:"Trigger URL is required"}),name:Mt.string({invalid_type_error:"Trigger name must be a string"}).optional()})]),Ut=Mt.object({accountAssociation:Mt.object({header:Mt.string({invalid_type_error:"Header must be a string",required_error:"Header is required"}),payload:Mt.string({invalid_type_error:"Payload must be a string",required_error:"Payload is required"}),signature:Mt.string({invalid_type_error:"Signature must be a string",required_error:"Signature is required"})},{invalid_type_error:"Account association must be an object"}),frame:Zt,triggers:Mt.array(Lt,{invalid_type_error:"Triggers must be an array"}).optional()}),$t=window.ReactJSXRuntime,Bt=()=>{const{removeNotice:e}=(0,h.useDispatch)(l.store),t=(0,h.useSelect)((e=>e(l.store).getNotices()),[]);if(0===t.length)return null;const r=t.map((e=>({id:e.id,content:e.content})));return(0,$t.jsx)(c.NoticeList,{notices:r,onRemove:e})},Ft=window.wp.mediaUtils;function zt(e,t,...r){if("undefined"!=typeof process&&void 0===t)throw new Error("invariant requires an error message argument");if(!e){let e;if(void 0===t)e=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{let n=0;e=new Error(t.replace(/%s/g,(function(){return r[n++]}))),e.name="Invariant Violation"}throw e.framesToPop=1,e}}var Ht=r(2017);const Vt=window.React,qt="undefined"!=typeof window?Vt.useLayoutEffect:Vt.useEffect;function Wt(e,t,r){return function(e,t,r){const[n,s]=function(e,t,r){const[n,s]=(0,Vt.useState)((()=>t(e))),i=(0,Vt.useCallback)((()=>{const i=t(e);Ht(n,i)||(s(i),r&&r())}),[n,e,r]);return qt(i),[n,i]}(e,t,r);return qt((function(){const t=e.getHandlerId();if(null!=t)return e.subscribeToStateChange(s,{handlerIds:[t]})}),[e,s]),n}(t,e||(()=>({})),(()=>r.reconnect()))}function Kt(e,t){const r=[...t||[]];return null==t&&"function"!=typeof e&&r.push(e),(0,Vt.useMemo)((()=>"function"==typeof e?e():e),r)}function Xt(e){return(0,Vt.useMemo)((()=>e.hooks.dragSource()),[e])}function Gt(e){return(0,Vt.useMemo)((()=>e.hooks.dragPreview()),[e])}function Yt(e,t,r,n){let s=r?r.call(n,e,t):void 0;if(void 0!==s)return!!s;if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;const i=Object.keys(e),a=Object.keys(t);if(i.length!==a.length)return!1;const o=Object.prototype.hasOwnProperty.bind(t);for(let a=0;a<i.length;a++){const c=i[a];if(!o(c))return!1;const d=e[c],u=t[c];if(s=r?r.call(n,d,u,c):void 0,!1===s||void 0===s&&d!==u)return!1}return!0}function Jt(e){return null!==e&&"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"current")}function Qt(e){const t={};return Object.keys(e).forEach((r=>{const n=e[r];if(r.endsWith("Ref"))t[r]=e[r];else{const e=function(e){return(t=null,r=null)=>{if(!(0,Vt.isValidElement)(t)){const n=t;return e(n,r),n}const n=t;return function(e){if("string"==typeof e.type)return;const t=e.type.displayName||e.type.name||"the component";throw new Error(`Only native element nodes can now be passed to React DnD connectors.You can either wrap ${t} into a <div>, or turn it into a drag source or a drop target itself.`)}(n),function(e,t){const r=e.ref;return zt("string"!=typeof r,"Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"),r?(0,Vt.cloneElement)(e,{ref:e=>{er(r,e),er(t,e)}}):(0,Vt.cloneElement)(e,{ref:t})}(n,r?t=>e(t,r):e)}}(n);t[r]=()=>e}})),t}function er(e,t){"function"==typeof e?e(t):e.current=t}class tr{receiveHandlerId(e){this.handlerId!==e&&(this.handlerId=e,this.reconnect())}get connectTarget(){return this.dragSource}get dragSourceOptions(){return this.dragSourceOptionsInternal}set dragSourceOptions(e){this.dragSourceOptionsInternal=e}get dragPreviewOptions(){return this.dragPreviewOptionsInternal}set dragPreviewOptions(e){this.dragPreviewOptionsInternal=e}reconnect(){const e=this.reconnectDragSource();this.reconnectDragPreview(e)}reconnectDragSource(){const e=this.dragSource,t=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();return t&&this.disconnectDragSource(),this.handlerId?e?(t&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragSource=e,this.lastConnectedDragSourceOptions=this.dragSourceOptions,this.dragSourceUnsubscribe=this.backend.connectDragSource(this.handlerId,e,this.dragSourceOptions)),t):(this.lastConnectedDragSource=e,t):t}reconnectDragPreview(e=!1){const t=this.dragPreview,r=e||this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();r&&this.disconnectDragPreview(),this.handlerId&&(t?r&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragPreview=t,this.lastConnectedDragPreviewOptions=this.dragPreviewOptions,this.dragPreviewUnsubscribe=this.backend.connectDragPreview(this.handlerId,t,this.dragPreviewOptions)):this.lastConnectedDragPreview=t)}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didConnectedDragSourceChange(){return this.lastConnectedDragSource!==this.dragSource}didConnectedDragPreviewChange(){return this.lastConnectedDragPreview!==this.dragPreview}didDragSourceOptionsChange(){return!Yt(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}didDragPreviewOptionsChange(){return!Yt(this.lastConnectedDragPreviewOptions,this.dragPreviewOptions)}disconnectDragSource(){this.dragSourceUnsubscribe&&(this.dragSourceUnsubscribe(),this.dragSourceUnsubscribe=void 0)}disconnectDragPreview(){this.dragPreviewUnsubscribe&&(this.dragPreviewUnsubscribe(),this.dragPreviewUnsubscribe=void 0,this.dragPreviewNode=null,this.dragPreviewRef=null)}get dragSource(){return this.dragSourceNode||this.dragSourceRef&&this.dragSourceRef.current}get dragPreview(){return this.dragPreviewNode||this.dragPreviewRef&&this.dragPreviewRef.current}clearDragSource(){this.dragSourceNode=null,this.dragSourceRef=null}clearDragPreview(){this.dragPreviewNode=null,this.dragPreviewRef=null}constructor(e){this.hooks=Qt({dragSource:(e,t)=>{this.clearDragSource(),this.dragSourceOptions=t||null,Jt(e)?this.dragSourceRef=e:this.dragSourceNode=e,this.reconnectDragSource()},dragPreview:(e,t)=>{this.clearDragPreview(),this.dragPreviewOptions=t||null,Jt(e)?this.dragPreviewRef=e:this.dragPreviewNode=e,this.reconnectDragPreview()}}),this.handlerId=null,this.dragSourceRef=null,this.dragSourceOptionsInternal=null,this.dragPreviewRef=null,this.dragPreviewOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDragSource=null,this.lastConnectedDragSourceOptions=null,this.lastConnectedDragPreview=null,this.lastConnectedDragPreviewOptions=null,this.backend=e}}const rr=(0,Vt.createContext)({dragDropManager:void 0});function nr(){const{dragDropManager:e}=(0,Vt.useContext)(rr);return zt(null!=e,"Expected drag drop context"),e}let sr=!1,ir=!1;class ar{receiveHandlerId(e){this.sourceId=e}getHandlerId(){return this.sourceId}canDrag(){zt(!sr,"You may not call monitor.canDrag() inside your canDrag() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return sr=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{sr=!1}}isDragging(){if(!this.sourceId)return!1;zt(!ir,"You may not call monitor.isDragging() inside your isDragging() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return ir=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{ir=!1}}subscribeToStateChange(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}isDraggingSource(e){return this.internalMonitor.isDraggingSource(e)}isOverTarget(e,t){return this.internalMonitor.isOverTarget(e,t)}getTargetIds(){return this.internalMonitor.getTargetIds()}isSourcePublic(){return this.internalMonitor.isSourcePublic()}getSourceId(){return this.internalMonitor.getSourceId()}subscribeToOffsetChange(e){return this.internalMonitor.subscribeToOffsetChange(e)}canDragSource(e){return this.internalMonitor.canDragSource(e)}canDropOnTarget(e){return this.internalMonitor.canDropOnTarget(e)}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(e){this.sourceId=null,this.internalMonitor=e.getMonitor()}}class or{beginDrag(){const e=this.spec,t=this.monitor;let r=null;return r="object"==typeof e.item?e.item:"function"==typeof e.item?e.item(t):{},null!=r?r:null}canDrag(){const e=this.spec,t=this.monitor;return"boolean"==typeof e.canDrag?e.canDrag:"function"!=typeof e.canDrag||e.canDrag(t)}isDragging(e,t){const r=this.spec,n=this.monitor,{isDragging:s}=r;return s?s(n):t===e.getSourceId()}endDrag(){const e=this.spec,t=this.monitor,r=this.connector,{end:n}=e;n&&n(t.getItem(),t),r.reconnect()}constructor(e,t,r){this.spec=e,this.monitor=t,this.connector=r}}function cr(e,t){const r=Kt(e,t);zt(!r.begin,"useDrag::spec.begin was deprecated in v14. Replace spec.begin() with spec.item(). (see more here - https://react-dnd.github.io/react-dnd/docs/api/use-drag)");const n=function(){const e=nr();return(0,Vt.useMemo)((()=>new ar(e)),[e])}(),s=function(e,t){const r=nr(),n=(0,Vt.useMemo)((()=>new tr(r.getBackend())),[r]);return qt((()=>(n.dragSourceOptions=e||null,n.reconnect(),()=>n.disconnectDragSource())),[n,e]),qt((()=>(n.dragPreviewOptions=t||null,n.reconnect(),()=>n.disconnectDragPreview())),[n,t]),n}(r.options,r.previewOptions);return function(e,t,r){const n=nr(),s=function(e,t,r){const n=(0,Vt.useMemo)((()=>new or(e,t,r)),[t,r]);return(0,Vt.useEffect)((()=>{n.spec=e}),[e]),n}(e,t,r),i=function(e){return(0,Vt.useMemo)((()=>{const t=e.type;return zt(null!=t,"spec.type must be defined"),t}),[e])}(e);qt((function(){if(null!=i){const[e,a]=function(e,t,r){const n=r.getRegistry(),s=n.addSource(e,t);return[s,()=>n.removeSource(s)]}(i,s,n);return t.receiveHandlerId(e),r.receiveHandlerId(e),a}}),[n,t,r,s,i])}(r,n,s),[Wt(r.collect,n,s),Xt(s),Gt(s)]}function dr(e){return(0,Vt.useMemo)((()=>e.hooks.dropTarget()),[e])}class ur{get connectTarget(){return this.dropTarget}reconnect(){const e=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();e&&this.disconnectDropTarget();const t=this.dropTarget;this.handlerId&&(t?e&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=t,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,t,this.dropTargetOptions)):this.lastConnectedDropTarget=t)}receiveHandlerId(e){e!==this.handlerId&&(this.handlerId=e,this.reconnect())}get dropTargetOptions(){return this.dropTargetOptionsInternal}set dropTargetOptions(e){this.dropTargetOptionsInternal=e}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didDropTargetChange(){return this.lastConnectedDropTarget!==this.dropTarget}didOptionsChange(){return!Yt(this.lastConnectedDropTargetOptions,this.dropTargetOptions)}disconnectDropTarget(){this.unsubscribeDropTarget&&(this.unsubscribeDropTarget(),this.unsubscribeDropTarget=void 0)}get dropTarget(){return this.dropTargetNode||this.dropTargetRef&&this.dropTargetRef.current}clearDropTarget(){this.dropTargetRef=null,this.dropTargetNode=null}constructor(e){this.hooks=Qt({dropTarget:(e,t)=>{this.clearDropTarget(),this.dropTargetOptions=t,Jt(e)?this.dropTargetRef=e:this.dropTargetNode=e,this.reconnect()}}),this.handlerId=null,this.dropTargetRef=null,this.dropTargetOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDropTarget=null,this.lastConnectedDropTargetOptions=null,this.backend=e}}let lr=!1;class hr{receiveHandlerId(e){this.targetId=e}getHandlerId(){return this.targetId}subscribeToStateChange(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}canDrop(){if(!this.targetId)return!1;zt(!lr,"You may not call monitor.canDrop() inside your canDrop() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor");try{return lr=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{lr=!1}}isOver(e){return!!this.targetId&&this.internalMonitor.isOverTarget(this.targetId,e)}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(e){this.targetId=null,this.internalMonitor=e.getMonitor()}}class fr{canDrop(){const e=this.spec,t=this.monitor;return!e.canDrop||e.canDrop(t.getItem(),t)}hover(){const e=this.spec,t=this.monitor;e.hover&&e.hover(t.getItem(),t)}drop(){const e=this.spec,t=this.monitor;if(e.drop)return e.drop(t.getItem(),t)}constructor(e,t){this.spec=e,this.monitor=t}}function pr(e,t){const r=Kt(e,t),n=function(){const e=nr();return(0,Vt.useMemo)((()=>new hr(e)),[e])}(),s=function(e){const t=nr(),r=(0,Vt.useMemo)((()=>new ur(t.getBackend())),[t]);return qt((()=>(r.dropTargetOptions=e||null,r.reconnect(),()=>r.disconnectDropTarget())),[e]),r}(r.options);return function(e,t,r){const n=nr(),s=function(e,t){const r=(0,Vt.useMemo)((()=>new fr(e,t)),[t]);return(0,Vt.useEffect)((()=>{r.spec=e}),[e]),r}(e,t),i=function(e){const{accept:t}=e;return(0,Vt.useMemo)((()=>(zt(null!=e.accept,"accept must be defined"),Array.isArray(t)?t:[t])),[t])}(e);qt((function(){const[e,a]=function(e,t,r){const n=r.getRegistry(),s=n.addTarget(e,t);return[s,()=>n.removeTarget(s)]}(i,s,n);return t.receiveHandlerId(e),r.receiveHandlerId(e),a}),[n,t,s,r,i.map((e=>e.toString())).join("|")])}(r,n,s),[Wt(r.collect,n,s),dr(s)]}function gr(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var mr="function"==typeof Symbol&&Symbol.observable||"@@observable",vr=function(){return Math.random().toString(36).substring(7).split("").join(".")},yr={INIT:"@@redux/INIT"+vr(),REPLACE:"@@redux/REPLACE"+vr(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+vr()}};function _r(e,t,r){var n;if("function"==typeof t&&"function"==typeof r||"function"==typeof r&&"function"==typeof arguments[3])throw new Error(gr(0));if("function"==typeof t&&void 0===r&&(r=t,t=void 0),void 0!==r){if("function"!=typeof r)throw new Error(gr(1));return r(_r)(e,t)}if("function"!=typeof e)throw new Error(gr(2));var s=e,i=t,a=[],o=a,c=!1;function d(){o===a&&(o=a.slice())}function u(){if(c)throw new Error(gr(3));return i}function l(e){if("function"!=typeof e)throw new Error(gr(4));if(c)throw new Error(gr(5));var t=!0;return d(),o.push(e),function(){if(t){if(c)throw new Error(gr(6));t=!1,d();var r=o.indexOf(e);o.splice(r,1),a=null}}}function h(e){if(!function(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}(e))throw new Error(gr(7));if(void 0===e.type)throw new Error(gr(8));if(c)throw new Error(gr(9));try{c=!0,i=s(i,e)}finally{c=!1}for(var t=a=o,r=0;r<t.length;r++)(0,t[r])();return e}return h({type:yr.INIT}),(n={dispatch:h,subscribe:l,getState:u,replaceReducer:function(e){if("function"!=typeof e)throw new Error(gr(10));s=e,h({type:yr.REPLACE})}})[mr]=function(){var e,t=l;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(gr(11));function r(){e.next&&e.next(u())}return r(),{unsubscribe:t(r)}}})[mr]=function(){return this},e},n}function br(e){return"object"==typeof e}const xr="dnd-core/INIT_COORDS",wr="dnd-core/BEGIN_DRAG",Tr="dnd-core/PUBLISH_DRAG_SOURCE",Sr="dnd-core/HOVER",Or="dnd-core/DROP",kr="dnd-core/END_DRAG";function Ir(e,t){return{type:xr,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}const Cr={type:xr,payload:{clientOffset:null,sourceClientOffset:null}};function Dr(e){return function(t=[],r={publishSource:!0}){const{publishSource:n=!0,clientOffset:s,getSourceClientOffset:i}=r,a=e.getMonitor(),o=e.getRegistry();e.dispatch(Ir(s)),function(e,t,r){zt(!t.isDragging(),"Cannot call beginDrag while dragging."),e.forEach((function(e){zt(r.getSource(e),"Expected sourceIds to be registered.")}))}(t,a,o);const c=function(e,t){let r=null;for(let n=e.length-1;n>=0;n--)if(t.canDragSource(e[n])){r=e[n];break}return r}(t,a);if(null==c)return void e.dispatch(Cr);let d=null;if(s){if(!i)throw new Error("getSourceClientOffset must be defined");!function(e){zt("function"==typeof e,"When clientOffset is provided, getSourceClientOffset must be a function.")}(i),d=i(c)}e.dispatch(Ir(s,d));const u=o.getSource(c).beginDrag(a,c);if(null==u)return;!function(e){zt(br(e),"Item must be an object.")}(u),o.pinSource(c);const l=o.getSourceType(c);return{type:wr,payload:{itemType:l,item:u,sourceId:c,clientOffset:s||null,sourceClientOffset:d||null,isSourcePublic:!!n}}}}function Er(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function jr(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){Er(e,t,r[t])}))}return e}function Nr(e){return function(t={}){const r=e.getMonitor(),n=e.getRegistry();!function(e){zt(e.isDragging(),"Cannot call drop while not dragging."),zt(!e.didDrop(),"Cannot call drop twice during one drag operation.")}(r);const s=function(e){const t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}(r);s.forEach(((s,i)=>{const a=function(e,t,r,n){const s=r.getTarget(e);let i=s?s.drop(n,e):void 0;return function(e){zt(void 0===e||br(e),"Drop result must either be an object or undefined.")}(i),void 0===i&&(i=0===t?{}:n.getDropResult()),i}(s,i,n,r),o={type:Or,payload:{dropResult:jr({},t,a)}};e.dispatch(o)}))}}function Pr(e){return function(){const t=e.getMonitor(),r=e.getRegistry();!function(e){zt(e.isDragging(),"Cannot call endDrag while not dragging.")}(t);const n=t.getSourceId();return null!=n&&(r.getSource(n,!0).endDrag(t,n),r.unpinSource()),{type:kr}}}function Rr(e,t){return null===t?null===e:Array.isArray(e)?e.some((e=>e===t)):e===t}function Ar(e){return function(t,{clientOffset:r}={}){!function(e){zt(Array.isArray(e),"Expected targetIds to be an array.")}(t);const n=t.slice(0),s=e.getMonitor(),i=e.getRegistry();return function(e,t,r){for(let n=e.length-1;n>=0;n--){const s=e[n];Rr(t.getTargetType(s),r)||e.splice(n,1)}}(n,i,s.getItemType()),function(e,t,r){zt(t.isDragging(),"Cannot call hover while not dragging."),zt(!t.didDrop(),"Cannot call hover after drop.");for(let t=0;t<e.length;t++){const n=e[t];zt(e.lastIndexOf(n)===t,"Expected targetIds to be unique in the passed array."),zt(r.getTarget(n),"Expected targetIds to be registered.")}}(n,s,i),function(e,t,r){e.forEach((function(e){r.getTarget(e).hover(t,e)}))}(n,s,i),{type:Sr,payload:{targetIds:n,clientOffset:r||null}}}}function Mr(e){return function(){if(e.getMonitor().isDragging())return{type:Tr}}}class Zr{receiveBackend(e){this.backend=e}getMonitor(){return this.monitor}getBackend(){return this.backend}getRegistry(){return this.monitor.registry}getActions(){const e=this,{dispatch:t}=this.store,r=function(e){return{beginDrag:Dr(e),publishDragSource:Mr(e),hover:Ar(e),drop:Nr(e),endDrag:Pr(e)}}(this);return Object.keys(r).reduce(((n,s)=>{const i=r[s];var a;return n[s]=(a=i,(...r)=>{const n=a.apply(e,r);void 0!==n&&t(n)}),n}),{})}dispatch(e){this.store.dispatch(e)}constructor(e,t){this.isSetUp=!1,this.handleRefCountChange=()=>{const e=this.store.getState().refCount>0;this.backend&&(e&&!this.isSetUp?(this.backend.setup(),this.isSetUp=!0):!e&&this.isSetUp&&(this.backend.teardown(),this.isSetUp=!1))},this.store=e,this.monitor=t,e.subscribe(this.handleRefCountChange)}}function Lr(e,t){return{x:e.x-t.x,y:e.y-t.y}}const Ur=[],$r=[];Ur.__IS_NONE__=!0,$r.__IS_ALL__=!0;class Br{subscribeToStateChange(e,t={}){const{handlerIds:r}=t;zt("function"==typeof e,"listener must be a function."),zt(void 0===r||Array.isArray(r),"handlerIds, when specified, must be an array of strings.");let n=this.store.getState().stateId;return this.store.subscribe((()=>{const t=this.store.getState(),s=t.stateId;try{const i=s===n||s===n+1&&!function(e,t){return e!==Ur&&(e===$r||void 0===t||(r=e,t.filter((e=>r.indexOf(e)>-1))).length>0);var r}(t.dirtyHandlerIds,r);i||e()}finally{n=s}}))}subscribeToOffsetChange(e){zt("function"==typeof e,"listener must be a function.");let t=this.store.getState().dragOffset;return this.store.subscribe((()=>{const r=this.store.getState().dragOffset;r!==t&&(t=r,e())}))}canDragSource(e){if(!e)return!1;const t=this.registry.getSource(e);return zt(t,`Expected to find a valid source. sourceId=${e}`),!this.isDragging()&&t.canDrag(this,e)}canDropOnTarget(e){if(!e)return!1;const t=this.registry.getTarget(e);return zt(t,`Expected to find a valid target. targetId=${e}`),!(!this.isDragging()||this.didDrop())&&(Rr(this.registry.getTargetType(e),this.getItemType())&&t.canDrop(this,e))}isDragging(){return Boolean(this.getItemType())}isDraggingSource(e){if(!e)return!1;const t=this.registry.getSource(e,!0);return zt(t,`Expected to find a valid source. sourceId=${e}`),!(!this.isDragging()||!this.isSourcePublic())&&(this.registry.getSourceType(e)===this.getItemType()&&t.isDragging(this,e))}isOverTarget(e,t={shallow:!1}){if(!e)return!1;const{shallow:r}=t;if(!this.isDragging())return!1;const n=this.registry.getTargetType(e),s=this.getItemType();if(s&&!Rr(n,s))return!1;const i=this.getTargetIds();if(!i.length)return!1;const a=i.indexOf(e);return r?a===i.length-1:a>-1}getItemType(){return this.store.getState().dragOperation.itemType}getItem(){return this.store.getState().dragOperation.item}getSourceId(){return this.store.getState().dragOperation.sourceId}getTargetIds(){return this.store.getState().dragOperation.targetIds}getDropResult(){return this.store.getState().dragOperation.dropResult}didDrop(){return this.store.getState().dragOperation.didDrop}isSourcePublic(){return Boolean(this.store.getState().dragOperation.isSourcePublic)}getInitialClientOffset(){return this.store.getState().dragOffset.initialClientOffset}getInitialSourceClientOffset(){return this.store.getState().dragOffset.initialSourceClientOffset}getClientOffset(){return this.store.getState().dragOffset.clientOffset}getSourceClientOffset(){return function(e){const{clientOffset:t,initialClientOffset:r,initialSourceClientOffset:n}=e;return t&&r&&n?Lr((i=n,{x:(s=t).x+i.x,y:s.y+i.y}),r):null;var s,i}(this.store.getState().dragOffset)}getDifferenceFromInitialOffset(){return function(e){const{clientOffset:t,initialClientOffset:r}=e;return t&&r?Lr(t,r):null}(this.store.getState().dragOffset)}constructor(e,t){this.store=e,this.registry=t}}const Fr="undefined"!=typeof global?global:self,zr=Fr.MutationObserver||Fr.WebKitMutationObserver;function Hr(e){return function(){const t=setTimeout(n,0),r=setInterval(n,50);function n(){clearTimeout(t),clearInterval(r),e()}}}const Vr="function"==typeof zr?function(e){let t=1;const r=new zr(e),n=document.createTextNode("");return r.observe(n,{characterData:!0}),function(){t=-t,n.data=t}}:Hr;class qr{call(){try{this.task&&this.task()}catch(e){this.onError(e)}finally{this.task=null,this.release(this)}}constructor(e,t){this.onError=e,this.release=t,this.task=null}}const Wr=new class{enqueueTask(e){const{queue:t,requestFlush:r}=this;t.length||(r(),this.flushing=!0),t[t.length]=e}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{const{queue:e}=this;for(;this.index<e.length;){const t=this.index;if(this.index++,e[t].call(),this.index>this.capacity){for(let t=0,r=e.length-this.index;t<r;t++)e[t]=e[t+this.index];e.length-=this.index,this.index=0}}e.length=0,this.index=0,this.flushing=!1},this.registerPendingError=e=>{this.pendingErrors.push(e),this.requestErrorThrow()},this.requestFlush=Vr(this.flush),this.requestErrorThrow=Hr((()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()}))}},Kr=new class{create(e){const t=this.freeTasks,r=t.length?t.pop():new qr(this.onError,(e=>t[t.length]=e));return r.task=e,r}constructor(e){this.onError=e,this.freeTasks=[]}}(Wr.registerPendingError),Xr="dnd-core/ADD_SOURCE",Gr="dnd-core/ADD_TARGET",Yr="dnd-core/REMOVE_SOURCE",Jr="dnd-core/REMOVE_TARGET";function Qr(e,t){t&&Array.isArray(e)?e.forEach((e=>Qr(e,!1))):zt("string"==typeof e||"symbol"==typeof e,t?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}var en;!function(e){e.SOURCE="SOURCE",e.TARGET="TARGET"}(en||(en={}));let tn=0;function rn(e){switch(e[0]){case"S":return en.SOURCE;case"T":return en.TARGET;default:throw new Error(`Cannot parse handler ID: ${e}`)}}function nn(e,t){const r=e.entries();let n=!1;do{const{done:e,value:[,s]}=r.next();if(s===t)return!0;n=!!e}while(!n);return!1}class sn{addSource(e,t){Qr(e),function(e){zt("function"==typeof e.canDrag,"Expected canDrag to be a function."),zt("function"==typeof e.beginDrag,"Expected beginDrag to be a function."),zt("function"==typeof e.endDrag,"Expected endDrag to be a function.")}(t);const r=this.addHandler(en.SOURCE,e,t);return this.store.dispatch(function(e){return{type:Xr,payload:{sourceId:e}}}(r)),r}addTarget(e,t){Qr(e,!0),function(e){zt("function"==typeof e.canDrop,"Expected canDrop to be a function."),zt("function"==typeof e.hover,"Expected hover to be a function."),zt("function"==typeof e.drop,"Expected beginDrag to be a function.")}(t);const r=this.addHandler(en.TARGET,e,t);return this.store.dispatch(function(e){return{type:Gr,payload:{targetId:e}}}(r)),r}containsHandler(e){return nn(this.dragSources,e)||nn(this.dropTargets,e)}getSource(e,t=!1){return zt(this.isSourceId(e),"Expected a valid source ID."),t&&e===this.pinnedSourceId?this.pinnedSource:this.dragSources.get(e)}getTarget(e){return zt(this.isTargetId(e),"Expected a valid target ID."),this.dropTargets.get(e)}getSourceType(e){return zt(this.isSourceId(e),"Expected a valid source ID."),this.types.get(e)}getTargetType(e){return zt(this.isTargetId(e),"Expected a valid target ID."),this.types.get(e)}isSourceId(e){return rn(e)===en.SOURCE}isTargetId(e){return rn(e)===en.TARGET}removeSource(e){var t;zt(this.getSource(e),"Expected an existing source."),this.store.dispatch(function(e){return{type:Yr,payload:{sourceId:e}}}(e)),t=()=>{this.dragSources.delete(e),this.types.delete(e)},Wr.enqueueTask(Kr.create(t))}removeTarget(e){zt(this.getTarget(e),"Expected an existing target."),this.store.dispatch(function(e){return{type:Jr,payload:{targetId:e}}}(e)),this.dropTargets.delete(e),this.types.delete(e)}pinSource(e){const t=this.getSource(e);zt(t,"Expected an existing source."),this.pinnedSourceId=e,this.pinnedSource=t}unpinSource(){zt(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}addHandler(e,t,r){const n=function(e){const t=(tn++).toString();switch(e){case en.SOURCE:return`S${t}`;case en.TARGET:return`T${t}`;default:throw new Error(`Unknown Handler Role: ${e}`)}}(e);return this.types.set(n,t),e===en.SOURCE?this.dragSources.set(n,r):e===en.TARGET&&this.dropTargets.set(n,r),n}constructor(e){this.types=new Map,this.dragSources=new Map,this.dropTargets=new Map,this.pinnedSourceId=null,this.pinnedSource=null,this.store=e}}const an=(e,t)=>e===t;function on(e=Ur,t){switch(t.type){case Sr:break;case Xr:case Gr:case Jr:case Yr:return Ur;default:return $r}const{targetIds:r=[],prevTargetIds:n=[]}=t.payload,s=function(e,t){const r=new Map,n=e=>{r.set(e,r.has(e)?r.get(e)+1:1)};e.forEach(n),t.forEach(n);const s=[];return r.forEach(((e,t)=>{1===e&&s.push(t)})),s}(r,n);if(!(s.length>0)&&function(e,t,r=an){if(e.length!==t.length)return!1;for(let n=0;n<e.length;++n)if(!r(e[n],t[n]))return!1;return!0}(r,n))return Ur;const i=n[n.length-1],a=r[r.length-1];return i!==a&&(i&&s.push(i),a&&s.push(a)),s}function cn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const dn={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function un(e=dn,t){const{payload:r}=t;switch(t.type){case xr:case wr:return{initialSourceClientOffset:r.sourceClientOffset,initialClientOffset:r.clientOffset,clientOffset:r.clientOffset};case Sr:return n=e.clientOffset,s=r.clientOffset,!n&&!s||n&&s&&n.x===s.x&&n.y===s.y?e:function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){cn(e,t,r[t])}))}return e}({},e,{clientOffset:r.clientOffset});case kr:case Or:return dn;default:return e}var n,s}function ln(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function hn(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){ln(e,t,r[t])}))}return e}const fn={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function pn(e=fn,t){const{payload:r}=t;switch(t.type){case wr:return hn({},e,{itemType:r.itemType,item:r.item,sourceId:r.sourceId,isSourcePublic:r.isSourcePublic,dropResult:null,didDrop:!1});case Tr:return hn({},e,{isSourcePublic:!0});case Sr:return hn({},e,{targetIds:r.targetIds});case Jr:return-1===e.targetIds.indexOf(r.targetId)?e:hn({},e,{targetIds:(n=e.targetIds,s=r.targetId,n.filter((e=>e!==s)))});case Or:return hn({},e,{dropResult:r.dropResult,didDrop:!0,targetIds:[]});case kr:return hn({},e,{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}var n,s}function gn(e=0,t){switch(t.type){case Xr:case Gr:return e+1;case Yr:case Jr:return e-1;default:return e}}function mn(e=0){return e+1}function vn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function yn(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){vn(e,t,r[t])}))}return e}function bn(e={},t){return{dirtyHandlerIds:on(e.dirtyHandlerIds,{type:t.type,payload:yn({},t.payload,{prevTargetIds:(r=e,n=[],"dragOperation.targetIds".split(".").reduce(((e,t)=>e&&e[t]?e[t]:n||null),r))})}),dragOffset:un(e.dragOffset,t),refCount:gn(e.refCount,t),dragOperation:pn(e.dragOperation,t),stateId:mn(e.stateId)};var r,n}function xn(e,t=void 0,r={},n=!1){const s=function(e){const t="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__;return _r(bn,e&&t&&t({name:"dnd-core",instanceId:"dnd-core"}))}(n),i=new Br(s,new sn(s)),a=new Zr(s,i),o=e(a,t,r);return a.receiveBackend(o),a}let wn=0;const Tn=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__");var Sn=(0,Vt.memo)((function(e){var{children:t}=e,r=function(e,t){if(null==e)return{};var r,n,s=function(e,t){if(null==e)return{};var r,n,s={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(s[r]=e[r]);return s}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}(e,["children"]);const[n,s]=function(e){if("manager"in e)return[{dragDropManager:e.manager},!1];return[function(e,t=On(),r,n){const s=t;return s[Tn]||(s[Tn]={dragDropManager:xn(e,t,r,n)}),s[Tn]}(e.backend,e.context,e.options,e.debugMode),!e.context]}(r);return(0,Vt.useEffect)((()=>{if(s){const e=On();return++wn,()=>{0==--wn&&(e[Tn]=null)}}}),[]),(0,$t.jsx)(rr.Provider,{value:n,children:t})}));function On(){return"undefined"!=typeof global?global:window}function kn(e){let t=null;return()=>(null==t&&(t=e()),t)}class In{enter(e){const t=this.entered.length;return this.entered=function(e,t){const r=new Set,n=e=>r.add(e);e.forEach(n),t.forEach(n);const s=[];return r.forEach((e=>s.push(e))),s}(this.entered.filter((t=>this.isNodeInDocument(t)&&(!t.contains||t.contains(e)))),[e]),0===t&&this.entered.length>0}leave(e){const t=this.entered.length;var r,n;return this.entered=(r=this.entered.filter(this.isNodeInDocument),n=e,r.filter((e=>e!==n))),t>0&&0===this.entered.length}reset(){this.entered=[]}constructor(e){this.entered=[],this.isNodeInDocument=e}}class Cn{initializeExposedProperties(){Object.keys(this.config.exposeProperties).forEach((e=>{Object.defineProperty(this.item,e,{configurable:!0,enumerable:!0,get:()=>(console.warn(`Browser doesn't allow reading "${e}" until the drop event.`),null)})}))}loadDataTransfer(e){if(e){const t={};Object.keys(this.config.exposeProperties).forEach((r=>{const n=this.config.exposeProperties[r];null!=n&&(t[r]={value:n(e,this.config.matchesTypes),configurable:!0,enumerable:!0})})),Object.defineProperties(this.item,t)}}canDrag(){return!0}beginDrag(){return this.item}isDragging(e,t){return t===e.getSourceId()}endDrag(){}constructor(e){this.config=e,this.item={},this.initializeExposedProperties()}}const Dn="__NATIVE_FILE__",En="__NATIVE_URL__",jn="__NATIVE_TEXT__",Nn="__NATIVE_HTML__";function Pn(e,t,r){const n=t.reduce(((t,r)=>t||e.getData(r)),"");return null!=n?n:r}const Rn={[Dn]:{exposeProperties:{files:e=>Array.prototype.slice.call(e.files),items:e=>e.items,dataTransfer:e=>e},matchesTypes:["Files"]},[Nn]:{exposeProperties:{html:(e,t)=>Pn(e,t,""),dataTransfer:e=>e},matchesTypes:["Html","text/html"]},[En]:{exposeProperties:{urls:(e,t)=>Pn(e,t,"").split("\n"),dataTransfer:e=>e},matchesTypes:["Url","text/uri-list"]},[jn]:{exposeProperties:{text:(e,t)=>Pn(e,t,""),dataTransfer:e=>e},matchesTypes:["Text","text/plain"]}};function An(e){if(!e)return null;const t=Array.prototype.slice.call(e.types||[]);return Object.keys(Rn).filter((e=>{const r=Rn[e];return!!(null==r?void 0:r.matchesTypes)&&r.matchesTypes.some((e=>t.indexOf(e)>-1))}))[0]||null}const Mn=kn((()=>/firefox/i.test(navigator.userAgent))),Zn=kn((()=>Boolean(window.safari)));class Ln{interpolate(e){const{xs:t,ys:r,c1s:n,c2s:s,c3s:i}=this;let a=t.length-1;if(e===t[a])return r[a];let o,c=0,d=i.length-1;for(;c<=d;){o=Math.floor(.5*(c+d));const n=t[o];if(n<e)c=o+1;else{if(!(n>e))return r[o];d=o-1}}a=Math.max(0,d);const u=e-t[a],l=u*u;return r[a]+n[a]*u+s[a]*l+i[a]*u*l}constructor(e,t){const{length:r}=e,n=[];for(let e=0;e<r;e++)n.push(e);n.sort(((t,r)=>e[t]<e[r]?-1:1));const s=[],i=[],a=[];let o,c;for(let n=0;n<r-1;n++)o=e[n+1]-e[n],c=t[n+1]-t[n],i.push(o),s.push(c),a.push(c/o);const d=[a[0]];for(let e=0;e<i.length-1;e++){const t=a[e],r=a[e+1];if(t*r<=0)d.push(0);else{o=i[e];const n=i[e+1],s=o+n;d.push(3*s/((s+n)/t+(s+o)/r))}}d.push(a[a.length-1]);const u=[],l=[];let h;for(let e=0;e<d.length-1;e++){h=a[e];const t=d[e],r=1/i[e],n=t+d[e+1]-h-h;u.push((h-t-n)*r),l.push(n*r*r)}this.xs=e,this.ys=t,this.c1s=d,this.c2s=u,this.c3s=l}}function Un(e){const t=1===e.nodeType?e:e.parentElement;if(!t)return null;const{top:r,left:n}=t.getBoundingClientRect();return{x:n,y:r}}function $n(e){return{x:e.clientX,y:e.clientY}}class Bn{get window(){return this.globalContext?this.globalContext:"undefined"!=typeof window?window:void 0}get document(){var e;return(null===(e=this.globalContext)||void 0===e?void 0:e.document)?this.globalContext.document:this.window?this.window.document:void 0}get rootElement(){var e;return(null===(e=this.optionsArgs)||void 0===e?void 0:e.rootElement)||this.window}constructor(e,t){this.ownerDocument=null,this.globalContext=e,this.optionsArgs=t}}function Fn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function zn(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){Fn(e,t,r[t])}))}return e}class Hn{profile(){var e,t;return{sourcePreviewNodes:this.sourcePreviewNodes.size,sourcePreviewNodeOptions:this.sourcePreviewNodeOptions.size,sourceNodeOptions:this.sourceNodeOptions.size,sourceNodes:this.sourceNodes.size,dragStartSourceIds:(null===(e=this.dragStartSourceIds)||void 0===e?void 0:e.length)||0,dropTargetIds:this.dropTargetIds.length,dragEnterTargetIds:this.dragEnterTargetIds.length,dragOverTargetIds:(null===(t=this.dragOverTargetIds)||void 0===t?void 0:t.length)||0}}get window(){return this.options.window}get document(){return this.options.document}get rootElement(){return this.options.rootElement}setup(){const e=this.rootElement;if(void 0!==e){if(e.__isReactDndBackendSetUp)throw new Error("Cannot have two HTML5 backends at the same time.");e.__isReactDndBackendSetUp=!0,this.addEventListeners(e)}}teardown(){const e=this.rootElement;var t;void 0!==e&&(e.__isReactDndBackendSetUp=!1,this.removeEventListeners(this.rootElement),this.clearCurrentDragSourceNode(),this.asyncEndDragFrameId&&(null===(t=this.window)||void 0===t||t.cancelAnimationFrame(this.asyncEndDragFrameId)))}connectDragPreview(e,t,r){return this.sourcePreviewNodeOptions.set(e,r),this.sourcePreviewNodes.set(e,t),()=>{this.sourcePreviewNodes.delete(e),this.sourcePreviewNodeOptions.delete(e)}}connectDragSource(e,t,r){this.sourceNodes.set(e,t),this.sourceNodeOptions.set(e,r);const n=t=>this.handleDragStart(t,e),s=e=>this.handleSelectStart(e);return t.setAttribute("draggable","true"),t.addEventListener("dragstart",n),t.addEventListener("selectstart",s),()=>{this.sourceNodes.delete(e),this.sourceNodeOptions.delete(e),t.removeEventListener("dragstart",n),t.removeEventListener("selectstart",s),t.setAttribute("draggable","false")}}connectDropTarget(e,t){const r=t=>this.handleDragEnter(t,e),n=t=>this.handleDragOver(t,e),s=t=>this.handleDrop(t,e);return t.addEventListener("dragenter",r),t.addEventListener("dragover",n),t.addEventListener("drop",s),()=>{t.removeEventListener("dragenter",r),t.removeEventListener("dragover",n),t.removeEventListener("drop",s)}}addEventListeners(e){e.addEventListener&&(e.addEventListener("dragstart",this.handleTopDragStart),e.addEventListener("dragstart",this.handleTopDragStartCapture,!0),e.addEventListener("dragend",this.handleTopDragEndCapture,!0),e.addEventListener("dragenter",this.handleTopDragEnter),e.addEventListener("dragenter",this.handleTopDragEnterCapture,!0),e.addEventListener("dragleave",this.handleTopDragLeaveCapture,!0),e.addEventListener("dragover",this.handleTopDragOver),e.addEventListener("dragover",this.handleTopDragOverCapture,!0),e.addEventListener("drop",this.handleTopDrop),e.addEventListener("drop",this.handleTopDropCapture,!0))}removeEventListeners(e){e.removeEventListener&&(e.removeEventListener("dragstart",this.handleTopDragStart),e.removeEventListener("dragstart",this.handleTopDragStartCapture,!0),e.removeEventListener("dragend",this.handleTopDragEndCapture,!0),e.removeEventListener("dragenter",this.handleTopDragEnter),e.removeEventListener("dragenter",this.handleTopDragEnterCapture,!0),e.removeEventListener("dragleave",this.handleTopDragLeaveCapture,!0),e.removeEventListener("dragover",this.handleTopDragOver),e.removeEventListener("dragover",this.handleTopDragOverCapture,!0),e.removeEventListener("drop",this.handleTopDrop),e.removeEventListener("drop",this.handleTopDropCapture,!0))}getCurrentSourceNodeOptions(){const e=this.monitor.getSourceId(),t=this.sourceNodeOptions.get(e);return zn({dropEffect:this.altKeyPressed?"copy":"move"},t||{})}getCurrentDropEffect(){return this.isDraggingNativeItem()?"copy":this.getCurrentSourceNodeOptions().dropEffect}getCurrentSourcePreviewNodeOptions(){const e=this.monitor.getSourceId();return zn({anchorX:.5,anchorY:.5,captureDraggingState:!1},this.sourcePreviewNodeOptions.get(e)||{})}isDraggingNativeItem(){const e=this.monitor.getItemType();return Object.keys(n).some((t=>n[t]===e))}beginDragNativeItem(e,t){this.clearCurrentDragSourceNode(),this.currentNativeSource=function(e,t){const r=Rn[e];if(!r)throw new Error(`native type ${e} has no configuration`);const n=new Cn(r);return n.loadDataTransfer(t),n}(e,t),this.currentNativeHandle=this.registry.addSource(e,this.currentNativeSource),this.actions.beginDrag([this.currentNativeHandle])}setCurrentDragSourceNode(e){this.clearCurrentDragSourceNode(),this.currentDragSourceNode=e,this.mouseMoveTimeoutTimer=setTimeout((()=>{var e;return null===(e=this.rootElement)||void 0===e?void 0:e.addEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)}),1e3)}clearCurrentDragSourceNode(){var e;return!!this.currentDragSourceNode&&(this.currentDragSourceNode=null,this.rootElement&&(null===(e=this.window)||void 0===e||e.clearTimeout(this.mouseMoveTimeoutTimer||void 0),this.rootElement.removeEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)),this.mouseMoveTimeoutTimer=null,!0)}handleDragStart(e,t){e.defaultPrevented||(this.dragStartSourceIds||(this.dragStartSourceIds=[]),this.dragStartSourceIds.unshift(t))}handleDragEnter(e,t){this.dragEnterTargetIds.unshift(t)}handleDragOver(e,t){null===this.dragOverTargetIds&&(this.dragOverTargetIds=[]),this.dragOverTargetIds.unshift(t)}handleDrop(e,t){this.dropTargetIds.unshift(t)}constructor(e,t,r){this.sourcePreviewNodes=new Map,this.sourcePreviewNodeOptions=new Map,this.sourceNodes=new Map,this.sourceNodeOptions=new Map,this.dragStartSourceIds=null,this.dropTargetIds=[],this.dragEnterTargetIds=[],this.currentNativeSource=null,this.currentNativeHandle=null,this.currentDragSourceNode=null,this.altKeyPressed=!1,this.mouseMoveTimeoutTimer=null,this.asyncEndDragFrameId=null,this.dragOverTargetIds=null,this.lastClientOffset=null,this.hoverRafId=null,this.getSourceClientOffset=e=>{const t=this.sourceNodes.get(e);return t&&Un(t)||null},this.endDragNativeItem=()=>{this.isDraggingNativeItem()&&(this.actions.endDrag(),this.currentNativeHandle&&this.registry.removeSource(this.currentNativeHandle),this.currentNativeHandle=null,this.currentNativeSource=null)},this.isNodeInDocument=e=>Boolean(e&&this.document&&this.document.body&&this.document.body.contains(e)),this.endDragIfSourceWasRemovedFromDOM=()=>{const e=this.currentDragSourceNode;null==e||this.isNodeInDocument(e)||(this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover())},this.scheduleHover=e=>{null===this.hoverRafId&&"undefined"!=typeof requestAnimationFrame&&(this.hoverRafId=requestAnimationFrame((()=>{this.monitor.isDragging()&&this.actions.hover(e||[],{clientOffset:this.lastClientOffset}),this.hoverRafId=null})))},this.cancelHover=()=>{null!==this.hoverRafId&&"undefined"!=typeof cancelAnimationFrame&&(cancelAnimationFrame(this.hoverRafId),this.hoverRafId=null)},this.handleTopDragStartCapture=()=>{this.clearCurrentDragSourceNode(),this.dragStartSourceIds=[]},this.handleTopDragStart=e=>{if(e.defaultPrevented)return;const{dragStartSourceIds:t}=this;this.dragStartSourceIds=null;const r=$n(e);this.monitor.isDragging()&&(this.actions.endDrag(),this.cancelHover()),this.actions.beginDrag(t||[],{publishSource:!1,getSourceClientOffset:this.getSourceClientOffset,clientOffset:r});const{dataTransfer:n}=e,s=An(n);if(this.monitor.isDragging()){if(n&&"function"==typeof n.setDragImage){const e=this.monitor.getSourceId(),t=this.sourceNodes.get(e),s=this.sourcePreviewNodes.get(e)||t;if(s){const{anchorX:e,anchorY:i,offsetX:a,offsetY:o}=this.getCurrentSourcePreviewNodeOptions(),c=function(e,t,r,n,s){const i="IMG"===(a=t).nodeName&&(Mn()||!(null===(o=document.documentElement)||void 0===o?void 0:o.contains(a)));var a,o;const c=Un(i?e:t),d={x:r.x-c.x,y:r.y-c.y},{offsetWidth:u,offsetHeight:l}=e,{anchorX:h,anchorY:f}=n,{dragPreviewWidth:p,dragPreviewHeight:g}=function(e,t,r,n){let s=e?t.width:r,i=e?t.height:n;return Zn()&&e&&(i/=window.devicePixelRatio,s/=window.devicePixelRatio),{dragPreviewWidth:s,dragPreviewHeight:i}}(i,t,u,l),{offsetX:m,offsetY:v}=s,y=0===v||v;return{x:0===m||m?m:new Ln([0,.5,1],[d.x,d.x/u*p,d.x+p-u]).interpolate(h),y:y?v:(()=>{let e=new Ln([0,.5,1],[d.y,d.y/l*g,d.y+g-l]).interpolate(f);return Zn()&&i&&(e+=(window.devicePixelRatio-1)*g),e})()}}(t,s,r,{anchorX:e,anchorY:i},{offsetX:a,offsetY:o});n.setDragImage(s,c.x,c.y)}}try{null==n||n.setData("application/json",{})}catch(e){}this.setCurrentDragSourceNode(e.target);const{captureDraggingState:t}=this.getCurrentSourcePreviewNodeOptions();t?this.actions.publishDragSource():setTimeout((()=>this.actions.publishDragSource()),0)}else if(s)this.beginDragNativeItem(s);else{if(n&&!n.types&&(e.target&&!e.target.hasAttribute||!e.target.hasAttribute("draggable")))return;e.preventDefault()}},this.handleTopDragEndCapture=()=>{this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleTopDragEnterCapture=e=>{var t;if(this.dragEnterTargetIds=[],this.isDraggingNativeItem()&&(null===(t=this.currentNativeSource)||void 0===t||t.loadDataTransfer(e.dataTransfer)),!this.enterLeaveCounter.enter(e.target)||this.monitor.isDragging())return;const{dataTransfer:r}=e,n=An(r);n&&this.beginDragNativeItem(n,r)},this.handleTopDragEnter=e=>{const{dragEnterTargetIds:t}=this;this.dragEnterTargetIds=[],this.monitor.isDragging()&&(this.altKeyPressed=e.altKey,t.length>0&&this.actions.hover(t,{clientOffset:$n(e)}),t.some((e=>this.monitor.canDropOnTarget(e)))&&(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=this.getCurrentDropEffect())))},this.handleTopDragOverCapture=e=>{var t;this.dragOverTargetIds=[],this.isDraggingNativeItem()&&(null===(t=this.currentNativeSource)||void 0===t||t.loadDataTransfer(e.dataTransfer))},this.handleTopDragOver=e=>{const{dragOverTargetIds:t}=this;if(this.dragOverTargetIds=[],!this.monitor.isDragging())return e.preventDefault(),void(e.dataTransfer&&(e.dataTransfer.dropEffect="none"));this.altKeyPressed=e.altKey,this.lastClientOffset=$n(e),this.scheduleHover(t),(t||[]).some((e=>this.monitor.canDropOnTarget(e)))?(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=this.getCurrentDropEffect())):this.isDraggingNativeItem()?e.preventDefault():(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="none"))},this.handleTopDragLeaveCapture=e=>{this.isDraggingNativeItem()&&e.preventDefault(),this.enterLeaveCounter.leave(e.target)&&(this.isDraggingNativeItem()&&setTimeout((()=>this.endDragNativeItem()),0),this.cancelHover())},this.handleTopDropCapture=e=>{var t;this.dropTargetIds=[],this.isDraggingNativeItem()?(e.preventDefault(),null===(t=this.currentNativeSource)||void 0===t||t.loadDataTransfer(e.dataTransfer)):An(e.dataTransfer)&&e.preventDefault(),this.enterLeaveCounter.reset()},this.handleTopDrop=e=>{const{dropTargetIds:t}=this;this.dropTargetIds=[],this.actions.hover(t,{clientOffset:$n(e)}),this.actions.drop({dropEffect:this.getCurrentDropEffect()}),this.isDraggingNativeItem()?this.endDragNativeItem():this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleSelectStart=e=>{const t=e.target;"function"==typeof t.dragDrop&&("INPUT"===t.tagName||"SELECT"===t.tagName||"TEXTAREA"===t.tagName||t.isContentEditable||(e.preventDefault(),t.dragDrop()))},this.options=new Bn(t,r),this.actions=e.getActions(),this.monitor=e.getMonitor(),this.registry=e.getRegistry(),this.enterLeaveCounter=new In(this.isNodeInDocument)}}const Vn=function(e,t,r){return new Hn(e,t,r)};class qn extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const t=super.get(e);return super.has(e)&&void 0!==t&&(this.delete(e),super.set(e,t)),t}set(e,t){if(super.set(e,t),this.maxSize&&this.size>this.maxSize){const e=this.keys().next().value;e&&this.delete(e)}return this}}const Wn="2.21.55";let Kn=({docsBaseUrl:e,docsPath:t="",docsSlug:r})=>t?`${e??"https://viem.sh"}${t}${r?`#${r}`:""}`:void 0,Xn=`viem@${Wn}`;class Gn extends Error{constructor(e,t={}){const r=t.cause instanceof Gn?t.cause.details:t.cause?.message?t.cause.message:t.details,n=t.cause instanceof Gn&&t.cause.docsPath||t.docsPath,s=Kn?.({...t,docsPath:n});super([e||"An error occurred.","",...t.metaMessages?[...t.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...r?[`Details: ${r}`]:[],...Xn?[`Version: ${Xn}`]:[]].join("\n"),t.cause?{cause:t.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=r,this.docsPath=n,this.metaMessages=t.metaMessages,this.name=t.name??this.name,this.shortMessage=e,this.version=Wn}walk(e){return Yn(this,e)}}function Yn(e,t){return t?.(e)?e:e&&"object"==typeof e&&"cause"in e&&void 0!==e.cause?Yn(e.cause,t):t?null:e}function Jn(e,{strict:t=!0}={}){return!!e&&"string"==typeof e&&(t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x"))}class Qn extends Gn{constructor({size:e,targetSize:t,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${e}) exceeds padding size (${t}).`,{name:"SizeExceedsPaddingSizeError"})}}function es(e,{dir:t,size:r=32}={}){return"string"==typeof e?function(e,{dir:t,size:r=32}={}){if(null===r)return e;const n=e.replace("0x","");if(n.length>2*r)throw new Qn({size:Math.ceil(n.length/2),targetSize:r,type:"hex"});return`0x${n["right"===t?"padEnd":"padStart"](2*r,"0")}`}(e,{dir:t,size:r}):function(e,{dir:t,size:r=32}={}){if(null===r)return e;if(e.length>r)throw new Qn({size:e.length,targetSize:r,type:"bytes"});const n=new Uint8Array(r);for(let s=0;s<r;s++){const i="right"===t;n[i?s:r-s-1]=e[i?s:e.length-s-1]}return n}(e,{dir:t,size:r})}class ts extends Gn{constructor({max:e,min:t,signed:r,size:n,value:s}){super(`Number "${s}" is not in safe ${n?`${8*n}-bit ${r?"signed":"unsigned"} `:""}integer range ${e?`(${t} to ${e})`:`(above ${t})`}`,{name:"IntegerOutOfRangeError"})}}class rs extends Gn{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed ${t} bytes. Given size: ${e} bytes.`,{name:"SizeOverflowError"})}}function ns(e){return Jn(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}function ss(e,{size:t}){if(ns(e)>t)throw new rs({givenSize:ns(e),maxSize:t})}function is(e,t={}){const{signed:r,size:n}=t,s=BigInt(e);let i;n?i=r?(1n<<8n*BigInt(n)-1n)-1n:2n**(8n*BigInt(n))-1n:"number"==typeof e&&(i=BigInt(Number.MAX_SAFE_INTEGER));const a="bigint"==typeof i&&r?-i-1n:0;if(i&&s>i||s<a){const t="bigint"==typeof e?"n":"";throw new ts({max:i?`${i}${t}`:void 0,min:`${a}${t}`,signed:r,size:n,value:`${e}${t}`})}const o=`0x${(r&&s<0?(1n<<BigInt(8*n))+BigInt(s):s).toString(16)}`;return n?es(o,{size:n}):o}const as=new TextEncoder;const os={zero:48,nine:57,A:65,F:70,a:97,f:102};function cs(e){return e>=os.zero&&e<=os.nine?e-os.zero:e>=os.A&&e<=os.F?e-(os.A-10):e>=os.a&&e<=os.f?e-(os.a-10):void 0}function ds(e,t={}){let r=e;t.size&&(ss(r,{size:t.size}),r=es(r,{dir:"right",size:t.size}));let n=r.slice(2);n.length%2&&(n=`0${n}`);const s=n.length/2,i=new Uint8Array(s);for(let e=0,t=0;e<s;e++){const r=cs(n.charCodeAt(t++)),s=cs(n.charCodeAt(t++));if(void 0===r||void 0===s)throw new Gn(`Invalid byte sequence ("${n[t-2]}${n[t-1]}" in "${n}").`);i[e]=16*r+s}return i}function us(e,t={}){const r=as.encode(e);return"number"==typeof t.size?(ss(r,{size:t.size}),es(r,{dir:"right",size:t.size})):r}function ls(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function hs(e,...t){if(!((r=e)instanceof Uint8Array||ArrayBuffer.isView(r)&&"Uint8Array"===r.constructor.name))throw new Error("Uint8Array expected");var r;if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function fs(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}const ps=BigInt(2**32-1),gs=BigInt(32);function ms(e,t=!1){return t?{h:Number(e&ps),l:Number(e>>gs&ps)}:{h:0|Number(e>>gs&ps),l:0|Number(e&ps)}}function vs(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let s=0;s<e.length;s++){const{h:i,l:a}=ms(e[s],t);[r[s],n[s]]=[i,a]}return[r,n]}const ys=(()=>68===new Uint8Array(new Uint32Array([287454020]).buffer)[0])();function _s(e){for(let r=0;r<e.length;r++)e[r]=(t=e[r])<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255;var t}function bs(e){return"string"==typeof e&&(e=function(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}(e)),hs(e),e}class xs{clone(){return this._cloneInto()}}const ws=[],Ts=[],Ss=[],Os=BigInt(0),ks=BigInt(1),Is=BigInt(2),Cs=BigInt(7),Ds=BigInt(256),Es=BigInt(113);for(let e=0,t=ks,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],ws.push(2*(5*n+r)),Ts.push((e+1)*(e+2)/2%64);let s=Os;for(let e=0;e<7;e++)t=(t<<ks^(t>>Cs)*Es)%Ds,t&Is&&(s^=ks<<(ks<<BigInt(e))-ks);Ss.push(s)}const[js,Ns]=vs(Ss,!0),Ps=(e,t,r)=>r>32?((e,t,r)=>t<<r-32|e>>>64-r)(e,t,r):((e,t,r)=>e<<r|t>>>32-r)(e,t,r),Rs=(e,t,r)=>r>32?((e,t,r)=>e<<r-32|t>>>64-r)(e,t,r):((e,t,r)=>t<<r|e>>>32-r)(e,t,r);class As extends xs{constructor(e,t,r,n=!1,s=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=n,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,ls(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");var i;this.state=new Uint8Array(200),this.state32=(i=this.state,new Uint32Array(i.buffer,i.byteOffset,Math.floor(i.byteLength/4)))}keccak(){ys||_s(this.state32),function(e,t=24){const r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let t=0;t<10;t++)r[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){const n=(t+8)%10,s=(t+2)%10,i=r[s],a=r[s+1],o=Ps(i,a,1)^r[n],c=Rs(i,a,1)^r[n+1];for(let r=0;r<50;r+=10)e[t+r]^=o,e[t+r+1]^=c}let t=e[2],s=e[3];for(let r=0;r<24;r++){const n=Ts[r],i=Ps(t,s,n),a=Rs(t,s,n),o=ws[r];t=e[o],s=e[o+1],e[o]=i,e[o+1]=a}for(let t=0;t<50;t+=10){for(let n=0;n<10;n++)r[n]=e[t+n];for(let n=0;n<10;n++)e[t+n]^=~r[(n+2)%10]&r[(n+4)%10]}e[0]^=js[n],e[1]^=Ns[n]}r.fill(0)}(this.state32,this.rounds),ys||_s(this.state32),this.posOut=0,this.pos=0}update(e){fs(this);const{blockLen:t,state:r}=this,n=(e=bs(e)).length;for(let s=0;s<n;){const i=Math.min(t-this.pos,n-s);for(let t=0;t<i;t++)r[this.pos++]^=e[s++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:t,pos:r,blockLen:n}=this;e[r]^=t,128&t&&r===n-1&&this.keccak(),e[n-1]^=128,this.keccak()}writeInto(e){fs(this,!1),hs(e),this.finish();const t=this.state,{blockLen:r}=this;for(let n=0,s=e.length;n<s;){this.posOut>=r&&this.keccak();const i=Math.min(r-this.posOut,s-n);e.set(t.subarray(this.posOut,this.posOut+i),n),this.posOut+=i,n+=i}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return ls(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(function(e,t){hs(e);const r=t.outputLen;if(e.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:t,suffix:r,outputLen:n,rounds:s,enableXOF:i}=this;return e||(e=new As(t,r,n,i,s)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=s,e.suffix=r,e.outputLen=n,e.enableXOF=i,e.destroyed=this.destroyed,e}}const Ms=((e,t,r)=>function(e){const t=t=>e().update(bs(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}((()=>new As(t,e,r))))(1,136,32),Zs=new qn(8192);function Ls(e,t){if(Zs.has(`${e}.${t}`))return Zs.get(`${e}.${t}`);const r=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),n=function(e){const t=Ms(Jn(e,{strict:!1})?function(e,t={}){return"number"==typeof e||"bigint"==typeof e?function(e,t){return ds(is(e,t))}(e,t):"boolean"==typeof e?function(e,t={}){const r=new Uint8Array(1);return r[0]=Number(e),"number"==typeof t.size?(ss(r,{size:t.size}),es(r,{size:t.size})):r}(e,t):Jn(e)?ds(e,t):us(e,t)}(e):e);return t}(us(r)),s=(t?r.substring(`${t}0x`.length):r).split("");for(let e=0;e<40;e+=2)n[e>>1]>>4>=8&&s[e]&&(s[e]=s[e].toUpperCase()),(15&n[e>>1])>=8&&s[e+1]&&(s[e+1]=s[e+1].toUpperCase());const i=`0x${s.join("")}`;return Zs.set(`${e}.${t}`,i),i}const Us=/^0x[a-fA-F0-9]{40}$/,$s=new qn(8192),Bs=[{id:"optimism",name:"Optimism"},{id:"base",name:"Base"},{id:"mainnet",name:"Ethereum Mainnet"},{id:"zora",name:"Zora"}],Fs=({dragType:e,index:t,item:r,moveItem:n,renderContent:s})=>{const[{isDragging:i},a]=cr({type:e,item:{index:t},collect:e=>({isDragging:e.isDragging()})}),[,o]=pr({accept:e,hover:e=>{e.index!==t&&(n(e.index,t),e.index=t)}});return(0,$t.jsxs)("div",{ref:e=>a(o(e)),style:{alignItems:"center",cursor:"move",display:"flex",gap:"8px",marginBottom:"8px",opacity:i?.5:1},children:[(0,$t.jsx)("span",{className:"dashicons dashicons-menu"}),(0,$t.jsx)("div",{style:{alignItems:"center",display:"flex",flex:1,justifyContent:"space-between"},children:s(r,t)})]})},zs=({chain:e,index:t,moveItem:r,removeChain:n})=>(0,$t.jsx)(Fs,{dragType:"chain",index:t,item:e,moveItem:r,renderContent:(e,t)=>(0,$t.jsxs)($t.Fragment,{children:[(0,$t.jsx)("span",{children:e.name}),(0,$t.jsx)(c.Button,{variant:"secondary",isDestructive:!0,onClick:()=>n(t),icon:"trash"})]})}),Hs=({value:e=[],onChange:t})=>{const r=e.map((e=>Bs.find((t=>t.id===e)))).filter(Boolean),n=r=>{const n=[...e];n.splice(r,1),t(n)},s=(r,n)=>{const s=[...e],[i]=s.splice(r,1);s.splice(n,0,i),t(s)},i=Bs.filter((t=>!e.includes(t.id)));return(0,$t.jsx)(Sn,{backend:Vn,children:(0,$t.jsxs)("div",{style:{width:"100%"},children:[(0,$t.jsx)("div",{className:"components-base-control",children:(0,$t.jsxs)("div",{className:"components-base-control__field",children:[(0,$t.jsx)("label",{htmlFor:"chains-control",className:"components-base-control__label",children:(0,o.__)("Supported Chains","frames-integration-for-farcaster")}),(0,$t.jsx)("div",{id:"chains-control",children:r.length>0?r.map(((e,t)=>(0,$t.jsx)(zs,{chain:e,index:t,moveItem:s,removeChain:n},e.id))):(0,$t.jsx)("div",{style:{background:"#f0f0f0",borderRadius:"4px",color:"#757575",margin:"8px 0",padding:"12px",textAlign:"center"},children:(0,o.__)("No chains selected. Add a chain below to get started.","frames-integration-for-farcaster")})})]})}),i.length>0&&(0,$t.jsx)("div",{className:"components-base-control",children:(0,$t.jsx)(c.SelectControl,{label:(0,o.__)("Add Chain","frames-integration-for-farcaster"),value:"",options:[{value:"",label:(0,o.__)("Select a chain to add…","frames-integration-for-farcaster")},...i.map((e=>({value:e.id,label:e.name})))],onChange:r=>{r&&(r=>{e.includes(r)||t([...e,r])})(r)}})})]})})},Vs=({value:e,onChange:t})=>(0,$t.jsx)(c.ColorPicker,{color:e,onChange:t}),qs=({value:e,onChange:t})=>(0,$t.jsx)(c.TextareaControl,{label:(0,o.__)("Domain Manifest","frames-integration-for-farcaster"),value:e,onChange:t}),Ws=({value:e=[],onChange:t})=>{const r=r=>{const n=[...e];n.splice(r,1),t(n)},n=(r,n)=>{const s=[...e];s[r]=Math.max(0,parseInt(n)||0),t(s)},s=(r,n)=>{const s=[...e],[i]=s.splice(r,1);s.splice(n,0,i),t(s)};return(0,$t.jsx)(Sn,{backend:Vn,children:(0,$t.jsxs)("div",{style:{width:"100%"},children:[(0,$t.jsx)("div",{className:"components-base-control",children:(0,$t.jsxs)("div",{className:"components-base-control__field",children:[(0,$t.jsxs)("label",{htmlFor:"tipping-amounts-control",className:"components-base-control__label",children:[(0,o.__)("Tipping Amounts (in","frames-integration-for-farcaster")," ",(0,$t.jsx)("a",{href:"https://zora.co/writings/sparks",target:"_blank",rel:"noopener noreferrer",children:(0,o.__)("Sparks","frames-integration-for-farcaster")}),(0,o.__)(")","frames-integration-for-farcaster")]}),(0,$t.jsx)("div",{id:"tipping-amounts-control",children:e.length>0?e.map(((e,t)=>(0,$t.jsx)(ri,{amount:e,index:t,moveItem:s,updateAmount:n,removeAmount:r},t))):(0,$t.jsx)("div",{style:{padding:"12px",background:"#f0f0f0",borderRadius:"4px",textAlign:"center",color:"#757575",margin:"8px 0"},children:(0,o.__)("No tipping amounts configured. Add an amount below to get started.","frames-integration-for-farcaster")})})]})}),(0,$t.jsx)(c.Button,{variant:"secondary",onClick:()=>{t([...e,0])},icon:"plus",children:(0,o.__)("Add Amount","frames-integration-for-farcaster")})]})})},Ks=({value:e,onChange:t,useTitleAsButtonText:r})=>(0,$t.jsx)(c.TextControl,{label:(0,o.__)("Button Text","frames-integration-for-farcaster"),value:e,help:r?(0,o.__)("This text will be used as the button text when frame is used outside of casts. Limited to 32 characters.","frames-integration-for-farcaster"):(0,o.__)("This text will be used as the button text for all posts. Limited to 32 characters.","frames-integration-for-farcaster"),onChange:t,__nextHasNoMarginBottom:!0,maxLength:32}),Xs=({value:e,onChange:t})=>{const r=e&&""!==e&&!function(e){const{strict:t=!0}={},r=`${e}.${t}`;if($s.has(r))return $s.get(r);const n=!(!Us.test(e)||e.toLowerCase()!==e&&t&&Ls(e)!==e);return $s.set(r,n),n}(e);return(0,$t.jsx)("div",{style:{width:"100%"},children:(0,$t.jsx)(c.TextControl,{label:(0,o.__)("Tipping Address","frames-integration-for-farcaster"),value:e,onChange:t,help:r?(0,o.__)("Please enter a valid Ethereum address","frames-integration-for-farcaster"):(0,o.__)("Enter the Ethereum address that will receive tips","frames-integration-for-farcaster"),className:r?"has-error":""})})},Gs=({value:e,onChange:t})=>(0,$t.jsx)(c.ToggleControl,{checked:e,label:(0,o.__)("Use Post Title as Button Text","frames-integration-for-farcaster"),onChange:t,__nextHasNoMarginBottom:!0}),Ys=({value:e,onChange:t})=>(0,$t.jsx)(c.ToggleControl,{checked:e,label:(0,o.__)("Enable Notifications","frames-integration-for-farcaster"),onChange:t,__nextHasNoMarginBottom:!0}),Js=({value:e,onChange:t})=>(0,$t.jsx)(c.ToggleControl,{checked:e,label:(0,o.__)("Enable SDK Logging","frames-integration-for-farcaster"),onChange:t,__nextHasNoMarginBottom:!0}),Qs=({value:e,onChange:t})=>(0,$t.jsx)(c.ToggleControl,{checked:e,label:(0,o.__)("Enable Farcaster Frames","frames-integration-for-farcaster"),onChange:t,__nextHasNoMarginBottom:!0}),ei=({value:e,onChange:t})=>(0,$t.jsx)(c.ToggleControl,{checked:e,label:(0,o.__)("Enable Tipping","frames-integration-for-farcaster"),onChange:t,__nextHasNoMarginBottom:!0}),ti=({value:e,onChange:t,buttonText:r="Select Image",labelText:n=""})=>(0,$t.jsx)(Ft.MediaUpload,{onSelect:e=>t({id:e.id,url:e.url}),help:(0,o.__)("This image will be used as the splash image for all posts.","frames-integration-for-farcaster"),allowedTypes:["image"],value:e,render:({open:s})=>(0,$t.jsx)("div",{children:e&&e.url?(0,$t.jsxs)("div",{style:{marginBottom:"10px"},children:[(0,$t.jsx)("img",{src:e.url,alt:"Selected",style:{maxWidth:"200px",height:"auto",display:"block",marginBottom:"8px"}}),(0,$t.jsxs)("div",{children:[(0,$t.jsx)(c.Button,{onClick:s,variant:"secondary",style:{marginRight:"8px"},children:"Replace Image"}),(0,$t.jsx)(c.Button,{onClick:()=>t({id:null,url:""}),variant:"link",isDestructive:!0,children:"Remove Image"})]})]}):(0,$t.jsx)(c.Button,{label:n,showTooltip:!0,onClick:s,variant:"secondary",children:r})})}),ri=({amount:e,index:t,moveItem:r,removeAmount:n,updateAmount:s})=>(0,$t.jsx)(Fs,{dragType:"amount",index:t,item:e,moveItem:r,renderContent:(e,t)=>(0,$t.jsxs)($t.Fragment,{children:[(0,$t.jsx)(c.TextControl,{type:"number",value:e,onChange:e=>s(t,e),min:0}),(0,$t.jsx)(c.Button,{icon:"trash",isDestructive:!0,onClick:()=>n(t),variant:"secondary"})]})}),ni=({value:e,onChange:t})=>(0,$t.jsx)("div",{style:{width:"100%"},children:(0,$t.jsx)(c.TextControl,{label:(0,o.__)("RPC URL for Optimism","frames-integration-for-farcaster"),value:e,onChange:t,help:e&&""!==e?(0,o.__)("Enter the URL of your Ethereum RPC for the Optimism chain.","frames-integration-for-farcaster"):(0,o.__)("Enter the URL of your Ethereum RPC for the Optimism chain. Required for complete key verification.","frames-integration-for-farcaster"),className:e&&""!==e?"":"has-error",type:"url",__nextHasNoMarginBottom:!0})}),si=window.wp.primitives,ii=(0,$t.jsx)(si.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,$t.jsx)(si.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M5 4.5h11a.5.5 0 0 1 .5.5v11a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V5a.5.5 0 0 1 .5-.5ZM3 5a2 2 0 0 1 2-2h11a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5Zm17 3v10.75c0 .69-.56 1.25-1.25 1.25H6v1.5h12.75a2.75 2.75 0 0 0 2.75-2.75V8H20Z"})}),ai=(0,$t.jsx)(si.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,$t.jsx)(si.Path,{d:"M18 11.3l-1-1.1-4 4V3h-1.5v11.3L7 10.2l-1 1.1 6.2 5.8 5.8-5.8zm.5 3.7v3.5h-13V15H4v5h16v-5h-1.5z"})}),oi=({content:e,showCopyButton:t=!0,showDownloadButton:r=!1,downloadFilename:n="download.json"})=>{const[s,i]=(0,a.useState)(!1);return(0,$t.jsxs)("div",{style:{position:"relative",maxWidth:"100%"},children:[(0,$t.jsx)("pre",{style:{background:"#f0f0f0",padding:"1rem",borderRadius:"4px",overflow:"auto",whiteSpace:"break-spaces",lineBreak:"anywhere"},children:e}),t&&(0,$t.jsx)(c.Button,{icon:ii,onClick:async()=>{await navigator.clipboard.writeText(e),i(!0),setTimeout((()=>i(!1)),2e3)},style:{position:"absolute",top:"8px",right:"8px",background:"white",border:"1px solid #ccc"},children:s?(0,o.__)("Copied!","frames-integration-for-farcaster"):(0,o.__)("Copy","frames-integration-for-farcaster")}),r&&(0,$t.jsx)(c.Button,{icon:ai,onClick:()=>{const t=new Blob([e],{type:"application/json"}),r=URL.createObjectURL(t),s=document.createElement("a");s.href=r,s.download=n,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(r)},style:{position:"absolute",bottom:"8px",right:"8px",background:"white",border:"1px solid #ccc"},children:(0,o.__)("Download","frames-integration-for-farcaster")})]})},ci=({currentManifest:e,domainManifest:t,setDomainManifest:r})=>{const[n,s]=(0,a.useState)(null),[i,d]=(0,a.useState)(""),[u,l]=(0,a.useState)(""),[h,f]=(0,a.useState)(!0),p=(0,a.useMemo)((()=>{if(!t)return null;let e=null;try{e=JSON.parse(t)}catch{}return e}),[t]),g=(0,a.useMemo)((()=>{if(!n||!e)return null;const t=p&&"object"==typeof p&&0!==Object.keys(p).length,r={name:n?.frame?.name!==e?.frame?.name,homeUrl:n?.frame?.homeUrl!==e?.frame?.homeUrl,iconUrl:n?.frame?.iconUrl!==e?.frame?.iconUrl,splashImageUrl:n?.frame?.splashImageUrl!==e?.frame?.splashImageUrl,splashBackgroundColor:n?.frame?.splashBackgroundColor!==e?.frame?.splashBackgroundColor,buttonTitle:n?.frame?.buttonTitle!==e?.frame?.buttonTitle,imageUrl:n?.frame?.imageUrl!==e?.frame?.imageUrl,...e?.frame?.webhookUrl?{webhookUrl:e?.frame?.webhookUrl!==n?.frame?.webhookUrl}:{},...t?{header:p?.accountAssociation?.header!==n?.accountAssociation?.header,payload:p?.accountAssociation?.payload!==n?.accountAssociation?.payload,signature:p?.accountAssociation?.signature!==n?.accountAssociation?.signature}:{}};return{count:Object.values(r).filter(Boolean).length,details:r}}),[n,e,p]);return(0,a.useEffect)((()=>{(async()=>{try{const e=new AbortController,t=setTimeout((()=>e.abort("Manifest retrieval timed out")),2e3),r=await fetch("/.well-known/farcaster.json",{signal:e.signal});if(clearTimeout(t),!r.ok)throw new Error("Manifest file not found");const n=(e=>{const t=Ut.safeParse(e);return t.success?(d(""),t.data):(d(t.error.message),e)})(await r.json());s(n),l("")}catch(e){l(e instanceof Error?`${(0,o.__)("Error:","frames-integration-for-farcaster")} ${e.message}`:(0,o.__)("Farcaster manifest file not found or request timed out at /.well-known/farcaster.json","frames-integration-for-farcaster"))}finally{f(!1)}})()}),[]),h?(0,$t.jsx)(c.__experimentalText,{children:(0,o.__)("Loading manifest…","frames-integration-for-farcaster")}):(0,$t.jsxs)("div",{className:"manifest-viewer",children:[u&&(0,$t.jsxs)($t.Fragment,{children:[(0,$t.jsx)(c.Notice,{status:"error",isDismissible:!1,children:u}),(0,$t.jsx)("div",{style:{marginTop:"8px"}})]}),(0,$t.jsxs)(c.__experimentalText,{children:[(0,o.__)("The Farcaster manifest file declares metadata for your frame application and defines supported triggers.","frames-integration-for-farcaster")," ",(0,$t.jsx)("a",{href:"https://docs.farcaster.xyz/developers/frames/v2/spec#frame-manifest",target:"_blank",rel:"noopener noreferrer",children:(0,o.__)("Learn more about the manifest specification.","frames-integration-for-farcaster")})," ",(0,o.__)("Frames Integration for Farcaster can help you manage your manifest file. To start, enter the domain manifest obtained from the Warpcast app.","frames-integration-for-farcaster")," ",(0,$t.jsx)("a",{href:"https://docs.farcaster.xyz/developers/frames/v2/notifications_webhooks#create-a-farcaster-domain-manifest",target:"_blank",rel:"noopener noreferrer",children:(0,o.__)("Follow the instructions here to create a domain manifest.","frames-integration-for-farcaster")})]}),(0,$t.jsx)("div",{style:{marginTop:"16px"},children:(0,$t.jsx)(qs,{value:t,onChange:r})}),n&&(0,$t.jsxs)($t.Fragment,{children:[(0,$t.jsx)("div",{style:{marginTop:"16px"},children:(0,$t.jsx)(c.__experimentalText,{children:(0,o.__)("Here is the current manifest on your site:","frames-integration-for-farcaster")})}),(0,$t.jsx)("div",{style:{marginTop:"8px"}}),(0,$t.jsx)(oi,{content:JSON.stringify(n,null,2),showCopyButton:!1}),i&&(0,$t.jsxs)(c.Notice,{status:"error",isDismissible:!1,children:[(0,o.__)("Validation complete, manifest is not valid. Errors:","frames-integration-for-farcaster")," ",(0,$t.jsx)("ul",{style:{margin:0,paddingLeft:"1rem"},children:JSON.parse(i).map(((e,t)=>(0,$t.jsxs)("li",{children:[(0,$t.jsx)("strong",{children:e.path.join(".")}),": ",e.message]},t)))})]}),!i&&(0,$t.jsx)(c.Notice,{status:"info",isDismissible:!1,children:e&&g?(0,o.sprintf)(/* translators: %d: number of mismatches */ /* translators: %d: number of mismatches */
     2(0,o.__)("Validation complete, manifest is valid. %d mismatches found with current settings.","frames-integration-for-farcaster"),g.count):(0,o.__)("Validation complete, manifest is valid.","frames-integration-for-farcaster")}),e&&g?.count>0&&(0,$t.jsxs)($t.Fragment,{children:[g.details.name&&(0,$t.jsx)(c.Notice,{status:"warning",isDismissible:!1,children:(0,o.__)("The manifest name does not match the current site name.","frames-integration-for-farcaster")}),g.details.homeUrl&&(0,$t.jsx)(c.Notice,{status:"warning",isDismissible:!1,children:(0,o.__)("The manifest home URL does not match the current site home URL.","frames-integration-for-farcaster")}),g.details.iconUrl&&(0,$t.jsx)(c.Notice,{status:"warning",isDismissible:!1,children:(0,o.__)("The manifest icon URL does not match the current site icon URL.","frames-integration-for-farcaster")}),g.details.imageUrl&&(0,$t.jsx)(c.Notice,{status:"warning",isDismissible:!1,children:(0,o.__)("The manifest image URL does not match the current site image URL.","frames-integration-for-farcaster")}),g.details.buttonTitle&&(0,$t.jsx)(c.Notice,{status:"warning",isDismissible:!1,children:(0,o.__)("The manifest button title does not match the current site button title.","frames-integration-for-farcaster")}),g.details.splashImageUrl&&(0,$t.jsx)(c.Notice,{status:"warning",isDismissible:!1,children:(0,o.__)("The manifest splash image URL does not match the current site splash image URL.","frames-integration-for-farcaster")}),g.details.splashBackgroundColor&&(0,$t.jsx)(c.Notice,{status:"warning",isDismissible:!1,children:(0,o.__)("The manifest splash background color does not match the current site splash background color.","frames-integration-for-farcaster")}),g.details.webhookUrl&&(0,$t.jsx)(c.Notice,{status:"warning",isDismissible:!1,children:(0,o.__)("The manifest webhook URL does not match the current site webhook URL.","frames-integration-for-farcaster")}),g.details.header&&(0,$t.jsx)(c.Notice,{status:"warning",isDismissible:!1,children:(0,o.__)("The manifest header does not match the domain manifest header.","frames-integration-for-farcaster")}),g.details.payload&&(0,$t.jsx)(c.Notice,{status:"warning",isDismissible:!1,children:(0,o.__)("The manifest payload does not match the domain manifest payload.","frames-integration-for-farcaster")}),g.details.signature&&(0,$t.jsx)(c.Notice,{status:"warning",isDismissible:!1,children:(0,o.__)("The manifest signature does not match the domain manifest signature.","frames-integration-for-farcaster")})]})]}),(0,$t.jsxs)($t.Fragment,{children:[(0,$t.jsx)("div",{style:{marginTop:"16px"},children:(0,$t.jsx)(c.__experimentalText,{children:(0,o.__)("Are you going to update the manifest to match current settings? Here is the manifest data to reference. This should be available at /.well-known/farcaster.json on your site.","frames-integration-for-farcaster")})}),(0,$t.jsx)(oi,{showDownloadButton:!0,downloadFilename:"farcaster.json",content:JSON.stringify(e,null,2)})]})]})},di=()=>{const{subscriptions:e}=(()=>{const[e,t]=(0,a.useState)(),r=(0,a.useCallback)((()=>{u()({path:"/farcaster-wp/v1/subscriptions"}).then((e=>{t(e)}))}),[]);return(0,a.useEffect)((()=>{r()}),[r]),{subscriptions:e,fetchSubscriptions:r}})();return(0,$t.jsxs)("div",{style:{width:"100%"},children:[(0,$t.jsx)("div",{style:{marginTop:"16px"},children:(0,$t.jsxs)(c.__experimentalText,{children:[(0,o.__)("You have","frames-integration-for-farcaster")," ",e?.length," ",(0,o.__)("subscriptions on your site:","frames-integration-for-farcaster")]})}),(0,$t.jsx)("div",{style:{marginTop:"8px"}}),(0,$t.jsx)("pre",{style:{maxHeight:"500px",overflow:"auto",border:"1px solid #ddd",borderRadius:"4px",padding:"8px",backgroundColor:"#f9f9f9"},children:JSON.stringify(e,null,2)})]})},ui=()=>{const{events:e}=(()=>{const[e,t]=(0,a.useState)(),r=(0,a.useCallback)((()=>{u()({path:"/farcaster-wp/v1/events"}).then((e=>{t(e)}))}),[]);return(0,a.useEffect)((()=>{r()}),[r]),{events:e,fetchEvents:r}})();return(0,$t.jsxs)("div",{style:{width:"100%"},children:[(0,$t.jsx)("div",{style:{marginTop:"16px"},children:(0,$t.jsxs)(c.__experimentalText,{children:[(0,o.__)("You have","frames-integration-for-farcaster")," ",e?.length," ",(0,o.__)("events on your site:","frames-integration-for-farcaster")]})}),(0,$t.jsx)("div",{style:{marginTop:"8px"}}),(0,$t.jsx)("pre",{style:{maxHeight:"500px",overflow:"auto",border:"1px solid #ddd",borderRadius:"4px",padding:"8px",backgroundColor:"#f9f9f9"},children:JSON.stringify(e,null,2)})]})},li=()=>(0,$t.jsx)(c.__experimentalHeading,{level:1,children:(0,o.__)("Frames Integration for Farcaster Settings","frames-integration-for-farcaster")}),hi=({onClick:e})=>(0,$t.jsx)(c.Button,{variant:"primary",onClick:e,__next40pxDefaultSize:!0,children:(0,o.__)("Save","frames-integration-for-farcaster")}),fi=()=>{const{saveSettings:e,framesEnabled:t,setFramesEnabled:r,splashBackgroundColor:n,setSplashBackgroundColor:s,buttonText:i,setButtonText:d,splashImage:f,setSplashImage:p,fallbackImage:g,setFallbackImage:m,useTitleAsButtonText:v,setUseTitleAsButtonText:y,domainManifest:_,setDomainManifest:b,notificationsEnabled:x,setNotificationsEnabled:w,debugEnabled:T,setDebugEnabled:S,tippingEnabled:O,setTippingEnabled:k,tippingAddress:I,setTippingAddress:C,tippingAmounts:D,setTippingAmounts:E,tippingChains:j,setTippingChains:N,rpcURL:P,setRpcURL:R}=(()=>{const[e,t]=(0,a.useState)(),[r,n]=(0,a.useState)(),[s,i]=(0,a.useState)(),[c,d]=(0,a.useState)(!1),[f,p]=(0,a.useState)(!1),[g,m]=(0,a.useState)(!1),[v,y]=(0,a.useState)(),[_,b]=(0,a.useState)([]),[x,w]=(0,a.useState)([]),[T,S]=(0,a.useState)(),[O,k]=(0,a.useState)(),[I,C]=(0,a.useState)({id:0,url:""}),[D,E]=(0,a.useState)({id:0,url:""}),[j,N]=(0,a.useState)(!1),{createSuccessNotice:P,createErrorNotice:R,removeNotice:A}=(0,h.useDispatch)(l.store);return(0,a.useEffect)((()=>{u()({path:"/wp/v2/settings"}).then((e=>{i(e.farcaster_wp?.frames_enabled),S(e.farcaster_wp?.splash_background_color),k(e.farcaster_wp?.button_text),C(e.farcaster_wp?.splash_image),E(e.farcaster_wp?.fallback_image),N(e.farcaster_wp?.use_title_as_button_text),t(e.farcaster_wp?.domain_manifest),d(e.farcaster_wp?.notifications_enabled),p(e.farcaster_wp?.debug_enabled),m(e.farcaster_wp?.tipping_enabled),y(e.farcaster_wp?.tipping_address),b(e.farcaster_wp?.tipping_amounts),w(e.farcaster_wp?.tipping_chains),n(e.farcaster_wp?.rpc_url)}))}),[]),(0,a.useEffect)((()=>{let e;return async function(){if(void 0===r||""!==r||e)void 0!==r&&""!==r&&e&&(A(e),e=void 0);else{const t=await R((0,o.__)("RPC URL is required for key validation. Currently, signatures will be validated, but keys will not be verified using contract.","frames-integration-for-farcaster"));e=t?.notice?.id}}(),()=>{e&&A(e)}}),[R,A,r]),{saveSettings:t=>{if(e){let t=null;try{t=JSON.parse(e)}catch{}if(!Ut.safeParse(t).success)return void R((0,o.__)("Did not save settings, domain manifest is invalid.","frames-integration-for-farcaster")).then((()=>document.scrollingElement?.scrollTo({top:0,behavior:"smooth"})))}if(r)try{new URL(r)}catch{return void R((0,o.__)("RPC URL is invalid.","frames-integration-for-farcaster")).then((()=>document.scrollingElement?.scrollTo({top:0,behavior:"smooth"})))}u()({path:"/wp/v2/settings",method:"POST",data:{farcaster_wp:{frames_enabled:s,splash_background_color:T,button_text:O,splash_image:I,fallback_image:D,use_title_as_button_text:j,domain_manifest:e,notifications_enabled:c,debug_enabled:f,tipping_enabled:g,tipping_address:v,tipping_amounts:_,tipping_chains:x,rpc_url:r}}}).then((()=>{P((0,o.__)("Settings saved.","frames-integration-for-farcaster")).then((()=>{t&&t(),document.scrollingElement?.scrollTo({top:0,behavior:"smooth"})}))})).catch((e=>{console.error(e),R((0,o.__)("Failed to save settings.","frames-integration-for-farcaster")).then((()=>document.scrollingElement?.scrollTo({top:0,behavior:"smooth"})))}))},framesEnabled:s,setFramesEnabled:i,splashBackgroundColor:T,setSplashBackgroundColor:S,buttonText:O,setButtonText:k,splashImage:I,setSplashImage:C,fallbackImage:D,setFallbackImage:E,useTitleAsButtonText:j,setUseTitleAsButtonText:N,domainManifest:e,setDomainManifest:t,notificationsEnabled:c,setNotificationsEnabled:d,debugEnabled:f,setDebugEnabled:p,tippingEnabled:g,setTippingEnabled:m,tippingAddress:v,setTippingAddress:y,tippingAmounts:_,setTippingAmounts:b,tippingChains:x,setTippingChains:w,rpcURL:r,setRpcURL:n}})(),{manifest:A,fetchManifest:M}=(()=>{const[e,t]=(0,a.useState)(),r=(0,a.useCallback)((()=>{u()({path:"/farcaster-wp/v1/manifest"}).then((e=>{t(e)}))}),[]);return(0,a.useEffect)((()=>{r()}),[r]),{manifest:e,fetchManifest:r}})();return(0,$t.jsxs)($t.Fragment,{children:[(0,$t.jsx)(li,{}),(0,$t.jsx)(Bt,{}),(0,$t.jsxs)(c.Panel,{header:"Frames",children:[(0,$t.jsx)(c.PanelBody,{children:(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsx)(Qs,{value:t,onChange:e=>r(e)})})}),(0,$t.jsx)(c.PanelBody,{title:(0,o.__)("Frame Button","frames-integration-for-farcaster"),initialOpen:t,children:(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsxs)(c.__experimentalVStack,{spacing:4,children:[(0,$t.jsx)(Gs,{value:v,onChange:y}),(0,$t.jsx)(Ks,{useTitleAsButtonText:v,value:i,onChange:d})]})})}),(0,$t.jsx)(c.PanelBody,{title:(0,o.__)("Splash Background Color","frames-integration-for-farcaster"),initialOpen:t,children:(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsx)(Vs,{value:n,onChange:s})})}),(0,$t.jsx)(c.PanelBody,{title:(0,o.__)("Frame Splash Image","frames-integration-for-farcaster"),initialOpen:t,children:(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsx)(ti,{value:f,onChange:p,labelText:(0,o.__)("Image will be displayed as 200x200px.","frames-integration-for-farcaster")})})}),(0,$t.jsx)(c.PanelBody,{title:(0,o.__)("Fallback Frame Image","frames-integration-for-farcaster"),initialOpen:t,children:(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsx)(ti,{labelText:(0,o.__)("Image will be displayed in 3:2 aspect ratio.","frames-integration-for-farcaster"),value:g,onChange:m})})})]}),(0,$t.jsxs)(c.Panel,{header:"Tipping",children:[(0,$t.jsxs)(c.PanelBody,{children:[(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsx)(ei,{value:O,onChange:k})}),(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsx)(Xs,{value:I,onChange:C})})]}),(0,$t.jsx)(c.PanelBody,{title:(0,o.__)("Tipping Chains","frames-integration-for-farcaster"),initialOpen:O,children:(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsx)(Hs,{value:j,onChange:N})})}),(0,$t.jsx)(c.PanelBody,{title:(0,o.__)("Tipping Amounts","frames-integration-for-farcaster"),initialOpen:O,children:(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsx)(Ws,{value:D,onChange:E})})})]}),(0,$t.jsx)(c.Panel,{header:"Notifications",children:(0,$t.jsxs)(c.PanelBody,{children:[(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsx)(Ys,{value:x,onChange:w})}),(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsx)(ni,{value:P,onChange:R})}),(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsx)(Js,{value:T,onChange:S})}),(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsx)(di,{})}),(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsx)(ui,{})})]})}),(0,$t.jsx)(c.Panel,{header:"Manifest",children:(0,$t.jsx)(c.PanelBody,{title:(0,o.__)("Manifest Validation","frames-integration-for-farcaster"),children:(0,$t.jsx)(c.PanelRow,{children:(0,$t.jsx)(ci,{currentManifest:A,domainManifest:_,setDomainManifest:b})})})}),(0,$t.jsx)(hi,{onClick:()=>e(M)})]})};i()((()=>{const e=document.getElementById("farcaster-wp-settings");e&&(0,a.createRoot)(e).render((0,$t.jsx)(fi,{}))}))})();
  • frames-integration-for-farcaster/trunk/frames-integration-for-farcaster.php

    r3214459 r3214536  
    1111 * Plugin URI:        https://davisshaver.com/frames-integration-for-farcaster/
    1212 * Description:       Frames Integration for Farcaster connects your WordPress site to Farcaster.
    13  * Version:           0.0.42
     13 * Version:           0.0.43
    1414 * Author:            Davis Shaver
    1515 * Author URI:        https://davisshaver.com/
     
    2323defined( 'ABSPATH' ) || exit;
    2424
    25 define( 'FARCASTER_WP_VERSION', '0.0.42' );
     25define( 'FARCASTER_WP_VERSION', '0.0.43' );
    2626
    2727define( 'FARCASTER_WP_API_NAMESPACE', 'farcaster-wp/v1' );
  • frames-integration-for-farcaster/trunk/includes/api/class-subscriptions-controller.php

    r3214439 r3214536  
    1212use WP_REST_Response;
    1313use Farcaster_WP\Storage;
     14
    1415defined( 'ABSPATH' ) || exit;
    1516
  • frames-integration-for-farcaster/trunk/includes/class-api.php

    r3214439 r3214536  
    1111use Farcaster_WP\API\Webhook_Controller;
    1212use Farcaster_WP\API\Subscriptions_Controller;
     13use Farcaster_WP\API\Events_Controller;
    1314
    1415defined( 'ABSPATH' ) || exit;
     
    3536            $subscriptions_api = new Subscriptions_Controller();
    3637            add_action( 'rest_api_init', [ $subscriptions_api, 'register_routes' ] );
     38
     39            include_once 'api/class-events-controller.php';
     40            $events_api = new Events_Controller();
     41            add_action( 'rest_api_init', [ $events_api, 'register_routes' ] );
    3742        }
    3843    }
  • frames-integration-for-farcaster/trunk/includes/class-storage.php

    r3214439 r3214536  
    178178
    179179    /**
     180     * Get events.
     181     *
     182     * @return array The events.
     183     */
     184    public static function get_events() {
     185        global $wpdb;
     186        $table_name = self::get_events_table_name();
     187        $results    = $wpdb->get_results( $wpdb->prepare( 'SELECT * FROM %1$s', [ $table_name ] ), ARRAY_A ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQLPlaceholders.UnquotedComplexPlaceholder, WordPress.DB.DirectDatabaseQuery.DirectQuery
     188        return $results ? $results : [];
     189    }
     190
     191    /**
    180192     * Get active subscriptions.
    181193     *
     
    186198        $table_name = self::get_fids_table_name();
    187199
    188         $results = $wpdb->get_results( $wpdb->prepare( 'SELECT * FROM %1$s WHERE status = \'active\'', [ $table_name ] ), ARRAY_A );  // phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQLPlaceholders.UnquotedComplexPlaceholder, WordPress.DB.DirectDatabaseQuery.DirectQuery
     200        $results = $wpdb->get_results( $wpdb->prepare( 'SELECT * FROM %1$s WHERE status = \'active\'', [ $table_name ] ), ARRAY_A ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQLPlaceholders.UnquotedComplexPlaceholder, WordPress.DB.DirectDatabaseQuery.DirectQuery
    189201
    190202        return $results ? $results : [];
  • frames-integration-for-farcaster/trunk/readme.txt

    r3214459 r3214536  
    55Requires at least: 6.7.0
    66Requires PHP: 7.0
    7 Stable tag: 0.0.42
     7Stable tag: 0.0.43
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    3030
    3131== Changelog ==
     32
     33= 0.0.43 =
     34* Add basic events viewer to settings page
    3235
    3336= 0.0.42 =
  • frames-integration-for-farcaster/trunk/vendor/composer/autoload_classmap.php

    r3214439 r3214536  
    8585    'FG\\X509\\SAN\\SubjectAlternativeNames' => $vendorDir . '/fgrosse/phpasn1/lib/X509/SAN/SubjectAlternativeNames.php',
    8686    'Farcaster_WP\\API' => $baseDir . '/includes/class-api.php',
     87    'Farcaster_WP\\API\\Events_Controller' => $baseDir . '/includes/api/class-events-controller.php',
    8788    'Farcaster_WP\\API\\Manifest_Controller' => $baseDir . '/includes/api/class-manifest-controller.php',
    8889    'Farcaster_WP\\API\\Subscriptions_Controller' => $baseDir . '/includes/api/class-subscriptions-controller.php',
  • frames-integration-for-farcaster/trunk/vendor/composer/autoload_static.php

    r3214439 r3214536  
    186186        'FG\\X509\\SAN\\SubjectAlternativeNames' => __DIR__ . '/..' . '/fgrosse/phpasn1/lib/X509/SAN/SubjectAlternativeNames.php',
    187187        'Farcaster_WP\\API' => __DIR__ . '/../..' . '/includes/class-api.php',
     188        'Farcaster_WP\\API\\Events_Controller' => __DIR__ . '/../..' . '/includes/api/class-events-controller.php',
    188189        'Farcaster_WP\\API\\Manifest_Controller' => __DIR__ . '/../..' . '/includes/api/class-manifest-controller.php',
    189190        'Farcaster_WP\\API\\Subscriptions_Controller' => __DIR__ . '/../..' . '/includes/api/class-subscriptions-controller.php',
  • frames-integration-for-farcaster/trunk/vendor/composer/installed.php

    r3214459 r3214536  
    22    'root' => array(
    33        'name' => 'davisshaver/frames-integration-for-farcaster',
    4         'pretty_version' => '0.0.42',
    5         'version' => '0.0.42.0',
    6         'reference' => 'f710f879bc23f826f2a9358c1716a34796e3db9f',
     4        'pretty_version' => '0.0.43',
     5        'version' => '0.0.43.0',
     6        'reference' => 'e00b308e764ef6ba03f2dab10af115b02fd4009c',
    77        'type' => 'wordpress-plugin',
    88        'install_path' => __DIR__ . '/../../',
     
    1212    'versions' => array(
    1313        'davisshaver/frames-integration-for-farcaster' => array(
    14             'pretty_version' => '0.0.42',
    15             'version' => '0.0.42.0',
    16             'reference' => 'f710f879bc23f826f2a9358c1716a34796e3db9f',
     14            'pretty_version' => '0.0.43',
     15            'version' => '0.0.43.0',
     16            'reference' => 'e00b308e764ef6ba03f2dab10af115b02fd4009c',
    1717            'type' => 'wordpress-plugin',
    1818            'install_path' => __DIR__ . '/../../',
Note: See TracChangeset for help on using the changeset viewer.