plugin-build-visualization-block 0.1.4 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +21 -0
- package/client.d.ts +2 -2
- package/client.js +1 -1
- package/dist/client/59.6bac6ada1dacea82.js +10 -0
- package/dist/client/index.js +1 -1
- package/dist/client-v2/385.1e235c5081822f07.js +10 -0
- package/dist/client-v2/59.cdb723e410dac32b.js +10 -0
- package/dist/client-v2/index.js +37 -1
- package/dist/externalVersion.js +12 -7
- package/dist/locale/en-US.json +77 -37
- package/dist/locale/vi-VN.json +58 -40
- package/dist/locale/zh-CN.json +79 -40
- package/dist/node_modules/zod/index.cjs +1 -1
- package/dist/node_modules/zod/package.json +1 -1
- package/dist/server/actions/build.js +8 -720
- package/dist/server/collections/workflow-runs.js +51 -0
- package/dist/server/pipeline/analyzer.js +18 -4
- package/dist/server/plugin.js +17 -20
- package/dist/server/tools/build-visualization-block.js +9 -26
- package/dist/server/workflow-domain.js +209 -0
- package/dist/server/workflow.js +466 -0
- package/dist/shared/blockSpec.js +1 -1
- package/dist/shared/workflow.js +58 -0
- package/package.json +14 -3
- package/server.d.ts +2 -2
- package/server.js +1 -1
- package/src/client/locale.ts +18 -18
- package/src/client/plugin.tsx +11 -0
- package/src/client/workflow.ts +28 -0
- package/src/client-v2/__tests__/buildApi.test.ts +68 -0
- package/src/client-v2/__tests__/modelOptions.test.ts +190 -0
- package/src/client-v2/__tests__/nativeModels.test.ts +77 -0
- package/src/client-v2/buildApi.ts +93 -0
- package/src/client-v2/components/AISelectors.tsx +85 -0
- package/src/client-v2/components/BuildForm.tsx +186 -0
- package/src/client-v2/components/CollectionMultiSelect.tsx +63 -0
- package/src/client-v2/components/NativePreview.tsx +53 -0
- package/src/client-v2/locale.ts +5 -0
- package/src/client-v2/modelOptions.ts +201 -0
- package/src/client-v2/models/BuildVisualizationBlockModel.tsx +95 -0
- package/src/client-v2/nativeBlock.ts +28 -0
- package/src/client-v2/pages/SettingsPage.tsx +77 -0
- package/src/client-v2/plugin.tsx +17 -4
- package/src/client-v2/workflow-fields.tsx +23 -0
- package/src/client-v2/workflow.ts +28 -0
- package/src/locale/en-US.json +77 -37
- package/src/locale/namespace.ts +6 -6
- package/src/locale/vi-VN.json +58 -40
- package/src/locale/zh-CN.json +79 -40
- package/src/server/__tests__/build-action.test.ts +121 -117
- package/src/server/__tests__/plugin.test.ts +19 -34
- package/src/server/actions/build.ts +268 -1318
- package/src/server/collections/workflow-runs.ts +30 -0
- package/src/server/pipeline/analyzer.ts +395 -368
- package/src/server/plugin.ts +26 -35
- package/src/server/tools/build-visualization-block.ts +18 -28
- package/src/server/workflow-domain.ts +235 -0
- package/src/server/workflow.ts +519 -0
- package/src/shared/blockSpec.ts +10 -1
- package/src/shared/workflow.ts +26 -0
- package/dist/client-v2/812.6b4f5e757b898c82.js +0 -10
package/dist/client-v2/index.js
CHANGED
|
@@ -7,4 +7,40 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@nocobase/client-v2"),require("@formily/core"),require("react"),require("antd"),require("@nocobase/client"),require("@formily/react")):"function"==typeof define&&define.amd?define("plugin-build-visualization-block/client-v2",["@nocobase/client-v2","@formily/core","react","antd","@nocobase/client","@formily/react"],t):"object"==typeof exports?exports["plugin-build-visualization-block/client-v2"]=t(require("@nocobase/client-v2"),require("@formily/core"),require("react"),require("antd"),require("@nocobase/client"),require("@formily/react")):e["plugin-build-visualization-block/client-v2"]=t(e["@nocobase/client-v2"],e["@formily/core"],e.react,e.antd,e["@nocobase/client"],e["@formily/react"])}(self,function(e,t,n,r,o,i){return function(){"use strict";var u,c,a,l={452:function(e){e.exports=t},230:function(e){e.exports=i},342:function(e){e.exports=o},485:function(t){t.exports=e},59:function(e){e.exports=r},155:function(e){e.exports=n}},f={};function p(e){var t=f[e];if(void 0!==t)return t.exports;var n=f[e]={exports:{}};return l[e](n,n.exports,p),n.exports}p.m=l,p.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return p.d(t,{a:t}),t},p.d=function(e,t){for(var n in t)p.o(t,n)&&!p.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},p.f={},p.e=function(e){return Promise.all(Object.keys(p.f).reduce(function(t,n){return p.f[n](e,t),t},[]))},p.u=function(e){return""+e+".6b4f5e757b898c82.js"},p.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),p.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s={},p.l=function(e,t,n,r){if(s[e])return void s[e].push(t);if(void 0!==n)for(var o,i,u=document.getElementsByTagName("script"),c=0;c<u.length;c++){var a=u[c];if(a.getAttribute("src")==e||a.getAttribute("data-rspack")=="plugin-build-visualization-block/client-v2:"+n){o=a;break}}o||(i=!0,(o=document.createElement("script")).timeout=120,p.nc&&o.setAttribute("nonce",p.nc),o.setAttribute("data-rspack","plugin-build-visualization-block/client-v2:"+n),o.src=e),s[e]=[t];var l=function(t,n){o.onerror=o.onload=null,clearTimeout(f);var r=s[e];if(delete s[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},f=setTimeout(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.bind(null,o.onload),i&&document.head.appendChild(o)},p.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},p.g.importScripts&&(b=p.g.location+"");var s,b,d=p.g.document;if(!b&&d&&(d.currentScript&&"SCRIPT"===d.currentScript.tagName.toUpperCase()&&(b=d.currentScript.src),!b)){var v=d.getElementsByTagName("script");if(v.length)for(var y=v.length-1;y>-1&&(!b||!/^http(s?):/.test(b));)b=v[y--].src}if(!b)throw Error("Automatic publicPath is not supported in this browser");p.p=b.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),u={889:0},p.f.j=function(e,t){var n=p.o(u,e)?u[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=u[e]=[t,r]});t.push(n[2]=r);var o=p.p+p.u(e),i=Error();p.l(o,function(t){if(p.o(u,e)&&(0!==(n=u[e])&&(u[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;i.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",i.name="ChunkLoadError",i.type=r,i.request=o,n[1](i)}},"chunk-"+e,e)}},c=function(e,t){var n,r,o=t[0],i=t[1],c=t[2],a=0;if(o.some(function(e){return 0!==u[e]})){for(n in i)p.o(i,n)&&(p.m[n]=i[n]);c&&c(p)}for(e&&e(t);a<o.length;a++)r=o[a],p.o(u,r)&&u[r]&&u[r][0](),u[r]=0},(a=self.webpackChunkplugin_build_visualization_block_client_v2=self.webpackChunkplugin_build_visualization_block_client_v2||[]).forEach(c.bind(null,0)),a.push=c.bind(null,a.push.bind(a));var h={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src&&(e=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")),!e){var n=window.__webpack_public_path__||"";n&&("/"!==n.charAt(n.length-1)&&(n+="/"),e=n+"static/plugins/plugin-build-visualization-block/dist/client-v2/")}if(!e){var r=window.__nocobase_modern_client_prefix__||"v",o="/"+(r=String(r).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var i=window.location.pathname||"/",u=i.indexOf(o);e=u>=0?i.slice(0,u+1):"/"}e&&(e=e.replace(RegExp("/"+r+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/plugin-build-visualization-block/dist/client-v2/"}p.p=e}(),!function(){p.r(h),p.d(h,{default:function(){return c}});var e=p(485);function t(e,t,n,r,o,i,u){try{var c=e[i](u),a=c.value}catch(e){n(e);return}c.done?t(a):Promise.resolve(a).then(r,o)}function n(e,t,r){return(n=u()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&o(i,n.prototype),i}).apply(null,arguments)}p(155);function r(e){return(r=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function o(e,t){return(o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function i(e){var t="function"==typeof Map?new Map:void 0;return(i=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,i)}function i(){return n(e,arguments,r(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),o(i,e)})(e)}function u(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(u=function(){return!!e})()}var c=function(e){var n;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function i(){var e,t;if(!(this instanceof i))throw TypeError("Cannot call a class as a function");return e=i,t=arguments,e=r(e),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,u()?Reflect.construct(e,t||[],r(this).constructor):e.apply(this,t))}return i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),e&&o(i,e),n=[{key:"load",value:function(){var e;return(e=function(){return function(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(u,"next",{value:a(0)}),c(u,"throw",{value:a(1)}),c(u,"return",{value:a(2)}),"function"==typeof Symbol&&c(u,Symbol.iterator,{value:function(){return this}}),u;function a(c){return function(a){var l=[c,a];if(n)throw TypeError("Generator is already executing.");for(;u&&(u=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(e){return this.pluginSettingsManager.addMenuItem({key:"plugin-build-visualization-block",title:this.t("Build Visualization Block"),icon:"DashboardOutlined",aclSnippet:"pm.plugin-build-visualization-block.settings"}),this.pluginSettingsManager.addPageTabItem({menuKey:"plugin-build-visualization-block",key:"index",title:this.t("Build Visualization Block"),componentLoader:function(){return p.e("812").then(p.bind(p,535)).then(function(e){return{default:e.SettingsPage}})}}),[2]})},function(){var n=this,r=arguments;return new Promise(function(o,i){var u=e.apply(n,r);function c(e){t(u,o,i,c,a,"next",e)}function a(e){t(u,o,i,c,a,"throw",e)}c(void 0)})}).call(this)}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(i.prototype,n),i}(i(e.Plugin))}(),h}()});
|
|
10
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("antd"),require("@nocobase/plugin-workflow/client-v2"),require("react"),require("react-i18next"),require("@nocobase/flow-engine"),require("ahooks"),require("@nocobase/client-v2")):"function"==typeof define&&define.amd?define("plugin-build-visualization-block/client-v2",["antd","@nocobase/plugin-workflow/client-v2","react","react-i18next","@nocobase/flow-engine","ahooks","@nocobase/client-v2"],t):"object"==typeof exports?exports["plugin-build-visualization-block/client-v2"]=t(require("antd"),require("@nocobase/plugin-workflow/client-v2"),require("react"),require("react-i18next"),require("@nocobase/flow-engine"),require("ahooks"),require("@nocobase/client-v2")):e["plugin-build-visualization-block/client-v2"]=t(e.antd,e["@nocobase/plugin-workflow/client-v2"],e.react,e["react-i18next"],e["@nocobase/flow-engine"],e.ahooks,e["@nocobase/client-v2"])}(self,function(e,t,n,r,i,o,a){return function(){"use strict";var u,s,l,c={456:function(e,t,n){n.d(t,{g:function(){return f},o:function(){return p}});var r=n(485),i=n(625),o=n(59),a=n(155),u=n.n(a),s=n(515);function l(e,t,n,r,i,o,a){try{var u=e[o](a),s=u.value}catch(e){n(e);return}u.done?t(s):Promise.resolve(s).then(r,i)}function c(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){l(o,r,i,a,u,"next",e)}function u(e){l(o,r,i,a,u,"throw",e)}a(void 0)})}}function d(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(a,"next",{value:s(0)}),u(a,"throw",{value:s(1)}),u(a,"return",{value:s(2)}),"function"==typeof Symbol&&u(a,Symbol.iterator,{value:function(){return this}}),a;function s(u){return function(s){var l=[u,s];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&l[0]?r.return:l[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,l[1])).done)return i;switch(r=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,r=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===l[0]||2===l[0])){o=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){o.label=l[1];break}if(6===l[0]&&o.label<i[1]){o.label=i[1],i=l;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(l);break}i[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],r=0}finally{n=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}function f(e){var t,n=e.value,a=e.onChange,l=e.disabled,f=(0,r.useApp)().apiClient,p=(0,s.k)(),h=(0,i.useRequest)(function(){return c(function(){return d(this,function(e){switch(e.label){case 0:return[4,f.resource("ai").listLLMServices()];case 1:return[2,e.sent().data.data]}})})()});return u().createElement(o.Select,{value:n,onChange:a,disabled:l,loading:h.loading,allowClear:!0,showSearch:!0,"aria-label":p("AI service"),style:{width:"100%"},optionFilterProp:"label",status:h.error?"error":void 0,notFoundContent:h.error?p("Failed to load the list"):void 0,options:null==(t=h.data)?void 0:t.map(function(e){return{label:e.title||e.name,value:e.name}})})}function p(e){var t,n=e.service,a=e.value,l=e.onChange,f=e.disabled,p=(0,r.useApp)().apiClient,h=(0,s.k)(),m=(0,i.useRequest)(function(){return c(function(){return d(this,function(e){switch(e.label){case 0:return[4,p.resource("ai").listModels({llmService:n})];case 1:return[2,e.sent().data.data]}})})()},{ready:!!n,refreshDeps:[n]});return u().createElement(o.Select,{value:a,onChange:l,disabled:f||!n,loading:!!n&&m.loading,"aria-label":h("Model"),style:{width:"100%"},allowClear:!0,showSearch:!0,optionFilterProp:"label",status:m.error?"error":void 0,notFoundContent:m.error?h("Failed to load the list"):void 0,options:n?null==(t=m.data)?void 0:t.flatMap(function(e){var t=e.id||e.name;return t?[{label:t,value:t}]:[]}):[]})}},667:function(e,t,n){n.d(t,{E:function(){return l}});var r=n(694),i=n(59),o=n(155),a=n.n(o),u=n(249),s=n(515);function l(e){var t,n=e.value,o=void 0===n?{}:n,l=e.onChange,c=e.disabled,d=(0,r.useFlowContext)(),f=(0,s.k)(),p=d.dataSourceManager.getDataSources(),h=o.dataSource&&(null==(t=d.dataSourceManager.getDataSource(o.dataSource))?void 0:t.getCollections())||[];return a().createElement(i.Space,{direction:"vertical",style:{width:"100%"}},a().createElement(i.Select,{"aria-label":f("Data source"),placeholder:f("Data source"),style:{width:"100%"},disabled:c,value:o.dataSource,showSearch:!0,optionFilterProp:"label",options:p.map(function(e){return{value:e.key,label:d.t(e.displayName||e.key)}}),onChange:function(e){return null==l?void 0:l({dataSource:e,collections:[]})}}),a().createElement(i.Select,{"aria-label":f("Collections"),placeholder:f("Collections"),mode:"multiple",style:{width:"100%"},disabled:c||!o.dataSource,value:o.collections||[],showSearch:!0,optionFilterProp:"label",maxCount:u.B1,options:h.filter(function(e){return d.acl.can({dataSourceKey:o.dataSource,resourceName:e.name,actionName:"list"})}).map(function(e){return{value:e.name,label:d.t(e.title||e.name)}}),onChange:function(e){return null==l?void 0:l({dataSource:o.dataSource,collections:e.slice(0,u.B1)})}}))}},284:function(e,t,n){let r,i,o;n.d(t,{lT:function(){return a7},bT:function(){return a8},M5:function(){return a3},DZ:function(){return a5},Du:function(){return ue}});var a,u,s={};n.r(s),n.d(s,{base64:function(){return eP},base64url:function(){return ej},bigint:function(){return eJ},boolean:function(){return eL},browserEmail:function(){return ek},cidrv4:function(){return eZ},cidrv6:function(){return eE},cuid:function(){return eo},cuid2:function(){return ea},date:function(){return eC},datetime:function(){return eD},domain:function(){return eI},duration:function(){return ed},e164:function(){return eA},email:function(){return eg},emoji:function(){return eS},extendedDuration:function(){return ef},guid:function(){return ep},hex:function(){return eK},hostname:function(){return eT},html5Email:function(){return eb},idnEmail:function(){return ew},integer:function(){return eB},ipv4:function(){return eO},ipv6:function(){return e$},ksuid:function(){return el},lowercase:function(){return eG},mac:function(){return ex},md5_base64:function(){return eQ},md5_base64url:function(){return e0},md5_hex:function(){return eY},nanoid:function(){return ec},null:function(){return eV},number:function(){return eU},rfc5322Email:function(){return e_},sha1_base64:function(){return e2},sha1_base64url:function(){return e4},sha1_hex:function(){return e1},sha256_base64:function(){return e9},sha256_base64url:function(){return e3},sha256_hex:function(){return e6},sha384_base64:function(){return e8},sha384_base64url:function(){return e7},sha384_hex:function(){return e5},sha512_base64:function(){return tt},sha512_base64url:function(){return tn},sha512_hex:function(){return te},string:function(){return eR},time:function(){return eM},ulid:function(){return eu},undefined:function(){return eq},unicodeEmail:function(){return ez},uppercase:function(){return eW},uuid:function(){return eh},uuid4:function(){return em},uuid6:function(){return ev},uuid7:function(){return ey},xid:function(){return es}});var l={};n.r(l),n.d(l,{endsWith:function(){return rC},gt:function(){return rg},gte:function(){return rb},includes:function(){return rA},length:function(){return rP},lowercase:function(){return rT},lt:function(){return rv},lte:function(){return ry},maxLength:function(){return rZ},maxSize:function(){return rO},mime:function(){return rM},minLength:function(){return rE},minSize:function(){return r$},multipleOf:function(){return rS},negative:function(){return rz},nonnegative:function(){return rk},nonpositive:function(){return rw},normalize:function(){return rR},overwrite:function(){return rD},positive:function(){return r_},property:function(){return rF},regex:function(){return rj},size:function(){return rx},slugify:function(){return rL},startsWith:function(){return rN},toLowerCase:function(){return rB},toUpperCase:function(){return rU},trim:function(){return rJ},uppercase:function(){return rI}});var c={};n.r(c),n.d(c,{ZodISODate:function(){return r2},ZodISODateTime:function(){return r0},ZodISODuration:function(){return r3},ZodISOTime:function(){return r6},date:function(){return r4},datetime:function(){return r1},duration:function(){return r5},time:function(){return r9}});var d={};function f(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:a,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=a.prototype,o=Object.keys(i);for(let e=0;e<o.length;e++){let t=o[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class o extends i{}function a(e){var t;let i=n?.Parent?new o:this;for(let n of(r(i,e),(t=i._zod).deferred??(t.deferred=[]),i._zod.deferred))n();return i}return Object.defineProperty(o,"name",{value:e}),Object.defineProperty(a,"init",{value:r}),Object.defineProperty(a,Symbol.hasInstance,{value:t=>!!n?.Parent&&t instanceof n.Parent||t?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}n.r(d),n.d(d,{ZodAny:function(){return oO},ZodArray:function(){return oN},ZodBase64:function(){return i1},ZodBase64URL:function(){return i4},ZodBigInt:function(){return oh},ZodBigIntFormat:function(){return ov},ZodBoolean:function(){return of},ZodCIDRv4:function(){return iH},ZodCIDRv6:function(){return iQ},ZodCUID:function(){return iN},ZodCUID2:function(){return iF},ZodCatch:function(){return a_},ZodCodec:function(){return a$},ZodCustom:function(){return aM},ZodCustomStringFormat:function(){return i7},ZodDate:function(){return oI},ZodDefault:function(){return af},ZodDiscriminatedUnion:function(){return oq},ZodE164:function(){return i9},ZodEmail:function(){return ib},ZodEmoji:function(){return ij},ZodEnum:function(){return o3},ZodExactOptional:function(){return au},ZodFile:function(){return at},ZodFunction:function(){return aC},ZodGUID:function(){return iz},ZodIPv4:function(){return iV},ZodIPv6:function(){return iK},ZodIntersection:function(){return oW},ZodJWT:function(){return i5},ZodKSUID:function(){return iU},ZodLazy:function(){return aT},ZodLiteral:function(){return o7},ZodMAC:function(){return iG},ZodMap:function(){return o2},ZodNaN:function(){return aw},ZodNanoID:function(){return iI},ZodNever:function(){return oE},ZodNonOptional:function(){return av},ZodNull:function(){return ok},ZodNullable:function(){return al},ZodNumber:function(){return oi},ZodNumberFormat:function(){return oa},ZodObject:function(){return oM},ZodOptional:function(){return ao},ZodPipe:function(){return aS},ZodPrefault:function(){return ah},ZodPromise:function(){return aA},ZodReadonly:function(){return aZ},ZodRecord:function(){return oY},ZodSet:function(){return o6},ZodString:function(){return iv},ZodStringFormat:function(){return ig},ZodSuccess:function(){return ag},ZodSymbol:function(){return ob},ZodTemplateLiteral:function(){return aP},ZodTransform:function(){return ar},ZodTuple:function(){return oX},ZodType:function(){return ih},ZodULID:function(){return iD},ZodURL:function(){return iZ},ZodUUID:function(){return ik},ZodUndefined:function(){return oz},ZodUnion:function(){return oB},ZodUnknown:function(){return ox},ZodVoid:function(){return oj},ZodXID:function(){return iJ},ZodXor:function(){return oL},_ZodString:function(){return im},_default:function(){return ap},_function:function(){return aF},any:function(){return o$},array:function(){return oC},base64:function(){return i2},base64url:function(){return i6},bigint:function(){return om},boolean:function(){return op},catch:function(){return az},check:function(){return aD},cidrv4:function(){return iY},cidrv6:function(){return i0},codec:function(){return ax},cuid:function(){return iC},cuid2:function(){return iM},custom:function(){return aR},date:function(){return oA},describe:function(){return aU},discriminatedUnion:function(){return oG},e164:function(){return i3},email:function(){return i_},emoji:function(){return iT},enum:function(){return o5},exactOptional:function(){return as},file:function(){return an},float32:function(){return os},float64:function(){return ol},function:function(){return aF},guid:function(){return iw},hash:function(){return or},hex:function(){return on},hostname:function(){return ot},httpUrl:function(){return iP},instanceof:function(){return aV},int:function(){return ou},int32:function(){return oc},int64:function(){return oy},intersection:function(){return oK},ipv4:function(){return iq},ipv6:function(){return iX},json:function(){return aG},jwt:function(){return i8},keyof:function(){return oF},ksuid:function(){return iL},lazy:function(){return aI},literal:function(){return ae},looseObject:function(){return oJ},looseRecord:function(){return o1},mac:function(){return iW},map:function(){return o4},meta:function(){return aL},nan:function(){return ak},nanoid:function(){return iA},nativeEnum:function(){return o8},never:function(){return oP},nonoptional:function(){return ay},null:function(){return oS},nullable:function(){return ac},nullish:function(){return ad},number:function(){return oo},object:function(){return oD},optional:function(){return aa},partialRecord:function(){return o0},pipe:function(){return aO},prefault:function(){return am},preprocess:function(){return aW},promise:function(){return aN},readonly:function(){return aE},record:function(){return oQ},refine:function(){return aJ},set:function(){return o9},strictObject:function(){return oR},string:function(){return iy},stringFormat:function(){return oe},stringbool:function(){return aq},success:function(){return ab},superRefine:function(){return aB},symbol:function(){return o_},templateLiteral:function(){return aj},transform:function(){return ai},tuple:function(){return oH},uint32:function(){return od},uint64:function(){return og},ulid:function(){return iR},undefined:function(){return ow},union:function(){return oU},unknown:function(){return oZ},url:function(){return iE},uuid:function(){return iS},uuidv4:function(){return iO},uuidv6:function(){return i$},uuidv7:function(){return ix},void:function(){return oT},xid:function(){return iB},xor:function(){return oV}}),Object.freeze({status:"aborted"}),Symbol("zod_brand");class p extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class h extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}let m={};function v(e){return e&&Object.assign(m,e),m}function y(e){let t=Object.values(e).filter(e=>"number"==typeof e);return Object.entries(e).filter(([e,n])=>-1===t.indexOf(+e)).map(([e,t])=>t)}function g(e,t="|"){return e.map(e=>M(e)).join(t)}function b(e,t){return"bigint"==typeof t?t.toString():t}function _(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function z(e){return null==e}function w(e){let t=+!!e.startsWith("^"),n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}let k=Symbol("evaluating");function S(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==k)return void 0===r&&(r=k,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function O(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function $(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function x(e){return JSON.stringify(e)}let Z="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function E(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}let P=_(()=>{if("u">typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return Function(""),!0}catch(e){return!1}});function j(e){if(!1===E(e))return!1;let t=e.constructor;if(void 0===t||"function"!=typeof t)return!0;let n=t.prototype;return!1!==E(n)&&!1!==Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")}function T(e){return j(e)?{...e}:Array.isArray(e)?[...e]:e}let I=new Set(["string","number","symbol"]),A=new Set(["string","number","bigint","boolean","symbol","undefined"]);function N(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function C(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function F(e){if(!e)return{};if("string"==typeof e)return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");e.error=e.message}return(delete e.message,"string"==typeof e.error)?{...e,error:()=>e.error}:e}function M(e){return"bigint"==typeof e?e.toString()+"n":"string"==typeof e?`"${e}"`:`${e}`}let D={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-0x80000000,0x7fffffff],uint32:[0,0xffffffff],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},R={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function J(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function B(e,t){return t.map(t=>(t.path??(t.path=[]),t.path.unshift(e),t))}function U(e){return"string"==typeof e?e:e?.message}function L(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=U(e.inst?._zod.def?.error?.(e))??U(t?.error?.(e))??U(n.customError?.(e))??U(n.localeError?.(e))??"Invalid input"),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function V(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function q(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function G(...e){let[t,n,r]=e;return"string"==typeof t?{message:t,code:"custom",input:n,inst:r}:{...t}}let W=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,b,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},K=f("$ZodError",W),X=f("$ZodError",W,{Parent:Error}),H=e=>(t,n,r,i)=>{let o=r?Object.assign(r,{async:!1}):{async:!1},a=t._zod.run({value:n,issues:[]},o);if(a instanceof Promise)throw new p;if(a.issues.length){let t=new(i?.Err??e)(a.issues.map(e=>L(e,o,v())));throw Z(t,i?.callee),t}return a.value},Y=H(X),Q=e=>async(t,n,r,i)=>{let o=r?Object.assign(r,{async:!0}):{async:!0},a=t._zod.run({value:n,issues:[]},o);if(a instanceof Promise&&(a=await a),a.issues.length){let t=new(i?.Err??e)(a.issues.map(e=>L(e,o,v())));throw Z(t,i?.callee),t}return a.value},ee=Q(X),et=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},i);if(o instanceof Promise)throw new p;return o.issues.length?{success:!1,error:new(e??K)(o.issues.map(e=>L(e,i,v())))}:{success:!0,data:o.value}},en=et(X),er=e=>async(t,n,r)=>{let i=r?Object.assign(r,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(e=>L(e,i,v())))}:{success:!0,data:o.value}},ei=er(X),eo=/^[cC][^\s-]{8,}$/,ea=/^[0-9a-z]+$/,eu=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,es=/^[0-9a-vA-V]{20}$/,el=/^[A-Za-z0-9]{27}$/,ec=/^[a-zA-Z0-9_-]{21}$/,ed=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ef=/^[-+]?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)?)??$/,ep=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,eh=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,em=eh(4),ev=eh(6),ey=eh(7),eg=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,eb=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,e_=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,ez=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,ew=ez,ek=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;function eS(){return RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}let eO=/^(?:(?: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])$/,e$=/^(([0-9a-fA-F]{1,4}:){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}|:))$/,ex=e=>{let t=N(e??":");return RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},eZ=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,eE=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,eP=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ej=/^[A-Za-z0-9_-]*$/,eT=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,eI=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,eA=/^\+[1-9]\d{6,14}$/,eN="(?:(?:\\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])))",eC=RegExp(`^${eN}$`);function eF(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function eM(e){return RegExp(`^${eF(e)}$`)}function eD(e){let t=eF({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${t}(?:${n.join("|")})`;return RegExp(`^${eN}T(?:${r})$`)}let eR=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return RegExp(`^${t}$`)},eJ=/^-?\d+n?$/,eB=/^-?\d+$/,eU=/^-?\d+(?:\.\d+)?$/,eL=/^(?:true|false)$/i,eV=/^null$/i,eq=/^undefined$/i,eG=/^[^A-Z]*$/,eW=/^[^a-z]*$/,eK=/^[0-9a-fA-F]*$/;function eX(e,t){return RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function eH(e){return RegExp(`^[A-Za-z0-9_-]{${e}}$`)}let eY=/^[0-9a-fA-F]{32}$/,eQ=eX(22,"=="),e0=eH(22),e1=/^[0-9a-fA-F]{40}$/,e2=eX(27,"="),e4=eH(27),e6=/^[0-9a-fA-F]{64}$/,e9=eX(43,"="),e3=eH(43),e5=/^[0-9a-fA-F]{96}$/,e8=eX(64,""),e7=eH(64),te=/^[0-9a-fA-F]{128}$/,tt=eX(86,"=="),tn=eH(86),tr=f("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),ti={number:"number",bigint:"bigint",object:"date"},to=f("$ZodCheckLessThan",(e,t)=>{tr.init(e,t);let n=ti[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:"object"==typeof t.value?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ta=f("$ZodCheckGreaterThan",(e,t)=>{tr.init(e,t);let n=ti[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:"object"==typeof t.value?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),tu=f("$ZodCheckMultipleOf",(e,t)=>{tr.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof n.value?n.value%t.value===BigInt(0):0===function(e,t){let n=(e.toString().split(".")[1]||"").length,r=t.toString(),i=(r.split(".")[1]||"").length;if(0===i&&/\d?e-\d?/.test(r)){let e=r.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}let o=n>i?n:i;return Number.parseInt(e.toFixed(o).replace(".",""))%Number.parseInt(t.toFixed(o).replace(".",""))/10**o}(n.value,t.value))||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),ts=f("$ZodCheckNumberFormat",(e,t)=>{tr.init(e,t),t.format=t.format||"float64";let n=t.format?.includes("int"),r=n?"int":"number",[i,o]=D[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=o,n&&(r.pattern=eB)}),e._zod.check=a=>{let u=a.value;if(n){if(!Number.isInteger(u))return void a.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:u,inst:e});if(!Number.isSafeInteger(u))return void(u>0?a.issues.push({input:u,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):a.issues.push({input:u,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}))}u<i&&a.issues.push({origin:"number",input:u,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),u>o&&a.issues.push({origin:"number",input:u,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),tl=f("$ZodCheckBigIntFormat",(e,t)=>{tr.init(e,t);let[n,r]=R[t.format];e._zod.onattach.push(e=>{let i=e._zod.bag;i.format=t.format,i.minimum=n,i.maximum=r}),e._zod.check=i=>{let o=i.value;o<n&&i.issues.push({origin:"bigint",input:o,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),o>r&&i.issues.push({origin:"bigint",input:o,code:"too_big",maximum:r,inclusive:!0,inst:e,continue:!t.abort})}}),tc=f("$ZodCheckMaxSize",(e,t)=>{var n;tr.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!z(t)&&void 0!==t.size}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;r.size<=t.maximum||n.issues.push({origin:V(r),code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),td=f("$ZodCheckMinSize",(e,t)=>{var n;tr.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!z(t)&&void 0!==t.size}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;r.size>=t.minimum||n.issues.push({origin:V(r),code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),tf=f("$ZodCheckSizeEquals",(e,t)=>{var n;tr.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!z(t)&&void 0!==t.size}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.size,n.maximum=t.size,n.size=t.size}),e._zod.check=n=>{let r=n.value,i=r.size;if(i===t.size)return;let o=i>t.size;n.issues.push({origin:V(r),...o?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),tp=f("$ZodCheckMaxLength",(e,t)=>{var n;tr.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!z(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=q(r);n.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),th=f("$ZodCheckMinLength",(e,t)=>{var n;tr.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!z(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=q(r);n.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),tm=f("$ZodCheckLengthEquals",(e,t)=>{var n;tr.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!z(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let o=q(r),a=i>t.length;n.issues.push({origin:o,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),tv=f("$ZodCheckStringFormat",(e,t)=>{var n,r;tr.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??(n.patterns=new Set),n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),ty=f("$ZodCheckRegex",(e,t)=>{tv.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),tg=f("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=eG),tv.init(e,t)}),tb=f("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=eW),tv.init(e,t)}),t_=f("$ZodCheckIncludes",(e,t)=>{tr.init(e,t);let n=N(t.includes),r=new RegExp("number"==typeof t.position?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),tz=f("$ZodCheckStartsWith",(e,t)=>{tr.init(e,t);let n=RegExp(`^${N(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),tw=f("$ZodCheckEndsWith",(e,t)=>{tr.init(e,t);let n=RegExp(`.*${N(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});function tk(e,t,n){e.issues.length&&t.issues.push(...B(n,e.issues))}let tS=f("$ZodCheckProperty",(e,t)=>{tr.init(e,t),e._zod.check=e=>{let n=t.schema._zod.run({value:e.value[t.property],issues:[]},{});if(n instanceof Promise)return n.then(n=>tk(n,e,t.property));tk(n,e,t.property)}}),tO=f("$ZodCheckMimeType",(e,t)=>{tr.init(e,t);let n=new Set(t.mime);e._zod.onattach.push(e=>{e._zod.bag.mime=t.mime}),e._zod.check=r=>{n.has(r.value.type)||r.issues.push({code:"invalid_value",values:t.mime,input:r.value.type,inst:e,continue:!t.abort})}}),t$=f("$ZodCheckOverwrite",(e,t)=>{tr.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class tx{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let t=e.split("\n").filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length));for(let e of t.map(e=>e.slice(n)).map(e=>" ".repeat(2*this.indent)+e))this.content.push(e)}compile(){return Function(...this?.args,[...(this?.content??[""]).map(e=>` ${e}`)].join("\n"))}}let tZ={major:4,minor:3,patch:5},tE=f("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=tZ;let r=[...e._zod.def.checks??[]];for(let t of(e._zod.traits.has("$ZodCheck")&&r.unshift(e),r))for(let n of t._zod.onattach)n(e);if(0===r.length)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r,i=J(e);for(let o of t){if(o._zod.def.when){if(!o._zod.def.when(e))continue}else if(i)continue;let t=e.issues.length,a=o._zod.check(e);if(a instanceof Promise&&n?.async===!1)throw new p;if(r||a instanceof Promise)r=(r??Promise.resolve()).then(async()=>{await a,e.issues.length!==t&&(i||(i=J(e,t)))});else{if(e.issues.length===t)continue;i||(i=J(e,t))}}return r?r.then(()=>e):e},n=(n,i,o)=>{if(J(n))return n.aborted=!0,n;let a=t(i,r,o);if(a instanceof Promise){if(!1===o.async)throw new p;return a.then(t=>e._zod.parse(t,o))}return e._zod.parse(a,o)};e._zod.run=(i,o)=>{if(o.skipChecks)return e._zod.parse(i,o);if("backward"===o.direction){let t=e._zod.parse({value:i.value,issues:[]},{...o,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,o)):n(t,i,o)}let a=e._zod.parse(i,o);if(a instanceof Promise){if(!1===o.async)throw new p;return a.then(e=>t(e,r,o))}return t(a,r,o)}}S(e,"~standard",()=>({validate:t=>{try{let n=en(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch(n){return ei(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),tP=f("$ZodString",(e,t)=>{tE.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??eR(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch(e){}return"string"==typeof n.value||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),tj=f("$ZodStringFormat",(e,t)=>{tv.init(e,t),tP.init(e,t)}),tT=f("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=ep),tj.init(e,t)}),tI=f("$ZodUUID",(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=eh(e))}else t.pattern??(t.pattern=eh());tj.init(e,t)}),tA=f("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=eg),tj.init(e,t)}),tN=f("$ZodURL",(e,t)=>{tj.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch(r){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),tC=f("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=eS()),tj.init(e,t)}),tF=f("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=ec),tj.init(e,t)}),tM=f("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=eo),tj.init(e,t)}),tD=f("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=ea),tj.init(e,t)}),tR=f("$ZodULID",(e,t)=>{t.pattern??(t.pattern=eu),tj.init(e,t)}),tJ=f("$ZodXID",(e,t)=>{t.pattern??(t.pattern=es),tj.init(e,t)}),tB=f("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=el),tj.init(e,t)}),tU=f("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=eD(t)),tj.init(e,t)}),tL=f("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=eC),tj.init(e,t)}),tV=f("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=eM(t)),tj.init(e,t)}),tq=f("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=ed),tj.init(e,t)}),tG=f("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=eO),tj.init(e,t),e._zod.bag.format="ipv4"}),tW=f("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=e$),tj.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),tK=f("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=ex(t.delimiter)),tj.init(e,t),e._zod.bag.format="mac"}),tX=f("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=eZ),tj.init(e,t)}),tH=f("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=eE),tj.init(e,t),e._zod.check=n=>{let r=n.value.split("/");try{if(2!==r.length)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function tY(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}let tQ=f("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=eP),tj.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{tY(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}}),t0=f("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=ej),tj.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{!function(e){if(!ej.test(e))return!1;let t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return tY(t.padEnd(4*Math.ceil(t.length/4),"="))}(n.value)&&n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),t1=f("$ZodE164",(e,t)=>{t.pattern??(t.pattern=eA),tj.init(e,t)}),t2=f("$ZodJWT",(e,t)=>{tj.init(e,t),e._zod.check=n=>{!function(e,t=null){try{let n=e.split(".");if(3!==n.length)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));if("typ"in i&&i?.typ!=="JWT"||!i.alg||t&&(!("alg"in i)||i.alg!==t))return!1;return!0}catch{return!1}}(n.value,t.alg)&&n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),t4=f("$ZodCustomStringFormat",(e,t)=>{tj.init(e,t),e._zod.check=n=>{t.fn(n.value)||n.issues.push({code:"invalid_format",format:t.format,input:n.value,inst:e,continue:!t.abort})}}),t6=f("$ZodNumber",(e,t)=>{tE.init(e,t),e._zod.pattern=e._zod.bag.pattern??eU,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch(e){}let i=n.value;if("number"==typeof i&&!Number.isNaN(i)&&Number.isFinite(i))return n;let o="number"==typeof i?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...o?{received:o}:{}}),n}}),t9=f("$ZodNumberFormat",(e,t)=>{ts.init(e,t),t6.init(e,t)}),t3=f("$ZodBoolean",(e,t)=>{tE.init(e,t),e._zod.pattern=eL,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch(e){}let i=n.value;return"boolean"==typeof i||n.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),n}}),t5=f("$ZodBigInt",(e,t)=>{tE.init(e,t),e._zod.pattern=eJ,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=BigInt(n.value)}catch(e){}return"bigint"==typeof n.value||n.issues.push({expected:"bigint",code:"invalid_type",input:n.value,inst:e}),n}}),t8=f("$ZodBigIntFormat",(e,t)=>{tl.init(e,t),t5.init(e,t)}),t7=f("$ZodSymbol",(e,t)=>{tE.init(e,t),e._zod.parse=(t,n)=>{let r=t.value;return"symbol"==typeof r||t.issues.push({expected:"symbol",code:"invalid_type",input:r,inst:e}),t}}),ne=f("$ZodUndefined",(e,t)=>{tE.init(e,t),e._zod.pattern=eq,e._zod.values=new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(t,n)=>{let r=t.value;return void 0===r||t.issues.push({expected:"undefined",code:"invalid_type",input:r,inst:e}),t}}),nt=f("$ZodNull",(e,t)=>{tE.init(e,t),e._zod.pattern=eV,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return null===r||t.issues.push({expected:"null",code:"invalid_type",input:r,inst:e}),t}}),nn=f("$ZodAny",(e,t)=>{tE.init(e,t),e._zod.parse=e=>e}),nr=f("$ZodUnknown",(e,t)=>{tE.init(e,t),e._zod.parse=e=>e}),ni=f("$ZodNever",(e,t)=>{tE.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)}),no=f("$ZodVoid",(e,t)=>{tE.init(e,t),e._zod.parse=(t,n)=>{let r=t.value;return void 0===r||t.issues.push({expected:"void",code:"invalid_type",input:r,inst:e}),t}}),na=f("$ZodDate",(e,t)=>{tE.init(e,t),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=new Date(n.value)}catch(e){}let i=n.value,o=i instanceof Date;return o&&!Number.isNaN(i.getTime())||n.issues.push({expected:"date",code:"invalid_type",input:i,...o?{received:"Invalid Date"}:{},inst:e}),n}});function nu(e,t,n){e.issues.length&&t.issues.push(...B(n,e.issues)),t.value[n]=e.value}let ns=f("$ZodArray",(e,t)=>{tE.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),n;n.value=Array(i.length);let o=[];for(let e=0;e<i.length;e++){let a=i[e],u=t.element._zod.run({value:a,issues:[]},r);u instanceof Promise?o.push(u.then(t=>nu(t,n,e))):nu(u,n,e)}return o.length?Promise.all(o).then(()=>n):n}});function nl(e,t,n,r,i){if(e.issues.length){if(i&&!(n in r))return;t.issues.push(...B(n,e.issues))}void 0===e.value?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function nc(e){var t;let n=Object.keys(e.shape);for(let t of n)if(!e.shape?.[t]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${t}": expected a Zod schema`);let r=Object.keys(t=e.shape).filter(e=>"optional"===t[e]._zod.optin&&"optional"===t[e]._zod.optout);return{...e,keys:n,keySet:new Set(n),numKeys:n.length,optionalKeys:new Set(r)}}function nd(e,t,n,r,i,o){let a=[],u=i.keySet,s=i.catchall._zod,l=s.def.type,c="optional"===s.optout;for(let i in t){if(u.has(i))continue;if("never"===l){a.push(i);continue}let o=s.run({value:t[i],issues:[]},r);o instanceof Promise?e.push(o.then(e=>nl(e,n,i,t,c))):nl(o,n,i,t,c)}return(a.length&&n.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:o}),e.length)?Promise.all(e).then(()=>n):n}let nf=f("$ZodObject",(e,t)=>{let n;tE.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape");if(!r?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}let i=_(()=>nc(t));S(e._zod,"propValues",()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values)for(let e of(n[t]??(n[t]=new Set),r.values))n[t].add(e)}return n});let o=t.catchall;e._zod.parse=(t,r)=>{n??(n=i.value);let a=t.value;if(!E(a))return t.issues.push({expected:"object",code:"invalid_type",input:a,inst:e}),t;t.value={};let u=[],s=n.shape;for(let e of n.keys){let n=s[e],i="optional"===n._zod.optout,o=n._zod.run({value:a[e],issues:[]},r);o instanceof Promise?u.push(o.then(n=>nl(n,t,e,a,i))):nl(o,t,e,a,i)}return o?nd(u,a,t,r,i.value,e):u.length?Promise.all(u).then(()=>t):t}}),np=f("$ZodObjectJIT",(e,t)=>{let n,r;nf.init(e,t);let i=e._zod.parse,o=_(()=>nc(t)),a=!m.jitless,u=a&&P.value,s=t.catchall;e._zod.parse=(l,c)=>{r??(r=o.value);let d=l.value;return E(d)?a&&u&&c?.async===!1&&!0!==c.jitless?(n||(n=(e=>{let t=new tx(["shape","payload","ctx"]),n=o.value,r=e=>{let t=x(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");let i=Object.create(null),a=0;for(let e of n.keys)i[e]=`key_${a++}`;for(let o of(t.write("const newResult = {};"),n.keys)){let n=i[o],a=x(o),u=e[o],s=u?._zod?.optout==="optional";t.write(`const ${n} = ${r(o)};`),s?t.write(`
|
|
11
|
+
if (${n}.issues.length) {
|
|
12
|
+
if (${a} in input) {
|
|
13
|
+
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
14
|
+
...iss,
|
|
15
|
+
path: iss.path ? [${a}, ...iss.path] : [${a}]
|
|
16
|
+
})));
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (${n}.value === undefined) {
|
|
21
|
+
if (${a} in input) {
|
|
22
|
+
newResult[${a}] = undefined;
|
|
23
|
+
}
|
|
24
|
+
} else {
|
|
25
|
+
newResult[${a}] = ${n}.value;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
`):t.write(`
|
|
29
|
+
if (${n}.issues.length) {
|
|
30
|
+
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
31
|
+
...iss,
|
|
32
|
+
path: iss.path ? [${a}, ...iss.path] : [${a}]
|
|
33
|
+
})));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (${n}.value === undefined) {
|
|
37
|
+
if (${a} in input) {
|
|
38
|
+
newResult[${a}] = undefined;
|
|
39
|
+
}
|
|
40
|
+
} else {
|
|
41
|
+
newResult[${a}] = ${n}.value;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
`)}t.write("payload.value = newResult;"),t.write("return payload;");let u=t.compile();return(t,n)=>u(e,t,n)})(t.shape)),l=n(l,c),s)?nd([],d,l,c,r,e):l:i(l,c):(l.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),l)}});function nh(e,t,n,r){for(let n of e)if(0===n.issues.length)return t.value=n.value,t;let i=e.filter(e=>!J(e));return 1===i.length?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>L(e,r,v())))}),t)}let nm=f("$ZodUnion",(e,t)=>{tE.init(e,t),S(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),S(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),S(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),S(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>w(e.source)).join("|")})$`)}});let n=1===t.options.length,r=t.options[0]._zod.run;e._zod.parse=(i,o)=>{if(n)return r(i,o);let a=!1,u=[];for(let e of t.options){let t=e._zod.run({value:i.value,issues:[]},o);if(t instanceof Promise)u.push(t),a=!0;else{if(0===t.issues.length)return t;u.push(t)}}return a?Promise.all(u).then(t=>nh(t,i,e,o)):nh(u,i,e,o)}});function nv(e,t,n,r){let i=e.filter(e=>0===e.issues.length);return 1===i.length?t.value=i[0].value:0===i.length?t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>L(e,r,v())))}):t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:[],inclusive:!1}),t}let ny=f("$ZodXor",(e,t)=>{nm.init(e,t),t.inclusive=!1;let n=1===t.options.length,r=t.options[0]._zod.run;e._zod.parse=(i,o)=>{if(n)return r(i,o);let a=!1,u=[];for(let e of t.options){let t=e._zod.run({value:i.value,issues:[]},o);t instanceof Promise?(u.push(t),a=!0):u.push(t)}return a?Promise.all(u).then(t=>nv(t,i,e,o)):nv(u,i,e,o)}}),ng=f("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,nm.init(e,t);let n=e._zod.parse;S(e._zod,"propValues",()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||0===Object.keys(r).length)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r))for(let r of(e[t]||(e[t]=new Set),n))e[t].add(r)}return e});let r=_(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||0===e.size)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,o)=>{let a=i.value;if(!E(a))return i.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),i;let u=r.value.get(a?.[t.discriminator]);return u?u._zod.run(i,o):t.unionFallback?n(i,o):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:a,path:[t.discriminator],inst:e}),i)}}),nb=f("$ZodIntersection",(e,t)=>{tE.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),o=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||o instanceof Promise?Promise.all([i,o]).then(([t,n])=>n_(e,t,n)):n_(e,i,o)}});function n_(e,t,n){let r,i=new Map;for(let n of t.issues)if("unrecognized_keys"===n.code)for(let e of(r??(r=n),n.keys))i.has(e)||i.set(e,{}),i.get(e).l=!0;else e.issues.push(n);for(let t of n.issues)if("unrecognized_keys"===t.code)for(let e of t.keys)i.has(e)||i.set(e,{}),i.get(e).r=!0;else e.issues.push(t);let o=[...i].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(o.length&&r&&e.issues.push({...r,keys:o}),J(e))return e;let a=function e(t,n){if(t===n||t instanceof Date&&n instanceof Date&&+t==+n)return{valid:!0,data:t};if(j(t)&&j(n)){let r=Object.keys(n),i=Object.keys(t).filter(e=>-1!==r.indexOf(e)),o={...t,...n};for(let r of i){let i=e(t[r],n[r]);if(!i.valid)return{valid:!1,mergeErrorPath:[r,...i.mergeErrorPath]};o[r]=i.data}return{valid:!0,data:o}}if(Array.isArray(t)&&Array.isArray(n)){if(t.length!==n.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let i=0;i<t.length;i++){let o=e(t[i],n[i]);if(!o.valid)return{valid:!1,mergeErrorPath:[i,...o.mergeErrorPath]};r.push(o.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}(t.value,n.value);if(!a.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}let nz=f("$ZodTuple",(e,t)=>{tE.init(e,t);let n=t.items;e._zod.parse=(r,i)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({input:o,inst:e,expected:"tuple",code:"invalid_type"}),r;r.value=[];let a=[],u=[...n].reverse().findIndex(e=>"optional"!==e._zod.optin),s=-1===u?0:n.length-u;if(!t.rest){let t=o.length>n.length,i=o.length<s-1;if(t||i)return r.issues.push({...t?{code:"too_big",maximum:n.length,inclusive:!0}:{code:"too_small",minimum:n.length},input:o,inst:e,origin:"array"}),r}let l=-1;for(let e of n){if(++l>=o.length&&l>=s)continue;let t=e._zod.run({value:o[l],issues:[]},i);t instanceof Promise?a.push(t.then(e=>nw(e,r,l))):nw(t,r,l)}if(t.rest)for(let e of o.slice(n.length)){l++;let n=t.rest._zod.run({value:e,issues:[]},i);n instanceof Promise?a.push(n.then(e=>nw(e,r,l))):nw(n,r,l)}return a.length?Promise.all(a).then(()=>r):r}});function nw(e,t,n){e.issues.length&&t.issues.push(...B(n,e.issues)),t.value[n]=e.value}let nk=f("$ZodRecord",(e,t)=>{tE.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!j(i))return n.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),n;let o=[],a=t.keyType._zod.values;if(a){let u;n.value={};let s=new Set;for(let e of a)if("string"==typeof e||"number"==typeof e||"symbol"==typeof e){s.add("number"==typeof e?e.toString():e);let a=t.valueType._zod.run({value:i[e],issues:[]},r);a instanceof Promise?o.push(a.then(t=>{t.issues.length&&n.issues.push(...B(e,t.issues)),n.value[e]=t.value})):(a.issues.length&&n.issues.push(...B(e,a.issues)),n.value[e]=a.value)}for(let e in i)s.has(e)||(u=u??[]).push(e);u&&u.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:u})}else for(let a of(n.value={},Reflect.ownKeys(i))){if("__proto__"===a)continue;let u=t.keyType._zod.run({value:a,issues:[]},r);if(u instanceof Promise)throw Error("Async schemas not supported in object keys currently");if("string"==typeof a&&eU.test(a)&&u.issues.length&&u.issues.some(e=>"invalid_type"===e.code&&"number"===e.expected)){let e=t.keyType._zod.run({value:Number(a),issues:[]},r);if(e instanceof Promise)throw Error("Async schemas not supported in object keys currently");0===e.issues.length&&(u=e)}if(u.issues.length){"loose"===t.mode?n.value[a]=i[a]:n.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map(e=>L(e,r,v())),input:a,path:[a],inst:e});continue}let s=t.valueType._zod.run({value:i[a],issues:[]},r);s instanceof Promise?o.push(s.then(e=>{e.issues.length&&n.issues.push(...B(a,e.issues)),n.value[u.value]=e.value})):(s.issues.length&&n.issues.push(...B(a,s.issues)),n.value[u.value]=s.value)}return o.length?Promise.all(o).then(()=>n):n}}),nS=f("$ZodMap",(e,t)=>{tE.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!(i instanceof Map))return n.issues.push({expected:"map",code:"invalid_type",input:i,inst:e}),n;let o=[];for(let[a,u]of(n.value=new Map,i)){let s=t.keyType._zod.run({value:a,issues:[]},r),l=t.valueType._zod.run({value:u,issues:[]},r);s instanceof Promise||l instanceof Promise?o.push(Promise.all([s,l]).then(([t,o])=>{nO(t,o,n,a,i,e,r)})):nO(s,l,n,a,i,e,r)}return o.length?Promise.all(o).then(()=>n):n}});function nO(e,t,n,r,i,o,a){e.issues.length&&(I.has(typeof r)?n.issues.push(...B(r,e.issues)):n.issues.push({code:"invalid_key",origin:"map",input:i,inst:o,issues:e.issues.map(e=>L(e,a,v()))})),t.issues.length&&(I.has(typeof r)?n.issues.push(...B(r,t.issues)):n.issues.push({origin:"map",code:"invalid_element",input:i,inst:o,key:r,issues:t.issues.map(e=>L(e,a,v()))})),n.value.set(e.value,t.value)}let n$=f("$ZodSet",(e,t)=>{tE.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!(i instanceof Set))return n.issues.push({input:i,inst:e,expected:"set",code:"invalid_type"}),n;let o=[];for(let e of(n.value=new Set,i)){let i=t.valueType._zod.run({value:e,issues:[]},r);i instanceof Promise?o.push(i.then(e=>nx(e,n))):nx(i,n)}return o.length?Promise.all(o).then(()=>n):n}});function nx(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}let nZ=f("$ZodEnum",(e,t)=>{tE.init(e,t);let n=y(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>I.has(typeof e)).map(e=>"string"==typeof e?N(e):e.toString()).join("|")})$`),e._zod.parse=(t,i)=>{let o=t.value;return r.has(o)||t.issues.push({code:"invalid_value",values:n,input:o,inst:e}),t}}),nE=f("$ZodLiteral",(e,t)=>{if(tE.init(e,t),0===t.values.length)throw Error("Cannot create literal schema with no valid values");let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>"string"==typeof e?N(e):e?N(e.toString()):String(e)).join("|")})$`),e._zod.parse=(r,i)=>{let o=r.value;return n.has(o)||r.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),r}}),nP=f("$ZodFile",(e,t)=>{tE.init(e,t),e._zod.parse=(t,n)=>{let r=t.value;return r instanceof File||t.issues.push({expected:"file",code:"invalid_type",input:r,inst:e}),t}}),nj=f("$ZodTransform",(e,t)=>{tE.init(e,t),e._zod.parse=(n,r)=>{if("backward"===r.direction)throw new h(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new p;return n.value=i,n}});function nT(e,t){return e.issues.length&&void 0===t?{issues:[],value:void 0}:e}let nI=f("$ZodOptional",(e,t)=>{tE.init(e,t),e._zod.optin="optional",e._zod.optout="optional",S(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),S(e._zod,"pattern",()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${w(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if("optional"===t.innerType._zod.optin){let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>nT(t,e.value)):nT(r,e.value)}return void 0===e.value?e:t.innerType._zod.run(e,n)}}),nA=f("$ZodExactOptional",(e,t)=>{nI.init(e,t),S(e._zod,"values",()=>t.innerType._zod.values),S(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),nN=f("$ZodNullable",(e,t)=>{tE.init(e,t),S(e._zod,"optin",()=>t.innerType._zod.optin),S(e._zod,"optout",()=>t.innerType._zod.optout),S(e._zod,"pattern",()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${w(e.source)}|null)$`):void 0}),S(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>null===e.value?e:t.innerType._zod.run(e,n)}),nC=f("$ZodDefault",(e,t)=>{tE.init(e,t),e._zod.optin="optional",S(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);if(void 0===e.value)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>nF(e,t)):nF(r,t)}});function nF(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}let nM=f("$ZodPrefault",(e,t)=>{tE.init(e,t),e._zod.optin="optional",S(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>("backward"===n.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),nD=f("$ZodNonOptional",(e,t)=>{tE.init(e,t),S(e._zod,"values",()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>nR(t,e)):nR(i,e)}});function nR(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}let nJ=f("$ZodSuccess",(e,t)=>{tE.init(e,t),e._zod.parse=(e,n)=>{if("backward"===n.direction)throw new h("ZodSuccess");let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>(e.value=0===t.issues.length,e)):(e.value=0===r.issues.length,e)}}),nB=f("$ZodCatch",(e,t)=>{tE.init(e,t),S(e._zod,"optin",()=>t.innerType._zod.optin),S(e._zod,"optout",()=>t.innerType._zod.optout),S(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>L(e,n,v()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>L(e,n,v()))},input:e.value}),e.issues=[]),e)}}),nU=f("$ZodNaN",(e,t)=>{tE.init(e,t),e._zod.parse=(t,n)=>("number"==typeof t.value&&Number.isNaN(t.value)||t.issues.push({input:t.value,inst:e,expected:"nan",code:"invalid_type"}),t)}),nL=f("$ZodPipe",(e,t)=>{tE.init(e,t),S(e._zod,"values",()=>t.in._zod.values),S(e._zod,"optin",()=>t.in._zod.optin),S(e._zod,"optout",()=>t.out._zod.optout),S(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if("backward"===n.direction){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>nV(e,t.in,n)):nV(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>nV(e,t.out,n)):nV(r,t.out,n)}});function nV(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}let nq=f("$ZodCodec",(e,t)=>{tE.init(e,t),S(e._zod,"values",()=>t.in._zod.values),S(e._zod,"optin",()=>t.in._zod.optin),S(e._zod,"optout",()=>t.out._zod.optout),S(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if("forward"===(n.direction||"forward")){let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>nG(e,t,n)):nG(r,t,n)}{let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>nG(e,t,n)):nG(r,t,n)}}});function nG(e,t,n){if(e.issues.length)return e.aborted=!0,e;if("forward"===(n.direction||"forward")){let r=t.transform(e.value,e);return r instanceof Promise?r.then(r=>nW(e,r,t.out,n)):nW(e,r,t.out,n)}{let r=t.reverseTransform(e.value,e);return r instanceof Promise?r.then(r=>nW(e,r,t.in,n)):nW(e,r,t.in,n)}}function nW(e,t,n,r){return e.issues.length?(e.aborted=!0,e):n._zod.run({value:t,issues:e.issues},r)}let nK=f("$ZodReadonly",(e,t)=>{tE.init(e,t),S(e._zod,"propValues",()=>t.innerType._zod.propValues),S(e._zod,"values",()=>t.innerType._zod.values),S(e._zod,"optin",()=>t.innerType?._zod?.optin),S(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(nX):nX(r)}});function nX(e){return e.value=Object.freeze(e.value),e}let nH=f("$ZodTemplateLiteral",(e,t)=>{tE.init(e,t);let n=[];for(let e of t.parts)if("object"==typeof e&&null!==e){if(!e._zod.pattern)throw Error(`Invalid template literal part, no pattern found: ${[...e._zod.traits].shift()}`);let t=e._zod.pattern instanceof RegExp?e._zod.pattern.source:e._zod.pattern;if(!t)throw Error(`Invalid template literal part: ${e._zod.traits}`);let r=+!!t.startsWith("^"),i=t.endsWith("$")?t.length-1:t.length;n.push(t.slice(r,i))}else if(null===e||A.has(typeof e))n.push(N(`${e}`));else throw Error(`Invalid template literal part: ${e}`);e._zod.pattern=RegExp(`^${n.join("")}$`),e._zod.parse=(n,r)=>("string"!=typeof n.value?n.issues.push({input:n.value,inst:e,expected:"string",code:"invalid_type"}):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source})),n)}),nY=f("$ZodFunction",(e,t)=>(tE.init(e,t),e._def=t,e._zod.def=t,e.implement=t=>{if("function"!=typeof t)throw Error("implement() must be called with a function");return function(...n){let r=Reflect.apply(t,this,e._def.input?Y(e._def.input,n):n);return e._def.output?Y(e._def.output,r):r}},e.implementAsync=t=>{if("function"!=typeof t)throw Error("implementAsync() must be called with a function");return async function(...n){let r=e._def.input?await ee(e._def.input,n):n,i=await Reflect.apply(t,this,r);return e._def.output?await ee(e._def.output,i):i}},e._zod.parse=(t,n)=>("function"!=typeof t.value?t.issues.push({code:"invalid_type",expected:"function",input:t.value,inst:e}):e._def.output&&"promise"===e._def.output._zod.def.type?t.value=e.implementAsync(t.value):t.value=e.implement(t.value),t),e.input=(...t)=>{let n=e.constructor;return new n(Array.isArray(t[0])?{type:"function",input:new nz({type:"tuple",items:t[0],rest:t[1]}),output:e._def.output}:{type:"function",input:t[0],output:e._def.output})},e.output=t=>new e.constructor({type:"function",input:e._def.input,output:t}),e)),nQ=f("$ZodPromise",(e,t)=>{tE.init(e,t),e._zod.parse=(e,n)=>Promise.resolve(e.value).then(e=>t.innerType._zod.run({value:e,issues:[]},n))}),n0=f("$ZodLazy",(e,t)=>{tE.init(e,t),S(e._zod,"innerType",()=>t.getter()),S(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),S(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),S(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),S(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),n1=f("$ZodCustom",(e,t)=>{tr.init(e,t),tE.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>n2(t,n,r,e));n2(i,n,r,e)}});function n2(e,t,n,r){if(!e){let e={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(G(e))}}Symbol("ZodOutput"),Symbol("ZodInput");(a=globalThis).__zod_globalRegistry??(a.__zod_globalRegistry=new class e{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&"object"==typeof n&&"id"in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}});let n4=globalThis.__zod_globalRegistry;function n6(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...F(t)})}function n9(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...F(t)})}function n3(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...F(t)})}function n5(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...F(t)})}function n8(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...F(t)})}function n7(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...F(t)})}function re(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...F(t)})}function rt(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...F(t)})}function rn(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...F(t)})}function rr(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...F(t)})}function ri(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...F(t)})}function ro(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...F(t)})}function ra(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...F(t)})}function ru(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...F(t)})}function rs(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...F(t)})}function rl(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...F(t)})}function rc(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...F(t)})}function rd(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...F(t)})}function rf(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...F(t)})}function rp(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...F(t)})}function rh(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...F(t)})}function rm(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...F(t)})}function rv(e,t){return new to({check:"less_than",...F(t),value:e,inclusive:!1})}function ry(e,t){return new to({check:"less_than",...F(t),value:e,inclusive:!0})}function rg(e,t){return new ta({check:"greater_than",...F(t),value:e,inclusive:!1})}function rb(e,t){return new ta({check:"greater_than",...F(t),value:e,inclusive:!0})}function r_(e){return rg(0,e)}function rz(e){return rv(0,e)}function rw(e){return ry(0,e)}function rk(e){return rb(0,e)}function rS(e,t){return new tu({check:"multiple_of",...F(t),value:e})}function rO(e,t){return new tc({check:"max_size",...F(t),maximum:e})}function r$(e,t){return new td({check:"min_size",...F(t),minimum:e})}function rx(e,t){return new tf({check:"size_equals",...F(t),size:e})}function rZ(e,t){return new tp({check:"max_length",...F(t),maximum:e})}function rE(e,t){return new th({check:"min_length",...F(t),minimum:e})}function rP(e,t){return new tm({check:"length_equals",...F(t),length:e})}function rj(e,t){return new ty({check:"string_format",format:"regex",...F(t),pattern:e})}function rT(e){return new tg({check:"string_format",format:"lowercase",...F(e)})}function rI(e){return new tb({check:"string_format",format:"uppercase",...F(e)})}function rA(e,t){return new t_({check:"string_format",format:"includes",...F(t),includes:e})}function rN(e,t){return new tz({check:"string_format",format:"starts_with",...F(t),prefix:e})}function rC(e,t){return new tw({check:"string_format",format:"ends_with",...F(t),suffix:e})}function rF(e,t,n){return new tS({check:"property",property:e,schema:t,...F(n)})}function rM(e,t){return new tO({check:"mime_type",mime:e,...F(t)})}function rD(e){return new t$({check:"overwrite",tx:e})}function rR(e){return rD(t=>t.normalize(e))}function rJ(){return rD(e=>e.trim())}function rB(){return rD(e=>e.toLowerCase())}function rU(){return rD(e=>e.toUpperCase())}function rL(){return rD(e=>e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,""))}function rV(e,t,n,r={}){let i=F(r),o={...F(r),check:"string_format",type:"string",format:t,fn:"function"==typeof n?n:e=>n.test(e),...i};return n instanceof RegExp&&(o.pattern=n),new e(o)}function rq(e){let t=e?.target??"draft-2020-12";return"draft-4"===t&&(t="draft-04"),"draft-7"===t&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??n4,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function rG(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,o=t.seen.get(e);if(o)return o.count++,n.schemaPath.includes(e)&&(o.cycle=n.path),o.schema;let a={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,a);let u=e._zod.toJSONSchema?.();if(u)a.schema=u;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,r);else{let n=a.schema,o=t.processors[i.type];if(!o)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);o(e,t,n,r)}let o=e._zod.parent;o&&(a.ref||(a.ref=o),rG(o,t,r),t.seen.get(o).isParent=!0)}let s=t.metadataRegistry.get(e);return s&&Object.assign(a.schema,s),"input"===t.io&&function e(t,n){let r=n??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);let i=t._zod.def;if("transform"===i.type)return!0;if("array"===i.type)return e(i.element,r);if("set"===i.type)return e(i.valueType,r);if("lazy"===i.type)return e(i.getter(),r);if("promise"===i.type||"optional"===i.type||"nonoptional"===i.type||"nullable"===i.type||"readonly"===i.type||"default"===i.type||"prefault"===i.type)return e(i.innerType,r);if("intersection"===i.type)return e(i.left,r)||e(i.right,r);if("record"===i.type||"map"===i.type)return e(i.keyType,r)||e(i.valueType,r);if("pipe"===i.type)return e(i.in,r)||e(i.out,r);if("object"===i.type){for(let t in i.shape)if(e(i.shape[t],r))return!0;return!1}if("union"===i.type){for(let t of i.options)if(e(t,r))return!0;return!1}if("tuple"===i.type){for(let t of i.items)if(e(t,r))return!0;if(i.rest&&e(i.rest,r))return!0}return!1}(e)&&(delete a.schema.examples,delete a.schema.default),"input"===t.io&&a.schema._prefault&&((r=a.schema).default??(r.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function rW(e,t){let n=e.seen.get(t);if(!n)throw Error("Unprocessed schema. This is a bug in Zod.");let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{if(t[1].schema.$ref)return;let r=t[1],{ref:i,defId:o}=(t=>{let r="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let o=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=o,{defId:o,ref:`${i("__shared")}#/${r}/${o}`}}if(t[1]===n)return{ref:"#"};let i=`#/${r}/`,o=t[1].schema.id??`__schema${e.counter++}`;return{defId:o,ref:i+o}})(t);r.def={...r.schema},o&&(r.defId=o);let a=r.schema;for(let e in a)delete a[e];a.$ref=i};if("throw"===e.cycles)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join("/")}/<root>
|
|
45
|
+
|
|
46
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){i(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){i(n);continue}}if(e.metadataRegistry.get(n[0])?.id||r.cycle||r.count>1&&"ref"===e.reused){i(n);continue}}}function rK(e,t){let n=e.seen.get(t);if(!n)throw Error("Unprocessed schema. This is a bug in Zod.");let r=t=>{let n=e.seen.get(t);if(null===n.ref)return;let i=n.def??n.schema,o={...i},a=n.ref;if(n.ref=null,a){r(a);let n=e.seen.get(a),u=n.schema;if(u.$ref&&("draft-07"===e.target||"draft-04"===e.target||"openapi-3.0"===e.target)?(i.allOf=i.allOf??[],i.allOf.push(u)):Object.assign(i,u),Object.assign(i,o),t._zod.parent===a)for(let e in i)"$ref"!==e&&"allOf"!==e&&(e in o||delete i[e]);if(u.$ref)for(let e in i)"$ref"!==e&&"allOf"!==e&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let u=t._zod.parent;if(u&&u!==a){r(u);let t=e.seen.get(u);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if("draft-2020-12"===e.target?i.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?i.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?i.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&("draft-2020-12"===e.target?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t["~standard"],jsonSchema:{input:rX(t,"input",e.processors),output:rX(t,"output",e.processors)}},enumerable:!1,writable:!1}),n}catch(e){throw Error("Error converting schema to JSON.")}}let rX=(e,t,n={})=>r=>{let{libraryOptions:i,target:o}=r??{},a=rq({...i??{},target:o,io:t,processors:n});return rG(e,a),rW(a,e),rK(a,e)},rH={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},rY=(e,t,n,r)=>{let i=e._zod.def,o=!1===i.inclusive,a=i.options.map((e,n)=>rG(e,t,{...r,path:[...r.path,o?"oneOf":"anyOf",n]}));o?n.oneOf=a:n.anyOf=a},rQ=(e,t,n,r)=>{let i=e._zod.def;rG(i.innerType,t,r),t.seen.get(e).ref=i.innerType},r0=f("ZodISODateTime",(e,t)=>{tU.init(e,t),ig.init(e,t)});function r1(e){return new r0({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...F(e)})}let r2=f("ZodISODate",(e,t)=>{tL.init(e,t),ig.init(e,t)});function r4(e){return new r2({type:"string",format:"date",check:"string_format",...F(e)})}let r6=f("ZodISOTime",(e,t)=>{tV.init(e,t),ig.init(e,t)});function r9(e){return new r6({type:"string",format:"time",check:"string_format",precision:null,...F(e)})}let r3=f("ZodISODuration",(e,t)=>{tq.init(e,t),ig.init(e,t)});function r5(e){return new r3({type:"string",format:"duration",check:"string_format",...F(e)})}let r8=(e,t)=>{K.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>(function(e,t=e=>e.message){let n={_errors:[]},r=e=>{for(let i of e.issues)if("invalid_union"===i.code&&i.errors.length)i.errors.map(e=>r({issues:e}));else if("invalid_key"===i.code)r({issues:i.issues});else if("invalid_element"===i.code)r({issues:i.issues});else if(0===i.path.length)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(e),n})(e,t)},flatten:{value:t=>(function(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}})(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,b,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,b,2)}},isEmpty:{get:()=>0===e.issues.length}})};f("ZodError",r8);let r7=f("ZodError",r8,{Parent:Error}),ie=H(r7),it=Q(r7),ir=et(r7),ii=er(r7),io=(e,t,n)=>{let r=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return H(r7)(e,t,r)},ia=(e,t,n)=>H(r7)(e,t,n),iu=async(e,t,n)=>{let r=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Q(r7)(e,t,r)},is=async(e,t,n)=>Q(r7)(e,t,n),il=(e,t,n)=>{let r=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return et(r7)(e,t,r)},ic=(e,t,n)=>et(r7)(e,t,n),id=async(e,t,n)=>{let r=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return er(r7)(e,t,r)},ip=async(e,t,n)=>er(r7)(e,t,n),ih=f("ZodType",(e,t)=>(tE.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:rX(e,"input"),output:rX(e,"output")}}),e.toJSONSchema=((e,t={})=>n=>{let r=rq({...n,processors:t});return rG(e,r),rW(r,e),rK(r,e)})(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone($(t,{checks:[...t.checks??[],...n.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>C(e,t,n),e.brand=()=>e,e.register=(t,n)=>(t.add(e,n),e),e.parse=(t,n)=>ie(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>ir(e,t,n),e.parseAsync=async(t,n)=>it(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>ii(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>io(e,t,n),e.decode=(t,n)=>ia(e,t,n),e.encodeAsync=async(t,n)=>iu(e,t,n),e.decodeAsync=async(t,n)=>is(e,t,n),e.safeEncode=(t,n)=>il(e,t,n),e.safeDecode=(t,n)=>ic(e,t,n),e.safeEncodeAsync=async(t,n)=>id(e,t,n),e.safeDecodeAsync=async(t,n)=>ip(e,t,n),e.refine=(t,n)=>e.check(aJ(t,n)),e.superRefine=t=>e.check(aB(t)),e.overwrite=t=>e.check(rD(t)),e.optional=()=>aa(e),e.exactOptional=()=>as(e),e.nullable=()=>ac(e),e.nullish=()=>aa(ac(e)),e.nonoptional=t=>ay(e,t),e.array=()=>oC(e),e.or=t=>oU([e,t]),e.and=t=>oK(e,t),e.transform=t=>aO(e,ai(t)),e.default=t=>ap(e,t),e.prefault=t=>am(e,t),e.catch=t=>az(e,t),e.pipe=t=>aO(e,t),e.readonly=()=>aE(e),e.describe=t=>{let n=e.clone();return n4.add(n,{description:t}),n},Object.defineProperty(e,"description",{get:()=>n4.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return n4.get(e);let n=e.clone();return n4.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),im=f("_ZodString",(e,t)=>{tP.init(e,t),ih.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{n.type="string";let{minimum:i,maximum:o,format:a,patterns:u,contentEncoding:s}=e._zod.bag;if("number"==typeof i&&(n.minLength=i),"number"==typeof o&&(n.maxLength=o),a&&(n.format=rH[a]??a,""===n.format&&delete n.format,"time"===a&&delete n.format),s&&(n.contentEncoding=s),u&&u.size>0){let e=[...u];1===e.length?n.pattern=e[0].source:e.length>1&&(n.allOf=[...e.map(e=>({..."draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target?{type:"string"}:{},pattern:e.source}))])}})(e,t,n,0);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(rj(...t)),e.includes=(...t)=>e.check(rA(...t)),e.startsWith=(...t)=>e.check(rN(...t)),e.endsWith=(...t)=>e.check(rC(...t)),e.min=(...t)=>e.check(rE(...t)),e.max=(...t)=>e.check(rZ(...t)),e.length=(...t)=>e.check(rP(...t)),e.nonempty=(...t)=>e.check(rE(1,...t)),e.lowercase=t=>e.check(rT(t)),e.uppercase=t=>e.check(rI(t)),e.trim=()=>e.check(rJ()),e.normalize=(...t)=>e.check(rR(...t)),e.toLowerCase=()=>e.check(rB()),e.toUpperCase=()=>e.check(rU()),e.slugify=()=>e.check(rL())}),iv=f("ZodString",(e,t)=>{tP.init(e,t),im.init(e,t),e.email=t=>e.check(n6(ib,t)),e.url=t=>e.check(re(iZ,t)),e.jwt=t=>e.check(rm(i5,t)),e.emoji=t=>e.check(rt(ij,t)),e.guid=t=>e.check(n9(iz,t)),e.uuid=t=>e.check(n3(ik,t)),e.uuidv4=t=>e.check(n5(ik,t)),e.uuidv6=t=>e.check(n8(ik,t)),e.uuidv7=t=>e.check(n7(ik,t)),e.nanoid=t=>e.check(rn(iI,t)),e.guid=t=>e.check(n9(iz,t)),e.cuid=t=>e.check(rr(iN,t)),e.cuid2=t=>e.check(ri(iF,t)),e.ulid=t=>e.check(ro(iD,t)),e.base64=t=>e.check(rf(i1,t)),e.base64url=t=>e.check(rp(i4,t)),e.xid=t=>e.check(ra(iJ,t)),e.ksuid=t=>e.check(ru(iU,t)),e.ipv4=t=>e.check(rs(iV,t)),e.ipv6=t=>e.check(rl(iK,t)),e.cidrv4=t=>e.check(rc(iH,t)),e.cidrv6=t=>e.check(rd(iQ,t)),e.e164=t=>e.check(rh(i9,t)),e.datetime=t=>e.check(r1(t)),e.date=t=>e.check(r4(t)),e.time=t=>e.check(r9(t)),e.duration=t=>e.check(r5(t))});function iy(e){return new iv({type:"string",...F(e)})}let ig=f("ZodStringFormat",(e,t)=>{tj.init(e,t),im.init(e,t)}),ib=f("ZodEmail",(e,t)=>{tA.init(e,t),ig.init(e,t)});function i_(e){return n6(ib,e)}let iz=f("ZodGUID",(e,t)=>{tT.init(e,t),ig.init(e,t)});function iw(e){return n9(iz,e)}let ik=f("ZodUUID",(e,t)=>{tI.init(e,t),ig.init(e,t)});function iS(e){return n3(ik,e)}function iO(e){return n5(ik,e)}function i$(e){return n8(ik,e)}function ix(e){return n7(ik,e)}let iZ=f("ZodURL",(e,t)=>{tN.init(e,t),ig.init(e,t)});function iE(e){return re(iZ,e)}function iP(e){return re(iZ,{protocol:/^https?$/,hostname:eI,...F(e)})}let ij=f("ZodEmoji",(e,t)=>{tC.init(e,t),ig.init(e,t)});function iT(e){return rt(ij,e)}let iI=f("ZodNanoID",(e,t)=>{tF.init(e,t),ig.init(e,t)});function iA(e){return rn(iI,e)}let iN=f("ZodCUID",(e,t)=>{tM.init(e,t),ig.init(e,t)});function iC(e){return rr(iN,e)}let iF=f("ZodCUID2",(e,t)=>{tD.init(e,t),ig.init(e,t)});function iM(e){return ri(iF,e)}let iD=f("ZodULID",(e,t)=>{tR.init(e,t),ig.init(e,t)});function iR(e){return ro(iD,e)}let iJ=f("ZodXID",(e,t)=>{tJ.init(e,t),ig.init(e,t)});function iB(e){return ra(iJ,e)}let iU=f("ZodKSUID",(e,t)=>{tB.init(e,t),ig.init(e,t)});function iL(e){return ru(iU,e)}let iV=f("ZodIPv4",(e,t)=>{tG.init(e,t),ig.init(e,t)});function iq(e){return rs(iV,e)}let iG=f("ZodMAC",(e,t)=>{tK.init(e,t),ig.init(e,t)});function iW(e){return new iG({type:"string",format:"mac",check:"string_format",abort:!1,...F(e)})}let iK=f("ZodIPv6",(e,t)=>{tW.init(e,t),ig.init(e,t)});function iX(e){return rl(iK,e)}let iH=f("ZodCIDRv4",(e,t)=>{tX.init(e,t),ig.init(e,t)});function iY(e){return rc(iH,e)}let iQ=f("ZodCIDRv6",(e,t)=>{tH.init(e,t),ig.init(e,t)});function i0(e){return rd(iQ,e)}let i1=f("ZodBase64",(e,t)=>{tQ.init(e,t),ig.init(e,t)});function i2(e){return rf(i1,e)}let i4=f("ZodBase64URL",(e,t)=>{t0.init(e,t),ig.init(e,t)});function i6(e){return rp(i4,e)}let i9=f("ZodE164",(e,t)=>{t1.init(e,t),ig.init(e,t)});function i3(e){return rh(i9,e)}let i5=f("ZodJWT",(e,t)=>{t2.init(e,t),ig.init(e,t)});function i8(e){return rm(i5,e)}let i7=f("ZodCustomStringFormat",(e,t)=>{t4.init(e,t),ig.init(e,t)});function oe(e,t,n={}){return rV(i7,e,t,n)}function ot(e){return rV(i7,"hostname",eT,e)}function on(e){return rV(i7,"hex",eK,e)}function or(e,t){let n=t?.enc??"hex",r=`${e}_${n}`,i=s[r];if(!i)throw Error(`Unrecognized hash format: ${r}`);return rV(i7,r,i,t)}let oi=f("ZodNumber",(e,t)=>{t6.init(e,t),ih.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{let{minimum:i,maximum:o,format:a,multipleOf:u,exclusiveMaximum:s,exclusiveMinimum:l}=e._zod.bag;"string"==typeof a&&a.includes("int")?n.type="integer":n.type="number","number"==typeof l&&("draft-04"===t.target||"openapi-3.0"===t.target?(n.minimum=l,n.exclusiveMinimum=!0):n.exclusiveMinimum=l),"number"==typeof i&&(n.minimum=i,"number"==typeof l&&"draft-04"!==t.target&&(l>=i?delete n.minimum:delete n.exclusiveMinimum)),"number"==typeof s&&("draft-04"===t.target||"openapi-3.0"===t.target?(n.maximum=s,n.exclusiveMaximum=!0):n.exclusiveMaximum=s),"number"==typeof o&&(n.maximum=o,"number"==typeof s&&"draft-04"!==t.target&&(s<=o?delete n.maximum:delete n.exclusiveMaximum)),"number"==typeof u&&(n.multipleOf=u)})(e,t,n,0),e.gt=(t,n)=>e.check(rg(t,n)),e.gte=(t,n)=>e.check(rb(t,n)),e.min=(t,n)=>e.check(rb(t,n)),e.lt=(t,n)=>e.check(rv(t,n)),e.lte=(t,n)=>e.check(ry(t,n)),e.max=(t,n)=>e.check(ry(t,n)),e.int=t=>e.check(ou(t)),e.safe=t=>e.check(ou(t)),e.positive=t=>e.check(rg(0,t)),e.nonnegative=t=>e.check(rb(0,t)),e.negative=t=>e.check(rv(0,t)),e.nonpositive=t=>e.check(ry(0,t)),e.multipleOf=(t,n)=>e.check(rS(t,n)),e.step=(t,n)=>e.check(rS(t,n)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function oo(e){return new oi({type:"number",checks:[],...F(e)})}let oa=f("ZodNumberFormat",(e,t)=>{t9.init(e,t),oi.init(e,t)});function ou(e){return new oa({type:"number",check:"number_format",abort:!1,format:"safeint",...F(e)})}function os(e){return new oa({type:"number",check:"number_format",abort:!1,format:"float32",...F(e)})}function ol(e){return new oa({type:"number",check:"number_format",abort:!1,format:"float64",...F(e)})}function oc(e){return new oa({type:"number",check:"number_format",abort:!1,format:"int32",...F(e)})}function od(e){return new oa({type:"number",check:"number_format",abort:!1,format:"uint32",...F(e)})}let of=f("ZodBoolean",(e,t)=>{t3.init(e,t),ih.init(e,t),e._zod.processJSONSchema=(e,t,n)=>{t.type="boolean"}});function op(e){return new of({type:"boolean",...F(e)})}let oh=f("ZodBigInt",(e,t)=>{t5.init(e,t),ih.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n,r)=>{if("throw"===t.unrepresentable)throw Error("BigInt cannot be represented in JSON Schema")})(0,e,0,0),e.gte=(t,n)=>e.check(rb(t,n)),e.min=(t,n)=>e.check(rb(t,n)),e.gt=(t,n)=>e.check(rg(t,n)),e.gte=(t,n)=>e.check(rb(t,n)),e.min=(t,n)=>e.check(rb(t,n)),e.lt=(t,n)=>e.check(rv(t,n)),e.lte=(t,n)=>e.check(ry(t,n)),e.max=(t,n)=>e.check(ry(t,n)),e.positive=t=>e.check(rg(BigInt(0),t)),e.negative=t=>e.check(rv(BigInt(0),t)),e.nonpositive=t=>e.check(ry(BigInt(0),t)),e.nonnegative=t=>e.check(rb(BigInt(0),t)),e.multipleOf=(t,n)=>e.check(rS(t,n));let n=e._zod.bag;e.minValue=n.minimum??null,e.maxValue=n.maximum??null,e.format=n.format??null});function om(e){return new oh({type:"bigint",...F(e)})}let ov=f("ZodBigIntFormat",(e,t)=>{t8.init(e,t),oh.init(e,t)});function oy(e){return new ov({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...F(e)})}function og(e){return new ov({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...F(e)})}let ob=f("ZodSymbol",(e,t)=>{t7.init(e,t),ih.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n,r)=>{if("throw"===t.unrepresentable)throw Error("Symbols cannot be represented in JSON Schema")})(0,e,0,0)});function o_(e){return new ob({type:"symbol",...F(e)})}let oz=f("ZodUndefined",(e,t)=>{ne.init(e,t),ih.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n,r)=>{if("throw"===t.unrepresentable)throw Error("Undefined cannot be represented in JSON Schema")})(0,e,0,0)});function ow(e){return new oz({type:"undefined",...F(e)})}let ok=f("ZodNull",(e,t)=>{nt.init(e,t),ih.init(e,t),e._zod.processJSONSchema=(e,t,n)=>{"openapi-3.0"===e.target?(t.type="string",t.nullable=!0,t.enum=[null]):t.type="null"}});function oS(e){return new ok({type:"null",...F(e)})}let oO=f("ZodAny",(e,t)=>{nn.init(e,t),ih.init(e,t),e._zod.processJSONSchema=(e,t,n)=>{}});function o$(){return new oO({type:"any"})}let ox=f("ZodUnknown",(e,t)=>{nr.init(e,t),ih.init(e,t),e._zod.processJSONSchema=(e,t,n)=>{}});function oZ(){return new ox({type:"unknown"})}let oE=f("ZodNever",(e,t)=>{ni.init(e,t),ih.init(e,t),e._zod.processJSONSchema=(e,t,n)=>{t.not={}}});function oP(e){return new oE({type:"never",...F(e)})}let oj=f("ZodVoid",(e,t)=>{no.init(e,t),ih.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n,r)=>{if("throw"===t.unrepresentable)throw Error("Void cannot be represented in JSON Schema")})(0,e,0,0)});function oT(e){return new oj({type:"void",...F(e)})}let oI=f("ZodDate",(e,t)=>{na.init(e,t),ih.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n,r)=>{if("throw"===t.unrepresentable)throw Error("Date cannot be represented in JSON Schema")})(0,e,0,0),e.min=(t,n)=>e.check(rb(t,n)),e.max=(t,n)=>e.check(ry(t,n));let n=e._zod.bag;e.minDate=n.minimum?new Date(n.minimum):null,e.maxDate=n.maximum?new Date(n.maximum):null});function oA(e){return new oI({type:"date",...F(e)})}let oN=f("ZodArray",(e,t)=>{ns.init(e,t),ih.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{let i=e._zod.def,{minimum:o,maximum:a}=e._zod.bag;"number"==typeof o&&(n.minItems=o),"number"==typeof a&&(n.maxItems=a),n.type="array",n.items=rG(i.element,t,{...r,path:[...r.path,"items"]})})(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(rE(t,n)),e.nonempty=t=>e.check(rE(1,t)),e.max=(t,n)=>e.check(rZ(t,n)),e.length=(t,n)=>e.check(rP(t,n)),e.unwrap=()=>e.element});function oC(e,t){return new oN({type:"array",element:e,...F(t)})}function oF(e){return o5(Object.keys(e._zod.def.shape))}let oM=f("ZodObject",(e,t)=>{np.init(e,t),ih.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{let i=e._zod.def;n.type="object",n.properties={};let o=i.shape;for(let e in o)n.properties[e]=rG(o[e],t,{...r,path:[...r.path,"properties",e]});let a=new Set([...new Set(Object.keys(o))].filter(e=>{let n=i.shape[e]._zod;return"input"===t.io?void 0===n.optin:void 0===n.optout}));a.size>0&&(n.required=Array.from(a)),i.catchall?._zod.def.type==="never"?n.additionalProperties=!1:i.catchall?i.catchall&&(n.additionalProperties=rG(i.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):"output"===t.io&&(n.additionalProperties=!1)})(e,t,n,r),S(e,"shape",()=>t.shape),e.keyof=()=>o5(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:oZ()}),e.loose=()=>e.clone({...e._zod.def,catchall:oZ()}),e.strict=()=>e.clone({...e._zod.def,catchall:oP()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>(function(e,t){if(!j(t))throw Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(void 0!==Object.getOwnPropertyDescriptor(n,e))throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let r=$(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return O(this,"shape",n),n}});return C(e,r)})(e,t),e.safeExtend=t=>(function(e,t){if(!j(t))throw Error("Invalid input to safeExtend: expected a plain object");let n=$(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return O(this,"shape",n),n}});return C(e,n)})(e,t),e.merge=t=>{let n;return n=$(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return O(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]}),C(e,n)},e.pick=t=>(function(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let i=$(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return O(this,"shape",e),e},checks:[]});return C(e,i)})(e,t),e.omit=t=>(function(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let i=$(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return O(this,"shape",r),r},checks:[]});return C(e,i)})(e,t),e.partial=(...t)=>(function(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let i=$(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:"optional",innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:"optional",innerType:r[t]}):r[t];return O(this,"shape",i),i},checks:[]});return C(t,i)})(ao,e,t[0]),e.required=(...t)=>{var n;let r;return n=t[0],r=$(e._zod.def,{get shape(){let t=e._zod.def.shape,r={...t};if(n)for(let e in n){if(!(e in r))throw Error(`Unrecognized key: "${e}"`);n[e]&&(r[e]=new av({type:"nonoptional",innerType:t[e]}))}else for(let e in t)r[e]=new av({type:"nonoptional",innerType:t[e]});return O(this,"shape",r),r}}),C(e,r)}});function oD(e,t){return new oM({type:"object",shape:e??{},...F(t)})}function oR(e,t){return new oM({type:"object",shape:e,catchall:oP(),...F(t)})}function oJ(e,t){return new oM({type:"object",shape:e,catchall:oZ(),...F(t)})}let oB=f("ZodUnion",(e,t)=>{nm.init(e,t),ih.init(e,t),e._zod.processJSONSchema=(t,n,r)=>rY(e,t,n,r),e.options=t.options});function oU(e,t){return new oB({type:"union",options:e,...F(t)})}let oL=f("ZodXor",(e,t)=>{oB.init(e,t),ny.init(e,t),e._zod.processJSONSchema=(t,n,r)=>rY(e,t,n,r),e.options=t.options});function oV(e,t){return new oL({type:"union",options:e,inclusive:!1,...F(t)})}let oq=f("ZodDiscriminatedUnion",(e,t)=>{oB.init(e,t),ng.init(e,t)});function oG(e,t,n){return new oq({type:"union",options:t,discriminator:e,...F(n)})}let oW=f("ZodIntersection",(e,t)=>{nb.init(e,t),ih.init(e,t),e._zod.processJSONSchema=(t,n,r)=>{let i,o,a,u;return o=rG((i=e._zod.def).left,t,{...r,path:[...r.path,"allOf",0]}),a=rG(i.right,t,{...r,path:[...r.path,"allOf",1]}),void(n.allOf=[...(u=e=>"allOf"in e&&1===Object.keys(e).length)(o)?o.allOf:[o],...u(a)?a.allOf:[a]])}});function oK(e,t){return new oW({type:"intersection",left:e,right:t})}let oX=f("ZodTuple",(e,t)=>{nz.init(e,t),ih.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{let i=e._zod.def;n.type="array";let o="draft-2020-12"===t.target?"prefixItems":"items",a="draft-2020-12"===t.target||"openapi-3.0"===t.target?"items":"additionalItems",u=i.items.map((e,n)=>rG(e,t,{...r,path:[...r.path,o,n]})),s=i.rest?rG(i.rest,t,{...r,path:[...r.path,a,..."openapi-3.0"===t.target?[i.items.length]:[]]}):null;"draft-2020-12"===t.target?(n.prefixItems=u,s&&(n.items=s)):"openapi-3.0"===t.target?(n.items={anyOf:u},s&&n.items.anyOf.push(s),n.minItems=u.length,s||(n.maxItems=u.length)):(n.items=u,s&&(n.additionalItems=s));let{minimum:l,maximum:c}=e._zod.bag;"number"==typeof l&&(n.minItems=l),"number"==typeof c&&(n.maxItems=c)})(e,t,n,r),e.rest=t=>e.clone({...e._zod.def,rest:t})});function oH(e,t,n){let r=t instanceof tE,i=r?n:t;return new oX({type:"tuple",items:e,rest:r?t:null,...F(i)})}let oY=f("ZodRecord",(e,t)=>{nk.init(e,t),ih.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{let i=e._zod.def;n.type="object";let o=i.keyType,a=o._zod.bag,u=a?.patterns;if("loose"===i.mode&&u&&u.size>0){let e=rG(i.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});for(let t of(n.patternProperties={},u))n.patternProperties[t.source]=e}else("draft-07"===t.target||"draft-2020-12"===t.target)&&(n.propertyNames=rG(i.keyType,t,{...r,path:[...r.path,"propertyNames"]})),n.additionalProperties=rG(i.valueType,t,{...r,path:[...r.path,"additionalProperties"]});let s=o._zod.values;if(s){let e=[...s].filter(e=>"string"==typeof e||"number"==typeof e);e.length>0&&(n.required=e)}})(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function oQ(e,t,n){return new oY({type:"record",keyType:e,valueType:t,...F(n)})}function o0(e,t,n){let r=C(e);return r._zod.values=void 0,new oY({type:"record",keyType:r,valueType:t,...F(n)})}function o1(e,t,n){return new oY({type:"record",keyType:e,valueType:t,mode:"loose",...F(n)})}let o2=f("ZodMap",(e,t)=>{nS.init(e,t),ih.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n,r)=>{if("throw"===t.unrepresentable)throw Error("Map cannot be represented in JSON Schema")})(0,e,0,0),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...t)=>e.check(r$(...t)),e.nonempty=t=>e.check(r$(1,t)),e.max=(...t)=>e.check(rO(...t)),e.size=(...t)=>e.check(rx(...t))});function o4(e,t,n){return new o2({type:"map",keyType:e,valueType:t,...F(n)})}let o6=f("ZodSet",(e,t)=>{n$.init(e,t),ih.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n,r)=>{if("throw"===t.unrepresentable)throw Error("Set cannot be represented in JSON Schema")})(0,e,0,0),e.min=(...t)=>e.check(r$(...t)),e.nonempty=t=>e.check(r$(1,t)),e.max=(...t)=>e.check(rO(...t)),e.size=(...t)=>e.check(rx(...t))});function o9(e,t){return new o6({type:"set",valueType:e,...F(t)})}let o3=f("ZodEnum",(e,t)=>{nZ.init(e,t),ih.init(e,t),e._zod.processJSONSchema=(t,n,r)=>{let i;(i=y(e._zod.def.entries)).every(e=>"number"==typeof e)&&(n.type="number"),i.every(e=>"string"==typeof e)&&(n.type="string"),n.enum=i},e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new o3({...t,checks:[],...F(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new o3({...t,checks:[],...F(r),entries:i})}});function o5(e,t){return new o3({type:"enum",entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...F(t)})}function o8(e,t){return new o3({type:"enum",entries:e,...F(t)})}let o7=f("ZodLiteral",(e,t)=>{nE.init(e,t),ih.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{let i=e._zod.def,o=[];for(let e of i.values)if(void 0===e){if("throw"===t.unrepresentable)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if("bigint"==typeof e)if("throw"===t.unrepresentable)throw Error("BigInt literals cannot be represented in JSON Schema");else o.push(Number(e));else o.push(e);if(0===o.length);else if(1===o.length){let e=o[0];n.type=null===e?"null":typeof e,"draft-04"===t.target||"openapi-3.0"===t.target?n.enum=[e]:n.const=e}else o.every(e=>"number"==typeof e)&&(n.type="number"),o.every(e=>"string"==typeof e)&&(n.type="string"),o.every(e=>"boolean"==typeof e)&&(n.type="boolean"),o.every(e=>null===e)&&(n.type="null"),n.enum=o})(e,t,n,0),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function ae(e,t){return new o7({type:"literal",values:Array.isArray(e)?e:[e],...F(t)})}let at=f("ZodFile",(e,t)=>{nP.init(e,t),ih.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{let i={type:"string",format:"binary",contentEncoding:"binary"},{minimum:o,maximum:a,mime:u}=e._zod.bag;void 0!==o&&(i.minLength=o),void 0!==a&&(i.maxLength=a),u?1===u.length?(i.contentMediaType=u[0],Object.assign(n,i)):(Object.assign(n,i),n.anyOf=u.map(e=>({contentMediaType:e}))):Object.assign(n,i)})(e,0,n,0),e.min=(t,n)=>e.check(r$(t,n)),e.max=(t,n)=>e.check(rO(t,n)),e.mime=(t,n)=>e.check(rM(Array.isArray(t)?t:[t],n))});function an(e){return new at({type:"file",...F(e)})}let ar=f("ZodTransform",(e,t)=>{nj.init(e,t),ih.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n,r)=>{if("throw"===t.unrepresentable)throw Error("Transforms cannot be represented in JSON Schema")})(0,e,0,0),e._zod.parse=(n,r)=>{if("backward"===r.direction)throw new h(e.constructor.name);n.addIssue=r=>{"string"==typeof r?n.issues.push(G(r,n.value,t)):(r.fatal&&(r.continue=!1),r.code??(r.code="custom"),r.input??(r.input=n.value),r.inst??(r.inst=e),n.issues.push(G(r)))};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function ai(e){return new ar({type:"transform",transform:e})}let ao=f("ZodOptional",(e,t)=>{nI.init(e,t),ih.init(e,t),e._zod.processJSONSchema=(t,n,r)=>rQ(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function aa(e){return new ao({type:"optional",innerType:e})}let au=f("ZodExactOptional",(e,t)=>{nA.init(e,t),ih.init(e,t),e._zod.processJSONSchema=(t,n,r)=>rQ(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function as(e){return new au({type:"optional",innerType:e})}let al=f("ZodNullable",(e,t)=>{nN.init(e,t),ih.init(e,t),e._zod.processJSONSchema=(t,n,r)=>{let i,o,a;return o=rG((i=e._zod.def).innerType,t,r),a=t.seen.get(e),void("openapi-3.0"===t.target?(a.ref=i.innerType,n.nullable=!0):n.anyOf=[o,{type:"null"}])},e.unwrap=()=>e._zod.def.innerType});function ac(e){return new al({type:"nullable",innerType:e})}function ad(e){return aa(ac(e))}let af=f("ZodDefault",(e,t)=>{nC.init(e,t),ih.init(e,t),e._zod.processJSONSchema=(t,n,r)=>{let i;rG((i=e._zod.def).innerType,t,r),t.seen.get(e).ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function ap(e,t){return new af({type:"default",innerType:e,get defaultValue(){return"function"==typeof t?t():T(t)}})}let ah=f("ZodPrefault",(e,t)=>{nM.init(e,t),ih.init(e,t),e._zod.processJSONSchema=(t,n,r)=>{let i;rG((i=e._zod.def).innerType,t,r),t.seen.get(e).ref=i.innerType,"input"===t.io&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},e.unwrap=()=>e._zod.def.innerType});function am(e,t){return new ah({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof t?t():T(t)}})}let av=f("ZodNonOptional",(e,t)=>{nD.init(e,t),ih.init(e,t),e._zod.processJSONSchema=(t,n,r)=>{let i;rG((i=e._zod.def).innerType,t,r),t.seen.get(e).ref=i.innerType},e.unwrap=()=>e._zod.def.innerType});function ay(e,t){return new av({type:"nonoptional",innerType:e,...F(t)})}let ag=f("ZodSuccess",(e,t)=>{nJ.init(e,t),ih.init(e,t),e._zod.processJSONSchema=(e,t,n)=>{t.type="boolean"},e.unwrap=()=>e._zod.def.innerType});function ab(e){return new ag({type:"success",innerType:e})}let a_=f("ZodCatch",(e,t)=>{nB.init(e,t),ih.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{let i,o=e._zod.def;rG(o.innerType,t,r),t.seen.get(e).ref=o.innerType;try{i=o.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}n.default=i})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function az(e,t){return new a_({type:"catch",innerType:e,catchValue:"function"==typeof t?t:()=>t})}let aw=f("ZodNaN",(e,t)=>{nU.init(e,t),ih.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n,r)=>{if("throw"===t.unrepresentable)throw Error("NaN cannot be represented in JSON Schema")})(0,e,0,0)});function ak(e){return new aw({type:"nan",...F(e)})}let aS=f("ZodPipe",(e,t)=>{nL.init(e,t),ih.init(e,t),e._zod.processJSONSchema=(t,n,r)=>{let i,o;return i=e._zod.def,void(rG(o="input"===t.io?"transform"===i.in._zod.def.type?i.out:i.in:i.out,t,r),t.seen.get(e).ref=o)},e.in=t.in,e.out=t.out});function aO(e,t){return new aS({type:"pipe",in:e,out:t})}let a$=f("ZodCodec",(e,t)=>{aS.init(e,t),nq.init(e,t)});function ax(e,t,n){return new a$({type:"pipe",in:e,out:t,transform:n.decode,reverseTransform:n.encode})}let aZ=f("ZodReadonly",(e,t)=>{nK.init(e,t),ih.init(e,t),e._zod.processJSONSchema=(t,n,r)=>{let i;rG((i=e._zod.def).innerType,t,r),t.seen.get(e).ref=i.innerType,n.readOnly=!0},e.unwrap=()=>e._zod.def.innerType});function aE(e){return new aZ({type:"readonly",innerType:e})}let aP=f("ZodTemplateLiteral",(e,t)=>{nH.init(e,t),ih.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{let i=e._zod.pattern;if(!i)throw Error("Pattern not found in template literal");n.type="string",n.pattern=i.source})(e,0,n,0)});function aj(e,t){return new aP({type:"template_literal",parts:e,...F(t)})}let aT=f("ZodLazy",(e,t)=>{n0.init(e,t),ih.init(e,t),e._zod.processJSONSchema=(t,n,r)=>{let i;rG(i=e._zod.innerType,t,r),t.seen.get(e).ref=i},e.unwrap=()=>e._zod.def.getter()});function aI(e){return new aT({type:"lazy",getter:e})}let aA=f("ZodPromise",(e,t)=>{nQ.init(e,t),ih.init(e,t),e._zod.processJSONSchema=(t,n,r)=>{let i;rG((i=e._zod.def).innerType,t,r),t.seen.get(e).ref=i.innerType},e.unwrap=()=>e._zod.def.innerType});function aN(e){return new aA({type:"promise",innerType:e})}let aC=f("ZodFunction",(e,t)=>{nY.init(e,t),ih.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n,r)=>{if("throw"===t.unrepresentable)throw Error("Function types cannot be represented in JSON Schema")})(0,e,0,0)});function aF(e){return new aC({type:"function",input:Array.isArray(e?.input)?oH(e?.input):e?.input??oC(oZ()),output:e?.output??oZ()})}let aM=f("ZodCustom",(e,t)=>{n1.init(e,t),ih.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n,r)=>{if("throw"===t.unrepresentable)throw Error("Custom types cannot be represented in JSON Schema")})(0,e,0,0)});function aD(e){let t=new tr({check:"custom"});return t._zod.check=e,t}function aR(e,t){var n;let r;return n=e??(()=>!0),(r=F(t)).abort??(r.abort=!0),new aM({type:"custom",check:"custom",fn:n,...r})}function aJ(e,t={}){return new aM({type:"custom",check:"custom",fn:e,...F(t)})}function aB(e){var t;let n,r;return t=t=>(t.addIssue=e=>{"string"==typeof e?t.issues.push(G(e,t.value,n._zod.def)):(e.fatal&&(e.continue=!1),e.code??(e.code="custom"),e.input??(e.input=t.value),e.inst??(e.inst=n),e.continue??(e.continue=!n._zod.def.abort),t.issues.push(G(e)))},e(t.value,t)),(r=new tr({check:"custom",...F(void 0)}))._zod.check=t,n=r}let aU=function(e){let t=new tr({check:"describe"});return t._zod.onattach=[t=>{let n=n4.get(t)??{};n4.add(t,{...n,description:e})}],t._zod.check=()=>{},t},aL=function(e){let t=new tr({check:"meta"});return t._zod.onattach=[t=>{let n=n4.get(t)??{};n4.add(t,{...n,...e})}],t._zod.check=()=>{},t};function aV(e,t={}){let n=new aM({type:"custom",check:"custom",fn:t=>t instanceof e,abort:!0,...F(t)});return n._zod.bag.Class=e,n._zod.check=t=>{t.value instanceof e||t.issues.push({code:"invalid_type",expected:e.name,input:t.value,inst:n,path:[...n._zod.def.path??[]]})},n}let aq=(...e)=>(function(e,t){let n=F(t),r=n.truthy??["true","1","yes","on","y","enabled"],i=n.falsy??["false","0","no","off","n","disabled"];"sensitive"!==n.case&&(r=r.map(e=>"string"==typeof e?e.toLowerCase():e),i=i.map(e=>"string"==typeof e?e.toLowerCase():e));let o=new Set(r),a=new Set(i),u=e.Codec??nq,s=e.Boolean??t3,l=new u({type:"pipe",in:new(e.String??tP)({type:"string",error:n.error}),out:new s({type:"boolean",error:n.error}),transform:(e,t)=>{let r=e;return"sensitive"!==n.case&&(r=r.toLowerCase()),!!o.has(r)||!a.has(r)&&(t.issues.push({code:"invalid_value",expected:"stringbool",values:[...o,...a],input:t.value,inst:l,continue:!1}),{})},reverseTransform:(e,t)=>!0===e?r[0]||"true":i[0]||"false",error:n.error});return l})({Codec:a$,Boolean:of,String:iv},...e);function aG(e){let t=aI(()=>oU([iy(e),oo(),op(),oS(),oC(t),oQ(iy(),t)]));return t}function aW(e,t){return aO(ai(e),t)}u||(u={}),v({localeError:(r={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}},i={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},o={nan:"NaN"},e=>{switch(e.code){case"invalid_type":{let t=o[e.expected]??e.expected,n=function(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":if(null===e)return"null";if(Array.isArray(e))return"array";if(e&&Object.getPrototypeOf(e)!==Object.prototype&&"constructor"in e&&e.constructor)return e.constructor.name}return t}(e.input),r=o[n]??n;return`Invalid input: expected ${t}, received ${r}`}case"invalid_value":if(1===e.values.length)return`Invalid input: expected ${M(e.values[0])}`;return`Invalid option: expected one of ${g(e.values,"|")}`;case"too_big":{let t=e.inclusive?"<=":"<",n=r[e.origin]??null;if(n)return`Too big: expected ${e.origin??"value"} to have ${t}${e.maximum.toString()} ${n.unit??"elements"}`;return`Too big: expected ${e.origin??"value"} to be ${t}${e.maximum.toString()}`}case"too_small":{let t=e.inclusive?">=":">",n=r[e.origin]??null;if(n)return`Too small: expected ${e.origin} to have ${t}${e.minimum.toString()} ${n.unit}`;return`Too small: expected ${e.origin} to be ${t}${e.minimum.toString()}`}case"invalid_format":if("starts_with"===e.format)return`Invalid string: must start with "${e.prefix}"`;if("ends_with"===e.format)return`Invalid string: must end with "${e.suffix}"`;if("includes"===e.format)return`Invalid string: must include "${e.includes}"`;if("regex"===e.format)return`Invalid string: must match pattern ${e.pattern}`;return`Invalid ${i[e.format]??e.format}`;case"not_multiple_of":return`Invalid number: must be a multiple of ${e.divisor}`;case"unrecognized_keys":return`Unrecognized key${e.keys.length>1?"s":""}: ${g(e.keys,", ")}`;case"invalid_key":return`Invalid key in ${e.origin}`;case"invalid_union":default:return"Invalid input";case"invalid_element":return`Invalid value in ${e.origin}`}})});var aK=o5(["count","sum","avg","max","min"]),aX=oD({field:iy(),aggregation:aK.optional(),alias:iy(),distinct:op().optional()}),aH=oD({field:iy(),alias:iy().optional(),format:iy().optional()}),aY=oD({key:iy(),title:iy(),chartType:iy(),measures:oC(aX),dimensions:oC(aH).optional(),config:oQ(iy(),oZ()).optional()}),aQ=oD({fields:oC(iy()),sortable:oC(iy()).optional(),actions:oC(o5(["view","edit","delete","add"])).optional()}),a0=oD({fields:oC(iy()),mode:o5(["create","edit"]).optional()}),a1=oD({version:ae(1),blockType:o5(["chart","table","form"]),title:iy(),primaryCollection:iy(),dataSource:iy(),charts:oC(aY).optional(),table:aQ.optional(),form:a0.optional(),rationale:iy().optional()}),a2=n(249);function a4(e,t,n,r,i,o,a){try{var u=e[o](a),s=u.value}catch(e){n(e);return}u.done?t(s):Promise.resolve(s).then(r,i)}function a6(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){a4(o,r,i,a,u,"next",e)}function u(e){a4(o,r,i,a,u,"throw",e)}a(void 0)})}}function a9(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(a,"next",{value:s(0)}),u(a,"throw",{value:s(1)}),u(a,"return",{value:s(2)}),"function"==typeof Symbol&&u(a,Symbol.iterator,{value:function(){return this}}),a;function s(u){return function(s){var l=[u,s];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&l[0]?r.return:l[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,l[1])).done)return i;switch(r=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,r=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===l[0]||2===l[0])){o=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){o.label=l[1];break}if(6===l[0]&&o.label<i[1]){o.label=i[1],i=l;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(l);break}i[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],r=0}finally{n=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}function a3(e){return a6(function(){return a9(this,function(t){switch(t.label){case 0:return[4,e.request({url:"".concat(a2.po,":publicGet"),method:"post"})];case 1:return[2,t.sent().data.data]}})})()}function a5(e,t){return a6(function(){return a9(this,function(n){switch(n.label){case 0:return[4,e.request({url:"".concat(a2.po,":update"),method:"post",params:{filterByTk:1},data:t})];case 1:return n.sent(),[2]}})})()}function a8(e,t){return a6(function(){var n;return a9(this,function(r){switch(r.label){case 0:var i,o;return[4,e.request({url:a2.kl.build,method:"post",data:(i=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},t),o=o={primaryCollection:t.collections[0]},Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(o)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(o)).forEach(function(e){Object.defineProperty(i,e,Object.getOwnPropertyDescriptor(o,e))}),i)})];case 1:if(null==(n=r.sent().data.data.id)||""===n)throw Error("Invalid build response");return[2,String(n)]}})})()}function a7(e,t){return a6(function(){var n;return a9(this,function(r){switch(r.label){case 0:return[4,e.request({url:a2.kl.getResult,method:"post",params:{filterByTk:t}})];case 1:if((n=function(e){if(!e||(void 0===e?"undefined":e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e)!="object"||"string"!=typeof e.id&&"number"!=typeof e.id||!a2.Gm.includes(e.buildPhase))throw Error("Invalid build response");var t=a1.safeParse(e.blockSpec);if("completed"===e.buildPhase&&!t.success)throw Error("Invalid generated block specification");return{id:String(e.id),buildPhase:e.buildPhase,blockSpec:t.success?t.data:void 0,usedFallback:!0===e.usedFallback,adjustments:e.adjustments,errorMessage:"string"==typeof e.errorMessage?e.errorMessage:void 0}}(r.sent().data.data)).id!==t)throw Error("Invalid build response");return[2,n]}})})()}function ue(e,t){return a6(function(){return a9(this,function(n){switch(n.label){case 0:return[4,e.request({url:a2.kl.retry,method:"post",params:{filterByTk:t}})];case 1:return n.sent(),[2]}})})()}},515:function(e,t,n){n.d(t,{C:function(){return i.AF},k:function(){return o}});var r=n(953),i=n(249),o=function(){return(0,r.useTranslation)(["plugin-build-visualization-block","client"]).t}},249:function(e,t,n){n.d(t,{AF:function(){return r},B1:function(){return u},Gm:function(){return a},kl:function(){return o},po:function(){return i},vw:function(){return s}});var r="plugin-build-visualization-block",i="aiVisualizationBuildSettings",o={build:"aiVisualizationBuilds:build",retry:"aiVisualizationBuilds:retry",getResult:"aiVisualizationBuilds:getResult"},a=["idle","queued","analyzing","generating","completed","failed"],u=50,s=2e3},327:function(e,t,n){n.d(t,{CU:function(){return r},an:function(){return i}});var r="plugin-build-visualization-block",i=[{type:"visualization-analyze",title:"Analyze visualization"},{type:"visualization-validate",title:"Validate visualization"},{type:"visualization-generate",title:"Generate visualization"}]},485:function(e){e.exports=a},694:function(e){e.exports=i},197:function(e){e.exports=t},625:function(e){e.exports=o},59:function(t){t.exports=e},155:function(e){e.exports=n},953:function(e){e.exports=r}},d={};function f(e){var t=d[e];if(void 0!==t)return t.exports;var n=d[e]={exports:{}};return c[e](n,n.exports,f),n.exports}f.m=c,f.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return f.d(t,{a:t}),t},f.d=function(e,t){for(var n in t)f.o(t,n)&&!f.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},f.f={},f.e=function(e){return Promise.all(Object.keys(f.f).reduce(function(t,n){return f.f[n](e,t),t},[]))},f.u=function(e){return""+e+"."+({385:"1e235c5081822f07",59:"cdb723e410dac32b"})[e]+".js"},f.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),f.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},p={},f.l=function(e,t,n,r){if(p[e])return void p[e].push(t);if(void 0!==n)for(var i,o,a=document.getElementsByTagName("script"),u=0;u<a.length;u++){var s=a[u];if(s.getAttribute("src")==e||s.getAttribute("data-rspack")=="plugin-build-visualization-block/client-v2:"+n){i=s;break}}i||(o=!0,(i=document.createElement("script")).timeout=120,f.nc&&i.setAttribute("nonce",f.nc),i.setAttribute("data-rspack","plugin-build-visualization-block/client-v2:"+n),i.src=e),p[e]=[t];var l=function(t,n){i.onerror=i.onload=null,clearTimeout(c);var r=p[e];if(delete p[e],i.parentNode&&i.parentNode.removeChild(i),r&&r.forEach(function(e){return e(n)}),t)return t(n)},c=setTimeout(l.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=l.bind(null,i.onerror),i.onload=l.bind(null,i.onload),o&&document.head.appendChild(i)},f.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.g.importScripts&&(h=f.g.location+"");var p,h,m=f.g.document;if(!h&&m&&(m.currentScript&&"SCRIPT"===m.currentScript.tagName.toUpperCase()&&(h=m.currentScript.src),!h)){var v=m.getElementsByTagName("script");if(v.length)for(var y=v.length-1;y>-1&&(!h||!/^http(s?):/.test(h));)h=v[y--].src}if(!h)throw Error("Automatic publicPath is not supported in this browser");f.p=h.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),u={889:0},f.f.j=function(e,t){var n=f.o(u,e)?u[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=u[e]=[t,r]});t.push(n[2]=r);var i=f.p+f.u(e),o=Error();f.l(i,function(t){if(f.o(u,e)&&(0!==(n=u[e])&&(u[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),i=t&&t.target&&t.target.src;o.message="Loading chunk "+e+" failed.\n("+r+": "+i+")",o.name="ChunkLoadError",o.type=r,o.request=i,n[1](o)}},"chunk-"+e,e)}},s=function(e,t){var n,r,i=t[0],o=t[1],a=t[2],s=0;if(i.some(function(e){return 0!==u[e]})){for(n in o)f.o(o,n)&&(f.m[n]=o[n]);a&&a(f)}for(e&&e(t);s<i.length;s++)r=i[s],f.o(u,r)&&u[r]&&u[r][0](),u[r]=0},(l=self.webpackChunkplugin_build_visualization_block_client_v2=self.webpackChunkplugin_build_visualization_block_client_v2||[]).forEach(s.bind(null,0)),l.push=s.bind(null,l.push.bind(l));var g={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src){var n=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"");n.indexOf("/static/plugins/plugin-build-visualization-block/dist/client-v2/")>=0&&(e=n.replace(/\/[^\/]+$/,"/"))}if(!e){var r=window.__webpack_public_path__||"";r&&("/"!==r.charAt(r.length-1)&&(r+="/"),e=r+"static/plugins/plugin-build-visualization-block/dist/client-v2/")}if(!e){var i=window.__nocobase_modern_client_prefix__||"v",o="/"+(i=String(i).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var a=window.location.pathname||"/",u=a.indexOf(o);e=u>=0?a.slice(0,u+1):"/"}e&&(e=e.replace(RegExp("/"+i+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/plugin-build-visualization-block/dist/client-v2/"}f.p=e}(),!function(){f.r(g),f.d(g,{default:function(){return Q}});var e=f(197),t=f(327);function n(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e){return(r=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function o(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(o=function(){return!!e})()}var a=f(485),u=f(694),s=f(59),l=f(155),c=f.n(l),d=f(284),p=f(625),h=f(249),m=f(515),v=f(456),y=f(667);function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function _(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function z(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function w(e){return function(e){if(Array.isArray(e))return b(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e){if(e){if("string"==typeof e)return b(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return b(e,void 0)}}(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var k=function(e){return{dataSourceKey:e.dataSource,collectionName:e.primaryCollection}},S=function(e){return{cardSettings:{titleDescription:{title:e}}}},O=function(e){return{use:"BlockGridModel",subModels:{items:e}}};function $(e,t,n,r,i){var o=k(e);return"create"!==r&&(o.filterByTk="{{ctx.view.inputArgs.filterByTk}}"),{use:"create"===r?"CreateFormModel":"edit"===r?"EditFormModel":"DetailsBlockModel",stepParams:z(_({},S(e.title)),{resourceSettings:{init:o}}),subModels:{grid:{use:"details"===r?"DetailsGridModel":"FormGridModel",subModels:{items:t.map(function(t){return{use:"details"===r?"DetailsItemModel":"FormItemModel",stepParams:{fieldSettings:{init:z(_({},k(e)),{fieldPath:t})}},subModels:{field:n(t,"details"===r?"display":"edit")}}})}},actions:"details"!==r&&i?[{use:"FormSubmitActionModel"}]:[]}}}function x(e,t,n,r){return{use:"create"===r?"AddNewActionModel":"edit"===r?"EditActionModel":"ViewActionModel",stepParams:{popupSettings:{openView:k(e)}},subModels:{page:{use:"ChildPageModel",stepParams:{pageSettings:{general:{displayTitle:!1,enableTabs:!1}}},subModels:{tabs:[{use:"ChildPageTabModel",subModels:{grid:O([$(e,t,n,r,!0)])}}]}}}}}function Z(e,t){var n,r=!(arguments.length>2)||void 0===arguments[2]||arguments[2],i=e.dataSourceManager.getCollection(t.dataSource,t.primaryCollection);if(!i)throw Error(e.t("Collection is unavailable",{ns:"plugin-build-visualization-block"}));var o=e.app.pm.get("data-visualization");return function(e,t,n){var r=!(arguments.length>3)||void 0===arguments[3]||arguments[3],i=arguments.length>4?arguments[4]:void 0;if("chart"===e.blockType){if(!(null==(l=e.charts)?void 0:l.length))throw Error("No compatible chart configuration");return O(e.charts.map(function(t){return function(e,t,n){if(!e.measures.length)throw Error("No compatible chart configuration");var r=e.measures.map(function(e){return z(_({},e),{aggregation:e.aggregation||"count"})}),i=(e.dimensions||[]).map(function(e){return z(_({},e),{alias:e.alias||e.field})}),o=_({},e.config),a=function(e,t){var n,o;return"string"!=typeof e?t:(null==(n=r.find(function(t){return t.field===e}))?void 0:n.alias)||(null==(o=i.find(function(t){return t.field===e}))?void 0:o.alias)||e};if(n(e.chartType))s={mode:"basic",builder:z(_({},o),{type:e.chartType})};else if("antd.statistic"===e.chartType){var u=a(o.field,r[0].alias);s={mode:"custom",raw:"const rows = ctx.data?.objects || [];\nconst value = rows[0]?.[".concat(JSON.stringify(u),"] ?? 0;\nreturn { graphic: { type: 'text', left: 'center', top: 'middle', style: { text: String(value), fontSize: 36 } } };")}}else{var s,l,c,d,f,p={"ant-design-charts.line":"line","ant-design-charts.column":"bar","ant-design-charts.bar":"barHorizontal","ant-design-charts.pie":"pie","ant-design-charts.area":"area","ant-design-charts.scatter":"scatter","ant-design-charts.funnel":"funnel"}[e.chartType];if(!p)throw Error("No compatible chart configuration");var h=a(o.xField,null==(l=i[0])?void 0:l.alias),m=a(o.yField,r[0].alias);s={mode:"basic",builder:z(_({},o),{type:p,xField:h,yField:m,seriesField:a(o.seriesField,null==(c=i[1])?void 0:c.alias),pieCategory:a(o.colorField,null==(d=i[0])?void 0:d.alias),pieValue:a(o.angleField,r[0].alias),pieRadiusInner:"number"==typeof o.innerRadius?100*o.innerRadius:0,funnelCategory:a(o.xField,null==(f=i[0])?void 0:f.alias),funnelValue:a(o.yField,r[0].alias)})}}return{use:"ChartBlockModel",stepParams:z(_({},S(e.title)),{chartSettings:{configure:{query:{mode:"builder",collectionPath:[t.dataSource,t.primaryCollection],measures:r,dimensions:i},chart:{option:s}}}})}}(t,e,n)}))}var o=w(new Set("table"===e.blockType?null==(a=e.table)?void 0:a.fields:null==(u=e.form)?void 0:u.fields));if(!o.length)throw Error("No compatible field renderer");if("form"===e.blockType){var a,u,s,l,c,d,f=$(e,o,t,(null==(c=e.form)?void 0:c.mode)==="create"?"create":"edit",r),p=(null==i?void 0:i.collectionName)===e.primaryCollection&&(i.dataSourceKey||"main")===e.dataSource&&null!=i.filterByTk;return O([(null==(d=e.form)?void 0:d.mode)==="create"||p?f:z(_({},f),{stepParams:z(_({},f.stepParams),{resourceSettings:{init:k(e)}})})])}var h=r&&(null==(s=e.table)?void 0:s.actions)||[],m=[];return h.includes("view")&&m.push(x(e,o,t,"details")),h.includes("edit")&&m.push(x(e,o,t,"edit")),h.includes("delete")&&m.push({use:"DeleteActionModel"}),O([{use:"TableBlockModel",stepParams:z(_({},S(e.title)),{resourceSettings:{init:k(e)}}),subModels:{columns:w(o.map(function(n){var r,i;return{use:"TableColumnModel",stepParams:{fieldSettings:{init:z(_({},k(e)),{fieldPath:n})},tableColumnSettings:{sorter:{sorter:!!(null==(i=e.table)||null==(r=i.sortable)?void 0:r.includes(n))}}},subModels:{field:t(n,"display")}}})).concat(w(m.length?[{use:"TableActionsColumnModel",subModels:{actions:m}}]:[])),actions:h.includes("add")?[x(e,o,t,"create")]:[]}}])}(t,function(n,r){var o=i.getFieldByPath(n),u=("edit"===r?a.FormItemModel:"table"===t.blockType?a.TableColumnModel:a.DetailsItemModel).getDefaultBindingByField(e,o,{fallbackToTargetTitleField:"display"===r});if(!u)throw Error(e.t("No compatible field renderer",{ns:"plugin-build-visualization-block"}));var s="function"==typeof u.defaultProps?u.defaultProps(e,o):u.defaultProps;return{use:u.modelName,props:function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},s)}},function(e){return!!(null==o?void 0:o.charts.getChart(e))},r,null==(n=e.view)?void 0:n.inputArgs)}function E(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function P(e,t,n,r,i,o,a){try{var u=e[o](a),s=u.value}catch(e){n(e);return}u.done?t(s):Promise.resolve(s).then(r,i)}function j(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,i=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var o=[],a=!0,u=!1;try{for(i=i.call(e);!(a=(n=i.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(e){u=!0,r=e}finally{try{a||null==i.return||i.return()}finally{if(u)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return E(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return E(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function T(e){var t=e.ctx,n=e.spec,r=(0,m.k)(),i=j((0,l.useState)(),2),o=i[0],a=i[1],d=j((0,l.useState)(""),2),f=d[0],p=d[1];return((0,l.useEffect)(function(){var e,i,o=!1,s=(0,u.createBlockScopedEngine)(t.engine);return a(void 0),p(""),(i=function(){var i,u;return function(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(a,"next",{value:s(0)}),u(a,"throw",{value:s(1)}),u(a,"return",{value:s(2)}),"function"==typeof Symbol&&u(a,Symbol.iterator,{value:function(){return this}}),a;function s(u){return function(s){var l=[u,s];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&l[0]?r.return:l[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,l[1])).done)return i;switch(r=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,r=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===l[0]||2===l[0])){o=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){o.label=l[1];break}if(6===l[0]&&o.label<i[1]){o.label=i[1],i=l;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(l);break}i[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],r=0}finally{n=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(l){switch(l.label){case 0:return l.trys.push([0,2,,3]),i=Z(t,n,!1),[4,s.createModelAsync(i)];case 1:if(e=l.sent(),o)return e.remove(),[2];return e.context.addDelegate(t),a(e),[3,3];case 2:var c;return u=l.sent(),o||p((null!=(c=Error)&&"u">typeof Symbol&&c[Symbol.hasInstance]?!!c[Symbol.hasInstance](u):u instanceof c)?u.message:r("Preview is unavailable")),[3,3];case 3:return[2]}})},function(){var e=this,t=arguments;return new Promise(function(n,r){var o=i.apply(e,t);function a(e){P(o,n,r,a,u,"next",e)}function u(e){P(o,n,r,a,u,"throw",e)}a(void 0)})})(),function(){o=!0,null==e||e.remove(),s.unlinkFromStack()}},[t,n,r]),f)?c().createElement(s.Alert,{type:"error",showIcon:!0,message:r(f)}):o?c().createElement(s.ConfigProvider,{componentDisabled:!0},c().createElement(u.FlowModelRenderer,{model:o,showFlowSettings:!1})):c().createElement(s.Spin,null)}function I(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function A(e,t,n,r,i,o,a){try{var u=e[o](a),s=u.value}catch(e){n(e);return}u.done?t(s):Promise.resolve(s).then(r,i)}function N(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){A(o,r,i,a,u,"next",e)}function u(e){A(o,r,i,a,u,"throw",e)}a(void 0)})}}function C(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,i=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var o=[],a=!0,u=!1;try{for(i=i.call(e);!(a=(n=i.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(e){u=!0,r=e}finally{try{a||null==i.return||i.return()}finally{if(u)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return I(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return I(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function F(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(a,"next",{value:s(0)}),u(a,"throw",{value:s(1)}),u(a,"return",{value:s(2)}),"function"==typeof Symbol&&u(a,Symbol.iterator,{value:function(){return this}}),a;function s(u){return function(s){var l=[u,s];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&l[0]?r.return:l[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,l[1])).done)return i;switch(r=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,r=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===l[0]||2===l[0])){o=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){o.label=l[1];break}if(6===l[0]&&o.label<i[1]){o.label=i[1],i=l;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(l);break}i[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],r=0}finally{n=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}function M(e){var t=e.value,n=e.onChange,r=e.context,i=(0,u.useFlowContext)(),o=(0,a.useApp)(),f=o.apiClient,g=(0,m.k)(),b=s.App.useApp().message,_=C(s.Form.useForm(),1)[0],z=s.Form.useWatch("llmService",_),w=C((0,l.useState)(null==t?void 0:t.buildId),2),k=w[0],S=w[1],O=C((0,l.useState)(),2),$=O[0],x=O[1],Z=C((0,l.useState)(!!(null==t?void 0:t.buildId)),2),E=Z[0],P=Z[1],j=!!o.pm.get("ai"),I=(0,p.useRequest)(function(){return(0,d.M5)(f)},{onSuccess:function(e){return _.setFieldsValue({collections:{dataSource:e.defaultDataSource||"main",collections:e.defaultCollections||[]},llmService:e.defaultLLMService,model:e.defaultModel})}}),A=(0,p.useRequest)(function(){return N(function(){return F(this,function(e){if(!k)throw Error("Invalid build response");return[2,(0,d.lT)(f,k)]})})()},{manual:!0,pollingInterval:2e3,pollingWhenHidden:!1,onSuccess:function(e){x(e),("completed"===e.buildPhase||"failed"===e.buildPhase)&&(P(!1),"completed"===e.buildPhase&&e.blockSpec&&(null==n||n({buildId:e.id,spec:e.blockSpec})))}}),M=A.run,D=A.cancel,R=A.error;(0,l.useEffect)(function(){return k&&E?M():D(),D},[k,E,M,D]);var J=(0,p.useRequest)(function(e){return N(function(){var t;return F(this,function(r){switch(r.label){case 0:return[4,(0,d.bT)(f,{requirement:e.requirement.trim(),dataSource:e.collections.dataSource||"main",collections:e.collections.collections||[],llmService:e.llmService,model:e.model})];case 1:return t=r.sent(),null==n||n(void 0),x(void 0),S(t),P(!0),[2]}})})()},{manual:!0,onError:function(){return b.error(g("The requirement could not be saved"))}}),B=(0,p.useRequest)(function(){return N(function(){return F(this,function(e){switch(e.label){case 0:if(!k)return[2];return[4,(0,d.Du)(f,k)];case 1:return e.sent(),null==n||n(void 0),x(void 0),P(!0),[2]}})})()},{manual:!0,onError:function(){return b.error(g("The requirement could not be saved"))}});return c().createElement(s.Space,{direction:"vertical",style:{width:"100%"},size:"middle"},!j&&c().createElement(s.Alert,{type:"warning",showIcon:!0,message:g("The AI service is unavailable")}),I.error&&c().createElement(s.Alert,{type:"warning",showIcon:!0,message:g("Failed to load the list")}),R&&c().createElement(s.Alert,{type:"error",showIcon:!0,message:g("Failed to load build status"),action:c().createElement(s.Button,{onClick:M},g("Retry"))}),E?c().createElement(s.Space,null,c().createElement(s.Spin,null),c().createElement(s.Tag,null,g((null==$?void 0:$.buildPhase)||"queued")),c().createElement(s.Typography.Text,null,g("Generating"))):null,(null==$?void 0:$.buildPhase)==="failed"&&c().createElement(s.Alert,{type:"error",showIcon:!0,message:$.errorMessage||g("The requirement could not be saved")}),(null==$?void 0:$.buildPhase)==="completed"&&$.blockSpec?c().createElement(c().Fragment,null,$.usedFallback&&c().createElement(s.Alert,{type:"warning",showIcon:!0,message:g("Generated using fallback specification")}),Array.isArray($.adjustments)&&$.adjustments.length>0&&c().createElement("details",null,c().createElement("summary",null,g("Adjustments")),c().createElement("pre",{style:{whiteSpace:"pre-wrap"}},JSON.stringify($.adjustments,null,2))),c().createElement(T,{ctx:r||i,spec:$.blockSpec}),c().createElement(s.Typography.Text,{type:"secondary"},g("Save this configuration to insert the generated block."))):null,!E&&k&&c().createElement(s.Button,{loading:B.loading,onClick:function(){return B.run()},disabled:!j},g("Regenerate")),c().createElement(s.Form,{form:_,layout:"vertical",disabled:I.loading||J.loading||E||B.loading,onFinish:function(e){return J.run(e)}},c().createElement(s.Form.Item,{name:"requirement",label:g("Requirement"),rules:[{required:!0,whitespace:!0},{max:h.vw}]},c().createElement(s.Input.TextArea,{"aria-label":g("Requirement"),rows:3,maxLength:h.vw,showCount:!0})),c().createElement(s.Form.Item,{name:"collections",label:g("Collections"),rules:[{validator:function(e,t){var n;return(null==t?void 0:t.dataSource)&&(null==(n=t.collections)?void 0:n.length)&&t.collections.length<=h.B1?Promise.resolve():Promise.reject(Error(g("At least one collection is required")))}}]},c().createElement(y.E,null)),c().createElement(s.Form.Item,{name:"llmService",label:g("AI service"),rules:[{required:!0}]},c().createElement(v.g,{onChange:function(){return _.setFieldValue("model",void 0)}})),c().createElement(s.Form.Item,{name:"model",label:g("Model"),rules:[{required:!0}]},c().createElement(v.o,{service:z})),c().createElement(s.Button,{type:"primary",htmlType:"submit",loading:J.loading,disabled:!j},g("Build"))))}function D(e,t,n,r,i,o,a){try{var u=e[o](a),s=u.value}catch(e){n(e);return}u.done?t(s):Promise.resolve(s).then(r,i)}function R(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){D(o,r,i,a,u,"next",e)}function u(e){D(o,r,i,a,u,"throw",e)}a(void 0)})}}function J(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function B(e){return(B=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function U(e,t){return(U=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function L(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(L=function(){return!!e})()}function V(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(a,"next",{value:s(0)}),u(a,"throw",{value:s(1)}),u(a,"return",{value:s(2)}),"function"==typeof Symbol&&u(a,Symbol.iterator,{value:function(){return this}}),a;function s(u){return function(s){var l=[u,s];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&l[0]?r.return:l[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,l[1])).done)return i;switch(r=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,r=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===l[0]||2===l[0])){o=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){o.label=l[1];break}if(6===l[0]&&o.label<i[1]){o.label=i[1],i=l;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(l);break}i[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],r=0}finally{n=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}var q=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t,r;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return t=n,r=arguments,t=B(t),J(e=function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,L()?Reflect.construct(t,r||[],B(this).constructor):t.apply(this,r)),"pendingOptions",void 0),e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&U(n,e),t=[{key:"installGenerated",value:function(e){return R(function(){var t,n,r,i;return V(this,function(o){switch(o.label){case 0:var a,u;if(!this.pendingOptions)return[2];return[4,this.flowEngine.createModelAsync((a=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){J(e,t,n[t])})}return e}({},this.pendingOptions),u=u={parentId:this.uid,subKey:"content",subType:"object"},Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(u)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(u)).forEach(function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(u,e))}),a))];case 1:t=o.sent(),n=this.subModels.content,r=this.props.generationFingerprint,this.setSubModel("content",t),this.setProps("generationFingerprint",JSON.stringify(e)),o.label=2;case 2:return o.trys.push([2,4,,5]),[4,this.save()];case 3:return o.sent(),[3,5];case 4:throw i=o.sent(),n?this.setSubModel("content",n):delete this.subModels.content,this.setProps("generationFingerprint",r),t.remove(),i;case 5:if(this.pendingOptions=void 0,!n)return[3,7];return[4,n.destroy()];case 6:o.sent(),o.label=7;case 7:return[2]}})}).call(this)}},{key:"renderComponent",value:function(){return this.subModels.content?c().createElement(u.FlowModelRenderer,{model:this.subModels.content,showFlowSettings:!1}):c().createElement(s.Empty,{description:this.context.t("Generate a block to get started",{ns:m.C})})}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,t),n}(a.BlockModel);function G(e,t,n,r,i,o,a){try{var u=e[o](a),s=u.value}catch(e){n(e);return}u.done?t(s):Promise.resolve(s).then(r,i)}function W(e,t,n){return(W=Y()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&X(i,n.prototype),i}).apply(null,arguments)}q.define({label:(0,u.tExpr)("Build Visualization Block",{ns:m.C}),group:(0,u.tExpr)("AI",{ns:m.C}),createModelOptions:{use:"BuildVisualizationBlockModel"},hide:function(e){return!e.acl.can({dataSourceKey:"main",resourceName:"aiVisualizationBuilds",actionName:"build"})}}),q.registerFlow({key:"visualizationBuildSettings",title:(0,u.tExpr)("Build Visualization Block",{ns:m.C}),manual:!0,sort:-100,steps:{generate:{preset:!0,title:(0,u.tExpr)("Build Visualization Block",{ns:m.C}),uiMode:{type:"dialog",props:{width:1e3}},uiSchema:function(e){return{generation:{type:"object",required:!0,"x-decorator":"FormItem","x-component":M,"x-component-props":{context:e}}}},beforeParamsSave:function(e,t){return R(function(){var n,r,i,o;return V(this,function(a){switch(a.label){case 0:if((r=e.model).pendingOptions=void 0,!(null==(n=t.generation)?void 0:n.buildId))throw Error(e.t("Generate a block to get started",{ns:m.C}));return[4,(0,d.lT)(e.api,t.generation.buildId)];case 1:if("completed"!==(i=a.sent()).buildPhase||!i.blockSpec)throw Error(e.t("Build is not completed",{ns:m.C}));if(t.generation={buildId:i.id,spec:i.blockSpec},r.setStepParams("visualizationBuildSettings","generate",{generation:t.generation}),r.subModels.content&&r.props.generationFingerprint===JSON.stringify(t.generation))return[2];if(!(o="chart"===i.blockSpec.blockType))return[3,3];return[4,e.engine.getModelClassAsync("ChartBlockModel")];case 2:o=!a.sent(),a.label=3;case 3:if(o)throw Error(e.t("Data visualization plugin is unavailable",{ns:m.C}));return r.pendingOptions=Z(e,i.blockSpec),[2]}})})()},afterParamsSave:function(e,t){return R(function(){return V(this,function(n){switch(n.label){case 0:return[4,e.model.installGenerated(t.generation)];case 1:return n.sent(),[2]}})})()}}}});function K(e){return(K=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function X(e,t){return(X=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function H(e){var t="function"==typeof Map?new Map:void 0;return(H=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return W(e,arguments,K(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),X(n,e)})(e)}function Y(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Y=function(){return!!e})()}var Q=function(a){var u;if("function"!=typeof a&&null!==a)throw TypeError("Super expression must either be null or a function");function s(){var e,t;if(!(this instanceof s))throw TypeError("Cannot call a class as a function");return e=s,t=arguments,e=K(e),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,Y()?Reflect.construct(e,t||[],K(this).constructor):e.apply(this,t))}return s.prototype=Object.create(a&&a.prototype,{constructor:{value:s,writable:!0,configurable:!0}}),a&&X(s,a),u=[{key:"load",value:function(){var a;return(a=function(){return function(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(a,"next",{value:s(0)}),u(a,"throw",{value:s(1)}),u(a,"return",{value:s(2)}),"function"==typeof Symbol&&u(a,Symbol.iterator,{value:function(){return this}}),a;function s(u){return function(s){var l=[u,s];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&l[0]?r.return:l[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,l[1])).done)return i;switch(r=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,r=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===l[0]||2===l[0])){o=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){o.label=l[1];break}if(6===l[0]&&o.label<i[1]){o.label=i[1],i=l;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(l);break}i[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],r=0}finally{n=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(a){return!function(a){var u=null==(d=a.pm)?void 0:d.get("workflow");if(u){var s=!0,l=!1,c=void 0;try{for(var d,p,h=t.an[Symbol.iterator]();!(s=(p=h.next()).done);s=!0)!function(){var a=p.value,s=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function u(){var e,i,s;if(!(this instanceof u))throw TypeError("Cannot call a class as a function");return i=u,s=arguments,i=r(i),e=function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,o()?Reflect.construct(i,s||[],r(this).constructor):i.apply(this,s)),n(e,"type",a.type),n(e,"title","{{t("+JSON.stringify(a.title)+", { ns: "+JSON.stringify(t.CU)+" })}}"),n(e,"group","extended"),n(e,"async",!0),n(e,"FieldsetLoader",function(){return f.e("59").then(f.bind(f,414))}),e}return u.prototype=Object.create(e&&e.prototype,{constructor:{value:u,writable:!0,configurable:!0}}),e&&i(u,e),u}(e.Instruction);u.registerInstruction(a.type,s)}()}catch(e){l=!0,c=e}finally{try{s||null==h.return||h.return()}finally{if(l)throw c}}}}(this.app),this.flowEngine.registerModels({BuildVisualizationBlockModel:q}),this.pluginSettingsManager.addMenuItem({key:"plugin-build-visualization-block",title:this.t("Build Visualization Block"),icon:"DashboardOutlined",aclSnippet:"pm.plugin-build-visualization-block.settings"}),this.pluginSettingsManager.addPageTabItem({menuKey:"plugin-build-visualization-block",key:"index",title:this.t("Build Visualization Block"),aclSnippet:"pm.plugin-build-visualization-block.settings",componentLoader:function(){return f.e("385").then(f.bind(f,144))}}),[2]})},function(){var e=this,t=arguments;return new Promise(function(n,r){var i=a.apply(e,t);function o(e){G(i,n,r,o,u,"next",e)}function u(e){G(i,n,r,o,u,"throw",e)}o(void 0)})}).call(this)}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(s.prototype,u),s}(H(a.Plugin))}(),g}()});
|
package/dist/externalVersion.js
CHANGED
|
@@ -10,15 +10,20 @@
|
|
|
10
10
|
module.exports = {
|
|
11
11
|
"react": "18.2.0",
|
|
12
12
|
"antd": "5.24.2",
|
|
13
|
-
"@nocobase/client": "2.
|
|
13
|
+
"@nocobase/client": "2.2.52",
|
|
14
14
|
"@formily/core": "2.3.7",
|
|
15
15
|
"@formily/react": "2.3.7",
|
|
16
16
|
"@ant-design/icons": "5.6.1",
|
|
17
|
-
"@nocobase/client-v2": "2.
|
|
18
|
-
"@nocobase/
|
|
19
|
-
"
|
|
20
|
-
"@nocobase/
|
|
21
|
-
"@
|
|
17
|
+
"@nocobase/client-v2": "2.2.52",
|
|
18
|
+
"@nocobase/plugin-workflow": "2.2.52",
|
|
19
|
+
"react-i18next": "11.18.6",
|
|
20
|
+
"@nocobase/flow-engine": "2.2.52",
|
|
21
|
+
"@nocobase/plugin-data-visualization": "2.2.52",
|
|
22
|
+
"@nocobase/server": "2.2.52",
|
|
23
|
+
"@nocobase/database": "2.2.52",
|
|
24
|
+
"ahooks": "3.7.8",
|
|
25
|
+
"@nocobase/actions": "2.2.52",
|
|
26
|
+
"@langchain/core": "1.1.49",
|
|
22
27
|
"@formily/shared": "2.3.7",
|
|
23
|
-
"@nocobase/resourcer": "2.
|
|
28
|
+
"@nocobase/resourcer": "2.2.52"
|
|
24
29
|
};
|
package/dist/locale/en-US.json
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
{
|
|
2
|
-
"Build Visualization Block": "Build Visualization Block",
|
|
3
|
-
"Data source": "Data source",
|
|
4
|
-
"Collections": "Collections",
|
|
5
|
-
"Requirement": "Requirement",
|
|
6
|
-
"Describe the block you want to build": "Describe the block you want to build",
|
|
7
|
-
"AI service": "AI service",
|
|
8
|
-
"Model": "Model",
|
|
9
|
-
"At least one collection is required": "At least one collection is required",
|
|
10
|
-
"You can select at most {{max}} collections": "You can select at most {{max}} collections",
|
|
11
|
-
"Requirement description is required": "Requirement description is required",
|
|
12
|
-
"Requirement must be at most {{max}} characters": "Requirement must be at most {{max}} characters",
|
|
13
|
-
"AI service and model are required": "AI service and model are required",
|
|
14
|
-
"The AI service is unavailable": "The AI service is unavailable",
|
|
15
|
-
"Idle": "Idle",
|
|
16
|
-
"Queued": "Queued",
|
|
17
|
-
"Analyzing": "Analyzing",
|
|
18
|
-
"Generating": "Generating",
|
|
19
|
-
"Completed": "Completed",
|
|
20
|
-
"Failed": "Failed",
|
|
21
|
-
"Build": "Build",
|
|
22
|
-
"Insert": "Insert",
|
|
23
|
-
"Regenerate": "Regenerate",
|
|
24
|
-
"Cancel": "Cancel",
|
|
25
|
-
"Preview": "Preview",
|
|
26
|
-
"A fallback block was generated": "A fallback block was generated",
|
|
27
|
-
"Some fields were adjusted to match the collection": "Some fields were adjusted to match the collection",
|
|
28
|
-
"Failed to load the list": "Failed to load the list",
|
|
29
|
-
"Retry": "Retry",
|
|
30
|
-
"The requirement could not be saved": "The requirement could not be saved",
|
|
31
|
-
"A maximum of {{max}} collections can be selected": "A maximum of {{max}} collections can be selected",
|
|
32
|
-
"A requirement is required": "A requirement is required",
|
|
33
|
-
"The requirement must be {{max}} characters or fewer": "The requirement must be {{max}} characters or fewer",
|
|
34
|
-
"An LLM service and model are required": "An LLM service and model are required",
|
|
35
|
-
"You do not have permission to read collection \"{{collection}}\"": "You do not have permission to read collection \"{{collection}}\"",
|
|
36
|
-
"You do not have permission to read this build": "You do not have permission to read this build",
|
|
1
|
+
{
|
|
2
|
+
"Build Visualization Block": "Build Visualization Block",
|
|
3
|
+
"Data source": "Data source",
|
|
4
|
+
"Collections": "Collections",
|
|
5
|
+
"Requirement": "Requirement",
|
|
6
|
+
"Describe the block you want to build": "Describe the block you want to build",
|
|
7
|
+
"AI service": "AI service",
|
|
8
|
+
"Model": "Model",
|
|
9
|
+
"At least one collection is required": "At least one collection is required",
|
|
10
|
+
"You can select at most {{max}} collections": "You can select at most {{max}} collections",
|
|
11
|
+
"Requirement description is required": "Requirement description is required",
|
|
12
|
+
"Requirement must be at most {{max}} characters": "Requirement must be at most {{max}} characters",
|
|
13
|
+
"AI service and model are required": "AI service and model are required",
|
|
14
|
+
"The AI service is unavailable": "The AI service is unavailable",
|
|
15
|
+
"Idle": "Idle",
|
|
16
|
+
"Queued": "Queued",
|
|
17
|
+
"Analyzing": "Analyzing",
|
|
18
|
+
"Generating": "Generating",
|
|
19
|
+
"Completed": "Completed",
|
|
20
|
+
"Failed": "Failed",
|
|
21
|
+
"Build": "Build",
|
|
22
|
+
"Insert": "Insert",
|
|
23
|
+
"Regenerate": "Regenerate",
|
|
24
|
+
"Cancel": "Cancel",
|
|
25
|
+
"Preview": "Preview",
|
|
26
|
+
"A fallback block was generated": "A fallback block was generated",
|
|
27
|
+
"Some fields were adjusted to match the collection": "Some fields were adjusted to match the collection",
|
|
28
|
+
"Failed to load the list": "Failed to load the list",
|
|
29
|
+
"Retry": "Retry",
|
|
30
|
+
"The requirement could not be saved": "The requirement could not be saved",
|
|
31
|
+
"A maximum of {{max}} collections can be selected": "A maximum of {{max}} collections can be selected",
|
|
32
|
+
"A requirement is required": "A requirement is required",
|
|
33
|
+
"The requirement must be {{max}} characters or fewer": "The requirement must be {{max}} characters or fewer",
|
|
34
|
+
"An LLM service and model are required": "An LLM service and model are required",
|
|
35
|
+
"You do not have permission to read collection \"{{collection}}\"": "You do not have permission to read collection \"{{collection}}\"",
|
|
36
|
+
"You do not have permission to read this build": "You do not have permission to read this build",
|
|
37
37
|
"A build id is required": "A build id is required",
|
|
38
38
|
"Build record not found": "Build record not found",
|
|
39
39
|
"Default collections": "Default collections",
|
|
@@ -41,5 +41,45 @@
|
|
|
41
41
|
"Default model": "Default model",
|
|
42
42
|
"Enable AI tool": "Enable AI tool",
|
|
43
43
|
"Save": "Save",
|
|
44
|
-
"Saved successfully": "Saved successfully"
|
|
44
|
+
"Saved successfully": "Saved successfully",
|
|
45
|
+
"Invalid build response": "Invalid build response",
|
|
46
|
+
"Invalid generated block specification": "Invalid generated block specification",
|
|
47
|
+
"No compatible chart configuration": "No compatible chart configuration",
|
|
48
|
+
"No compatible field renderer": "No compatible field renderer",
|
|
49
|
+
"Collection is unavailable": "Collection is unavailable",
|
|
50
|
+
"Failed to save settings": "Failed to save settings",
|
|
51
|
+
"Preview is unavailable": "Preview is unavailable",
|
|
52
|
+
"Failed to load build status": "Failed to load build status",
|
|
53
|
+
"Generated using fallback specification": "Generated using fallback specification",
|
|
54
|
+
"Adjustments": "Adjustments",
|
|
55
|
+
"Save this configuration to insert the generated block.": "Save this configuration to insert the generated block.",
|
|
56
|
+
"Generate a block to get started": "Generate a block to get started",
|
|
57
|
+
"Build is not completed": "Build is not completed",
|
|
58
|
+
"Data visualization plugin is unavailable": "Data visualization plugin is unavailable",
|
|
59
|
+
"AI": "AI",
|
|
60
|
+
"idle": "Idle",
|
|
61
|
+
"queued": "Queued",
|
|
62
|
+
"analyzing": "Analyzing",
|
|
63
|
+
"generating": "Generating",
|
|
64
|
+
"completed": "Completed",
|
|
65
|
+
"failed": "Failed",
|
|
66
|
+
"Managed workflow": "Managed workflow",
|
|
67
|
+
"Index file": "Index file",
|
|
68
|
+
"Analyze visualization": "Analyze visualization",
|
|
69
|
+
"Validate visualization": "Validate visualization",
|
|
70
|
+
"Generate visualization": "Generate visualization",
|
|
71
|
+
"This node requires an asynchronous workflow": "This node requires an asynchronous workflow",
|
|
72
|
+
"Workflow request not found": "Workflow request not found",
|
|
73
|
+
"Workflow request does not belong to this execution": "Workflow request does not belong to this execution",
|
|
74
|
+
"Managed workflow is unavailable or disabled": "Managed workflow is unavailable or disabled",
|
|
75
|
+
"Workflow request was canceled or superseded": "Workflow request was canceled or superseded",
|
|
76
|
+
"Workflow execution failed or was canceled": "Workflow execution failed or was canceled",
|
|
77
|
+
"Build queued in workflow": "Build queued in workflow",
|
|
78
|
+
"Build completed in workflow": "Build completed in workflow",
|
|
79
|
+
"Build running in workflow": "Build running in workflow",
|
|
80
|
+
"Workflow stage input is invalid": "Workflow stage input is invalid",
|
|
81
|
+
"Schema generation failed": "Schema generation failed",
|
|
82
|
+
"This node processes the request that triggered this workflow. No configuration is required.": "This node processes the request that triggered this workflow. No configuration is required.",
|
|
83
|
+
"Build completed using fallback": "Build completed using fallback",
|
|
84
|
+
"Workflow completed without finishing the plugin request": "Workflow completed without finishing the plugin request"
|
|
45
85
|
}
|