@uniformdev/uniform-mcp 20.29.2-alpha.14 → 20.30.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/dist/index.mjs +4 -4
- package/package.json +7 -7
package/dist/index.mjs
CHANGED
|
@@ -233,7 +233,7 @@ Check the render method of %s.`,Wt(fa)||"Unknown"));var P=uf(T,D);P.payload={ele
|
|
|
233
233
|
You might need to use a local HTTP server (instead of file://): https://reactjs.org/link/react-devtools-faq`:""),"font-weight:bold")}Dl.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Fk,Dl.createPortal=gNe,Dl.createRoot=yNe,Dl.findDOMNode=dNe,Dl.flushSync=xNe,Dl.hydrate=fNe,Dl.hydrateRoot=bNe,Dl.render=pNe,Dl.unmountComponentAtNode=hNe,Dl.unstable_batchedUpdates=mk,Dl.unstable_renderSubtreeIntoContainer=vNe,Dl.version=Ok,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()});var Md=rt((cbt,ij)=>{"use strict";function nye(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function")){if(process.env.NODE_ENV!=="production")throw new Error("^_^");try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(nye)}catch(t){console.error(t)}}}process.env.NODE_ENV==="production"?(nye(),ij.exports=eye()):ij.exports=tye()});var $Ge,j1e=Ue(()=>{"use strict";$Ge=[{id:"ci",name:"Circum Icons",projectUrl:"https://circumicons.com/",license:"MPL-2.0 license",licenseUrl:"https://github.com/Klarr-Agency/Circum-Icons/blob/main/LICENSE"},{id:"fa",name:"Font Awesome 5",projectUrl:"https://fontawesome.com/",license:"CC BY 4.0 License",licenseUrl:"https://creativecommons.org/licenses/by/4.0/"},{id:"fa6",name:"Font Awesome 6",projectUrl:"https://fontawesome.com/",license:"CC BY 4.0 License",licenseUrl:"https://creativecommons.org/licenses/by/4.0/"},{id:"io",name:"Ionicons 4",projectUrl:"https://ionicons.com/",license:"MIT",licenseUrl:"https://github.com/ionic-team/ionicons/blob/master/LICENSE"},{id:"io5",name:"Ionicons 5",projectUrl:"https://ionicons.com/",license:"MIT",licenseUrl:"https://github.com/ionic-team/ionicons/blob/master/LICENSE"},{id:"md",name:"Material Design icons",projectUrl:"http://google.github.io/material-design-icons/",license:"Apache License Version 2.0",licenseUrl:"https://github.com/google/material-design-icons/blob/master/LICENSE"},{id:"ti",name:"Typicons",projectUrl:"http://s-ings.com/typicons/",license:"CC BY-SA 3.0",licenseUrl:"https://creativecommons.org/licenses/by-sa/3.0/"},{id:"go",name:"Github Octicons icons",projectUrl:"https://octicons.github.com/",license:"MIT",licenseUrl:"https://github.com/primer/octicons/blob/master/LICENSE"},{id:"fi",name:"Feather",projectUrl:"https://feathericons.com/",license:"MIT",licenseUrl:"https://github.com/feathericons/feather/blob/master/LICENSE"},{id:"lu",name:"Lucide",projectUrl:"https://lucide.dev/",license:"ISC",licenseUrl:"https://github.com/lucide-icons/lucide/blob/main/LICENSE"},{id:"gi",name:"Game Icons",projectUrl:"https://game-icons.net/",license:"CC BY 3.0",licenseUrl:"https://creativecommons.org/licenses/by/3.0/"},{id:"wi",name:"Weather Icons",projectUrl:"https://erikflowers.github.io/weather-icons/",license:"SIL OFL 1.1",licenseUrl:"http://scripts.sil.org/OFL"},{id:"di",name:"Devicons",projectUrl:"https://vorillaz.github.io/devicons/",license:"MIT",licenseUrl:"https://opensource.org/licenses/MIT"},{id:"ai",name:"Ant Design Icons",projectUrl:"https://github.com/ant-design/ant-design-icons",license:"MIT",licenseUrl:"https://opensource.org/licenses/MIT"},{id:"bs",name:"Bootstrap Icons",projectUrl:"https://github.com/twbs/icons",license:"MIT",licenseUrl:"https://opensource.org/licenses/MIT"},{id:"ri",name:"Remix Icon",projectUrl:"https://github.com/Remix-Design/RemixIcon",license:"Apache License Version 2.0",licenseUrl:"http://www.apache.org/licenses/"},{id:"fc",name:"Flat Color Icons",projectUrl:"https://github.com/icons8/flat-color-icons",license:"MIT",licenseUrl:"https://opensource.org/licenses/MIT"},{id:"gr",name:"Grommet-Icons",projectUrl:"https://github.com/grommet/grommet-icons",license:"Apache License Version 2.0",licenseUrl:"http://www.apache.org/licenses/"},{id:"hi",name:"Heroicons",projectUrl:"https://github.com/tailwindlabs/heroicons",license:"MIT",licenseUrl:"https://opensource.org/licenses/MIT"},{id:"hi2",name:"Heroicons 2",projectUrl:"https://github.com/tailwindlabs/heroicons",license:"MIT",licenseUrl:"https://opensource.org/licenses/MIT"},{id:"si",name:"Simple Icons",projectUrl:"https://simpleicons.org/",license:"CC0 1.0 Universal",licenseUrl:"https://creativecommons.org/publicdomain/zero/1.0/"},{id:"sl",name:"Simple Line Icons",projectUrl:"https://thesabbir.github.io/simple-line-icons/",license:"MIT",licenseUrl:"https://opensource.org/licenses/MIT"},{id:"im",name:"IcoMoon Free",projectUrl:"https://github.com/Keyamoon/IcoMoon-Free",license:"CC BY 4.0 License",licenseUrl:"https://github.com/Keyamoon/IcoMoon-Free/blob/master/License.txt"},{id:"bi",name:"BoxIcons",projectUrl:"https://github.com/atisawd/boxicons",license:"MIT",licenseUrl:"https://github.com/atisawd/boxicons/blob/master/LICENSE"},{id:"cg",name:"css.gg",projectUrl:"https://github.com/astrit/css.gg",license:"MIT",licenseUrl:"https://opensource.org/licenses/MIT"},{id:"vsc",name:"VS Code Icons",projectUrl:"https://github.com/microsoft/vscode-codicons",license:"CC BY 4.0",licenseUrl:"https://creativecommons.org/licenses/by/4.0/"},{id:"tb",name:"Tabler Icons",projectUrl:"https://github.com/tabler/tabler-icons",license:"MIT",licenseUrl:"https://opensource.org/licenses/MIT"},{id:"tfi",name:"Themify Icons",projectUrl:"https://github.com/lykmapipo/themify-icons",license:"MIT",licenseUrl:"https://github.com/thecreation/standard-icons/blob/master/modules/themify-icons/LICENSE"},{id:"rx",name:"Radix Icons",projectUrl:"https://icons.radix-ui.com",license:"MIT",licenseUrl:"https://github.com/radix-ui/icons/blob/master/LICENSE"},{id:"pi",name:"Phosphor Icons",projectUrl:"https://github.com/phosphor-icons/core",license:"MIT",licenseUrl:"https://github.com/phosphor-icons/core/blob/main/LICENSE"},{id:"lia",name:"Icons8 Line Awesome",projectUrl:"https://icons8.com/line-awesome",license:"MIT",licenseUrl:"https://github.com/icons8/line-awesome/blob/master/LICENSE.md"}]});var Hj,g8,v8,jj=Ue(()=>{"use strict";Hj=J(ae(),1),g8={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},v8=Hj.default.createContext&&Hj.default.createContext(g8)});function LGe(t,e){if(t==null)return{};var n=OGe(t,e),r,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(o=0;o<i.length;o++)r=i[o],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function OGe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function y8(){return y8=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},y8.apply(this,arguments)}function W1e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),n.push.apply(n,r)}return n}function b8(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?W1e(Object(n),!0).forEach(function(r){MGe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):W1e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function MGe(t,e,n){return e=RGe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function RGe(t){var e=AGe(t,"string");return typeof e=="symbol"?e:e+""}function AGe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function K1e(t){return t&&t.map((e,n)=>Px.default.createElement(e.tag,b8({key:n},e.attr),K1e(e.child)))}function Xt(t){return e=>Px.default.createElement(G1e,y8({attr:b8({},t.attr)},e),K1e(t.child))}function G1e(t){var e=n=>{var{attr:r,size:o,title:i}=t,a=LGe(t,NGe),l=o||n.size||"1em",c;return n.className&&(c=n.className),t.className&&(c=(c?c+" ":"")+t.className),Px.default.createElement("svg",y8({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},n.attr,r,a,{className:c,style:b8(b8({color:t.color||n.color},n.style),t.style),height:l,width:l,xmlns:"http://www.w3.org/2000/svg"}),i&&Px.default.createElement("title",null,i),t.children)};return v8!==void 0?Px.default.createElement(v8.Consumer,null,n=>e(n)):e(g8)}var Px,NGe,Y1e=Ue(()=>{"use strict";Px=J(ae(),1);jj();NGe=["attr","size","title"]});var Sc={};zr(Sc,{DefaultContext:()=>g8,GenIcon:()=>Xt,IconBase:()=>G1e,IconContext:()=>v8,IconsManifest:()=>$Ge});var Ll=Ue(()=>{"use strict";j1e();Y1e();jj()});var q1e=rt((wwt,Z1e)=>{"use strict";var kGe=(Ll(),Kc(Sc)).GenIcon;Z1e.exports.MdSettings=function(e){return kGe({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58a.49.49 0 0 0 .12-.61l-1.92-3.32a.488.488 0 0 0-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54a.484.484 0 0 0-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58a.49.49 0 0 0-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z"},child:[]}]})(e)}});var Wj=rt((Ewt,J1e)=>{"use strict";var PGe=(Ll(),Kc(Sc)).GenIcon;J1e.exports.CgClose=function(e){return PGe({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none"},child:[{tag:"path",attr:{d:"M6.2253 4.81108C5.83477 4.42056 5.20161 4.42056 4.81108 4.81108C4.42056 5.20161 4.42056 5.83477 4.81108 6.2253L10.5858 12L4.81114 17.7747C4.42062 18.1652 4.42062 18.7984 4.81114 19.1889C5.20167 19.5794 5.83483 19.5794 6.22535 19.1889L12 13.4142L17.7747 19.1889C18.1652 19.5794 18.7984 19.5794 19.1889 19.1889C19.5794 18.7984 19.5794 18.1652 19.1889 17.7747L13.4142 12L19.189 6.2253C19.5795 5.83477 19.5795 5.20161 19.189 4.81108C18.7985 4.42056 18.1653 4.42056 17.7748 4.81108L12 10.5858L6.2253 4.81108Z",fill:"currentColor"},child:[]}]})(e)}});var Q1e=rt((Twt,X1e)=>{"use strict";var IGe=(Ll(),Kc(Sc)).GenIcon;X1e.exports.CgChevronDown=function(e){return IGe({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none"},child:[{tag:"path",attr:{d:"M6.34317 7.75732L4.92896 9.17154L12 16.2426L19.0711 9.17157L17.6569 7.75735L12 13.4142L6.34317 7.75732Z",fill:"currentColor"},child:[]}]})(e)}});var Kj=rt((_wt,ebe)=>{"use strict";var FGe=(Ll(),Kc(Sc)).GenIcon;ebe.exports.MdWarning=function(e){return FGe({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"},child:[]}]})(e)}});var nbe=rt((Dwt,tbe)=>{"use strict";var BGe=(Ll(),Kc(Sc)).GenIcon;tbe.exports.MdInfoOutline=function(e){return BGe({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"M11 7h2v2h-2V7zm0 4h2v6h-2v-6zm1-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"},child:[]}]})(e)}});var Yw=rt((Nwt,sp)=>{"use strict";function Gj(t){"@babel/helpers - typeof";return sp.exports=Gj=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},sp.exports.__esModule=!0,sp.exports.default=sp.exports,Gj(t)}sp.exports=Gj,sp.exports.__esModule=!0,sp.exports.default=sp.exports});var ibe=rt((Lwt,Zw)=>{"use strict";var obe=Yw().default;function zGe(t,e){if(obe(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(obe(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}Zw.exports=zGe,Zw.exports.__esModule=!0,Zw.exports.default=Zw.exports});var Yj=rt((Owt,qw)=>{"use strict";var VGe=Yw().default,UGe=ibe();function HGe(t){var e=UGe(t,"string");return VGe(e)=="symbol"?e:e+""}qw.exports=HGe,qw.exports.__esModule=!0,qw.exports.default=qw.exports});var Zj=rt((Mwt,Jw)=>{"use strict";var jGe=Yj();function WGe(t,e,n){return(e=jGe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}Jw.exports=WGe,Jw.exports.__esModule=!0,Jw.exports.default=Jw.exports});var sbe=rt((Rwt,Xw)=>{"use strict";var KGe=Zj();function abe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),n.push.apply(n,r)}return n}function GGe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?abe(Object(n),!0).forEach(function(r){KGe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):abe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}Xw.exports=GGe,Xw.exports.__esModule=!0,Xw.exports.default=Xw.exports});var lbe=rt((Awt,Qw)=>{"use strict";function YGe(t){if(Array.isArray(t))return t}Qw.exports=YGe,Qw.exports.__esModule=!0,Qw.exports.default=Qw.exports});var ube=rt((kwt,eE)=>{"use strict";function ZGe(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,o,i,a,l=[],c=!0,d=!1;try{if(i=(n=n.call(t)).next,e===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(f){d=!0,o=f}finally{try{if(!c&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(d)throw o}}return l}}eE.exports=ZGe,eE.exports.__esModule=!0,eE.exports.default=eE.exports});var qj=rt((Pwt,tE)=>{"use strict";function qGe(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}tE.exports=qGe,tE.exports.__esModule=!0,tE.exports.default=tE.exports});var Jj=rt((Iwt,nE)=>{"use strict";var cbe=qj();function JGe(t,e){if(t){if(typeof t=="string")return cbe(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?cbe(t,e):void 0}}nE.exports=JGe,nE.exports.__esModule=!0,nE.exports.default=nE.exports});var dbe=rt((Fwt,rE)=>{"use strict";function XGe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
234
234
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}rE.exports=XGe,rE.exports.__esModule=!0,rE.exports.default=rE.exports});var fbe=rt((Bwt,oE)=>{"use strict";var QGe=lbe(),eYe=ube(),tYe=Jj(),nYe=dbe();function rYe(t,e){return QGe(t)||eYe(t,e)||tYe(t,e)||nYe()}oE.exports=rYe,oE.exports.__esModule=!0,oE.exports.default=oE.exports});var pbe=rt((zwt,iE)=>{"use strict";function oYe(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.includes(r))continue;n[r]=t[r]}return n}iE.exports=oYe,iE.exports.__esModule=!0,iE.exports.default=iE.exports});var mbe=rt((Vwt,aE)=>{"use strict";var iYe=pbe();function aYe(t,e){if(t==null)return{};var n,r,o=iYe(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)n=i[r],e.includes(n)||{}.propertyIsEnumerable.call(t,n)&&(o[n]=t[n])}return o}aE.exports=aYe,aE.exports.__esModule=!0,aE.exports.default=aE.exports});var hbe=rt((Uwt,sE)=>{"use strict";function sYe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}sE.exports=sYe,sE.exports.__esModule=!0,sE.exports.default=sE.exports});var vbe=rt((Hwt,lE)=>{"use strict";var lYe=Yj();function gbe(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,lYe(r.key),r)}}function uYe(t,e,n){return e&&gbe(t.prototype,e),n&&gbe(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}lE.exports=uYe,lE.exports.__esModule=!0,lE.exports.default=lE.exports});var ybe=rt((jwt,lp)=>{"use strict";function Xj(t,e){return lp.exports=Xj=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},lp.exports.__esModule=!0,lp.exports.default=lp.exports,Xj(t,e)}lp.exports=Xj,lp.exports.__esModule=!0,lp.exports.default=lp.exports});var bbe=rt((Wwt,uE)=>{"use strict";var cYe=ybe();function dYe(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&cYe(t,e)}uE.exports=dYe,uE.exports.__esModule=!0,uE.exports.default=uE.exports});var xbe=rt((Kwt,up)=>{"use strict";function Qj(t){return up.exports=Qj=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},up.exports.__esModule=!0,up.exports.default=up.exports,Qj(t)}up.exports=Qj,up.exports.__esModule=!0,up.exports.default=up.exports});var Sbe=rt((Gwt,cp)=>{"use strict";function Cbe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(cp.exports=Cbe=function(){return!!t},cp.exports.__esModule=!0,cp.exports.default=cp.exports)()}cp.exports=Cbe,cp.exports.__esModule=!0,cp.exports.default=cp.exports});var wbe=rt((Ywt,cE)=>{"use strict";function fYe(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}cE.exports=fYe,cE.exports.__esModule=!0,cE.exports.default=cE.exports});var Ebe=rt((Zwt,dE)=>{"use strict";var pYe=Yw().default,mYe=wbe();function hYe(t,e){if(e&&(pYe(e)=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return mYe(t)}dE.exports=hYe,dE.exports.__esModule=!0,dE.exports.default=dE.exports});var _be=rt((qwt,fE)=>{"use strict";var Tbe=xbe(),gYe=Sbe(),vYe=Ebe();function yYe(t){var e=gYe();return function(){var n,r=Tbe(t);if(e){var o=Tbe(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return vYe(this,n)}}fE.exports=yYe,fE.exports.__esModule=!0,fE.exports.default=fE.exports});var Dbe=rt((Jwt,pE)=>{"use strict";var bYe=qj();function xYe(t){if(Array.isArray(t))return bYe(t)}pE.exports=xYe,pE.exports.__esModule=!0,pE.exports.default=pE.exports});var $be=rt((Xwt,mE)=>{"use strict";function CYe(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}mE.exports=CYe,mE.exports.__esModule=!0,mE.exports.default=mE.exports});var Nbe=rt((Qwt,hE)=>{"use strict";function SYe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
235
235
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}hE.exports=SYe,hE.exports.__esModule=!0,hE.exports.default=hE.exports});var Lbe=rt((eEt,gE)=>{"use strict";var wYe=Dbe(),EYe=$be(),TYe=Jj(),_Ye=Nbe();function DYe(t){return wYe(t)||EYe(t)||TYe(t)||_Ye()}gE.exports=DYe,gE.exports.__esModule=!0,gE.exports.default=gE.exports});var Obe=rt((tEt,vE)=>{"use strict";function $Ye(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}vE.exports=$Ye,vE.exports.__esModule=!0,vE.exports.default=vE.exports});var Rbe=rt((vEt,Mbe)=>{"use strict";var OYe=(Ll(),Kc(Sc)).GenIcon;Mbe.exports.CgSearch=function(e){return OYe({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none"},child:[{tag:"path",attr:{fillRule:"evenodd",clipRule:"evenodd",d:"M18.319 14.4326C20.7628 11.2941 20.542 6.75347 17.6569 3.86829C14.5327 0.744098 9.46734 0.744098 6.34315 3.86829C3.21895 6.99249 3.21895 12.0578 6.34315 15.182C9.22833 18.0672 13.769 18.2879 16.9075 15.8442C16.921 15.8595 16.9351 15.8745 16.9497 15.8891L21.1924 20.1317C21.5829 20.5223 22.2161 20.5223 22.6066 20.1317C22.9971 19.7412 22.9971 19.1081 22.6066 18.7175L18.364 14.4749C18.3493 14.4603 18.3343 14.4462 18.319 14.4326ZM16.2426 5.28251C18.5858 7.62565 18.5858 11.4246 16.2426 13.7678C13.8995 16.1109 10.1005 16.1109 7.75736 13.7678C5.41421 11.4246 5.41421 7.62565 7.75736 5.28251C10.1005 2.93936 13.8995 2.93936 16.2426 5.28251Z",fill:"currentColor"},child:[]}]})(e)}});var kCe=rt((E8t,ACe)=>{"use strict";var dJe=(Ll(),Kc(Sc)).GenIcon;ACe.exports.CgExternal=function(e){return dJe({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none"},child:[{tag:"path",attr:{d:"M15.6396 7.02527H12.0181V5.02527H19.0181V12.0253H17.0181V8.47528L12.1042 13.3892L10.6899 11.975L15.6396 7.02527Z",fill:"currentColor"},child:[]},{tag:"path",attr:{d:"M10.9819 6.97473H4.98193V18.9747H16.9819V12.9747H14.9819V16.9747H6.98193V8.97473H10.9819V6.97473Z",fill:"currentColor"},child:[]}]})(e)}});var ICe=rt((T8t,PCe)=>{"use strict";var fJe=(Ll(),Kc(Sc)).GenIcon;PCe.exports.TbCheck=function(e){return fJe({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M5 12l5 5l10 -10"},child:[]}]})(e)}});var BCe=rt((_8t,FCe)=>{"use strict";var pJe=(Ll(),Kc(Sc)).GenIcon;FCe.exports.TbMinus=function(e){return pJe({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M5 12l14 0"},child:[]}]})(e)}});var VCe=rt((D8t,zCe)=>{"use strict";var mJe=(Ll(),Kc(Sc)).GenIcon;zCe.exports.CgChevronRight=function(e){return mJe({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none"},child:[{tag:"path",attr:{d:"M10.5858 6.34317L12 4.92896L19.0711 12L12 19.0711L10.5858 17.6569L16.2427 12L10.5858 6.34317Z",fill:"currentColor"},child:[]}]})(e)}});var N2e=rt((GE,hZ)=>{"use strict";(function(t,e){typeof GE=="object"&&typeof hZ=="object"?hZ.exports=e(ae()):typeof define=="function"&&define.amd?define(["react"],e):typeof GE=="object"?GE.ReactPaginate=e(ae()):t.ReactPaginate=e(t.React)})(GE,t=>(()=>{var e={703:(i,a,l)=>{"use strict";var c=l(414);function d(){}function f(){}f.resetWarningCache=d,i.exports=function(){function m(y,b,C,S,w,E){if(E!==c){var _=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw _.name="Invariant Violation",_}}function h(){return m}m.isRequired=m;var g={array:m,bigint:m,bool:m,func:m,number:m,object:m,string:m,symbol:m,any:m,arrayOf:h,element:m,elementType:m,instanceOf:h,node:m,objectOf:h,oneOf:h,oneOfType:h,shape:h,exact:h,checkPropTypes:f,resetWarningCache:d};return g.PropTypes=g,g}},697:(i,a,l)=>{i.exports=l(703)()},414:i=>{"use strict";i.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},98:i=>{"use strict";i.exports=t}},n={};function r(i){var a=n[i];if(a!==void 0)return a.exports;var l=n[i]={exports:{}};return e[i](l,l.exports,r),l.exports}r.n=i=>{var a=i&&i.__esModule?()=>i.default:()=>i;return r.d(a,{a}),a},r.d=(i,a)=>{for(var l in a)r.o(a,l)&&!r.o(i,l)&&Object.defineProperty(i,l,{enumerable:!0,get:a[l]})},r.o=(i,a)=>Object.prototype.hasOwnProperty.call(i,a),r.r=i=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})};var o={};return(()=>{"use strict";r.r(o),r.d(o,{default:()=>A});var i=r(98),a=r.n(i),l=r(697),c=r.n(l);function d(){return d=Object.assign?Object.assign.bind():function(k){for(var F=1;F<arguments.length;F++){var j=arguments[F];for(var B in j)Object.prototype.hasOwnProperty.call(j,B)&&(k[B]=j[B])}return k},d.apply(this,arguments)}var f=function(k){var F=k.pageClassName,j=k.pageLinkClassName,B=k.page,U=k.selected,H=k.activeClassName,Y=k.activeLinkClassName,W=k.getEventListener,Z=k.pageSelectedHandler,X=k.href,se=k.extraAriaContext,de=k.pageLabelBuilder,ye=k.rel,Fe=k.ariaLabel||"Page "+B+(se?" "+se:""),Ge=null;return U&&(Ge="page",Fe=k.ariaLabel||"Page "+B+" is your current page",F=F!==void 0?F+" "+H:H,j!==void 0?Y!==void 0&&(j=j+" "+Y):j=Y),a().createElement("li",{className:F},a().createElement("a",d({rel:ye,role:X?void 0:"button",className:j,href:X,tabIndex:U?"-1":"0","aria-label":Fe,"aria-current":Ge,onKeyPress:Z},W(Z)),de(B)))};f.propTypes={pageSelectedHandler:c().func.isRequired,selected:c().bool.isRequired,pageClassName:c().string,pageLinkClassName:c().string,activeClassName:c().string,activeLinkClassName:c().string,extraAriaContext:c().string,href:c().string,ariaLabel:c().string,page:c().number.isRequired,getEventListener:c().func.isRequired,pageLabelBuilder:c().func.isRequired,rel:c().string};let m=f;function h(){return h=Object.assign?Object.assign.bind():function(k){for(var F=1;F<arguments.length;F++){var j=arguments[F];for(var B in j)Object.prototype.hasOwnProperty.call(j,B)&&(k[B]=j[B])}return k},h.apply(this,arguments)}var g=function(k){var F=k.breakLabel,j=k.breakAriaLabel,B=k.breakClassName,U=k.breakLinkClassName,H=k.breakHandler,Y=k.getEventListener,W=B||"break";return a().createElement("li",{className:W},a().createElement("a",h({className:U,role:"button",tabIndex:"0","aria-label":j,onKeyPress:H},Y(H)),F))};g.propTypes={breakLabel:c().oneOfType([c().string,c().node]),breakAriaLabel:c().string,breakClassName:c().string,breakLinkClassName:c().string,breakHandler:c().func.isRequired,getEventListener:c().func.isRequired};let y=g;function b(k){var F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return k??F}function C(k){return C=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(F){return typeof F}:function(F){return F&&typeof Symbol=="function"&&F.constructor===Symbol&&F!==Symbol.prototype?"symbol":typeof F},C(k)}function S(){return S=Object.assign?Object.assign.bind():function(k){for(var F=1;F<arguments.length;F++){var j=arguments[F];for(var B in j)Object.prototype.hasOwnProperty.call(j,B)&&(k[B]=j[B])}return k},S.apply(this,arguments)}function w(k,F){for(var j=0;j<F.length;j++){var B=F[j];B.enumerable=B.enumerable||!1,B.configurable=!0,"value"in B&&(B.writable=!0),Object.defineProperty(k,B.key,B)}}function E(k,F){return E=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(j,B){return j.__proto__=B,j},E(k,F)}function _(k,F){if(F&&(C(F)==="object"||typeof F=="function"))return F;if(F!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return N(k)}function N(k){if(k===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return k}function $(k){return $=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(F){return F.__proto__||Object.getPrototypeOf(F)},$(k)}function M(k,F,j){return F in k?Object.defineProperty(k,F,{value:j,enumerable:!0,configurable:!0,writable:!0}):k[F]=j,k}var O=function(k){(function(W,Z){if(typeof Z!="function"&&Z!==null)throw new TypeError("Super expression must either be null or a function");W.prototype=Object.create(Z&&Z.prototype,{constructor:{value:W,writable:!0,configurable:!0}}),Object.defineProperty(W,"prototype",{writable:!1}),Z&&E(W,Z)})(Y,k);var F,j,B,U,H=(B=Y,U=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}(),function(){var W,Z=$(B);if(U){var X=$(this).constructor;W=Reflect.construct(Z,arguments,X)}else W=Z.apply(this,arguments);return _(this,W)});function Y(W){var Z,X;return function(se,de){if(!(se instanceof de))throw new TypeError("Cannot call a class as a function")}(this,Y),M(N(Z=H.call(this,W)),"handlePreviousPage",function(se){var de=Z.state.selected;Z.handleClick(se,null,de>0?de-1:void 0,{isPrevious:!0})}),M(N(Z),"handleNextPage",function(se){var de=Z.state.selected,ye=Z.props.pageCount;Z.handleClick(se,null,de<ye-1?de+1:void 0,{isNext:!0})}),M(N(Z),"handlePageSelected",function(se,de){if(Z.state.selected===se)return Z.callActiveCallback(se),void Z.handleClick(de,null,void 0,{isActive:!0});Z.handleClick(de,null,se)}),M(N(Z),"handlePageChange",function(se){Z.state.selected!==se&&(Z.setState({selected:se}),Z.callCallback(se))}),M(N(Z),"getEventListener",function(se){return M({},Z.props.eventListener,se)}),M(N(Z),"handleClick",function(se,de,ye){var Fe=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},Ge=Fe.isPrevious,lt=Ge!==void 0&&Ge,xt=Fe.isNext,we=xt!==void 0&&xt,Pe=Fe.isBreak,Je=Pe!==void 0&&Pe,yt=Fe.isActive,rn=yt!==void 0&&yt;se.preventDefault?se.preventDefault():se.returnValue=!1;var $e=Z.state.selected,Ct=Z.props.onClick,Kt=ye;if(Ct){var Ut=Ct({index:de,selected:$e,nextSelectedPage:ye,event:se,isPrevious:lt,isNext:we,isBreak:Je,isActive:rn});if(Ut===!1)return;Number.isInteger(Ut)&&(Kt=Ut)}Kt!==void 0&&Z.handlePageChange(Kt)}),M(N(Z),"handleBreakClick",function(se,de){var ye=Z.state.selected;Z.handleClick(de,se,ye<se?Z.getForwardJump():Z.getBackwardJump(),{isBreak:!0})}),M(N(Z),"callCallback",function(se){Z.props.onPageChange!==void 0&&typeof Z.props.onPageChange=="function"&&Z.props.onPageChange({selected:se})}),M(N(Z),"callActiveCallback",function(se){Z.props.onPageActive!==void 0&&typeof Z.props.onPageActive=="function"&&Z.props.onPageActive({selected:se})}),M(N(Z),"getElementPageRel",function(se){var de=Z.state.selected,ye=Z.props,Fe=ye.nextPageRel,Ge=ye.prevPageRel,lt=ye.selectedPageRel;return de-1===se?Ge:de===se?lt:de+1===se?Fe:void 0}),M(N(Z),"pagination",function(){var se=[],de=Z.props,ye=de.pageRangeDisplayed,Fe=de.pageCount,Ge=de.marginPagesDisplayed,lt=de.breakLabel,xt=de.breakClassName,we=de.breakLinkClassName,Pe=de.breakAriaLabels,Je=Z.state.selected;if(Fe<=ye)for(var yt=0;yt<Fe;yt++)se.push(Z.getPageElement(yt));else{var rn=ye/2,$e=ye-rn;Je>Fe-ye/2?rn=ye-($e=Fe-Je):Je<ye/2&&($e=ye-(rn=Je));var Ct,Kt,Ut=function(bt){return Z.getPageElement(bt)},Ht=[];for(Ct=0;Ct<Fe;Ct++){var Xn=Ct+1;if(Xn<=Ge)Ht.push({type:"page",index:Ct,display:Ut(Ct)});else if(Xn>Fe-Ge)Ht.push({type:"page",index:Ct,display:Ut(Ct)});else if(Ct>=Je-rn&&Ct<=Je+(Je===0&&ye>1?$e-1:$e))Ht.push({type:"page",index:Ct,display:Ut(Ct)});else if(lt&&Ht.length>0&&Ht[Ht.length-1].display!==Kt&&(ye>0||Ge>0)){var ke=Ct<Je?Pe.backward:Pe.forward;Kt=a().createElement(y,{key:Ct,breakAriaLabel:ke,breakLabel:lt,breakClassName:xt,breakLinkClassName:we,breakHandler:Z.handleBreakClick.bind(null,Ct),getEventListener:Z.getEventListener}),Ht.push({type:"break",index:Ct,display:Kt})}}Ht.forEach(function(bt,Sn){var Gt=bt;bt.type==="break"&&Ht[Sn-1]&&Ht[Sn-1].type==="page"&&Ht[Sn+1]&&Ht[Sn+1].type==="page"&&Ht[Sn+1].index-Ht[Sn-1].index<=2&&(Gt={type:"page",index:bt.index,display:Ut(bt.index)}),se.push(Gt.display)})}return se}),W.initialPage!==void 0&&W.forcePage!==void 0&&console.warn("(react-paginate): Both initialPage (".concat(W.initialPage,") and forcePage (").concat(W.forcePage,") props are provided, which is discouraged.")+` Use exclusively forcePage prop for a controlled component.
|
|
236
|
-
See https://reactjs.org/docs/forms.html#controlled-components`),X=W.initialPage?W.initialPage:W.forcePage?W.forcePage:0,Z.state={selected:X},Z}return F=Y,(j=[{key:"componentDidMount",value:function(){var W=this.props,Z=W.initialPage,X=W.disableInitialCallback,se=W.extraAriaContext,de=W.pageCount,ye=W.forcePage;Z===void 0||X||this.callCallback(Z),se&&console.warn("DEPRECATED (react-paginate): The extraAriaContext prop is deprecated. You should now use the ariaLabelBuilder instead."),Number.isInteger(de)||console.warn("(react-paginate): The pageCount prop value provided is not an integer (".concat(de,"). Did you forget a Math.ceil()?")),Z!==void 0&&Z>de-1&&console.warn("(react-paginate): The initialPage prop provided is greater than the maximum page index from pageCount prop (".concat(Z," > ").concat(de-1,").")),ye!==void 0&&ye>de-1&&console.warn("(react-paginate): The forcePage prop provided is greater than the maximum page index from pageCount prop (".concat(ye," > ").concat(de-1,")."))}},{key:"componentDidUpdate",value:function(W){this.props.forcePage!==void 0&&this.props.forcePage!==W.forcePage&&(this.props.forcePage>this.props.pageCount-1&&console.warn("(react-paginate): The forcePage prop provided is greater than the maximum page index from pageCount prop (".concat(this.props.forcePage," > ").concat(this.props.pageCount-1,").")),this.setState({selected:this.props.forcePage})),Number.isInteger(W.pageCount)&&!Number.isInteger(this.props.pageCount)&&console.warn("(react-paginate): The pageCount prop value provided is not an integer (".concat(this.props.pageCount,"). Did you forget a Math.ceil()?"))}},{key:"getForwardJump",value:function(){var W=this.state.selected,Z=this.props,X=Z.pageCount,se=W+Z.pageRangeDisplayed;return se>=X?X-1:se}},{key:"getBackwardJump",value:function(){var W=this.state.selected-this.props.pageRangeDisplayed;return W<0?0:W}},{key:"getElementHref",value:function(W){var Z=this.props,X=Z.hrefBuilder,se=Z.pageCount,de=Z.hrefAllControls;if(X)return de||W>=0&&W<se?X(W+1,se,this.state.selected):void 0}},{key:"ariaLabelBuilder",value:function(W){var Z=W===this.state.selected;if(this.props.ariaLabelBuilder&&W>=0&&W<this.props.pageCount){var X=this.props.ariaLabelBuilder(W+1,Z);return this.props.extraAriaContext&&!Z&&(X=X+" "+this.props.extraAriaContext),X}}},{key:"getPageElement",value:function(W){var Z=this.state.selected,X=this.props,se=X.pageClassName,de=X.pageLinkClassName,ye=X.activeClassName,Fe=X.activeLinkClassName,Ge=X.extraAriaContext,lt=X.pageLabelBuilder;return a().createElement(m,{key:W,pageSelectedHandler:this.handlePageSelected.bind(null,W),selected:Z===W,rel:this.getElementPageRel(W),pageClassName:se,pageLinkClassName:de,activeClassName:ye,activeLinkClassName:Fe,extraAriaContext:Ge,href:this.getElementHref(W),ariaLabel:this.ariaLabelBuilder(W),page:W+1,pageLabelBuilder:lt,getEventListener:this.getEventListener})}},{key:"render",value:function(){var W=this.props.renderOnZeroPageCount;if(this.props.pageCount===0&&W!==void 0)return W&&W(this.props);var Z=this.props,X=Z.disabledClassName,se=Z.disabledLinkClassName,de=Z.pageCount,ye=Z.className,Fe=Z.containerClassName,Ge=Z.previousLabel,lt=Z.previousClassName,xt=Z.previousLinkClassName,we=Z.previousAriaLabel,Pe=Z.prevRel,Je=Z.nextLabel,yt=Z.nextClassName,rn=Z.nextLinkClassName,$e=Z.nextAriaLabel,Ct=Z.nextRel,Kt=this.state.selected,Ut=Kt===0,Ht=Kt===de-1,Xn="".concat(b(lt)).concat(Ut?" ".concat(b(X)):""),ke="".concat(b(yt)).concat(Ht?" ".concat(b(X)):""),bt="".concat(b(xt)).concat(Ut?" ".concat(b(se)):""),Sn="".concat(b(rn)).concat(Ht?" ".concat(b(se)):""),Gt=Ut?"true":"false",sr=Ht?"true":"false";return a().createElement("ul",{className:ye||Fe,role:"navigation","aria-label":"Pagination"},a().createElement("li",{className:Xn},a().createElement("a",S({className:bt,href:this.getElementHref(Kt-1),tabIndex:Ut?"-1":"0",role:"button",onKeyPress:this.handlePreviousPage,"aria-disabled":Gt,"aria-label":we,rel:Pe},this.getEventListener(this.handlePreviousPage)),Ge)),this.pagination(),a().createElement("li",{className:ke},a().createElement("a",S({className:Sn,href:this.getElementHref(Kt+1),tabIndex:Ht?"-1":"0",role:"button",onKeyPress:this.handleNextPage,"aria-disabled":sr,"aria-label":$e,rel:Ct},this.getEventListener(this.handleNextPage)),Je)))}}])&&w(F.prototype,j),Object.defineProperty(F,"prototype",{writable:!1}),Y}(i.Component);M(O,"propTypes",{pageCount:c().number.isRequired,pageRangeDisplayed:c().number,marginPagesDisplayed:c().number,previousLabel:c().node,previousAriaLabel:c().string,prevPageRel:c().string,prevRel:c().string,nextLabel:c().node,nextAriaLabel:c().string,nextPageRel:c().string,nextRel:c().string,breakLabel:c().oneOfType([c().string,c().node]),breakAriaLabels:c().shape({forward:c().string,backward:c().string}),hrefBuilder:c().func,hrefAllControls:c().bool,onPageChange:c().func,onPageActive:c().func,onClick:c().func,initialPage:c().number,forcePage:c().number,disableInitialCallback:c().bool,containerClassName:c().string,className:c().string,pageClassName:c().string,pageLinkClassName:c().string,pageLabelBuilder:c().func,activeClassName:c().string,activeLinkClassName:c().string,previousClassName:c().string,nextClassName:c().string,previousLinkClassName:c().string,nextLinkClassName:c().string,disabledClassName:c().string,disabledLinkClassName:c().string,breakClassName:c().string,breakLinkClassName:c().string,extraAriaContext:c().string,ariaLabelBuilder:c().func,eventListener:c().string,renderOnZeroPageCount:c().func,selectedPageRel:c().string}),M(O,"defaultProps",{pageRangeDisplayed:2,marginPagesDisplayed:3,activeClassName:"selected",previousLabel:"Previous",previousClassName:"previous",previousAriaLabel:"Previous page",prevPageRel:"prev",prevRel:"prev",nextLabel:"Next",nextClassName:"next",nextAriaLabel:"Next page",nextPageRel:"next",nextRel:"next",breakLabel:"...",breakAriaLabels:{forward:"Jump forward",backward:"Jump backward"},disabledClassName:"disabled",disableInitialCallback:!1,pageLabelBuilder:function(k){return k},eventListener:"onClick",renderOnZeroPageCount:void 0,selectedPageRel:"canonical",hrefAllControls:!1});let A=O})(),o})())});var L4e=rt((fUt,N4e)=>{"use strict";var Tot=Object.prototype.hasOwnProperty,_ot=Object.prototype.toString;N4e.exports=function(e,n,r){if(_ot.call(n)!=="[object Function]")throw new TypeError("iterator must be a function");var o=e.length;if(o===+o)for(var i=0;i<o;i++)n.call(r,e[i],i,e);else for(var a in e)Tot.call(e,a)&&n.call(r,e[a],a,e)}});var zZ=rt((pUt,O4e)=>{"use strict";var Dot=L4e();O4e.exports=wr;function wr(t,e,n){if(arguments.length===3)return wr.set(t,e,n);if(arguments.length===2)return wr.get(t,e);var r=wr.bind(wr,t);for(var o in wr)wr.hasOwnProperty(o)&&(r[o]=wr[o].bind(r,t));return r}wr.get=function(e,n){for(var r=Array.isArray(n)?n:wr.parse(n),o=0;o<r.length;++o){var i=r[o];if(!(typeof e=="object"&&i in e))throw new Error("Invalid reference token: "+i);e=e[i]}return e};wr.set=function(e,n,r){var o=Array.isArray(n)?n:wr.parse(n),i=o[0];if(o.length===0)throw Error("Can not set the root object");for(var a=0;a<o.length-1;++a){var l=o[a];typeof l!="string"&&typeof l!="number"&&(l=String(l)),!(l==="__proto__"||l==="constructor"||l==="prototype")&&(l==="-"&&Array.isArray(e)&&(l=e.length),i=o[a+1],l in e||(i.match(/^(\d+|-)$/)?e[l]=[]:e[l]={}),e=e[l])}return i==="-"&&Array.isArray(e)&&(i=e.length),e[i]=r,this};wr.remove=function(t,e){var n=Array.isArray(e)?e:wr.parse(e),r=n[n.length-1];if(r===void 0)throw new Error('Invalid JSON pointer for remove: "'+e+'"');var o=wr.get(t,n.slice(0,-1));if(Array.isArray(o)){var i=+r;if(r===""&&isNaN(i))throw new Error('Invalid array index: "'+r+'"');Array.prototype.splice.call(o,i,1)}else delete o[r]};wr.dict=function(e,n){var r={};return wr.walk(e,function(o,i){r[i]=o},n),r};wr.walk=function(e,n,r){var o=[];r=r||function(i){var a=Object.prototype.toString.call(i);return a==="[object Object]"||a==="[object Array]"},function i(a){Dot(a,function(l,c){o.push(String(c)),r(l)?i(l):n(l,wr.compile(o)),o.pop()})}(e)};wr.has=function(e,n){try{wr.get(e,n)}catch{return!1}return!0};wr.escape=function(e){return e.toString().replace(/~/g,"~0").replace(/\//g,"~1")};wr.unescape=function(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")};wr.parse=function(e){if(e==="")return[];if(e.charAt(0)!=="/")throw new Error("Invalid JSON pointer: "+e);return e.substring(1).split(/\//).map(wr.unescape)};wr.compile=function(e){return e.length===0?"":"/"+e.map(wr.escape).join("/")}});var R4e=rt((mUt,M4e)=>{"use strict";var VZ=class{constructor(e){this.value=e,this.next=void 0}},UZ=class{constructor(){this.clear()}enqueue(e){let n=new VZ(e);this._head?(this._tail.next=n,this._tail=n):(this._head=n,this._tail=n),this._size++}dequeue(){let e=this._head;if(e)return this._head=this._head.next,this._size--,e.value}clear(){this._head=void 0,this._tail=void 0,this._size=0}get size(){return this._size}*[Symbol.iterator](){let e=this._head;for(;e;)yield e.value,e=e.next}};M4e.exports=UZ});var k4e=rt((hUt,A4e)=>{"use strict";var $ot=R4e(),Not=t=>{if(!((Number.isInteger(t)||t===1/0)&&t>0))throw new TypeError("Expected `concurrency` to be a number from 1 and up");let e=new $ot,n=0,r=()=>{n--,e.size>0&&e.dequeue()()},o=async(l,c,...d)=>{n++;let f=(async()=>l(...d))();c(f);try{await f}catch{}r()},i=(l,c,...d)=>{e.enqueue(o.bind(null,l,c,...d)),(async()=>(await Promise.resolve(),n<t&&e.size>0&&e.dequeue()()))()},a=(l,...c)=>new Promise(d=>{i(l,d,...c)});return Object.defineProperties(a,{activeCount:{get:()=>n},pendingCount:{get:()=>e.size},clearQueue:{value:()=>{e.clear()}}}),a};A4e.exports=Not});import{McpServer as fst}from"@modelcontextprotocol/sdk/server/mcp.js";import{StdioServerTransport as pst}from"@modelcontextprotocol/sdk/server/stdio.js";import{CanvasClient as GNe}from"@uniformdev/canvas";import{z as one}from"zod";var Qte=process.env.UNIFORM_API_KEY,Bk=process.env.UNIFORM_PROJECT_ID,Xte=process.env.UNIFORM_API_HOST??"https://uniform.app",NNe=process.env.UNIFORM_AI_API_HOST??"https://ai.uniform.global";if(!Qte&&process.env.NODE_ENV!=="test")throw new Error("UNIFORM_API_KEY is not set");if(!Bk&&process.env.NODE_ENV!=="test")throw new Error("UNIFORM_PROJECT_ID is not set");var pt={apiHost:Xte,apiKey:Qte,projectId:Bk,aiApiHost:NNe,baseWebUrl:`${Xte}/projects/${Bk}`};import LNe from"fast-json-patch";function Z_(t,e){return LNe.applyPatch(t,e).newDocument}import{z as CS}from"zod";var q_=CS.array(CS.object({op:CS.enum(["add","remove","replace"]),path:CS.string().describe("The JSON path to patch"),value:CS.unknown().describe("The value to patch - for remove, leave this blank")}));function ONe(t){return Array.isArray(t)&&t.length>0}function ene(t){return!!t&&typeof t=="object"&&"type"in t}function tne(t){return typeof t=="object"&&t!==null&&"root"in t&&ene(t.root)}function Mg(t){return"children"in t&&ONe(t.children)}var MNe=({context:t,renderChildren:e})=>Mg(t.currentNode)?`${e(t.currentNode.children)} `:"";var RNe=({context:t,renderChildren:e})=>{if(!Mg(t.currentNode))return"";let n=e(t.currentNode.children);return n.endsWith(" ")?n:`${n} `};var ANe=({context:t,renderChildren:e})=>Mg(t.currentNode)?`${e(t.currentNode.children)} `:"";var kNe=({context:t,renderChildren:e})=>Mg(t.currentNode)?`${e(t.currentNode.children)} `:"";var PNe=({context:t,renderChildren:e})=>Mg(t.currentNode)?`${e(t.currentNode.children)} `:"";var INe=({context:t,renderChildren:e})=>Mg(t.currentNode)?`${e(t.currentNode.children)} `:"";var FNe=({context:t})=>t.currentNode.text;var BNe=()=>" ";var zNe=()=>" ",VNe=new Map([["text",FNe],["tab",BNe],["linebreak",zNe],["paragraph",ANe],["listitem",RNe],["heading",MNe],["table",kNe],["tablecell",PNe],["tablerow",INe]]),UNe=t=>{let e=VNe.get(t.currentNode.type);return e||(({context:n,renderChildren:r})=>Mg(n.currentNode)?r(n.currentNode.children):"")};function HNe(t,e){let n=[];return e?.ancestorNodes&&(n=n.concat(e.ancestorNodes)),e?.currentNode&&n.unshift(e.currentNode),{...e??{},currentNode:t,ancestorNodes:n}}function zk(t,e){var n;if(!ene(t))return"";let r=HNe(t,e),o=(n=r.resolveRenderer)==null?void 0:n.call(r,r);if(typeof o>"u")o=UNe(r);else if(o===null)return"";let i=a=>jNe(a,r);if(o){let a=o({context:r,renderChildren:i});return r.ancestorNodes.length>0?a:a.trim()}else throw new Error(`There is no renderer for node type: ${r.currentNode.type}`)}function jNe(t,e){return Array.isArray(t)?t.map(n=>zk(n,e)).join(""):""}var WNe=[{label:"Heading 1",type:"h1"},{label:"Heading 2",type:"h2"},{label:"Heading 3",type:"h3"},{label:"Heading 4",type:"h4"},{label:"Heading 5",type:"h5"},{label:"Heading 6",type:"h6"},{label:"Bullet List",type:"unorderedList"},{label:"Ordered List",type:"orderedList"},{label:"Link",type:"link"},{label:"Blockquote",type:"quote"},{label:"Code Block",type:"code"},{label:"Table",type:"table"},{label:"Asset",type:"asset"},{label:"Dynamic Token",type:"variable"}],KNe=[{label:"Bold",type:"bold"},{label:"Italic",type:"italic"},{label:"Underline",type:"underline"},{label:"Strikethrough",type:"strikethrough"},{label:"Code",type:"code"},{label:"Superscript",type:"superscript"},{label:"Subscript",type:"subscript"}];var J_={required:!1,formatting:{builtIn:KNe.map(t=>t.type)},elements:{builtIn:WNe.map(t=>t.type)},elementsConfig:{asset:{allowedTypes:["image"]}}};import{z as Qa}from"zod";import{z as lo}from"zod";var X_=lo.object({name:lo.string().describe('Title-cased display name. Ex: "Headline"'),id:lo.string().describe("The public ID. Must be unique within the current entity fields/parameters."),type:lo.enum(["text","richText","select","multi-select","number","date","dateTime","checkbox","link","asset","json","contentReference","$enr","group"]).describe("The data type of the property. The group type defines a grouping of other properties."),guidance:lo.string().describe('Describe what kind of content should be populated, for a LLM to use as a guide. 1-2 sentences max. Ex: "Meta tags based on the content", "2-3 word headline"'),localizable:lo.boolean().describe("Whether values are stored as locale-specific"),typeConfig:lo.object({allowedTypes:lo.array(lo.enum(["image","video","audio","other"])).optional().describe("The types of asset allowed. ONLY applies when type=asset, omit for other types"),options:lo.array(lo.object({text:lo.string().describe("The text to display to the author"),value:lo.string().describe("The value to store for the option")})).optional().describe("The author-selectable options for the select property. ONLY applies when type=select or multi-select, omit for other types"),required:lo.boolean().optional().describe("Whether an author must enter a value for this property"),min:lo.number().optional().describe("When type=number, this is the smallest allowed value (omit for no minimum). When type=multi-select, this is the minimum number of selections the author must make (omit for no minimum). When type=reference and isMulti=true, this is the minimum number of references the author must select (omit for no minimum). Omit for all other types."),max:lo.number().optional().describe("When type=number, this is the largest allowed value (omit for no maximum). When type=multi-select, this is the maximum number of selections the author can make (omit for no maximum). When type=reference and isMulti=true, this is the maximum number of references the author can select (omit for no maximum). Omit for all other types."),allowedContentTypes:lo.array(lo.string()).optional().describe("When type=reference, this is a list of content type public IDs the author can reference. The content type ID must already exist. Omit for all other types."),isMulti:lo.boolean().optional().describe("When type=reference, this is whether the author can select multiple referenced entries. When false, only one reference is allowed. Omit for all other types."),childrenParams:lo.array(lo.string()).optional().describe("When type=group, this is a list of public IDs of the properties to group. The property ID must be defined within this definition. Omit for all other types."),collapsed:lo.boolean().optional().describe("When type=group, this is whether the group is collapsed by default."),schema:lo.any().describe("When type=json, this is an optional JSON schema the property value must follow. Omit for all other types.")}).optional()});var nne=Qa.object({name:Qa.string().describe('Title-cased display name of the component. Ex: "Hero"'),id:Qa.string().describe("Public ID of the component, the camelCase version of name, using only alphanumeric characters"),description:Qa.string().describe('Describe the purpose of the component in 1-2 sentences. If the component seems generic, such as "Promo" or "Hero", this should be blank.'),canBeComposition:Qa.boolean().describe("True if the component can have pages/compositions created from it. False if it is a part of a page."),parameters:Qa.array(X_).describe("The properties of the component. The key is the publicId of the property.").optional(),slots:Qa.array(Qa.object({name:Qa.string().describe('Title-cased display name of the slot. Ex: "Content"'),id:Qa.string().describe("The public id of the slot. Must be unique within this component's slots."),allowedComponents:Qa.array(Qa.string()).describe("The components public IDs allowed in the slot."),minComponents:Qa.number().describe("The minimum number of components allowed in the slot. Omit for no minimum.").min(0).optional(),maxComponents:Qa.number().describe("The maximum number of components allowed in the slot. Omit for no maximum.").min(1).optional(),inheritAllowedComponents:Qa.boolean().describe("Set to false")})).describe("The slots of the component. The key is the publicId of the slot.").optional()});function rne(t){let e=t.slots?.map(o=>({...o,patternsInAllowedComponents:!0,inheritAllowedComponents:!1,maxComponents:o.maxComponents===0?void 0:o.maxComponents,minComponents:o.minComponents===0?void 0:o.minComponents})),n=t.parameters?.find(o=>o.type==="asset"&&typeof o.typeConfig=="object"&&o.typeConfig!==null&&"allowedTypes"in o.typeConfig&&Array.isArray(o.typeConfig.allowedTypes)&&o.typeConfig.allowedTypes?.includes("image"))?.id,r=t.parameters?.find(o=>o.type==="text")?.id;return{...t,slots:e,titleParameter:r,thumbnailParameter:n}}function _y(t){let e=t.filter(r=>r.type==="group")??[];if(e.length===0)return!1;let n=!1;for(;e.length>0;){let r=e.shift(),o=r.typeConfig&&typeof r.typeConfig=="object"&&"childrenParams"in r.typeConfig&&Array.isArray(r.typeConfig.childrenParams)?r.typeConfig.childrenParams:[],i=new Set(o),a=t.findIndex(c=>c.id===r.id),l=i.size;for(let c=a+1;c<=a+l;c++){let d=t[c];if(d)if(i.has(d.id))i.delete(d.id);else break}if(i.size>0){let c=Array.from(i),d=a+l-i.size;for(let f of c){let m=t.findIndex(h=>h.id===f);if(m!==-1){let[h]=t.splice(m,1);m>d&&d++,t.splice(d,0,h)}else o.splice(o.indexOf(f),1)}n=!0}}return n}function Q_(t){return`${pt.baseWebUrl}/dashboards/canvas/components/${t}`}function Dy(t,e){let n=t.filter(r=>e===void 0&&r.type==="richText"||e!==void 0&&e.includes(r.id));if(n.length!==0)for(let r of n){if(r.typeConfig===void 0){r.typeConfig=J_;continue}r.typeConfig={...J_,required:r.typeConfig.required??J_.required}}}var YNe={action:one.enum(["create","update","delete"]).describe("The action to perform"),publicId:one.string().describe("Public ID of the component, the camelCase version of name, using only alphanumeric characters"),component:nne.describe("Full component definition to create. Omit for update or delete.").optional(),patches:q_.describe("JSON patch to apply to the existing component definition. Omit for create or delete.").optional()};function ine(t){t.tool("componentAction","Creates, updates, or deletes a Uniform Component definition (or Composition definition)",YNe,async({publicId:e,action:n,component:r,patches:o})=>{let i=new GNe(pt),a=!1;if(n==="create"){if(!r)throw new Error("Component definition is required for create");let l=rne(r);l.parameters&&(a=_y(l.parameters),Dy(l.parameters)),await i.updateComponentDefinition({componentDefinition:l})}if(n==="update"){if(!o)throw new Error("Patches are required for update");let l=await i.getComponentDefinitions({componentId:e});if(!l.componentDefinitions.length)throw new Error(`Component with public ID ${e} does not exist, try creating it instead`);let c=l.componentDefinitions[0],d=c.parameters?.filter(m=>m.type==="richText").map(m=>m.id),f=Z_(c,o);if(f.parameters){a=_y(f.parameters);let m=f.parameters?.filter(h=>h.type==="richText").map(h=>h.id).filter(h=>!d?.includes(h));Dy(f.parameters,m)}await i.updateComponentDefinition({componentDefinition:f})}return n==="delete"&&await i.removeComponentDefinition({componentId:e}),{content:[{type:"text",text:JSON.stringify({success:!0,editUrl:Q_(e),warning:a?"Issues with parameter group order were fixed. Ensure definition data is re-fetched before any future updates.":void 0},null,2)}]}})}import{CanvasClient as ane}from"@uniformdev/canvas";import{z as ZNe}from"zod";var qNe={id:ZNe.string()};function sne(t){t.tool("componentList","Lists all Uniform Component definitions",async()=>{let r=(await new ane(pt).getComponentDefinitions({includeSystem:!0})).componentDefinitions.map(o=>({id:o.id,name:o.name,type:o.canBeComposition?"composition":"component",description:o.description,editUrl:Q_(o.id)}));return{content:[{type:"text",text:JSON.stringify(r,null,2)}]}}),t.tool("componentGet","Gets a Uniform Component definition details (slots, parameters, etc.)",qNe,async({id:e})=>{let r=await new ane(pt).getComponentDefinitions({componentId:e,includeSystem:!0});return{content:[{type:"text",text:JSON.stringify(r.componentDefinitions[0],null,2)}]}})}import{z as pn}from"zod";var JNe=pn.object({parentComponentId:pn.string().describe("ID of the component the slot belongs to"),slotName:pn.string().describe("Public ID of the target slot"),slotIndex:pn.number().describe("Index to insert the new component at. Omit for append.").optional(),newComponentInstanceUuid:pn.string().uuid().describe("ID of the new component to create - generate a random unique UUID"),instanceType:pn.enum(["component","componentPattern"]),componentType:pn.string().describe("Public ID of the component definition to insert. Component definition must be registered with Uniform. Omit when inserting a component pattern instance.").optional(),componentPatternId:pn.string().describe("UUID of the component pattern definition to insert. Component pattern must be registered with Uniform. Omit when inserting a component instance.").optional()}),e6=pn.object({componentId:pn.string().describe("ID of the component the parameter belongs to - can be created in the same call to this tool"),parameterId:pn.string().describe("Public ID of the parameter to update. Must be defined in the component type of the parent componentId"),parameterType:pn.string().describe("The type of the parameterId as defined on the component definition"),locale:pn.string().describe("Locale of the parameter value. Omit for non-localized values.").optional(),editInstructions:pn.string().describe('Prompt that will be used to generate the parameter value. Omission will leave the value unchanged. To reset an overridden value to pattern default, say "reset override".').optional()}).describe("A value change to a parameter. Omit unchanged parameters."),t6=pn.object({newComponentsInSlots:pn.array(JNe).describe("New components to insert in slots. Omit for delete. Performed before deleting, moving or duplicating components, and parameter updates.").optional(),deletedComponentsInSlots:pn.array(pn.string().describe("Component ID to remove. Cannot be the pattern root component.")).describe("Components to delete from slots during an update. Omit for create or delete, or if nothing needs deleting. These are performed before moving or duplicating components, and parameter updates.").optional(),moveComponentsInSlots:pn.array(pn.object({componentId:pn.string().describe("Component ID to move. Cannot be root component."),newParentComponentId:pn.string(),newSlotName:pn.string(),newSlotIndex:pn.number()})).describe("Components to move between slots. Omit for create or delete, or if nothing needs moving. These are performed before duplicating components, and parameter updates.").optional(),duplicateComponentsInSlots:pn.array(pn.string().describe("Component ID to duplicate. Cannot be root component. All descendants of the duplicated component will be duplicated as well. Duplicates are placed in the same slot as the original component, at the end.")).describe("Components to duplicate/copy. Omit when empty. These are performed before parameter updates.").optional()}),om=pn.object({enableLocales:pn.array(pn.string()).describe("Locales to enable. Omit for no change.").optional(),disableLocales:pn.array(pn.string()).describe("Locales to disable. Existing data in disabled locales will be lost. Omit for no change.").optional()}),XNe=pn.object({summary:pn.string().describe("Short summary of the edit that was made.").optional(),success:pn.boolean()}),Gst=pn.object({success:pn.boolean().describe("Whether all actions were successful"),actionsTaken:pn.array(XNe).describe("Array of individual actions that were taken")});import{z as SS}from"zod";var QNe=e6.extend({overridable:SS.enum(["yes","no"]).describe("Whether the parameter value set on the pattern definition is overridable by pattern consumers. Omit when no change is needed.").optional()}),lne=t6.extend({name:SS.string().describe("Name of the pattern. If the name does not need to be changed, omit this field. Always include for creates.").optional(),type:SS.string().describe("Component definition type of the pattern. Must be registered with Uniform. Always include for creates. Omit otherwise.").optional(),description:SS.string().describe("Description of the pattern for authors. If the description does not need to be changed, omit this field.").optional(),parameterUpdates:SS.array(QNe).describe("Updates to the parameters of the pattern. Use empty array if no changes are needed.").optional(),localeUpdates:om.optional()}).describe("Modification instructions for the pattern");import{z as n6}from"zod";var une=n6.object({...t6.shape,name:n6.string().describe("Name of the composition. If the name does not need to be changed, omit this field. Always include for creates.").optional(),type:n6.string().describe("Component definition type of the composition. Must be registered with Uniform and have canBeComposition=true in the component definition. Always include for creates. Omit otherwise.").optional(),parameterUpdates:n6.array(e6).describe("Updates to the parameters of the pattern. Use empty array if no changes are needed.").optional(),localeUpdates:om.optional()}).describe("Modification instructions for the composition");import{z as $y}from"zod";import{z as gf}from"zod";var Vk=gf.object({fieldId:gf.string().describe("Public ID of the field to update. Must be defined in the content type of the parent entry."),fieldType:gf.string().describe("The type of the fieldId as defined on the content type"),locale:gf.string().describe("Locale of the field value. Omit for non-localized values.").optional(),editInstructions:gf.string().describe('Prompt that will be used to generate the field value. Omission will leave the value unchanged. To reset an overridden value to pattern default, say "reset override".').optional()}).describe("A value change to a field. Omit unchanged fields."),cne=gf.object({type:gf.string().describe("Content type of the entry. Must be registered with Uniform. Always include for creates. Omit otherwise.").optional(),slug:gf.string().describe("Slug (human-readable identifier) of the entry. If the slug does not need to be changed, omit this field.").optional(),fieldUpdates:gf.array(Vk).describe("Updates to the fields of the entry. Use empty array if no changes are needed.").optional(),localeUpdates:om.optional()}).describe("Modification instructions for the entry");var e8e=Vk.extend({overridable:$y.enum(["yes","no"]).describe("Whether the parameter value set on the pattern definition is overridable by pattern consumers. Omit when no change is needed.").optional()}),dne=$y.object({name:$y.string().describe("Name of the entry pattern. If the name does not need to be changed, omit this field. Always include for creates.").optional(),type:$y.string().describe("Content type of the entry pattern. Must be registered with Uniform. Always include for creates. Omit otherwise.").optional(),description:$y.string().describe("Description of the entry pattern for authors. If the description does not need to be changed, omit this field.").optional(),fieldUpdates:$y.array(e8e).describe("Updates to the fields of the entry pattern. Use empty array if no changes are needed.").optional(),localeUpdates:om.optional()}).describe("Modification instructions for the entry pattern");import{z as tq}from"zod";import{CANVAS_BLOCK_PARAM_TYPE as xot}from"@uniformdev/canvas";import{getEffectivePropertyValue as Cot}from"@uniformdev/canvas";import{CANVAS_PERSONALIZATION_PARAM as Sot}from"@uniformdev/canvas";import t8e from"crypto";var o6=new Uint8Array(256),r6=o6.length;function Uk(){return r6>o6.length-16&&(t8e.randomFillSync(o6),r6=0),o6.slice(r6,r6+=16)}var fne=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function n8e(t){return typeof t=="string"&&fne.test(t)}var wS=n8e;var na=[];for(let t=0;t<256;++t)na.push((t+256).toString(16).slice(1));function pne(t,e=0){return na[t[e+0]]+na[t[e+1]]+na[t[e+2]]+na[t[e+3]]+"-"+na[t[e+4]]+na[t[e+5]]+"-"+na[t[e+6]]+na[t[e+7]]+"-"+na[t[e+8]]+na[t[e+9]]+"-"+na[t[e+10]]+na[t[e+11]]+na[t[e+12]]+na[t[e+13]]+na[t[e+14]]+na[t[e+15]]}import r8e from"crypto";var Hk={randomUUID:r8e.randomUUID};function o8e(t,e,n){if(Hk.randomUUID&&!e&&!t)return Hk.randomUUID();t=t||{};let r=t.random||(t.rng||Uk)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,e){n=n||0;for(let o=0;o<16;++o)e[n+o]=r[o];return e}return pne(r)}var ya=o8e;var i8e="$p:";function mne(t){return`${i8e}${t}`}function hne(t){return{...t,allowedComponentsIndex:new Set(t?.allowedComponents??[]),maxComponents:t?.maxComponents??Number.MAX_VALUE,minComponents:t?.minComponents??0,allowAllPatternsOfAllowedTypes:!t?.patternsInAllowedComponents}}import{CANVAS_LOCALIZATION_SLOT as _lt,CANVAS_LOCALIZATION_TYPE as Dlt,CANVAS_PERSONALIZATION_ALGORITHM_PARAM as $lt,CANVAS_PERSONALIZATION_ALGORITHM_TYPE as Nlt,CANVAS_PERSONALIZATION_EVENT_NAME_PARAM as Llt,CANVAS_PERSONALIZATION_TAKE_PARAM as Olt,CANVAS_PERSONALIZE_SLOT as Mlt,CANVAS_PERSONALIZE_TYPE as Rlt,CANVAS_SLOT_SECTION_SLOT as Alt,CANVAS_SLOT_SECTION_TYPE as klt,CANVAS_TEST_SLOT as Plt,CANVAS_TEST_TYPE as Ilt}from"@uniformdev/canvas";var a8e={$personalization:{isNestableIntoItself:!0},$test:void 0,$localization:void 0,$loop:void 0,$slotSection:{isAutoAllowed:!0,isNestableIntoItself:!0,isOnlyAllowedInPatternEditor:!0}},gne=t=>a8e[t];function jk(t,e,n=!1){let r=gne(t.type);if(r?.isOnlyAllowedInPatternEditor&&!n)return!1;if(r?.isAutoAllowed||e.allowAllComponents)return!0;let o=e.allowedComponentsIndex.has(t.type);return e.allowAllPatternsOfAllowedTypes||!t._pattern?o:e.allowedComponentsIndex.has(mne(t._pattern))||!1}var Wk=({twee:t,parentSlotDefinition:e,nodeId:n,componentDefinitionsIndex:r})=>{if(!e.inheritAllowedComponents)return e;let o=t.getParentInfo(n);if(!o)return;let i=r[o.value.type]?.slots?.find(({id:a})=>a===o.parentName);if(i)return Wk({parentSlotDefinition:i,nodeId:o.parentId,twee:t,componentDefinitionsIndex:r})};function a6({definition:t,lastUserChoice:e,currentValue:n}){if(t&&!t.localizable)return!1;if(n){if(n.locales&&i6(n.locales)||n.localesConditions&&i6(n.localesConditions))return!0;if(n.value!==void 0||n.conditions!==void 0)return!1}if(e!==void 0)return e;if(t)return!t.notLocalizedByDefault}function i6(t){return Array.isArray(t)?t.some(e=>i6(e)):t===void 0?!1:t===null||typeof t!="object"?!0:Object.values(t).some(e=>i6(e))}function vne({twee:t,nodeId:e,currentEditorLocale:n,definition:r}){let o=t.getNodeById(e),i=o?.propertyValueLocalizability?.[r.id],a=t.getNodeProperty(e,r?.id),l=a6({lastUserChoice:i,currentValue:a,definition:r});if(o&&l!==void 0&&l!==(i??!1)&&t.updateNode({nodeId:e,updateMetadata:c=>{c.propertyValueLocalizability[r.id]=l},doNotSetDirty:!0}),l)return n}import{CANVAS_ENRICHMENT_TAG_PARAM as mot,CANVAS_PERSONALIZATION_ALGORITHM_PARAM as hot,CANVAS_PERSONALIZATION_PARAM as got,CANVAS_PERSONALIZE_SLOT as vot,isSystemComponentDefinition as yot}from"@uniformdev/canvas";var yne=Object.prototype.hasOwnProperty;function ba(t,e){var n,r;if(t===e)return!0;if(t&&e&&(n=t.constructor)===e.constructor){if(n===Date)return t.getTime()===e.getTime();if(n===RegExp)return t.toString()===e.toString();if(n===Array){if((r=t.length)===e.length)for(;r--&&ba(t[r],e[r]););return r===-1}if(!n||typeof t=="object"){r=0;for(n in t)if(yne.call(t,n)&&++r&&!yne.call(e,n)||!(n in e)||!ba(t[n],e[n]))return!1;return Object.keys(e).length===r}}return t!==t&&e!==e}function s6(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)t[r]=n[r]}return t}var s8e={read:function(t){return t[0]==='"'&&(t=t.slice(1,-1)),t.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(t){return encodeURIComponent(t).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function Kk(t,e){function n(o,i,a){if(!(typeof document>"u")){a=s6({},e,a),typeof a.expires=="number"&&(a.expires=new Date(Date.now()+a.expires*864e5)),a.expires&&(a.expires=a.expires.toUTCString()),o=encodeURIComponent(o).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var l="";for(var c in a)a[c]&&(l+="; "+c,a[c]!==!0&&(l+="="+a[c].split(";")[0]));return document.cookie=o+"="+t.write(i,o)+l}}function r(o){if(!(typeof document>"u"||arguments.length&&!o)){for(var i=document.cookie?document.cookie.split("; "):[],a={},l=0;l<i.length;l++){var c=i[l].split("="),d=c.slice(1).join("=");try{var f=decodeURIComponent(c[0]);if(a[f]=t.read(d,f),o===f)break}catch{}}return o?a[o]:a}}return Object.create({set:n,get:r,remove:function(o,i){n(o,"",s6({},i,{expires:-1}))},withAttributes:function(o){return Kk(this.converter,s6({},this.attributes,o))},withConverter:function(o){return Kk(s6({},this.converter,o),this.attributes)}},{attributes:{value:Object.freeze(e)},converter:{value:Object.freeze(t)}})}var l8e=Kk(s8e,{path:"/"});function ES(t){return{all:t=t||new Map,on:function(e,n){var r=t.get(e);r?r.push(n):t.set(e,[n])},off:function(e,n){var r=t.get(e);r&&(n?r.splice(r.indexOf(n)>>>0,1):t.set(e,[]))},emit:function(e,n){var r=t.get(e);r&&r.slice().map(function(o){o(n)}),(r=t.get("*"))&&r.slice().map(function(o){o(e,n)})}}}var Sne=J(TS(),1);var $ne=J(TS(),1),Nne=J(TS(),1);var d8e=t=>{throw TypeError(t)};var Jk=(t,e,n)=>e.has(t)||d8e("Cannot "+n),lr=(t,e,n)=>(Jk(t,e,"read from private field"),n?n.call(t):e.get(t));var xne=(t,e,n,r)=>(Jk(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),DS=(t,e,n)=>(Jk(t,e,"access private method"),n);var f8e="_",p8e;p8e=new WeakMap;var m8e,h8e;m8e=new WeakMap;h8e=new WeakMap;var g8e,v8e,y8e,b8e;g8e=new WeakMap;v8e=new WeakMap;y8e=new WeakMap;b8e=new WeakMap;function x8e(t,e){return`${t}${f8e}${e}`}function C8e(t,e){var n;if(typeof t>"u"||t===null)return!1;let r=Number(t);if(isNaN(r))return!1;switch((n=e?.op)!=null?n:"="){case"=":return r===e.rhs;case"!=":return r!==e.rhs;case">":return r>e.rhs;case"<":return r<e.rhs;default:return console.warn(`Unknown match type ${e.op} is false.`),!1}}function S8e(t,e){return`${t} ${w8e(e)}`}function w8e(t){return`${t.op} ${t.rhs}`}var Gk=x8e("$pvc","v"),E8e=({update:t,criteria:e,commands:n,onLogMessage:r})=>{var o,i;if(e.type!=="PVC")return{result:!1,changed:!1};let a=!!(t.state.url&&(!t.previousState||((o=t.state.url)==null?void 0:o.toString())!==((i=t.previousState.url)==null?void 0:i.toString()))),c=(t.visitor.sessionScores[Gk]||0)+1,d={result:!1,changed:a},f=n.some(m=>m.type==="modscoreS"&&m.data.dimension===Gk);return a&&!f&&n.push({type:"modscoreS",data:{dimension:Gk,delta:1}}),C8e(c,e.match)&&(d.result=!0),r?.(["debug",203,{criteria:e,result:d,explanation:S8e(c,e.match)}]),d};E8e.alwaysExecute=!0;var T8e;T8e=new WeakMap;var Cne="ssc";var _8e,D8e,$8e;_8e=new WeakMap;D8e=new WeakMap;$8e=new WeakMap;var Yk="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",nut=Yk.split(""),N8e=new Array(123);for(let t=0;t<Yk.length;t++)N8e[Yk.charCodeAt(t)]=t;var L8e,O8e,M8e,R8e;L8e=new WeakMap;O8e=new WeakMap;M8e=new WeakMap;R8e=new WeakMap;var A8e,k8e;A8e=new WeakSet;k8e=async function(){let t=await new Promise(e=>{setTimeout(()=>{e(void 0)},2e3)});t&&this.signalAsyncDataUpdate(t)};var P8e=()=>({quirks:{},scores:{},sessionScores:{},tests:{},goals:{},consent:!1,controlGroup:!1,personalizeVariants:{}}),iut=(0,Sne.default)();var I8e,F8e;I8e=new WeakSet;F8e=function(t){return this.partitionKey?`${this.partitionKey}.${t}`:t};var wne="ufvisitor",Rg,Xk,l6,gl,_S,Ene,B8e,Tne,z8e,Zk,V8e;Rg=new WeakMap;Xk=new WeakMap;l6=new WeakMap;gl=new WeakMap;_S=new WeakSet;Ene=function(){return lr(this,Xk).get(wne)};B8e=function(t,e=!1){var n,r,o,i,a,l,c,d,f,m,h;let g=lr(this,_S,Ene),y=Date.now();DS(this,_S,Zk).call(this,t.scores),DS(this,_S,Zk).call(this,t.sessionScores),(r=(n=lr(this,gl)).decay)==null||r.call(n,{now:y,lastUpd:g?.updated,scores:t.scores,sessionScores:t.sessionScores,onLogMessage:lr(this,gl).onLogMessage});let b=!ba(g?.visitorData.scores,t.scores),C=!ba(g?.visitorData.sessionScores,t.sessionScores),S=!ba(g?.visitorData.quirks,t.quirks),w=!ba(g?.visitorData.tests,t.tests),E=!ba(g?.visitorData.goals,t.goals),_={updated:y,visitorData:t};if(DS(this,_S,Tne).call(this),lr(this,Xk).set(wne,_,!!t.consent),(i=(o=lr(this,gl)).onLogMessage)==null||i.call(o,["debug",102,t]),!e&&((b||C)&&lr(this,Rg).emit("scoresUpdated",t),S&&lr(this,Rg).emit("quirksUpdated",t),w&&lr(this,Rg).emit("testsUpdated",t),((a=g?.visitorData)==null?void 0:a.consent)!==t.consent&&lr(this,Rg).emit("consentUpdated",t),((l=g?.visitorData)==null?void 0:l.controlGroup)!==t.controlGroup&&(lr(this,Rg).emit("controlGroupUpdated",t),(f=(d=lr(this,gl)).onLogMessage)==null||f.call(d,["debug",104,(c=t.controlGroup)!=null?c:!1])),E)){let N=Object.keys((m=t.goals)!=null?m:{});for(let $=0;$<N.length;$++){let M=N[$];(h=g?.visitorData.goals)!=null&&h[M]||lr(this,Rg).emit("goalConverted",{goalId:M})}}};Tne=function(){typeof document>"u"||!lr(this,gl).visitLifespan||(lr(this,l6)&&window.clearTimeout(lr(this,l6)),xne(this,l6,window.setTimeout(()=>{this.data},lr(this,gl).visitLifespan+50)))};z8e=function(t){let e=lr(this,gl).visitLifespan;return e?t.updated+e<Date.now():!1};Zk=function(t){var e,n;if(lr(this,gl).manifest)for(let r in t){let o=t[r],i=lr(this,gl).manifest.getDimensionByKey(r);i&&o>i.cap&&((n=(e=lr(this,gl)).onLogMessage)==null||n.call(e,["debug",110,{dim:r,score:o,cap:i.cap}]),t[r]=i.cap)}};V8e=function(){var t,e,n;return{...P8e(),consent:(t=lr(this,gl).defaultConsent)!=null?t:!1,controlGroup:(n=(e=lr(this,gl).manifest)==null?void 0:e.rollForControlGroup())!=null?n:!1}};var U8e,H8e,u6,j8e,W8e,K8e,G8e,Y8e,c6,qk,Z8e,_ne,q8e,Dne;U8e=new WeakMap;H8e=new WeakMap;u6=new WeakMap;j8e=new WeakMap;W8e=new WeakMap;K8e=new WeakMap;G8e=new WeakMap;Y8e=new WeakMap;c6=new WeakMap;qk=new WeakSet;Z8e=function(t){lr(this,c6).emit("testResult",t)};_ne=async function(t){let e=this.manifest.computeGoals(t);e.length!==0&&await this.storage.updateData(e)};q8e=function(t){let e=DS(this,qk,Dne).call(this,t);!ba(e,lr(this,u6))&&(xne(this,u6,e),DS(this,qk,_ne).call(this,{scores:lr(this,u6),quirks:void 0}),lr(this,c6).emit("scoresUpdated",e),lr(this,c6).emit("log",["info",3,e]))};Dne=function(t){var e;let n={...t.scores};for(let r in t.sessionScores)n[r]=((e=n[r])!=null?e:0)+t.sessionScores[r];return n=this.manifest.computeAggregateDimensions(n),n};var lut=(0,$ne.default)();var uut=(0,Nne.default)();await j1();var EIe=await(process.env.NODE_ENV!=="production"?lue().then(()=>sue):cue().then(()=>uue)),due=EIe.createHeadlessEditor;await PD();await jB();await KD();await rpe();var Xm=J(wo());ume();var Ngt=J(ae());Nb();var Ogt=J(lV());i3();var Rgt=J(eV());Ob();Mb();G$();var Ys=Xm.Fragment;function K(t,e,n){return c3.call(e,"css")?Xm.jsx(aV,iV(t,e),n):Xm.jsx(t,e,n)}function Oe(t,e,n){return c3.call(e,"css")?Xm.jsxs(aV,iV(t,e),n):Xm.jsxs(t,e,n)}Ee();Ee();Ee();Ee();Ee();function pme(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];t&&t.addEventListener&&t.addEventListener.apply(t,e)}function mme(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];t&&t.removeEventListener&&t.removeEventListener.apply(t,e)}var hme=typeof window<"u";var gme=J(ae());var uc=J(ae());function cV(t,e){e===void 0&&(e=0);var n=(0,uc.useRef)(!1),r=(0,uc.useRef)(),o=(0,uc.useRef)(t),i=(0,uc.useCallback)(function(){return n.current},[]),a=(0,uc.useCallback)(function(){n.current=!1,r.current&&clearTimeout(r.current),r.current=setTimeout(function(){n.current=!0,o.current()},e)},[e]),l=(0,uc.useCallback)(function(){n.current=null,r.current&&clearTimeout(r.current)},[]);return(0,uc.useEffect)(function(){o.current=t},[t]),(0,uc.useEffect)(function(){return a(),l},[e]),[i,l,a]}function X$(t,e,n){e===void 0&&(e=0),n===void 0&&(n=[]);var r=cV(t,e),o=r[0],i=r[1],a=r[2];return(0,gme.useEffect)(a,n),[o,i]}var Rb=J(ae());var fUe=function(t){return t===void 0&&(t={laptopL:1440,laptop:1024,tablet:768}),function(){var e=(0,Rb.useState)(hme?window.innerWidth:0),n=e[0],r=e[1];(0,Rb.useEffect)(function(){var a=function(){r(window.innerWidth)};return a(),pme(window,"resize",a),function(){mme(window,"resize",a)}});var o=(0,Rb.useMemo)(function(){return Object.entries(t).sort(function(a,l){return a[1]>=l[1]?1:-1})},[t]),i=o.reduce(function(a,l){var c=l[0],d=l[1];return n>=d?c:a},o[0][0]);return i}},dV=fUe;Ee();Ee();Ee();var bQe=J(ae());Ee();Ee();var pUe=Object.defineProperty,mUe=Object.defineProperties,hUe=Object.getOwnPropertyDescriptors,Q$=Object.getOwnPropertySymbols,yme=Object.prototype.hasOwnProperty,bme=Object.prototype.propertyIsEnumerable,vme=(t,e,n)=>e in t?pUe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,me=(t,e)=>{for(var n in e||(e={}))yme.call(e,n)&&vme(t,n,e[n]);if(Q$)for(var n of Q$(e))bme.call(e,n)&&vme(t,n,e[n]);return t},Ne=(t,e)=>mUe(t,hUe(e)),ut=(t,e)=>{var n={};for(var r in t)yme.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&Q$)for(var r of Q$(t))e.indexOf(r)<0&&bme.call(t,r)&&(n[r]=t[r]);return n};var gUe=Object.defineProperty,vUe=Object.defineProperties,yUe=Object.getOwnPropertyDescriptors,e9=Object.getOwnPropertySymbols,Cme=Object.prototype.hasOwnProperty,Sme=Object.prototype.propertyIsEnumerable,xme=(t,e,n)=>e in t?gUe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Jt=(t,e)=>{for(var n in e||(e={}))Cme.call(e,n)&&xme(t,n,e[n]);if(e9)for(var n of e9(e))Sme.call(e,n)&&xme(t,n,e[n]);return t},ir=(t,e)=>vUe(t,yUe(e)),t9=(t,e)=>{var n={};for(var r in t)Cme.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&e9)for(var r of e9(t))e.indexOf(r)<0&&Sme.call(t,r)&&(n[r]=t[r]);return n};function yv(...t){}function d3(t,e){if(bUe(t)){let n=xUe(e)?e():e;return t(n)}return t}function bUe(t){return typeof t=="function"}function xUe(t){return typeof t=="function"}function fs(t,e){return typeof Object.hasOwn=="function"?Object.hasOwn(t,e):Object.prototype.hasOwnProperty.call(t,e)}function Hr(...t){return(...e)=>{for(let n of t)typeof n=="function"&&n(...e)}}function fV(t){return t.normalize("NFD").replace(/[\u0300-\u036f]/g,"")}function pV(t,e){let n=Jt({},t);for(let r of e)fs(n,r)&&delete n[r];return n}function mV(t,e){let n={};for(let r of e)fs(t,r)&&(n[r]=t[r]);return n}function f3(t){return t}function tn(t,e){if(!t)throw typeof e!="string"?new Error("Invariant failed"):new Error(e)}function hV(t){return Object.keys(t)}function Sd(t,...e){let n=typeof t=="function"?t(...e):t;return n==null?!1:!n}function cc(t){return t.disabled||t["aria-disabled"]===!0||t["aria-disabled"]==="true"}function ps(t){let e={};for(let n in t)t[n]!==void 0&&(e[n]=t[n]);return e}function Zt(...t){for(let e of t)if(e!==void 0)return e}var wme=J(ae(),1);function p3(t,e){typeof t=="function"?t(e):t&&(t.current=e)}function CUe(t){return!t||!(0,wme.isValidElement)(t)?!1:"ref"in t.props||"ref"in t}function Eme(t){return CUe(t)?me({},t.props).ref||t.ref:null}function Tme(t,e){let n=me({},t);for(let r in e){if(!fs(e,r))continue;if(r==="className"){let i="className";n[i]=t[i]?`${t[i]} ${e[i]}`:e[i];continue}if(r==="style"){let i="style";n[i]=t[i]?me(me({},t[i]),e[i]):e[i];continue}let o=e[r];if(typeof o=="function"&&r.startsWith("on")){let i=t[r];if(typeof i=="function"){n[r]=(...a)=>{o(...a),i(...a)};continue}}n[r]=o}return n}var Vf=SUe();function SUe(){var t;return typeof window<"u"&&!!((t=window.document)!=null&&t.createElement)}function xn(t){return t?"self"in t?t.document:t.ownerDocument||document:document}function bv(t){return t?"self"in t?t.self:xn(t).defaultView||window:self}function yl(t,e=!1){let{activeElement:n}=xn(t);if(!n?.nodeName)return null;if(m3(n)&&n.contentDocument)return yl(n.contentDocument.body,e);if(e){let r=n.getAttribute("aria-activedescendant");if(r){let o=xn(n).getElementById(r);if(o)return o}}return n}function Bn(t,e){return t===e||t.contains(e)}function m3(t){return t.tagName==="IFRAME"}function Zs(t){let e=t.tagName.toLowerCase();return e==="button"?!0:e==="input"&&t.type?wUe.indexOf(t.type)!==-1:!1}var wUe=["button","color","file","image","reset","submit"];function h3(t){if(typeof t.checkVisibility=="function")return t.checkVisibility();let e=t;return e.offsetWidth>0||e.offsetHeight>0||t.getClientRects().length>0}function ms(t){try{let e=t instanceof HTMLInputElement&&t.selectionStart!==null,n=t.tagName==="TEXTAREA";return e||n||!1}catch{return!1}}function g3(t){return t.isContentEditable||ms(t)}function gV(t){if(ms(t))return t.value;if(t.isContentEditable){let e=xn(t).createRange();return e.selectNodeContents(t),e.toString()}return""}function vV(t){let e=0,n=0;if(ms(t))e=t.selectionStart||0,n=t.selectionEnd||0;else if(t.isContentEditable){let r=xn(t).getSelection();if(r?.rangeCount&&r.anchorNode&&Bn(t,r.anchorNode)&&r.focusNode&&Bn(t,r.focusNode)){let o=r.getRangeAt(0),i=o.cloneRange();i.selectNodeContents(t),i.setEnd(o.startContainer,o.startOffset),e=i.toString().length,i.setEnd(o.endContainer,o.endOffset),n=i.toString().length}}return{start:e,end:n}}function Ab(t,e){let n=["dialog","menu","listbox","tree","grid"],r=t?.getAttribute("role");return r&&n.indexOf(r)!==-1?r:e}function v3(t,e){var n;let r={menu:"menuitem",listbox:"option",tree:"treeitem"},o=Ab(t);return o&&(n=r[o])!=null?n:e}function n9(t){if(!t)return null;let e=n=>n==="auto"||n==="scroll";if(t.clientHeight&&t.scrollHeight>t.clientHeight){let{overflowY:n}=getComputedStyle(t);if(e(n))return t}else if(t.clientWidth&&t.scrollWidth>t.clientWidth){let{overflowX:n}=getComputedStyle(t);if(e(n))return t}return n9(t.parentElement)||document.scrollingElement||document.body}function y3(t,e){let n=t.map((o,i)=>[i,o]),r=!1;return n.sort(([o,i],[a,l])=>{let c=e(i),d=e(l);return c===d||!c||!d?0:EUe(c,d)?(o>a&&(r=!0),-1):(o<a&&(r=!0),1)}),r?n.map(([o,i])=>i):t}function EUe(t,e){return!!(e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_PRECEDING)}function _me(){return Vf&&!!navigator.maxTouchPoints}function kb(){return Vf?/mac|iphone|ipad|ipod/i.test(navigator.platform):!1}function xv(){return Vf&&kb()&&/apple/i.test(navigator.vendor)}function yV(){return Vf&&/firefox\//i.test(navigator.userAgent)}function bV(){return Vf&&navigator.platform.startsWith("Mac")&&!_me()}function r9(t){return!!(t.currentTarget&&!Bn(t.currentTarget,t.target))}function Ri(t){return t.target===t.currentTarget}function Dme(t){let e=t.currentTarget;if(!e)return!1;let n=kb();if(n&&!t.metaKey||!n&&!t.ctrlKey)return!1;let r=e.tagName.toLowerCase();return r==="a"||r==="button"&&e.type==="submit"||r==="input"&&e.type==="submit"}function $me(t){let e=t.currentTarget;if(!e)return!1;let n=e.tagName.toLowerCase();return t.altKey?n==="a"||n==="button"&&e.type==="submit"||n==="input"&&e.type==="submit":!1}function Nme(t,e,n){let r=new Event(e,n);return t.dispatchEvent(r)}function Cv(t,e){let n=new FocusEvent("blur",e),r=t.dispatchEvent(n),o=ir(Jt({},e),{bubbles:!0});return t.dispatchEvent(new FocusEvent("focusout",o)),r}function Lme(t,e,n){let r=new KeyboardEvent(e,n);return t.dispatchEvent(r)}function xV(t,e){let n=new MouseEvent("click",e);return t.dispatchEvent(n)}function Qm(t,e){let n=e||t.currentTarget,r=t.relatedTarget;return!r||!Bn(n,r)}function eh(t,e,n,r){let i=(l=>{if(r){let d=setTimeout(l,r);return()=>clearTimeout(d)}let c=requestAnimationFrame(l);return()=>cancelAnimationFrame(c)})(()=>{t.removeEventListener(e,a,!0),n()}),a=()=>{i(),n()};return t.addEventListener(e,a,{once:!0,capture:!0}),i}function ro(t,e,n,r=window){let o=[];try{r.document.addEventListener(t,e,n);for(let a of Array.from(r.frames))o.push(ro(t,e,n,a))}catch{}return()=>{try{r.document.removeEventListener(t,e,n)}catch{}for(let a of o)a()}}var oo=J(ae(),1),TUe=J(ae(),1),CV=me({},TUe),Ome=CV.useId,Tvt=CV.useDeferredValue,Mme=CV.useInsertionEffect,cn=Vf?oo.useLayoutEffect:oo.useEffect;function i9(t){let e=(0,oo.useRef)(t);return cn(()=>{e.current=t}),e}function vt(t){let e=(0,oo.useRef)(()=>{throw new Error("Cannot call an event handler while rendering.")});return Mme?Mme(()=>{e.current=t}):e.current=t,(0,oo.useCallback)((...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)},[])}function kme(t){let[e,n]=(0,oo.useState)(null);return cn(()=>{if(e==null||!t)return;let r=null;return t(o=>(r=o,e)),()=>{t(r)}},[e,t]),[e,n]}function sn(...t){return(0,oo.useMemo)(()=>{if(t.some(Boolean))return e=>{for(let n of t)p3(n,e)}},t)}function du(t){if(Ome){let r=Ome();return t||r}let[e,n]=(0,oo.useState)(t);return cn(()=>{if(t||e)return;let r=Math.random().toString(36).slice(2,8);n(`id-${r}`)},[t,e]),t||e}function a9(t,e){let n=i=>{if(typeof i=="string")return i},[r,o]=(0,oo.useState)(()=>n(e));return cn(()=>{let i=t&&"current"in t?t.current:t;o(i?.tagName.toLowerCase()||n(e))},[t,e]),r}function th(t,e){let n=(0,oo.useRef)(!1);(0,oo.useEffect)(()=>{if(n.current)return t();n.current=!0},e),(0,oo.useEffect)(()=>()=>{n.current=!1},[])}function Pme(){return(0,oo.useReducer)(()=>[],[])}function Oo(t){return vt(typeof t=="function"?t:()=>t)}function fr(t,e,n=[]){let r=(0,oo.useCallback)(o=>(t.wrapElement&&(o=t.wrapElement(o)),e(o)),[...n,t.wrapElement]);return Ne(me({},t),{wrapElement:r})}function Pb(t=!1,e){let[n,r]=(0,oo.useState)(null);return{portalRef:sn(r,e),portalNode:n,domReady:!t||n}}function s9(t,e,n){let r=t.onLoadedMetadataCapture,o=(0,oo.useMemo)(()=>Object.assign(()=>{},Ne(me({},r),{[e]:n})),[r,e,n]);return[r?.[e],{onLoadedMetadataCapture:o}]}function Ib(){return(0,oo.useEffect)(()=>{ro("mousemove",DUe,!0),ro("mousedown",o9,!0),ro("mouseup",o9,!0),ro("keydown",o9,!0),ro("scroll",o9,!0)},[]),vt(()=>SV)}var SV=!1,Rme=0,Ame=0;function _Ue(t){let e=t.movementX||t.screenX-Rme,n=t.movementY||t.screenY-Ame;return Rme=t.screenX,Ame=t.screenY,e||n||process.env.NODE_ENV==="test"}function DUe(t){_Ue(t)&&(SV=!0)}function o9(){SV=!1}var hs=J(ae(),1),Sv=J(wo(),1);function st(t){let e=hs.forwardRef((n,r)=>t(Ne(me({},n),{ref:r})));return e.displayName=t.displayName||t.name,e}function Fb(t,e){return hs.memo(t,e)}function ct(t,e){let n=e,{wrapElement:r,render:o}=n,i=ut(n,["wrapElement","render"]),a=sn(e.ref,Eme(o)),l;if(hs.isValidElement(o)){let c=Ne(me({},o.props),{ref:a});l=hs.cloneElement(o,Tme(i,c))}else o?l=o(i):l=(0,Sv.jsx)(t,me({},i));return r?r(l):l}function ft(t){let e=(n={})=>t(n);return e.displayName=t.name,e}function Ho(t=[],e=[]){let n=hs.createContext(void 0),r=hs.createContext(void 0),o=()=>hs.useContext(n),i=(d=!1)=>{let f=hs.useContext(r),m=o();return d?f:f||m},a=()=>{let d=hs.useContext(r),f=o();if(!(d&&d===f))return f},l=d=>t.reduceRight((f,m)=>(0,Sv.jsx)(m,Ne(me({},d),{children:f})),(0,Sv.jsx)(n.Provider,me({},d)));return{context:n,scopedContext:r,useContext:o,useScopedContext:i,useProviderContext:a,ContextProvider:l,ScopedContextProvider:d=>(0,Sv.jsx)(l,Ne(me({},d),{children:e.reduceRight((f,m)=>(0,Sv.jsx)(m,Ne(me({},d),{children:f})),(0,Sv.jsx)(r.Provider,me({},d)))}))}}var b3=Ho(),Ime=b3.useContext,Mvt=b3.useScopedContext,Rvt=b3.useProviderContext,Fme=b3.ContextProvider,Bme=b3.ScopedContextProvider;var wV=J(ae(),1),x3=Ho([Fme],[Bme]),Bb=x3.useContext,Ivt=x3.useScopedContext,zme=x3.useProviderContext,nh=x3.ContextProvider,zb=x3.ScopedContextProvider,Vme=(0,wV.createContext)(void 0),Ume=(0,wV.createContext)(void 0);function wv(t,e){let n=t.__unstableInternals;return tn(n,"Invalid store"),n[e]}function Mo(t,...e){let n=t,r=n,o=Symbol(),i=yv,a=new Set,l=new Set,c=new Set,d=new Set,f=new Set,m=new WeakMap,h=new WeakMap,g=O=>(c.add(O),()=>c.delete(O)),y=()=>{let O=a.size,A=Symbol();a.add(A);let k=()=>{a.delete(A),!a.size&&i()};if(O)return k;let F=hV(n).map(U=>Hr(...e.map(H=>{var Y;let W=(Y=H?.getState)==null?void 0:Y.call(H);if(W&&fs(W,U))return di(H,[U],Z=>{$(U,Z[U],!0)})}))),j=[];for(let U of c)j.push(U());let B=e.map(Vb);return i=Hr(...F,...j,...B),k},b=(O,A,k=d)=>(k.add(A),h.set(A,O),()=>{var F;(F=m.get(A))==null||F(),m.delete(A),h.delete(A),k.delete(A)}),C=(O,A)=>b(O,A),S=(O,A)=>(m.set(A,A(n,n)),b(O,A)),w=(O,A)=>(m.set(A,A(n,r)),b(O,A,f)),E=O=>Mo(mV(n,O),M),_=O=>Mo(pV(n,O),M),N=()=>n,$=(O,A,k=!1)=>{var F;if(!fs(n,O))return;let j=d3(A,n[O]);if(j===n[O])return;if(!k)for(let Y of e)(F=Y?.setState)==null||F.call(Y,O,j);let B=n;n=ir(Jt({},n),{[O]:j});let U=Symbol();o=U,l.add(O);let H=(Y,W,Z)=>{var X;let se=h.get(Y),de=ye=>Z?Z.has(ye):ye===O;(!se||se.some(de))&&((X=m.get(Y))==null||X(),m.set(Y,Y(n,W)))};for(let Y of d)H(Y,B);queueMicrotask(()=>{if(o!==U)return;let Y=n;for(let W of f)H(W,r,l);r=Y,l.clear()})},M={getState:N,setState:$,__unstableInternals:{setup:g,init:y,subscribe:C,sync:S,batch:w,pick:E,omit:_}};return M}function qs(t,...e){if(t)return wv(t,"setup")(...e)}function Vb(t,...e){if(t)return wv(t,"init")(...e)}function Ub(t,...e){if(t)return wv(t,"subscribe")(...e)}function di(t,...e){if(t)return wv(t,"sync")(...e)}function Hb(t,...e){if(t)return wv(t,"batch")(...e)}function Ev(t,...e){if(t)return wv(t,"omit")(...e)}function EV(t,...e){if(t)return wv(t,"pick")(...e)}function Tv(...t){let e=t.reduce((r,o)=>{var i;let a=(i=o?.getState)==null?void 0:i.call(o);return a?Object.assign(r,a):r},{}),n=Mo(e,...t);return Object.assign({},...t,n)}function Uf(t,e){if(process.env.NODE_ENV==="production"||!e)return;let n=Object.entries(t).filter(([i,a])=>i.startsWith("default")&&a!==void 0).map(([i])=>{var a;let l=i.replace("default","");return`${((a=l[0])==null?void 0:a.toLowerCase())||""}${l.slice(1)}`});if(!n.length)return;let r=e.getState();if(n.filter(i=>fs(r,i)).length)throw new Error(`Passing a store prop in conjunction with a default state is not supported.
|
|
236
|
+
See https://reactjs.org/docs/forms.html#controlled-components`),X=W.initialPage?W.initialPage:W.forcePage?W.forcePage:0,Z.state={selected:X},Z}return F=Y,(j=[{key:"componentDidMount",value:function(){var W=this.props,Z=W.initialPage,X=W.disableInitialCallback,se=W.extraAriaContext,de=W.pageCount,ye=W.forcePage;Z===void 0||X||this.callCallback(Z),se&&console.warn("DEPRECATED (react-paginate): The extraAriaContext prop is deprecated. You should now use the ariaLabelBuilder instead."),Number.isInteger(de)||console.warn("(react-paginate): The pageCount prop value provided is not an integer (".concat(de,"). Did you forget a Math.ceil()?")),Z!==void 0&&Z>de-1&&console.warn("(react-paginate): The initialPage prop provided is greater than the maximum page index from pageCount prop (".concat(Z," > ").concat(de-1,").")),ye!==void 0&&ye>de-1&&console.warn("(react-paginate): The forcePage prop provided is greater than the maximum page index from pageCount prop (".concat(ye," > ").concat(de-1,")."))}},{key:"componentDidUpdate",value:function(W){this.props.forcePage!==void 0&&this.props.forcePage!==W.forcePage&&(this.props.forcePage>this.props.pageCount-1&&console.warn("(react-paginate): The forcePage prop provided is greater than the maximum page index from pageCount prop (".concat(this.props.forcePage," > ").concat(this.props.pageCount-1,").")),this.setState({selected:this.props.forcePage})),Number.isInteger(W.pageCount)&&!Number.isInteger(this.props.pageCount)&&console.warn("(react-paginate): The pageCount prop value provided is not an integer (".concat(this.props.pageCount,"). Did you forget a Math.ceil()?"))}},{key:"getForwardJump",value:function(){var W=this.state.selected,Z=this.props,X=Z.pageCount,se=W+Z.pageRangeDisplayed;return se>=X?X-1:se}},{key:"getBackwardJump",value:function(){var W=this.state.selected-this.props.pageRangeDisplayed;return W<0?0:W}},{key:"getElementHref",value:function(W){var Z=this.props,X=Z.hrefBuilder,se=Z.pageCount,de=Z.hrefAllControls;if(X)return de||W>=0&&W<se?X(W+1,se,this.state.selected):void 0}},{key:"ariaLabelBuilder",value:function(W){var Z=W===this.state.selected;if(this.props.ariaLabelBuilder&&W>=0&&W<this.props.pageCount){var X=this.props.ariaLabelBuilder(W+1,Z);return this.props.extraAriaContext&&!Z&&(X=X+" "+this.props.extraAriaContext),X}}},{key:"getPageElement",value:function(W){var Z=this.state.selected,X=this.props,se=X.pageClassName,de=X.pageLinkClassName,ye=X.activeClassName,Fe=X.activeLinkClassName,Ge=X.extraAriaContext,lt=X.pageLabelBuilder;return a().createElement(m,{key:W,pageSelectedHandler:this.handlePageSelected.bind(null,W),selected:Z===W,rel:this.getElementPageRel(W),pageClassName:se,pageLinkClassName:de,activeClassName:ye,activeLinkClassName:Fe,extraAriaContext:Ge,href:this.getElementHref(W),ariaLabel:this.ariaLabelBuilder(W),page:W+1,pageLabelBuilder:lt,getEventListener:this.getEventListener})}},{key:"render",value:function(){var W=this.props.renderOnZeroPageCount;if(this.props.pageCount===0&&W!==void 0)return W&&W(this.props);var Z=this.props,X=Z.disabledClassName,se=Z.disabledLinkClassName,de=Z.pageCount,ye=Z.className,Fe=Z.containerClassName,Ge=Z.previousLabel,lt=Z.previousClassName,xt=Z.previousLinkClassName,we=Z.previousAriaLabel,Pe=Z.prevRel,Je=Z.nextLabel,yt=Z.nextClassName,rn=Z.nextLinkClassName,$e=Z.nextAriaLabel,Ct=Z.nextRel,Kt=this.state.selected,Ut=Kt===0,Ht=Kt===de-1,Xn="".concat(b(lt)).concat(Ut?" ".concat(b(X)):""),ke="".concat(b(yt)).concat(Ht?" ".concat(b(X)):""),bt="".concat(b(xt)).concat(Ut?" ".concat(b(se)):""),Sn="".concat(b(rn)).concat(Ht?" ".concat(b(se)):""),Gt=Ut?"true":"false",sr=Ht?"true":"false";return a().createElement("ul",{className:ye||Fe,role:"navigation","aria-label":"Pagination"},a().createElement("li",{className:Xn},a().createElement("a",S({className:bt,href:this.getElementHref(Kt-1),tabIndex:Ut?"-1":"0",role:"button",onKeyPress:this.handlePreviousPage,"aria-disabled":Gt,"aria-label":we,rel:Pe},this.getEventListener(this.handlePreviousPage)),Ge)),this.pagination(),a().createElement("li",{className:ke},a().createElement("a",S({className:Sn,href:this.getElementHref(Kt+1),tabIndex:Ht?"-1":"0",role:"button",onKeyPress:this.handleNextPage,"aria-disabled":sr,"aria-label":$e,rel:Ct},this.getEventListener(this.handleNextPage)),Je)))}}])&&w(F.prototype,j),Object.defineProperty(F,"prototype",{writable:!1}),Y}(i.Component);M(O,"propTypes",{pageCount:c().number.isRequired,pageRangeDisplayed:c().number,marginPagesDisplayed:c().number,previousLabel:c().node,previousAriaLabel:c().string,prevPageRel:c().string,prevRel:c().string,nextLabel:c().node,nextAriaLabel:c().string,nextPageRel:c().string,nextRel:c().string,breakLabel:c().oneOfType([c().string,c().node]),breakAriaLabels:c().shape({forward:c().string,backward:c().string}),hrefBuilder:c().func,hrefAllControls:c().bool,onPageChange:c().func,onPageActive:c().func,onClick:c().func,initialPage:c().number,forcePage:c().number,disableInitialCallback:c().bool,containerClassName:c().string,className:c().string,pageClassName:c().string,pageLinkClassName:c().string,pageLabelBuilder:c().func,activeClassName:c().string,activeLinkClassName:c().string,previousClassName:c().string,nextClassName:c().string,previousLinkClassName:c().string,nextLinkClassName:c().string,disabledClassName:c().string,disabledLinkClassName:c().string,breakClassName:c().string,breakLinkClassName:c().string,extraAriaContext:c().string,ariaLabelBuilder:c().func,eventListener:c().string,renderOnZeroPageCount:c().func,selectedPageRel:c().string}),M(O,"defaultProps",{pageRangeDisplayed:2,marginPagesDisplayed:3,activeClassName:"selected",previousLabel:"Previous",previousClassName:"previous",previousAriaLabel:"Previous page",prevPageRel:"prev",prevRel:"prev",nextLabel:"Next",nextClassName:"next",nextAriaLabel:"Next page",nextPageRel:"next",nextRel:"next",breakLabel:"...",breakAriaLabels:{forward:"Jump forward",backward:"Jump backward"},disabledClassName:"disabled",disableInitialCallback:!1,pageLabelBuilder:function(k){return k},eventListener:"onClick",renderOnZeroPageCount:void 0,selectedPageRel:"canonical",hrefAllControls:!1});let A=O})(),o})())});var L4e=rt((fUt,N4e)=>{"use strict";var Tot=Object.prototype.hasOwnProperty,_ot=Object.prototype.toString;N4e.exports=function(e,n,r){if(_ot.call(n)!=="[object Function]")throw new TypeError("iterator must be a function");var o=e.length;if(o===+o)for(var i=0;i<o;i++)n.call(r,e[i],i,e);else for(var a in e)Tot.call(e,a)&&n.call(r,e[a],a,e)}});var zZ=rt((pUt,O4e)=>{"use strict";var Dot=L4e();O4e.exports=wr;function wr(t,e,n){if(arguments.length===3)return wr.set(t,e,n);if(arguments.length===2)return wr.get(t,e);var r=wr.bind(wr,t);for(var o in wr)wr.hasOwnProperty(o)&&(r[o]=wr[o].bind(r,t));return r}wr.get=function(e,n){for(var r=Array.isArray(n)?n:wr.parse(n),o=0;o<r.length;++o){var i=r[o];if(!(typeof e=="object"&&i in e))throw new Error("Invalid reference token: "+i);e=e[i]}return e};wr.set=function(e,n,r){var o=Array.isArray(n)?n:wr.parse(n),i=o[0];if(o.length===0)throw Error("Can not set the root object");for(var a=0;a<o.length-1;++a){var l=o[a];typeof l!="string"&&typeof l!="number"&&(l=String(l)),!(l==="__proto__"||l==="constructor"||l==="prototype")&&(l==="-"&&Array.isArray(e)&&(l=e.length),i=o[a+1],l in e||(i.match(/^(\d+|-)$/)?e[l]=[]:e[l]={}),e=e[l])}return i==="-"&&Array.isArray(e)&&(i=e.length),e[i]=r,this};wr.remove=function(t,e){var n=Array.isArray(e)?e:wr.parse(e),r=n[n.length-1];if(r===void 0)throw new Error('Invalid JSON pointer for remove: "'+e+'"');var o=wr.get(t,n.slice(0,-1));if(Array.isArray(o)){var i=+r;if(r===""&&isNaN(i))throw new Error('Invalid array index: "'+r+'"');Array.prototype.splice.call(o,i,1)}else delete o[r]};wr.dict=function(e,n){var r={};return wr.walk(e,function(o,i){r[i]=o},n),r};wr.walk=function(e,n,r){var o=[];r=r||function(i){var a=Object.prototype.toString.call(i);return a==="[object Object]"||a==="[object Array]"},function i(a){Dot(a,function(l,c){o.push(String(c)),r(l)?i(l):n(l,wr.compile(o)),o.pop()})}(e)};wr.has=function(e,n){try{wr.get(e,n)}catch{return!1}return!0};wr.escape=function(e){return e.toString().replace(/~/g,"~0").replace(/\//g,"~1")};wr.unescape=function(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")};wr.parse=function(e){if(e==="")return[];if(e.charAt(0)!=="/")throw new Error("Invalid JSON pointer: "+e);return e.substring(1).split(/\//).map(wr.unescape)};wr.compile=function(e){return e.length===0?"":"/"+e.map(wr.escape).join("/")}});var R4e=rt((mUt,M4e)=>{"use strict";var VZ=class{constructor(e){this.value=e,this.next=void 0}},UZ=class{constructor(){this.clear()}enqueue(e){let n=new VZ(e);this._head?(this._tail.next=n,this._tail=n):(this._head=n,this._tail=n),this._size++}dequeue(){let e=this._head;if(e)return this._head=this._head.next,this._size--,e.value}clear(){this._head=void 0,this._tail=void 0,this._size=0}get size(){return this._size}*[Symbol.iterator](){let e=this._head;for(;e;)yield e.value,e=e.next}};M4e.exports=UZ});var k4e=rt((hUt,A4e)=>{"use strict";var $ot=R4e(),Not=t=>{if(!((Number.isInteger(t)||t===1/0)&&t>0))throw new TypeError("Expected `concurrency` to be a number from 1 and up");let e=new $ot,n=0,r=()=>{n--,e.size>0&&e.dequeue()()},o=async(l,c,...d)=>{n++;let f=(async()=>l(...d))();c(f);try{await f}catch{}r()},i=(l,c,...d)=>{e.enqueue(o.bind(null,l,c,...d)),(async()=>(await Promise.resolve(),n<t&&e.size>0&&e.dequeue()()))()},a=(l,...c)=>new Promise(d=>{i(l,d,...c)});return Object.defineProperties(a,{activeCount:{get:()=>n},pendingCount:{get:()=>e.size},clearQueue:{value:()=>{e.clear()}}}),a};A4e.exports=Not});import{McpServer as fst}from"@modelcontextprotocol/sdk/server/mcp.js";import{StdioServerTransport as pst}from"@modelcontextprotocol/sdk/server/stdio.js";import{CanvasClient as GNe}from"@uniformdev/canvas";import{z as one}from"zod";var Qte=process.env.UNIFORM_API_KEY,Bk=process.env.UNIFORM_PROJECT_ID,Xte=process.env.UNIFORM_API_HOST??"https://uniform.app",NNe=process.env.UNIFORM_AI_API_HOST??"https://ai.uniform.global";if(!Qte&&process.env.NODE_ENV!=="test")throw new Error("UNIFORM_API_KEY is not set");if(!Bk&&process.env.NODE_ENV!=="test")throw new Error("UNIFORM_PROJECT_ID is not set");var pt={apiHost:Xte,apiKey:Qte,projectId:Bk,aiApiHost:NNe,baseWebUrl:`${Xte}/projects/${Bk}`};import LNe from"fast-json-patch";function Z_(t,e){return LNe.applyPatch(t,e).newDocument}import{z as CS}from"zod";var q_=CS.array(CS.object({op:CS.enum(["add","remove","replace"]),path:CS.string().describe("The JSON path to patch"),value:CS.unknown().describe("The value to patch - for remove, leave this blank")}));function ONe(t){return Array.isArray(t)&&t.length>0}function ene(t){return!!t&&typeof t=="object"&&"type"in t}function tne(t){return typeof t=="object"&&t!==null&&"root"in t&&ene(t.root)}function Mg(t){return"children"in t&&ONe(t.children)}var MNe=({context:t,renderChildren:e})=>Mg(t.currentNode)?`${e(t.currentNode.children)} `:"";var RNe=({context:t,renderChildren:e})=>{if(!Mg(t.currentNode))return"";let n=e(t.currentNode.children);return n.endsWith(" ")?n:`${n} `};var ANe=({context:t,renderChildren:e})=>Mg(t.currentNode)?`${e(t.currentNode.children)} `:"";var kNe=({context:t,renderChildren:e})=>Mg(t.currentNode)?`${e(t.currentNode.children)} `:"";var PNe=({context:t,renderChildren:e})=>Mg(t.currentNode)?`${e(t.currentNode.children)} `:"";var INe=({context:t,renderChildren:e})=>Mg(t.currentNode)?`${e(t.currentNode.children)} `:"";var FNe=({context:t})=>t.currentNode.text;var BNe=()=>" ";var zNe=()=>" ",VNe=new Map([["text",FNe],["tab",BNe],["linebreak",zNe],["paragraph",ANe],["listitem",RNe],["heading",MNe],["table",kNe],["tablecell",PNe],["tablerow",INe]]),UNe=t=>{let e=VNe.get(t.currentNode.type);return e||(({context:n,renderChildren:r})=>Mg(n.currentNode)?r(n.currentNode.children):"")};function HNe(t,e){let n=[];return e?.ancestorNodes&&(n=n.concat(e.ancestorNodes)),e?.currentNode&&n.unshift(e.currentNode),{...e??{},currentNode:t,ancestorNodes:n}}function zk(t,e){var n;if(!ene(t))return"";let r=HNe(t,e),o=(n=r.resolveRenderer)==null?void 0:n.call(r,r);if(typeof o>"u")o=UNe(r);else if(o===null)return"";let i=a=>jNe(a,r);if(o){let a=o({context:r,renderChildren:i});return r.ancestorNodes.length>0?a:a.trim()}else throw new Error(`There is no renderer for node type: ${r.currentNode.type}`)}function jNe(t,e){return Array.isArray(t)?t.map(n=>zk(n,e)).join(""):""}var WNe=[{label:"Heading 1",type:"h1"},{label:"Heading 2",type:"h2"},{label:"Heading 3",type:"h3"},{label:"Heading 4",type:"h4"},{label:"Heading 5",type:"h5"},{label:"Heading 6",type:"h6"},{label:"Bullet List",type:"unorderedList"},{label:"Ordered List",type:"orderedList"},{label:"Link",type:"link"},{label:"Blockquote",type:"quote"},{label:"Code Block",type:"code"},{label:"Table",type:"table"},{label:"Asset",type:"asset"},{label:"Dynamic Token",type:"variable"}],KNe=[{label:"Bold",type:"bold"},{label:"Italic",type:"italic"},{label:"Underline",type:"underline"},{label:"Strikethrough",type:"strikethrough"},{label:"Code",type:"code"},{label:"Superscript",type:"superscript"},{label:"Subscript",type:"subscript"}];var J_={required:!1,formatting:{builtIn:KNe.map(t=>t.type)},elements:{builtIn:WNe.map(t=>t.type)},elementsConfig:{asset:{allowedTypes:["image"]}}};import{z as Qa}from"zod";import{z as lo}from"zod";var X_=lo.object({name:lo.string().describe('Title-cased display name. Ex: "Headline"'),id:lo.string().describe("The public ID. Must be unique within the current entity fields/parameters."),type:lo.enum(["text","richText","select","multi-select","number","date","dateTime","checkbox","link","asset","json","contentReference","$enr","group"]).describe("The data type of the property. The group type defines a grouping of other properties."),guidance:lo.string().describe('Describe what kind of content should be populated, for a LLM to use as a guide. 1-2 sentences max. Ex: "Meta tags based on the content", "2-3 word headline"'),localizable:lo.boolean().describe("Whether values are stored as locale-specific"),typeConfig:lo.object({allowedTypes:lo.array(lo.enum(["image","video","audio","other"])).optional().describe("The types of asset allowed. ONLY applies when type=asset, omit for other types"),options:lo.array(lo.object({text:lo.string().describe("The text to display to the author"),value:lo.string().describe("The value to store for the option")})).optional().describe("The author-selectable options for the select property. ONLY applies when type=select or multi-select, omit for other types"),required:lo.boolean().optional().describe("Whether an author must enter a value for this property"),min:lo.number().optional().describe("When type=number, this is the smallest allowed value (omit for no minimum). When type=multi-select, this is the minimum number of selections the author must make (omit for no minimum). When type=reference and isMulti=true, this is the minimum number of references the author must select (omit for no minimum). Omit for all other types."),max:lo.number().optional().describe("When type=number, this is the largest allowed value (omit for no maximum). When type=multi-select, this is the maximum number of selections the author can make (omit for no maximum). When type=reference and isMulti=true, this is the maximum number of references the author can select (omit for no maximum). Omit for all other types."),allowedContentTypes:lo.array(lo.string()).optional().describe("When type=reference, this is a list of content type public IDs the author can reference. The content type ID must already exist. Omit for all other types."),isMulti:lo.boolean().optional().describe("When type=reference, this is whether the author can select multiple referenced entries. When false, only one reference is allowed. Omit for all other types."),childrenParams:lo.array(lo.string()).optional().describe("When type=group, this is a list of public IDs of the properties to group. The property ID must be defined within this definition. Omit for all other types."),collapsed:lo.boolean().optional().describe("When type=group, this is whether the group is collapsed by default."),schema:lo.any().describe("When type=json, this is an optional JSON schema the property value must follow. Omit for all other types.")}).optional()});var nne=Qa.object({name:Qa.string().describe('Title-cased display name of the component. Ex: "Hero"'),id:Qa.string().describe("Public ID of the component, the camelCase version of name, using only alphanumeric characters"),description:Qa.string().describe('Describe the purpose of the component in 1-2 sentences. If the component seems generic, such as "Promo" or "Hero", this should be blank.'),canBeComposition:Qa.boolean().describe("True if the component can have pages/compositions created from it. False if it is a part of a page."),parameters:Qa.array(X_).describe("The properties of the component. The key is the publicId of the property.").optional(),slots:Qa.array(Qa.object({name:Qa.string().describe('Title-cased display name of the slot. Ex: "Content"'),id:Qa.string().describe("The public id of the slot. Must be unique within this component's slots."),allowedComponents:Qa.array(Qa.string()).describe("The components public IDs allowed in the slot."),minComponents:Qa.number().describe("The minimum number of components allowed in the slot. Omit for no minimum.").min(0).optional(),maxComponents:Qa.number().describe("The maximum number of components allowed in the slot. Omit for no maximum.").min(1).optional(),inheritAllowedComponents:Qa.boolean().describe("Set to false")})).describe("The slots of the component. The key is the publicId of the slot.").optional()});function rne(t){let e=t.slots?.map(o=>({...o,patternsInAllowedComponents:!0,inheritAllowedComponents:!1,maxComponents:o.maxComponents===0?void 0:o.maxComponents,minComponents:o.minComponents===0?void 0:o.minComponents})),n=t.parameters?.find(o=>o.type==="asset"&&typeof o.typeConfig=="object"&&o.typeConfig!==null&&"allowedTypes"in o.typeConfig&&Array.isArray(o.typeConfig.allowedTypes)&&o.typeConfig.allowedTypes?.includes("image"))?.id,r=t.parameters?.find(o=>o.type==="text")?.id;return{...t,slots:e,titleParameter:r,thumbnailParameter:n}}function _y(t){let e=t.filter(r=>r.type==="group")??[];if(e.length===0)return!1;let n=!1;for(;e.length>0;){let r=e.shift(),o=r.typeConfig&&typeof r.typeConfig=="object"&&"childrenParams"in r.typeConfig&&Array.isArray(r.typeConfig.childrenParams)?r.typeConfig.childrenParams:[],i=new Set(o),a=t.findIndex(c=>c.id===r.id),l=i.size;for(let c=a+1;c<=a+l;c++){let d=t[c];if(d)if(i.has(d.id))i.delete(d.id);else break}if(i.size>0){let c=Array.from(i),d=a+l-i.size;for(let f of c){let m=t.findIndex(h=>h.id===f);if(m!==-1){let[h]=t.splice(m,1);m>d&&d++,t.splice(d,0,h)}else o.splice(o.indexOf(f),1)}n=!0}}return n}function Q_(t){return`${pt.baseWebUrl}/dashboards/canvas/components/${t}`}function Dy(t,e){let n=t.filter(r=>e===void 0&&r.type==="richText"||e!==void 0&&e.includes(r.id));if(n.length!==0)for(let r of n){if(r.typeConfig===void 0){r.typeConfig=J_;continue}r.typeConfig={...J_,required:r.typeConfig.required??J_.required}}}var YNe={action:one.enum(["create","update","delete"]).describe("The action to perform"),publicId:one.string().describe("Public ID of the component, the camelCase version of name, using only alphanumeric characters"),component:nne.describe("Full component definition to create. Omit for update or delete.").optional(),patches:q_.describe("JSON patch to apply to the existing component definition. Omit for create or delete.").optional()};function ine(t){t.tool("componentAction","Creates, updates, or deletes a Uniform Component definition (or Composition definition)",YNe,async({publicId:e,action:n,component:r,patches:o})=>{let i=new GNe(pt),a=!1;if(n==="create"){if(!r)throw new Error("Component definition is required for create");let l=rne(r);l.parameters&&(a=_y(l.parameters),Dy(l.parameters)),await i.updateComponentDefinition({componentDefinition:l})}if(n==="update"){if(!o)throw new Error("Patches are required for update");let l=await i.getComponentDefinitions({componentId:e});if(!l.componentDefinitions.length)throw new Error(`Component with public ID ${e} does not exist, try creating it instead`);let c=l.componentDefinitions[0],d=c.parameters?.filter(m=>m.type==="richText").map(m=>m.id),f=Z_(c,o);if(f.parameters){a=_y(f.parameters);let m=f.parameters?.filter(h=>h.type==="richText").map(h=>h.id).filter(h=>!d?.includes(h));Dy(f.parameters,m)}await i.updateComponentDefinition({componentDefinition:f})}return n==="delete"&&await i.removeComponentDefinition({componentId:e}),{content:[{type:"text",text:JSON.stringify({success:!0,editUrl:Q_(e),warning:a?"Issues with parameter group order were fixed. Ensure definition data is re-fetched before any future updates.":void 0},null,2)}]}})}import{CanvasClient as ane}from"@uniformdev/canvas";import{z as ZNe}from"zod";var qNe={id:ZNe.string()};function sne(t){t.tool("componentList","Lists all Uniform Component definitions",async()=>{let r=(await new ane(pt).getComponentDefinitions({includeSystem:!0})).componentDefinitions.map(o=>({id:o.id,name:o.name,type:o.canBeComposition?"composition":"component",description:o.description,editUrl:Q_(o.id)}));return{content:[{type:"text",text:JSON.stringify(r,null,2)}]}}),t.tool("componentGet","Gets a Uniform Component definition details (slots, parameters, etc.)",qNe,async({id:e})=>{let r=await new ane(pt).getComponentDefinitions({componentId:e,includeSystem:!0});return{content:[{type:"text",text:JSON.stringify(r.componentDefinitions[0],null,2)}]}})}import{z as pn}from"zod";var JNe=pn.object({parentComponentId:pn.string().describe("ID of the component the slot belongs to"),slotName:pn.string().describe("Public ID of the target slot"),slotIndex:pn.number().describe("Index to insert the new component at. Omit for append.").optional(),newComponentInstanceUuid:pn.string().uuid().describe("ID of the new component to create - generate a random unique UUID"),instanceType:pn.enum(["component","componentPattern"]),componentType:pn.string().describe("Public ID of the component definition to insert. Component definition must be registered with Uniform. Omit when inserting a component pattern instance.").optional(),componentPatternId:pn.string().describe("UUID of the component pattern definition to insert. Component pattern must be registered with Uniform. Omit when inserting a component instance.").optional()}),e6=pn.object({componentId:pn.string().describe("ID of the component the parameter belongs to - can be created in the same call to this tool"),parameterId:pn.string().describe("Public ID of the parameter to update. Must be defined in the component type of the parent componentId"),parameterType:pn.string().describe("The type of the parameterId as defined on the component definition"),locale:pn.string().describe("Locale of the parameter value. Omit for non-localized values.").optional(),editInstructions:pn.string().describe('Prompt that will be used to generate the parameter value. Omission will leave the value unchanged. To reset an overridden value to pattern default, say "reset override".').optional()}).describe("A value change to a parameter. Omit unchanged parameters."),t6=pn.object({createComponentInstances:pn.array(JNe).describe("New components to insert in slots. Do not use for moves or duplications. Omit for delete. These actions are performed before moving, duplicating, or deleting components, and parameter updates.").optional(),moveComponentInstances:pn.array(pn.object({componentId:pn.string().describe("Existing component ID to move. Cannot be root component."),newParentComponentId:pn.string(),newSlotName:pn.string().describe("Destination slot to move to"),newSlotIndex:pn.number().describe("Destination index in the parent slot to move to")})).describe("Moves existing component instances to a new location in a composition. The destination can be the same slot to cause a reorder. Omit for create or delete, or if nothing needs moving. These actions are performed before duplicating or deleting components, and parameter updates.").optional(),duplicateComponentInstances:pn.array(pn.string().describe("Component ID to duplicate. Cannot be root component. All descendants of the duplicated component will be duplicated as well. Duplicates are placed in the same slot as the original component, at the end.")).describe("Component instances to duplicate/copy. Omit when empty. These actions are performed before deleting components and parameter updates.").optional(),deleteComponentInstances:pn.array(pn.string().describe("Component ID to remove. Cannot be the pattern root component.")).describe("Component instances to delete from slots during an update. Omit for create or delete, or if nothing needs deleting. These actions are performed after moving and duplicating components, and before parameter updates.").optional()}),om=pn.object({enableLocales:pn.array(pn.string()).describe("Locales to enable. Omit for no change.").optional(),disableLocales:pn.array(pn.string()).describe("Locales to disable. Existing data in disabled locales will be lost. Omit for no change.").optional()}),XNe=pn.object({summary:pn.string().describe("Short summary of the edit that was made.").optional(),success:pn.boolean()}),Gst=pn.object({success:pn.boolean().describe("Whether all actions were successful"),actionsTaken:pn.array(XNe).describe("Array of individual actions that were taken")});import{z as SS}from"zod";var QNe=e6.extend({overridable:SS.enum(["yes","no"]).describe("Whether the parameter value set on the pattern definition is overridable by pattern consumers. Omit when no change is needed.").optional()}),lne=t6.extend({name:SS.string().describe("Name of the pattern. If the name does not need to be changed, omit this field. Always include for creates.").optional(),type:SS.string().describe("Component definition type of the pattern. Must be registered with Uniform. Always include for creates. Omit otherwise.").optional(),description:SS.string().describe("Description of the pattern for authors. If the description does not need to be changed, omit this field.").optional(),parameterUpdates:SS.array(QNe).describe("Updates to the parameters of the pattern. Use empty array if no changes are needed.").optional(),localeUpdates:om.optional()}).describe("Modification instructions for the pattern");import{z as n6}from"zod";var une=n6.object({...t6.shape,name:n6.string().describe("Name of the composition. If the name does not need to be changed, omit this field. Always include for creates.").optional(),type:n6.string().describe("Component definition type of the composition. Must be registered with Uniform and have canBeComposition=true in the component definition. Always include for creates. Omit otherwise.").optional(),parameterUpdates:n6.array(e6).describe("Updates to the parameters of the pattern. Use empty array if no changes are needed.").optional(),localeUpdates:om.optional()}).describe("Modification instructions for the composition");import{z as $y}from"zod";import{z as gf}from"zod";var Vk=gf.object({fieldId:gf.string().describe("Public ID of the field to update. Must be defined in the content type of the parent entry."),fieldType:gf.string().describe("The type of the fieldId as defined on the content type"),locale:gf.string().describe("Locale of the field value. Omit for non-localized values.").optional(),editInstructions:gf.string().describe('Prompt that will be used to generate the field value. Omission will leave the value unchanged. To reset an overridden value to pattern default, say "reset override".').optional()}).describe("A value change to a field. Omit unchanged fields."),cne=gf.object({type:gf.string().describe("Content type of the entry. Must be registered with Uniform. Always include for creates. Omit otherwise.").optional(),slug:gf.string().describe("Slug (human-readable identifier) of the entry. If the slug does not need to be changed, omit this field.").optional(),fieldUpdates:gf.array(Vk).describe("Updates to the fields of the entry. Use empty array if no changes are needed.").optional(),localeUpdates:om.optional()}).describe("Modification instructions for the entry");var e8e=Vk.extend({overridable:$y.enum(["yes","no"]).describe("Whether the parameter value set on the pattern definition is overridable by pattern consumers. Omit when no change is needed.").optional()}),dne=$y.object({name:$y.string().describe("Name of the entry pattern. If the name does not need to be changed, omit this field. Always include for creates.").optional(),type:$y.string().describe("Content type of the entry pattern. Must be registered with Uniform. Always include for creates. Omit otherwise.").optional(),description:$y.string().describe("Description of the entry pattern for authors. If the description does not need to be changed, omit this field.").optional(),fieldUpdates:$y.array(e8e).describe("Updates to the fields of the entry pattern. Use empty array if no changes are needed.").optional(),localeUpdates:om.optional()}).describe("Modification instructions for the entry pattern");import{z as tq}from"zod";import{CANVAS_BLOCK_PARAM_TYPE as xot}from"@uniformdev/canvas";import{getEffectivePropertyValue as Cot}from"@uniformdev/canvas";import{CANVAS_PERSONALIZATION_PARAM as Sot}from"@uniformdev/canvas";import t8e from"crypto";var o6=new Uint8Array(256),r6=o6.length;function Uk(){return r6>o6.length-16&&(t8e.randomFillSync(o6),r6=0),o6.slice(r6,r6+=16)}var fne=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function n8e(t){return typeof t=="string"&&fne.test(t)}var wS=n8e;var na=[];for(let t=0;t<256;++t)na.push((t+256).toString(16).slice(1));function pne(t,e=0){return na[t[e+0]]+na[t[e+1]]+na[t[e+2]]+na[t[e+3]]+"-"+na[t[e+4]]+na[t[e+5]]+"-"+na[t[e+6]]+na[t[e+7]]+"-"+na[t[e+8]]+na[t[e+9]]+"-"+na[t[e+10]]+na[t[e+11]]+na[t[e+12]]+na[t[e+13]]+na[t[e+14]]+na[t[e+15]]}import r8e from"crypto";var Hk={randomUUID:r8e.randomUUID};function o8e(t,e,n){if(Hk.randomUUID&&!e&&!t)return Hk.randomUUID();t=t||{};let r=t.random||(t.rng||Uk)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,e){n=n||0;for(let o=0;o<16;++o)e[n+o]=r[o];return e}return pne(r)}var ya=o8e;var i8e="$p:";function mne(t){return`${i8e}${t}`}function hne(t){return{...t,allowedComponentsIndex:new Set(t?.allowedComponents??[]),maxComponents:t?.maxComponents??Number.MAX_VALUE,minComponents:t?.minComponents??0,allowAllPatternsOfAllowedTypes:!t?.patternsInAllowedComponents}}import{CANVAS_LOCALIZATION_SLOT as _lt,CANVAS_LOCALIZATION_TYPE as Dlt,CANVAS_PERSONALIZATION_ALGORITHM_PARAM as $lt,CANVAS_PERSONALIZATION_ALGORITHM_TYPE as Nlt,CANVAS_PERSONALIZATION_EVENT_NAME_PARAM as Llt,CANVAS_PERSONALIZATION_TAKE_PARAM as Olt,CANVAS_PERSONALIZE_SLOT as Mlt,CANVAS_PERSONALIZE_TYPE as Rlt,CANVAS_SLOT_SECTION_SLOT as Alt,CANVAS_SLOT_SECTION_TYPE as klt,CANVAS_TEST_SLOT as Plt,CANVAS_TEST_TYPE as Ilt}from"@uniformdev/canvas";var a8e={$personalization:{isNestableIntoItself:!0},$test:void 0,$localization:void 0,$loop:void 0,$slotSection:{isAutoAllowed:!0,isNestableIntoItself:!0,isOnlyAllowedInPatternEditor:!0}},gne=t=>a8e[t];function jk(t,e,n=!1){let r=gne(t.type);if(r?.isOnlyAllowedInPatternEditor&&!n)return!1;if(r?.isAutoAllowed||e.allowAllComponents)return!0;let o=e.allowedComponentsIndex.has(t.type);return e.allowAllPatternsOfAllowedTypes||!t._pattern?o:e.allowedComponentsIndex.has(mne(t._pattern))||!1}var Wk=({twee:t,parentSlotDefinition:e,nodeId:n,componentDefinitionsIndex:r})=>{if(!e.inheritAllowedComponents)return e;let o=t.getParentInfo(n);if(!o)return;let i=r[o.value.type]?.slots?.find(({id:a})=>a===o.parentName);if(i)return Wk({parentSlotDefinition:i,nodeId:o.parentId,twee:t,componentDefinitionsIndex:r})};function a6({definition:t,lastUserChoice:e,currentValue:n}){if(t&&!t.localizable)return!1;if(n){if(n.locales&&i6(n.locales)||n.localesConditions&&i6(n.localesConditions))return!0;if(n.value!==void 0||n.conditions!==void 0)return!1}if(e!==void 0)return e;if(t)return!t.notLocalizedByDefault}function i6(t){return Array.isArray(t)?t.some(e=>i6(e)):t===void 0?!1:t===null||typeof t!="object"?!0:Object.values(t).some(e=>i6(e))}function vne({twee:t,nodeId:e,currentEditorLocale:n,definition:r}){let o=t.getNodeById(e),i=o?.propertyValueLocalizability?.[r.id],a=t.getNodeProperty(e,r?.id),l=a6({lastUserChoice:i,currentValue:a,definition:r});if(o&&l!==void 0&&l!==(i??!1)&&t.updateNode({nodeId:e,updateMetadata:c=>{c.propertyValueLocalizability[r.id]=l},doNotSetDirty:!0}),l)return n}import{CANVAS_ENRICHMENT_TAG_PARAM as mot,CANVAS_PERSONALIZATION_ALGORITHM_PARAM as hot,CANVAS_PERSONALIZATION_PARAM as got,CANVAS_PERSONALIZE_SLOT as vot,isSystemComponentDefinition as yot}from"@uniformdev/canvas";var yne=Object.prototype.hasOwnProperty;function ba(t,e){var n,r;if(t===e)return!0;if(t&&e&&(n=t.constructor)===e.constructor){if(n===Date)return t.getTime()===e.getTime();if(n===RegExp)return t.toString()===e.toString();if(n===Array){if((r=t.length)===e.length)for(;r--&&ba(t[r],e[r]););return r===-1}if(!n||typeof t=="object"){r=0;for(n in t)if(yne.call(t,n)&&++r&&!yne.call(e,n)||!(n in e)||!ba(t[n],e[n]))return!1;return Object.keys(e).length===r}}return t!==t&&e!==e}function s6(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)t[r]=n[r]}return t}var s8e={read:function(t){return t[0]==='"'&&(t=t.slice(1,-1)),t.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(t){return encodeURIComponent(t).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function Kk(t,e){function n(o,i,a){if(!(typeof document>"u")){a=s6({},e,a),typeof a.expires=="number"&&(a.expires=new Date(Date.now()+a.expires*864e5)),a.expires&&(a.expires=a.expires.toUTCString()),o=encodeURIComponent(o).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var l="";for(var c in a)a[c]&&(l+="; "+c,a[c]!==!0&&(l+="="+a[c].split(";")[0]));return document.cookie=o+"="+t.write(i,o)+l}}function r(o){if(!(typeof document>"u"||arguments.length&&!o)){for(var i=document.cookie?document.cookie.split("; "):[],a={},l=0;l<i.length;l++){var c=i[l].split("="),d=c.slice(1).join("=");try{var f=decodeURIComponent(c[0]);if(a[f]=t.read(d,f),o===f)break}catch{}}return o?a[o]:a}}return Object.create({set:n,get:r,remove:function(o,i){n(o,"",s6({},i,{expires:-1}))},withAttributes:function(o){return Kk(this.converter,s6({},this.attributes,o))},withConverter:function(o){return Kk(s6({},this.converter,o),this.attributes)}},{attributes:{value:Object.freeze(e)},converter:{value:Object.freeze(t)}})}var l8e=Kk(s8e,{path:"/"});function ES(t){return{all:t=t||new Map,on:function(e,n){var r=t.get(e);r?r.push(n):t.set(e,[n])},off:function(e,n){var r=t.get(e);r&&(n?r.splice(r.indexOf(n)>>>0,1):t.set(e,[]))},emit:function(e,n){var r=t.get(e);r&&r.slice().map(function(o){o(n)}),(r=t.get("*"))&&r.slice().map(function(o){o(e,n)})}}}var Sne=J(TS(),1);var $ne=J(TS(),1),Nne=J(TS(),1);var d8e=t=>{throw TypeError(t)};var Jk=(t,e,n)=>e.has(t)||d8e("Cannot "+n),lr=(t,e,n)=>(Jk(t,e,"read from private field"),n?n.call(t):e.get(t));var xne=(t,e,n,r)=>(Jk(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),DS=(t,e,n)=>(Jk(t,e,"access private method"),n);var f8e="_",p8e;p8e=new WeakMap;var m8e,h8e;m8e=new WeakMap;h8e=new WeakMap;var g8e,v8e,y8e,b8e;g8e=new WeakMap;v8e=new WeakMap;y8e=new WeakMap;b8e=new WeakMap;function x8e(t,e){return`${t}${f8e}${e}`}function C8e(t,e){var n;if(typeof t>"u"||t===null)return!1;let r=Number(t);if(isNaN(r))return!1;switch((n=e?.op)!=null?n:"="){case"=":return r===e.rhs;case"!=":return r!==e.rhs;case">":return r>e.rhs;case"<":return r<e.rhs;default:return console.warn(`Unknown match type ${e.op} is false.`),!1}}function S8e(t,e){return`${t} ${w8e(e)}`}function w8e(t){return`${t.op} ${t.rhs}`}var Gk=x8e("$pvc","v"),E8e=({update:t,criteria:e,commands:n,onLogMessage:r})=>{var o,i;if(e.type!=="PVC")return{result:!1,changed:!1};let a=!!(t.state.url&&(!t.previousState||((o=t.state.url)==null?void 0:o.toString())!==((i=t.previousState.url)==null?void 0:i.toString()))),c=(t.visitor.sessionScores[Gk]||0)+1,d={result:!1,changed:a},f=n.some(m=>m.type==="modscoreS"&&m.data.dimension===Gk);return a&&!f&&n.push({type:"modscoreS",data:{dimension:Gk,delta:1}}),C8e(c,e.match)&&(d.result=!0),r?.(["debug",203,{criteria:e,result:d,explanation:S8e(c,e.match)}]),d};E8e.alwaysExecute=!0;var T8e;T8e=new WeakMap;var Cne="ssc";var _8e,D8e,$8e;_8e=new WeakMap;D8e=new WeakMap;$8e=new WeakMap;var Yk="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",nut=Yk.split(""),N8e=new Array(123);for(let t=0;t<Yk.length;t++)N8e[Yk.charCodeAt(t)]=t;var L8e,O8e,M8e,R8e;L8e=new WeakMap;O8e=new WeakMap;M8e=new WeakMap;R8e=new WeakMap;var A8e,k8e;A8e=new WeakSet;k8e=async function(){let t=await new Promise(e=>{setTimeout(()=>{e(void 0)},2e3)});t&&this.signalAsyncDataUpdate(t)};var P8e=()=>({quirks:{},scores:{},sessionScores:{},tests:{},goals:{},consent:!1,controlGroup:!1,personalizeVariants:{}}),iut=(0,Sne.default)();var I8e,F8e;I8e=new WeakSet;F8e=function(t){return this.partitionKey?`${this.partitionKey}.${t}`:t};var wne="ufvisitor",Rg,Xk,l6,gl,_S,Ene,B8e,Tne,z8e,Zk,V8e;Rg=new WeakMap;Xk=new WeakMap;l6=new WeakMap;gl=new WeakMap;_S=new WeakSet;Ene=function(){return lr(this,Xk).get(wne)};B8e=function(t,e=!1){var n,r,o,i,a,l,c,d,f,m,h;let g=lr(this,_S,Ene),y=Date.now();DS(this,_S,Zk).call(this,t.scores),DS(this,_S,Zk).call(this,t.sessionScores),(r=(n=lr(this,gl)).decay)==null||r.call(n,{now:y,lastUpd:g?.updated,scores:t.scores,sessionScores:t.sessionScores,onLogMessage:lr(this,gl).onLogMessage});let b=!ba(g?.visitorData.scores,t.scores),C=!ba(g?.visitorData.sessionScores,t.sessionScores),S=!ba(g?.visitorData.quirks,t.quirks),w=!ba(g?.visitorData.tests,t.tests),E=!ba(g?.visitorData.goals,t.goals),_={updated:y,visitorData:t};if(DS(this,_S,Tne).call(this),lr(this,Xk).set(wne,_,!!t.consent),(i=(o=lr(this,gl)).onLogMessage)==null||i.call(o,["debug",102,t]),!e&&((b||C)&&lr(this,Rg).emit("scoresUpdated",t),S&&lr(this,Rg).emit("quirksUpdated",t),w&&lr(this,Rg).emit("testsUpdated",t),((a=g?.visitorData)==null?void 0:a.consent)!==t.consent&&lr(this,Rg).emit("consentUpdated",t),((l=g?.visitorData)==null?void 0:l.controlGroup)!==t.controlGroup&&(lr(this,Rg).emit("controlGroupUpdated",t),(f=(d=lr(this,gl)).onLogMessage)==null||f.call(d,["debug",104,(c=t.controlGroup)!=null?c:!1])),E)){let N=Object.keys((m=t.goals)!=null?m:{});for(let $=0;$<N.length;$++){let M=N[$];(h=g?.visitorData.goals)!=null&&h[M]||lr(this,Rg).emit("goalConverted",{goalId:M})}}};Tne=function(){typeof document>"u"||!lr(this,gl).visitLifespan||(lr(this,l6)&&window.clearTimeout(lr(this,l6)),xne(this,l6,window.setTimeout(()=>{this.data},lr(this,gl).visitLifespan+50)))};z8e=function(t){let e=lr(this,gl).visitLifespan;return e?t.updated+e<Date.now():!1};Zk=function(t){var e,n;if(lr(this,gl).manifest)for(let r in t){let o=t[r],i=lr(this,gl).manifest.getDimensionByKey(r);i&&o>i.cap&&((n=(e=lr(this,gl)).onLogMessage)==null||n.call(e,["debug",110,{dim:r,score:o,cap:i.cap}]),t[r]=i.cap)}};V8e=function(){var t,e,n;return{...P8e(),consent:(t=lr(this,gl).defaultConsent)!=null?t:!1,controlGroup:(n=(e=lr(this,gl).manifest)==null?void 0:e.rollForControlGroup())!=null?n:!1}};var U8e,H8e,u6,j8e,W8e,K8e,G8e,Y8e,c6,qk,Z8e,_ne,q8e,Dne;U8e=new WeakMap;H8e=new WeakMap;u6=new WeakMap;j8e=new WeakMap;W8e=new WeakMap;K8e=new WeakMap;G8e=new WeakMap;Y8e=new WeakMap;c6=new WeakMap;qk=new WeakSet;Z8e=function(t){lr(this,c6).emit("testResult",t)};_ne=async function(t){let e=this.manifest.computeGoals(t);e.length!==0&&await this.storage.updateData(e)};q8e=function(t){let e=DS(this,qk,Dne).call(this,t);!ba(e,lr(this,u6))&&(xne(this,u6,e),DS(this,qk,_ne).call(this,{scores:lr(this,u6),quirks:void 0}),lr(this,c6).emit("scoresUpdated",e),lr(this,c6).emit("log",["info",3,e]))};Dne=function(t){var e;let n={...t.scores};for(let r in t.sessionScores)n[r]=((e=n[r])!=null?e:0)+t.sessionScores[r];return n=this.manifest.computeAggregateDimensions(n),n};var lut=(0,$ne.default)();var uut=(0,Nne.default)();await j1();var EIe=await(process.env.NODE_ENV!=="production"?lue().then(()=>sue):cue().then(()=>uue)),due=EIe.createHeadlessEditor;await PD();await jB();await KD();await rpe();var Xm=J(wo());ume();var Ngt=J(ae());Nb();var Ogt=J(lV());i3();var Rgt=J(eV());Ob();Mb();G$();var Ys=Xm.Fragment;function K(t,e,n){return c3.call(e,"css")?Xm.jsx(aV,iV(t,e),n):Xm.jsx(t,e,n)}function Oe(t,e,n){return c3.call(e,"css")?Xm.jsxs(aV,iV(t,e),n):Xm.jsxs(t,e,n)}Ee();Ee();Ee();Ee();Ee();function pme(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];t&&t.addEventListener&&t.addEventListener.apply(t,e)}function mme(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];t&&t.removeEventListener&&t.removeEventListener.apply(t,e)}var hme=typeof window<"u";var gme=J(ae());var uc=J(ae());function cV(t,e){e===void 0&&(e=0);var n=(0,uc.useRef)(!1),r=(0,uc.useRef)(),o=(0,uc.useRef)(t),i=(0,uc.useCallback)(function(){return n.current},[]),a=(0,uc.useCallback)(function(){n.current=!1,r.current&&clearTimeout(r.current),r.current=setTimeout(function(){n.current=!0,o.current()},e)},[e]),l=(0,uc.useCallback)(function(){n.current=null,r.current&&clearTimeout(r.current)},[]);return(0,uc.useEffect)(function(){o.current=t},[t]),(0,uc.useEffect)(function(){return a(),l},[e]),[i,l,a]}function X$(t,e,n){e===void 0&&(e=0),n===void 0&&(n=[]);var r=cV(t,e),o=r[0],i=r[1],a=r[2];return(0,gme.useEffect)(a,n),[o,i]}var Rb=J(ae());var fUe=function(t){return t===void 0&&(t={laptopL:1440,laptop:1024,tablet:768}),function(){var e=(0,Rb.useState)(hme?window.innerWidth:0),n=e[0],r=e[1];(0,Rb.useEffect)(function(){var a=function(){r(window.innerWidth)};return a(),pme(window,"resize",a),function(){mme(window,"resize",a)}});var o=(0,Rb.useMemo)(function(){return Object.entries(t).sort(function(a,l){return a[1]>=l[1]?1:-1})},[t]),i=o.reduce(function(a,l){var c=l[0],d=l[1];return n>=d?c:a},o[0][0]);return i}},dV=fUe;Ee();Ee();Ee();var bQe=J(ae());Ee();Ee();var pUe=Object.defineProperty,mUe=Object.defineProperties,hUe=Object.getOwnPropertyDescriptors,Q$=Object.getOwnPropertySymbols,yme=Object.prototype.hasOwnProperty,bme=Object.prototype.propertyIsEnumerable,vme=(t,e,n)=>e in t?pUe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,me=(t,e)=>{for(var n in e||(e={}))yme.call(e,n)&&vme(t,n,e[n]);if(Q$)for(var n of Q$(e))bme.call(e,n)&&vme(t,n,e[n]);return t},Ne=(t,e)=>mUe(t,hUe(e)),ut=(t,e)=>{var n={};for(var r in t)yme.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&Q$)for(var r of Q$(t))e.indexOf(r)<0&&bme.call(t,r)&&(n[r]=t[r]);return n};var gUe=Object.defineProperty,vUe=Object.defineProperties,yUe=Object.getOwnPropertyDescriptors,e9=Object.getOwnPropertySymbols,Cme=Object.prototype.hasOwnProperty,Sme=Object.prototype.propertyIsEnumerable,xme=(t,e,n)=>e in t?gUe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Jt=(t,e)=>{for(var n in e||(e={}))Cme.call(e,n)&&xme(t,n,e[n]);if(e9)for(var n of e9(e))Sme.call(e,n)&&xme(t,n,e[n]);return t},ir=(t,e)=>vUe(t,yUe(e)),t9=(t,e)=>{var n={};for(var r in t)Cme.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&e9)for(var r of e9(t))e.indexOf(r)<0&&Sme.call(t,r)&&(n[r]=t[r]);return n};function yv(...t){}function d3(t,e){if(bUe(t)){let n=xUe(e)?e():e;return t(n)}return t}function bUe(t){return typeof t=="function"}function xUe(t){return typeof t=="function"}function fs(t,e){return typeof Object.hasOwn=="function"?Object.hasOwn(t,e):Object.prototype.hasOwnProperty.call(t,e)}function Hr(...t){return(...e)=>{for(let n of t)typeof n=="function"&&n(...e)}}function fV(t){return t.normalize("NFD").replace(/[\u0300-\u036f]/g,"")}function pV(t,e){let n=Jt({},t);for(let r of e)fs(n,r)&&delete n[r];return n}function mV(t,e){let n={};for(let r of e)fs(t,r)&&(n[r]=t[r]);return n}function f3(t){return t}function tn(t,e){if(!t)throw typeof e!="string"?new Error("Invariant failed"):new Error(e)}function hV(t){return Object.keys(t)}function Sd(t,...e){let n=typeof t=="function"?t(...e):t;return n==null?!1:!n}function cc(t){return t.disabled||t["aria-disabled"]===!0||t["aria-disabled"]==="true"}function ps(t){let e={};for(let n in t)t[n]!==void 0&&(e[n]=t[n]);return e}function Zt(...t){for(let e of t)if(e!==void 0)return e}var wme=J(ae(),1);function p3(t,e){typeof t=="function"?t(e):t&&(t.current=e)}function CUe(t){return!t||!(0,wme.isValidElement)(t)?!1:"ref"in t.props||"ref"in t}function Eme(t){return CUe(t)?me({},t.props).ref||t.ref:null}function Tme(t,e){let n=me({},t);for(let r in e){if(!fs(e,r))continue;if(r==="className"){let i="className";n[i]=t[i]?`${t[i]} ${e[i]}`:e[i];continue}if(r==="style"){let i="style";n[i]=t[i]?me(me({},t[i]),e[i]):e[i];continue}let o=e[r];if(typeof o=="function"&&r.startsWith("on")){let i=t[r];if(typeof i=="function"){n[r]=(...a)=>{o(...a),i(...a)};continue}}n[r]=o}return n}var Vf=SUe();function SUe(){var t;return typeof window<"u"&&!!((t=window.document)!=null&&t.createElement)}function xn(t){return t?"self"in t?t.document:t.ownerDocument||document:document}function bv(t){return t?"self"in t?t.self:xn(t).defaultView||window:self}function yl(t,e=!1){let{activeElement:n}=xn(t);if(!n?.nodeName)return null;if(m3(n)&&n.contentDocument)return yl(n.contentDocument.body,e);if(e){let r=n.getAttribute("aria-activedescendant");if(r){let o=xn(n).getElementById(r);if(o)return o}}return n}function Bn(t,e){return t===e||t.contains(e)}function m3(t){return t.tagName==="IFRAME"}function Zs(t){let e=t.tagName.toLowerCase();return e==="button"?!0:e==="input"&&t.type?wUe.indexOf(t.type)!==-1:!1}var wUe=["button","color","file","image","reset","submit"];function h3(t){if(typeof t.checkVisibility=="function")return t.checkVisibility();let e=t;return e.offsetWidth>0||e.offsetHeight>0||t.getClientRects().length>0}function ms(t){try{let e=t instanceof HTMLInputElement&&t.selectionStart!==null,n=t.tagName==="TEXTAREA";return e||n||!1}catch{return!1}}function g3(t){return t.isContentEditable||ms(t)}function gV(t){if(ms(t))return t.value;if(t.isContentEditable){let e=xn(t).createRange();return e.selectNodeContents(t),e.toString()}return""}function vV(t){let e=0,n=0;if(ms(t))e=t.selectionStart||0,n=t.selectionEnd||0;else if(t.isContentEditable){let r=xn(t).getSelection();if(r?.rangeCount&&r.anchorNode&&Bn(t,r.anchorNode)&&r.focusNode&&Bn(t,r.focusNode)){let o=r.getRangeAt(0),i=o.cloneRange();i.selectNodeContents(t),i.setEnd(o.startContainer,o.startOffset),e=i.toString().length,i.setEnd(o.endContainer,o.endOffset),n=i.toString().length}}return{start:e,end:n}}function Ab(t,e){let n=["dialog","menu","listbox","tree","grid"],r=t?.getAttribute("role");return r&&n.indexOf(r)!==-1?r:e}function v3(t,e){var n;let r={menu:"menuitem",listbox:"option",tree:"treeitem"},o=Ab(t);return o&&(n=r[o])!=null?n:e}function n9(t){if(!t)return null;let e=n=>n==="auto"||n==="scroll";if(t.clientHeight&&t.scrollHeight>t.clientHeight){let{overflowY:n}=getComputedStyle(t);if(e(n))return t}else if(t.clientWidth&&t.scrollWidth>t.clientWidth){let{overflowX:n}=getComputedStyle(t);if(e(n))return t}return n9(t.parentElement)||document.scrollingElement||document.body}function y3(t,e){let n=t.map((o,i)=>[i,o]),r=!1;return n.sort(([o,i],[a,l])=>{let c=e(i),d=e(l);return c===d||!c||!d?0:EUe(c,d)?(o>a&&(r=!0),-1):(o<a&&(r=!0),1)}),r?n.map(([o,i])=>i):t}function EUe(t,e){return!!(e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_PRECEDING)}function _me(){return Vf&&!!navigator.maxTouchPoints}function kb(){return Vf?/mac|iphone|ipad|ipod/i.test(navigator.platform):!1}function xv(){return Vf&&kb()&&/apple/i.test(navigator.vendor)}function yV(){return Vf&&/firefox\//i.test(navigator.userAgent)}function bV(){return Vf&&navigator.platform.startsWith("Mac")&&!_me()}function r9(t){return!!(t.currentTarget&&!Bn(t.currentTarget,t.target))}function Ri(t){return t.target===t.currentTarget}function Dme(t){let e=t.currentTarget;if(!e)return!1;let n=kb();if(n&&!t.metaKey||!n&&!t.ctrlKey)return!1;let r=e.tagName.toLowerCase();return r==="a"||r==="button"&&e.type==="submit"||r==="input"&&e.type==="submit"}function $me(t){let e=t.currentTarget;if(!e)return!1;let n=e.tagName.toLowerCase();return t.altKey?n==="a"||n==="button"&&e.type==="submit"||n==="input"&&e.type==="submit":!1}function Nme(t,e,n){let r=new Event(e,n);return t.dispatchEvent(r)}function Cv(t,e){let n=new FocusEvent("blur",e),r=t.dispatchEvent(n),o=ir(Jt({},e),{bubbles:!0});return t.dispatchEvent(new FocusEvent("focusout",o)),r}function Lme(t,e,n){let r=new KeyboardEvent(e,n);return t.dispatchEvent(r)}function xV(t,e){let n=new MouseEvent("click",e);return t.dispatchEvent(n)}function Qm(t,e){let n=e||t.currentTarget,r=t.relatedTarget;return!r||!Bn(n,r)}function eh(t,e,n,r){let i=(l=>{if(r){let d=setTimeout(l,r);return()=>clearTimeout(d)}let c=requestAnimationFrame(l);return()=>cancelAnimationFrame(c)})(()=>{t.removeEventListener(e,a,!0),n()}),a=()=>{i(),n()};return t.addEventListener(e,a,{once:!0,capture:!0}),i}function ro(t,e,n,r=window){let o=[];try{r.document.addEventListener(t,e,n);for(let a of Array.from(r.frames))o.push(ro(t,e,n,a))}catch{}return()=>{try{r.document.removeEventListener(t,e,n)}catch{}for(let a of o)a()}}var oo=J(ae(),1),TUe=J(ae(),1),CV=me({},TUe),Ome=CV.useId,Tvt=CV.useDeferredValue,Mme=CV.useInsertionEffect,cn=Vf?oo.useLayoutEffect:oo.useEffect;function i9(t){let e=(0,oo.useRef)(t);return cn(()=>{e.current=t}),e}function vt(t){let e=(0,oo.useRef)(()=>{throw new Error("Cannot call an event handler while rendering.")});return Mme?Mme(()=>{e.current=t}):e.current=t,(0,oo.useCallback)((...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)},[])}function kme(t){let[e,n]=(0,oo.useState)(null);return cn(()=>{if(e==null||!t)return;let r=null;return t(o=>(r=o,e)),()=>{t(r)}},[e,t]),[e,n]}function sn(...t){return(0,oo.useMemo)(()=>{if(t.some(Boolean))return e=>{for(let n of t)p3(n,e)}},t)}function du(t){if(Ome){let r=Ome();return t||r}let[e,n]=(0,oo.useState)(t);return cn(()=>{if(t||e)return;let r=Math.random().toString(36).slice(2,8);n(`id-${r}`)},[t,e]),t||e}function a9(t,e){let n=i=>{if(typeof i=="string")return i},[r,o]=(0,oo.useState)(()=>n(e));return cn(()=>{let i=t&&"current"in t?t.current:t;o(i?.tagName.toLowerCase()||n(e))},[t,e]),r}function th(t,e){let n=(0,oo.useRef)(!1);(0,oo.useEffect)(()=>{if(n.current)return t();n.current=!0},e),(0,oo.useEffect)(()=>()=>{n.current=!1},[])}function Pme(){return(0,oo.useReducer)(()=>[],[])}function Oo(t){return vt(typeof t=="function"?t:()=>t)}function fr(t,e,n=[]){let r=(0,oo.useCallback)(o=>(t.wrapElement&&(o=t.wrapElement(o)),e(o)),[...n,t.wrapElement]);return Ne(me({},t),{wrapElement:r})}function Pb(t=!1,e){let[n,r]=(0,oo.useState)(null);return{portalRef:sn(r,e),portalNode:n,domReady:!t||n}}function s9(t,e,n){let r=t.onLoadedMetadataCapture,o=(0,oo.useMemo)(()=>Object.assign(()=>{},Ne(me({},r),{[e]:n})),[r,e,n]);return[r?.[e],{onLoadedMetadataCapture:o}]}function Ib(){return(0,oo.useEffect)(()=>{ro("mousemove",DUe,!0),ro("mousedown",o9,!0),ro("mouseup",o9,!0),ro("keydown",o9,!0),ro("scroll",o9,!0)},[]),vt(()=>SV)}var SV=!1,Rme=0,Ame=0;function _Ue(t){let e=t.movementX||t.screenX-Rme,n=t.movementY||t.screenY-Ame;return Rme=t.screenX,Ame=t.screenY,e||n||process.env.NODE_ENV==="test"}function DUe(t){_Ue(t)&&(SV=!0)}function o9(){SV=!1}var hs=J(ae(),1),Sv=J(wo(),1);function st(t){let e=hs.forwardRef((n,r)=>t(Ne(me({},n),{ref:r})));return e.displayName=t.displayName||t.name,e}function Fb(t,e){return hs.memo(t,e)}function ct(t,e){let n=e,{wrapElement:r,render:o}=n,i=ut(n,["wrapElement","render"]),a=sn(e.ref,Eme(o)),l;if(hs.isValidElement(o)){let c=Ne(me({},o.props),{ref:a});l=hs.cloneElement(o,Tme(i,c))}else o?l=o(i):l=(0,Sv.jsx)(t,me({},i));return r?r(l):l}function ft(t){let e=(n={})=>t(n);return e.displayName=t.name,e}function Ho(t=[],e=[]){let n=hs.createContext(void 0),r=hs.createContext(void 0),o=()=>hs.useContext(n),i=(d=!1)=>{let f=hs.useContext(r),m=o();return d?f:f||m},a=()=>{let d=hs.useContext(r),f=o();if(!(d&&d===f))return f},l=d=>t.reduceRight((f,m)=>(0,Sv.jsx)(m,Ne(me({},d),{children:f})),(0,Sv.jsx)(n.Provider,me({},d)));return{context:n,scopedContext:r,useContext:o,useScopedContext:i,useProviderContext:a,ContextProvider:l,ScopedContextProvider:d=>(0,Sv.jsx)(l,Ne(me({},d),{children:e.reduceRight((f,m)=>(0,Sv.jsx)(m,Ne(me({},d),{children:f})),(0,Sv.jsx)(r.Provider,me({},d)))}))}}var b3=Ho(),Ime=b3.useContext,Mvt=b3.useScopedContext,Rvt=b3.useProviderContext,Fme=b3.ContextProvider,Bme=b3.ScopedContextProvider;var wV=J(ae(),1),x3=Ho([Fme],[Bme]),Bb=x3.useContext,Ivt=x3.useScopedContext,zme=x3.useProviderContext,nh=x3.ContextProvider,zb=x3.ScopedContextProvider,Vme=(0,wV.createContext)(void 0),Ume=(0,wV.createContext)(void 0);function wv(t,e){let n=t.__unstableInternals;return tn(n,"Invalid store"),n[e]}function Mo(t,...e){let n=t,r=n,o=Symbol(),i=yv,a=new Set,l=new Set,c=new Set,d=new Set,f=new Set,m=new WeakMap,h=new WeakMap,g=O=>(c.add(O),()=>c.delete(O)),y=()=>{let O=a.size,A=Symbol();a.add(A);let k=()=>{a.delete(A),!a.size&&i()};if(O)return k;let F=hV(n).map(U=>Hr(...e.map(H=>{var Y;let W=(Y=H?.getState)==null?void 0:Y.call(H);if(W&&fs(W,U))return di(H,[U],Z=>{$(U,Z[U],!0)})}))),j=[];for(let U of c)j.push(U());let B=e.map(Vb);return i=Hr(...F,...j,...B),k},b=(O,A,k=d)=>(k.add(A),h.set(A,O),()=>{var F;(F=m.get(A))==null||F(),m.delete(A),h.delete(A),k.delete(A)}),C=(O,A)=>b(O,A),S=(O,A)=>(m.set(A,A(n,n)),b(O,A)),w=(O,A)=>(m.set(A,A(n,r)),b(O,A,f)),E=O=>Mo(mV(n,O),M),_=O=>Mo(pV(n,O),M),N=()=>n,$=(O,A,k=!1)=>{var F;if(!fs(n,O))return;let j=d3(A,n[O]);if(j===n[O])return;if(!k)for(let Y of e)(F=Y?.setState)==null||F.call(Y,O,j);let B=n;n=ir(Jt({},n),{[O]:j});let U=Symbol();o=U,l.add(O);let H=(Y,W,Z)=>{var X;let se=h.get(Y),de=ye=>Z?Z.has(ye):ye===O;(!se||se.some(de))&&((X=m.get(Y))==null||X(),m.set(Y,Y(n,W)))};for(let Y of d)H(Y,B);queueMicrotask(()=>{if(o!==U)return;let Y=n;for(let W of f)H(W,r,l);r=Y,l.clear()})},M={getState:N,setState:$,__unstableInternals:{setup:g,init:y,subscribe:C,sync:S,batch:w,pick:E,omit:_}};return M}function qs(t,...e){if(t)return wv(t,"setup")(...e)}function Vb(t,...e){if(t)return wv(t,"init")(...e)}function Ub(t,...e){if(t)return wv(t,"subscribe")(...e)}function di(t,...e){if(t)return wv(t,"sync")(...e)}function Hb(t,...e){if(t)return wv(t,"batch")(...e)}function Ev(t,...e){if(t)return wv(t,"omit")(...e)}function EV(t,...e){if(t)return wv(t,"pick")(...e)}function Tv(...t){let e=t.reduce((r,o)=>{var i;let a=(i=o?.getState)==null?void 0:i.call(o);return a?Object.assign(r,a):r},{}),n=Mo(e,...t);return Object.assign({},...t,n)}function Uf(t,e){if(process.env.NODE_ENV==="production"||!e)return;let n=Object.entries(t).filter(([i,a])=>i.startsWith("default")&&a!==void 0).map(([i])=>{var a;let l=i.replace("default","");return`${((a=l[0])==null?void 0:a.toLowerCase())||""}${l.slice(1)}`});if(!n.length)return;let r=e.getState();if(n.filter(i=>fs(r,i)).length)throw new Error(`Passing a store prop in conjunction with a default state is not supported.
|
|
237
237
|
|
|
238
238
|
const store = useSelectStore();
|
|
239
239
|
<SelectProvider store={store} defaultValue="Apple" />
|
|
@@ -5175,10 +5175,10 @@ to {
|
|
|
5175
5175
|
&:before {
|
|
5176
5176
|
background: var(--error);
|
|
5177
5177
|
}
|
|
5178
|
-
`;await er();function D4e(t){let e=due({nodes:[gd,hd,PZ,rb,ob,cse,tpe,epe,npe,Af]});return e.update(()=>{use("skip-dom-selection"),sfe(t,mfe)},{discrete:!0}),e.getEditorState().toJSON()}function $4e({twee:t,nodeId:e,propertyId:n,propertyType:r,locale:o,propertyEdit:i,conditionIndex:a=-1}){let l=t.getNodeById(e);if(!l)throw new Error(`Node with ID ${e} not found`);if(i.action==="clearValue")t.updateNodeProperty({nodeId:e,property:n,value:null,source:"ai",locale:o,conditionIndex:-1});else if(i.action==="resetOverride")t.resetPatternPropertyOverride(e,n,o);else if(i.action==="setValue"){let c=bot({twee:t,targetNode:l,propertyId:n,propertyType:r,propertyEdit:i}),d=t.getNodeProperty(e,n);if(!o&&d?.locales)throw new Error(`The ${n} property is localized in ${Object.keys(d.locales).join(", ")}, but no locale was provided when setting its value. Please provide an explicit locale.`);if(n===got){let f=t.getParentInfo(e);if(f?.parentId){let m=t.getNodeProperty(f.parentId,hot);if(m?.value!==Cne)throw new Error(`Cannot edit personalization criteria when the parent personalization component is not using the Strongest Variation Match selection method. Current selection method: ${m?.value||"Top-down criteria matching"}.`)}}t.updateNodeProperty({nodeId:e,property:n,value:()=>c,source:"ai",locale:o,conditionIndex:a,type:r})}}var bot=({twee:t,targetNode:e,propertyId:n,propertyType:r,propertyEdit:o})=>{if(r==="richText")return D4e(o.newValue??"");if(r==="number")return Number(o.newValue);if(n===mot){if(yot(e.value.type))throw new Error("Enrichment tags are not allowed in system components.");if(t.getParentInfo(e.nodeId)?.parentId===vot)throw new Error("Enrichment tags are not allowed in personalization variants.")}return o.treatNewValueAsJson?JSON.parse(o.newValue):o.newValue};async function jL({twee:t,slotUpdates:e,propertyUpdates:n,localeUpdates:r,nameUpdate:o,slugUpdate:i,descriptionUpdate:a,currentEditorLocale:l,referenceData:c}){let d=[];o&&(t.updateRootNode({update:{_name:o}}),d.push({summary:"Updated name",success:!0})),i&&(t.updateRootNode({update:{_slug:i}}),d.push({summary:"Updated slug",success:!0})),a&&(t.updateRootMetadata({description:a}),d.push({summary:"Updated description",success:!0}));let f=await c.fetchDefinitions();await wot({slotUpdates:e,twee:t,definitions:f,referenceData:c,results:d});let m=d.some(g=>!g.success);return e.deletedComponentsInSlots?.forEach(g=>{if(!wS(g)){d.push({summary:`Skipped deleting component ${g} because component IDs are UUIDs, and the value provided is not a valid UUID`,success:!1});return}m?d.push({summary:`Skipped deleting component ${g} because previous actions failed`,success:!1}):(t.deleteNode(g,!1),d.push({summary:`Deleted component ${g}`,success:!0}))}),m=d.some(g=>!g.success),e.moveComponentsInSlots?.forEach(g=>{if(!wS(g.componentId)){d.push({summary:`Skipped moving component ${g.componentId} because component IDs are UUIDs, and the value provided is not a valid UUID`,success:!1});return}if(!wS(g.newParentComponentId)){d.push({summary:`Skipped moving component ${g.componentId} because the new parent component ID is not a valid UUID`,success:!1});return}m?d.push({summary:`Skipped moving component ${g.componentId} because previous actions failed`,success:!1}):(t.moveNode({movedNodeId:g.componentId,parentNodeId:g.newParentComponentId,parentSlot:g.newSlotName,targetIndexInSlot:g.newSlotIndex}),d.push({summary:`Moved component ${g.componentId} to ${g.newParentComponentId} in slot ${g.newSlotName} at index ${g.newSlotIndex}`,success:!0}))}),m=d.some(g=>!g.success),e.duplicateComponentsInSlots?.forEach(g=>{if(m)d.push({summary:`Skipped duplicating component ${g} because previous actions failed`,success:!1});else{let y=t.duplicateNode(g,c.resolvePatternData);d.push({summary:`Duplicated component ${g}. The new duplicate has ID ${y}`,success:!0})}}),m=d.some(g=>!g.success),r?.enableLocales?.forEach(g=>{m?d.push({summary:`Skipped enabling locale ${g} because previous actions failed`,success:!1}):(t.enableLocale(g),d.push({summary:`Enabled locale ${g}`,success:!0}))}),m=d.some(g=>!g.success),r?.disableLocales?.forEach(g=>{m?d.push({summary:`Skipped disabling locale ${g} because previous actions failed`,success:!1}):(t.disableLocale(g),d.push({summary:`Disabled locale ${g}`,success:!0}))}),m=d.some(g=>!g.success),m?n.length>0&&d.push({summary:`Skipped ${n.length} property updates because previous actions failed`,success:!1}):(await Eot({propertyUpdates:n,twee:t,currentEditorLocale:l,referenceData:c,definitions:f,results:d})).forEach(y=>{if(!y.result.success)return;let b="componentId"in y.update?y.update.componentId:t.rootNodeId,C=vne({twee:t,nodeId:b,currentEditorLocale:y.currentLocale,definition:y.propertyDefinition}),S=(t.getNodeById(t.rootNodeId)?.value)._locales??[];if(C&&!S.includes(C)){d.push({summary:`The ${C} locale is not enabled on this entity. Please enable it before setting values in this locale.`,success:!1});return}if(y.result.action!=="nothing")try{$4e({twee:t,nodeId:b,propertyId:y.propertyDefinition.id,propertyType:y.propertyDefinition.type,locale:C,propertyEdit:y.result}),d.push({summary:`Updated value of ${y.propertyDefinition.id} on ${b}${C?` in ${C}`:""}`,success:!0})}catch(w){d.push({summary:`Failed to update value of ${y.propertyDefinition.id} on ${b}${C?` in ${C}`:""}: ${w instanceof Error?w.message:"Unknown error"}`,success:!1})}if("overridable"in y.update&&y.update.overridable!==void 0)if(y.propertyDefinition.type===xot)d.push({summary:`Cannot set overridability for block property '${y.propertyDefinition.id}' - blocks do not support overrides`,success:!1});else{let w=y.update.overridable;t.updateNode({nodeId:b,updateComponent:E=>{E._overridability??={},E._overridability.parameters??={},E._overridability.parameters[y.propertyDefinition.id]=w}}),d.push({summary:`Updated overridability for ${b}`,success:!0})}}),{success:d.every(g=>g.success),actionsTaken:d}}async function wot({slotUpdates:t,twee:e,definitions:n,referenceData:r,results:o}){(await Promise.allSettled(t.newComponentsInSlots?.map(async a=>{let l=e.getNodeById(a.parentComponentId);if(!l)throw new Error(`Parent component with ID ${a.parentComponentId} not found`);let c=n[l.value.type];if(!c)throw new Error(`Definition for parent component type ${l.value.type} not found`);let d=c.slots?.find(h=>h.id===a.slotName);if(!d)throw new Error(`Slot ${a.slotName} not found on component type ${l.value.type}`);let f=Wk({twee:e,parentSlotDefinition:d,nodeId:a.parentComponentId,componentDefinitionsIndex:n});if(!f)throw new Error(`Can't find allowed components inherited slot for ${a.slotName}`);let m=hne(f);if(a.instanceType==="component"){if(!a.componentType)throw new Error("componentType is required when inserting a component instance");if(!jk({type:a.componentType},m,!1))throw new Error(`Component type ${a.componentType} is not allowed in slot ${a.slotName}`);e.insertNode({node:{type:a.componentType},overrideNodeId:a.newComponentInstanceUuid,parentNodeId:a.parentComponentId,parentSlot:a.slotName,targetIndexInSlot:a.slotIndex}),o.push({summary:`Inserted component ${a.componentType} in slot ${a.slotName} ${a.slotIndex!==void 0?`at index ${a.slotIndex}`:""}`,success:!0})}else{if(!a.componentPatternId)throw new Error("componentPatternId is required when inserting a component pattern instance");let h=await r.resolvePatternData(a.componentPatternId);if(!h)throw new Error(`Pattern definition with ID ${a.componentPatternId} not found`);if(!jk({type:h.type,_pattern:a.componentPatternId},m,!1))throw new Error(`Pattern ${a.componentPatternId} is not allowed in slot ${a.slotName}`);e.insertPattern({pattern:h,patternInstanceId:a.newComponentInstanceUuid,parentNodeId:a.parentComponentId,parentSlot:a.slotName,targetIndexInSlot:a.slotIndex}),o.push({summary:`Inserted pattern ${h._name} in slot ${a.slotName} ${a.slotIndex!==void 0?`at index ${a.slotIndex}`:""}`,success:!0})}})??[])).forEach((a,l)=>{if(a.status==="rejected"){let c=t.newComponentsInSlots?.[l];console.error("Error inserting component",a.reason),o.push({summary:`Failed to insert component ${c?.newComponentInstanceUuid}: ${"message"in a.reason?a.reason.message:"Unknown error"}`,success:!1})}})}async function Eot({propertyUpdates:t,twee:e,currentEditorLocale:n,referenceData:r,definitions:o,results:i}){if(t.length===0)return[];let[a,l]=await Promise.all([r.fetchProjectGuidance(),r.getToolClient()]),c=await Promise.allSettled(t.map(async d=>(async()=>{let f="componentId"in d?d.componentId:e.rootNodeId,m=e.getNodeById(f);if(!m)throw new Error(`Component instance with ID ${f} not found`);let h=o[m.value.type];if(!h)throw new Error(`Definition with ID ${m.value.type} not found`);let g="fieldId"in d?d.fieldId:d.parameterId,y=h.parameters?.find(N=>N.id===g),b=d.locale??n,C=y??{id:g,type:"unknown"};if(d.editInstructions===void 0)return{result:{success:!0,newValue:"",treatNewValueAsJson:!1,action:"nothing"},update:d,propertyDefinition:C};if(d.editInstructions==="")return{result:{success:!0,newValue:"",treatNewValueAsJson:!1,action:"clearValue"},update:d,propertyDefinition:C};if(!y)throw new Error(`Property with ID ${g} not found`);let S=Cot({property:e.getNodeProperty(f,g),locale:b,conditionIndex:-1}),w,E=e.getNodeProperty(f,Sot);E?.value?.dim&&(w=await r.getDimensionGuidance(E.value.dim));let _=await l.invoke("createPropertyEdit",{edit:d.editInstructions,propertyDefinition:{id:g,name:y.name,type:y.type,guidance:y.guidance,typeConfig:y.typeConfig},outputLocale:b,documentContext:void 0,currentValue:S,projectGuidance:a,componentGuidance:h.description,audienceGuidance:w});if(!_.success)throw new Error(_.summary??"Failed to edit property");return{result:_,update:d,propertyDefinition:y,currentLocale:b}})()));return c.forEach((d,f)=>{if(d.status==="rejected"){let m=t[f],h="fieldId"in m?m.fieldId:m.parameterId;i.push({summary:`Failed to edit property ${h}: ${"message"in d.reason?d.reason.message:"Unknown error"}`,success:!1})}}),c.filter(d=>d.status==="fulfilled").map(d=>d.value)}import{CANVAS_BLOCK_PARAM_TYPE as Tc,CANVAS_ENRICHMENT_TAG_PARAM as s3e,CANVAS_LOCALE_TAG_PARAM as iT,CANVAS_LOCALIZATION_SLOT as JZ,CANVAS_LOCALIZATION_TYPE as ait,CANVAS_PERSONALIZATION_PARAM as aT,CANVAS_PERSONALIZE_SLOT as l3e,CANVAS_SLOT_SECTION_SLOT as sit,CANVAS_SLOT_SECTION_TYPE as XZ,CANVAS_TEST_SLOT as u3e,CANVAS_TEST_VARIANT_PARAM as c3e,CANVAS_VIZ_CONTROL_PARAM as p0,convertToBindExpression as lit,createVariableReference as uit,getEffectivePropertyValue as d3e,walkNodeTree as m0}from"@uniformdev/canvas";var h0=J(zZ(),1),p3e=J(TS(),1);import{produce as _o}from"immer";import{bindVariablesToObject as Lot}from"@uniformdev/canvas";var rT="Untitled",P4e=60;function I4e({value:t,isNew:e,contentType:n}){let{result:r}=Lot({value:t,handleBinding:()=>"{token}",variables:{}}),o=n.entryName??"",i=(n.fields??[]).find(a=>a.id===o);if(typeof r=="string"){if(i?.type==="image")return r.length>0?`Image: ${Mot(r)}`:`${rT} image`;if(r.length>0)return i?.type==="date"?Aot(r)?kot(r):"Invalid date":f0(r)}else{if(typeof r=="number"||typeof r=="boolean")return r.toString();if(typeof r<"u"&&r!==null){if(i?.type==="link")return Oot(r);if(tne(r))return f0(zk(r.root));if(i?.type==="datetime"&&r){let a=r;return a.datetime&&F4e(a.datetime)?Pot(a.datetime):"Invalid datetime"}else return f0(Iot(r).description)}}return e?`New entry: ${n.name}`:rT}function Oot(t){return t?t.type==="projectMapNode"?t.path.length>0?`Link to ${f0(t.path)}`:`Link to project map node (${t.nodeId})`:t.path.length>0?`Link to ${f0(t.path)}`:`${rT} link`:`${rT} link`}function Mot(t){try{let{pathname:e,hostname:n}=new URL(t),r=e.split("/").filter(o=>o);return r.length>2?`/${r[0]}/.../${r[r.length-1]} (${f0(n)})`:`${e} (${f0(n)})`}catch{return t}}function f0(t){let e=t.split(" ").filter(i=>i).reverse();if(e.length<1)return rT;let n="",r=e.pop(),o=()=>n.length+(r?.length??0)+(n.length>0?1:0);for(;r&&o()<P4e;)n+=n.length>0?` ${r}`:r,r=e.pop();return n.length<1?`${t.slice(0,P4e)}...`:e.length>0?`${n}...`:n}var Rot=/^[1-9][0-9]{3}-[0-1][0-9]-[0-3][0-9]$/;function Aot(t){return Rot.test(t)?F4e(t):!1}function F4e(t){let e=new Date(t);return e instanceof Date&&!isNaN(Number(e))}function kot(t){return new Date(t).toLocaleDateString()}function Pot(t){return new Date(t).toLocaleString()}function Iot(t){let e=HZ(t);return e?{description:e,named:!0}:{description:Fot(t).valuePreview,named:!1}}function Fot(t){if(typeof t>"u")return{valueIcon:"close-o",valuePreview:"undefined"};if(t===null)return{valueIcon:"close-o",valuePreview:"null"};if(Array.isArray(t))return{valuePreview:`array with ${t.length} item${t.length!==1?"s":""}`,valueIcon:"list"};if(typeof t=="boolean")return{valuePreview:t.toString(),valueIcon:t?"check-r":"close-r"};if(typeof t=="number"||typeof t=="bigint")return{valuePreview:t.toString(10),valueIcon:"number-input"};if(typeof t=="object"){let e=Object.keys(t);return{valuePreview:`object with ${e.length} ${e.length!==1?"properties":"property"}`,valueIcon:"shape-hexagon"}}return{valuePreview:t,valueIcon:"text-input"}}var Bot=["displayName","name","_name","title","heading","label","parameters","fields","properties","entry","slug","_slug","alt","alt_description","description","results","items","entries","hits","value","id","objectID","identifier"];function HZ(t){if(typeof t=="string")return t;if(typeof t=="number")return t.toString(10);if(typeof t=="boolean")return t.toString();if(typeof t!="object"||t===null)return;if(Array.isArray(t)){if(t.length===0)return;let r=HZ(t[0]);return r?t.length===1?r:`${r} and ${t.length-1} other${t.length>2?"s":""}`:void 0}let n=t;for(let r of Bot)if(r in n){let o=HZ(n[r]);if(o)return o}}import{CANVAS_SLOT_SECTION_SLOT as zot,walkNodeTree as Vot}from"@uniformdev/canvas";var oT="|";function WL(t,e){if(!t)return e??ya();let n=t.split(oT),r=(e??ya()).split(oT);return n.at(-1)===r[0]&&n.pop(),n.concat(r).join(oT)}function z4e(t){let e=t.indexOf(oT);if(e<0)throw new Error(`Cannot remove pattern instance ID from ${t}`);return t.substring(e+1)}function KL(t,e,n=!1){Vot(t,({node:r,actions:{setDescendantsContext:o},context:i})=>{let a=!n&&!i?.currentParentPatternInstanceId,l="_pattern"in r&&!!r._pattern;if(i?.currentParentPatternInstanceId){let d=WL(i.currentParentPatternInstanceId,r._id);r._id=d}let c=i?.currentParentPatternInstanceId;l&&(c=r._id),"_overrides"in r&&r._overrides&&B4e(r._overrides,c,a),"_patternOverrides"in r&&r._patternOverrides&&B4e(r._patternOverrides,c,a),l&&o({currentParentPatternInstanceId:r._id})},{initialContext:{currentParentPatternInstanceId:e}})}var B4e=(t,e,n)=>{Object.entries(t).forEach(([r,o])=>{let i=n?r:WL(e,r);Object.entries(o.slots??{}).forEach(([a,l])=>{l.forEach(c=>{let{partOfNestedPattern:d}=GL(r??"");KL(c,a===zot&&!d?void 0:e,!0)})}),i&&(delete t[r],t[i]=o)})};function GL(t){let e=t.split(oT);return e.length===1?{partOfPattern:void 0,partOfNestedPattern:void 0}:e.length===2?{partOfPattern:e[0],partOfNestedPattern:void 0}:{partOfPattern:e[0],partOfNestedPattern:e[e.length-2]}}import{CANVAS_SLOT_SECTION_SLOT as K4e}from"@uniformdev/canvas";import{CANVAS_VIZ_CONTROL_PARAM as Wot}from"@uniformdev/canvas";import{CANVAS_ENRICHMENT_TAG_PARAM as V4e,CANVAS_INTENT_TAG_PARAM as Uot,CANVAS_LOCALE_TAG_PARAM as Hot,CANVAS_PERSONALIZATION_PARAM as U4e,CANVAS_TEST_VARIANT_PARAM as jot,CANVAS_VIZ_CONTROL_PARAM as H4e}from"@uniformdev/canvas";var j4e=[{id:Uot,name:"Intent Tag",type:"intentTag"},{id:Hot,name:"Locale Visibility",type:"localeSelect"},{id:U4e,name:"Personalization Criteria",type:U4e},{id:V4e,name:"Enrichment Tags",type:V4e,helpText:"Seeing this component will increase a visitor's score in these enrichments."},{id:jot,name:"A/B Test",type:"testVariant"},{id:H4e,name:"Visibility Control",type:H4e}];var Kot=j4e.reduce((t,e)=>(e.id===Wot||t.add(e.id),t),new Set);function gC(t,e){return Kot.has(e)?"yes":t?.parameters?.[e]??"no"}function jZ(t,e){e&&Object.entries(e).forEach(([n,r])=>{let o=t[n];if((r.parameters||o?.parameters)&&(t[n]??={},t[n].parameters={...r?.parameters,...o?.parameters}),(r.dataResources||o?.dataResources)&&(t[n]??={},t[n].dataResources={...r?.dataResources,...o?.dataResources}),r.slots||o?.slots){t[n]??={};let i=Object.entries(o?.slots??{}).reduce((a,[l,c])=>(a[l]&&Array.isArray(a[l])?a[l]=[...c,...a[l]]:a[l]=c,a),r.slots??{});t[n].slots=i}(r.variant!==void 0||o?.variant!==void 0)&&(t[n]=t[n]??{},t[n].variant=o?.variant??r?.variant)})}function W4e({applyOverrideToNode:t}){let e=new Set,n={};return{visitNode(r){e.add(r._id),jZ(n,r._overrides),jZ(n,r._patternOverrides);let o=n[r._id];o&&(o.parameters&&Object.keys(o.parameters).forEach(i=>{gC(r._overridability,i)==="no"&&(console.log(`[Override] Cleaned override from ${r._id} parameter ${i} because it is not overridable`),delete n[r._id].parameters?.[i])}),o.dataResources&&Object.keys(o.dataResources).forEach(i=>{r._patternDataResources?.[i]?.isPatternParameter||(console.log(`[Override] Cleaned override from ${r._id} data resource ${i} because it is not overridable`),delete n[r._id].dataResources?.[i])}),o.variant!==void 0&&(r._overridability?.variants||delete o.variant),t({node:r,overrides:o}))},overrides:n}}function WZ(t){let{beforeApplyParameterOverride:e,beforeApplyDataResourceOverride:n}=t??{};return W4e({applyOverrideToNode({node:r,overrides:o}){if(Object.entries(o.parameters??{}).map(([i,a])=>{r.parameters=r.parameters??{},e?.(r,i,a,r.parameters[i]);let l=r.parameters[i]??={type:a.type};a.locales||a.localesConditions?(l.locales??={},delete l.value,delete l.conditions,new Set([...Object.keys(a.locales??{}),...Object.keys(a.localesConditions??{})]).forEach(f=>{delete l.locales?.[f],delete l.localesConditions?.[f];let m=a.locales?.[f],h=a.localesConditions?.[f];m!=null&&(l.locales??={},l.locales[f]=m),h!=null&&(l.localesConditions??={},l.localesConditions[f]=h)}),l.locales&&Object.keys(l.locales).length===0&&delete l.locales,l.localesConditions&&Object.keys(l.localesConditions).length===0&&delete l.localesConditions):(delete l.locales,delete l.localesConditions,delete l.conditions,delete l.value,a.value!==null&&a.value!==void 0&&(l.value=a.value,l.connectedData=a.connectedData),a.conditions!==null&&a.conditions!==void 0&&(l.conditions=a.conditions)),!l.locales&&!l.localesConditions&&!l.conditions&&l.value===void 0&&delete r.parameters[i]}),Object.entries(o.dataResources??{}).forEach(([i,a])=>{n?.(r,i,a,r._dataResources?.[i]),r._dataResources??={},r._dataResources[i]=a}),o.variant!==void 0&&(r.variant=o.variant),o.slots){r.slots??={};let i=Object.keys(o.slots)[0];r.slots[K4e]??=[],r.slots[K4e]=[...o.slots[i]??[]]}}})}import{CANVAS_SLOT_SECTION_SLOT as Got,CANVAS_SLOT_SECTION_TYPE as Yot}from"@uniformdev/canvas";var G4e=({preserveOwnSlotSections:t=!1,preserveChildrenSlotSections:e=!1}={})=>n=>{if(n.node.type!==Yot)return;let{partOfPattern:r,partOfNestedPattern:o}=GL(n.node._id??"");!r&&!o&&t||r&&!o&&e||Zot(n)},Zot=({node:t,type:e,actions:n})=>{e!=="entry"&&(n.insertAfter(t.slots?.[Got]??[]),n.remove())};import{walkNodeTree as Xot}from"@uniformdev/canvas";import{produce as Qot}from"immer";import{CANVAS_SLOT_SECTION_SLOT as Y4e,walkNodeTree as qot}from"@uniformdev/canvas";import{produce as Jot}from"immer";function Z4e(t,e,n,r=ya()){if(!t._pattern)throw new Error("Not a pattern");let o={};return qot(t,({node:i,ancestorsAndSelf:a,actions:l})=>{let c=i._id,d=e[c];if(a.length===1)i._id=r;else{let m=a[0];m.type!=="slot"||m.parentSlot!==Y4e?(i._id=z4e(c),i._id=WL(r,i._id)):(l.replace({...o[c],_id:o[c]._id}),l.stopProcessingDescendants())}if(d){let m=Jot(d,h=>{h.slots&&Object.entries(h.slots).forEach(([g,y])=>{if(g!==Y4e)throw new Error("Only slot section items are supported for duplication");y.forEach((b,C)=>{if(!b._id)return;let S=YL(b,e,n);o[b._id]=S,y[C]=S})})});n?.(i._id,m,c)}}),r}function YL(t,e,n){return Qot(t,r=>{Xot(r,({type:o,node:i,actions:{stopProcessingDescendants:a}})=>{o==="component"&&i._pattern?(Z4e(i,e,n),a()):i._id=ya()})})}function ZL({locale:t,conditionIndex:e,property:n}){if(t===void 0)if(e<0){if(delete n.value,!n.conditions?.length)return!1}else n.conditions?.splice(e,1);else e<0?delete n.locales?.[t]:n.localesConditions?.[t]?.splice(e,1);if(n.localesConditions){for(let[r,o]of Object.entries(n.localesConditions))if(o.length===0){delete n.localesConditions[r];break}Object.keys(n.localesConditions).length===0&&delete n.localesConditions}return n.locales&&Object.keys(n.locales).length===0&&delete n.locales,n.conditions&&n.conditions.length===0&&delete n.conditions,!!(n.value!==void 0||n.locales||n.conditions||n.localesConditions)}function KZ({locale:t,conditionIndex:e,conditionDefinition:n,property:r,newPropertyValue:o}){t===void 0?e<0?r.value=o:(r.conditions??=[],q4e(r.conditions,e,n,o)):e<0?(r.locales??={},r.locales[t]=o):(r.localesConditions??={},r.localesConditions[t]??=[],q4e(r.localesConditions[t],e,n,o))}function q4e(t,e,n,r){if(e<0)throw new Error("Condition index must be greater than or equal to 0");let o=t[e];t[e]={when:n??o?.when??{clauses:[]},value:r===void 0?null:r,id:o?.id??eit(t)}}function eit(t){let e=new Set(t.map(r=>r.id)),n=0;for(;e.has(n);)n++;return n}function J4e(t){let e=!1,n={};return"_pattern"in t&&t._patternDataResources&&Object.entries(t._patternDataResources).forEach(([r,o])=>{e=!0,n[r]={...o,source:"patternDataResource"}}),t._dataResources&&Object.entries(t._dataResources).forEach(([r,o])=>{n[r]?n[r].isPatternParameter&&(e=!0,n[r]={...o,source:"dataResource"}):(e=!0,n[r]={...o,source:"dataResource"})}),e?n:void 0}import{CANVAS_DRAFT_STATE as tit,convertEntryToPutEntry as THt,getPropertiesValue as $Ht}from"@uniformdev/canvas";function X4e(t){let{fields:e,entryName:n,type:r="contentType",thumbnailField:o,...i}=t;return{...i,titleParameter:n,thumbnailParameter:o,parameters:e,canBeComposition:r==="block",permissions:t.permissions,useTeamPermissions:t.useTeamPermissions??!0,workflowId:t.workflowId}}function Q4e(t){return{id:t.id,name:t.name,entryName:t.titleParameter,thumbnailField:t.thumbnailParameter,fields:t.parameters,icon:t.icon,description:t.description,slugSettings:t.slugSettings,type:t.canBeComposition?"block":"contentType",created:t.created,updated:t.updated,permissions:t.permissions,useTeamPermissions:t.useTeamPermissions,workflowId:t.workflowId||void 0}}function qL(t){let{entry:{fields:e,...n},...r}=t;return{created:"",modified:"",composition:{_id:"",...n,_name:t.entry._name??"Untitled",parameters:e,_overridability:t.entry._overridability,_overrides:t.entry._overrides,_pattern:t.entry._pattern,_patternError:t.entry._patternError},pattern:!!t.pattern,previewImageUrl:t.entry._thumbnail,...r}}function e3e(t,e,n,r,o,i,a){let l=a??e.projectId;if(!l)throw new Error("projectId is required in currentEntry or explicitly");return{created:e.created??"",modified:e.modified??"",projectId:l,state:r??e.state??tit,releaseId:o??e.releaseId,workflowId:n?.workflowId??e.workflowId,workflowStageId:n?.workflowStageId??e.workflowStageId,editionId:i,editionName:n?.editionName??e.editionName,editionPriority:n?.editionPriority??e.editionPriority,pattern:e.pattern,entry:{type:t.type,_id:t._id,_name:t._name,_slug:t._slug??"",fields:t.parameters,_thumbnail:n?.previewImageUrl??void 0,_dataResources:t._dataResources,_pattern:t._pattern,_patternError:t._patternError,_overridability:t._overridability,_overrides:t._overrides,_locales:t._locales,_author:t._author,_authorSubject:t._authorSubject,_creator:t._creator,_creatorSubject:t._creatorSubject,_patternDataResources:t._patternDataResources}}}function GZ(t,e){let{parameters:n,...r}=t;return{...r,_id:e??r._id??"unknown",fields:n}}function YZ(t){let{fields:e,...n}=t;return{...n,parameters:e}}import{CANVAS_VIZ_LOCALE_RULE as nit}from"@uniformdev/canvas";import{produce as rit}from"immer";function t3e(t,e,n){let r=rit(t.criteria,o=>n3e(o,e,n));return r&&{...t,criteria:r}}function n3e(t,e,n){if(!t)return t;let r=!1;for(let o of t.clauses)if("clauses"in o){let i=n3e(o,e,n);if(i===null){if(t.op!=="|")return null;t.clauses.splice(t.clauses.indexOf(o),1),r=!0}else i!==void 0&&(t.clauses[t.clauses.indexOf(o)]=i,r=!0)}else if(o.rule===nit){let i=Array.isArray(o.value)?o.value:[o.value],a=i.includes(e),l=i.includes(n);if(!a&&!l||a&&l)continue;if(i.length===1&&l&&!a)return null;a&&!l&&(o.value=i.concat(n),r=!0)}return r?t:void 0}var r3e=J(zZ(),1);function ZZ(t,e){try{return(0,r3e.get)(t,e)}catch{return}}function qZ(t,e,n=0){let r=t.slice(n*4,n*4+4);if(!r)throw new Error("Failed to generate a default variation name");return`${e.startsWith("$")?e.slice(1):e}-${r}`}import{CANVAS_VIZ_LOCALE_RULE as oit}from"@uniformdev/canvas";import{produce as iit}from"immer";function o3e(t,e){let n=iit(t.criteria,r=>i3e(r,e));return n&&{...t,criteria:n}}function i3e(t,e){if(!t)return t;for(let n=t.clauses.length-1;n>=0;n--){let r=t.clauses[n];if("clauses"in r){let o=i3e(r,e);if(o)t.clauses[n]=o;else if(t.clauses.splice(n,1),o===null&&t.op!=="|")return null}else if(r.rule===oit){let o=Array.isArray(r.value)?r.value:[r.value],i=o.indexOf(e);if(i!==-1)if(Array.isArray(r.value)&&r.value.length>1)o.splice(i,1);else if(r.op.startsWith("!"))t.clauses.splice(n,1);else return null}}if(t.clauses.length!==0)return t}function a3e(t,e){let n=ES();if(process.env.NODE_ENV==="development"&&!e){let r=new Error().stack?.split(`
|
|
5178
|
+
`;await er();function D4e(t){let e=due({nodes:[gd,hd,PZ,rb,ob,cse,tpe,epe,npe,Af]});return e.update(()=>{use("skip-dom-selection"),sfe(t,mfe)},{discrete:!0}),e.getEditorState().toJSON()}function $4e({twee:t,nodeId:e,propertyId:n,propertyType:r,locale:o,propertyEdit:i,conditionIndex:a=-1}){let l=t.getNodeById(e);if(!l)throw new Error(`Node with ID ${e} not found`);if(i.action==="clearValue")t.updateNodeProperty({nodeId:e,property:n,value:null,source:"ai",locale:o,conditionIndex:-1});else if(i.action==="resetOverride")t.resetPatternPropertyOverride(e,n,o);else if(i.action==="setValue"){let c=bot({twee:t,targetNode:l,propertyId:n,propertyType:r,propertyEdit:i}),d=t.getNodeProperty(e,n);if(!o&&d?.locales)throw new Error(`The ${n} property is localized in ${Object.keys(d.locales).join(", ")}, but no locale was provided when setting its value. Please provide an explicit locale.`);if(n===got){let f=t.getParentInfo(e);if(f?.parentId){let m=t.getNodeProperty(f.parentId,hot);if(m?.value!==Cne)throw new Error(`Cannot edit personalization criteria when the parent personalization component is not using the Strongest Variation Match selection method. Current selection method: ${m?.value||"Top-down criteria matching"}.`)}}t.updateNodeProperty({nodeId:e,property:n,value:()=>c,source:"ai",locale:o,conditionIndex:a,type:r})}}var bot=({twee:t,targetNode:e,propertyId:n,propertyType:r,propertyEdit:o})=>{if(r==="richText")return D4e(o.newValue??"");if(r==="number")return Number(o.newValue);if(n===mot){if(yot(e.value.type))throw new Error("Enrichment tags are not allowed in system components.");if(t.getParentInfo(e.nodeId)?.parentId===vot)throw new Error("Enrichment tags are not allowed in personalization variants.")}return o.treatNewValueAsJson?JSON.parse(o.newValue):o.newValue};async function jL({twee:t,slotUpdates:e,propertyUpdates:n,localeUpdates:r,nameUpdate:o,slugUpdate:i,descriptionUpdate:a,currentEditorLocale:l,referenceData:c}){let d=[];o&&(t.updateRootNode({update:{_name:o}}),d.push({summary:"Updated name",success:!0})),i&&(t.updateRootNode({update:{_slug:i}}),d.push({summary:"Updated slug",success:!0})),a&&(t.updateRootMetadata({description:a}),d.push({summary:"Updated description",success:!0}));let f=await c.fetchDefinitions();await wot({slotUpdates:e,twee:t,definitions:f,referenceData:c,results:d});let m=d.some(g=>!g.success);if(e.moveComponentInstances?.forEach(g=>{if(!wS(g.componentId)){d.push({summary:`Skipped moving component ${g.componentId} because component IDs are UUIDs, and the value provided is not a valid UUID`,success:!1});return}if(!wS(g.newParentComponentId)){d.push({summary:`Skipped moving component ${g.componentId} because the new parent component ID is not a valid UUID`,success:!1});return}m?d.push({summary:`Skipped moving component ${g.componentId} because previous actions failed`,success:!1}):(t.moveNode({movedNodeId:g.componentId,parentNodeId:g.newParentComponentId,parentSlot:g.newSlotName,targetIndexInSlot:g.newSlotIndex}),d.push({summary:`Moved component ${g.componentId} to ${g.newParentComponentId} in slot ${g.newSlotName} at index ${g.newSlotIndex}`,success:!0}))}),m=d.some(g=>!g.success),e.duplicateComponentInstances)for(let g of e.duplicateComponentInstances)if(m)d.push({summary:`Skipped duplicating component ${g} because previous actions failed`,success:!1});else{let y=await t.duplicateNode(g,c.resolvePatternData);d.push({summary:`Duplicated component ${g}. The new duplicate has ID ${y} and is placed immediately after the original component in the same slot.`,success:!0})}return m=d.some(g=>!g.success),e.deleteComponentInstances?.forEach(g=>{if(!wS(g)){d.push({summary:`Skipped deleting component ${g} because component IDs are UUIDs, and the value provided is not a valid UUID`,success:!1});return}m?d.push({summary:`Skipped deleting component ${g} because previous actions failed`,success:!1}):(t.deleteNode(g,!1),d.push({summary:`Deleted component ${g}`,success:!0}))}),m=d.some(g=>!g.success),r?.enableLocales?.forEach(g=>{m?d.push({summary:`Skipped enabling locale ${g} because previous actions failed`,success:!1}):(t.enableLocale(g),d.push({summary:`Enabled locale ${g}`,success:!0}))}),m=d.some(g=>!g.success),r?.disableLocales?.forEach(g=>{m?d.push({summary:`Skipped disabling locale ${g} because previous actions failed`,success:!1}):(t.disableLocale(g),d.push({summary:`Disabled locale ${g}`,success:!0}))}),m=d.some(g=>!g.success),m?n.length>0&&d.push({summary:`Skipped ${n.length} property updates because previous actions failed`,success:!1}):(await Eot({propertyUpdates:n,twee:t,currentEditorLocale:l,referenceData:c,definitions:f,results:d})).forEach(y=>{if(!y.result.success)return;let b="componentId"in y.update?y.update.componentId:t.rootNodeId,C=vne({twee:t,nodeId:b,currentEditorLocale:y.currentLocale,definition:y.propertyDefinition}),S=(t.getNodeById(t.rootNodeId)?.value)._locales??[];if(C&&!S.includes(C)){d.push({summary:`The ${C} locale is not enabled on this entity. Please enable it before setting values in this locale.`,success:!1});return}if(y.result.action!=="nothing")try{$4e({twee:t,nodeId:b,propertyId:y.propertyDefinition.id,propertyType:y.propertyDefinition.type,locale:C,propertyEdit:y.result}),d.push({summary:`Updated value of ${y.propertyDefinition.id} on ${b}${C?` in ${C}`:""}`,success:!0})}catch(w){d.push({summary:`Failed to update value of ${y.propertyDefinition.id} on ${b}${C?` in ${C}`:""}: ${w instanceof Error?w.message:"Unknown error"}`,success:!1})}if("overridable"in y.update&&y.update.overridable!==void 0)if(y.propertyDefinition.type===xot)d.push({summary:`Cannot set overridability for block property '${y.propertyDefinition.id}' - blocks do not support overrides`,success:!1});else{let w=y.update.overridable;t.updateNode({nodeId:b,updateComponent:E=>{E._overridability??={},E._overridability.parameters??={},E._overridability.parameters[y.propertyDefinition.id]=w}}),d.push({summary:`Updated overridability for ${b}`,success:!0})}}),{success:d.every(g=>g.success),actionsTaken:d}}async function wot({slotUpdates:t,twee:e,definitions:n,referenceData:r,results:o}){(await Promise.allSettled(t.createComponentInstances?.map(async a=>{let l=e.getNodeById(a.parentComponentId);if(!l)throw new Error(`Parent component with ID ${a.parentComponentId} not found`);let c=n[l.value.type];if(!c)throw new Error(`Definition for parent component type ${l.value.type} not found`);let d=c.slots?.find(h=>h.id===a.slotName);if(!d)throw new Error(`Slot ${a.slotName} not found on component type ${l.value.type}`);let f=Wk({twee:e,parentSlotDefinition:d,nodeId:a.parentComponentId,componentDefinitionsIndex:n});if(!f)throw new Error(`Can't find allowed components inherited slot for ${a.slotName}`);let m=hne(f);if(a.instanceType==="component"){if(!a.componentType)throw new Error("componentType is required when inserting a component instance");if(!jk({type:a.componentType},m,!1))throw new Error(`Component type ${a.componentType} is not allowed in slot ${a.slotName}`);e.insertNode({node:{type:a.componentType},overrideNodeId:a.newComponentInstanceUuid,parentNodeId:a.parentComponentId,parentSlot:a.slotName,targetIndexInSlot:a.slotIndex}),o.push({summary:`Inserted component ${a.componentType} in slot ${a.slotName} ${a.slotIndex!==void 0?`at index ${a.slotIndex}`:""}`,success:!0})}else{if(!a.componentPatternId)throw new Error("componentPatternId is required when inserting a component pattern instance");let h=await r.resolvePatternData(a.componentPatternId);if(!h)throw new Error(`Pattern definition with ID ${a.componentPatternId} not found`);if(!jk({type:h.type,_pattern:a.componentPatternId},m,!1))throw new Error(`Pattern ${a.componentPatternId} is not allowed in slot ${a.slotName}`);e.insertPattern({pattern:h,patternInstanceId:a.newComponentInstanceUuid,parentNodeId:a.parentComponentId,parentSlot:a.slotName,targetIndexInSlot:a.slotIndex}),o.push({summary:`Inserted pattern ${h._name} in slot ${a.slotName} ${a.slotIndex!==void 0?`at index ${a.slotIndex}`:""}`,success:!0})}})??[])).forEach((a,l)=>{if(a.status==="rejected"){let c=t.createComponentInstances?.[l];console.error("Error inserting component",a.reason),o.push({summary:`Failed to insert component ${c?.newComponentInstanceUuid}: ${"message"in a.reason?a.reason.message:"Unknown error"}`,success:!1})}})}async function Eot({propertyUpdates:t,twee:e,currentEditorLocale:n,referenceData:r,definitions:o,results:i}){if(t.length===0)return[];let[a,l]=await Promise.all([r.fetchProjectGuidance(),r.getToolClient()]),c=await Promise.allSettled(t.map(async d=>(async()=>{let f="componentId"in d?d.componentId:e.rootNodeId,m=e.getNodeById(f);if(!m)throw new Error(`Component instance with ID ${f} not found`);let h=o[m.value.type];if(!h)throw new Error(`Definition with ID ${m.value.type} not found`);let g="fieldId"in d?d.fieldId:d.parameterId,y=h.parameters?.find(N=>N.id===g),b=d.locale??n,C=y??{id:g,type:"unknown"};if(d.editInstructions===void 0)return{result:{success:!0,newValue:"",treatNewValueAsJson:!1,action:"nothing"},update:d,propertyDefinition:C};if(d.editInstructions==="")return{result:{success:!0,newValue:"",treatNewValueAsJson:!1,action:"clearValue"},update:d,propertyDefinition:C};if(!y)throw new Error(`Property with ID ${g} not found`);let S=Cot({property:e.getNodeProperty(f,g),locale:b,conditionIndex:-1}),w,E=e.getNodeProperty(f,Sot);E?.value?.dim&&(w=await r.getDimensionGuidance(E.value.dim));let _=await l.invoke("createPropertyEdit",{edit:d.editInstructions,propertyDefinition:{id:g,name:y.name,type:y.type,guidance:y.guidance,typeConfig:y.typeConfig},outputLocale:b,documentContext:void 0,currentValue:S,projectGuidance:a,componentGuidance:h.description,audienceGuidance:w});if(!_.success)throw new Error(_.summary??"Failed to edit property");return{result:_,update:d,propertyDefinition:y,currentLocale:b}})()));return c.forEach((d,f)=>{if(d.status==="rejected"){let m=t[f],h="fieldId"in m?m.fieldId:m.parameterId;i.push({summary:`Failed to edit property ${h}: ${"message"in d.reason?d.reason.message:"Unknown error"}`,success:!1})}}),c.filter(d=>d.status==="fulfilled").map(d=>d.value)}import{CANVAS_BLOCK_PARAM_TYPE as Tc,CANVAS_ENRICHMENT_TAG_PARAM as s3e,CANVAS_LOCALE_TAG_PARAM as iT,CANVAS_LOCALIZATION_SLOT as JZ,CANVAS_LOCALIZATION_TYPE as ait,CANVAS_PERSONALIZATION_PARAM as aT,CANVAS_PERSONALIZE_SLOT as l3e,CANVAS_SLOT_SECTION_SLOT as sit,CANVAS_SLOT_SECTION_TYPE as XZ,CANVAS_TEST_SLOT as u3e,CANVAS_TEST_VARIANT_PARAM as c3e,CANVAS_VIZ_CONTROL_PARAM as p0,convertToBindExpression as lit,createVariableReference as uit,getEffectivePropertyValue as d3e,walkNodeTree as m0}from"@uniformdev/canvas";var h0=J(zZ(),1),p3e=J(TS(),1);import{produce as _o}from"immer";import{bindVariablesToObject as Lot}from"@uniformdev/canvas";var rT="Untitled",P4e=60;function I4e({value:t,isNew:e,contentType:n}){let{result:r}=Lot({value:t,handleBinding:()=>"{token}",variables:{}}),o=n.entryName??"",i=(n.fields??[]).find(a=>a.id===o);if(typeof r=="string"){if(i?.type==="image")return r.length>0?`Image: ${Mot(r)}`:`${rT} image`;if(r.length>0)return i?.type==="date"?Aot(r)?kot(r):"Invalid date":f0(r)}else{if(typeof r=="number"||typeof r=="boolean")return r.toString();if(typeof r<"u"&&r!==null){if(i?.type==="link")return Oot(r);if(tne(r))return f0(zk(r.root));if(i?.type==="datetime"&&r){let a=r;return a.datetime&&F4e(a.datetime)?Pot(a.datetime):"Invalid datetime"}else return f0(Iot(r).description)}}return e?`New entry: ${n.name}`:rT}function Oot(t){return t?t.type==="projectMapNode"?t.path.length>0?`Link to ${f0(t.path)}`:`Link to project map node (${t.nodeId})`:t.path.length>0?`Link to ${f0(t.path)}`:`${rT} link`:`${rT} link`}function Mot(t){try{let{pathname:e,hostname:n}=new URL(t),r=e.split("/").filter(o=>o);return r.length>2?`/${r[0]}/.../${r[r.length-1]} (${f0(n)})`:`${e} (${f0(n)})`}catch{return t}}function f0(t){let e=t.split(" ").filter(i=>i).reverse();if(e.length<1)return rT;let n="",r=e.pop(),o=()=>n.length+(r?.length??0)+(n.length>0?1:0);for(;r&&o()<P4e;)n+=n.length>0?` ${r}`:r,r=e.pop();return n.length<1?`${t.slice(0,P4e)}...`:e.length>0?`${n}...`:n}var Rot=/^[1-9][0-9]{3}-[0-1][0-9]-[0-3][0-9]$/;function Aot(t){return Rot.test(t)?F4e(t):!1}function F4e(t){let e=new Date(t);return e instanceof Date&&!isNaN(Number(e))}function kot(t){return new Date(t).toLocaleDateString()}function Pot(t){return new Date(t).toLocaleString()}function Iot(t){let e=HZ(t);return e?{description:e,named:!0}:{description:Fot(t).valuePreview,named:!1}}function Fot(t){if(typeof t>"u")return{valueIcon:"close-o",valuePreview:"undefined"};if(t===null)return{valueIcon:"close-o",valuePreview:"null"};if(Array.isArray(t))return{valuePreview:`array with ${t.length} item${t.length!==1?"s":""}`,valueIcon:"list"};if(typeof t=="boolean")return{valuePreview:t.toString(),valueIcon:t?"check-r":"close-r"};if(typeof t=="number"||typeof t=="bigint")return{valuePreview:t.toString(10),valueIcon:"number-input"};if(typeof t=="object"){let e=Object.keys(t);return{valuePreview:`object with ${e.length} ${e.length!==1?"properties":"property"}`,valueIcon:"shape-hexagon"}}return{valuePreview:t,valueIcon:"text-input"}}var Bot=["displayName","name","_name","title","heading","label","parameters","fields","properties","entry","slug","_slug","alt","alt_description","description","results","items","entries","hits","value","id","objectID","identifier"];function HZ(t){if(typeof t=="string")return t;if(typeof t=="number")return t.toString(10);if(typeof t=="boolean")return t.toString();if(typeof t!="object"||t===null)return;if(Array.isArray(t)){if(t.length===0)return;let r=HZ(t[0]);return r?t.length===1?r:`${r} and ${t.length-1} other${t.length>2?"s":""}`:void 0}let n=t;for(let r of Bot)if(r in n){let o=HZ(n[r]);if(o)return o}}import{CANVAS_SLOT_SECTION_SLOT as zot,walkNodeTree as Vot}from"@uniformdev/canvas";var oT="|";function WL(t,e){if(!t)return e??ya();let n=t.split(oT),r=(e??ya()).split(oT);return n.at(-1)===r[0]&&n.pop(),n.concat(r).join(oT)}function z4e(t){let e=t.indexOf(oT);if(e<0)throw new Error(`Cannot remove pattern instance ID from ${t}`);return t.substring(e+1)}function KL(t,e,n=!1){Vot(t,({node:r,actions:{setDescendantsContext:o},context:i})=>{let a=!n&&!i?.currentParentPatternInstanceId,l="_pattern"in r&&!!r._pattern;if(i?.currentParentPatternInstanceId){let d=WL(i.currentParentPatternInstanceId,r._id);r._id=d}let c=i?.currentParentPatternInstanceId;l&&(c=r._id),"_overrides"in r&&r._overrides&&B4e(r._overrides,c,a),"_patternOverrides"in r&&r._patternOverrides&&B4e(r._patternOverrides,c,a),l&&o({currentParentPatternInstanceId:r._id})},{initialContext:{currentParentPatternInstanceId:e}})}var B4e=(t,e,n)=>{Object.entries(t).forEach(([r,o])=>{let i=n?r:WL(e,r);Object.entries(o.slots??{}).forEach(([a,l])=>{l.forEach(c=>{let{partOfNestedPattern:d}=GL(r??"");KL(c,a===zot&&!d?void 0:e,!0)})}),i&&(delete t[r],t[i]=o)})};function GL(t){let e=t.split(oT);return e.length===1?{partOfPattern:void 0,partOfNestedPattern:void 0}:e.length===2?{partOfPattern:e[0],partOfNestedPattern:void 0}:{partOfPattern:e[0],partOfNestedPattern:e[e.length-2]}}import{CANVAS_SLOT_SECTION_SLOT as K4e}from"@uniformdev/canvas";import{CANVAS_VIZ_CONTROL_PARAM as Wot}from"@uniformdev/canvas";import{CANVAS_ENRICHMENT_TAG_PARAM as V4e,CANVAS_INTENT_TAG_PARAM as Uot,CANVAS_LOCALE_TAG_PARAM as Hot,CANVAS_PERSONALIZATION_PARAM as U4e,CANVAS_TEST_VARIANT_PARAM as jot,CANVAS_VIZ_CONTROL_PARAM as H4e}from"@uniformdev/canvas";var j4e=[{id:Uot,name:"Intent Tag",type:"intentTag"},{id:Hot,name:"Locale Visibility",type:"localeSelect"},{id:U4e,name:"Personalization Criteria",type:U4e},{id:V4e,name:"Enrichment Tags",type:V4e,helpText:"Seeing this component will increase a visitor's score in these enrichments."},{id:jot,name:"A/B Test",type:"testVariant"},{id:H4e,name:"Visibility Control",type:H4e}];var Kot=j4e.reduce((t,e)=>(e.id===Wot||t.add(e.id),t),new Set);function gC(t,e){return Kot.has(e)?"yes":t?.parameters?.[e]??"no"}function jZ(t,e){e&&Object.entries(e).forEach(([n,r])=>{let o=t[n];if((r.parameters||o?.parameters)&&(t[n]??={},t[n].parameters={...r?.parameters,...o?.parameters}),(r.dataResources||o?.dataResources)&&(t[n]??={},t[n].dataResources={...r?.dataResources,...o?.dataResources}),r.slots||o?.slots){t[n]??={};let i=Object.entries(o?.slots??{}).reduce((a,[l,c])=>(a[l]&&Array.isArray(a[l])?a[l]=[...c,...a[l]]:a[l]=c,a),r.slots??{});t[n].slots=i}(r.variant!==void 0||o?.variant!==void 0)&&(t[n]=t[n]??{},t[n].variant=o?.variant??r?.variant)})}function W4e({applyOverrideToNode:t}){let e=new Set,n={};return{visitNode(r){e.add(r._id),jZ(n,r._overrides),jZ(n,r._patternOverrides);let o=n[r._id];o&&(o.parameters&&Object.keys(o.parameters).forEach(i=>{gC(r._overridability,i)==="no"&&(console.log(`[Override] Cleaned override from ${r._id} parameter ${i} because it is not overridable`),delete n[r._id].parameters?.[i])}),o.dataResources&&Object.keys(o.dataResources).forEach(i=>{r._patternDataResources?.[i]?.isPatternParameter||(console.log(`[Override] Cleaned override from ${r._id} data resource ${i} because it is not overridable`),delete n[r._id].dataResources?.[i])}),o.variant!==void 0&&(r._overridability?.variants||delete o.variant),t({node:r,overrides:o}))},overrides:n}}function WZ(t){let{beforeApplyParameterOverride:e,beforeApplyDataResourceOverride:n}=t??{};return W4e({applyOverrideToNode({node:r,overrides:o}){if(Object.entries(o.parameters??{}).map(([i,a])=>{r.parameters=r.parameters??{},e?.(r,i,a,r.parameters[i]);let l=r.parameters[i]??={type:a.type};a.locales||a.localesConditions?(l.locales??={},delete l.value,delete l.conditions,new Set([...Object.keys(a.locales??{}),...Object.keys(a.localesConditions??{})]).forEach(f=>{delete l.locales?.[f],delete l.localesConditions?.[f];let m=a.locales?.[f],h=a.localesConditions?.[f];m!=null&&(l.locales??={},l.locales[f]=m),h!=null&&(l.localesConditions??={},l.localesConditions[f]=h)}),l.locales&&Object.keys(l.locales).length===0&&delete l.locales,l.localesConditions&&Object.keys(l.localesConditions).length===0&&delete l.localesConditions):(delete l.locales,delete l.localesConditions,delete l.conditions,delete l.value,a.value!==null&&a.value!==void 0&&(l.value=a.value,l.connectedData=a.connectedData),a.conditions!==null&&a.conditions!==void 0&&(l.conditions=a.conditions)),!l.locales&&!l.localesConditions&&!l.conditions&&l.value===void 0&&delete r.parameters[i]}),Object.entries(o.dataResources??{}).forEach(([i,a])=>{n?.(r,i,a,r._dataResources?.[i]),r._dataResources??={},r._dataResources[i]=a}),o.variant!==void 0&&(r.variant=o.variant),o.slots){r.slots??={};let i=Object.keys(o.slots)[0];r.slots[K4e]??=[],r.slots[K4e]=[...o.slots[i]??[]]}}})}import{CANVAS_SLOT_SECTION_SLOT as Got,CANVAS_SLOT_SECTION_TYPE as Yot}from"@uniformdev/canvas";var G4e=({preserveOwnSlotSections:t=!1,preserveChildrenSlotSections:e=!1}={})=>n=>{if(n.node.type!==Yot)return;let{partOfPattern:r,partOfNestedPattern:o}=GL(n.node._id??"");!r&&!o&&t||r&&!o&&e||Zot(n)},Zot=({node:t,type:e,actions:n})=>{e!=="entry"&&(n.insertAfter(t.slots?.[Got]??[]),n.remove())};import{walkNodeTree as Xot}from"@uniformdev/canvas";import{produce as Qot}from"immer";import{CANVAS_SLOT_SECTION_SLOT as Y4e,walkNodeTree as qot}from"@uniformdev/canvas";import{produce as Jot}from"immer";function Z4e(t,e,n,r=ya()){if(!t._pattern)throw new Error("Not a pattern");let o={};return qot(t,({node:i,ancestorsAndSelf:a,actions:l})=>{let c=i._id,d=e[c];if(a.length===1)i._id=r;else{let m=a[0];m.type!=="slot"||m.parentSlot!==Y4e?(i._id=z4e(c),i._id=WL(r,i._id)):(l.replace({...o[c],_id:o[c]._id}),l.stopProcessingDescendants())}if(d){let m=Jot(d,h=>{h.slots&&Object.entries(h.slots).forEach(([g,y])=>{if(g!==Y4e)throw new Error("Only slot section items are supported for duplication");y.forEach((b,C)=>{if(!b._id)return;let S=YL(b,e,n);o[b._id]=S,y[C]=S})})});n?.(i._id,m,c)}}),r}function YL(t,e,n){return Qot(t,r=>{Xot(r,({type:o,node:i,actions:{stopProcessingDescendants:a}})=>{o==="component"&&i._pattern?(Z4e(i,e,n),a()):i._id=ya()})})}function ZL({locale:t,conditionIndex:e,property:n}){if(t===void 0)if(e<0){if(delete n.value,!n.conditions?.length)return!1}else n.conditions?.splice(e,1);else e<0?delete n.locales?.[t]:n.localesConditions?.[t]?.splice(e,1);if(n.localesConditions){for(let[r,o]of Object.entries(n.localesConditions))if(o.length===0){delete n.localesConditions[r];break}Object.keys(n.localesConditions).length===0&&delete n.localesConditions}return n.locales&&Object.keys(n.locales).length===0&&delete n.locales,n.conditions&&n.conditions.length===0&&delete n.conditions,!!(n.value!==void 0||n.locales||n.conditions||n.localesConditions)}function KZ({locale:t,conditionIndex:e,conditionDefinition:n,property:r,newPropertyValue:o}){t===void 0?e<0?r.value=o:(r.conditions??=[],q4e(r.conditions,e,n,o)):e<0?(r.locales??={},r.locales[t]=o):(r.localesConditions??={},r.localesConditions[t]??=[],q4e(r.localesConditions[t],e,n,o))}function q4e(t,e,n,r){if(e<0)throw new Error("Condition index must be greater than or equal to 0");let o=t[e];t[e]={when:n??o?.when??{clauses:[]},value:r===void 0?null:r,id:o?.id??eit(t)}}function eit(t){let e=new Set(t.map(r=>r.id)),n=0;for(;e.has(n);)n++;return n}function J4e(t){let e=!1,n={};return"_pattern"in t&&t._patternDataResources&&Object.entries(t._patternDataResources).forEach(([r,o])=>{e=!0,n[r]={...o,source:"patternDataResource"}}),t._dataResources&&Object.entries(t._dataResources).forEach(([r,o])=>{n[r]?n[r].isPatternParameter&&(e=!0,n[r]={...o,source:"dataResource"}):(e=!0,n[r]={...o,source:"dataResource"})}),e?n:void 0}import{CANVAS_DRAFT_STATE as tit,convertEntryToPutEntry as THt,getPropertiesValue as $Ht}from"@uniformdev/canvas";function X4e(t){let{fields:e,entryName:n,type:r="contentType",thumbnailField:o,...i}=t;return{...i,titleParameter:n,thumbnailParameter:o,parameters:e,canBeComposition:r==="block",permissions:t.permissions,useTeamPermissions:t.useTeamPermissions??!0,workflowId:t.workflowId}}function Q4e(t){return{id:t.id,name:t.name,entryName:t.titleParameter,thumbnailField:t.thumbnailParameter,fields:t.parameters,icon:t.icon,description:t.description,slugSettings:t.slugSettings,type:t.canBeComposition?"block":"contentType",created:t.created,updated:t.updated,permissions:t.permissions,useTeamPermissions:t.useTeamPermissions,workflowId:t.workflowId||void 0}}function qL(t){let{entry:{fields:e,...n},...r}=t;return{created:"",modified:"",composition:{_id:"",...n,_name:t.entry._name??"Untitled",parameters:e,_overridability:t.entry._overridability,_overrides:t.entry._overrides,_pattern:t.entry._pattern,_patternError:t.entry._patternError},pattern:!!t.pattern,previewImageUrl:t.entry._thumbnail,...r}}function e3e(t,e,n,r,o,i,a){let l=a??e.projectId;if(!l)throw new Error("projectId is required in currentEntry or explicitly");return{created:e.created??"",modified:e.modified??"",projectId:l,state:r??e.state??tit,releaseId:o??e.releaseId,workflowId:n?.workflowId??e.workflowId,workflowStageId:n?.workflowStageId??e.workflowStageId,editionId:i,editionName:n?.editionName??e.editionName,editionPriority:n?.editionPriority??e.editionPriority,pattern:e.pattern,entry:{type:t.type,_id:t._id,_name:t._name,_slug:t._slug??"",fields:t.parameters,_thumbnail:n?.previewImageUrl??void 0,_dataResources:t._dataResources,_pattern:t._pattern,_patternError:t._patternError,_overridability:t._overridability,_overrides:t._overrides,_locales:t._locales,_author:t._author,_authorSubject:t._authorSubject,_creator:t._creator,_creatorSubject:t._creatorSubject,_patternDataResources:t._patternDataResources}}}function GZ(t,e){let{parameters:n,...r}=t;return{...r,_id:e??r._id??"unknown",fields:n}}function YZ(t){let{fields:e,...n}=t;return{...n,parameters:e}}import{CANVAS_VIZ_LOCALE_RULE as nit}from"@uniformdev/canvas";import{produce as rit}from"immer";function t3e(t,e,n){let r=rit(t.criteria,o=>n3e(o,e,n));return r&&{...t,criteria:r}}function n3e(t,e,n){if(!t)return t;let r=!1;for(let o of t.clauses)if("clauses"in o){let i=n3e(o,e,n);if(i===null){if(t.op!=="|")return null;t.clauses.splice(t.clauses.indexOf(o),1),r=!0}else i!==void 0&&(t.clauses[t.clauses.indexOf(o)]=i,r=!0)}else if(o.rule===nit){let i=Array.isArray(o.value)?o.value:[o.value],a=i.includes(e),l=i.includes(n);if(!a&&!l||a&&l)continue;if(i.length===1&&l&&!a)return null;a&&!l&&(o.value=i.concat(n),r=!0)}return r?t:void 0}var r3e=J(zZ(),1);function ZZ(t,e){try{return(0,r3e.get)(t,e)}catch{return}}function qZ(t,e,n=0){let r=t.slice(n*4,n*4+4);if(!r)throw new Error("Failed to generate a default variation name");return`${e.startsWith("$")?e.slice(1):e}-${r}`}import{CANVAS_VIZ_LOCALE_RULE as oit}from"@uniformdev/canvas";import{produce as iit}from"immer";function o3e(t,e){let n=iit(t.criteria,r=>i3e(r,e));return n&&{...t,criteria:n}}function i3e(t,e){if(!t)return t;for(let n=t.clauses.length-1;n>=0;n--){let r=t.clauses[n];if("clauses"in r){let o=i3e(r,e);if(o)t.clauses[n]=o;else if(t.clauses.splice(n,1),o===null&&t.op!=="|")return null}else if(r.rule===oit){let o=Array.isArray(r.value)?r.value:[r.value],i=o.indexOf(e);if(i!==-1)if(Array.isArray(r.value)&&r.value.length>1)o.splice(i,1);else if(r.op.startsWith("!"))t.clauses.splice(n,1);else return null}}if(t.clauses.length!==0)return t}function a3e(t,e){let n=ES();if(process.env.NODE_ENV==="development"&&!e){let r=new Error().stack?.split(`
|
|
5179
5179
|
`).slice(2).join(`
|
|
5180
|
-
`).trimStart();n.on("*",(o,i)=>{console.debug(`\u26A1\uFE0F ${t}:${String(o)}`,{args:i,stack:r,subs:n.all.get(String(o))?.length??0})})}return n}var _u=(0,p3e.default)(),cit=!0,dit="Twee",jh=class t{#e={};rootNodeId;#r={};#o={};#n;#i={};#t=a3e(dit,cit);#u;#c;#h;#d;#s;#a;#y;constructor(e,n){let{metadata:r,startDirty:o}=n||{};this.#s=r??{},this.#a={_name:e?._name??"",_slug:e?._slug??null},this.#d=!o,this.#y=n?.temp_disableDataResourceOverrideCreation??!1;let i=_o(e,a=>{this.#v({composition:a,ignoreRootOverrides:!0,preserveChildrenSlotSections:!0}),delete a._author,delete a._authorSubject,delete a._creator,delete a._creatorSubject});this.rootNodeId=i._id??ya(),this.#u=this.rootNodeId,this.#l({componentTree:i,nodeId:this.rootNodeId}),this.#n=i._overrides??{}}events=this.#t;exportTree(e){return this.exportSubtree(this.rootNodeId,e)}exportMetadata(){return this.#s}exportRootNodeMetadata(){return this.#a}get pristine(){return this.#d}set pristine(e){this.#d!==e&&(this.#d=e,this.#t.emit("pristineChanged",{pristine:e}))}get selectedBlockIdStack(){return this.#c}set selectedBlockIdStack(e){this.#c=e,this.#t.emit("selectedBlockChanged",{selectedBlockIds:this.#c})}get selectedNodeId(){return this.#u}set selectedNodeId(e){this.#u!==e&&(this.#u=e,this.selectedParameterId=void 0,this.#t.emit("selectedNodeChanged",{selectedNodeId:e}))}get selectedParameterId(){return this.#h}set selectedParameterId(e){this.#h!==e&&(this.#h=e,this.#t.emit("selectedParameterChanged",{selectedParameterId:e}))}pushSelectedBlockId(e){this.selectedBlockIdStack=this.selectedBlockIdStack??[],this.selectedBlockIdStack?.push(e),this.#t.emit("selectedBlockChanged",{selectedBlockIds:this.selectedBlockIdStack})}popSelectedBlockId(){this.#c?.pop(),this.#t.emit("selectedBlockChanged",{selectedBlockIds:this.selectedBlockIdStack})}getNodeById(e){return this.#e[e]}getNodesIndex(){return this.#e}getBlockNodeValueById(e){return GZ(this.exportSubtree(e),e)}getNodeChildren(e){let n=this.#r[e];if(n)return n}getNodeProperty(e,n){return ZZ(this.#o,[e,n])}getNodeProperties(e){return this.#o[e]??{}}insertNode({node:e,parentNodeId:n,parentSlot:r,targetIndexInSlot:o,overrideNodeId:i}){let a=i??ya(),l={nodeId:a,parentId:n,value:t.#T(e),isExpandedInUI:!0,propertyValueLocalizability:{}};return this.#w({node:l,parentNodeId:n,parentSlot:r,targetIndexInSlot:o}),this.#m({nodeId:a,destinationParentId:n,destinationSlotName:r}),this.pristine=!1,this.#t.emit("nodeChanged",{changedNode:l,oldValue:void 0,type:"new"}),this.#t.emit("childrenChanged",{parentId:n,slotOrBlockName:r,newChildIds:this.#r[n][r],type:"slot"}),a}upsertBlockNode({nodeId:e,property:n,index:r,entry:o}){let i=this.#E({nodeId:e,property:n,index:r,entry:o});return this.pristine=!1,this.#t.emit("childrenChanged",{parentId:e,slotOrBlockName:n,newChildIds:this.#o[e]?.[n]?.value,type:"block"}),i}updateRootMetadata(e){let n={...this.#s};this.#s={...this.#s,...e},this.pristine=!1,this.#t.emit("metadataChanged",{metadata:this.#s,oldValue:n})}updateRootNode({update:e,doNotSetDirty:n}){let r={...this.#a};this.#a={...this.#a,...e},n||(this.pristine=!1),this.#t.emit("rootNodeMetadataChanged",{metadata:this.#a,oldValue:r})}insertPattern({parentNodeId:e,parentSlot:n,pattern:r,targetIndexInSlot:o,patternInstanceId:i}){let a=i??ya();if(this.#e[a])throw new Error(`Node with ID '${a}' already exists. Pattern nodes must have unique IDs.`);let l=this.#x(r,a,!1);return this.#f({nodeId:l,parentNodeId:e,parentSlot:n,targetIndexInSlot:o}),this.#m({nodeId:l,destinationParentId:e,destinationSlotName:n}),this.pristine=!1,this.visitNodeAndDescendants(l,c=>{this.#t.emit("nodeChanged",{changedNode:c,oldValue:void 0,type:"new"})}),this.#t.emit("childrenChanged",{parentId:e,slotOrBlockName:n,newChildIds:this.#r[e][n],type:"slot"}),l}unlinkPattern(e){let n=this.#e[e];if(!n)throw new Error(`Node ${e} does not exist`);if(!n.value._pattern)throw new Error(`Node ${e} is not a pattern`);let r=n.value._patternDataResources||n.value._dataResources,o=J4e(n.value),i=l=>{l.partOfNestedPattern||(this.updateNode({nodeId:l.nodeId,updateComponent:c=>{delete c._pattern,delete c._patternError,delete c._overrides},updateMetadata:c=>{delete c.partOfPattern,delete c.partOfNestedPattern},doNotSetDirty:!0,ignoreOverrides:!0}),this.#n[l.nodeId]&&(this.#n=_o(this.#n,c=>{delete c[l.nodeId]})))};this.visitNodeAndDescendants(e,i);let a=l=>{l.partOfNestedPattern&&this.updateNode({nodeId:l.nodeId,updateMetadata:c=>{c.partOfPattern=c.partOfNestedPattern,delete c.partOfNestedPattern},doNotSetDirty:!0,ignoreOverrides:!0})};this.visitNodeAndDescendants(e,a),r&&(this.updateNode({nodeId:this.rootNodeId,updateDataResources:l=>Object.entries(o??{}).filter(([c])=>!(c in(l??{}))).map(([c,d])=>{let{source:f,...m}=d;return{type:"set",name:c,value:m}})}),this.updateNode({nodeId:n.nodeId,updateComponent:l=>{delete l._patternDataResources},updateDataResources:"removeAll",doNotSetDirty:!0,ignoreOverrides:!0})),this.pristine=!1}convertToPattern({existingNodeId:e,pattern:n}){let r=this.#e[e],o=r?.parentId;if(!r)throw new Error(`Node ${e} does not exist`);let i=this.#x(n,e,!0);this.#e[i]=_o(this.#e[i],l=>{l.parentId=o}),this.pristine=!1;let a=this.#e[i];this.#t.emit("nodeChanged",{changedNode:a,oldValue:r,type:"new"}),Object.entries(this.#r[i]??{}).forEach(([l,c])=>{this.#t.emit("childrenChanged",{newChildIds:c,parentId:i,slotOrBlockName:l,type:"slot"})})}copyNodeToClipboard(e){let n=this.exportSubtree(e,{keepPatternData:!1}),r=this.exportSubtree(e,{keepPatternData:!0}),o=[];m0(r,({node:l})=>{l._id&&o.push(l._id)}),m0(n,({node:l})=>{l._id&&(l._overrides&&delete l._overrides,"_name"in l&&delete l._name,"_slug"in l&&delete l._slug)});let i=this.#g(),a=Object.entries(i??{}).reduce((l,[c,d])=>(o.some(f=>c.includes(f))&&(l[c]=d),l),{});return{format:"uniform/copied-component-subtree-1.0",componentData:n,overrides:Object.keys(a).length?a:void 0,pasteAs:this.getNodeById(e)?.isBlock?"block":void 0}}async pasteNodeFromClipboard({parentNodeId:e,parentSlot:n,targetIndexInParent:r,clipboard:o,resolvePattern:i}){let a=_u(o),l=async d=>{d._pattern&&c.push((async()=>{let f=await i(d._pattern);if(!f){console.debug(`Pasted pattern ${d._pattern} not found, skipping`);return}let m=this.#C(f,d._id);Object.assign(d,m)})())},c=[];return m0(a.componentData,({node:d})=>{l(d)}),a.overrides&&Object.values(a.overrides).forEach(d=>{d.slots&&Object.values(d.slots).forEach(f=>{f.forEach(m=>{m0(m,({node:h})=>{l(h)})})})}),await Promise.all(c),this.#_(a.componentData,{parentId:e,parentName:n,parentType:o.pasteAs==="block"?"block":"slot",targetIndexInParent:r},a.overrides)}enableLocale(e){this.updateNode({nodeId:this.rootNodeId,updateComponent:n=>{let r=n;r._locales??=[];let o=[...new Set([...r._locales,...Array.isArray(e)?e:[e]])];r._locales=o}})}disableLocale(e){this.updateNode({nodeId:this.rootNodeId,updateComponent:o=>{let i=o;i._locales=i._locales?.filter(a=>a!==e)}});let n=[],r=o=>{this.getNodeProperty(o.nodeId,iT)?.value===e&&!o.partOfPattern&&n.push(o.nodeId);let a=this.getNodeProperties(o.nodeId);Object.entries(a).forEach(([c,d])=>{let f=d;c!==p0&&(o.partOfPattern?this.isPatternPropertyOverridden(o.nodeId,c,e)&&this.resetPatternPropertyOverride(o.nodeId,c,e):(f?.localesConditions?.[e]?.forEach((m,h)=>{this.updateNodeProperty({nodeId:o.nodeId,property:c,value:void 0,source:"other",locale:e,conditionIndex:h,conditionDefinition:null})}),f?.locales?.[e]!==void 0&&this.updateNodeProperty({nodeId:o.nodeId,property:c,value:void 0,source:"other",locale:e,conditionIndex:-1})))});let l=this.getNodeProperty(o.nodeId,p0);if(l?.value){let c=o3e(l.value,e);c===null?n.push(o.nodeId):this.updateNodeProperty({nodeId:o.nodeId,property:p0,value:c?()=>c:void 0,source:"other",locale:void 0,conditionIndex:-1})}};this.visitNodeAndDescendants(this.rootNodeId,r),n.forEach(o=>{this.deleteNode(o)})}copyValuesToLocalePlan({sourceLocale:e,destinationLocale:n,doNotCopyDescendants:r=!1,startingNodeId:o=this.rootNodeId,specificPropertyId:i}){let a=new Map,l=d=>{if(d.value.type===ait&&!d.partOfPattern){let m=this.getNodeChildren(d.nodeId)?.[JZ]??[],h=m.map(b=>this.getNodeProperty(b,iT)),g=h.findIndex(b=>b?.value===n);if(g>=0){let b=m[g];Hh(a,b).actions.push({type:"deleteLocalizedNode"})}let y=h.findIndex(b=>b?.value===e);if(y>=0){let b=m[y];Hh(a,b).actions.push({type:"duplicateLocalizedNode",targetIndexInSlot:g})}}if(a.get(d.nodeId)?.actions.some(m=>m.type==="deleteLocalizedNode"))return;let f=i?{[i]:this.getNodeProperty(d.nodeId,i)}:this.getNodeProperties(d.nodeId);Object.entries(f).forEach(([m,h])=>{if(h===void 0)return;let g=!d.partOfPattern,y=gC(d.value._overridability,m)==="yes";if(!(g||y))return;if(m===p0){let $=t3e(h.value,e,n);$===null?Hh(a,d.nodeId).actions.push({type:"deleteLocalizedNode"}):$&&Hh(a,d.nodeId).actions.push({type:"updateVisibilityCriteria",targetValue:$})}let C=h.locales?.[e],S=h.locales?.[n];(!C||!S||!ba(C,S))&&(C!==void 0?Hh(a,d.nodeId).actions.push({type:"copyPropertyValue",propertyId:m,sourceValue:C,targetValue:S,conditionIndex:-1}):S!==void 0&&Hh(a,d.nodeId).actions.push({type:"deletePropertyValue",propertyId:m,sourceValue:C,targetValue:S,conditionIndex:-1}));let w=h.localesConditions?.[e],E=h.localesConditions?.[n];w?.forEach(($,M)=>{let O=h.localesConditions?.[n]?.[M];(!$||!O||!ba($,O))&&Hh(a,d.nodeId).actions.push({type:"copyPropertyValue",propertyId:m,sourceValue:$.value,targetValue:O,conditionIndex:M,conditionDefinition:$.when})});let _=w?.length??0,N=E?.length??0;if(_<N){let $=Hh(a,d.nodeId);for(let M=_;M<N;M++)$.actions.push({type:"deletePropertyValue",propertyId:m,sourceValue:w?.[M],targetValue:E?.[M],conditionIndex:M})}})},c=this.#e[o];if(!c)throw new Error(`Node ${o} does not exist`);return l(c),!i&&!r&&this.visitDescendants(c.nodeId,l),{nodePlans:Array.from(a.values()),sourceLocale:e,destinationLocale:n}}async copyValuesToLocaleExecute({resolvePattern:e,plan:{sourceLocale:n,destinationLocale:r,nodePlans:o}}){let i=`copyLocaleExecute: ${r}`;console.time(i);for(let{nodeId:a,actions:l}of o)for(let c of l)switch(c.type){case"copyPropertyValue":{this.updateNodeProperty({nodeId:a,property:c.propertyId,source:"other",locale:r,value:()=>c.sourceValue,type:this.getNodeProperty(a,c.propertyId)?.type,conditionIndex:c.conditionIndex,conditionDefinition:c.conditionDefinition});break}case"deletePropertyValue":{this.updateNodeProperty({nodeId:a,property:c.propertyId,source:"other",locale:r,value:void 0,conditionIndex:c.conditionIndex,conditionDefinition:null});break}case"deleteLocalizedNode":{this.deleteNode(a);break}case"duplicateLocalizedNode":{let d=await this.duplicateNode(a,e);this.updateNodeProperty({nodeId:d,locale:void 0,conditionIndex:-1,type:"localeSelect",property:iT,source:"other",value:()=>r});let f=this.copyValuesToLocalePlan({sourceLocale:n,destinationLocale:r,startingNodeId:d});this.copyValuesToLocaleExecute({plan:f,resolvePattern:e}),c.targetIndexInSlot!==void 0&&this.moveNode({movedNodeId:d,parentNodeId:this.#e[a].parentId,parentSlot:JZ,targetIndexInSlot:c.targetIndexInSlot});break}case"updateVisibilityCriteria":{this.updateNodeProperty({nodeId:a,property:p0,source:"other",locale:void 0,conditionIndex:-1,value:()=>c.targetValue});break}default:throw new Error(`Unhandled action type ${c.type}`)}console.timeEnd(i)}updateNode({nodeId:e,updateComponent:n,updateDataResources:r,updateMetadata:o,doNotSetDirty:i,ignoreOverrides:a}){let l=this.#e[e];if(!l)throw new Error(`Update target node ID ${e} did not exist!`);let c=_o(l,h=>{if(o&&(o(h),h.nodeId=e,h.value=l.value,h.parentId=l.parentId),n){if(n(h.value),"slots"in h.value)throw new Error("Do not set `slots` on a Twee node, insert child nodes instead.");if("parameters"in h.value)throw new Error("Do not set `parameters` on a Twee node, use updateProperties option instead.")}if(r){let g=typeof r=="function"?r(h.value._dataResources):r;if(g==="removeAll")delete h.value._dataResources;else for(let y of g){let b=this.#y||a?!1:h.nodeId!==this.rootNodeId&&h.value._pattern;switch(y.type){case"set":b&&(this.#n=_o(this.#n,C=>{C[e]??={},C[e].dataResources??={},C[e].dataResources[y.name]=y.value})),h.value._dataResources??={},h.value._dataResources[y.name]=y.value;break;case"remove":b&&(this.#n=_o(this.#n,C=>{delete C[e]?.dataResources?.[y.name]})),delete h.value._dataResources?.[y.name];break;case"reset":{let C=this.#i[e]?.dataResources?.[y.name];h.value._dataResources&&(C&&Object.keys(C).length>0?h.value._dataResources[y.name]=C:delete h.value._dataResources[y.name]),this.#n=_o(this.#n,S=>{delete S[e]?.dataResources?.[y.name]})}break;default:throw new Error(`Unhandled data resource action ${y?.type}`)}}}}),d=!!(l.partOfPattern&&!l.value._patternError),f=l.value.variant!==c.value.variant,m=l.value._overridability?.variants??!1;!a&&d&&f&&m&&(this.#n=_o(this.#n,h=>{h[e]??={},h[e].variant=c.value.variant})),this.#e[e]=c,i||(this.pristine=!1),this.#t.emit("nodeChanged",{changedNode:c,type:"update",oldValue:l})}updateNodeProperty({nodeId:e,property:n,value:r,source:o,locale:i,type:a,doNotSetDirty:l=!1,ignoreOverrides:c=!1,conditionIndex:d,conditionDefinition:f}){let m=this.#e[e];if(!m)throw new Error(`Update target node ID ${e} did not exist!`);if(d<0&&f)throw new Error("Condition definition provided for non-conditional value");let h=!!(m.partOfPattern&&!m.value._patternError),g=[e,n],y=ZZ(this.#o,g);if(!y&&r==null)return;let b=d3e({locale:i,property:y,conditionIndex:d}),C=i?y?.localesConditions?.[i]?.[d]:y?.conditions?.[d],S=typeof r=="function"?_o(b,$=>r($)):r,w=a??y?.type;if(!w)throw new Error(`Cannot add parameter ${n} to node ${e} without specifying a type`);let E={...y,type:w},_=!1;E=_o(E,$=>{S===void 0&&d<0?_=!ZL({locale:i,property:$,conditionIndex:d}):f===null&&d>=0?_=!ZL({locale:i,property:$,conditionIndex:d}):KZ({locale:i,property:$,newPropertyValue:S,conditionIndex:d,conditionDefinition:f??C?.when??{clauses:[]}})}),_&&(E=void 0);let N=h&&gC(m.value._overridability,n)==="yes";if(h&&!N&&!c)throw new Error(`Cannot override parameter ${n} on node ${e} because it is not marked as overridable on the pattern (${m.partOfPattern})`);if(N&&(this.#i[e]?.parameters?.[n]||(this.#i=_o(this.#i,M=>{M[e]??={parameters:{},dataResources:{}},M[e].parameters[n]=y??null}))),!c&&N){let $=this.#n[e]?.parameters?.[n];this.#n=_o(this.#n,M=>{let A=S==null||E===void 0?null:S,k=$??{type:E?.type??y?.type??"unknown",value:y?.value,conditions:y?.conditions,locales:i&&y?.locales?.[i]?{[i]:y.locales[i]}:void 0,localesConditions:i&&y?.localesConditions?.[i]?{[i]:y.localesConditions[i]}:void 0},F=_o(k,j=>{f===null&&d>=0?ZL({locale:i,property:j,conditionIndex:d}):KZ({locale:i,property:j,newPropertyValue:A,conditionIndex:d,conditionDefinition:f??C?.when??{clauses:[]}})});(0,h0.set)(M,`/${e}/parameters/${n}`,F)}),$||this.#t.emit("propertyOverrideCreated",{nodeId:e,property:n})}S===null?(0,h0.remove)(this.#o,g):(this.#o[e]??={},(0,h0.set)(this.#o,g,E)),l||(this.pristine=!1),this.#t.emit("nodeParameterChanged",{nodeId:e,parameter:n,locale:i,conditionIndex:d,value:E,previousValue:y,type:r?y?"update":"new":"delete",conditionDefinition:f,source:o})}isPatternPropertyOverridden(e,n,r,o){let i=this.getNodeById(e);if(!i||gC(i.value._overridability,n)==="no")return!1;let a=this.#n[e]?.parameters?.[n];return a?r?(o===void 0||o===!0)&&a.localesConditions?.[r]!==void 0||(o===void 0||o===!1)&&a.locales?.[r]!==void 0:(o===void 0||o===!0)&&a.conditions!==void 0||(o===void 0||o===!1)&&a.value!==void 0:!1}getPatternPropertyOverrideDefaultValue(e,n,r){let o=this.#i[e]?.parameters?.[n];if(!o)return{exists:!1};if(r&&o.locales?.[r])return{exists:!0,value:o,sourceLocale:r};if(o.value)return{exists:!0,value:o,sourceLocale:void 0};let i=Object.keys(o.locales??{})[0];return i?{exists:!0,value:o,sourceLocale:i}:{exists:!1}}resetPatternPropertyOverride(e,n,r){let o=[-1];this.#n=_o(this.#n,a=>{let l=a[e]?.parameters?.[n];if(l)if(r){delete l.locales?.[r];let c=l.localesConditions?.[r];c&&(c.forEach((d,f)=>{o.push(f)}),delete l.localesConditions?.[r]),l.locales&&Object.keys(l.locales).length===0&&delete l.locales,l.localesConditions&&Object.keys(l.localesConditions).length===0&&delete l.localesConditions,Object.keys(l.locales??{}).length===0&&Object.keys(l.localesConditions??{}).length===0&&delete a[e]?.parameters?.[n]}else{let c=l.conditions;c&&c.forEach((d,f)=>{o.push(f)}),delete a[e].parameters?.[n]}});let i=this.getPatternPropertyOverrideDefaultValue(e,n,r);!i.exists||i.value===null?this.updateNodeProperty({nodeId:e,property:n,value:void 0,source:"reset",locale:r,ignoreOverrides:!0,doNotSetDirty:!1,conditionIndex:-1}):o.forEach(a=>{let l=d3e({locale:i.sourceLocale,property:i.value,conditionIndex:a,strict:!0});this.updateNodeProperty({nodeId:e,property:n,value:l===void 0?void 0:()=>l,source:"reset",locale:r,type:i.value?.type,ignoreOverrides:!0,doNotSetDirty:!1,conditionIndex:a,conditionDefinition:(r?i.value?.localesConditions?.[r]?.[a]?.when:i.value?.conditions?.[a]?.when)??null})}),this.#t.emit("propertyOverrideReset",{nodeId:e,property:n,usedPatternDefault:i!==void 0})}async duplicateNode(e,n){let r=this.getParentInfo(e);if(!r)throw new Error("Cannot duplicate root node or parentless block");let o=this.copyNodeToClipboard(e);return await this.pasteNodeFromClipboard({parentNodeId:r.parentId,parentSlot:r.parentName,resolvePattern:n,targetIndexInParent:r.targetIndexInParent+1,clipboard:o})}moveNode({movedNodeId:e,parentNodeId:n,parentSlot:r,targetIndexInSlot:o}){if(!this.#e[e])throw new Error(`Cannot move node ${e} - it does not exist`);let a=this.getParentInfo(e);if(!a)throw new Error("Cannot move root node");this.#r[a.parentId][a.parentName].splice(a.targetIndexInParent,1),this.#b(a.parentId,e),this.#f({nodeId:e,parentNodeId:n,parentSlot:r,targetIndexInSlot:o}),this.#m({nodeId:e,destinationParentId:n,destinationSlotName:r,sourceSlotName:a.parentName}),this.pristine=!1,this.#t.emit("childrenChanged",{parentId:n,slotOrBlockName:r,newChildIds:this.#r[n][r],type:"slot"}),this.#t.emit("childrenChanged",{parentId:a.parentId,slotOrBlockName:a.parentName,newChildIds:this.#r[a.parentId][a.parentName],type:"slot"})}deleteNode(e,n){let r=this.getParentInfo(e);if(!r&&!n)throw new Error("Cannot delete root node");r&&!n&&(this.#r[r.parentId][r.parentName].splice(r.targetIndexInParent,1),this.#r[r.parentId][r.parentName].length===0&&delete this.#r[r.parentId][r.parentName],this.selectedNodeId===e&&(this.selectedNodeId=r.parentId),this.#b(r.parentId,e),this.#t.emit("childrenChanged",{parentId:r.parentId,slotOrBlockName:r.parentName,newChildIds:this.#r[r.parentId][r.parentName]??[],type:"slot"})),delete this.#e[e],this.#t.emit("nodeDeleted",{deletedNodeId:e}),this.pristine=!1}#b(e,n){this.#n=_o(this.#n,r=>{let o=r[e]?.slots;o&&Object.keys(o).forEach(i=>{o[i]=o[i].filter(({_id:a})=>a!==n),o[i].length===0&&delete o[i]})})}#g(){if(Object.keys(this.#n).length>0){let e=_u(this.#n);return Object.entries(e).forEach(([r,o])=>{let i=!0;if(!this.#e[r]){delete e[r];return}if(o.parameters){let a=Object.entries(o.parameters);a.forEach(([l,c])=>{let d=f3e(c);d?(o.parameters[l]=d,i=!1):delete o.parameters[l]}),a.length===0&&delete o.parameters}o.slots&&Object.entries(o.slots).forEach(([l,c])=>{if(c.length){let d=c.filter(f=>f._id).map(f=>this.exportSubtree(f._id));d?(o.slots[l]=d,i=!1):delete o.slots[l]}else delete o.slots[l]}),o.variant!==void 0&&(i=!1),o.dataResources&&Object.keys(o.dataResources).length>0&&(i=!1),i&&delete e[r]}),Object.keys(e).length===0&&(e=void 0),e}}exportSubtree(e,n){let{keepPatternData:r=!1}=n??{},o=this.#e[e];if(!o)throw new Error(`Node ${e} to export is not found`);let i=_u(o);if(e===this.rootNodeId){let c=this.#g();c?i.value._overrides=c:delete i.value._overrides;let d=i.value;d._name=this.#a._name,this.#a._slug&&(d._slug=this.#a._slug)}let a=[i],l=new Set;for(;a.length>0;){let c=a.pop();if(l.has(c.nodeId))throw new Error("Circular reference detected in the composition tree with node ID "+c.nodeId);if(l.add(c.nodeId),c.value._id=c.nodeId,!r&&(delete c.value._patternDataResources,delete c.value._patternOverrides,c.value._pattern&&c.value._dataResources)){let m=!1;Object.keys(c.value._dataResources).forEach(h=>{i.value._overrides?.[c.nodeId]?.dataResources?.[h]?delete c.value._dataResources[h]:m=!0}),m||delete c.value._dataResources}let d=this.#o[c.nodeId];if(d&&(r||!c.partOfPattern)){let m={},h=!1;Object.entries(d).forEach(([g,y])=>{if(y?.type===Tc&&Array.isArray(y.value)){let b=y.value,C=[];b.forEach(S=>{let w=this.exportSubtree(S,n);C.push(GZ(w,S))}),m[g]={value:C,type:Tc},h=!0}else{let b=f3e(y);b&&(m[g]=b,h=!0)}}),h&&(c.value.parameters=m)}let f=this.#r[c.nodeId];!f||c.partOfPattern&&!r||Object.entries(f).forEach(([m,h])=>{h.forEach((g,y)=>{let b=this.#e[g];if(!b)throw new Error("Insanity detected.");let C=_u(b),S=c.value;S.slots=S.slots||{},(0,h0.set)(c,["value","slots",m,y.toString(10)],C.value),a.push(C)})})}return i.value}#w({parentNodeId:e,parentSlot:n,targetIndexInSlot:r,node:o}){if(!this.#e[e])throw new Error("Parent ID to insert under did not exist!");if(this.#e[o.nodeId])throw new Error(`Node with ID '${o.nodeId}' already exists. Nodes must have unique IDs.`);this.#e[o.nodeId]=o,this.#f({nodeId:o.nodeId,parentNodeId:e,parentSlot:n,targetIndexInSlot:r})}#f({nodeId:e,parentNodeId:n,parentSlot:r,targetIndexInSlot:o}){let i=this.#e[n],a=this.#r[n]??={},l=a[r]??=[];typeof o<"u"?l.splice(o,0,e):l.push(e),i?.value.type===XZ&&(this.#n=_o(this.#n,c=>{c[n]=c[n]??{},c[n].slots={[sit]:l.map(d=>({_id:d,type:this.#e[d].value.type}))}})),this.#e[e]=_o(this.#e[e],c=>{c.parentId=n})}#E({nodeId:e,property:n,index:r,entry:o}){let i=this.getNodeById(e);if(!i)throw new Error("Node doesn't exist");let l={nodeId:o._id??ya(),value:{type:o.type,_dataResources:o._dataResources},isBlock:!0,parentId:e,propertyValueLocalizability:{}},c=this.getNodeProperty(i.nodeId,n);if(c&&c.type!==Tc)throw new Error("Parameter already exists and isn't a block parameter");let d=this.#e[l.nodeId];this.#e[l.nodeId]=l;let f=_u(this.getNodeProperty(i.nodeId,n)?.value?.filter(m=>this.getNodeById(m))??[]);if(typeof r<"u"){if(r<0)throw new Error("parameter index cannot be less than 0");let m=-1;if(f.forEach((h,g)=>{h===l.nodeId&&(m=g)}),r>f.length+(m===-1?1:0))throw new Error(`Parameter index ${r} outside current index bounds.`);m>-1&&m!==r&&(f=f.filter(h=>h!==l.nodeId),f.splice(r,0,l.nodeId))}else f.push(l.nodeId);return Object.entries(o?.fields??{}).forEach(([m,h])=>{if(h.type===Tc&&Array.isArray(h.value)){let g=h.value,y=[];g.forEach(b=>{this.#l({nodeId:l.nodeId,componentTree:YZ(b)}),y.push(b._id)}),this.updateNodeProperty({nodeId:l.nodeId,property:m,type:h.type,value:()=>y,source:"other",locale:void 0,conditionIndex:-1})}else this.updateNodeProperty({nodeId:l.nodeId,property:m,type:h.type,value:()=>h.value,source:"other",locale:void 0,conditionIndex:-1})}),this.updateNodeProperty({nodeId:i.nodeId,property:n,type:Tc,value:()=>f,source:"other",locale:void 0,conditionIndex:-1}),this.#t.emit("nodeChanged",{changedNode:i,oldValue:void 0,type:d?"update":"new"}),this.#t.emit("nodeParameterChanged",{nodeId:i.nodeId,parameter:n,previousValue:c,source:"other",type:d?"update":"new",locale:void 0,conditionIndex:-1,conditionDefinition:void 0,value:{type:Tc,value:f}}),{blockIds:f}}#l({componentTree:e,nodeId:n,partOfPattern:r,partOfNestedPattern:o,resetUids:i,isBlock:a,allowReplacement:l}){let{slots:c,parameters:d,_id:f,_overrides:m,...h}=e,g=r??h._pattern,y=h._pattern&&h._pattern!==g?h._pattern:o,b=n??(i?void 0:f)??ya();if(this.#e[b]&&!l)throw new Error(`Node with ID '${b}' already exists. Nodes must have unique IDs.`);let C={nodeId:b,value:h,partOfPattern:g,partOfNestedPattern:y,isBlock:a,propertyValueLocalizability:Object.entries(d??{}).reduce((S,[w,E])=>(S[w]=a6({definition:void 0,currentValue:E,lastUserChoice:void 0}),S),{})};return g&&(C.partOfPattern=g),this.#e[C.nodeId]=C,d&&Object.entries(d).forEach(([S,w])=>{let{connectedData:E,..._}=w,N=E?uit(lit(E)):w.value;if(w?.type===Tc&&Array.isArray(N)){let $=N,M=[];$?.forEach(O=>{let A={...O,_id:i?ya():O._id??ya()};if(this.#e[A._id])throw new Error(`Block node with ID '${A._id}' already exists. Block nodes must have unique IDs.`);return M.push(A._id),this.#e[A._id]={nodeId:A._id,value:{type:Tc},propertyValueLocalizability:{}},this.#l({componentTree:YZ(A),nodeId:A._id,allowReplacement:!0}),this.#e[A._id].isBlock=!0,this.#e[A._id].parentId=C.nodeId,this.#e[A._id]}),N=M}this.#o[C.nodeId]=this.#o[C.nodeId]??{},(0,h0.set)(this.#o,[C.nodeId,S],{..._,value:N})}),c&&Object.entries(c).forEach(([S,w])=>{let E=w.map(_=>{if(this.#e[_._id??""]?.isBlock)return;let N=this.#l({componentTree:_,partOfPattern:h.type===XZ?void 0:g,partOfNestedPattern:h.type===XZ?void 0:y,resetUids:i});return this.#e[N].parentId=C.nodeId,N});this.#r[C.nodeId]=this.#r[C.nodeId]??{},this.#r[C.nodeId][S]=E.filter(_=>_)}),C.nodeId}#x(e,n,r){let o=this.#C(e,n);return this.#l({componentTree:o,nodeId:n,allowReplacement:r})}#C(e,n){let r=_u(e);return this.#v({composition:r}),KL(r,n),r._pattern=e._id,delete r._id,delete r._name,delete r._slug,delete r._overrides,delete r._locales,delete r._author,delete r._authorSubject,delete r._creator,delete r._creatorSubject,r._dataResources&&(r._patternDataResources=_u(r._dataResources),delete r._dataResources),r}getParentInfo(e){let{parentId:n,isBlock:r}=this.#e[e]??{};if(!n)return;let o=this.#e[n];if(o)if(r)for(let[i,a]of Object.entries(this.#o[n]??{})){if(a?.type!==Tc)continue;let l=Array.isArray(a.value)?a.value:[],c=l.indexOf(e);if(c>=0)return{value:o.value,parentId:n,parentName:i,targetIndexInParent:c,parentChildIds:l,parentType:"block"}}else{let i=this.#r[n];if(!i&&!r)throw new Error("Sanity failed; parent had no children!");for(let[a,l]of Object.entries(i??{})){let c=l.indexOf(e);if(c>=0)return{value:o.value,parentId:n,parentName:a,targetIndexInParent:c,parentChildIds:l,parentType:"slot"}}return}}static#T(e){return _o(e,r=>{delete r.slots,delete r.parameters})}#_(e,n,r){let i={...this.#g(),...r},a;if(this.#n=_o(this.#n,c=>{this.#i=_o(this.#i,d=>{a=YL(e,i,(f,m,h)=>{c[f]=m,d[f]=this.#i[h]})})}),!a)throw new Error("Failed to duplicate component");a=_o(a,c=>{c._overrides=_u(this.#n),this.#v({composition:c,preserveChildrenSlotSections:!0})});let l=this.#l({componentTree:a,isBlock:n.parentType==="block"});if(n.parentType==="block"){let c=this.getNodeProperty(n.parentId,n.parentName)?.value??[],d=[...c.slice(0,n.targetIndexInParent),l,...c.slice(n.targetIndexInParent)];this.updateNodeProperty({nodeId:n.parentId,property:n.parentName,type:Tc,value:()=>d,locale:void 0,conditionIndex:-1,source:"other"}),this.#e[l].parentId=n.parentId,this.#t.emit("nodeChanged",{changedNode:this.getNodeById(l),type:"new",oldValue:void 0}),this.#t.emit("childrenChanged",{parentId:n.parentId,slotOrBlockName:n.parentName,newChildIds:d,type:"block"})}else{this.#f({nodeId:l,parentNodeId:n.parentId,parentSlot:n.parentName,targetIndexInSlot:n.targetIndexInParent}),this.#m({nodeId:l,destinationParentId:n.parentId,destinationSlotName:n.parentName}),this.#t.emit("childrenChanged",{parentId:n.parentId,slotOrBlockName:n.parentName,newChildIds:this.#r[n.parentId][n.parentName],type:"slot"});let c=d=>{this.#t.emit("nodeChanged",{changedNode:d,type:"new",oldValue:void 0})};this.visitNodeAndDescendants(l,c)}return this.pristine=!1,l}#v({composition:e,ignoreRootOverrides:n,preserveChildrenSlotSections:r}){this.#i=_o(this.#i,i=>{let a=WZ({beforeApplyParameterOverride(d,f,m){i[d._id]??={parameters:{},dataResources:{}},i[d._id].parameters[f]=_u(m)},beforeApplyDataResourceOverride(d,f,m){d._dataResources?.[f]?.ignorePatternParameterDefault||(i[d._id]??={parameters:{},dataResources:{}},i[d._id].dataResources[f]=_u(m))}}),l=WZ({beforeApplyParameterOverride(d,f,m,h){i[d._id]?.parameters[f]||(i[d._id]??={parameters:{},dataResources:{}},i[d._id].parameters[f]=_u(h??null))},beforeApplyDataResourceOverride(d,f,m,h){d._dataResources?.[f]?.ignorePatternParameterDefault||i[d._id]?.dataResources[f]||(i[d._id]??={parameters:{},dataResources:{}},i[d._id].dataResources[f]=_u(h))}});if(n){let{_overrides:d,...f}=e;m0(f,({node:m})=>{a.visitNode(m)})}let c=n?l:a;m0(e,({node:d})=>{c.visitNode(d)})});let o=G4e({preserveOwnSlotSections:!0,preserveChildrenSlotSections:r});m0(e,i=>{o(i)})}visitNodeAndDescendants(e,n){let r=this.getNodeById(e);if(!r)throw new Error("Insanity detected.");n(r),this.visitDescendants(e,n)}visitDescendants(e,n){let r=this.#p(e,new Set);for(let o of r)n(...o)}async visitDescendantsAsync(e,n){let r=this.#p(e,new Set);for(let o of r)await n(...o)}*#p(e,n){let r=this.#e[e],o=this.#r[e]??{},i=Object.entries(this.#o[e]??{}).filter(([,a])=>a?.type===Tc)??[];if(!r)throw new Error("Insanity detected.");n.add(e);for(let[a,l]of i){let c=l.value??[];for(let d=0;d<c.length;d++){let f=c[d],m=this.#e[f];if(m){if(n.has(f)){console.error(`Detected parent/child cycle in composition, ID ${f} exists more than once. The traversal of descendants will be aborted for the cycle subtree.`);continue}yield[m,r,a,d];for(let h of this.#p(f,n))yield h}}}for(let[a,l]of Object.entries(o))for(let c=0;c<l.length;c++){let d=l[c],f=this.#e[d];if(f){if(n.has(d)){console.error(`Detected parent/child cycle in composition, ID ${d} exists more than once. The traversal of descendants will be aborted for the cycle subtree.`);continue}yield[f,r,a,c];for(let m of this.#p(d,n))yield m}}}#m({nodeId:e,destinationParentId:n,destinationSlotName:r,sourceSlotName:o}){let i=r,a=o===l3e,l=i===l3e,c=o===u3e,d=i===u3e,f=i===JZ,m=this.getNodeProperty(e,s3e);l&&m&&this.updateNodeProperty({nodeId:e,property:s3e,value:void 0,source:"other",locale:void 0,conditionIndex:-1});let h=this.getNodeProperty(e,aT);!l&&h&&this.updateNodeProperty({nodeId:e,property:aT,value:void 0,source:"other",locale:void 0,conditionIndex:-1}),l&&!a&&this.#S({nodeId:e,siblingIds:this.getNodeChildren(n)?.[r]??[],selectExistingName:b=>this.getNodeProperty(b,aT)?.value?.name,setName:b=>this.updateNodeProperty({nodeId:e,property:aT,value:C=>C&&typeof C=="object"&&C!==null?{...C,name:b}:{name:b,crit:[]},source:"other",locale:void 0,conditionIndex:-1,type:aT})}),d&&!c&&this.#S({nodeId:e,siblingIds:this.getNodeChildren(n)?.[r]??[],selectExistingName:b=>this.getNodeProperty(b,c3e)?.value?.id,setName:b=>this.updateNodeProperty({nodeId:e,property:c3e,value:C=>C&&typeof C=="object"&&C!==null?{...C,id:b}:{id:b},source:"other",locale:void 0,conditionIndex:-1,type:"testVariant"})});let g=this.getNodeProperty(e,iT);!f&&g&&this.updateNodeProperty({nodeId:e,property:iT,value:void 0,source:"other",locale:void 0,conditionIndex:-1});let y=this.getNodeProperty(e,p0);(l||f||d)&&y&&this.updateNodeProperty({nodeId:e,property:p0,value:void 0,source:"other",locale:void 0,conditionIndex:-1})}#S({nodeId:e,siblingIds:n,selectExistingName:r,setName:o}){let i=r(e),a=m=>n.some(h=>h===e?!1:r(h)===m),l=i&&a(i);if(i&&!l)return;let c=this.getNodeById(e)?.value.type;if(!c)throw new Error("Insanity detected.");let d=0,f=qZ(e,c,d);do f=qZ(e,c,d),d++;while(a(f));o(f)}};function f3e(t){return t?.value===void 0&&!t?.conditions&&!t?.locales&&!t?.localesConditions?null:t}function Hh(t,e){return fit(t,e,()=>({nodeId:e,actions:[]}))}function fit(t,e,n){return t.has(e)||t.set(e,n()),t.get(e)}import{CANVAS_DRAFT_STATE as eq,CanvasClient as git}from"@uniformdev/canvas";function m3e(t){return t.reduce((e,n)=>(e[n._id]={id:n._id,type:n.type,name:n._name},e),{})}import{CANVAS_DRAFT_STATE as y3e,CanvasClient as QZ,ContentClient as b3e,ProjectClient as x3e}from"@uniformdev/canvas";var h3e=J(k4e());var g3e=(0,h3e.default)(6),JL=class t extends Error{constructor(n,r,o,i,a,l){super(`${n}
|
|
5181
|
-
${i}${a?" "+a:""} (${r} ${o}${l?` Request ID: ${l}`:""})`);this.errorMessage=n;this.fetchMethod=r;this.fetchUri=o;this.statusCode=i;this.statusText=a;this.requestId=l;Object.setPrototypeOf(this,t.prototype)}};var XL=class t{options;constructor(e){if(!e.apiKey&&!e.bearerToken)throw new Error("You must provide an API key or a bearer token");let n=e.fetch;if(!n)if(typeof window<"u")n=window.fetch.bind(window);else if(typeof fetch<"u")n=fetch;else throw new Error("You must provide or polyfill a fetch implementation when not in a browser");this.options={...e,fetch:n,apiHost:this.ensureApiHost(e.apiHost),apiKey:e.apiKey??null,projectId:e.projectId??null,bearerToken:e.bearerToken??null,limitPolicy:e.limitPolicy??g3e,bypassCache:e.bypassCache??!1}}async apiClient(e,n){return(await this.apiClientWithResponse(e,n)).body}async apiClientWithResponse(e,n){return this.options.limitPolicy(async()=>{let r=this.options.apiKey?{"x-api-key":this.options.apiKey}:{Authorization:`Bearer ${this.options.bearerToken}`};this.options.bypassCache&&(r["x-bypass-cache"]="true");let{fetch:o,signal:i}=this.options,l=await pit(()=>o(e.toString(),{...n,signal:i,headers:{...n?.headers,...r}}));if(!l.ok){let c="";try{let d=await l.text();try{let f=JSON.parse(d);f.errorMessage?c=Array.isArray(f.errorMessage)?f.errorMessage.join(", "):f.errorMessage:c=d}catch{c=d}}catch{c="General error"}throw new JL(c,n?.method??"GET",e.toString(),l.status,l.statusText,t.getRequestId(l))}return n?.expectNoContent?{response:l,body:null}:{response:l,body:await l.json()}})}createUrl(e,n,r){let o=new URL(`${r??this.options.apiHost}${e}`);return Object.entries(n??{}).forEach(([i,a])=>{typeof a<"u"&&a!==null&&o.searchParams.append(i,Array.isArray(a)?a.join(","):a?.toString()??"")}),o}ensureApiHost(e){if(!e)return"https://uniform.app";if(!e?.startsWith("http"))throw new Error('Your apiHost must start with "http"');if(e.indexOf("/",8)>-1)throw new Error("Your apiHost must not contain a path element after the domain");if(e.indexOf("?")>-1)throw new Error("Your apiHost must not contain a query string");return e?.endsWith("/")&&(e=e.substring(0,e.length-1)),e}static getRequestId(e){let n=e.headers.get("apigw-requestid");if(n)return n}};async function pit(t){let n=5,r;for(;n>0&&(r=await t(),r.status===429);){let o=0;try{let l=r.clone(),c=l.headers.get("date"),d=c?new Date(c).getTime():void 0,m=(await l.json())?.info?.reset;typeof d=="number"&&typeof m=="number"&&(o=Math.max(0,Math.min(Math.round(1.1*(m-d)),1e4)))}catch{}let i=Math.pow(2,5-n)*333,a=i+Math.round(Math.random()*(i/2))*(Math.random()>.5?1:-1);await new Promise(l=>setTimeout(l,o+a)),n-=1}return r}var QL=class extends XL{telemetryContext;constructor(e){e.apiHost||(e.apiHost="https://ai.uniform.global"),super(e),this.telemetryContext=e.telemetryContext}async invoke(e,n){let r={};if(this.telemetryContext){let{threadId:i,uniformClient:a,userAgent:l}=this.telemetryContext;i&&(r["x-thread-id"]=i),a&&(r["x-uniform-client"]=a),l&&(r["user-agent"]=l)}return(await this.apiClientWithResponse(new URL(`/projects/${this.options.projectId}/tools/${e}`,this.options.apiHost),{method:"POST",body:n?JSON.stringify(n):void 0,headers:Object.keys(r).length>0?r:void 0})).body}};var v3e={name:"@uniformdev/uniform-mcp",version:"20.
|
|
5180
|
+
`).trimStart();n.on("*",(o,i)=>{console.debug(`\u26A1\uFE0F ${t}:${String(o)}`,{args:i,stack:r,subs:n.all.get(String(o))?.length??0})})}return n}var _u=(0,p3e.default)(),cit=!0,dit="Twee",jh=class t{#e={};rootNodeId;#r={};#o={};#n;#i={};#t=a3e(dit,cit);#u;#c;#h;#d;#s;#a;#y;constructor(e,n){let{metadata:r,startDirty:o}=n||{};this.#s=r??{},this.#a={_name:e?._name??"",_slug:e?._slug??null},this.#d=!o,this.#y=n?.temp_disableDataResourceOverrideCreation??!1;let i=_o(e,a=>{this.#v({composition:a,ignoreRootOverrides:!0,preserveChildrenSlotSections:!0}),delete a._author,delete a._authorSubject,delete a._creator,delete a._creatorSubject});this.rootNodeId=i._id??ya(),this.#u=this.rootNodeId,this.#l({componentTree:i,nodeId:this.rootNodeId}),this.#n=i._overrides??{}}events=this.#t;exportTree(e){return this.exportSubtree(this.rootNodeId,e)}exportMetadata(){return this.#s}exportRootNodeMetadata(){return this.#a}get pristine(){return this.#d}set pristine(e){this.#d!==e&&(this.#d=e,this.#t.emit("pristineChanged",{pristine:e}))}get selectedBlockIdStack(){return this.#c}set selectedBlockIdStack(e){this.#c=e,this.#t.emit("selectedBlockChanged",{selectedBlockIds:this.#c})}get selectedNodeId(){return this.#u}set selectedNodeId(e){this.#u!==e&&(this.#u=e,this.selectedParameterId=void 0,this.#t.emit("selectedNodeChanged",{selectedNodeId:e}))}get selectedParameterId(){return this.#h}set selectedParameterId(e){this.#h!==e&&(this.#h=e,this.#t.emit("selectedParameterChanged",{selectedParameterId:e}))}pushSelectedBlockId(e){this.selectedBlockIdStack=this.selectedBlockIdStack??[],this.selectedBlockIdStack?.push(e),this.#t.emit("selectedBlockChanged",{selectedBlockIds:this.selectedBlockIdStack})}popSelectedBlockId(){this.#c?.pop(),this.#t.emit("selectedBlockChanged",{selectedBlockIds:this.selectedBlockIdStack})}getNodeById(e){return this.#e[e]}getNodesIndex(){return this.#e}getBlockNodeValueById(e){return GZ(this.exportSubtree(e),e)}getNodeChildren(e){let n=this.#r[e];if(n)return n}getNodeProperty(e,n){return ZZ(this.#o,[e,n])}getNodeProperties(e){return this.#o[e]??{}}insertNode({node:e,parentNodeId:n,parentSlot:r,targetIndexInSlot:o,overrideNodeId:i}){let a=i??ya(),l={nodeId:a,parentId:n,value:t.#T(e),isExpandedInUI:!0,propertyValueLocalizability:{}};return this.#w({node:l,parentNodeId:n,parentSlot:r,targetIndexInSlot:o}),this.#m({nodeId:a,destinationParentId:n,destinationSlotName:r}),this.pristine=!1,this.#t.emit("nodeChanged",{changedNode:l,oldValue:void 0,type:"new"}),this.#t.emit("childrenChanged",{parentId:n,slotOrBlockName:r,newChildIds:this.#r[n][r],type:"slot"}),a}upsertBlockNode({nodeId:e,property:n,index:r,entry:o}){let i=this.#E({nodeId:e,property:n,index:r,entry:o});return this.pristine=!1,this.#t.emit("childrenChanged",{parentId:e,slotOrBlockName:n,newChildIds:this.#o[e]?.[n]?.value,type:"block"}),i}updateRootMetadata(e){let n={...this.#s};this.#s={...this.#s,...e},this.pristine=!1,this.#t.emit("metadataChanged",{metadata:this.#s,oldValue:n})}updateRootNode({update:e,doNotSetDirty:n}){let r={...this.#a};this.#a={...this.#a,...e},n||(this.pristine=!1),this.#t.emit("rootNodeMetadataChanged",{metadata:this.#a,oldValue:r})}insertPattern({parentNodeId:e,parentSlot:n,pattern:r,targetIndexInSlot:o,patternInstanceId:i}){let a=i??ya();if(this.#e[a])throw new Error(`Node with ID '${a}' already exists. Pattern nodes must have unique IDs. Did you mean to move or duplicate this pattern instead?`);let l=this.#x(r,a,!1);return this.#f({nodeId:l,parentNodeId:e,parentSlot:n,targetIndexInSlot:o}),this.#m({nodeId:l,destinationParentId:e,destinationSlotName:n}),this.pristine=!1,this.visitNodeAndDescendants(l,c=>{this.#t.emit("nodeChanged",{changedNode:c,oldValue:void 0,type:"new"})}),this.#t.emit("childrenChanged",{parentId:e,slotOrBlockName:n,newChildIds:this.#r[e][n],type:"slot"}),l}unlinkPattern(e){let n=this.#e[e];if(!n)throw new Error(`Node ${e} does not exist`);if(!n.value._pattern)throw new Error(`Node ${e} is not a pattern`);let r=n.value._patternDataResources||n.value._dataResources,o=J4e(n.value),i=l=>{l.partOfNestedPattern||(this.updateNode({nodeId:l.nodeId,updateComponent:c=>{delete c._pattern,delete c._patternError,delete c._overrides},updateMetadata:c=>{delete c.partOfPattern,delete c.partOfNestedPattern},doNotSetDirty:!0,ignoreOverrides:!0}),this.#n[l.nodeId]&&(this.#n=_o(this.#n,c=>{delete c[l.nodeId]})))};this.visitNodeAndDescendants(e,i);let a=l=>{l.partOfNestedPattern&&this.updateNode({nodeId:l.nodeId,updateMetadata:c=>{c.partOfPattern=c.partOfNestedPattern,delete c.partOfNestedPattern},doNotSetDirty:!0,ignoreOverrides:!0})};this.visitNodeAndDescendants(e,a),r&&(this.updateNode({nodeId:this.rootNodeId,updateDataResources:l=>Object.entries(o??{}).filter(([c])=>!(c in(l??{}))).map(([c,d])=>{let{source:f,...m}=d;return{type:"set",name:c,value:m}})}),this.updateNode({nodeId:n.nodeId,updateComponent:l=>{delete l._patternDataResources},updateDataResources:"removeAll",doNotSetDirty:!0,ignoreOverrides:!0})),this.pristine=!1}convertToPattern({existingNodeId:e,pattern:n}){let r=this.#e[e],o=r?.parentId;if(!r)throw new Error(`Node ${e} does not exist`);let i=this.#x(n,e,!0);this.#e[i]=_o(this.#e[i],l=>{l.parentId=o}),this.pristine=!1;let a=this.#e[i];this.#t.emit("nodeChanged",{changedNode:a,oldValue:r,type:"new"}),Object.entries(this.#r[i]??{}).forEach(([l,c])=>{this.#t.emit("childrenChanged",{newChildIds:c,parentId:i,slotOrBlockName:l,type:"slot"})})}copyNodeToClipboard(e){let n=this.exportSubtree(e,{keepPatternData:!1}),r=this.exportSubtree(e,{keepPatternData:!0}),o=[];m0(r,({node:l})=>{l._id&&o.push(l._id)}),m0(n,({node:l})=>{l._id&&(l._overrides&&delete l._overrides,"_name"in l&&delete l._name,"_slug"in l&&delete l._slug)});let i=this.#g(),a=Object.entries(i??{}).reduce((l,[c,d])=>(o.some(f=>c.includes(f))&&(l[c]=d),l),{});return{format:"uniform/copied-component-subtree-1.0",componentData:n,overrides:Object.keys(a).length?a:void 0,pasteAs:this.getNodeById(e)?.isBlock?"block":void 0}}async pasteNodeFromClipboard({parentNodeId:e,parentSlot:n,targetIndexInParent:r,clipboard:o,resolvePattern:i}){let a=_u(o),l=async d=>{d._pattern&&c.push((async()=>{let f=await i(d._pattern);if(!f){console.debug(`Pasted pattern ${d._pattern} not found, skipping`);return}let m=this.#C(f,d._id);Object.assign(d,m)})())},c=[];return m0(a.componentData,({node:d})=>{l(d)}),a.overrides&&Object.values(a.overrides).forEach(d=>{d.slots&&Object.values(d.slots).forEach(f=>{f.forEach(m=>{m0(m,({node:h})=>{l(h)})})})}),await Promise.all(c),this.#_(a.componentData,{parentId:e,parentName:n,parentType:o.pasteAs==="block"?"block":"slot",targetIndexInParent:r},a.overrides)}enableLocale(e){this.updateNode({nodeId:this.rootNodeId,updateComponent:n=>{let r=n;r._locales??=[];let o=[...new Set([...r._locales,...Array.isArray(e)?e:[e]])];r._locales=o}})}disableLocale(e){this.updateNode({nodeId:this.rootNodeId,updateComponent:o=>{let i=o;i._locales=i._locales?.filter(a=>a!==e)}});let n=[],r=o=>{this.getNodeProperty(o.nodeId,iT)?.value===e&&!o.partOfPattern&&n.push(o.nodeId);let a=this.getNodeProperties(o.nodeId);Object.entries(a).forEach(([c,d])=>{let f=d;c!==p0&&(o.partOfPattern?this.isPatternPropertyOverridden(o.nodeId,c,e)&&this.resetPatternPropertyOverride(o.nodeId,c,e):(f?.localesConditions?.[e]?.forEach((m,h)=>{this.updateNodeProperty({nodeId:o.nodeId,property:c,value:void 0,source:"other",locale:e,conditionIndex:h,conditionDefinition:null})}),f?.locales?.[e]!==void 0&&this.updateNodeProperty({nodeId:o.nodeId,property:c,value:void 0,source:"other",locale:e,conditionIndex:-1})))});let l=this.getNodeProperty(o.nodeId,p0);if(l?.value){let c=o3e(l.value,e);c===null?n.push(o.nodeId):this.updateNodeProperty({nodeId:o.nodeId,property:p0,value:c?()=>c:void 0,source:"other",locale:void 0,conditionIndex:-1})}};this.visitNodeAndDescendants(this.rootNodeId,r),n.forEach(o=>{this.deleteNode(o)})}copyValuesToLocalePlan({sourceLocale:e,destinationLocale:n,doNotCopyDescendants:r=!1,startingNodeId:o=this.rootNodeId,specificPropertyId:i}){let a=new Map,l=d=>{if(d.value.type===ait&&!d.partOfPattern){let m=this.getNodeChildren(d.nodeId)?.[JZ]??[],h=m.map(b=>this.getNodeProperty(b,iT)),g=h.findIndex(b=>b?.value===n);if(g>=0){let b=m[g];Hh(a,b).actions.push({type:"deleteLocalizedNode"})}let y=h.findIndex(b=>b?.value===e);if(y>=0){let b=m[y];Hh(a,b).actions.push({type:"duplicateLocalizedNode",targetIndexInSlot:g})}}if(a.get(d.nodeId)?.actions.some(m=>m.type==="deleteLocalizedNode"))return;let f=i?{[i]:this.getNodeProperty(d.nodeId,i)}:this.getNodeProperties(d.nodeId);Object.entries(f).forEach(([m,h])=>{if(h===void 0)return;let g=!d.partOfPattern,y=gC(d.value._overridability,m)==="yes";if(!(g||y))return;if(m===p0){let $=t3e(h.value,e,n);$===null?Hh(a,d.nodeId).actions.push({type:"deleteLocalizedNode"}):$&&Hh(a,d.nodeId).actions.push({type:"updateVisibilityCriteria",targetValue:$})}let C=h.locales?.[e],S=h.locales?.[n];(!C||!S||!ba(C,S))&&(C!==void 0?Hh(a,d.nodeId).actions.push({type:"copyPropertyValue",propertyId:m,sourceValue:C,targetValue:S,conditionIndex:-1}):S!==void 0&&Hh(a,d.nodeId).actions.push({type:"deletePropertyValue",propertyId:m,sourceValue:C,targetValue:S,conditionIndex:-1}));let w=h.localesConditions?.[e],E=h.localesConditions?.[n];w?.forEach(($,M)=>{let O=h.localesConditions?.[n]?.[M];(!$||!O||!ba($,O))&&Hh(a,d.nodeId).actions.push({type:"copyPropertyValue",propertyId:m,sourceValue:$.value,targetValue:O,conditionIndex:M,conditionDefinition:$.when})});let _=w?.length??0,N=E?.length??0;if(_<N){let $=Hh(a,d.nodeId);for(let M=_;M<N;M++)$.actions.push({type:"deletePropertyValue",propertyId:m,sourceValue:w?.[M],targetValue:E?.[M],conditionIndex:M})}})},c=this.#e[o];if(!c)throw new Error(`Node ${o} does not exist`);return l(c),!i&&!r&&this.visitDescendants(c.nodeId,l),{nodePlans:Array.from(a.values()),sourceLocale:e,destinationLocale:n}}async copyValuesToLocaleExecute({resolvePattern:e,plan:{sourceLocale:n,destinationLocale:r,nodePlans:o}}){let i=`copyLocaleExecute: ${r}`;console.time(i);for(let{nodeId:a,actions:l}of o)for(let c of l)switch(c.type){case"copyPropertyValue":{this.updateNodeProperty({nodeId:a,property:c.propertyId,source:"other",locale:r,value:()=>c.sourceValue,type:this.getNodeProperty(a,c.propertyId)?.type,conditionIndex:c.conditionIndex,conditionDefinition:c.conditionDefinition});break}case"deletePropertyValue":{this.updateNodeProperty({nodeId:a,property:c.propertyId,source:"other",locale:r,value:void 0,conditionIndex:c.conditionIndex,conditionDefinition:null});break}case"deleteLocalizedNode":{this.deleteNode(a);break}case"duplicateLocalizedNode":{let d=await this.duplicateNode(a,e);this.updateNodeProperty({nodeId:d,locale:void 0,conditionIndex:-1,type:"localeSelect",property:iT,source:"other",value:()=>r});let f=this.copyValuesToLocalePlan({sourceLocale:n,destinationLocale:r,startingNodeId:d});this.copyValuesToLocaleExecute({plan:f,resolvePattern:e}),c.targetIndexInSlot!==void 0&&this.moveNode({movedNodeId:d,parentNodeId:this.#e[a].parentId,parentSlot:JZ,targetIndexInSlot:c.targetIndexInSlot});break}case"updateVisibilityCriteria":{this.updateNodeProperty({nodeId:a,property:p0,source:"other",locale:void 0,conditionIndex:-1,value:()=>c.targetValue});break}default:throw new Error(`Unhandled action type ${c.type}`)}console.timeEnd(i)}updateNode({nodeId:e,updateComponent:n,updateDataResources:r,updateMetadata:o,doNotSetDirty:i,ignoreOverrides:a}){let l=this.#e[e];if(!l)throw new Error(`Update target node ID ${e} did not exist!`);let c=_o(l,h=>{if(o&&(o(h),h.nodeId=e,h.value=l.value,h.parentId=l.parentId),n){if(n(h.value),"slots"in h.value)throw new Error("Do not set `slots` on a Twee node, insert child nodes instead.");if("parameters"in h.value)throw new Error("Do not set `parameters` on a Twee node, use updateProperties option instead.")}if(r){let g=typeof r=="function"?r(h.value._dataResources):r;if(g==="removeAll")delete h.value._dataResources;else for(let y of g){let b=this.#y||a?!1:h.nodeId!==this.rootNodeId&&h.value._pattern;switch(y.type){case"set":b&&(this.#n=_o(this.#n,C=>{C[e]??={},C[e].dataResources??={},C[e].dataResources[y.name]=y.value})),h.value._dataResources??={},h.value._dataResources[y.name]=y.value;break;case"remove":b&&(this.#n=_o(this.#n,C=>{delete C[e]?.dataResources?.[y.name]})),delete h.value._dataResources?.[y.name];break;case"reset":{let C=this.#i[e]?.dataResources?.[y.name];h.value._dataResources&&(C&&Object.keys(C).length>0?h.value._dataResources[y.name]=C:delete h.value._dataResources[y.name]),this.#n=_o(this.#n,S=>{delete S[e]?.dataResources?.[y.name]})}break;default:throw new Error(`Unhandled data resource action ${y?.type}`)}}}}),d=!!(l.partOfPattern&&!l.value._patternError),f=l.value.variant!==c.value.variant,m=l.value._overridability?.variants??!1;!a&&d&&f&&m&&(this.#n=_o(this.#n,h=>{h[e]??={},h[e].variant=c.value.variant})),this.#e[e]=c,i||(this.pristine=!1),this.#t.emit("nodeChanged",{changedNode:c,type:"update",oldValue:l})}updateNodeProperty({nodeId:e,property:n,value:r,source:o,locale:i,type:a,doNotSetDirty:l=!1,ignoreOverrides:c=!1,conditionIndex:d,conditionDefinition:f}){let m=this.#e[e];if(!m)throw new Error(`Update target node ID ${e} did not exist!`);if(d<0&&f)throw new Error("Condition definition provided for non-conditional value");let h=!!(m.partOfPattern&&!m.value._patternError),g=[e,n],y=ZZ(this.#o,g);if(!y&&r==null)return;let b=d3e({locale:i,property:y,conditionIndex:d}),C=i?y?.localesConditions?.[i]?.[d]:y?.conditions?.[d],S=typeof r=="function"?_o(b,$=>r($)):r,w=a??y?.type;if(!w)throw new Error(`Cannot add parameter ${n} to node ${e} without specifying a type`);let E={...y,type:w},_=!1;E=_o(E,$=>{S===void 0&&d<0?_=!ZL({locale:i,property:$,conditionIndex:d}):f===null&&d>=0?_=!ZL({locale:i,property:$,conditionIndex:d}):KZ({locale:i,property:$,newPropertyValue:S,conditionIndex:d,conditionDefinition:f??C?.when??{clauses:[]}})}),_&&(E=void 0);let N=h&&gC(m.value._overridability,n)==="yes";if(h&&!N&&!c)throw new Error(`Cannot override parameter ${n} on node ${e} because it is not marked as overridable on the pattern (${m.partOfPattern})`);if(N&&(this.#i[e]?.parameters?.[n]||(this.#i=_o(this.#i,M=>{M[e]??={parameters:{},dataResources:{}},M[e].parameters[n]=y??null}))),!c&&N){let $=this.#n[e]?.parameters?.[n];this.#n=_o(this.#n,M=>{let A=S==null||E===void 0?null:S,k=$??{type:E?.type??y?.type??"unknown",value:y?.value,conditions:y?.conditions,locales:i&&y?.locales?.[i]?{[i]:y.locales[i]}:void 0,localesConditions:i&&y?.localesConditions?.[i]?{[i]:y.localesConditions[i]}:void 0},F=_o(k,j=>{f===null&&d>=0?ZL({locale:i,property:j,conditionIndex:d}):KZ({locale:i,property:j,newPropertyValue:A,conditionIndex:d,conditionDefinition:f??C?.when??{clauses:[]}})});(0,h0.set)(M,`/${e}/parameters/${n}`,F)}),$||this.#t.emit("propertyOverrideCreated",{nodeId:e,property:n})}S===null?(0,h0.remove)(this.#o,g):(this.#o[e]??={},(0,h0.set)(this.#o,g,E)),l||(this.pristine=!1),this.#t.emit("nodeParameterChanged",{nodeId:e,parameter:n,locale:i,conditionIndex:d,value:E,previousValue:y,type:r?y?"update":"new":"delete",conditionDefinition:f,source:o})}isPatternPropertyOverridden(e,n,r,o){let i=this.getNodeById(e);if(!i||gC(i.value._overridability,n)==="no")return!1;let a=this.#n[e]?.parameters?.[n];return a?r?(o===void 0||o===!0)&&a.localesConditions?.[r]!==void 0||(o===void 0||o===!1)&&a.locales?.[r]!==void 0:(o===void 0||o===!0)&&a.conditions!==void 0||(o===void 0||o===!1)&&a.value!==void 0:!1}getPatternPropertyOverrideDefaultValue(e,n,r){let o=this.#i[e]?.parameters?.[n];if(!o)return{exists:!1};if(r&&o.locales?.[r])return{exists:!0,value:o,sourceLocale:r};if(o.value)return{exists:!0,value:o,sourceLocale:void 0};let i=Object.keys(o.locales??{})[0];return i?{exists:!0,value:o,sourceLocale:i}:{exists:!1}}resetPatternPropertyOverride(e,n,r){let o=[-1];this.#n=_o(this.#n,a=>{let l=a[e]?.parameters?.[n];if(l)if(r){delete l.locales?.[r];let c=l.localesConditions?.[r];c&&(c.forEach((d,f)=>{o.push(f)}),delete l.localesConditions?.[r]),l.locales&&Object.keys(l.locales).length===0&&delete l.locales,l.localesConditions&&Object.keys(l.localesConditions).length===0&&delete l.localesConditions,Object.keys(l.locales??{}).length===0&&Object.keys(l.localesConditions??{}).length===0&&delete a[e]?.parameters?.[n]}else{let c=l.conditions;c&&c.forEach((d,f)=>{o.push(f)}),delete a[e].parameters?.[n]}});let i=this.getPatternPropertyOverrideDefaultValue(e,n,r);!i.exists||i.value===null?this.updateNodeProperty({nodeId:e,property:n,value:void 0,source:"reset",locale:r,ignoreOverrides:!0,doNotSetDirty:!1,conditionIndex:-1}):o.forEach(a=>{let l=d3e({locale:i.sourceLocale,property:i.value,conditionIndex:a,strict:!0});this.updateNodeProperty({nodeId:e,property:n,value:l===void 0?void 0:()=>l,source:"reset",locale:r,type:i.value?.type,ignoreOverrides:!0,doNotSetDirty:!1,conditionIndex:a,conditionDefinition:(r?i.value?.localesConditions?.[r]?.[a]?.when:i.value?.conditions?.[a]?.when)??null})}),this.#t.emit("propertyOverrideReset",{nodeId:e,property:n,usedPatternDefault:i!==void 0})}async duplicateNode(e,n){let r=this.getParentInfo(e);if(!r)throw new Error("Cannot duplicate root node or parentless block");let o=this.copyNodeToClipboard(e);return await this.pasteNodeFromClipboard({parentNodeId:r.parentId,parentSlot:r.parentName,resolvePattern:n,targetIndexInParent:r.targetIndexInParent+1,clipboard:o})}moveNode({movedNodeId:e,parentNodeId:n,parentSlot:r,targetIndexInSlot:o}){if(!this.#e[e])throw new Error(`Cannot move node ${e} - it does not exist`);let a=this.getParentInfo(e);if(!a)throw new Error("Cannot move root node");this.#r[a.parentId][a.parentName].splice(a.targetIndexInParent,1),this.#b(a.parentId,e),this.#f({nodeId:e,parentNodeId:n,parentSlot:r,targetIndexInSlot:o}),this.#m({nodeId:e,destinationParentId:n,destinationSlotName:r,sourceSlotName:a.parentName}),this.pristine=!1,this.#t.emit("childrenChanged",{parentId:n,slotOrBlockName:r,newChildIds:this.#r[n][r],type:"slot"}),this.#t.emit("childrenChanged",{parentId:a.parentId,slotOrBlockName:a.parentName,newChildIds:this.#r[a.parentId][a.parentName],type:"slot"})}deleteNode(e,n){let r=this.getParentInfo(e);if(!r&&!n)throw new Error("Cannot delete root node");r&&!n&&(this.#r[r.parentId][r.parentName].splice(r.targetIndexInParent,1),this.#r[r.parentId][r.parentName].length===0&&delete this.#r[r.parentId][r.parentName],this.selectedNodeId===e&&(this.selectedNodeId=r.parentId),this.#b(r.parentId,e),this.#t.emit("childrenChanged",{parentId:r.parentId,slotOrBlockName:r.parentName,newChildIds:this.#r[r.parentId][r.parentName]??[],type:"slot"})),delete this.#e[e],this.#t.emit("nodeDeleted",{deletedNodeId:e}),this.pristine=!1}#b(e,n){this.#n=_o(this.#n,r=>{let o=r[e]?.slots;o&&Object.keys(o).forEach(i=>{o[i]=o[i].filter(({_id:a})=>a!==n),o[i].length===0&&delete o[i]})})}#g(){if(Object.keys(this.#n).length>0){let e=_u(this.#n);return Object.entries(e).forEach(([r,o])=>{let i=!0;if(!this.#e[r]){delete e[r];return}if(o.parameters){let a=Object.entries(o.parameters);a.forEach(([l,c])=>{let d=f3e(c);d?(o.parameters[l]=d,i=!1):delete o.parameters[l]}),a.length===0&&delete o.parameters}o.slots&&Object.entries(o.slots).forEach(([l,c])=>{if(c.length){let d=c.filter(f=>f._id).map(f=>this.exportSubtree(f._id));d?(o.slots[l]=d,i=!1):delete o.slots[l]}else delete o.slots[l]}),o.variant!==void 0&&(i=!1),o.dataResources&&Object.keys(o.dataResources).length>0&&(i=!1),i&&delete e[r]}),Object.keys(e).length===0&&(e=void 0),e}}exportSubtree(e,n){let{keepPatternData:r=!1}=n??{},o=this.#e[e];if(!o)throw new Error(`Node ${e} to export is not found`);let i=_u(o);if(e===this.rootNodeId){let c=this.#g();c?i.value._overrides=c:delete i.value._overrides;let d=i.value;d._name=this.#a._name,this.#a._slug&&(d._slug=this.#a._slug)}let a=[i],l=new Set;for(;a.length>0;){let c=a.pop();if(l.has(c.nodeId))throw new Error("Circular reference detected in the composition tree with node ID "+c.nodeId);if(l.add(c.nodeId),c.value._id=c.nodeId,!r&&(delete c.value._patternDataResources,delete c.value._patternOverrides,c.value._pattern&&c.value._dataResources)){let m=!1;Object.keys(c.value._dataResources).forEach(h=>{i.value._overrides?.[c.nodeId]?.dataResources?.[h]?delete c.value._dataResources[h]:m=!0}),m||delete c.value._dataResources}let d=this.#o[c.nodeId];if(d&&(r||!c.partOfPattern)){let m={},h=!1;Object.entries(d).forEach(([g,y])=>{if(y?.type===Tc&&Array.isArray(y.value)){let b=y.value,C=[];b.forEach(S=>{let w=this.exportSubtree(S,n);C.push(GZ(w,S))}),m[g]={value:C,type:Tc},h=!0}else{let b=f3e(y);b&&(m[g]=b,h=!0)}}),h&&(c.value.parameters=m)}let f=this.#r[c.nodeId];!f||c.partOfPattern&&!r||Object.entries(f).forEach(([m,h])=>{h.forEach((g,y)=>{let b=this.#e[g];if(!b)throw new Error("Insanity detected.");let C=_u(b),S=c.value;S.slots=S.slots||{},(0,h0.set)(c,["value","slots",m,y.toString(10)],C.value),a.push(C)})})}return i.value}#w({parentNodeId:e,parentSlot:n,targetIndexInSlot:r,node:o}){if(!this.#e[e])throw new Error("Parent ID to insert under did not exist!");if(this.#e[o.nodeId])throw new Error(`Node with ID '${o.nodeId}' already exists. Nodes must have unique IDs. Did you mean to move or duplicate this node instead?`);this.#e[o.nodeId]=o,this.#f({nodeId:o.nodeId,parentNodeId:e,parentSlot:n,targetIndexInSlot:r})}#f({nodeId:e,parentNodeId:n,parentSlot:r,targetIndexInSlot:o}){let i=this.#e[n],a=this.#r[n]??={},l=a[r]??=[];typeof o<"u"?l.splice(o,0,e):l.push(e),i?.value.type===XZ&&(this.#n=_o(this.#n,c=>{c[n]=c[n]??{},c[n].slots={[sit]:l.map(d=>({_id:d,type:this.#e[d].value.type}))}})),this.#e[e]=_o(this.#e[e],c=>{c.parentId=n})}#E({nodeId:e,property:n,index:r,entry:o}){let i=this.getNodeById(e);if(!i)throw new Error("Node doesn't exist");let l={nodeId:o._id??ya(),value:{type:o.type,_dataResources:o._dataResources},isBlock:!0,parentId:e,propertyValueLocalizability:{}},c=this.getNodeProperty(i.nodeId,n);if(c&&c.type!==Tc)throw new Error("Parameter already exists and isn't a block parameter");let d=this.#e[l.nodeId];this.#e[l.nodeId]=l;let f=_u(this.getNodeProperty(i.nodeId,n)?.value?.filter(m=>this.getNodeById(m))??[]);if(typeof r<"u"){if(r<0)throw new Error("parameter index cannot be less than 0");let m=-1;if(f.forEach((h,g)=>{h===l.nodeId&&(m=g)}),r>f.length+(m===-1?1:0))throw new Error(`Parameter index ${r} outside current index bounds.`);m>-1&&m!==r&&(f=f.filter(h=>h!==l.nodeId),f.splice(r,0,l.nodeId))}else f.push(l.nodeId);return Object.entries(o?.fields??{}).forEach(([m,h])=>{if(h.type===Tc&&Array.isArray(h.value)){let g=h.value,y=[];g.forEach(b=>{this.#l({nodeId:l.nodeId,componentTree:YZ(b)}),y.push(b._id)}),this.updateNodeProperty({nodeId:l.nodeId,property:m,type:h.type,value:()=>y,source:"other",locale:void 0,conditionIndex:-1})}else this.updateNodeProperty({nodeId:l.nodeId,property:m,type:h.type,value:()=>h.value,source:"other",locale:void 0,conditionIndex:-1})}),this.updateNodeProperty({nodeId:i.nodeId,property:n,type:Tc,value:()=>f,source:"other",locale:void 0,conditionIndex:-1}),this.#t.emit("nodeChanged",{changedNode:i,oldValue:void 0,type:d?"update":"new"}),this.#t.emit("nodeParameterChanged",{nodeId:i.nodeId,parameter:n,previousValue:c,source:"other",type:d?"update":"new",locale:void 0,conditionIndex:-1,conditionDefinition:void 0,value:{type:Tc,value:f}}),{blockIds:f}}#l({componentTree:e,nodeId:n,partOfPattern:r,partOfNestedPattern:o,resetUids:i,isBlock:a,allowReplacement:l}){let{slots:c,parameters:d,_id:f,_overrides:m,...h}=e,g=r??h._pattern,y=h._pattern&&h._pattern!==g?h._pattern:o,b=n??(i?void 0:f)??ya();if(this.#e[b]&&!l)throw new Error(`Node with ID '${b}' already exists. Nodes must have unique IDs.`);let C={nodeId:b,value:h,partOfPattern:g,partOfNestedPattern:y,isBlock:a,propertyValueLocalizability:Object.entries(d??{}).reduce((S,[w,E])=>(S[w]=a6({definition:void 0,currentValue:E,lastUserChoice:void 0}),S),{})};return g&&(C.partOfPattern=g),this.#e[C.nodeId]=C,d&&Object.entries(d).forEach(([S,w])=>{let{connectedData:E,..._}=w,N=E?uit(lit(E)):w.value;if(w?.type===Tc&&Array.isArray(N)){let $=N,M=[];$?.forEach(O=>{let A={...O,_id:i?ya():O._id??ya()};if(this.#e[A._id])throw new Error(`Block node with ID '${A._id}' already exists. Block nodes must have unique IDs.`);return M.push(A._id),this.#e[A._id]={nodeId:A._id,value:{type:Tc},propertyValueLocalizability:{}},this.#l({componentTree:YZ(A),nodeId:A._id,allowReplacement:!0}),this.#e[A._id].isBlock=!0,this.#e[A._id].parentId=C.nodeId,this.#e[A._id]}),N=M}this.#o[C.nodeId]=this.#o[C.nodeId]??{},(0,h0.set)(this.#o,[C.nodeId,S],{..._,value:N})}),c&&Object.entries(c).forEach(([S,w])=>{let E=w.map(_=>{if(this.#e[_._id??""]?.isBlock)return;let N=this.#l({componentTree:_,partOfPattern:h.type===XZ?void 0:g,partOfNestedPattern:h.type===XZ?void 0:y,resetUids:i});return this.#e[N].parentId=C.nodeId,N});this.#r[C.nodeId]=this.#r[C.nodeId]??{},this.#r[C.nodeId][S]=E.filter(_=>_)}),C.nodeId}#x(e,n,r){let o=this.#C(e,n);return this.#l({componentTree:o,nodeId:n,allowReplacement:r})}#C(e,n){let r=_u(e);return this.#v({composition:r}),KL(r,n),r._pattern=e._id,delete r._id,delete r._name,delete r._slug,delete r._overrides,delete r._locales,delete r._author,delete r._authorSubject,delete r._creator,delete r._creatorSubject,r._dataResources&&(r._patternDataResources=_u(r._dataResources),delete r._dataResources),r}getParentInfo(e){let{parentId:n,isBlock:r}=this.#e[e]??{};if(!n)return;let o=this.#e[n];if(o)if(r)for(let[i,a]of Object.entries(this.#o[n]??{})){if(a?.type!==Tc)continue;let l=Array.isArray(a.value)?a.value:[],c=l.indexOf(e);if(c>=0)return{value:o.value,parentId:n,parentName:i,targetIndexInParent:c,parentChildIds:l,parentType:"block"}}else{let i=this.#r[n];if(!i&&!r)throw new Error("Sanity failed; parent had no children!");for(let[a,l]of Object.entries(i??{})){let c=l.indexOf(e);if(c>=0)return{value:o.value,parentId:n,parentName:a,targetIndexInParent:c,parentChildIds:l,parentType:"slot"}}return}}static#T(e){return _o(e,r=>{delete r.slots,delete r.parameters})}#_(e,n,r){let i={...this.#g(),...r},a;if(this.#n=_o(this.#n,c=>{this.#i=_o(this.#i,d=>{a=YL(e,i,(f,m,h)=>{c[f]=m,d[f]=this.#i[h]})})}),!a)throw new Error("Failed to duplicate component");a=_o(a,c=>{c._overrides=_u(this.#n),this.#v({composition:c,preserveChildrenSlotSections:!0})});let l=this.#l({componentTree:a,isBlock:n.parentType==="block"});if(n.parentType==="block"){let c=this.getNodeProperty(n.parentId,n.parentName)?.value??[],d=[...c.slice(0,n.targetIndexInParent),l,...c.slice(n.targetIndexInParent)];this.updateNodeProperty({nodeId:n.parentId,property:n.parentName,type:Tc,value:()=>d,locale:void 0,conditionIndex:-1,source:"other"}),this.#e[l].parentId=n.parentId,this.#t.emit("nodeChanged",{changedNode:this.getNodeById(l),type:"new",oldValue:void 0}),this.#t.emit("childrenChanged",{parentId:n.parentId,slotOrBlockName:n.parentName,newChildIds:d,type:"block"})}else{this.#f({nodeId:l,parentNodeId:n.parentId,parentSlot:n.parentName,targetIndexInSlot:n.targetIndexInParent}),this.#m({nodeId:l,destinationParentId:n.parentId,destinationSlotName:n.parentName}),this.#t.emit("childrenChanged",{parentId:n.parentId,slotOrBlockName:n.parentName,newChildIds:this.#r[n.parentId][n.parentName],type:"slot"});let c=d=>{this.#t.emit("nodeChanged",{changedNode:d,type:"new",oldValue:void 0})};this.visitNodeAndDescendants(l,c)}return this.pristine=!1,l}#v({composition:e,ignoreRootOverrides:n,preserveChildrenSlotSections:r}){this.#i=_o(this.#i,i=>{let a=WZ({beforeApplyParameterOverride(d,f,m){i[d._id]??={parameters:{},dataResources:{}},i[d._id].parameters[f]=_u(m)},beforeApplyDataResourceOverride(d,f,m){d._dataResources?.[f]?.ignorePatternParameterDefault||(i[d._id]??={parameters:{},dataResources:{}},i[d._id].dataResources[f]=_u(m))}}),l=WZ({beforeApplyParameterOverride(d,f,m,h){i[d._id]?.parameters[f]||(i[d._id]??={parameters:{},dataResources:{}},i[d._id].parameters[f]=_u(h??null))},beforeApplyDataResourceOverride(d,f,m,h){d._dataResources?.[f]?.ignorePatternParameterDefault||i[d._id]?.dataResources[f]||(i[d._id]??={parameters:{},dataResources:{}},i[d._id].dataResources[f]=_u(h))}});if(n){let{_overrides:d,...f}=e;m0(f,({node:m})=>{a.visitNode(m)})}let c=n?l:a;m0(e,({node:d})=>{c.visitNode(d)})});let o=G4e({preserveOwnSlotSections:!0,preserveChildrenSlotSections:r});m0(e,i=>{o(i)})}visitNodeAndDescendants(e,n){let r=this.getNodeById(e);if(!r)throw new Error("Insanity detected.");n(r),this.visitDescendants(e,n)}visitDescendants(e,n){let r=this.#p(e,new Set);for(let o of r)n(...o)}async visitDescendantsAsync(e,n){let r=this.#p(e,new Set);for(let o of r)await n(...o)}*#p(e,n){let r=this.#e[e],o=this.#r[e]??{},i=Object.entries(this.#o[e]??{}).filter(([,a])=>a?.type===Tc)??[];if(!r)throw new Error("Insanity detected.");n.add(e);for(let[a,l]of i){let c=l.value??[];for(let d=0;d<c.length;d++){let f=c[d],m=this.#e[f];if(m){if(n.has(f)){console.error(`Detected parent/child cycle in composition, ID ${f} exists more than once. The traversal of descendants will be aborted for the cycle subtree.`);continue}yield[m,r,a,d];for(let h of this.#p(f,n))yield h}}}for(let[a,l]of Object.entries(o))for(let c=0;c<l.length;c++){let d=l[c],f=this.#e[d];if(f){if(n.has(d)){console.error(`Detected parent/child cycle in composition, ID ${d} exists more than once. The traversal of descendants will be aborted for the cycle subtree.`);continue}yield[f,r,a,c];for(let m of this.#p(d,n))yield m}}}#m({nodeId:e,destinationParentId:n,destinationSlotName:r,sourceSlotName:o}){let i=r,a=o===l3e,l=i===l3e,c=o===u3e,d=i===u3e,f=i===JZ,m=this.getNodeProperty(e,s3e);l&&m&&this.updateNodeProperty({nodeId:e,property:s3e,value:void 0,source:"other",locale:void 0,conditionIndex:-1});let h=this.getNodeProperty(e,aT);!l&&h&&this.updateNodeProperty({nodeId:e,property:aT,value:void 0,source:"other",locale:void 0,conditionIndex:-1}),l&&!a&&this.#S({nodeId:e,siblingIds:this.getNodeChildren(n)?.[r]??[],selectExistingName:b=>this.getNodeProperty(b,aT)?.value?.name,setName:b=>this.updateNodeProperty({nodeId:e,property:aT,value:C=>C&&typeof C=="object"&&C!==null?{...C,name:b}:{name:b,crit:[]},source:"other",locale:void 0,conditionIndex:-1,type:aT})}),d&&!c&&this.#S({nodeId:e,siblingIds:this.getNodeChildren(n)?.[r]??[],selectExistingName:b=>this.getNodeProperty(b,c3e)?.value?.id,setName:b=>this.updateNodeProperty({nodeId:e,property:c3e,value:C=>C&&typeof C=="object"&&C!==null?{...C,id:b}:{id:b},source:"other",locale:void 0,conditionIndex:-1,type:"testVariant"})});let g=this.getNodeProperty(e,iT);!f&&g&&this.updateNodeProperty({nodeId:e,property:iT,value:void 0,source:"other",locale:void 0,conditionIndex:-1});let y=this.getNodeProperty(e,p0);(l||f||d)&&y&&this.updateNodeProperty({nodeId:e,property:p0,value:void 0,source:"other",locale:void 0,conditionIndex:-1})}#S({nodeId:e,siblingIds:n,selectExistingName:r,setName:o}){let i=r(e),a=m=>n.some(h=>h===e?!1:r(h)===m),l=i&&a(i);if(i&&!l)return;let c=this.getNodeById(e)?.value.type;if(!c)throw new Error("Insanity detected.");let d=0,f=qZ(e,c,d);do f=qZ(e,c,d),d++;while(a(f));o(f)}};function f3e(t){return t?.value===void 0&&!t?.conditions&&!t?.locales&&!t?.localesConditions?null:t}function Hh(t,e){return fit(t,e,()=>({nodeId:e,actions:[]}))}function fit(t,e,n){return t.has(e)||t.set(e,n()),t.get(e)}import{CANVAS_DRAFT_STATE as eq,CanvasClient as git}from"@uniformdev/canvas";function m3e(t){return t.reduce((e,n)=>(e[n._id]={id:n._id,type:n.type,name:n._name},e),{})}import{CANVAS_DRAFT_STATE as y3e,CanvasClient as QZ,ContentClient as b3e,ProjectClient as x3e}from"@uniformdev/canvas";var h3e=J(k4e());var g3e=(0,h3e.default)(6),JL=class t extends Error{constructor(n,r,o,i,a,l){super(`${n}
|
|
5181
|
+
${i}${a?" "+a:""} (${r} ${o}${l?` Request ID: ${l}`:""})`);this.errorMessage=n;this.fetchMethod=r;this.fetchUri=o;this.statusCode=i;this.statusText=a;this.requestId=l;Object.setPrototypeOf(this,t.prototype)}};var XL=class t{options;constructor(e){if(!e.apiKey&&!e.bearerToken)throw new Error("You must provide an API key or a bearer token");let n=e.fetch;if(!n)if(typeof window<"u")n=window.fetch.bind(window);else if(typeof fetch<"u")n=fetch;else throw new Error("You must provide or polyfill a fetch implementation when not in a browser");this.options={...e,fetch:n,apiHost:this.ensureApiHost(e.apiHost),apiKey:e.apiKey??null,projectId:e.projectId??null,bearerToken:e.bearerToken??null,limitPolicy:e.limitPolicy??g3e,bypassCache:e.bypassCache??!1}}async apiClient(e,n){return(await this.apiClientWithResponse(e,n)).body}async apiClientWithResponse(e,n){return this.options.limitPolicy(async()=>{let r=this.options.apiKey?{"x-api-key":this.options.apiKey}:{Authorization:`Bearer ${this.options.bearerToken}`};this.options.bypassCache&&(r["x-bypass-cache"]="true");let{fetch:o,signal:i}=this.options,l=await pit(()=>o(e.toString(),{...n,signal:i,headers:{...n?.headers,...r}}));if(!l.ok){let c="";try{let d=await l.text();try{let f=JSON.parse(d);f.errorMessage?c=Array.isArray(f.errorMessage)?f.errorMessage.join(", "):f.errorMessage:c=d}catch{c=d}}catch{c="General error"}throw new JL(c,n?.method??"GET",e.toString(),l.status,l.statusText,t.getRequestId(l))}return n?.expectNoContent?{response:l,body:null}:{response:l,body:await l.json()}})}createUrl(e,n,r){let o=new URL(`${r??this.options.apiHost}${e}`);return Object.entries(n??{}).forEach(([i,a])=>{typeof a<"u"&&a!==null&&o.searchParams.append(i,Array.isArray(a)?a.join(","):a?.toString()??"")}),o}ensureApiHost(e){if(!e)return"https://uniform.app";if(!e?.startsWith("http"))throw new Error('Your apiHost must start with "http"');if(e.indexOf("/",8)>-1)throw new Error("Your apiHost must not contain a path element after the domain");if(e.indexOf("?")>-1)throw new Error("Your apiHost must not contain a query string");return e?.endsWith("/")&&(e=e.substring(0,e.length-1)),e}static getRequestId(e){let n=e.headers.get("apigw-requestid");if(n)return n}};async function pit(t){let n=5,r;for(;n>0&&(r=await t(),r.status===429);){let o=0;try{let l=r.clone(),c=l.headers.get("date"),d=c?new Date(c).getTime():void 0,m=(await l.json())?.info?.reset;typeof d=="number"&&typeof m=="number"&&(o=Math.max(0,Math.min(Math.round(1.1*(m-d)),1e4)))}catch{}let i=Math.pow(2,5-n)*333,a=i+Math.round(Math.random()*(i/2))*(Math.random()>.5?1:-1);await new Promise(l=>setTimeout(l,o+a)),n-=1}return r}var QL=class extends XL{telemetryContext;constructor(e){e.apiHost||(e.apiHost="https://ai.uniform.global"),super(e),this.telemetryContext=e.telemetryContext}async invoke(e,n){let r={};if(this.telemetryContext){let{threadId:i,uniformClient:a,userAgent:l}=this.telemetryContext;i&&(r["x-thread-id"]=i),a&&(r["x-uniform-client"]=a),l&&(r["user-agent"]=l)}return(await this.apiClientWithResponse(new URL(`/projects/${this.options.projectId}/tools/${e}`,this.options.apiHost),{method:"POST",body:n?JSON.stringify(n):void 0,headers:Object.keys(r).length>0?r:void 0})).body}};var v3e={name:"@uniformdev/uniform-mcp",version:"20.30.0",description:"Uniform MCP Server",license:"SEE LICENSE IN LICENSE.txt",bin:{"uniform-mcp":"./dist/index.mjs"},exports:{types:"./dist/index.d.mts",import:"./dist/index.mjs"},sideEffects:!1,scripts:{build:"tsup",dev:"tsup --watch",clean:"rimraf dist",test:"vitest",lint:'eslint "src/**/*.{js,ts,tsx}"',format:'prettier --write "src/**/*.{js,ts,tsx}"',mcp:"node dist/index.mjs"},dependencies:{"@modelcontextprotocol/sdk":"^1.12.0","@uniformdev/canvas":"workspace:*","fast-json-patch":"^3.1.1",immer:"10.1.1",zod:"3.23.8"},files:["/dist"],publishConfig:{access:"public"},devDependencies:{"@uniformdev/design-system":"workspace:*","@uniformdev/files":"workspace:*","@uniformdev/mesh-edgehancer-sdk":"workspace:*","@uniformdev/richtext":"workspace:*",vitest:"^3.1.4"}};function sT(){return new QL({...pt,apiHost:pt.aiApiHost,telemetryContext:{userAgent:`uniform-mcp/${v3e.version}`,uniformClient:"mcp"}})}function C3e(){let t,e,n;return{fetchProjectGuidance:async()=>(t!==void 0||(t=(await new x3e(pt).get({projectId:pt.projectId}))?.guidance),t),fetchDefinitions:async()=>{if(e!==void 0)return e;let o=await new QZ(pt).getComponentDefinitions({limit:1e3,includeSystem:!0});return e=Object.fromEntries(o.componentDefinitions.map(i=>[i.id,i])),e},fetchPatterns:async()=>{if(n!==void 0)return n;let o=await new QZ(pt).getCompositionList({limit:1e3,pattern:!0,patternType:"component",resolveData:!1,skipPatternResolution:!0,skipOverridesResolution:!0,state:y3e});return n=m3e(o.compositions.map(i=>i.composition)),n},resolvePatternData:async r=>(await new QZ(pt).getCompositionById({compositionId:r,state:y3e,skipPatternResolution:!1,skipOverridesResolution:!0,withComponentIDs:!0,skipDataResolution:!0,withWorkflowDefinition:!0,releaseId:void 0}))?.composition,getToolClient:async()=>sT(),getDimensionGuidance:async()=>{}}}function S3e(){let t,e;return{fetchProjectGuidance:async()=>(t!==void 0||(t=(await new x3e(pt).get({projectId:pt.projectId}))?.guidance),t),fetchDefinitions:async()=>{if(e!==void 0)return e;let r=await new b3e(pt).getContentTypes({limit:1e3});return e=Object.fromEntries(r.contentTypes.map(o=>[o.id,X4e(o)])),e},fetchPatterns:async()=>({}),resolvePatternData:async n=>{let o=(await new b3e(pt).getEntries({entryIDs:[n],skipPatternResolution:!1,skipOverridesResolution:!0,withComponentIDs:!0,skipDataResolution:!0,withWorkflowDefinition:!0,releaseId:void 0}))?.entries[0];return qL(o).composition},getToolClient:async()=>sT(),getDimensionGuidance:async()=>{}}}import{LocaleClient as hit}from"@uniformdev/canvas";async function eO(t){if(!t||t.length===0)return;let r=(await new hit(pt).get()).results.map(i=>i.locale),o=t.filter(i=>!r.includes(i));if(o.length>0)throw new Error(`The following locales are not registered in your project: ${o.join(", ")}`)}async function tO({action:t,id:e,instructions:n,isPattern:r,patternId:o,getEditUrl:i}){let a=new git(pt),l,c,d=t==="update"?e:void 0,f={success:!0,actionsTaken:[]};if(t==="create"){if(!n)throw new Error("Instructions are required for create");if(!n.name)throw new Error("Name is required for create");if(!n.type)throw new Error("Type is required for create");if(!o)l=new jh({_id:e,_name:n.name,type:n.type,_overridability:{hideLockedParameters:!0}});else{let m={composition:{_id:e,_name:n.name,type:n.type,_pattern:o},projectId:pt.projectId,state:eq,pattern:!1};await a.updateComposition(m),d=e}}if(d){if(c=await a.getCompositionById({compositionId:e,state:eq,skipDataResolution:!0,skipPatternResolution:!1,withComponentIDs:!0,skipOverridesResolution:!0}),!c)throw new Error("Composition not found");l=new jh(c.composition)}if(t==="delete"&&await a.removeComposition({compositionId:e}),l){await eO(n?.localeUpdates?.enableLocales),f=await jL({twee:l,descriptionUpdate:void 0,slugUpdate:void 0,nameUpdate:n?.name,propertyUpdates:n?.parameterUpdates??[],localeUpdates:n?.localeUpdates,slotUpdates:n??{newComponentsInSlots:[],deletedComponentsInSlots:[]},currentEditorLocale:void 0,referenceData:C3e()});let m=l.exportTree(),h=l.exportMetadata(),g={composition:m,projectId:pt.projectId,state:eq,pattern:r,releaseId:c?.releaseId,editionId:c?.editionId,...h};await a.updateComposition(g)}return{content:[{type:"text",text:JSON.stringify({...f,editUrl:i(e)},null,2)}]}}function nO(t){return`${pt.baseWebUrl}/dashboards/canvas/edit/${t}`}async function rO(t,e){return await sT().invoke("createFilterExpression",{...t,entityType:e})}var vit={action:tq.enum(["create","update","delete"]).describe("The action to perform"),id:tq.string().uuid().describe("UUID of the composition instance to create, update, or delete"),patternId:tq.string().uuid().describe("Composition pattern ID to create the composition from. Omit when not creating, or when creating a composition without a composition pattern.").optional(),instructions:une.describe("Modification instructions for the composition. Omit for delete.").optional()};function w3e(t){t.tool("compositionAction","Creates, updates, or deletes a Uniform Composition",vit,async e=>await tO({...e,isPattern:!1,getEditUrl:nO,patternId:e.patternId}))}import{z as Wo}from"zod";var yit=Wo.object({field:Wo.string(),operator:Wo.string(),value:Wo.string().or(Wo.array(Wo.string()))}),bit=Wo.object({filter:Wo.array(yit),error:Wo.string().describe("An error message if the filter expression could not be created, otherwise an empty string"),sort:Wo.array(Wo.enum(["created_at_ASC","created_at_DESC","updated_at_ASC","updated_at_DESC","author_ASC","author_DESC","creator_ASC","creator_DESC","name_ASC","name_DESC","slug_ASC","slug_DESC"])),limit:Wo.number().min(1).max(100),offset:Wo.number().min(0),keyword:Wo.string(),locale:Wo.string().optional()}),xp=Wo.object({searchExpressionPrompt:Wo.string().describe(`Describe what you are looking for, for example "created by me in the last week" or "type is article and headline contains breaking news" or "keyword search for breaking news".
|
|
5182
5182
|
You can specify multiple criteria (AND only).
|
|
5183
5183
|
You can filter by date, number, or string properties on the definition, as well as name, created, modified, author, slug, enabled locales, type, and publish status.`),username:Wo.string().describe("The username of the current user. If you do not know the username, use an empty string"),locale:Wo.string().describe("The current locale. If there is no current locale, use an empty string")}),oWt={displayName:"Create filter expression",description:"Creates a Uniform search filter expression for searching entries, patterns, or compositions from a user prompt. Meant to be a callable tool only.",inputSchema:xp.extend({entityType:Wo.enum(["composition","entry","componentPattern","compositionPattern","entryPattern"]).describe("The entity type we are creating a filter for")}),outputSchema:bit,runsAt:"server",timeout:10,callable:!0};import{z as jat}from"zod";var Cp=class extends Error{},oO=class extends Cp{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}},iO=class extends Cp{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}},aO=class extends Cp{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}},_c=class extends Cp{},vC=class extends Cp{constructor(e){super(`Invalid unit ${e}`)}},Ko=class extends Cp{},Dc=class extends Cp{constructor(){super("Zone is an abstract class")}};var ze="numeric",$c="short",Bl="long",Wh={year:ze,month:ze,day:ze},lT={year:ze,month:$c,day:ze},nq={year:ze,month:$c,day:ze,weekday:$c},uT={year:ze,month:Bl,day:ze},cT={year:ze,month:Bl,day:ze,weekday:Bl},dT={hour:ze,minute:ze},fT={hour:ze,minute:ze,second:ze},pT={hour:ze,minute:ze,second:ze,timeZoneName:$c},mT={hour:ze,minute:ze,second:ze,timeZoneName:Bl},hT={hour:ze,minute:ze,hourCycle:"h23"},gT={hour:ze,minute:ze,second:ze,hourCycle:"h23"},vT={hour:ze,minute:ze,second:ze,hourCycle:"h23",timeZoneName:$c},yT={hour:ze,minute:ze,second:ze,hourCycle:"h23",timeZoneName:Bl},bT={year:ze,month:ze,day:ze,hour:ze,minute:ze},xT={year:ze,month:ze,day:ze,hour:ze,minute:ze,second:ze},CT={year:ze,month:$c,day:ze,hour:ze,minute:ze},ST={year:ze,month:$c,day:ze,hour:ze,minute:ze,second:ze},rq={year:ze,month:$c,day:ze,weekday:$c,hour:ze,minute:ze},wT={year:ze,month:Bl,day:ze,hour:ze,minute:ze,timeZoneName:$c},ET={year:ze,month:Bl,day:ze,hour:ze,minute:ze,second:ze,timeZoneName:$c},TT={year:ze,month:Bl,day:ze,weekday:Bl,hour:ze,minute:ze,timeZoneName:Bl},_T={year:ze,month:Bl,day:ze,weekday:Bl,hour:ze,minute:ze,second:ze,timeZoneName:Bl};var al=class{get type(){throw new Dc}get name(){throw new Dc}get ianaName(){return this.name}get isUniversal(){throw new Dc}offsetName(e,n){throw new Dc}formatOffset(e,n){throw new Dc}offset(e){throw new Dc}equals(e){throw new Dc}get isValid(){throw new Dc}};var oq=null,Kh=class t extends al{static get instance(){return oq===null&&(oq=new t),oq}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:n,locale:r}){return lO(e,n,r)}formatOffset(e,n){return Gh(this.offset(e),n)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}};var cO={};function xit(t){return cO[t]||(cO[t]=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"})),cO[t]}var Cit={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function Sit(t,e){let n=t.format(e).replace(/\u200E/g,""),r=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(n),[,o,i,a,l,c,d,f]=r;return[a,o,i,l,c,d,f]}function wit(t,e){let n=t.formatToParts(e),r=[];for(let o=0;o<n.length;o++){let{type:i,value:a}=n[o],l=Cit[i];i==="era"?r[l]=a:Mt(l)||(r[l]=parseInt(a,10))}return r}var uO={},Ua=class t extends al{static create(e){return uO[e]||(uO[e]=new t(e)),uO[e]}static resetCache(){uO={},cO={}}static isValidSpecifier(e){return this.isValidZone(e)}static isValidZone(e){if(!e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}).format(),!0}catch{return!1}}constructor(e){super(),this.zoneName=e,this.valid=t.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:n,locale:r}){return lO(e,n,r,this.name)}formatOffset(e,n){return Gh(this.offset(e),n)}offset(e){let n=new Date(e);if(isNaN(n))return NaN;let r=xit(this.name),[o,i,a,l,c,d,f]=r.formatToParts?wit(r,n):Sit(r,n);l==="BC"&&(o=-Math.abs(o)+1);let h=yC({year:o,month:i,day:a,hour:c===24?0:c,minute:d,second:f,millisecond:0}),g=+n,y=g%1e3;return g-=y>=0?y:1e3+y,(h-g)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}};var E3e={};function Eit(t,e={}){let n=JSON.stringify([t,e]),r=E3e[n];return r||(r=new Intl.ListFormat(t,e),E3e[n]=r),r}var iq={};function aq(t,e={}){let n=JSON.stringify([t,e]),r=iq[n];return r||(r=new Intl.DateTimeFormat(t,e),iq[n]=r),r}var sq={};function Tit(t,e={}){let n=JSON.stringify([t,e]),r=sq[n];return r||(r=new Intl.NumberFormat(t,e),sq[n]=r),r}var lq={};function _it(t,e={}){let{base:n,...r}=e,o=JSON.stringify([t,r]),i=lq[o];return i||(i=new Intl.RelativeTimeFormat(t,e),lq[o]=i),i}var DT=null;function Dit(){return DT||(DT=new Intl.DateTimeFormat().resolvedOptions().locale,DT)}var T3e={};function $it(t){let e=T3e[t];if(!e){let n=new Intl.Locale(t);e="getWeekInfo"in n?n.getWeekInfo():n.weekInfo,T3e[t]=e}return e}function Nit(t){let e=t.indexOf("-x-");e!==-1&&(t=t.substring(0,e));let n=t.indexOf("-u-");if(n===-1)return[t];{let r,o;try{r=aq(t).resolvedOptions(),o=t}catch{let c=t.substring(0,n);r=aq(c).resolvedOptions(),o=c}let{numberingSystem:i,calendar:a}=r;return[o,i,a]}}function Lit(t,e,n){return(n||e)&&(t.includes("-u-")||(t+="-u"),n&&(t+=`-ca-${n}`),e&&(t+=`-nu-${e}`)),t}function Oit(t){let e=[];for(let n=1;n<=12;n++){let r=gn.utc(2009,n,1);e.push(t(r))}return e}function Mit(t){let e=[];for(let n=1;n<=7;n++){let r=gn.utc(2016,11,13+n);e.push(t(r))}return e}function dO(t,e,n,r){let o=t.listingMode();return o==="error"?null:o==="en"?n(e):r(e)}function Rit(t){return t.numberingSystem&&t.numberingSystem!=="latn"?!1:t.numberingSystem==="latn"||!t.locale||t.locale.startsWith("en")||new Intl.DateTimeFormat(t.intl).resolvedOptions().numberingSystem==="latn"}var uq=class{constructor(e,n,r){this.padTo=r.padTo||0,this.floor=r.floor||!1;let{padTo:o,floor:i,...a}=r;if(!n||Object.keys(a).length>0){let l={useGrouping:!1,...r};r.padTo>0&&(l.minimumIntegerDigits=r.padTo),this.inf=Tit(e,l)}}format(e){if(this.inf){let n=this.floor?Math.floor(e):e;return this.inf.format(n)}else{let n=this.floor?Math.floor(e):bC(e,3);return go(n,this.padTo)}}},cq=class{constructor(e,n,r){this.opts=r,this.originalZone=void 0;let o;if(this.opts.timeZone)this.dt=e;else if(e.zone.type==="fixed"){let a=-1*(e.offset/60),l=a>=0?`Etc/GMT+${a}`:`Etc/GMT${a}`;e.offset!==0&&Ua.create(l).valid?(o=l,this.dt=e):(o="UTC",this.dt=e.offset===0?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else e.zone.type==="system"?this.dt=e:e.zone.type==="iana"?(this.dt=e,o=e.zone.name):(o="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);let i={...this.opts};i.timeZone=i.timeZone||o,this.dtf=aq(n,i)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){let e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(n=>{if(n.type==="timeZoneName"){let r=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...n,value:r}}else return n}):e}resolvedOptions(){return this.dtf.resolvedOptions()}},dq=class{constructor(e,n,r){this.opts={style:"long",...r},!n&&fO()&&(this.rtf=_it(e,r))}format(e,n){return this.rtf?this.rtf.format(e,n):_3e(n,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,n){return this.rtf?this.rtf.formatToParts(e,n):[]}},Ait={firstDay:1,minimalDays:4,weekend:[6,7]},Jn=class t{static fromOpts(e){return t.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,n,r,o,i=!1){let a=e||Vn.defaultLocale,l=a||(i?"en-US":Dit()),c=n||Vn.defaultNumberingSystem,d=r||Vn.defaultOutputCalendar,f=$T(o)||Vn.defaultWeekSettings;return new t(l,c,d,f,a)}static resetCache(){DT=null,iq={},sq={},lq={}}static fromObject({locale:e,numberingSystem:n,outputCalendar:r,weekSettings:o}={}){return t.create(e,n,r,o)}constructor(e,n,r,o,i){let[a,l,c]=Nit(e);this.locale=a,this.numberingSystem=n||l||null,this.outputCalendar=r||c||null,this.weekSettings=o,this.intl=Lit(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=i,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=Rit(this)),this.fastNumbersCached}listingMode(){let e=this.isEnglish(),n=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return e&&n?"en":"intl"}clone(e){return!e||Object.getOwnPropertyNames(e).length===0?this:t.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,$T(e.weekSettings)||this.weekSettings,e.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,n=!1){return dO(this,e,fq,()=>{let r=n?{month:e,day:"numeric"}:{month:e},o=n?"format":"standalone";return this.monthsCache[o][e]||(this.monthsCache[o][e]=Oit(i=>this.extract(i,r,"month"))),this.monthsCache[o][e]})}weekdays(e,n=!1){return dO(this,e,pq,()=>{let r=n?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},o=n?"format":"standalone";return this.weekdaysCache[o][e]||(this.weekdaysCache[o][e]=Mit(i=>this.extract(i,r,"weekday"))),this.weekdaysCache[o][e]})}meridiems(){return dO(this,void 0,()=>mq,()=>{if(!this.meridiemCache){let e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[gn.utc(2016,11,13,9),gn.utc(2016,11,13,19)].map(n=>this.extract(n,e,"dayperiod"))}return this.meridiemCache})}eras(e){return dO(this,e,hq,()=>{let n={era:e};return this.eraCache[e]||(this.eraCache[e]=[gn.utc(-40,1,1),gn.utc(2017,1,1)].map(r=>this.extract(r,n,"era"))),this.eraCache[e]})}extract(e,n,r){let o=this.dtFormatter(e,n),i=o.formatToParts(),a=i.find(l=>l.type.toLowerCase()===r);return a?a.value:null}numberFormatter(e={}){return new uq(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,n={}){return new cq(e,this.intl,n)}relFormatter(e={}){return new dq(this.intl,this.isEnglish(),e)}listFormatter(e={}){return Eit(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:pO()?$it(this.locale):Ait}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}};var vq=null,Hi=class t extends al{static get utcInstance(){return vq===null&&(vq=new t(0)),vq}static instance(e){return e===0?t.utcInstance:new t(e)}static parseSpecifier(e){if(e){let n=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(n)return new t(g0(n[1],n[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${Gh(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${Gh(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,n){return Gh(this.fixed,n)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type==="fixed"&&e.fixed===this.fixed}get isValid(){return!0}};var xC=class extends al{constructor(e){super(),this.zoneName=e}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}};function Nc(t,e){let n;if(Mt(t)||t===null)return e;if(t instanceof al)return t;if(D3e(t)){let r=t.toLowerCase();return r==="default"?e:r==="local"||r==="system"?Kh.instance:r==="utc"||r==="gmt"?Hi.utcInstance:Hi.parseSpecifier(r)||Ua.create(t)}else return Ud(t)?Hi.instance(t):typeof t=="object"&&"offset"in t&&typeof t.offset=="function"?t:new xC(t)}var $3e=()=>Date.now(),N3e="system",L3e=null,O3e=null,M3e=null,R3e=60,A3e,k3e=null,Vn=class{static get now(){return $3e}static set now(e){$3e=e}static set defaultZone(e){N3e=e}static get defaultZone(){return Nc(N3e,Kh.instance)}static get defaultLocale(){return L3e}static set defaultLocale(e){L3e=e}static get defaultNumberingSystem(){return O3e}static set defaultNumberingSystem(e){O3e=e}static get defaultOutputCalendar(){return M3e}static set defaultOutputCalendar(e){M3e=e}static get defaultWeekSettings(){return k3e}static set defaultWeekSettings(e){k3e=$T(e)}static get twoDigitCutoffYear(){return R3e}static set twoDigitCutoffYear(e){R3e=e%100}static get throwOnInvalid(){return A3e}static set throwOnInvalid(e){A3e=e}static resetCaches(){Jn.resetCache(),Ua.resetCache()}};var ji=class{constructor(e,n){this.reason=e,this.explanation=n}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}};var P3e=[0,31,59,90,120,151,181,212,243,273,304,334],I3e=[0,31,60,91,121,152,182,213,244,274,305,335];function Du(t,e){return new ji("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${t}, which is invalid`)}function mO(t,e,n){let r=new Date(Date.UTC(t,e-1,n));t<100&&t>=0&&r.setUTCFullYear(r.getUTCFullYear()-1900);let o=r.getUTCDay();return o===0?7:o}function F3e(t,e,n){return n+(y0(t)?I3e:P3e)[e-1]}function B3e(t,e){let n=y0(t)?I3e:P3e,r=n.findIndex(i=>i<e),o=e-n[r];return{month:r+1,day:o}}function hO(t,e){return(t-e+7)%7+1}function NT(t,e=4,n=1){let{year:r,month:o,day:i}=t,a=F3e(r,o,i),l=hO(mO(r,o,i),n),c=Math.floor((a-l+14-e)/7),d;return c<1?(d=r-1,c=v0(d,e,n)):c>v0(r,e,n)?(d=r+1,c=1):d=r,{weekYear:d,weekNumber:c,weekday:l,...OT(t)}}function yq(t,e=4,n=1){let{weekYear:r,weekNumber:o,weekday:i}=t,a=hO(mO(r,1,e),n),l=Yh(r),c=o*7+i-a-7+e,d;c<1?(d=r-1,c+=Yh(d)):c>l?(d=r+1,c-=Yh(r)):d=r;let{month:f,day:m}=B3e(d,c);return{year:d,month:f,day:m,...OT(t)}}function gO(t){let{year:e,month:n,day:r}=t,o=F3e(e,n,r);return{year:e,ordinal:o,...OT(t)}}function bq(t){let{year:e,ordinal:n}=t,{month:r,day:o}=B3e(e,n);return{year:e,month:r,day:o,...OT(t)}}function xq(t,e){if(!Mt(t.localWeekday)||!Mt(t.localWeekNumber)||!Mt(t.localWeekYear)){if(!Mt(t.weekday)||!Mt(t.weekNumber)||!Mt(t.weekYear))throw new _c("Cannot mix locale-based week fields with ISO-based week fields");return Mt(t.localWeekday)||(t.weekday=t.localWeekday),Mt(t.localWeekNumber)||(t.weekNumber=t.localWeekNumber),Mt(t.localWeekYear)||(t.weekYear=t.localWeekYear),delete t.localWeekday,delete t.localWeekNumber,delete t.localWeekYear,{minDaysInFirstWeek:e.getMinDaysInFirstWeek(),startOfWeek:e.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function z3e(t,e=4,n=1){let r=LT(t.weekYear),o=zl(t.weekNumber,1,v0(t.weekYear,e,n)),i=zl(t.weekday,1,7);return r?o?i?!1:Du("weekday",t.weekday):Du("week",t.weekNumber):Du("weekYear",t.weekYear)}function V3e(t){let e=LT(t.year),n=zl(t.ordinal,1,Yh(t.year));return e?n?!1:Du("ordinal",t.ordinal):Du("year",t.year)}function Cq(t){let e=LT(t.year),n=zl(t.month,1,12),r=zl(t.day,1,CC(t.year,t.month));return e?n?r?!1:Du("day",t.day):Du("month",t.month):Du("year",t.year)}function Sq(t){let{hour:e,minute:n,second:r,millisecond:o}=t,i=zl(e,0,23)||e===24&&n===0&&r===0&&o===0,a=zl(n,0,59),l=zl(r,0,59),c=zl(o,0,999);return i?a?l?c?!1:Du("millisecond",o):Du("second",r):Du("minute",n):Du("hour",e)}function Mt(t){return typeof t>"u"}function Ud(t){return typeof t=="number"}function LT(t){return typeof t=="number"&&t%1===0}function D3e(t){return typeof t=="string"}function H3e(t){return Object.prototype.toString.call(t)==="[object Date]"}function fO(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function pO(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function j3e(t){return Array.isArray(t)?t:[t]}function wq(t,e,n){if(t.length!==0)return t.reduce((r,o)=>{let i=[e(o),o];return r&&n(r[0],i[0])===r[0]?r:i},null)[1]}function W3e(t,e){return e.reduce((n,r)=>(n[r]=t[r],n),{})}function Zh(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function $T(t){if(t==null)return null;if(typeof t!="object")throw new Ko("Week settings must be an object");if(!zl(t.firstDay,1,7)||!zl(t.minimalDays,1,7)||!Array.isArray(t.weekend)||t.weekend.some(e=>!zl(e,1,7)))throw new Ko("Invalid week settings");return{firstDay:t.firstDay,minimalDays:t.minimalDays,weekend:Array.from(t.weekend)}}function zl(t,e,n){return LT(t)&&t>=e&&t<=n}function kit(t,e){return t-e*Math.floor(t/e)}function go(t,e=2){let n=t<0,r;return n?r="-"+(""+-t).padStart(e,"0"):r=(""+t).padStart(e,"0"),r}function Sp(t){if(!(Mt(t)||t===null||t===""))return parseInt(t,10)}function qh(t){if(!(Mt(t)||t===null||t===""))return parseFloat(t)}function MT(t){if(!(Mt(t)||t===null||t==="")){let e=parseFloat("0."+t)*1e3;return Math.floor(e)}}function bC(t,e,n=!1){let r=10**e;return(n?Math.trunc:Math.round)(t*r)/r}function y0(t){return t%4===0&&(t%100!==0||t%400===0)}function Yh(t){return y0(t)?366:365}function CC(t,e){let n=kit(e-1,12)+1,r=t+(e-n)/12;return n===2?y0(r)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][n-1]}function yC(t){let e=Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,t.second,t.millisecond);return t.year<100&&t.year>=0&&(e=new Date(e),e.setUTCFullYear(t.year,t.month-1,t.day)),+e}function U3e(t,e,n){return-hO(mO(t,1,e),n)+e-1}function v0(t,e=4,n=1){let r=U3e(t,e,n),o=U3e(t+1,e,n);return(Yh(t)-r+o)/7}function RT(t){return t>99?t:t>Vn.twoDigitCutoffYear?1900+t:2e3+t}function lO(t,e,n,r=null){let o=new Date(t),i={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};r&&(i.timeZone=r);let a={timeZoneName:e,...i},l=new Intl.DateTimeFormat(n,a).formatToParts(o).find(c=>c.type.toLowerCase()==="timezonename");return l?l.value:null}function g0(t,e){let n=parseInt(t,10);Number.isNaN(n)&&(n=0);let r=parseInt(e,10)||0,o=n<0||Object.is(n,-0)?-r:r;return n*60+o}function Eq(t){let e=Number(t);if(typeof t=="boolean"||t===""||Number.isNaN(e))throw new Ko(`Invalid unit value ${t}`);return e}function SC(t,e){let n={};for(let r in t)if(Zh(t,r)){let o=t[r];if(o==null)continue;n[e(r)]=Eq(o)}return n}function Gh(t,e){let n=Math.trunc(Math.abs(t/60)),r=Math.trunc(Math.abs(t%60)),o=t>=0?"+":"-";switch(e){case"short":return`${o}${go(n,2)}:${go(r,2)}`;case"narrow":return`${o}${n}${r>0?`:${r}`:""}`;case"techie":return`${o}${go(n,2)}${go(r,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function OT(t){return W3e(t,["hour","minute","second","millisecond"])}var Pit=["January","February","March","April","May","June","July","August","September","October","November","December"],Tq=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Iit=["J","F","M","A","M","J","J","A","S","O","N","D"];function fq(t){switch(t){case"narrow":return[...Iit];case"short":return[...Tq];case"long":return[...Pit];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}var _q=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Dq=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Fit=["M","T","W","T","F","S","S"];function pq(t){switch(t){case"narrow":return[...Fit];case"short":return[...Dq];case"long":return[..._q];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}var mq=["AM","PM"],Bit=["Before Christ","Anno Domini"],zit=["BC","AD"],Vit=["B","A"];function hq(t){switch(t){case"narrow":return[...Vit];case"short":return[...zit];case"long":return[...Bit];default:return null}}function K3e(t){return mq[t.hour<12?0:1]}function G3e(t,e){return pq(e)[t.weekday-1]}function Y3e(t,e){return fq(e)[t.month-1]}function Z3e(t,e){return hq(e)[t.year<0?0:1]}function _3e(t,e,n="always",r=!1){let o={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},i=["hours","minutes","seconds"].indexOf(t)===-1;if(n==="auto"&&i){let m=t==="days";switch(e){case 1:return m?"tomorrow":`next ${o[t][0]}`;case-1:return m?"yesterday":`last ${o[t][0]}`;case 0:return m?"today":`this ${o[t][0]}`;default:}}let a=Object.is(e,-0)||e<0,l=Math.abs(e),c=l===1,d=o[t],f=r?c?d[1]:d[2]||d[1]:c?o[t][0]:t;return a?`${l} ${f} ago`:`in ${l} ${f}`}function q3e(t,e){let n="";for(let r of t)r.literal?n+=r.val:n+=e(r.val);return n}var Uit={D:Wh,DD:lT,DDD:uT,DDDD:cT,t:dT,tt:fT,ttt:pT,tttt:mT,T:hT,TT:gT,TTT:vT,TTTT:yT,f:bT,ff:CT,fff:wT,ffff:TT,F:xT,FF:ST,FFF:ET,FFFF:_T},Wi=class t{static create(e,n={}){return new t(e,n)}static parseFormat(e){let n=null,r="",o=!1,i=[];for(let a=0;a<e.length;a++){let l=e.charAt(a);l==="'"?(r.length>0&&i.push({literal:o||/^\s+$/.test(r),val:r}),n=null,r="",o=!o):o||l===n?r+=l:(r.length>0&&i.push({literal:/^\s+$/.test(r),val:r}),r=l,n=l)}return r.length>0&&i.push({literal:o||/^\s+$/.test(r),val:r}),i}static macroTokenToFormatOpts(e){return Uit[e]}constructor(e,n){this.opts=n,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,n){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...n}).format()}dtFormatter(e,n={}){return this.loc.dtFormatter(e,{...this.opts,...n})}formatDateTime(e,n){return this.dtFormatter(e,n).format()}formatDateTimeParts(e,n){return this.dtFormatter(e,n).formatToParts()}formatInterval(e,n){return this.dtFormatter(e.start,n).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,n){return this.dtFormatter(e,n).resolvedOptions()}num(e,n=0){if(this.opts.forceSimple)return go(e,n);let r={...this.opts};return n>0&&(r.padTo=n),this.loc.numberFormatter(r).format(e)}formatDateTimeFromString(e,n){let r=this.loc.listingMode()==="en",o=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",i=(g,y)=>this.loc.extract(e,g,y),a=g=>e.isOffsetFixed&&e.offset===0&&g.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,g.format):"",l=()=>r?K3e(e):i({hour:"numeric",hourCycle:"h12"},"dayperiod"),c=(g,y)=>r?Y3e(e,g):i(y?{month:g}:{month:g,day:"numeric"},"month"),d=(g,y)=>r?G3e(e,g):i(y?{weekday:g}:{weekday:g,month:"long",day:"numeric"},"weekday"),f=g=>{let y=t.macroTokenToFormatOpts(g);return y?this.formatWithSystemDefault(e,y):g},m=g=>r?Z3e(e,g):i({era:g},"era"),h=g=>{switch(g){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12===0?12:e.hour%12);case"hh":return this.num(e.hour%12===0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return a({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return a({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return a({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return l();case"d":return o?i({day:"numeric"},"day"):this.num(e.day);case"dd":return o?i({day:"2-digit"},"day"):this.num(e.day,2);case"c":return this.num(e.weekday);case"ccc":return d("short",!0);case"cccc":return d("long",!0);case"ccccc":return d("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return d("short",!1);case"EEEE":return d("long",!1);case"EEEEE":return d("narrow",!1);case"L":return o?i({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return o?i({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return c("short",!0);case"LLLL":return c("long",!0);case"LLLLL":return c("narrow",!0);case"M":return o?i({month:"numeric"},"month"):this.num(e.month);case"MM":return o?i({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return c("short",!1);case"MMMM":return c("long",!1);case"MMMMM":return c("narrow",!1);case"y":return o?i({year:"numeric"},"year"):this.num(e.year);case"yy":return o?i({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return o?i({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return o?i({year:"numeric"},"year"):this.num(e.year,6);case"G":return m("short");case"GG":return m("long");case"GGGGG":return m("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return f(g)}};return q3e(t.parseFormat(n),h)}formatDurationFromString(e,n){let r=c=>{switch(c[0]){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":return"hour";case"d":return"day";case"w":return"week";case"M":return"month";case"y":return"year";default:return null}},o=c=>d=>{let f=r(d);return f?this.num(c.get(f),d.length):d},i=t.parseFormat(n),a=i.reduce((c,{literal:d,val:f})=>d?c:c.concat(f),[]),l=e.shiftTo(...a.map(r).filter(c=>c));return q3e(i,o(l))}};var X3e=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function EC(...t){let e=t.reduce((n,r)=>n+r.source,"");return RegExp(`^${e}$`)}function TC(...t){return e=>t.reduce(([n,r,o],i)=>{let[a,l,c]=i(e,o);return[{...n,...a},l||r,c]},[{},null,1]).slice(0,2)}function _C(t,...e){if(t==null)return[null,null];for(let[n,r]of e){let o=n.exec(t);if(o)return r(o)}return[null,null]}function Q3e(...t){return(e,n)=>{let r={},o;for(o=0;o<t.length;o++)r[t[o]]=Sp(e[n+o]);return[r,null,n+o]}}var ewe=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,Hit=`(?:${ewe.source}?(?:\\[(${X3e.source})\\])?)?`,$q=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,twe=RegExp(`${$q.source}${Hit}`),Nq=RegExp(`(?:T${twe.source})?`),jit=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,Wit=/(\d{4})-?W(\d\d)(?:-?(\d))?/,Kit=/(\d{4})-?(\d{3})/,Git=Q3e("weekYear","weekNumber","weekDay"),Yit=Q3e("year","ordinal"),Zit=/(\d{4})-(\d\d)-(\d\d)/,nwe=RegExp(`${$q.source} ?(?:${ewe.source}|(${X3e.source}))?`),qit=RegExp(`(?: ${nwe.source})?`);function wC(t,e,n){let r=t[e];return Mt(r)?n:Sp(r)}function Jit(t,e){return[{year:wC(t,e),month:wC(t,e+1,1),day:wC(t,e+2,1)},null,e+3]}function DC(t,e){return[{hours:wC(t,e,0),minutes:wC(t,e+1,0),seconds:wC(t,e+2,0),milliseconds:MT(t[e+3])},null,e+4]}function AT(t,e){let n=!t[e]&&!t[e+1],r=g0(t[e+1],t[e+2]),o=n?null:Hi.instance(r);return[{},o,e+3]}function kT(t,e){let n=t[e]?Ua.create(t[e]):null;return[{},n,e+1]}var Xit=RegExp(`^T?${$q.source}$`),Qit=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function eat(t){let[e,n,r,o,i,a,l,c,d]=t,f=e[0]==="-",m=c&&c[0]==="-",h=(g,y=!1)=>g!==void 0&&(y||g&&f)?-g:g;return[{years:h(qh(n)),months:h(qh(r)),weeks:h(qh(o)),days:h(qh(i)),hours:h(qh(a)),minutes:h(qh(l)),seconds:h(qh(c),c==="-0"),milliseconds:h(MT(d),m)}]}var tat={GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function Lq(t,e,n,r,o,i,a){let l={year:e.length===2?RT(Sp(e)):Sp(e),month:Tq.indexOf(n)+1,day:Sp(r),hour:Sp(o),minute:Sp(i)};return a&&(l.second=Sp(a)),t&&(l.weekday=t.length>3?_q.indexOf(t)+1:Dq.indexOf(t)+1),l}var nat=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function rat(t){let[,e,n,r,o,i,a,l,c,d,f,m]=t,h=Lq(e,o,r,n,i,a,l),g;return c?g=tat[c]:d?g=0:g=g0(f,m),[h,new Hi(g)]}function oat(t){return t.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}var iat=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,aat=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,sat=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function J3e(t){let[,e,n,r,o,i,a,l]=t;return[Lq(e,o,r,n,i,a,l),Hi.utcInstance]}function lat(t){let[,e,n,r,o,i,a,l]=t;return[Lq(e,l,n,r,o,i,a),Hi.utcInstance]}var uat=EC(jit,Nq),cat=EC(Wit,Nq),dat=EC(Kit,Nq),fat=EC(twe),rwe=TC(Jit,DC,AT,kT),pat=TC(Git,DC,AT,kT),mat=TC(Yit,DC,AT,kT),hat=TC(DC,AT,kT);function owe(t){return _C(t,[uat,rwe],[cat,pat],[dat,mat],[fat,hat])}function iwe(t){return _C(oat(t),[nat,rat])}function awe(t){return _C(t,[iat,J3e],[aat,J3e],[sat,lat])}function swe(t){return _C(t,[Qit,eat])}var gat=TC(DC);function lwe(t){return _C(t,[Xit,gat])}var vat=EC(Zit,qit),yat=EC(nwe),bat=TC(DC,AT,kT);function uwe(t){return _C(t,[vat,rwe],[yat,bat])}var cwe="Invalid Duration",fwe={weeks:{days:7,hours:7*24,minutes:7*24*60,seconds:7*24*60*60,milliseconds:7*24*60*60*1e3},days:{hours:24,minutes:24*60,seconds:24*60*60,milliseconds:24*60*60*1e3},hours:{minutes:60,seconds:60*60,milliseconds:60*60*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},xat={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:91*24,minutes:91*24*60,seconds:91*24*60*60,milliseconds:91*24*60*60*1e3},months:{weeks:4,days:30,hours:30*24,minutes:30*24*60,seconds:30*24*60*60,milliseconds:30*24*60*60*1e3},...fwe},$u=146097/400,$C=146097/4800,Cat={years:{quarters:4,months:12,weeks:$u/7,days:$u,hours:$u*24,minutes:$u*24*60,seconds:$u*24*60*60,milliseconds:$u*24*60*60*1e3},quarters:{months:3,weeks:$u/28,days:$u/4,hours:$u*24/4,minutes:$u*24*60/4,seconds:$u*24*60*60/4,milliseconds:$u*24*60*60*1e3/4},months:{weeks:$C/7,days:$C,hours:$C*24,minutes:$C*24*60,seconds:$C*24*60*60,milliseconds:$C*24*60*60*1e3},...fwe},b0=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],Sat=b0.slice(0).reverse();function Jh(t,e,n=!1){let r={values:n?e.values:{...t.values,...e.values||{}},loc:t.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||t.conversionAccuracy,matrix:e.matrix||t.matrix};return new vo(r)}function pwe(t,e){let n=e.milliseconds??0;for(let r of Sat.slice(1))e[r]&&(n+=e[r]*t[r].milliseconds);return n}function dwe(t,e){let n=pwe(t,e)<0?-1:1;b0.reduceRight((r,o)=>{if(Mt(e[o]))return r;if(r){let i=e[r]*n,a=t[o][r],l=Math.floor(i/a);e[o]+=l*n,e[r]-=l*a*n}return o},null),b0.reduce((r,o)=>{if(Mt(e[o]))return r;if(r){let i=e[r]%1;e[r]-=i,e[o]+=i*t[r][o]}return o},null)}function wat(t){let e={};for(let[n,r]of Object.entries(t))r!==0&&(e[n]=r);return e}var vo=class t{constructor(e){let n=e.conversionAccuracy==="longterm"||!1,r=n?Cat:xat;e.matrix&&(r=e.matrix),this.values=e.values,this.loc=e.loc||Jn.create(),this.conversionAccuracy=n?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=r,this.isLuxonDuration=!0}static fromMillis(e,n){return t.fromObject({milliseconds:e},n)}static fromObject(e,n={}){if(e==null||typeof e!="object")throw new Ko(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new t({values:SC(e,t.normalizeUnit),loc:Jn.fromObject(n),conversionAccuracy:n.conversionAccuracy,matrix:n.matrix})}static fromDurationLike(e){if(Ud(e))return t.fromMillis(e);if(t.isDuration(e))return e;if(typeof e=="object")return t.fromObject(e);throw new Ko(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,n){let[r]=swe(e);return r?t.fromObject(r,n):t.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,n){let[r]=lwe(e);return r?t.fromObject(r,n):t.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,n=null){if(!e)throw new Ko("need to specify a reason the Duration is invalid");let r=e instanceof ji?e:new ji(e,n);if(Vn.throwOnInvalid)throw new aO(r);return new t({invalid:r})}static normalizeUnit(e){let n={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[e&&e.toLowerCase()];if(!n)throw new vC(e);return n}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,n={}){let r={...n,floor:n.round!==!1&&n.floor!==!1};return this.isValid?Wi.create(this.loc,r).formatDurationFromString(this,e):cwe}toHuman(e={}){if(!this.isValid)return cwe;let n=b0.map(r=>{let o=this.values[r];return Mt(o)?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:r.slice(0,-1)}).format(o)}).filter(r=>r);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(n)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return this.years!==0&&(e+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(e+=this.months+this.quarters*3+"M"),this.weeks!==0&&(e+=this.weeks+"W"),this.days!==0&&(e+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(e+="T"),this.hours!==0&&(e+=this.hours+"H"),this.minutes!==0&&(e+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(e+=bC(this.seconds+this.milliseconds/1e3,3)+"S"),e==="P"&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;let n=this.toMillis();return n<0||n>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1},gn.fromMillis(n,{zone:"UTC"}).toISOTime(e))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?pwe(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;let n=t.fromDurationLike(e),r={};for(let o of b0)(Zh(n.values,o)||Zh(this.values,o))&&(r[o]=n.get(o)+this.get(o));return Jh(this,{values:r},!0)}minus(e){if(!this.isValid)return this;let n=t.fromDurationLike(e);return this.plus(n.negate())}mapUnits(e){if(!this.isValid)return this;let n={};for(let r of Object.keys(this.values))n[r]=Eq(e(this.values[r],r));return Jh(this,{values:n},!0)}get(e){return this[t.normalizeUnit(e)]}set(e){if(!this.isValid)return this;let n={...this.values,...SC(e,t.normalizeUnit)};return Jh(this,{values:n})}reconfigure({locale:e,numberingSystem:n,conversionAccuracy:r,matrix:o}={}){let a={loc:this.loc.clone({locale:e,numberingSystem:n}),matrix:o,conversionAccuracy:r};return Jh(this,a)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;let e=this.toObject();return dwe(this.matrix,e),Jh(this,{values:e},!0)}rescale(){if(!this.isValid)return this;let e=wat(this.normalize().shiftToAll().toObject());return Jh(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(a=>t.normalizeUnit(a));let n={},r={},o=this.toObject(),i;for(let a of b0)if(e.indexOf(a)>=0){i=a;let l=0;for(let d in r)l+=this.matrix[d][a]*r[d],r[d]=0;Ud(o[a])&&(l+=o[a]);let c=Math.trunc(l);n[a]=c,r[a]=(l*1e3-c*1e3)/1e3}else Ud(o[a])&&(r[a]=o[a]);for(let a in r)r[a]!==0&&(n[i]+=a===i?r[a]:r[a]/this.matrix[i][a]);return dwe(this.matrix,n),Jh(this,{values:n},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;let e={};for(let n of Object.keys(this.values))e[n]=this.values[n]===0?0:-this.values[n];return Jh(this,{values:e},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid||!this.loc.equals(e.loc))return!1;function n(r,o){return r===void 0||r===0?o===void 0||o===0:r===o}for(let r of b0)if(!n(this.values[r],e.values[r]))return!1;return!0}};var NC="Invalid Interval";function Eat(t,e){return!t||!t.isValid?wp.invalid("missing or invalid start"):!e||!e.isValid?wp.invalid("missing or invalid end"):e<t?wp.invalid("end before start",`The end of an interval must be after its start, but you had start=${t.toISO()} and end=${e.toISO()}`):null}var wp=class t{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(e,n=null){if(!e)throw new Ko("need to specify a reason the Interval is invalid");let r=e instanceof ji?e:new ji(e,n);if(Vn.throwOnInvalid)throw new iO(r);return new t({invalid:r})}static fromDateTimes(e,n){let r=LC(e),o=LC(n),i=Eat(r,o);return i??new t({start:r,end:o})}static after(e,n){let r=vo.fromDurationLike(n),o=LC(e);return t.fromDateTimes(o,o.plus(r))}static before(e,n){let r=vo.fromDurationLike(n),o=LC(e);return t.fromDateTimes(o.minus(r),o)}static fromISO(e,n){let[r,o]=(e||"").split("/",2);if(r&&o){let i,a;try{i=gn.fromISO(r,n),a=i.isValid}catch{a=!1}let l,c;try{l=gn.fromISO(o,n),c=l.isValid}catch{c=!1}if(a&&c)return t.fromDateTimes(i,l);if(a){let d=vo.fromISO(o,n);if(d.isValid)return t.after(i,d)}else if(c){let d=vo.fromISO(r,n);if(d.isValid)return t.before(l,d)}}return t.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static isInterval(e){return e&&e.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(e="milliseconds"){return this.isValid?this.toDuration(e).get(e):NaN}count(e="milliseconds",n){if(!this.isValid)return NaN;let r=this.start.startOf(e,n),o;return n?.useLocaleWeeks?o=this.end.reconfigure({locale:r.locale}):o=this.end,o=o.startOf(e,n),Math.floor(o.diff(r,e).get(e))+(o.valueOf()!==this.end.valueOf())}hasSame(e){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,e):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(e){return this.isValid?this.s>e:!1}isBefore(e){return this.isValid?this.e<=e:!1}contains(e){return this.isValid?this.s<=e&&this.e>e:!1}set({start:e,end:n}={}){return this.isValid?t.fromDateTimes(e||this.s,n||this.e):this}splitAt(...e){if(!this.isValid)return[];let n=e.map(LC).filter(a=>this.contains(a)).sort((a,l)=>a.toMillis()-l.toMillis()),r=[],{s:o}=this,i=0;for(;o<this.e;){let a=n[i]||this.e,l=+a>+this.e?this.e:a;r.push(t.fromDateTimes(o,l)),o=l,i+=1}return r}splitBy(e){let n=vo.fromDurationLike(e);if(!this.isValid||!n.isValid||n.as("milliseconds")===0)return[];let{s:r}=this,o=1,i,a=[];for(;r<this.e;){let l=this.start.plus(n.mapUnits(c=>c*o));i=+l>+this.e?this.e:l,a.push(t.fromDateTimes(r,i)),r=i,o+=1}return a}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s<e.e}abutsStart(e){return this.isValid?+this.e==+e.s:!1}abutsEnd(e){return this.isValid?+e.e==+this.s:!1}engulfs(e){return this.isValid?this.s<=e.s&&this.e>=e.e:!1}equals(e){return!this.isValid||!e.isValid?!1:this.s.equals(e.s)&&this.e.equals(e.e)}intersection(e){if(!this.isValid)return this;let n=this.s>e.s?this.s:e.s,r=this.e<e.e?this.e:e.e;return n>=r?null:t.fromDateTimes(n,r)}union(e){if(!this.isValid)return this;let n=this.s<e.s?this.s:e.s,r=this.e>e.e?this.e:e.e;return t.fromDateTimes(n,r)}static merge(e){let[n,r]=e.sort((o,i)=>o.s-i.s).reduce(([o,i],a)=>i?i.overlaps(a)||i.abutsStart(a)?[o,i.union(a)]:[o.concat([i]),a]:[o,a],[[],null]);return r&&n.push(r),n}static xor(e){let n=null,r=0,o=[],i=e.map(c=>[{time:c.s,type:"s"},{time:c.e,type:"e"}]),a=Array.prototype.concat(...i),l=a.sort((c,d)=>c.time-d.time);for(let c of l)r+=c.type==="s"?1:-1,r===1?n=c.time:(n&&+n!=+c.time&&o.push(t.fromDateTimes(n,c.time)),n=null);return t.merge(o)}difference(...e){return t.xor([this].concat(e)).map(n=>this.intersection(n)).filter(n=>n&&!n.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} \u2013 ${this.e.toISO()})`:NC}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(e=Wh,n={}){return this.isValid?Wi.create(this.s.loc.clone(n),e).formatInterval(this):NC}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:NC}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:NC}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:NC}toFormat(e,{separator:n=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(e)}${n}${this.e.toFormat(e)}`:NC}toDuration(e,n){return this.isValid?this.e.diff(this.s,e,n):vo.invalid(this.invalidReason)}mapEndpoints(e){return t.fromDateTimes(e(this.s),e(this.e))}};var Ep=class{static hasDST(e=Vn.defaultZone){let n=gn.now().setZone(e).set({month:12});return!e.isUniversal&&n.offset!==n.set({month:6}).offset}static isValidIANAZone(e){return Ua.isValidZone(e)}static normalizeZone(e){return Nc(e,Vn.defaultZone)}static getStartOfWeek({locale:e=null,locObj:n=null}={}){return(n||Jn.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:n=null}={}){return(n||Jn.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:n=null}={}){return(n||Jn.create(e)).getWeekendDays().slice()}static months(e="long",{locale:n=null,numberingSystem:r=null,locObj:o=null,outputCalendar:i="gregory"}={}){return(o||Jn.create(n,r,i)).months(e)}static monthsFormat(e="long",{locale:n=null,numberingSystem:r=null,locObj:o=null,outputCalendar:i="gregory"}={}){return(o||Jn.create(n,r,i)).months(e,!0)}static weekdays(e="long",{locale:n=null,numberingSystem:r=null,locObj:o=null}={}){return(o||Jn.create(n,r,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:n=null,numberingSystem:r=null,locObj:o=null}={}){return(o||Jn.create(n,r,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return Jn.create(e).meridiems()}static eras(e="short",{locale:n=null}={}){return Jn.create(n,null,"gregory").eras(e)}static features(){return{relative:fO(),localeWeek:pO()}}};function mwe(t,e){let n=o=>o.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),r=n(e)-n(t);return Math.floor(vo.fromMillis(r).as("days"))}function Tat(t,e,n){let r=[["years",(c,d)=>d.year-c.year],["quarters",(c,d)=>d.quarter-c.quarter+(d.year-c.year)*4],["months",(c,d)=>d.month-c.month+(d.year-c.year)*12],["weeks",(c,d)=>{let f=mwe(c,d);return(f-f%7)/7}],["days",mwe]],o={},i=t,a,l;for(let[c,d]of r)n.indexOf(c)>=0&&(a=c,o[c]=d(t,e),l=i.plus(o),l>e?(o[c]--,t=i.plus(o),t>e&&(l=t,o[c]--,t=i.plus(o))):t=l);return[t,o,l,a]}function hwe(t,e,n,r){let[o,i,a,l]=Tat(t,e,n),c=e-o,d=n.filter(m=>["hours","minutes","seconds","milliseconds"].indexOf(m)>=0);d.length===0&&(a<e&&(a=o.plus({[l]:1})),a!==o&&(i[l]=(i[l]||0)+c/(a-o)));let f=vo.fromObject(i,r);return d.length>0?vo.fromMillis(c,r).shiftTo(...d).plus(f):f}var Oq={arab:"[\u0660-\u0669]",arabext:"[\u06F0-\u06F9]",bali:"[\u1B50-\u1B59]",beng:"[\u09E6-\u09EF]",deva:"[\u0966-\u096F]",fullwide:"[\uFF10-\uFF19]",gujr:"[\u0AE6-\u0AEF]",hanidec:"[\u3007|\u4E00|\u4E8C|\u4E09|\u56DB|\u4E94|\u516D|\u4E03|\u516B|\u4E5D]",khmr:"[\u17E0-\u17E9]",knda:"[\u0CE6-\u0CEF]",laoo:"[\u0ED0-\u0ED9]",limb:"[\u1946-\u194F]",mlym:"[\u0D66-\u0D6F]",mong:"[\u1810-\u1819]",mymr:"[\u1040-\u1049]",orya:"[\u0B66-\u0B6F]",tamldec:"[\u0BE6-\u0BEF]",telu:"[\u0C66-\u0C6F]",thai:"[\u0E50-\u0E59]",tibt:"[\u0F20-\u0F29]",latn:"\\d"},gwe={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},_at=Oq.hanidec.replace(/[\[|\]]/g,"").split("");function vwe(t){let e=parseInt(t,10);if(isNaN(e)){e="";for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);if(t[n].search(Oq.hanidec)!==-1)e+=_at.indexOf(t[n]);else for(let o in gwe){let[i,a]=gwe[o];r>=i&&r<=a&&(e+=r-i)}}return parseInt(e,10)}else return e}function Nu({numberingSystem:t},e=""){return new RegExp(`${Oq[t||"latn"]}${e}`)}var Dat="missing Intl.DateTimeFormat.formatToParts support";function Un(t,e=n=>n){return{regex:t,deser:([n])=>e(vwe(n))}}var $at="\xA0",xwe=`[ ${$at}]`,Cwe=new RegExp(xwe,"g");function Nat(t){return t.replace(/\./g,"\\.?").replace(Cwe,xwe)}function ywe(t){return t.replace(/\./g,"").replace(Cwe," ").toLowerCase()}function Lc(t,e){return t===null?null:{regex:RegExp(t.map(Nat).join("|")),deser:([n])=>t.findIndex(r=>ywe(n)===ywe(r))+e}}function bwe(t,e){return{regex:t,deser:([,n,r])=>g0(n,r),groups:e}}function vO(t){return{regex:t,deser:([e])=>e}}function Lat(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Oat(t,e){let n=Nu(e),r=Nu(e,"{2}"),o=Nu(e,"{3}"),i=Nu(e,"{4}"),a=Nu(e,"{6}"),l=Nu(e,"{1,2}"),c=Nu(e,"{1,3}"),d=Nu(e,"{1,6}"),f=Nu(e,"{1,9}"),m=Nu(e,"{2,4}"),h=Nu(e,"{4,6}"),g=C=>({regex:RegExp(Lat(C.val)),deser:([S])=>S,literal:!0}),b=(C=>{if(t.literal)return g(C);switch(C.val){case"G":return Lc(e.eras("short"),0);case"GG":return Lc(e.eras("long"),0);case"y":return Un(d);case"yy":return Un(m,RT);case"yyyy":return Un(i);case"yyyyy":return Un(h);case"yyyyyy":return Un(a);case"M":return Un(l);case"MM":return Un(r);case"MMM":return Lc(e.months("short",!0),1);case"MMMM":return Lc(e.months("long",!0),1);case"L":return Un(l);case"LL":return Un(r);case"LLL":return Lc(e.months("short",!1),1);case"LLLL":return Lc(e.months("long",!1),1);case"d":return Un(l);case"dd":return Un(r);case"o":return Un(c);case"ooo":return Un(o);case"HH":return Un(r);case"H":return Un(l);case"hh":return Un(r);case"h":return Un(l);case"mm":return Un(r);case"m":return Un(l);case"q":return Un(l);case"qq":return Un(r);case"s":return Un(l);case"ss":return Un(r);case"S":return Un(c);case"SSS":return Un(o);case"u":return vO(f);case"uu":return vO(l);case"uuu":return Un(n);case"a":return Lc(e.meridiems(),0);case"kkkk":return Un(i);case"kk":return Un(m,RT);case"W":return Un(l);case"WW":return Un(r);case"E":case"c":return Un(n);case"EEE":return Lc(e.weekdays("short",!1),1);case"EEEE":return Lc(e.weekdays("long",!1),1);case"ccc":return Lc(e.weekdays("short",!0),1);case"cccc":return Lc(e.weekdays("long",!0),1);case"Z":case"ZZ":return bwe(new RegExp(`([+-]${l.source})(?::(${r.source}))?`),2);case"ZZZ":return bwe(new RegExp(`([+-]${l.source})(${r.source})?`),2);case"z":return vO(/[a-z_+-/]{1,256}?/i);case" ":return vO(/[^\S\n\r]/);default:return g(C)}})(t)||{invalidReason:Dat};return b.token=t,b}var Mat={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function Rat(t,e,n){let{type:r,value:o}=t;if(r==="literal"){let c=/^\s+$/.test(o);return{literal:!c,val:c?" ":o}}let i=e[r],a=r;r==="hour"&&(e.hour12!=null?a=e.hour12?"hour12":"hour24":e.hourCycle!=null?e.hourCycle==="h11"||e.hourCycle==="h12"?a="hour12":a="hour24":a=n.hour12?"hour12":"hour24");let l=Mat[a];if(typeof l=="object"&&(l=l[i]),l)return{literal:!1,val:l}}function Aat(t){return[`^${t.map(n=>n.regex).reduce((n,r)=>`${n}(${r.source})`,"")}$`,t]}function kat(t,e,n){let r=t.match(e);if(r){let o={},i=1;for(let a in n)if(Zh(n,a)){let l=n[a],c=l.groups?l.groups+1:1;!l.literal&&l.token&&(o[l.token.val[0]]=l.deser(r.slice(i,i+c))),i+=c}return[r,o]}else return[r,{}]}function Pat(t){let e=i=>{switch(i){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}},n=null,r;return Mt(t.z)||(n=Ua.create(t.z)),Mt(t.Z)||(n||(n=new Hi(t.Z)),r=t.Z),Mt(t.q)||(t.M=(t.q-1)*3+1),Mt(t.h)||(t.h<12&&t.a===1?t.h+=12:t.h===12&&t.a===0&&(t.h=0)),t.G===0&&t.y&&(t.y=-t.y),Mt(t.u)||(t.S=MT(t.u)),[Object.keys(t).reduce((i,a)=>{let l=e(a);return l&&(i[l]=t[a]),i},{}),n,r]}var Mq=null;function Iat(){return Mq||(Mq=gn.fromMillis(1555555555555)),Mq}function Fat(t,e){if(t.literal)return t;let n=Wi.macroTokenToFormatOpts(t.val),r=kq(n,e);return r==null||r.includes(void 0)?t:r}function Rq(t,e){return Array.prototype.concat(...t.map(n=>Fat(n,e)))}function Aq(t,e,n){let r=Rq(Wi.parseFormat(n),t),o=r.map(a=>Oat(a,t)),i=o.find(a=>a.invalidReason);if(i)return{input:e,tokens:r,invalidReason:i.invalidReason};{let[a,l]=Aat(o),c=RegExp(a,"i"),[d,f]=kat(e,c,l),[m,h,g]=f?Pat(f):[null,null,void 0];if(Zh(f,"a")&&Zh(f,"H"))throw new _c("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:r,regex:c,rawMatches:d,matches:f,result:m,zone:h,specificOffset:g}}}function Swe(t,e,n){let{result:r,zone:o,specificOffset:i,invalidReason:a}=Aq(t,e,n);return[r,o,i,a]}function kq(t,e){if(!t)return null;let r=Wi.create(e,t).dtFormatter(Iat()),o=r.formatToParts(),i=r.resolvedOptions();return o.map(a=>Rat(a,t,i))}var Pq="Invalid DateTime",wwe=864e13;function yO(t){return new ji("unsupported zone",`the zone "${t.name}" is not supported`)}function Iq(t){return t.weekData===null&&(t.weekData=NT(t.c)),t.weekData}function Fq(t){return t.localWeekData===null&&(t.localWeekData=NT(t.c,t.loc.getMinDaysInFirstWeek(),t.loc.getStartOfWeek())),t.localWeekData}function x0(t,e){let n={ts:t.ts,zone:t.zone,c:t.c,o:t.o,loc:t.loc,invalid:t.invalid};return new gn({...n,...e,old:n})}function Lwe(t,e,n){let r=t-e*60*1e3,o=n.offset(r);if(e===o)return[r,e];r-=(o-e)*60*1e3;let i=n.offset(r);return o===i?[r,o]:[t-Math.min(o,i)*60*1e3,Math.max(o,i)]}function bO(t,e){t+=e*60*1e3;let n=new Date(t);return{year:n.getUTCFullYear(),month:n.getUTCMonth()+1,day:n.getUTCDate(),hour:n.getUTCHours(),minute:n.getUTCMinutes(),second:n.getUTCSeconds(),millisecond:n.getUTCMilliseconds()}}function CO(t,e,n){return Lwe(yC(t),e,n)}function Ewe(t,e){let n=t.o,r=t.c.year+Math.trunc(e.years),o=t.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,i={...t.c,year:r,month:o,day:Math.min(t.c.day,CC(r,o))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},a=vo.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),l=yC(i),[c,d]=Lwe(l,n,t.zone);return a!==0&&(c+=a,d=t.zone.offset(c)),{ts:c,o:d}}function PT(t,e,n,r,o,i){let{setZone:a,zone:l}=n;if(t&&Object.keys(t).length!==0||e){let c=e||l,d=gn.fromObject(t,{...n,zone:c,specificOffset:i});return a?d:d.setZone(l)}else return gn.invalid(new ji("unparsable",`the input "${o}" can't be parsed as ${r}`))}function xO(t,e,n=!0){return t.isValid?Wi.create(Jn.create("en-US"),{allowZ:n,forceSimple:!0}).formatDateTimeFromString(t,e):null}function Bq(t,e){let n=t.c.year>9999||t.c.year<0,r="";return n&&t.c.year>=0&&(r+="+"),r+=go(t.c.year,n?6:4),e?(r+="-",r+=go(t.c.month),r+="-",r+=go(t.c.day)):(r+=go(t.c.month),r+=go(t.c.day)),r}function Twe(t,e,n,r,o,i){let a=go(t.c.hour);return e?(a+=":",a+=go(t.c.minute),(t.c.millisecond!==0||t.c.second!==0||!n)&&(a+=":")):a+=go(t.c.minute),(t.c.millisecond!==0||t.c.second!==0||!n)&&(a+=go(t.c.second),(t.c.millisecond!==0||!r)&&(a+=".",a+=go(t.c.millisecond,3))),o&&(t.isOffsetFixed&&t.offset===0&&!i?a+="Z":t.o<0?(a+="-",a+=go(Math.trunc(-t.o/60)),a+=":",a+=go(Math.trunc(-t.o%60))):(a+="+",a+=go(Math.trunc(t.o/60)),a+=":",a+=go(Math.trunc(t.o%60)))),i&&(a+="["+t.zone.ianaName+"]"),a}var Owe={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},Bat={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},zat={ordinal:1,hour:0,minute:0,second:0,millisecond:0},Mwe=["year","month","day","hour","minute","second","millisecond"],Vat=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],Uat=["year","ordinal","hour","minute","second","millisecond"];function Hat(t){let e={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[t.toLowerCase()];if(!e)throw new vC(t);return e}function _we(t){switch(t.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return Hat(t)}}function Dwe(t,e){let n=Nc(e.zone,Vn.defaultZone),r=Jn.fromObject(e),o=Vn.now(),i,a;if(Mt(t.year))i=o;else{for(let d of Mwe)Mt(t[d])&&(t[d]=Owe[d]);let l=Cq(t)||Sq(t);if(l)return gn.invalid(l);let c=n.offset(o);[i,a]=CO(t,c,n)}return new gn({ts:i,zone:n,loc:r,o:a})}function $we(t,e,n){let r=Mt(n.round)?!0:n.round,o=(a,l)=>(a=bC(a,r||n.calendary?0:2,!0),e.loc.clone(n).relFormatter(n).format(a,l)),i=a=>n.calendary?e.hasSame(t,a)?0:e.startOf(a).diff(t.startOf(a),a).get(a):e.diff(t,a).get(a);if(n.unit)return o(i(n.unit),n.unit);for(let a of n.units){let l=i(a);if(Math.abs(l)>=1)return o(l,a)}return o(t>e?-0:0,n.units[n.units.length-1])}function Nwe(t){let e={},n;return t.length>0&&typeof t[t.length-1]=="object"?(e=t[t.length-1],n=Array.from(t).slice(0,t.length-1)):n=Array.from(t),[e,n]}var gn=class t{constructor(e){let n=e.zone||Vn.defaultZone,r=e.invalid||(Number.isNaN(e.ts)?new ji("invalid input"):null)||(n.isValid?null:yO(n));this.ts=Mt(e.ts)?Vn.now():e.ts;let o=null,i=null;if(!r)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(n))[o,i]=[e.old.c,e.old.o];else{let l=n.offset(this.ts);o=bO(this.ts,l),r=Number.isNaN(o.year)?new ji("invalid input"):null,o=r?null:o,i=r?null:l}this._zone=n,this.loc=e.loc||Jn.create(),this.invalid=r,this.weekData=null,this.localWeekData=null,this.c=o,this.o=i,this.isLuxonDateTime=!0}static now(){return new t({})}static local(){let[e,n]=Nwe(arguments),[r,o,i,a,l,c,d]=n;return Dwe({year:r,month:o,day:i,hour:a,minute:l,second:c,millisecond:d},e)}static utc(){let[e,n]=Nwe(arguments),[r,o,i,a,l,c,d]=n;return e.zone=Hi.utcInstance,Dwe({year:r,month:o,day:i,hour:a,minute:l,second:c,millisecond:d},e)}static fromJSDate(e,n={}){let r=H3e(e)?e.valueOf():NaN;if(Number.isNaN(r))return t.invalid("invalid input");let o=Nc(n.zone,Vn.defaultZone);return o.isValid?new t({ts:r,zone:o,loc:Jn.fromObject(n)}):t.invalid(yO(o))}static fromMillis(e,n={}){if(Ud(e))return e<-wwe||e>wwe?t.invalid("Timestamp out of range"):new t({ts:e,zone:Nc(n.zone,Vn.defaultZone),loc:Jn.fromObject(n)});throw new Ko(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,n={}){if(Ud(e))return new t({ts:e*1e3,zone:Nc(n.zone,Vn.defaultZone),loc:Jn.fromObject(n)});throw new Ko("fromSeconds requires a numerical input")}static fromObject(e,n={}){e=e||{};let r=Nc(n.zone,Vn.defaultZone);if(!r.isValid)return t.invalid(yO(r));let o=Jn.fromObject(n),i=SC(e,_we),{minDaysInFirstWeek:a,startOfWeek:l}=xq(i,o),c=Vn.now(),d=Mt(n.specificOffset)?r.offset(c):n.specificOffset,f=!Mt(i.ordinal),m=!Mt(i.year),h=!Mt(i.month)||!Mt(i.day),g=m||h,y=i.weekYear||i.weekNumber;if((g||f)&&y)throw new _c("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(h&&f)throw new _c("Can't mix ordinal dates with month/day");let b=y||i.weekday&&!g,C,S,w=bO(c,d);b?(C=Vat,S=Bat,w=NT(w,a,l)):f?(C=Uat,S=zat,w=gO(w)):(C=Mwe,S=Owe);let E=!1;for(let k of C){let F=i[k];Mt(F)?E?i[k]=S[k]:i[k]=w[k]:E=!0}let _=b?z3e(i,a,l):f?V3e(i):Cq(i),N=_||Sq(i);if(N)return t.invalid(N);let $=b?yq(i,a,l):f?bq(i):i,[M,O]=CO($,d,r),A=new t({ts:M,zone:r,o:O,loc:o});return i.weekday&&g&&e.weekday!==A.weekday?t.invalid("mismatched weekday",`you can't specify both a weekday of ${i.weekday} and a date of ${A.toISO()}`):A}static fromISO(e,n={}){let[r,o]=owe(e);return PT(r,o,n,"ISO 8601",e)}static fromRFC2822(e,n={}){let[r,o]=iwe(e);return PT(r,o,n,"RFC 2822",e)}static fromHTTP(e,n={}){let[r,o]=awe(e);return PT(r,o,n,"HTTP",n)}static fromFormat(e,n,r={}){if(Mt(e)||Mt(n))throw new Ko("fromFormat requires an input string and a format");let{locale:o=null,numberingSystem:i=null}=r,a=Jn.fromOpts({locale:o,numberingSystem:i,defaultToEN:!0}),[l,c,d,f]=Swe(a,e,n);return f?t.invalid(f):PT(l,c,r,`format ${n}`,e,d)}static fromString(e,n,r={}){return t.fromFormat(e,n,r)}static fromSQL(e,n={}){let[r,o]=uwe(e);return PT(r,o,n,"SQL",e)}static invalid(e,n=null){if(!e)throw new Ko("need to specify a reason the DateTime is invalid");let r=e instanceof ji?e:new ji(e,n);if(Vn.throwOnInvalid)throw new oO(r);return new t({invalid:r})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,n={}){let r=kq(e,Jn.fromObject(n));return r?r.map(o=>o?o.val:null).join(""):null}static expandFormat(e,n={}){return Rq(Wi.parseFormat(e),Jn.fromObject(n)).map(o=>o.val).join("")}get(e){return this[e]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?Iq(this).weekYear:NaN}get weekNumber(){return this.isValid?Iq(this).weekNumber:NaN}get weekday(){return this.isValid?Iq(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?Fq(this).weekday:NaN}get localWeekNumber(){return this.isValid?Fq(this).weekNumber:NaN}get localWeekYear(){return this.isValid?Fq(this).weekYear:NaN}get ordinal(){return this.isValid?gO(this.c).ordinal:NaN}get monthShort(){return this.isValid?Ep.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?Ep.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?Ep.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?Ep.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];let e=864e5,n=6e4,r=yC(this.c),o=this.zone.offset(r-e),i=this.zone.offset(r+e),a=this.zone.offset(r-o*n),l=this.zone.offset(r-i*n);if(a===l)return[this];let c=r-a*n,d=r-l*n,f=bO(c,a),m=bO(d,l);return f.hour===m.hour&&f.minute===m.minute&&f.second===m.second&&f.millisecond===m.millisecond?[x0(this,{ts:c}),x0(this,{ts:d})]:[this]}get isInLeapYear(){return y0(this.year)}get daysInMonth(){return CC(this.year,this.month)}get daysInYear(){return this.isValid?Yh(this.year):NaN}get weeksInWeekYear(){return this.isValid?v0(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?v0(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){let{locale:n,numberingSystem:r,calendar:o}=Wi.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:n,numberingSystem:r,outputCalendar:o}}toUTC(e=0,n={}){return this.setZone(Hi.instance(e),n)}toLocal(){return this.setZone(Vn.defaultZone)}setZone(e,{keepLocalTime:n=!1,keepCalendarTime:r=!1}={}){if(e=Nc(e,Vn.defaultZone),e.equals(this.zone))return this;if(e.isValid){let o=this.ts;if(n||r){let i=e.offset(this.ts),a=this.toObject();[o]=CO(a,i,e)}return x0(this,{ts:o,zone:e})}else return t.invalid(yO(e))}reconfigure({locale:e,numberingSystem:n,outputCalendar:r}={}){let o=this.loc.clone({locale:e,numberingSystem:n,outputCalendar:r});return x0(this,{loc:o})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;let n=SC(e,_we),{minDaysInFirstWeek:r,startOfWeek:o}=xq(n,this.loc),i=!Mt(n.weekYear)||!Mt(n.weekNumber)||!Mt(n.weekday),a=!Mt(n.ordinal),l=!Mt(n.year),c=!Mt(n.month)||!Mt(n.day),d=l||c,f=n.weekYear||n.weekNumber;if((d||a)&&f)throw new _c("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(c&&a)throw new _c("Can't mix ordinal dates with month/day");let m;i?m=yq({...NT(this.c,r,o),...n},r,o):Mt(n.ordinal)?(m={...this.toObject(),...n},Mt(n.day)&&(m.day=Math.min(CC(m.year,m.month),m.day))):m=bq({...gO(this.c),...n});let[h,g]=CO(m,this.o,this.zone);return x0(this,{ts:h,o:g})}plus(e){if(!this.isValid)return this;let n=vo.fromDurationLike(e);return x0(this,Ewe(this,n))}minus(e){if(!this.isValid)return this;let n=vo.fromDurationLike(e).negate();return x0(this,Ewe(this,n))}startOf(e,{useLocaleWeeks:n=!1}={}){if(!this.isValid)return this;let r={},o=vo.normalizeUnit(e);switch(o){case"years":r.month=1;case"quarters":case"months":r.day=1;case"weeks":case"days":r.hour=0;case"hours":r.minute=0;case"minutes":r.second=0;case"seconds":r.millisecond=0;break;case"milliseconds":break}if(o==="weeks")if(n){let i=this.loc.getStartOfWeek(),{weekday:a}=this;a<i&&(r.weekNumber=this.weekNumber-1),r.weekday=i}else r.weekday=1;if(o==="quarters"){let i=Math.ceil(this.month/3);r.month=(i-1)*3+1}return this.set(r)}endOf(e,n){return this.isValid?this.plus({[e]:1}).startOf(e,n).minus(1):this}toFormat(e,n={}){return this.isValid?Wi.create(this.loc.redefaultToEN(n)).formatDateTimeFromString(this,e):Pq}toLocaleString(e=Wh,n={}){return this.isValid?Wi.create(this.loc.clone(n),e).formatDateTime(this):Pq}toLocaleParts(e={}){return this.isValid?Wi.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:n=!1,suppressMilliseconds:r=!1,includeOffset:o=!0,extendedZone:i=!1}={}){if(!this.isValid)return null;let a=e==="extended",l=Bq(this,a);return l+="T",l+=Twe(this,a,n,r,o,i),l}toISODate({format:e="extended"}={}){return this.isValid?Bq(this,e==="extended"):null}toISOWeekDate(){return xO(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:n=!1,includeOffset:r=!0,includePrefix:o=!1,extendedZone:i=!1,format:a="extended"}={}){return this.isValid?(o?"T":"")+Twe(this,a==="extended",n,e,r,i):null}toRFC2822(){return xO(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return xO(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?Bq(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:n=!1,includeOffsetSpace:r=!0}={}){let o="HH:mm:ss.SSS";return(n||e)&&(r&&(o+=" "),n?o+="z":e&&(o+="ZZ")),xO(this,o,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():Pq}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(e={}){if(!this.isValid)return{};let n={...this.c};return e.includeConfig&&(n.outputCalendar=this.outputCalendar,n.numberingSystem=this.loc.numberingSystem,n.locale=this.loc.locale),n}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,n="milliseconds",r={}){if(!this.isValid||!e.isValid)return vo.invalid("created by diffing an invalid DateTime");let o={locale:this.locale,numberingSystem:this.numberingSystem,...r},i=j3e(n).map(vo.normalizeUnit),a=e.valueOf()>this.valueOf(),l=a?this:e,c=a?e:this,d=hwe(l,c,i,o);return a?d.negate():d}diffNow(e="milliseconds",n={}){return this.diff(t.now(),e,n)}until(e){return this.isValid?wp.fromDateTimes(this,e):this}hasSame(e,n,r){if(!this.isValid)return!1;let o=e.valueOf(),i=this.setZone(e.zone,{keepLocalTime:!0});return i.startOf(n,r)<=o&&o<=i.endOf(n,r)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;let n=e.base||t.fromObject({},{zone:this.zone}),r=e.padding?this<n?-e.padding:e.padding:0,o=["years","months","days","hours","minutes","seconds"],i=e.unit;return Array.isArray(e.unit)&&(o=e.unit,i=void 0),$we(n,this.plus(r),{...e,numeric:"always",units:o,unit:i})}toRelativeCalendar(e={}){return this.isValid?$we(e.base||t.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(t.isDateTime))throw new Ko("min requires all arguments be DateTimes");return wq(e,n=>n.valueOf(),Math.min)}static max(...e){if(!e.every(t.isDateTime))throw new Ko("max requires all arguments be DateTimes");return wq(e,n=>n.valueOf(),Math.max)}static fromFormatExplain(e,n,r={}){let{locale:o=null,numberingSystem:i=null}=r,a=Jn.fromOpts({locale:o,numberingSystem:i,defaultToEN:!0});return Aq(a,e,n)}static fromStringExplain(e,n,r={}){return t.fromFormatExplain(e,n,r)}static get DATE_SHORT(){return Wh}static get DATE_MED(){return lT}static get DATE_MED_WITH_WEEKDAY(){return nq}static get DATE_FULL(){return uT}static get DATE_HUGE(){return cT}static get TIME_SIMPLE(){return dT}static get TIME_WITH_SECONDS(){return fT}static get TIME_WITH_SHORT_OFFSET(){return pT}static get TIME_WITH_LONG_OFFSET(){return mT}static get TIME_24_SIMPLE(){return hT}static get TIME_24_WITH_SECONDS(){return gT}static get TIME_24_WITH_SHORT_OFFSET(){return vT}static get TIME_24_WITH_LONG_OFFSET(){return yT}static get DATETIME_SHORT(){return bT}static get DATETIME_SHORT_WITH_SECONDS(){return xT}static get DATETIME_MED(){return CT}static get DATETIME_MED_WITH_SECONDS(){return ST}static get DATETIME_MED_WITH_WEEKDAY(){return rq}static get DATETIME_FULL(){return wT}static get DATETIME_FULL_WITH_SECONDS(){return ET}static get DATETIME_HUGE(){return TT}static get DATETIME_HUGE_WITH_SECONDS(){return _T}};function LC(t){if(gn.isDateTime(t))return t;if(t&&t.valueOf&&Ud(t.valueOf()))return gn.fromJSDate(t);if(t&&typeof t=="object")return gn.fromObject(t);throw new Ko(`Unknown datetime argument: ${t}, of type ${typeof t}`)}function SO(t){return t.reduce((e,{field:n,operator:r,value:o})=>{if(!n||!r)return e;if(n==="updated_at"&&(n="modified"),n==="created_at"&&(n="created"),r==="def")return{...e,[`${n}[def]`]:"true"};if(r==="ndef")return{...e,[`${n}[def]`]:"false"};if(r==="checked")return{...e,[`${n}[eq]`]:"true"};if(r==="nchecked")return{...e,[`${n}[eq]`]:"false"};if(typeof o>"u"||o===null||o===""||Array.isArray(o)&&o.length<1)return e;if(r==="between"||r==="sys-date-between")if(Array.isArray(o)&&o.length===2){if(r==="between")return{...e,[`${n}[gte]`]:o[0],[`${n}[lte]`]:o[1]};{let i=gn.fromISO(o[0],{zone:"system"}).setZone("utc").toISO(),a=gn.fromISO(o[1],{zone:"system"}).plus({day:1}).setZone("utc").toISO();return i&&a?{...e,[`${n}[gte]`]:i,[`${n}[lt]`]:a}:e}}else return e;if(r==="sys-date-eq")if(typeof o=="string"){let i=gn.fromISO(o,{zone:"system"}).setZone("utc").toISO(),a=gn.fromISO(o,{zone:"system"}).plus({day:1}).setZone("utc").toISO();return i&&a?{...e,[`${n}[gte]`]:i,[`${n}[lt]`]:a}:e}else return e;if(r==="sys-date-gt")if(typeof o=="string"){let i=gn.fromISO(o,{zone:"system"}).plus({day:1}).setZone("utc").toISO();return i?{...e,[`${n}[gte]`]:i}:e}else return e;if(r==="sys-date-gte")if(typeof o=="string"){let i=gn.fromISO(o,{zone:"system"}).setZone("utc").toISO();return i?{...e,[`${n}[gte]`]:i}:e}else return e;if(r==="sys-date-lt")if(typeof o=="string"){let i=gn.fromISO(o,{zone:"system"}).setZone("utc").toISO();return i?{...e,[`${n}[lt]`]:i}:e}else return e;if(r==="sys-date-lte")if(typeof o=="string"){let i=gn.fromISO(o,{zone:"system"}).plus({day:1}).setZone("utc").toISO();return i?{...e,[`${n}[lt]`]:i}:e}else return e;if(r==="starts"&&typeof o=="string")return{...e,[`${n}[starts]`]:o.replaceAll(/[^a-zA-Z0-9_.\s-]/g,"").toLowerCase()};if(n==="workflowStageId"){let i=t.some(a=>a.field==="workflowId");if(r==="eq"||r==="neq"){let a=[];return Array.isArray(o)?a=o.map(c=>c.split("_")[1]):a=o.split("_"),{...e,...i?{}:{"workflowId[eq]":a[0]},[`${n}[${r}]`]:a[1]}}if(Array.isArray(o)){let a=o.map(d=>{let f=d.split("_")[0],m=d.split("_")[1];return{workflowId:f,workflowStage:m}}),l=a.map(d=>d.workflowId).join(","),c=a.map(d=>d.workflowStage).join(",");return{...e,...i?{}:{[`workflowId[${r}]`]:l},[`${n}[${r}]`]:c}}}return{...e,[`${n}[${r}]`]:Array.isArray(o)?o.join(","):o}},{})}import{CANVAS_DRAFT_STATE as Rwe,CanvasClient as Awe}from"@uniformdev/canvas";async function wO({instanceType:t,searchExpressionPrompt:e,username:n,locale:r,getEditUrl:o}){let i=new Awe(pt),a=await rO({searchExpressionPrompt:e,username:n,locale:r},t),{limit:l,offset:c,keyword:d,sort:f,filter:m}=a,g=(await i.getCompositionList({patternType:t==="composition"?void 0:t==="componentPattern"?"component":"composition",pattern:t!=="composition",resolveData:!1,withComponentIDs:!0,skipOverridesResolution:!0,limit:l,offset:c,search:d,filters:m?SO(m):void 0,orderBy:Array.isArray(f)?f:f?[f]:void 0,locale:r,skipPatternResolution:!0,state:Rwe})).compositions.map(y=>({id:y.composition._id,name:y.composition._name,componentType:y.composition.type,editUrl:o(y.composition._id)}));return{content:[{type:"text",text:JSON.stringify({results:g,criteria:a},null,2)}]}}async function EO({id:t}){let n=await new Awe(pt).getCompositionById({skipDataResolution:!0,withComponentIDs:!0,skipOverridesResolution:!0,skipPatternResolution:!1,compositionId:t,state:Rwe});return{content:[{type:"text",text:JSON.stringify(n,null,2)}]}}var Wat={id:jat.string()};function kwe(t){t.tool("compositionList","Lists available Uniform compositions",xp.shape,async e=>await wO({...e,instanceType:"composition",getEditUrl:nO})),t.tool("compositionGet","Gets the full contents of a Uniform composition",Wat,async e=>await EO(e))}import{ContentClient as Kat}from"@uniformdev/canvas";import{z as Fwe}from"zod";import{z as IT}from"zod";var Pwe=IT.object({name:IT.string().describe('Title-cased display name of the component. Ex: "Hero"'),id:IT.string().describe("Public ID of the content type, the camelCase version of name, using only alphanumeric characters"),description:IT.string().describe("Describe the purpose of the content type in 1-2 sentences."),fields:IT.array(X_).describe("The fields of the content type. The key is the publicId of the field.").optional()});function Iwe(t){let e=t.fields?.find(r=>r.type==="asset"&&typeof r.typeConfig=="object"&&r.typeConfig!==null&&"allowedTypes"in r.typeConfig&&Array.isArray(r.typeConfig.allowedTypes)&&r.typeConfig.allowedTypes?.includes("image"))?.id,n=t.fields?.find(r=>r.type==="text")?.id;return{...t,thumbnailField:e,entryName:n}}function TO(t){return`${pt.baseWebUrl}/dashboards/canvas/content-types/${t}`}var Gat={action:Fwe.enum(["create","update","delete"]).describe("The action to perform"),publicId:Fwe.string().describe("Public ID of the component, the camelCase version of name, using only alphanumeric characters"),contentType:Pwe.describe("Full content type definition to create. Omit for update or delete.").optional(),patches:q_.describe("JSON patch to apply to the existing component definition. Omit for create or delete.").optional()};function Bwe(t){t.tool("contentTypeAction","Creates, updates, or deletes a Uniform Content Type definition",Gat,async({publicId:e,action:n,contentType:r,patches:o})=>{let i=new Kat(pt),a=!1;if(n==="create"){if(!r)throw new Error("Content type definition is required for create");let l=Iwe(r);l.fields&&(a=_y(l.fields),Dy(l.fields)),await i.upsertContentType({contentType:l})}if(n==="update"){if(!o)throw new Error("Patches are required for update");let c=(await i.getContentTypes()).contentTypes.find(m=>m.id===e);if(!c)throw new Error(`Content Type with public ID ${e} does not exist, try creating it instead`);let d=c.fields?.filter(m=>m.type==="richText").map(m=>m.id),f=Z_(c,o);if(f.fields){a=_y(f.fields);let m=f.fields?.filter(h=>h.type==="richText").map(h=>h.id).filter(h=>!d?.includes(h));Dy(f.fields,m)}await i.upsertContentType({contentType:f})}return n==="delete"&&await i.deleteContentType({contentTypeId:e}),{content:[{type:"text",text:JSON.stringify({success:!0,editUrl:TO(e),warning:a?"Issues with field group order were fixed. Ensure definition data is re-fetched before any future updates.":void 0},null,2)}]}})}import{ContentClient as zwe}from"@uniformdev/canvas";import{z as Yat}from"zod";var Zat={id:Yat.string()};function Vwe(t){t.tool("contentTypeList","Lists all Uniform Content Type definitions",async()=>{let r=(await new zwe(pt).getContentTypes()).contentTypes.map(o=>({id:o.id,name:o.name,description:o.description,editUrl:TO(o.id)}));return{content:[{type:"text",text:JSON.stringify(r,null,2)}]}}),t.tool("contentTypeGet","Gets a Uniform Content Type definition details (fields, etc.)",Zat,async({id:e})=>{let o=(await new zwe(pt).getContentTypes()).contentTypes.find(i=>i.id===e);if(!o)throw new Error(`Content Type with ID ${e} not found`);return{content:[{type:"text",text:JSON.stringify(o,null,2)}]}})}function Uwe(t){t.tool("createUuid","Creates a new random UUID",async()=>({content:[{type:"text",text:crypto.randomUUID()}]}))}import{z as Vq}from"zod";import{CANVAS_DRAFT_STATE as zq,ContentClient as qat,convertEntryToPutEntry as Jat,getEffectivePropertyValue as Xat}from"@uniformdev/canvas";async function Qat(t,e,n){let o=(await e.fetchDefinitions())[t.entry.type];if(!o)throw new Error("insanity");let i=Q4e(o),a;i.entryName&&(a=t.entry._overrides?.[t.entry._id].parameters?.[i.entryName]??t.entry.fields?.[i.entryName]);let l=Xat({conditionIndex:-1,locale:void 0,greedyLocaleMatching:!0,property:a}),c=I4e({value:l,isNew:n,contentType:i});t.entry._name=c}async function _O({action:t,id:e,instructions:n,isPattern:r,patternId:o,getEditUrl:i}){let a=new qat(pt),l,c,d=t==="update"?e:void 0,f={success:!0,actionsTaken:[]};if(t==="create"){if(!n)throw new Error("Instructions are required for create");if(!n.type)throw new Error("Type is required for create");o?(await a.upsertEntry({state:zq,entry:{type:n.type,_id:e,fields:{},_pattern:o}}),d=e):l=new jh({_id:e,_name:"New Entry",type:n.type,_overridability:{hideLockedParameters:!0}})}if(d){if(c=(await a.getEntries({entryIDs:[e],pattern:r,state:zq,skipDataResolution:!0,skipPatternResolution:!1,withComponentIDs:!0,skipOverridesResolution:!0})).entries[0],!c)throw new Error("Entry not found");let m=qL(c);l=new jh(m.composition)}if(t==="delete"&&await a.deleteEntry({entryId:e}),l){await eO(n?.localeUpdates?.enableLocales);let m=S3e();f=await jL({twee:l,descriptionUpdate:void 0,slugUpdate:n&&"slug"in n?n.slug:void 0,nameUpdate:n&&"name"in n?n.name:void 0,propertyUpdates:n?.fieldUpdates??[],slotUpdates:{},localeUpdates:n?.localeUpdates,currentEditorLocale:void 0,referenceData:m});let h=l.exportTree(),g=l.exportMetadata(),y=Jat(e3e(h,c??{projectId:pt.projectId,pattern:r},g,zq,c?.releaseId,c?.editionId));r||await Qat(y,m,t==="create"),await a.upsertEntry(y)}return{content:[{type:"text",text:JSON.stringify({...f,editUrl:i(e)},null,2)}]}}function DO(t){return`${pt.baseWebUrl}/dashboards/canvas/entries/${t}`}var est={action:Vq.enum(["create","update","delete"]).describe("The action to perform"),id:Vq.string().uuid().describe("UUID of the entry to create, update, or delete"),patternId:Vq.string().uuid().describe("Entry pattern ID to create the entry from. Omit when not creating, or when creating an entry without an entry pattern.").optional(),instructions:cne.describe("Modification instructions for the entry. Omit for delete.").optional()};function Hwe(t){t.tool("entryAction","Creates, updates, or deletes a Uniform Entry",est,async e=>await _O({...e,isPattern:!1,getEditUrl:DO,patternId:e.patternId}))}import{z as tst}from"zod";import{CANVAS_DRAFT_STATE as jwe,ContentClient as Wwe}from"@uniformdev/canvas";async function $O({isPattern:t,searchExpressionPrompt:e,username:n,locale:r,getEditUrl:o}){let i=new Wwe(pt),a=await rO({searchExpressionPrompt:e,username:n,locale:r},t?"entryPattern":"entry"),{limit:l,offset:c,keyword:d,sort:f,filter:m}=a,g=(await i.getEntries({limit:l,offset:c,pattern:t,skipDataResolution:!0,withTotalCount:!0,skipPatternResolution:!0,skipOverridesResolution:!0,state:jwe,search:d,filters:m?SO(m):void 0,orderBy:Array.isArray(f)?f:f?[f]:void 0,locale:r})).entries.map(y=>({id:y.entry._id,name:y.entry._name??"",contentType:y.entry.type,editUrl:o(y.entry._id)}));return{content:[{type:"text",text:JSON.stringify({results:g,criteria:a},null,2)}]}}async function NO({id:t,isPattern:e}){let r=await new Wwe(pt).getEntries({skipDataResolution:!0,withComponentIDs:!0,skipOverridesResolution:!0,skipPatternResolution:!1,pattern:e,entryIDs:[t],state:jwe});if(r.entries.length===0)throw new Error(`Entry with ID ${t} not found`);return{content:[{type:"text",text:JSON.stringify(r.entries[0],null,2)}]}}var nst={id:tst.string()};function Kwe(t){t.tool("entryList","Lists available Uniform entries",xp.shape,async e=>await $O({...e,isPattern:!1,getEditUrl:DO})),t.tool("entryGet","Gets the full contents of a Uniform entry",nst,async e=>await NO({...e,isPattern:!1}))}import{z as Gwe}from"zod";function LO(t){return`${pt.baseWebUrl}/dashboards/canvas/entry-patterns/${t}`}var rst={action:Gwe.enum(["create","update","delete"]).describe("The action to perform"),id:Gwe.string().uuid().describe("UUID of the entry pattern to create, update, or delete"),instructions:dne.describe("Modification instructions for the entry pattern. Omit for delete.").optional()};function Ywe(t){t.tool("entryPatternAction","Creates, updates, or deletes a Uniform Entry Pattern",rst,async e=>await _O({...e,isPattern:!0,getEditUrl:LO,patternId:void 0}))}import{z as ost}from"zod";var ist={id:ost.string()};function Zwe(t){t.tool("entryPatternList","Lists available Uniform entry patterns",xp.shape,async e=>await $O({...e,isPattern:!0,getEditUrl:LO})),t.tool("entryPatternGet","Gets the full contents of a Uniform entry pattern",ist,async e=>await NO({...e,isPattern:!0}))}import{ProjectClient as ast}from"@uniformdev/canvas";async function sst(){let t=await fetch(`${pt.apiHost}/api/v1/member-profile`,{headers:{"x-api-key":pt.apiKey,"Content-Type":"application/json"}});if(!t.ok)throw new Error(`Failed to fetch user profile: ${t.status} ${t.statusText}`);return(await t.json()).name}function qwe(t){t.tool("getUniformEnvironment","Get the connected Uniform Project name, edit URL, and current user",{},async()=>{try{let e=new ast(pt),[n,r]=await Promise.all([e.get({projectId:pt.projectId}),sst()]),o={projectName:n.name,teamName:n.teamName,projectUrl:pt.baseWebUrl,currentIdentity:r};return{content:[{type:"text",text:JSON.stringify(o,null,2)}]}}catch(e){return{content:[{type:"text",text:JSON.stringify({error:"Failed to fetch project information",details:e instanceof Error?e.message:"Unknown error"},null,2)}]}}})}import{LocaleClient as lst}from"@uniformdev/canvas";function Jwe(t){t.tool("localeList","Lists all registered Uniform locales",async()=>{let n=await new lst(pt).get();return{content:[{type:"text",text:JSON.stringify({locales:n.results,editUrl:`${pt.baseWebUrl}/settings/localization`},null,2)}]}})}import{z as Xwe}from"zod";function OO(t){return`${pt.baseWebUrl}/dashboards/canvas/edit/${t}`}var ust={action:Xwe.enum(["create","update","delete"]).describe("The action to perform"),id:Xwe.string().uuid().describe("UUID of the pattern instance to create, update, or delete"),instructions:lne.describe("Modification instructions for the pattern. Omit for delete.").optional()};function Qwe(t){t.tool("patternAction","Creates, updates, or deletes a Uniform Component Pattern or Composition Pattern",ust,async e=>await tO({...e,isPattern:!0,getEditUrl:OO,patternId:void 0}))}import{z as eEe}from"zod";var cst={instanceType:eEe.enum(["componentPattern","compositionPattern"]),...xp.shape},dst={id:eEe.string()};function tEe(t){t.tool("patternList","Lists available Uniform component patterns or composition patterns",cst,async e=>await wO({...e,getEditUrl:OO})),t.tool("patternGet","Gets the full contents of a Uniform component pattern or composition pattern",dst,async e=>await EO(e))}var Ha=new fst({name:"Uniform MCP",version:"1.0.0"});ine(Ha);sne(Ha);Bwe(Ha);Vwe(Ha);Hwe(Ha);Kwe(Ha);Zwe(Ha);Ywe(Ha);tEe(Ha);Qwe(Ha);w3e(Ha);kwe(Ha);Uwe(Ha);qwe(Ha);Jwe(Ha);var mst=new pst;await Ha.connect(mst);process.stderr.write(`Uniform MCP server started
|
|
5184
5184
|
`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/uniform-mcp",
|
|
3
|
-
"version": "20.
|
|
3
|
+
"version": "20.30.0",
|
|
4
4
|
"description": "Uniform MCP Server",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"bin": {
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@modelcontextprotocol/sdk": "^1.12.0",
|
|
25
|
-
"@uniformdev/canvas": "20.
|
|
25
|
+
"@uniformdev/canvas": "20.30.0",
|
|
26
26
|
"fast-json-patch": "^3.1.1",
|
|
27
27
|
"immer": "10.1.1",
|
|
28
28
|
"zod": "3.23.8"
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
"access": "public"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@uniformdev/design-system": "20.
|
|
38
|
-
"@uniformdev/files": "20.
|
|
39
|
-
"@uniformdev/mesh-edgehancer-sdk": "20.
|
|
40
|
-
"@uniformdev/richtext": "20.
|
|
37
|
+
"@uniformdev/design-system": "20.30.0",
|
|
38
|
+
"@uniformdev/files": "20.30.0",
|
|
39
|
+
"@uniformdev/mesh-edgehancer-sdk": "20.30.0",
|
|
40
|
+
"@uniformdev/richtext": "20.30.0",
|
|
41
41
|
"vitest": "^3.1.4"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "933c8162daf230a896cc8962f63fbb35efd03653"
|
|
44
44
|
}
|