@plasmicapp/react-web
Advanced tools
Comparing version 0.2.137 to 0.2.138
@@ -17,5 +17,3 @@ import _classNames from "classnames"; | ||
export { useTrigger } from "./render/triggers"; | ||
export { $State } from "./states"; | ||
export * from "./states/helpers"; | ||
export { default as useDollarState, useCanvasDollarState, } from "./states/valtio"; | ||
export * from "./states"; | ||
export declare const classNames: typeof _classNames; |
@@ -1,2 +0,2 @@ | ||
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("classnames")),r=require("react"),n=e(r),a=e(require("dlv")),i=require("react-dom"),o=e(i),s=require("@plasmicapp/data-sources-context"),u=require("@react-aria/ssr"),l=require("@react-aria/focus"),c=e(require("clone")),p=e(require("fast-deep-equal")),d=require("valtio"),f=require("valtio/utils"),v=require("@react-aria/checkbox"),m=require("@react-aria/visually-hidden"),h=require("@react-stately/toggle"),y=require("@react-aria/menu"),g=require("@react-stately/tree"),b=require("@react-stately/collections"),P=require("@react-aria/separator"),S=require("@react-stately/menu"),w=require("@react-aria/interactions"),x=require("@react-aria/select"),E=require("@react-aria/listbox"),V=require("@react-stately/select"),O=require("@react-aria/switch"),C=require("@react-aria/overlays");function k(){return(k=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function I(e,t){if(null==e)return{};var r,n,a={},i=Object.keys(e);for(n=0;n<i.length;n++)t.indexOf(r=i[n])>=0||(a[r]=e[r]);return a}function M(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function j(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return M(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?M(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function T(e){return null!=e}function R(e){if(0===Object.keys(e).length)return e;for(var t={},r=arguments.length,n=new Array(r>1?r-1:0),a=1;a<r;a++)n[a-1]=arguments[a];for(var i=0,o=n;i<o.length;i++){var s=o[i];s in e&&(t[s]=e[s])}return t}function A(e){if(0===Object.keys(e).length)return e;for(var t={},r=arguments.length,n=new Array(r>1?r-1:0),a=1;a<r;a++)n[a-1]=arguments[a];for(var i=0,o=Object.keys(e);i<o.length;i++){var s=o[i];n.includes(s)||(t[s]=e[s])}return t}function F(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(0!==t.length)return function(e){for(var r=e,n=0,a=t;n<a.length;n++)r=(0,a[n])(r);return r}}function N(e,t){for(var r,n={},a=j(e);!(r=a()).done;){var i=r.value,o=t(i);o in n?n[o].push(i):n[o]=[i]}return n}function D(e,t){var r={};for(var n in e)r[n]=t(e[n]);return r}var W="undefined"!=typeof window,q=Symbol("NONE"),_=W?n.useLayoutEffect:n.useEffect;function K(e,t,r){return Array.isArray(r)?n.createElement.apply(n,[e,t].concat(r)):r||"children"in t?n.createElement(e,t,r):n.createElement(e,t)}function H(e){return n.isValidElement(t=e)||function(e){return"string"==typeof e||"number"==typeof e}(t)?[e]:Array.isArray(e)?e.flatMap(H):[];var t}function B(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];if(r.every((function(e){return 0===Object.keys(e).length})))return e;for(var a=k({},e),i=0,o=r;i<o.length;i++)for(var s=o[i],u=0,l=Object.keys(s);u<l.length;u++){var c=l[u];a[c]=z(c,a[c],s[c])}return a}function U(e,t){e&&("function"==typeof e?e(t):Object.isFrozen(e)||(e.current=t))}function L(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(e){for(var r=0,n=t;r<n.length;r++)U(n[r],e)}}function z(e,r,n){return r===q||n===q?null:null==r?n:null==n?r:"className"===e?t(r,n):"style"===e?k({},r,n):"ref"===e?L(r,n):typeof r!=typeof n?n:e.startsWith("on")&&"function"==typeof r?function(){var e;return"function"==typeof r&&(e=r.apply(void 0,arguments)),"function"==typeof n&&(e=n.apply(void 0,arguments)),e}:n}var G=["children"],Q=["as","hasGap"],Y=["hasGap"];function J(e,t,r,n){var a=t.children,i=I(t,G),o=ee(a,null!=r&&r);return K(e,k({ref:n},i),o)}function $(e,t){var r=e.as,n=e.hasGap;return J(null!=r?r:"div",I(e,Q),n,t)}var X=function(e){return r.forwardRef((function(t,r){var n=t.hasGap,a=I(t,Y);return J(e,a,n,r)}))},Z=Object.assign(r.forwardRef($),{div:X("div"),a:X("a"),button:X("button"),h1:X("h1"),h2:X("h2"),h3:X("h3"),h4:X("h4"),h5:X("h5"),h6:X("h6"),label:X("label"),form:X("form"),section:X("section"),head:X("head"),main:X("main"),nav:X("nav")});function ee(e,t){var n=t?"__wab_flex-container":"__wab_passthrough";return e?Array.isArray(e)?r.createElement.apply(r,["div",{className:n}].concat(e)):r.createElement("div",{className:n},e):null}function te(e,t,r,a){if(!e||0===Object.keys(e).length)return K(t,r,r.children);var i=oe(e),o=ie(r,i.props);if("render"===i.type)return i.render(o,t);var s=t;"as"===i.type&&i.as&&(t===Z?o.as=i.as:s=i.as);var u=o.children;i.wrapChildren&&(u=i.wrapChildren(function(e){return Array.isArray(e)?1===e.length?e[0]:n.createElement.apply(n,[n.Fragment,{}].concat(e)):e}(u))),a&&(u=ee(u,!0));var l=K(s,o,u);return i.wrap&&(l=i.wrap(l)),l}var re=new Map;function ne(e,t){var r,n=t["data-plasmic-override"],a=t["data-plasmic-wrap-flex-child"],i=null!=(r=t["data-plasmic-trigger-props"])?r:[];delete t["data-plasmic-override"],delete t["data-plasmic-wrap-flex-child"],delete t["data-plasmic-trigger-props"];for(var o=arguments.length,s=new Array(o>2?o-2:0),u=2;u<o;u++)s[u-2]=arguments[u];return te(n,e,B.apply(void 0,[t,0===s.length?{}:{children:1===s.length?s[0]:s}].concat(i)),a)}var ae=Symbol("UNSET");function ie(e,t){if(!t)return e;for(var r=k({},e),n=0,a=Object.keys(t);n<a.length;n++){var i=a[n],o=e[i],s=t[i];s===ae?delete r[i]:(null!=s||"className"===i||"style"===i||i.startsWith("on")&&"function"==typeof o||(s=q),r[i]=z(i,o,s))}return r}function oe(e){if(!e)return{type:"default",props:{}};if(function(e){return"string"==typeof e||"number"==typeof e||n.isValidElement(e)}(e))return{type:"default",props:{children:e}};if("object"==typeof e)return"as"in e?k({},e,{props:e.props||{},type:"as"}):"render"in e?k({},e,{type:"render"}):"props"in e?k({},e,{props:e.props||{},type:"default"}):(t=Object.keys(e),r=["wrap","wrapChildren"],t.every((function(e){return r.includes(e)}))?k({},e,{props:{},type:"default"}):{type:"default",props:e});if("function"==typeof e)return{type:"render",render:e};var t,r;throw new Error("Unexpected override: "+e)}function se(e,t){if(!t)return e;for(var r={},n=0,a=Array.from(new Set([].concat(Object.keys(e),Object.keys(t))));n<a.length;n++){var i=a[n];r[i]=ue(e[i],t[i])}return r}function ue(e,t){var r,n;if(!e)return t;if(!t)return e;var a=oe(e),i=oe(t),o=F.apply(void 0,[a.wrap,i.wrap].filter(T)),s=F.apply(void 0,[a.wrapChildren,i.wrapChildren].filter(T)),u=ie(null!=(r=a.props)?r:{},i.props);if("render"===i.type)return{render:i.render,props:u,wrap:o,wrapChildren:s};if("render"===a.type)return{render:a.render,props:u,wrap:o,wrapChildren:s};var l=null!=(n="as"===i.type?i.as:void 0)?n:"as"===a.type?a.as:void 0;return k({props:u,wrap:o,wrapChildren:s},l?{as:l}:{})}var le=r.createContext(void 0),ce=["PlasmicIconType"],pe=["src","className","displayWidth","displayHeight","displayMinWidth","displayMinHeight","displayMaxWidth","displayMaxHeight","quality","loader","imgRef","style","loading"],de=[640,750,828,1080,1200,1920,2048,3840],fe=[].concat([16,32,48,64,96,128,256,384],de),ve=n.forwardRef((function(e,r){var a=e.src,i=e.className,o=e.displayWidth,s=e.displayHeight,u=e.displayMinWidth,l=e.displayMinHeight,c=e.displayMaxWidth,p=e.displayMaxHeight,d=e.quality,f=e.loader,v=e.imgRef,m=e.style,h=e.loading,y=I(e,pe),g=Object.assign({},y,{loading:null!=h?h:"lazy"}),b="string"!=typeof a&&a?a:{fullWidth:void 0,fullHeight:void 0,aspectRatio:void 0},P=b.fullWidth,S=b.fullHeight,w=b.aspectRatio,x=a?"string"==typeof a?a:"string"==typeof a.src?a.src:a.src.src:"";if(null==S||null==P)return n.createElement("img",Object.assign({src:x,className:i,style:m},g,{loading:h,ref:L(v,r)}));!he(x)||null!=s&&"auto"!==s||null!=o&&"auto"!==o||(o="100%");var E=o;P&&S&&(!o||"auto"===o)&&ge(s)&&(he(x)||(E=ge(s)*P/S));var V=P,O=S;w&&isFinite(w)&&he(x)&&(V=me,O=Math.round(V/w));var C=function(e,t,r){var n=null==r?void 0:r.minWidth,a=ge(e),i=ge(n);if(null!=a&&(!n||null!=i))return{widthDescs:[{width:ye(Math.max(a,null!=i?i:0),t),desc:"1x"},{width:ye(2*Math.max(a,null!=i?i:0),t),desc:"2x"}],sizes:void 0};var o=de.filter((function(e){return!t||e<t}));return t&&0===o.length?{widthDescs:[{width:ye(t,t),desc:"1x"}],sizes:void 0}:{widthDescs:o.map((function(e){return{width:ye(e,t),desc:e+"w"}})),sizes:"100vw"}}(E,P,{minWidth:u}),M=C.sizes,j=C.widthDescs,T=function(e){return null==e?void 0:"plasmic"===e?be:e}(f),A='<svg width="'+V+'" height="'+O+'" xmlns="http://www.w3.org/2000/svg" version="1.1"/>',F="undefined"==typeof window?Buffer.from(A).toString("base64"):window.btoa(A),N=k({},m||{}),D=k({},R(m||{},"objectFit","objectPosition"));return null!=o&&"auto"!==o?D.width="100%":(D.width=o,N.width="auto",u&&(D.minWidth="100%"),null!=c&&"none"!==c&&(D.maxWidth="100%")),null!=s&&"auto"!==s?D.height="100%":(D.height=s,N.height="auto",l&&(D.minHeight="100%"),null!=p&&"none"!==p&&(D.maxHeight="100%")),n.createElement("div",{className:t(i,"__wab_img-wrapper"),ref:r,style:N},n.createElement("img",{alt:"","aria-hidden":!0,className:"__wab_img-spacer-svg",src:"data:image/svg+xml;base64,"+F,style:D}),function(e){var t=e.imageLoader,r=e.widthDescs,a=e.src,i=e.quality,o=e.style,s=e.className,u=e.sizes,l=e.imgProps,c=e.ref;return n.createElement("picture",{className:"__wab_picture"},t&&t.supportsUrl(a)&&n.createElement("source",{type:"image/webp",srcSet:r.map((function(e){return t.transformUrl({src:a,quality:i,width:e.width,format:"webp"})+" "+e.desc})).join(", ")}),n.createElement("img",Object.assign({},l,{ref:c,className:s,decoding:"async",src:t&&t.supportsUrl(a)?t.transformUrl({src:a,quality:i,width:r[r.length-1].width}):a,srcSet:t&&t.supportsUrl(a)?r.map((function(e){return t.transformUrl({src:a,quality:i,width:e.width})+" "+e.desc})).join(", "):void 0,sizes:t&&t.supportsUrl(a)?u:void 0,style:k({},o?R(o,"objectFit","objectPosition"):{},{width:0,height:0})})))}({imageLoader:T,widthDescs:j,sizes:M,src:x,quality:d,ref:v,style:m?R(m,"objectFit","objectPosition"):void 0,imgProps:g,className:"__wab_img"}))})),me=1e4;function he(e){return e.endsWith(".svg")||e.startsWith("data:image/svg")}function ye(e,t){var r,n=null!=(r=fe.findIndex((function(t){return t>=e})))?r:fe.length-1,a=fe[n];if(!(a>=t||n+1<fe.length&&t<=fe[n+1]))return a}function ge(e){if(null!=e&&""!=e){if("number"==typeof e)return e;var t=function(e){var t=e.match(/^\s*(-?(?:\d+\.\d*|\d*\.\d+|\d+))\s*([a-z]*|%)\s*(?:\/\*.*)?$/i);if(null!=t)return{num:+t[1],units:t[2]}}(e);return!t||t.units&&"px"!==t.units?void 0:t.num}}var be={supportsUrl:function(e){return e.startsWith("https://img.plasmic.app")&&!he(e)},transformUrl:function(e){var t,r=[e.width?"w="+e.width:void 0,"q="+(null!=(t=e.quality)?t:75),e.format?"f="+e.format:void 0].filter((function(e){return!!e}));return e.src+"?"+r.join("&")}},Pe=n.forwardRef((function(e,t){if("nextjs"===e.platform&&e.href){var r=["href","replace","scroll","shallow","passHref","prefetch","locale"];return n.createElement(e.component,k({},R.apply(void 0,[e].concat(r)),{legacyBehavior:!0}),n.createElement("a",Object.assign({},A.apply(void 0,[e,"component","platform"].concat(r)),{ref:t})))}return"gatsby"===e.platform&&/^\/(?!\/)/.test(e.href)?n.createElement(e.component,k({},A(e,"component","platform","href"),{to:e.href,ref:t})):n.createElement("a",Object.assign({},A(e,"component","platform"),{ref:t}))})),Se=n.createContext(void 0);function we(e){var t={},r=0;return{str:function e(a){if(!a)return"";if("number"==typeof a||"boolean"==typeof a||"string"==typeof a)return a.toString();if("object"!=typeof a)return"";if(Array.isArray(a)||null!=(i=a)&&"function"==typeof i[Symbol.iterator])return Array.from(a).map((function(t){return e(t)})).filter((function(e){return!!e})).join("");var i,o=Ve(a,"props")&&Ve(a.props,"children")&&a.props.children||Ve(a,"children")&&a.children||[],s=""+n.Children.toArray(o).map((function(t){return e(t)})).filter((function(e){return!!e})).join("");if(n.isValidElement(a)&&a.type===n.Fragment)return s;var u=r+1;return r++,t[u]=n.isValidElement(a)?n.cloneElement(a,{key:u,children:void 0}):a,"<"+u+">"+s+"</"+u+">"}(e),components:t,componentsCount:r}}function xe(e){var t=e.transKey,r=e.children,a=n.useContext(Se);if(!a)return Ee||(console.warn("Using Plasmic Translation but no translation function has been provided"),Ee=!0),r;var i=we(r);return a(null!=t?t:i.str,i.componentsCount>0?{components:i.components}:void 0)}var Ee=!1;function Ve(e,t){return"object"==typeof e&&null!==e&&t in e}var Oe=["as","defaultContents","value"];function Ce(e){var t=e.as,n=e.defaultContents,a=e.value,i=I(e,Oe),o=void 0===a?n:a;if(!o||Array.isArray(o)&&0===o.length)return null;var s=function e(t){return!r.isValidElement(t)||t.type!==r.Fragment&&t.type!==xe?"string"==typeof t?t:Array.isArray(t)&&1===t.length&&"string"==typeof t[0]?t[0]:void 0:e(t.props.children)}(o);return s&&(o=r.createElement("span",{className:"__wab_slot-string-wrapper"},s)),0===Object.keys(i).filter((function(e){return!!i[e]})).length?r.createElement(r.Fragment,null,o):r.createElement(t||"span",B({className:"__wab_slot"},i),o)}var ke=[],Ie={};function Me(){return W?Object.entries(Ie).filter((function(e){return window.matchMedia(e[1]).matches})).map((function(e){return e[0]})):[]}var je=void 0;W&&window.addEventListener("resize",(function(){var e=Me();je&&e.join("")===je.join("")||(je=e,o.unstable_batchedUpdates((function(){return ke.forEach((function(e){return e()}))})))}));var Te=r.createContext(void 0),Re=u.useIsSSR;function Ae(){r.useContext(Te)}var Fe={useHover:function(){var e=r.useState(!1),t=e[1];return[e[0],{onMouseEnter:function(){return t(!0)},onMouseLeave:function(){return t(!1)}}]},useFocused:function(e){var t=l.useFocusRing({within:!1,isTextInput:e.isTextInput});return[t.isFocused,t.focusProps]},useFocusVisible:function(e){var t=l.useFocusRing({within:!1,isTextInput:e.isTextInput});return[t.isFocusVisible,t.focusProps]},useFocusedWithin:function(e){var t=l.useFocusRing({within:!0,isTextInput:e.isTextInput});return[t.isFocused,t.focusProps]},useFocusVisibleWithin:function(e){var t=l.useFocusRing({within:!0,isTextInput:e.isTextInput});return[t.isFocusVisible,t.focusProps]},usePressed:function(){var e=r.useState(!1),t=e[1];return[e[0],{onMouseDown:function(){return t(!0)},onMouseUp:function(){return t(!1)}}]}};function Ne(e,t,r){for(var n,a,i=0,o=(t=t.split?t.split("."):t).length,s=e;i<o&&"__proto__"!==(a=t[i++])&&"constructor"!==a&&"prototype"!==a;)i===o?(s[a]=r,s=s[a]):typeof(n=s[a])==typeof t?s=s[a]=n:0*t[i]!=0||~(""+t[i]).indexOf(".")?(s[a]={},s=s[a]):(s[a]=[],s=s[a])}var De="undefined"!=typeof window?r.useLayoutEffect:r.useEffect;function We(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function qe(e){return"symbol"!=typeof e&&!isNaN(+e)}var _e=Symbol("[]"),Ke=function(){function e(e){this.specs=e,this.edges=new Map}var t=e.prototype;return t.hasEdge=function(e){return this.edges.has(e)},t.addEdge=function(e,t){this.edges.set(e,t)},t.makeTransition=function(e){return e=qe(e)?_e:e,this.edges.get(e)},t.isLeaf=function(){return 0===this.edges.size},t.hasArrayTransition=function(){return this.edges.has(_e)},t.getSpec=function(){return this.specs[0]},t.getAllSpecs=function(){return this.specs},e}(),He=function(e){return e.split(".").flatMap((function e(t){return t.endsWith("[]")?[].concat(e(t.slice(0,-2)),[_e]):[t]}))};function Be(e){var t=e.map((function(e){return k({},e,{pathObj:He(e.path),isRepeated:e.path.split(".").some((function(e){return e.endsWith("[]")}))})}));return function e(r){var n=new Ke(t.filter((function(e){return We(r,e.pathObj.slice(0,r.length))})));return n.getAllSpecs().forEach((function(t){if(t.pathObj.length>r.length){var a=t.pathObj[r.length];n.hasEdge(a)||n.addEdge(a,e([].concat(r,[a])))}})),n}([])}var Ue=function(e){return null!=e&&"object"==typeof e?d.ref(e):e};function Le(e,t){return function r(n,i){var o=function(e){return[].concat(n,[(t=e,"symbol"==typeof t||isNaN(+t)?e:+e)]);var t};return new Proxy(i.hasArrayTransition()?[]:{},{deleteProperty:function(t,r){var i=o(r),s=new Set;return e.existingStates.forEach((function(t){var r=t.path,n=t.specKey;r.length>=i.length&&function(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}(r.slice(0,i.length),i)&&(ze(e,r),s.add(n))})),s.forEach((function(t){var r,i,o=e.specsByKey[t];o.onChangeProp&&(null==(r=(i=e.props)[o.onChangeProp])||r.call(i,a(e.stateValues,n),n))})),Reflect.deleteProperty(t,r)},get:function(e,n,a){var s,u,l=o(n),c=i.makeTransition(n);return c&&(c.isLeaf()?e[n]=null==(s=(u=t(l,c.getSpec())).get)?void 0:s.call(u,e,n,a):n in e||(e[n]=r(l,c))),Reflect.get(e,n,a)},set:function(a,s,u,l){var c,p,d=o(s),f=i.makeTransition(s);if(f&&"symbol"!=typeof s){var v,m;if(f.isLeaf())return a[s]=null==(v=(m=t(d,f.getSpec())).set)?void 0:v.call(m,a,s,u,l),Reflect.set(a,s,u,l);if("object"==typeof u){a[s]=r(d,f);for(var h=0,y=Object.keys(u);h<y.length;h++){var g=y[h];a[s][g]=u[g]}return!0}}return"registerInitFunc"===s&&0===n.length?Reflect.set(a,s,u,l):!!i.hasArrayTransition()&&(Ne(e.stateValues,d,u),null==(c=i.makeTransition(_e))||null==(p=c.getAllSpecs())||p.forEach((function(t){var r,n;t.onChangeProp&&(null==(r=(n=e.props)[t.onChangeProp])||r.call(n,u,d))})),Reflect.set(a,s,u,l))}})}([],e.rootStateSpec)}var ze=function(e,t){var r,n=JSON.stringify(t);null==(r=e.unsubscriptionsByState[n])||r.forEach((function(e){return e()})),delete e.unsubscriptionsByState[n],e.existingStates.delete(n)},Ge=function(e,t){var r=[];if(e.length!==t.pathObj.length)throw new Error("Unexpected error: state path and spec path have different lengths");for(var n=0;n<t.pathObj.length;n++)"[]"===t.pathObj[n]&&r.push(e[n]);return r};function Qe(e,t,r){var n,i=JSON.stringify(t),o=new Set,s=Le(e,(function(t,r){return{get:function(){var n=JSON.stringify(t);return o.add({path:t,spec:r}),r.valueProp?r.isRepeated?a(e.props[r.valueProp],t.slice(1)):e.props[r.valueProp]:(e.existingStates.has(n)||r.initFunc&&Qe(e,t,r),a(e.stateValues,t))},set:function(){throw new Error("Cannot update state values during initialization")}}}));null==(n=e.unsubscriptionsByState[i])||n.forEach((function(e){return e()})),e.unsubscriptionsByState[i]=[],o.forEach((function(n){var o=n.path,u=n.spec,l=f.subscribeKey(a(e.stateValues,o.slice(-1)),o.slice(-1)[0],(function(){return Ye(e,t,r,r.initFunc(e.props,s,e.ctx,Ge(o,u)))}));e.unsubscriptionsByState[i].push(l)}));var u=r.initFunc(e.props,s,e.ctx,Ge(t,r));return Je(e,t,r,u),u}function Ye(e,t,r,n){Ne(e.stateValues,t,r.isImmutable?Ue(n):n)}function Je(e,t,r,n){if(r.isImmutable){var a=Ue(n);Ne(e.stateValues,t,a),Ne(e.initStateValues,t,c(a))}else Ne(e.stateValues,t,c(n)),Ne(e.initStateValues,t,c(n))}var $e=t,Xe=!0;function Ze(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=t.filter((function(e){return!!e.def})),a=N(n,(function(e){return e.def.group}));return D(a,(function(e){return Object.fromEntries(e.map((function(e){return[e.def.variant,!!e.active]})))}))}function et(e){if(r.isValidElement(e)){var t=e.type;return t.__plumeType||(null==t.getPlumeType?void 0:t.getPlumeType(e.props))}}var tt=["link","isDisabled","startIcon","endIcon","showStartIcon","showEndIcon","children"];function rt(e){return R(e,"className","style")}function nt(e,t){return{plasmicProps:{variants:R.apply(void 0,[t].concat(e.internalVariantProps)),args:R.apply(void 0,[t].concat(e.internalArgProps)),overrides:{}}}}var at=/^(data-.*)$/;function it(e,t){var r=t.itemPlumeType,a=t.sectionPlumeType,i=t.invalidChildError,o=t.requireItemValue;return n.useMemo((function(){return function(e,t){if(!e)return{items:[],disabledKeys:[]};var r=t.itemPlumeType,a=t.sectionPlumeType,i=t.invalidChildError,o=0,s=0,u=[];return{items:function e(l){return H(l).flatMap((function(l){if(n.isValidElement(l)){if(l.type===n.Fragment)return e(l.props.children);var c,p=et(l);if(p===r){var d=ut(l=function(e){if(ct(e,"value"))return o++,e;if(t.requireItemValue&&Xe)throw new Error('Must specify a "value" prop for '+function(e){if("string"==typeof e.type)return e.type;var t,r,n,a,i=e.type;return null!=(t=null!=(r=null!=(n=i.displayName)?n:i.name)?r:null==(a=i.render)?void 0:a.name)?t:"Component"}(e));return pt(e,{value:""+o++})}(l));return lt(l,"isDisabled")&&d&&u.push(d),[l]}if(p===a)return[pt(l,{key:null!=(c=l.key)?c:"section-"+s++,children:e(lt(l,"children"))})]}if(Xe)throw new Error(null!=i?i:"Unexpected child");return[]}))}(e),disabledKeys:u}}(e,{itemPlumeType:r,sectionPlumeType:a,invalidChildError:i,requireItemValue:o})}),[e,r,a,i,o])}function ot(e){return pt(e.rendered,{_node:e,key:e.key})}function st(e,t){if(et(e)===t.itemPlumeType){var r,a=e,i=lt(a,"children");return n.createElement(b.Item,{key:ut(a),textValue:null!=(r=lt(a,"textValue"))?r:(o=i,"string"==typeof o?i:ct(a,"value")?lt(a,"value"):a.key),"aria-label":lt(a,"aria-label")},a)}var o,s=e;return n.createElement(b.Section,{title:s,"aria-label":lt(s,"aria-label"),items:lt(s,"children")},(function(e){return st(e,t)}))}function ut(e){var t;return null!=(t=lt(e,"value"))?t:e.key}function lt(e,t){return"componentProps"in e.props?e.props.componentProps[t]:e.props[t]}function ct(e,t){return"componentProps"in e.props?t in e.props.componentProps:t in e.props}function pt(e,t){return n.cloneElement(e,e.type.getPlumeType?k({componentProps:k({},e.props.componentProps,t)},t.key?{key:t.key}:{}):t)}var dt=r.createContext(void 0),ft=r.createContext(void 0),vt=["children"],mt={itemPlumeType:"menu-item",sectionPlumeType:"menu-group"};function ht(e,t){var n=e.triggerRef,a=e.isDisabled,i=e.placement,o=e.menuMatchTriggerWidth,s=e.menuWidth,u=e.menu,l=y.useMenuTrigger({type:"menu",isDisabled:a},t,n),c=l.menuProps;return{triggerProps:w.usePress(k({},l.menuTriggerProps,{isDisabled:a})).pressProps,makeMenu:function(){var e="function"==typeof u?u():u;if(!e)return null;if("menu"!==et(e)){if(Xe)throw new Error("Must use an instance of the Menu component.");return null}return r.cloneElement(e,B(e.props,c))},triggerContext:r.useMemo((function(){var e;return{triggerRef:n,state:t,autoFocus:null==(e=t.focusStrategy)||e,placement:i,overlayMatchTriggerWidth:o,overlayMinTriggerWidth:!0,overlayWidth:s}}),[n,t,i,o,s])}}var yt=r.createContext(void 0),gt=["value","defaultValue","children","onChange","placement","menuMatchTriggerWidth","menuWidth"],bt={itemPlumeType:"select-option",sectionPlumeType:"select-option-group"};function Pt(e){var t=e.state,n=e.menuProps,a=e.children,i=r.useRef(null),o=E.useListBox(k({},n,{isVirtualized:!1,autoFocus:t.focusStrategy||!0,disallowEmptySelection:!0}),t,i);return r.cloneElement(a,B(a.props,o.listBoxProps,{style:{outline:"none"},ref:i}))}var St=["isDisabled","startIcon","endIcon","showStartIcon","showEndIcon","className","style","inputClassName","inputStyle"];exports.get=a,Object.defineProperty(exports,"PlasmicDataSourceContextProvider",{enumerable:!0,get:function(){return s.PlasmicDataSourceContextProvider}}),Object.defineProperty(exports,"useCurrentUser",{enumerable:!0,get:function(){return s.useCurrentUser}}),exports.DropdownMenu=function(e){var t=e.isOpen,n=e.defaultOpen,a=e.onOpenChange,i=e.children,o=e.placement,s=e.menu,u=r.useRef(null),l=S.useMenuTriggerState({isOpen:t,defaultOpen:n,onOpenChange:a,shouldFlip:!0}),c=ht({triggerRef:u,placement:o,menu:s},l),p=c.makeMenu;return r.createElement(dt.Provider,{value:c.triggerContext},r.cloneElement(i,B(i.props,c.triggerProps,{ref:u})),l.isOpen&&p())},exports.PlasmicHead=function(e){var t=r.useContext(le);return t?r.createElement(t,null,e.image?[r.createElement("meta",{key:"twitter:card",name:"twitter:card",content:"summary_large_image"}),r.createElement("meta",{key:"og:image",property:"og:image",content:e.image}),r.createElement("meta",{key:"twitter:image",name:"twitter:image",content:e.image})]:r.createElement("meta",{key:"twitter:card",name:"twitter:card",content:"summary"}),e.title&&[r.createElement("title",{key:"title"},e.title),r.createElement("meta",{key:"og:title",property:"og:title",content:e.title}),r.createElement("meta",{key:"twitter:title",property:"twitter:title",content:e.title})],e.description&&[r.createElement("meta",{key:"description",name:"description",content:e.description}),r.createElement("meta",{key:"og:description",property:"og:description",content:e.description}),r.createElement("meta",{key:"twitter:description",name:"twitter:description",content:e.description})],e.canonical&&r.createElement("link",{key:"canonical",ref:"canonical",href:e.canonical})):(console.warn("Plasmic: Head meta tags are being ignored. To make them work, pass a Head component into PlasmicRootProvider."),null)},exports.PlasmicIcon=function(e){var t=e.PlasmicIconType,n=I(e,ce);return r.createElement(t,Object.assign({},n))},exports.PlasmicImg=ve,exports.PlasmicLink=Pe,exports.PlasmicPageGuard=function(e){var t=e.children,r=e.dataSourceCtxValue;return!r||r.isUserLoading?null:r&&r.user&&"roleId"in r.user&&e.validRoles.includes(r.user.roleId)?t:n.createElement("div",null,"You don't have access to this page")},exports.PlasmicRootProvider=function(e){var t=e.platform,n=e.children,a=e.userAuthToken,i=e.isUserLoading,o=e.user,l=r.useMemo((function(){return{platform:t}}),[t]),c=r.useMemo((function(){return{userAuthToken:a,user:o,isUserLoading:i}}),[a,i,o]);return r.createElement(Te.Provider,{value:l},r.createElement(u.SSRProvider,null,r.createElement(s.PlasmicDataSourceContextProvider,{value:c},r.createElement(Se.Provider,{value:e.translator},r.createElement(le.Provider,{value:e.Head},n)))))},exports.PlasmicSlot=function(e){return Ce(e)},exports.SelectContext=yt,exports.Stack=Z,exports.Trans=xe,exports.TriggeredOverlayContext=dt,exports.classNames=$e,exports.createPlasmicElementProxy=function(e,t){null==t&&(t={});var r=t["data-plasmic-name"],n=t["data-plasmic-root"],a=t["data-plasmic-for-node"];delete t["data-plasmic-name"],delete t["data-plasmic-root"],delete t["data-plasmic-for-node"];for(var i=arguments.length,o=new Array(i>2?i-2:0),s=2;s<i;s++)o[s-2]=arguments[s];var u=ne.apply(void 0,[e,t].concat(o));if(r&&re.set(r,u),n){var l,c=a?null!=(l=re.get(a))?l:null:u;return re.clear(),c}return u},exports.createUseScreenVariants=function(e,t){return Object.assign(Ie,t),je=void 0,function(){var t=r.useState()[1],n=r.useRef(je||[]);return _((function(){var e=function(){je&&n.current.join("")!==je.join("")&&(n.current=je,t({}))};return ke.push(e),void 0===je&&(je=Me()),e(),function(){ke.splice(ke.indexOf(e),1)}}),[]),e?je||[]:je?je[je.length-1]:void 0}},exports.deriveRenderOpts=function(e,t){var r,n,a,i,o,s=t.name,u=t.descendantNames,l=t.internalVariantPropNames,c=t.internalArgPropNames,p=["variants","args","overrides"],d=(r=A.apply(void 0,[R.apply(void 0,[e].concat(l))].concat(p)),n=e.variants,r&&n?k({},r,n):r||n||{}),f=(a=A.apply(void 0,[R.apply(void 0,[e].concat(c))].concat(p)),i=e.args,a&&i?k({},a,i):a||i||{}),v=se(A.apply(void 0,[R.apply(void 0,[e].concat(u))].concat(c,l,p)),e.overrides),m=A.apply(void 0,[e,"variants","args","overrides"].concat(u,l,c));return Object.keys(m).length>0&&(v=se(v,((o={})[s]={props:m},o))),{variants:d,args:f,overrides:v}},exports.ensureGlobalVariants=function(e){return Object.entries(e).filter((function(e){return"PLEASE_RENDER_INSIDE_PROVIDER"===e[1]})).forEach((function(t){e[t[0]]=void 0})),e},exports.genTranslatableString=we,exports.generateStateOnChangeProp=function(e,t,r){return function(n,a){return Ne(e,[t].concat(r,a),n)}},exports.generateStateValueProp=function(e,t){return a(e,t)},exports.getDataProps=function(e){return function(e,t){for(var r={},n=0,a=Object.entries(e);n<a.length;n++){var i=a[n][0];at.test(i)&&(r[i]=e[i])}return r}(e)},exports.hasVariant=function(e,t,r){if(null==e)return!1;var n=e[t];return null!=n&&(!0===n?r===t:!1!==n&&(Array.isArray(n)?n.includes(r):"string"==typeof n?n===r:void 0!==n[r]&&!1!==n[r]))},exports.isNum=qe,exports.makeFragment=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return r.createElement.apply(r,[r.Fragment,{}].concat(t))},exports.mergeVariantsWithStates=function(e,t,r){return k({},e,Object.fromEntries(r.map((function(e){return[e.variantGroup,a(t,e.statePath)]}))))},exports.omit=A,exports.pick=R,exports.plasmicHeadMeta={name:"hostless-plasmic-head",displayName:"Head",description:"Used to add page metadata to HTML <head />.",importName:"PlasmicHead",importPath:"@plasmicapp/react-web",isRepeatable:!1,styleSections:!1,props:{title:{type:"string",displayName:"Title"},description:{type:"string",displayName:"Description"},image:{type:"imageUrl",displayName:"Image"},canonical:{type:"string",displayName:"Canonical URL"}}},exports.renderPlasmicSlot=Ce,exports.set=Ne,exports.setPlumeStrictMode=function(e){Xe=e},exports.shallowEqual=We,exports.useButton=function(e,t,r,n){var a,i,o,s;void 0===n&&(n=null);var u=t.link,l=t.isDisabled,c=t.startIcon,p=t.endIcon,d=t.showStartIcon,f=t.showEndIcon,v=t.children,m=I(t,tt);return{plasmicProps:{variants:k({},R.apply(void 0,[t].concat(e.internalVariantProps)),Ze({def:r.showStartIconVariant,active:d},{def:r.showEndIconVariant,active:f},{def:r.isDisabledVariant,active:l})),args:k({},R.apply(void 0,[t].concat(e.internalArgProps)),r.startIconSlot&&((a={})[r.startIconSlot]=c,a),r.endIconSlot&&((i={})[r.endIconSlot]=p,i),((o={})[r.contentSlot]=v,o)),overrides:((s={})[r.root]={as:u?"a":"button",props:k({},A.apply(void 0,[m].concat(e.internalArgProps,e.internalVariantProps)),{ref:n,disabled:l},!!u&&{href:u})},s)}}},exports.useCanvasDollarState=function(e,t,r){var n=d.proxy({stateValues:{},initStateValues:{},specsByKey:Object.fromEntries(e.map((function(e){return[e.path,k({},e,{pathObj:He(e.path),isRepeated:e.path.split(".").some((function(e){return e.endsWith("[]")}))})]}))),statesInstanceBySpec:new Map,existingStates:new Map,unsubscriptionsByState:{},props:{},ctx:{},registrationsQueue:[],rootStateSpec:Be(e)});n.props=Ue(t),n.ctx=Ue(r);for(var a,i={},o=j(e);!(a=o()).done;){var s=a.value,u=He(s.path);Ne(i,u,s.valueProp?n.props[s.valueProp]:s.initVal?s.initVal:s.initFunc?Qe(n,u,n.specsByKey[s.path]):void 0)}return i},exports.useCheckbox=function(e,t,n,a){var i,o;void 0===a&&(a=null);var s=t.children,u=t.isDisabled,l=t.isIndeterminate;Ae();var c=r.useRef(null),p=r.useRef(null),d=function(e){var t=k({},e,{isSelected:e.isChecked,defaultSelected:e.defaultChecked});return delete t.isChecked,delete t.defaultChecked,t}(t),f=h.useToggleState(d),y=v.useCheckbox(d,f,c).inputProps,g=k({},R.apply(void 0,[t].concat(e.internalVariantProps)),Ze({def:n.isDisabledVariant,active:u},{def:n.isCheckedVariant,active:f.isSelected},{def:n.isIndeterminateVariant,active:l},{def:n.noLabelVariant,active:!s})),b=((i={})[n.root]={as:"label",props:B(rt(t),{ref:p}),wrapChildren:function(e){return r.createElement(r.Fragment,null,r.createElement(m.VisuallyHidden,null,r.createElement("input",Object.assign({},y,{ref:c}))),e)}},i),P=k({},R.apply(void 0,[t].concat(e.internalArgProps)),n.labelSlot?((o={})[n.labelSlot]=s,o):{}),S=r.useMemo((function(){return{setChecked:function(e){return f.setSelected(e)}}}),[f]);return r.useImperativeHandle(a,(function(){return{getRoot:function(){return p.current},focus:function(){var e;return null==(e=c.current)?void 0:e.focus()},blur:function(){var e;return null==(e=c.current)?void 0:e.blur()},setChecked:function(e){return S.setChecked(e)}}}),[p,c,S]),{plasmicProps:{variants:g,overrides:b,args:P},state:S}},exports.useDollarState=function(e,t,r){var i=n.useRef(d.proxy({stateValues:{},initStateValues:{},specsByKey:Object.fromEntries(e.map((function(e){return[e.path,k({},e,{pathObj:He(e.path),isRepeated:e.path.split(".").some((function(e){return e.endsWith("[]")}))})]}))),statesInstanceBySpec:new Map,existingStates:new Map,unsubscriptionsByState:{},props:{},ctx:{},registrationsQueue:[],rootStateSpec:Be(e)})).current;i.props=Ue(t),i.ctx=Ue(null!=r?r:{});var o=n.useRef(Object.assign(Le(i,(function(e,t){var r=JSON.stringify(e);if(!i.existingStates.has(r)){var n;!function(e,t,r){var n=JSON.stringify(t);e.existingStates.set(n,{path:t,specKey:r.path}),e.statesInstanceBySpec.has(r.path)||e.statesInstanceBySpec.set(r.path,[]),e.statesInstanceBySpec.get(r.path).push({path:t,specKey:r.path})}(i,e,t);var o=t.initFunc?Qe(i,e,t):null!=(n=t.initVal)?n:void 0;Je(i,e,t,o)}return{get:function(){return t.valueProp?t.isRepeated?a(i.props[t.valueProp],e.slice(1)):i.props[t.valueProp]:a(i.stateValues,e)},set:function(r,n,a){var o,s;return Ye(i,e,t,a),t.onChangeProp&&(null==(o=(s=i.props)[t.onChangeProp])||o.call(s,a,e)),!0}}})),{registerInitFunc:function(e,n){var s;null!=(s=i.statesInstanceBySpec.get(e))&&s.some((function(e){var s=e.path,u=e.specKey;return!p(a(i.initStateValues,s),n(t,o,null!=r?r:{},Ge(s,i.specsByKey[u])))}))&&i.registrationsQueue.push({pathStr:e,f:n})}})).current,s=[];return i.existingStates.forEach((function(e){var n=e.path,u=i.specsByKey[e.specKey];if(u.initFunc){var l=u.initFunc(t,o,null!=r?r:{},Ge(n,u));p(l,a(i.initStateValues,n))||s.push({path:n,spec:u})}})),De((function(){s.forEach((function(e){var t,r,n=e.path,a=e.spec,o=Qe(i,n,a);a.onChangeProp&&(null==(t=(r=i.props)[a.onChangeProp])||t.call(r,o,n))}))}),[t,s]),De((function(){i.registrationsQueue.forEach((function(e){i.specsByKey[e.pathStr].initFunc=e.f})),i.registrationsQueue=[]}),[i.registrationsQueue]),d.useSnapshot(i.stateValues,{sync:!0}),d.useSnapshot(i.specsByKey,{sync:!0}),o},exports.useIsSSR=Re,exports.useIsomorphicLayoutEffect=De,exports.useMenu=function(e,t,n,a){var i,o;void 0===a&&(a=null),Ae();var s=function(e){var t=e.children,n=I(e,vt),a=it(t,k({},mt,{invalidChildError:"Can only use Menu.Item and Menu.Group as children to Menu",requireItemValue:!1})),i=a.items,o=a.disabledKeys;return{ariaProps:k({},n,{children:r.useCallback((function(e){return st(e,mt)}),[]),items:i,disabledKeys:o})}}(t).ariaProps,u=r.useContext(dt),l=r.useRef(null),c=g.useTreeState(s),p=r.useRef(null),d=y.useMenu(k({},s,{autoFocus:null==u?void 0:u.autoFocus}),c,p).menuProps,f=r.useMemo((function(){return{state:c,menuProps:t}}),[c,t]),v=k({},R.apply(void 0,[t].concat(e.internalVariantProps))),m=((i={})[n.root]={props:B(rt(t),{ref:l})},i[n.itemsContainer]={as:"ul",props:B(d,{ref:p,style:k({},{outline:"none"})})},i),h=k({},R.apply(void 0,[t].concat(e.internalArgProps)),((o={})[n.itemsSlot]=r.createElement(ft.Provider,{value:f},Array.from(c.collection).map((function(e){return ot(e)}))),o)),b=r.useMemo((function(){return{getFocusedValue:function(){return c.selectionManager.focusedKey},setFocusedValue:function(e){return c.selectionManager.setFocusedKey(e)}}}),[c]);return r.useImperativeHandle(a,(function(){return{getRoot:function(){return l.current},getFocusedValue:function(){return b.getFocusedValue()},setFocusedValue:function(e){return b.setFocusedValue(e)}}}),[l,b]),{plasmicProps:{variants:v,args:h,overrides:m},state:b}},exports.useMenuButton=function(e,t,n,a){var i,o;void 0===a&&(a=null);var s=t.placement,u=t.isOpen,c=t.defaultOpen,p=t.onOpenChange,d=t.isDisabled,f=t.menu,v=t.autoFocus,m=t.menuMatchTriggerWidth,h=t.menuWidth;Ae();var y=r.useRef(null),g=r.useRef(null),b=S.useMenuTriggerState({isOpen:u,defaultOpen:c,onOpenChange:p,shouldFlip:!0}),P=ht({isDisabled:d,triggerRef:g,placement:s,menuMatchTriggerWidth:m,menuWidth:h,menu:f},b),w=P.triggerProps,x=P.makeMenu,E=P.triggerContext,V=l.useFocusable(t,g).focusableProps,O=k({},R.apply(void 0,[t].concat(e.internalVariantProps)),Ze({def:n.isOpenVariant,active:b.isOpen},{def:n.isDisabledVariant,active:d})),C=k({},R.apply(void 0,[t].concat(e.internalArgProps)),((i={})[n.menuSlot]=b.isOpen?x():void 0,i)),I=((o={})[n.root]={wrapChildren:function(e){return r.createElement(dt.Provider,{value:E},e)},props:{ref:y}},o[n.trigger]={props:B(w,V,rt(t),R(t,"title"),{ref:g,autoFocus:v,disabled:!!d,type:"button"})},o),M=r.useMemo((function(){return{open:function(){return b.open()},close:function(){return b.close()},isOpen:function(){return b.isOpen}}}),[b]);return r.useImperativeHandle(a,(function(){return{getRoot:function(){return y.current},getTrigger:function(){return g.current},focus:function(){return g.current&&g.current.focus()},blur:function(){return g.current&&g.current.blur()},open:M.open,close:M.close,isOpen:M.isOpen}}),[y,g,M]),{plasmicProps:{variants:O,args:C,overrides:I},state:M}},exports.useMenuGroup=function(e,t,n){var a,i,o=r.useContext(ft),s=t._node;if(!o||!s){if(Xe)throw new Error("You can only use a Menu.Group within a Menu component.");return nt(e,t)}var u=y.useMenuSection({heading:t.title,"aria-label":t["aria-label"]}),l=u.headingProps,c=u.groupProps,p=P.useSeparator({elementType:"li"}).separatorProps;return{plasmicProps:{variants:k({},R.apply(void 0,[t].concat(e.internalVariantProps)),Ze({def:n.noTitleVariant,active:!t.title},{def:n.isFirstVariant,active:o.state.collection.getFirstKey()===s.key})),args:k({},R.apply(void 0,[t].concat(e.internalArgProps)),((a={})[n.titleSlot]=t.title,a[n.itemsSlot]=Array.from(s.childNodes).map((function(e){return ot(e)})),a)),overrides:((i={})[n.root]={props:rt(t)},i[n.separator]={props:k({},p),as:"li"},i[n.titleContainer]=k({props:k({role:"presentation"},l)},!t.title&&{render:function(){return null}}),i[n.itemsContainer]={props:k({},c),as:"ul"},i)}}},exports.useMenuItem=function(e,t,n){var a,i,o=r.useContext(ft),s=r.useContext(dt);if(!o){if(Xe)throw new Error("You can only use a Menu.Item within a Menu component.");return nt(e,t)}var u=t.children,l=t.onAction,c=o.state,p=o.menuProps,d=t._node,f=c.disabledKeys.has(d.key),v=c.selectionManager.isFocused&&c.selectionManager.focusedKey===d.key,m=r.useRef(null),h=y.useMenuItem(B({onAction:l},{onAction:p.onAction,onClose:null==s?void 0:s.state.close},{isDisabled:f,"aria-label":d&&d["aria-label"],key:d.key,isVirtualized:!1,closeOnSelect:!0}),c,m),g=h.menuItemProps,b=h.labelProps;return{plasmicProps:{variants:k({},R.apply(void 0,[t].concat(e.internalVariantProps)),Ze({def:n.isDisabledVariant,active:f},{def:n.isHighlightedVariant,active:v})),args:k({},R.apply(void 0,[t].concat(e.internalArgProps)),((a={})[n.labelSlot]=u,a)),overrides:((i={})[n.root]={as:"li",props:B(g,{ref:m,style:{outline:"none"}})},i[n.labelContainer]={props:k({},b)},i)}}},exports.useSelect=function(e,t,n,a){var i,o;void 0===a&&(a=null),Ae();var s=function(e){var t=e.value,n=e.defaultValue,a=e.children,i=e.onChange,o=I(e,gt),s=it(a,k({},bt,{invalidChildError:"Can only use Select.Option and Select.OptionGroup as children to Select",requireItemValue:!0})),u=s.items,l=s.disabledKeys;return{ariaProps:k({},o,{children:r.useCallback((function(e){return st(e,bt)}),[]),onSelectionChange:r.useMemo((function(){return i?function(e){return i(null==e||"null"===e?null:e)}:void 0}),[i]),items:u,disabledKeys:l,defaultSelectedKey:n},"value"in e&&{selectedKey:null!=t?t:null})}}(t).ariaProps,u=t.placement,l=V.useSelectState(s),c=r.useRef(null),p=r.useRef(null),d=t.isDisabled,f=t.name,v=t.menuWidth,m=t.menuMatchTriggerWidth,h=t.autoFocus,y=t.placeholder,g=t.selectedContent,b=x.useSelect(s,l,c),P=b.menuProps,S=w.usePress(k({},b.triggerProps,{isDisabled:d})).pressProps,E=l.selectedItem?null!=g?g:lt(l.selectedItem.value,"children"):null,O=k({},R.apply(void 0,[t].concat(e.internalVariantProps)),Ze({def:n.isOpenVariant,active:l.isOpen},{def:n.placeholderVariant,active:!l.selectedItem},{def:n.isDisabledVariant,active:d})),C=r.useMemo((function(){return{triggerRef:c,state:l,placement:u,overlayMatchTriggerWidth:m,overlayMinTriggerWidth:!0,overlayWidth:v}}),[c,l,u,m,v]),M=((i={})[n.root]={props:B(rt(t),{ref:p}),wrapChildren:function(e){return r.createElement(r.Fragment,null,r.createElement(x.HiddenSelect,{state:l,triggerRef:c,name:f,isDisabled:d}),e)}},i[n.trigger]={props:B(S,{ref:c,autoFocus:h,disabled:!!d,type:"button"})},i[n.overlay]={wrap:function(e){return r.createElement(dt.Provider,{value:C},e)}},i[n.optionsContainer]={wrap:function(e){return r.createElement(Pt,{state:l,menuProps:P},e)}},i),j=k({},R.apply(void 0,[t].concat(e.internalArgProps)),((o={})[n.triggerContentSlot]=E,o[n.placeholderSlot]=y,o[n.optionsSlot]=r.createElement(yt.Provider,{value:l},Array.from(l.collection).map((function(e){return ot(e)}))),o)),T=r.useMemo((function(){return{open:function(){return l.open()},close:function(){return l.close()},isOpen:function(){return l.isOpen},getSelectedValue:function(){return l.selectedKey?""+l.selectedKey:null},setSelectedValue:function(e){return l.setSelectedKey(e)}}}),[l]);return r.useImperativeHandle(a,(function(){return{getRoot:function(){return p.current},getTrigger:function(){return c.current},focus:function(){var e;return null==(e=c.current)?void 0:e.focus()},blur:function(){var e;return null==(e=c.current)?void 0:e.blur()},open:function(){return T.open()},close:function(){return T.close()},isOpen:function(){return T.isOpen()},getSelectedValue:function(){return T.getSelectedValue()},setSelectedValue:function(e){return T.setSelectedValue(e)}}}),[p,c,T]),{plasmicProps:{variants:O,args:j,overrides:M},state:T}},exports.useSelectOption=function(e,t,n,a){var i,o;void 0===a&&(a=null);var s=r.useContext(yt);if(!s){if(Xe)throw new Error("You can only use a Select.Option within a Select component.");return nt(e,t)}var u=t.children,l=r.useRef(null),c=L(l,a),p=t._node,d=s.selectionManager.isSelected(p.key),f=s.disabledKeys.has(p.key),v=s.selectionManager.isFocused&&s.selectionManager.focusedKey===p.key,m=E.useOption({isSelected:d,isDisabled:f,"aria-label":p&&p["aria-label"],key:p.key,shouldSelectOnPressUp:!0,shouldFocusOnHover:!0,isVirtualized:!1},s,l),h=m.optionProps,y=m.labelProps;return{plasmicProps:{variants:k({},R.apply(void 0,[t].concat(e.internalVariantProps)),Ze({def:n.isSelectedVariant,active:d},{def:n.isDisabledVariant,active:f},{def:n.isHighlightedVariant,active:v})),args:k({},R.apply(void 0,[t].concat(e.internalArgProps)),((i={})[n.labelSlot]=u,i)),overrides:((o={})[n.root]={props:B(h,rt(t),{ref:c,style:{outline:"none"}})},o[n.labelContainer]={props:y},o)}}},exports.useSelectOptionGroup=function(e,t,n){var a,i,o=r.useContext(yt),s=t._node;if(!o||!s){if(Xe)throw new Error("You can only use a Select.OptionGroup within a Select component.");return nt(e,t)}var u=E.useListBoxSection({heading:t.title,"aria-label":t["aria-label"]}),l=u.headingProps,c=u.groupProps,p=P.useSeparator({elementType:"li"}).separatorProps;return{plasmicProps:{variants:k({},R.apply(void 0,[t].concat(e.internalVariantProps)),Ze({def:n.noTitleVariant,active:!t.title},{def:n.isFirstVariant,active:o.collection.getFirstKey()===s.key})),args:k({},R.apply(void 0,[t].concat(e.internalArgProps)),((a={})[n.titleSlot]=t.title,a[n.optionsSlot]=Array.from(s.childNodes).map((function(e){return ot(e)})),a)),overrides:((i={})[n.root]={props:rt(t)},i[n.separator]={props:k({},p)},i[n.titleContainer]=k({props:k({role:"presentation"},l)},!t.title&&{render:function(){return null}}),i[n.optionsContainer]={props:k({},c)},i)}}},exports.useSwitch=function(e,t,n,a){var i,o;void 0===a&&(a=null);var s=t.children,u=t.isDisabled;Ae();var l=r.useRef(null),c=r.useRef(null),p=function(e){var t=k({},e,{isSelected:e.isChecked,defaultSelected:e.defaultChecked});return delete t.isChecked,delete t.defaultChecked,t}(t),d=h.useToggleState(p),f=O.useSwitch(p,d,l).inputProps,v=k({},R.apply(void 0,[t].concat(e.internalVariantProps)),Ze({def:n.isDisabledVariant,active:u},{def:n.isCheckedVariant,active:d.isSelected},{def:n.noLabelVariant,active:!s})),y=((i={})[n.root]={as:"label",props:B(rt(t),{ref:c}),wrapChildren:function(e){return r.createElement(r.Fragment,null,r.createElement(m.VisuallyHidden,null,r.createElement("input",Object.assign({},f,{ref:l}))),e)}},i),g=k({},R.apply(void 0,[t].concat(e.internalArgProps)),n.labelSlot?((o={})[n.labelSlot]=s,o):{}),b=r.useMemo((function(){return{setChecked:function(e){return d.setSelected(e)}}}),[d]);return r.useImperativeHandle(a,(function(){return{getRoot:function(){return c.current},focus:function(){var e;return null==(e=l.current)?void 0:e.focus()},blur:function(){var e;return null==(e=l.current)?void 0:e.blur()},setChecked:function(e){return b.setChecked(e)}}}),[c,l,b]),{plasmicProps:{variants:v,overrides:y,args:g},state:b}},exports.useTextInput=function(e,t,n,a){var i,o,s;void 0===a&&(a=null);var u=t.isDisabled,l=t.startIcon,c=t.endIcon,p=t.showStartIcon,d=t.showEndIcon,f=t.className,v=t.style,m=t.inputClassName,h=t.inputStyle,y=I(t,St),g=r.useRef(null),b=r.useRef(null);return r.useImperativeHandle(a,(function(){return{focus:function(){var e;null==(e=b.current)||e.focus()},blur:function(){var e;null==(e=b.current)||e.blur()},getRoot:function(){return g.current},getInput:function(){return b.current}}}),[g,b]),{plasmicProps:{variants:k({},R.apply(void 0,[t].concat(e.internalVariantProps)),Ze({def:n.showStartIconVariant,active:p},{def:n.showEndIconVariant,active:d},{def:n.isDisabledVariant,active:u})),args:k({},R.apply(void 0,[t].concat(e.internalArgProps)),n.startIconSlot&&((i={})[n.startIconSlot]=l,i),n.endIconSlot&&((o={})[n.endIconSlot]=c,o)),overrides:((s={})[n.root]={props:{ref:g,className:f,style:v}},s[n.input]={props:k({},A.apply(void 0,[y].concat(e.internalArgProps.filter((function(e){return"required"!==e})),e.internalVariantProps)),{disabled:u,ref:b,className:m,style:h})},s)}}},exports.useTrigger=function(e,t){return Fe[e](t)},exports.useTriggeredOverlay=function(e,t,n,a,o){var s,u;void 0===a&&(a=null),void 0===o&&(o=!0);var c=r.useRef(null),p=L(c,a),d=r.useContext(dt);if(!d){if(Xe)throw new Error("You can only use a triggered overlay with a TriggeredOverlayContext");return nt(e,t)}var f=t.children,v=d.triggerRef,m=d.placement,h=d.overlayMatchTriggerWidth,y=d.overlayMinTriggerWidth,g=d.overlayWidth,b=d.state,P=r.useState(!1),S=P[0],w=P[1],x=v.current&&(h||y)?v.current.offsetWidth:void 0;_((function(){!S&&v.current&&(h||y)&&w(!0)}),[v,S,h,y]);var E=C.useOverlay({isOpen:b.isOpen,onClose:b.close,isDismissable:o,shouldCloseOnBlur:!0},c).overlayProps,V=C.useOverlayPosition({targetRef:v,overlayRef:c,placement:null!=m?m:"bottom left",shouldFlip:!0,isOpen:b.isOpen,onClose:b.close,containerPadding:0}),O=V.overlayProps,I=V.updatePosition,M=V.placement;_((function(){b.isOpen&&requestAnimationFrame((function(){I()}))}),[b.isOpen,I]);var j=B({style:{left:"auto",right:"auto",top:"auto",bottom:"auto",position:"absolute",width:null!=g?g:h?x:"auto",minWidth:y?x:"auto"}},E,O);return{plasmicProps:{variants:k({},R.apply(void 0,[t].concat(e.internalVariantProps)),Ze({def:n.isPlacedTopVariant,active:"top"===M},{def:n.isPlacedBottomVariant,active:"bottom"===M},{def:n.isPlacedLeftVariant,active:"left"===M},{def:n.isPlacedRightVariant,active:"right"===M})),args:k({},R.apply(void 0,[t].concat(e.internalArgProps)),((s={})[n.contentSlot]=r.createElement(l.FocusScope,{restoreFocus:!0},r.createElement(C.DismissButton,{onDismiss:b.close}),f),s)),overrides:((u={})[n.root]={props:B(j,rt(t),{ref:p}),wrap:function(e){return"undefined"!=typeof document?i.createPortal(e,document.body):e}},u)}}},exports.wrapWithClassName=function(e,t){var n=r.isValidElement(e)&&e.key||void 0;return r.createElement("div",{key:n,className:t,style:{display:"grid"}},e)}; | ||
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("classnames")),r=require("react"),n=e(r),a=e(require("dlv")),i=require("react-dom"),o=e(i),s=require("@plasmicapp/data-sources-context"),u=require("@react-aria/ssr"),l=require("@react-aria/focus"),c=e(require("clone")),p=e(require("fast-deep-equal")),d=require("valtio"),f=require("@react-aria/checkbox"),v=require("@react-aria/visually-hidden"),m=require("@react-stately/toggle"),h=require("@react-aria/menu"),g=require("@react-stately/tree"),y=require("@react-stately/collections"),b=require("@react-aria/separator"),P=require("@react-stately/menu"),w=require("@react-aria/interactions"),S=require("@react-aria/select"),E=require("@react-aria/listbox"),x=require("@react-stately/select"),C=require("@react-aria/switch"),O=require("@react-aria/overlays");function V(){return(V=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function k(e,t){if(null==e)return{};var r,n,a={},i=Object.keys(e);for(n=0;n<i.length;n++)t.indexOf(r=i[n])>=0||(a[r]=e[r]);return a}function I(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function M(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return I(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?I(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function T(e){return null!=e}function j(e){if(0===Object.keys(e).length)return e;for(var t={},r=arguments.length,n=new Array(r>1?r-1:0),a=1;a<r;a++)n[a-1]=arguments[a];for(var i=0,o=n;i<o.length;i++){var s=o[i];s in e&&(t[s]=e[s])}return t}function A(e){if(0===Object.keys(e).length)return e;for(var t={},r=arguments.length,n=new Array(r>1?r-1:0),a=1;a<r;a++)n[a-1]=arguments[a];for(var i=0,o=Object.keys(e);i<o.length;i++){var s=o[i];n.includes(s)||(t[s]=e[s])}return t}function R(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(0!==t.length)return function(e){for(var r=e,n=0,a=t;n<a.length;n++)r=(0,a[n])(r);return r}}function F(e,t){for(var r,n={},a=M(e);!(r=a()).done;){var i=r.value,o=t(i);o in n?n[o].push(i):n[o]=[i]}return n}function N(e,t){var r={};for(var n in e)r[n]=t(e[n]);return r}var _="undefined"!=typeof window,D=Symbol("NONE"),W=_?n.useLayoutEffect:n.useEffect;function q(e,t,r){return Array.isArray(r)?n.createElement.apply(n,[e,t].concat(r)):r||"children"in t?n.createElement(e,t,r):n.createElement(e,t)}function L(e){return n.isValidElement(t=e)||function(e){return"string"==typeof e||"number"==typeof e}(t)?[e]:Array.isArray(e)?e.flatMap(L):[];var t}function H(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];if(r.every((function(e){return 0===Object.keys(e).length})))return e;for(var a=V({},e),i=0,o=r;i<o.length;i++)for(var s=o[i],u=0,l=Object.keys(s);u<l.length;u++){var c=l[u];a[c]=z(c,a[c],s[c])}return a}function U(e,t){e&&("function"==typeof e?e(t):Object.isFrozen(e)||(e.current=t))}function K(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(e){for(var r=0,n=t;r<n.length;r++)U(n[r],e)}}function z(e,r,n){return r===D||n===D?null:null==r?n:null==n?r:"className"===e?t(r,n):"style"===e?V({},r,n):"ref"===e?K(r,n):typeof r!=typeof n?n:e.startsWith("on")&&"function"==typeof r?function(){var e;return"function"==typeof r&&(e=r.apply(void 0,arguments)),"function"==typeof n&&(e=n.apply(void 0,arguments)),e}:n}var G=["children"],B=["as","hasGap"],J=["hasGap"];function Y(e,t,r,n){var a=t.children,i=k(t,G),o=Z(a,null!=r&&r);return q(e,V({ref:n},i),o)}function Q(e,t){var r=e.as,n=e.hasGap;return Y(null!=r?r:"div",k(e,B),n,t)}var $=function(e){return r.forwardRef((function(t,r){var n=t.hasGap,a=k(t,J);return Y(e,a,n,r)}))},X=Object.assign(r.forwardRef(Q),{div:$("div"),a:$("a"),button:$("button"),h1:$("h1"),h2:$("h2"),h3:$("h3"),h4:$("h4"),h5:$("h5"),h6:$("h6"),label:$("label"),form:$("form"),section:$("section"),head:$("head"),main:$("main"),nav:$("nav")});function Z(e,t){var n=t?"__wab_flex-container":"__wab_passthrough";return e?Array.isArray(e)?r.createElement.apply(r,["div",{className:n}].concat(e)):r.createElement("div",{className:n},e):null}function ee(e,t,r,a){if(!e||0===Object.keys(e).length)return q(t,r,r.children);var i=ie(e),o=ae(r,i.props);if("render"===i.type)return i.render(o,t);var s=t;"as"===i.type&&i.as&&(t===X?o.as=i.as:s=i.as);var u=o.children;i.wrapChildren&&(u=i.wrapChildren(function(e){return Array.isArray(e)?1===e.length?e[0]:n.createElement.apply(n,[n.Fragment,{}].concat(e)):e}(u))),a&&(u=Z(u,!0));var l=q(s,o,u);return i.wrap&&(l=i.wrap(l)),l}var te=new Map;function re(e,t){var r,n=t["data-plasmic-override"],a=t["data-plasmic-wrap-flex-child"],i=null!=(r=t["data-plasmic-trigger-props"])?r:[];delete t["data-plasmic-override"],delete t["data-plasmic-wrap-flex-child"],delete t["data-plasmic-trigger-props"];for(var o=arguments.length,s=new Array(o>2?o-2:0),u=2;u<o;u++)s[u-2]=arguments[u];return ee(n,e,H.apply(void 0,[t,0===s.length?{}:{children:1===s.length?s[0]:s}].concat(i)),a)}var ne=Symbol("UNSET");function ae(e,t){if(!t)return e;for(var r=V({},e),n=0,a=Object.keys(t);n<a.length;n++){var i=a[n],o=e[i],s=t[i];s===ne?delete r[i]:(null!=s||"className"===i||"style"===i||i.startsWith("on")&&"function"==typeof o||(s=D),r[i]=z(i,o,s))}return r}function ie(e){if(!e)return{type:"default",props:{}};if(function(e){return"string"==typeof e||"number"==typeof e||n.isValidElement(e)}(e))return{type:"default",props:{children:e}};if("object"==typeof e)return"as"in e?V({},e,{props:e.props||{},type:"as"}):"render"in e?V({},e,{type:"render"}):"props"in e?V({},e,{props:e.props||{},type:"default"}):(t=Object.keys(e),r=["wrap","wrapChildren"],t.every((function(e){return r.includes(e)}))?V({},e,{props:{},type:"default"}):{type:"default",props:e});if("function"==typeof e)return{type:"render",render:e};var t,r;throw new Error("Unexpected override: "+e)}function oe(e,t){if(!t)return e;for(var r={},n=0,a=Array.from(new Set([].concat(Object.keys(e),Object.keys(t))));n<a.length;n++){var i=a[n];r[i]=se(e[i],t[i])}return r}function se(e,t){var r,n;if(!e)return t;if(!t)return e;var a=ie(e),i=ie(t),o=R.apply(void 0,[a.wrap,i.wrap].filter(T)),s=R.apply(void 0,[a.wrapChildren,i.wrapChildren].filter(T)),u=ae(null!=(r=a.props)?r:{},i.props);if("render"===i.type)return{render:i.render,props:u,wrap:o,wrapChildren:s};if("render"===a.type)return{render:a.render,props:u,wrap:o,wrapChildren:s};var l=null!=(n="as"===i.type?i.as:void 0)?n:"as"===a.type?a.as:void 0;return V({props:u,wrap:o,wrapChildren:s},l?{as:l}:{})}var ue=r.createContext(void 0),le=["PlasmicIconType"],ce=["src","className","displayWidth","displayHeight","displayMinWidth","displayMinHeight","displayMaxWidth","displayMaxHeight","quality","loader","imgRef","style","loading"],pe=[640,750,828,1080,1200,1920,2048,3840],de=[].concat([16,32,48,64,96,128,256,384],pe),fe=n.forwardRef((function(e,r){var a=e.src,i=e.className,o=e.displayWidth,s=e.displayHeight,u=e.displayMinWidth,l=e.displayMinHeight,c=e.displayMaxWidth,p=e.displayMaxHeight,d=e.quality,f=e.loader,v=e.imgRef,m=e.style,h=e.loading,g=k(e,ce),y=Object.assign({},g,{loading:null!=h?h:"lazy"}),b="string"!=typeof a&&a?a:{fullWidth:void 0,fullHeight:void 0,aspectRatio:void 0},P=b.fullWidth,w=b.fullHeight,S=b.aspectRatio,E=a?"string"==typeof a?a:"string"==typeof a.src?a.src:a.src.src:"";if(null==w||null==P)return n.createElement("img",Object.assign({src:E,className:i,style:m},y,{loading:h,ref:K(v,r)}));!me(E)||null!=s&&"auto"!==s||null!=o&&"auto"!==o||(o="100%");var x=o;P&&w&&(!o||"auto"===o)&&ge(s)&&(me(E)||(x=ge(s)*P/w));var C=P,O=w;S&&isFinite(S)&&me(E)&&(C=ve,O=Math.round(C/S));var I=function(e,t,r){var n=null==r?void 0:r.minWidth,a=ge(e),i=ge(n);if(null!=a&&(!n||null!=i))return{widthDescs:[{width:he(Math.max(a,null!=i?i:0),t),desc:"1x"},{width:he(2*Math.max(a,null!=i?i:0),t),desc:"2x"}],sizes:void 0};var o=pe.filter((function(e){return!t||e<t}));return t&&0===o.length?{widthDescs:[{width:he(t,t),desc:"1x"}],sizes:void 0}:{widthDescs:o.map((function(e){return{width:he(e,t),desc:e+"w"}})),sizes:"100vw"}}(x,P,{minWidth:u}),M=I.sizes,T=I.widthDescs,A=function(e){return null==e?void 0:"plasmic"===e?ye:e}(f),R='<svg width="'+C+'" height="'+O+'" xmlns="http://www.w3.org/2000/svg" version="1.1"/>',F="undefined"==typeof window?Buffer.from(R).toString("base64"):window.btoa(R),N=V({},m||{}),_=V({},j(m||{},"objectFit","objectPosition"));return null!=o&&"auto"!==o?_.width="100%":(_.width=o,N.width="auto",u&&(_.minWidth="100%"),null!=c&&"none"!==c&&(_.maxWidth="100%")),null!=s&&"auto"!==s?_.height="100%":(_.height=s,N.height="auto",l&&(_.minHeight="100%"),null!=p&&"none"!==p&&(_.maxHeight="100%")),n.createElement("div",{className:t(i,"__wab_img-wrapper"),ref:r,style:N},n.createElement("img",{alt:"","aria-hidden":!0,className:"__wab_img-spacer-svg",src:"data:image/svg+xml;base64,"+F,style:_}),function(e){var t=e.imageLoader,r=e.widthDescs,a=e.src,i=e.quality,o=e.style,s=e.className,u=e.sizes,l=e.imgProps,c=e.ref;return n.createElement("picture",{className:"__wab_picture"},t&&t.supportsUrl(a)&&n.createElement("source",{type:"image/webp",srcSet:r.map((function(e){return t.transformUrl({src:a,quality:i,width:e.width,format:"webp"})+" "+e.desc})).join(", ")}),n.createElement("img",Object.assign({},l,{ref:c,className:s,decoding:"async",src:t&&t.supportsUrl(a)?t.transformUrl({src:a,quality:i,width:r[r.length-1].width}):a,srcSet:t&&t.supportsUrl(a)?r.map((function(e){return t.transformUrl({src:a,quality:i,width:e.width})+" "+e.desc})).join(", "):void 0,sizes:t&&t.supportsUrl(a)?u:void 0,style:V({},o?j(o,"objectFit","objectPosition"):{},{width:0,height:0})})))}({imageLoader:A,widthDescs:T,sizes:M,src:E,quality:d,ref:v,style:m?j(m,"objectFit","objectPosition"):void 0,imgProps:y,className:"__wab_img"}))})),ve=1e4;function me(e){return e.endsWith(".svg")||e.startsWith("data:image/svg")}function he(e,t){var r,n=null!=(r=de.findIndex((function(t){return t>=e})))?r:de.length-1,a=de[n];if(!(a>=t||n+1<de.length&&t<=de[n+1]))return a}function ge(e){if(null!=e&&""!=e){if("number"==typeof e)return e;var t=function(e){var t=e.match(/^\s*(-?(?:\d+\.\d*|\d*\.\d+|\d+))\s*([a-z]*|%)\s*(?:\/\*.*)?$/i);if(null!=t)return{num:+t[1],units:t[2]}}(e);return!t||t.units&&"px"!==t.units?void 0:t.num}}var ye={supportsUrl:function(e){return e.startsWith("https://img.plasmic.app")&&!me(e)},transformUrl:function(e){var t,r=[e.width?"w="+e.width:void 0,"q="+(null!=(t=e.quality)?t:75),e.format?"f="+e.format:void 0].filter((function(e){return!!e}));return e.src+"?"+r.join("&")}},be=n.forwardRef((function(e,t){if("nextjs"===e.platform&&e.href){var r=["href","replace","scroll","shallow","passHref","prefetch","locale"];return n.createElement(e.component,V({},j.apply(void 0,[e].concat(r)),{legacyBehavior:!0}),n.createElement("a",Object.assign({},A.apply(void 0,[e,"component","platform"].concat(r)),{ref:t})))}return"gatsby"===e.platform&&/^\/(?!\/)/.test(e.href)?n.createElement(e.component,V({},A(e,"component","platform","href"),{to:e.href,ref:t})):n.createElement("a",Object.assign({},A(e,"component","platform"),{ref:t}))})),Pe=n.createContext(void 0);function we(e){var t={},r=0;return{str:function e(a){if(!a)return"";if("number"==typeof a||"boolean"==typeof a||"string"==typeof a)return a.toString();if("object"!=typeof a)return"";if(Array.isArray(a)||null!=(i=a)&&"function"==typeof i[Symbol.iterator])return Array.from(a).map((function(t){return e(t)})).filter((function(e){return!!e})).join("");var i,o=xe(a,"props")&&xe(a.props,"children")&&a.props.children||xe(a,"children")&&a.children||[],s=""+n.Children.toArray(o).map((function(t){return e(t)})).filter((function(e){return!!e})).join("");if(n.isValidElement(a)&&a.type===n.Fragment)return s;var u=r+1;return r++,t[u]=n.isValidElement(a)?n.cloneElement(a,{key:u,children:void 0}):a,"<"+u+">"+s+"</"+u+">"}(e),components:t,componentsCount:r}}function Se(e){var t=e.transKey,r=e.children,a=n.useContext(Pe);if(!a)return Ee||(console.warn("Using Plasmic Translation but no translation function has been provided"),Ee=!0),r;var i=we(r);return a(null!=t?t:i.str,i.componentsCount>0?{components:i.components}:void 0)}var Ee=!1;function xe(e,t){return"object"==typeof e&&null!==e&&t in e}var Ce=["as","defaultContents","value"];function Oe(e){var t=e.as,n=e.defaultContents,a=e.value,i=k(e,Ce),o=void 0===a?n:a;if(!o||Array.isArray(o)&&0===o.length)return null;var s=function e(t){return!r.isValidElement(t)||t.type!==r.Fragment&&t.type!==Se?"string"==typeof t?t:Array.isArray(t)&&1===t.length&&"string"==typeof t[0]?t[0]:void 0:e(t.props.children)}(o);return s&&(o=r.createElement("span",{className:"__wab_slot-string-wrapper"},s)),0===Object.keys(i).filter((function(e){return!!i[e]})).length?r.createElement(r.Fragment,null,o):r.createElement(t||"span",H({className:"__wab_slot"},i),o)}var Ve=[],ke={};function Ie(){return _?Object.entries(ke).filter((function(e){return window.matchMedia(e[1]).matches})).map((function(e){return e[0]})):[]}var Me=void 0;_&&window.addEventListener("resize",(function(){var e=Ie();Me&&e.join("")===Me.join("")||(Me=e,o.unstable_batchedUpdates((function(){return Ve.forEach((function(e){return e()}))})))}));var Te=r.createContext(void 0),je=u.useIsSSR;function Ae(){r.useContext(Te)}var Re={useHover:function(){var e=r.useState(!1),t=e[1];return[e[0],{onMouseEnter:function(){return t(!0)},onMouseLeave:function(){return t(!1)}}]},useFocused:function(e){var t=l.useFocusRing({within:!1,isTextInput:e.isTextInput});return[t.isFocused,t.focusProps]},useFocusVisible:function(e){var t=l.useFocusRing({within:!1,isTextInput:e.isTextInput});return[t.isFocusVisible,t.focusProps]},useFocusedWithin:function(e){var t=l.useFocusRing({within:!0,isTextInput:e.isTextInput});return[t.isFocused,t.focusProps]},useFocusVisibleWithin:function(e){var t=l.useFocusRing({within:!0,isTextInput:e.isTextInput});return[t.isFocusVisible,t.focusProps]},usePressed:function(){var e=r.useState(!1),t=e[1];return[e[0],{onMouseDown:function(){return t(!0)},onMouseUp:function(){return t(!1)}}]}},Fe="undefined"!=typeof window?r.useLayoutEffect:r.useEffect;function Ne(e,t,r){for(var n,a,i=0,o=(t=t.split?t.split("."):t).length,s=e;i<o&&"__proto__"!==(a=t[i++])&&"constructor"!==a&&"prototype"!==a;)u=s,l=a,c=i===o?r:typeof(n=s[a])==typeof t?n:0*t[i]!=0||~(""+t[i]).indexOf(".")?{}:[],p=u[l],Object.prototype.hasOwnProperty.call(u,l)&&function(e,t){return e===t||e!=e&&t!=t}(p,c)&&(void 0!==c||l in u)||function(e,t,r){"__proto__"==t?Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}(u,l,c),s=s[a];var u,l,c,p}var _e=Symbol("[]"),De=Symbol("plasmic.unitialized"),We=function(){function e(e){this.specs=e,this.edges=new Map,this.state={}}var t=e.prototype;return t.hasEdge=function(e){return this.edges.has(e)},t.addEdge=function(e,t){this.edges.set(e,t)},t.children=function(){return this.edges.values()},t.makeTransition=function(e){var t;return e="symbol"==typeof(t=e)||isNaN(+t)?e:_e,this.edges.get(e)},t.isLeaf=function(){return 0===this.edges.size},t.hasArrayTransition=function(){return this.edges.has(_e)},t.getSpec=function(){return this.specs[0]},t.getAllSpecs=function(){return this.specs},t.getState=function(e){return this.state[JSON.stringify(e)]},t.clearStates=function(){this.state={}},t.states=function(){return Object.values(this.state)},t.hasState=function(e){return JSON.stringify(e)in this.state},t.createStateCell=function(e){var t=JSON.stringify(e);this.state[t]={listeners:[],initialValue:De,registeredInitFunc:this.getSpec().initFunc,path:e}},t.setInitialValue=function(e,t){var r=JSON.stringify(e);this.state[r].initialValue=t},t.getInitialValue=function(e){var t=JSON.stringify(e);return this.state[t].initialValue},t.addListener=function(e,t){var r=JSON.stringify(e);this.state[r].listeners.push(t)},e}(),qe=function(e){return e.split(".").flatMap((function e(t){return t.endsWith("[]")?[].concat(e(t.slice(0,-2)),[_e]):[t]}))};function Le(e){return"symbol"!=typeof e&&!isNaN(+e)}function He(e,t,r,n){var i=new Set,o=Ue(e,(function(t,r){return{get:function(){i.add({path:r,node:t});var o=t.getSpec();return o.valueProp?e.props[o.valueProp]:!t.hasState(r)&&o.initFunc?He(e,t,r,n):a(n,r)},set:function(){throw new Error("Cannot update state values during initialization")}}}));i.forEach((function(a){a.node.addListener(a.path,(function(){var a=t.getSpec().initFunc(e.props,o,e.ctx);Ne(n,r,a)}))}));var s=t.getState(r).registeredInitFunc(e.props,o,e.ctx);t.setInitialValue(r,c(s));var u,l,p=t.getSpec(),d=p.isImmutable?Ke(s):c(s);return Ne(n,r,d),p.onChangeProp&&(null==(u=(l=e.props)[p.onChangeProp])||u.call(l,s)),s}function Ue(e,t){return function r(n,i,o,s,u){var l=function(e){return[].concat(n,[Le(e)?+e:e])},c=i.getSpec(),p={deleteProperty:function(t,r){if(!(o||i.isLeaf()||i.hasArrayTransition()||Le(r)))throw new Error("Can't delete a property in the middle of the state spec");var s,u;return delete a(e.stateValues,n)[r],c.onChangeProp&&(null==(s=(u=e.props)[c.onChangeProp])||s.call(u,a(e.stateValues,n.slice(c.pathObj.length)))),Reflect.deleteProperty(t,r)},get:function(e,n,a){s=null==s?a:s;var u=l(n);if(o||i.isLeaf())return Reflect.get(e,n,a);var c,p,d=i.makeTransition(n);return null!=d&&d.isLeaf()?null==(c=(p=t(d,u,s)).get)?void 0:c.call(p,e,n,a):(d&&!(n in e)&&(e[n]=r(u,d,!1,s,void 0)),Reflect.get(e,n,a))},set:function(a,u,c,p){var d,f;s=null==s?p:s;var v,m,h=l(u),g=i.makeTransition(u);if("registerInitFunc"===u&&0===n.length)return Reflect.set(a,u,c,p);if(!g&&i.hasArrayTransition())return Ne(e.stateValues,h,c),Reflect.set(a,u,c,p);if(null!=(d=g)&&d.isLeaf()&&(null==(v=(m=t(g,h,s)).set)||v.call(m,a,u,c,p)),!o&&!i.isLeaf()&&!g)return!1;if(g||(function(e,t){if(void 0===t&&(t="Assertion failed"),!e)throw t=("string"==typeof t?t:t())||"Assertion failed",new Error(t)}(o||i.isLeaf,"unexpected update in nextNode"),g=i),function(e){return"object"==typeof e&&null!=e}(c))a[u]=r(h,g,o||i.isLeaf(),s,c);else{if(!(o||i.isLeaf()||null!=(f=g)&&f.isLeaf()))throw new Error("inserting a primitive value into a non-leaf");Reflect.set(a,u,c,p)}g.getAllSpecs().forEach((function(t){var r,n;t.onChangeProp&&(null==(r=(n=e.props)[t.onChangeProp])||r.call(n,c))}));var y=(o||i.isLeaf())&&i.getSpec().isImmutable?Ke(c):c;return Ne(e.stateValues,h,y),!0}},d=o||i.isLeaf()?Array.isArray(u)?[]:Object.create(Object.getPrototypeOf(u)):i.hasArrayTransition()?[]:{},f=new Proxy(d,p);return u&&Reflect.ownKeys(u).forEach((function(e){var t=Object.getOwnPropertyDescriptor(u,e);t.get||t.set?Object.defineProperty(d,e,t):f[e]=u[e]})),f}([],e.rootSpecTree,!1,void 0,void 0)}var Ke=function(e){return null!=e&&"object"==typeof e?d.ref(e):e},ze=t,Ge=!0;function Be(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=t.filter((function(e){return!!e.def})),a=F(n,(function(e){return e.def.group}));return N(a,(function(e){return Object.fromEntries(e.map((function(e){return[e.def.variant,!!e.active]})))}))}function Je(e){if(r.isValidElement(e)){var t=e.type;return t.__plumeType||(null==t.getPlumeType?void 0:t.getPlumeType(e.props))}}var Ye=["link","isDisabled","startIcon","endIcon","showStartIcon","showEndIcon","children"];function Qe(e){return j(e,"className","style")}function $e(e,t){return{plasmicProps:{variants:j.apply(void 0,[t].concat(e.internalVariantProps)),args:j.apply(void 0,[t].concat(e.internalArgProps)),overrides:{}}}}var Xe=/^(data-.*)$/;function Ze(e,t){var r=t.itemPlumeType,a=t.sectionPlumeType,i=t.invalidChildError,o=t.requireItemValue;return n.useMemo((function(){return function(e,t){if(!e)return{items:[],disabledKeys:[]};var r=t.itemPlumeType,a=t.sectionPlumeType,i=t.invalidChildError,o=0,s=0,u=[];return{items:function e(l){return L(l).flatMap((function(l){if(n.isValidElement(l)){if(l.type===n.Fragment)return e(l.props.children);var c,p=Je(l);if(p===r){var d=rt(l=function(e){if(at(e,"value"))return o++,e;if(t.requireItemValue&&Ge)throw new Error('Must specify a "value" prop for '+function(e){if("string"==typeof e.type)return e.type;var t,r,n,a,i=e.type;return null!=(t=null!=(r=null!=(n=i.displayName)?n:i.name)?r:null==(a=i.render)?void 0:a.name)?t:"Component"}(e));return it(e,{value:""+o++})}(l));return nt(l,"isDisabled")&&d&&u.push(d),[l]}if(p===a)return[it(l,{key:null!=(c=l.key)?c:"section-"+s++,children:e(nt(l,"children"))})]}if(Ge)throw new Error(null!=i?i:"Unexpected child");return[]}))}(e),disabledKeys:u}}(e,{itemPlumeType:r,sectionPlumeType:a,invalidChildError:i,requireItemValue:o})}),[e,r,a,i,o])}function et(e){return it(e.rendered,{_node:e,key:e.key})}function tt(e,t){if(Je(e)===t.itemPlumeType){var r,a=e,i=nt(a,"children");return n.createElement(y.Item,{key:rt(a),textValue:null!=(r=nt(a,"textValue"))?r:(o=i,"string"==typeof o?i:at(a,"value")?nt(a,"value"):a.key),"aria-label":nt(a,"aria-label")},a)}var o,s=e;return n.createElement(y.Section,{title:s,"aria-label":nt(s,"aria-label"),items:nt(s,"children")},(function(e){return tt(e,t)}))}function rt(e){var t;return null!=(t=nt(e,"value"))?t:e.key}function nt(e,t){return"componentProps"in e.props?e.props.componentProps[t]:e.props[t]}function at(e,t){return"componentProps"in e.props?t in e.props.componentProps:t in e.props}function it(e,t){return n.cloneElement(e,e.type.getPlumeType?V({componentProps:V({},e.props.componentProps,t)},t.key?{key:t.key}:{}):t)}var ot=r.createContext(void 0),st=r.createContext(void 0),ut=["children"],lt={itemPlumeType:"menu-item",sectionPlumeType:"menu-group"};function ct(e,t){var n=e.triggerRef,a=e.isDisabled,i=e.placement,o=e.menuMatchTriggerWidth,s=e.menuWidth,u=e.menu,l=h.useMenuTrigger({type:"menu",isDisabled:a},t,n),c=l.menuProps;return{triggerProps:w.usePress(V({},l.menuTriggerProps,{isDisabled:a})).pressProps,makeMenu:function(){var e="function"==typeof u?u():u;if(!e)return null;if("menu"!==Je(e)){if(Ge)throw new Error("Must use an instance of the Menu component.");return null}return r.cloneElement(e,H(e.props,c))},triggerContext:r.useMemo((function(){var e;return{triggerRef:n,state:t,autoFocus:null==(e=t.focusStrategy)||e,placement:i,overlayMatchTriggerWidth:o,overlayMinTriggerWidth:!0,overlayWidth:s}}),[n,t,i,o,s])}}var pt=r.createContext(void 0),dt=["value","defaultValue","children","onChange","placement","menuMatchTriggerWidth","menuWidth"],ft={itemPlumeType:"select-option",sectionPlumeType:"select-option-group"};function vt(e){var t=e.state,n=e.menuProps,a=e.children,i=r.useRef(null),o=E.useListBox(V({},n,{isVirtualized:!1,autoFocus:t.focusStrategy||!0,disallowEmptySelection:!0}),t,i);return r.cloneElement(a,H(a.props,o.listBoxProps,{style:{outline:"none"},ref:i}))}var mt=["isDisabled","startIcon","endIcon","showStartIcon","showEndIcon","className","style","inputClassName","inputStyle"];exports.get=a,Object.defineProperty(exports,"PlasmicDataSourceContextProvider",{enumerable:!0,get:function(){return s.PlasmicDataSourceContextProvider}}),Object.defineProperty(exports,"useCurrentUser",{enumerable:!0,get:function(){return s.useCurrentUser}}),exports.DropdownMenu=function(e){var t=e.isOpen,n=e.defaultOpen,a=e.onOpenChange,i=e.children,o=e.placement,s=e.menu,u=r.useRef(null),l=P.useMenuTriggerState({isOpen:t,defaultOpen:n,onOpenChange:a,shouldFlip:!0}),c=ct({triggerRef:u,placement:o,menu:s},l),p=c.makeMenu;return r.createElement(ot.Provider,{value:c.triggerContext},r.cloneElement(i,H(i.props,c.triggerProps,{ref:u})),l.isOpen&&p())},exports.PlasmicHead=function(e){var t=r.useContext(ue);return t?r.createElement(t,null,e.image?[r.createElement("meta",{key:"twitter:card",name:"twitter:card",content:"summary_large_image"}),r.createElement("meta",{key:"og:image",property:"og:image",content:e.image}),r.createElement("meta",{key:"twitter:image",name:"twitter:image",content:e.image})]:r.createElement("meta",{key:"twitter:card",name:"twitter:card",content:"summary"}),e.title&&[r.createElement("title",{key:"title"},e.title),r.createElement("meta",{key:"og:title",property:"og:title",content:e.title}),r.createElement("meta",{key:"twitter:title",property:"twitter:title",content:e.title})],e.description&&[r.createElement("meta",{key:"description",name:"description",content:e.description}),r.createElement("meta",{key:"og:description",property:"og:description",content:e.description}),r.createElement("meta",{key:"twitter:description",name:"twitter:description",content:e.description})],e.canonical&&r.createElement("link",{key:"canonical",ref:"canonical",href:e.canonical})):(console.warn("Plasmic: Head meta tags are being ignored. To make them work, pass a Head component into PlasmicRootProvider."),null)},exports.PlasmicIcon=function(e){var t=e.PlasmicIconType,n=k(e,le);return r.createElement(t,Object.assign({},n))},exports.PlasmicImg=fe,exports.PlasmicLink=be,exports.PlasmicPageGuard=function(e){var t=e.children,r=e.dataSourceCtxValue;return!r||r.isUserLoading?null:r&&r.user&&"roleId"in r.user&&e.validRoles.includes(r.user.roleId)?t:n.createElement("div",null,"You don't have access to this page")},exports.PlasmicRootProvider=function(e){var t=e.platform,n=e.children,a=e.userAuthToken,i=e.isUserLoading,o=e.user,l=r.useMemo((function(){return{platform:t}}),[t]),c=r.useMemo((function(){return{userAuthToken:a,user:o,isUserLoading:i}}),[a,i,o]);return r.createElement(Te.Provider,{value:l},r.createElement(u.SSRProvider,null,r.createElement(s.PlasmicDataSourceContextProvider,{value:c},r.createElement(Pe.Provider,{value:e.translator},r.createElement(ue.Provider,{value:e.Head},n)))))},exports.PlasmicSlot=function(e){return Oe(e)},exports.SelectContext=pt,exports.Stack=X,exports.Trans=Se,exports.TriggeredOverlayContext=ot,exports.classNames=ze,exports.createPlasmicElementProxy=function(e,t){null==t&&(t={});var r=t["data-plasmic-name"],n=t["data-plasmic-root"],a=t["data-plasmic-for-node"];delete t["data-plasmic-name"],delete t["data-plasmic-root"],delete t["data-plasmic-for-node"];for(var i=arguments.length,o=new Array(i>2?i-2:0),s=2;s<i;s++)o[s-2]=arguments[s];var u=re.apply(void 0,[e,t].concat(o));if(r&&te.set(r,u),n){var l,c=a?null!=(l=te.get(a))?l:null:u;return te.clear(),c}return u},exports.createUseScreenVariants=function(e,t){return Object.assign(ke,t),Me=void 0,function(){var t=r.useState()[1],n=r.useRef(Me||[]);return W((function(){var e=function(){Me&&n.current.join("")!==Me.join("")&&(n.current=Me,t({}))};return Ve.push(e),void 0===Me&&(Me=Ie()),e(),function(){Ve.splice(Ve.indexOf(e),1)}}),[]),e?Me||[]:Me?Me[Me.length-1]:void 0}},exports.deriveRenderOpts=function(e,t){var r,n,a,i,o,s=t.name,u=t.descendantNames,l=t.internalVariantPropNames,c=t.internalArgPropNames,p=["variants","args","overrides"],d=(r=A.apply(void 0,[j.apply(void 0,[e].concat(l))].concat(p)),n=e.variants,r&&n?V({},r,n):r||n||{}),f=(a=A.apply(void 0,[j.apply(void 0,[e].concat(c))].concat(p)),i=e.args,a&&i?V({},a,i):a||i||{}),v=oe(A.apply(void 0,[j.apply(void 0,[e].concat(u))].concat(c,l,p)),e.overrides),m=A.apply(void 0,[e,"variants","args","overrides"].concat(u,l,c));return Object.keys(m).length>0&&(v=oe(v,((o={})[s]={props:m},o))),{variants:d,args:f,overrides:v}},exports.ensureGlobalVariants=function(e){return Object.entries(e).filter((function(e){return"PLEASE_RENDER_INSIDE_PROVIDER"===e[1]})).forEach((function(t){e[t[0]]=void 0})),e},exports.genTranslatableString=we,exports.generateStateOnChangeProp=function(e,t,r){return function(n,a){return Ne(e,[t].concat(r,a),n)}},exports.generateStateValueProp=function(e,t){return a(e,t)},exports.getDataProps=function(e){return function(e,t){for(var r={},n=0,a=Object.entries(e);n<a.length;n++){var i=a[n][0];Xe.test(i)&&(r[i]=e[i])}return r}(e)},exports.hasVariant=function(e,t,r){if(null==e)return!1;var n=e[t];return null!=n&&(!0===n?r===t:!1!==n&&(Array.isArray(n)?n.includes(r):"string"==typeof n?n===r:void 0!==n[r]&&!1!==n[r]))},exports.makeFragment=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return r.createElement.apply(r,[r.Fragment,{}].concat(t))},exports.mergeVariantsWithStates=function(e,t,r){return V({},e,Object.fromEntries(r.map((function(e){return[e.variantGroup,a(t,e.statePath)]}))))},exports.omit=A,exports.pick=j,exports.plasmicHeadMeta={name:"hostless-plasmic-head",displayName:"Head",description:"Used to add page metadata to HTML <head />.",importName:"PlasmicHead",importPath:"@plasmicapp/react-web",isRepeatable:!1,styleSections:!1,props:{title:{type:"string",displayName:"Title"},description:{type:"string",displayName:"Description"},image:{type:"imageUrl",displayName:"Image"},canonical:{type:"string",displayName:"Canonical URL"}}},exports.renderPlasmicSlot=Oe,exports.set=Ne,exports.setPlumeStrictMode=function(e){Ge=e},exports.useButton=function(e,t,r,n){var a,i,o,s;void 0===n&&(n=null);var u=t.link,l=t.isDisabled,c=t.startIcon,p=t.endIcon,d=t.showStartIcon,f=t.showEndIcon,v=t.children,m=k(t,Ye);return{plasmicProps:{variants:V({},j.apply(void 0,[t].concat(e.internalVariantProps)),Be({def:r.showStartIconVariant,active:d},{def:r.showEndIconVariant,active:f},{def:r.isDisabledVariant,active:l})),args:V({},j.apply(void 0,[t].concat(e.internalArgProps)),r.startIconSlot&&((a={})[r.startIconSlot]=c,a),r.endIconSlot&&((i={})[r.endIconSlot]=p,i),((o={})[r.contentSlot]=v,o)),overrides:((s={})[r.root]={as:u?"a":"button",props:V({},A.apply(void 0,[m].concat(e.internalArgProps,e.internalVariantProps)),{ref:n,disabled:l},!!u&&{href:u})},s)}}},exports.useCheckbox=function(e,t,n,a){var i,o;void 0===a&&(a=null);var s=t.children,u=t.isDisabled,l=t.isIndeterminate;Ae();var c=r.useRef(null),p=r.useRef(null),d=function(e){var t=V({},e,{isSelected:e.isChecked,defaultSelected:e.defaultChecked});return delete t.isChecked,delete t.defaultChecked,t}(t),h=m.useToggleState(d),g=f.useCheckbox(d,h,c).inputProps,y=V({},j.apply(void 0,[t].concat(e.internalVariantProps)),Be({def:n.isDisabledVariant,active:u},{def:n.isCheckedVariant,active:h.isSelected},{def:n.isIndeterminateVariant,active:l},{def:n.noLabelVariant,active:!s})),b=((i={})[n.root]={as:"label",props:H(Qe(t),{ref:p}),wrapChildren:function(e){return r.createElement(r.Fragment,null,r.createElement(v.VisuallyHidden,null,r.createElement("input",Object.assign({},g,{ref:c}))),e)}},i),P=V({},j.apply(void 0,[t].concat(e.internalArgProps)),n.labelSlot?((o={})[n.labelSlot]=s,o):{}),w=r.useMemo((function(){return{setChecked:function(e){return h.setSelected(e)}}}),[h]);return r.useImperativeHandle(a,(function(){return{getRoot:function(){return p.current},focus:function(){var e;return null==(e=c.current)?void 0:e.focus()},blur:function(){var e;return null==(e=c.current)?void 0:e.blur()},setChecked:function(e){return w.setChecked(e)}}}),[p,c,w]),{plasmicProps:{variants:y,overrides:b,args:P},state:w}},exports.useDollarState=function(e,t,r){var a,i,o,s=n.useRef((o=function(e){var t=e.map((function(e){return V({},e,{pathObj:qe(e.path),isRepeated:e.path.split(".").some((function(e){return e.endsWith("[]")}))})}));return function e(r){var n=new We(t.filter((function(e){return function(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}(r,e.pathObj.slice(0,r.length))})));return n.getAllSpecs().forEach((function(t){if(t.pathObj.length>r.length){var a=t.pathObj[r.length];n.hasEdge(a)||n.addEdge(a,e([].concat(r,[a])))}})),n}([])}(e),{rootSpecTree:o,specTreeLeaves:(a=o,i=[],function e(t){for(var r,n=M(t.children());!(r=n()).done;)e(r.value);t.isLeaf()&&i.push(t)}(a),i),stateValues:d.proxy({}),props:{},ctx:{},registrationsQueue:[]})).current;s.props=t,s.ctx=null!=r?r:{};var u,l=n.useRef((u=Object.assign(Ue(s,(function(e,t,r){if(!e.hasState(t)){e.createStateCell(t);var n=e.getSpec();n.initFunc?He(s,e,t,r):n.valueProp||Ne(r,t,n.initVal)}return{get:function(t,r,n){var a=e.getSpec();return a.valueProp?s.props[a.valueProp]:Reflect.get(t,r,n)}}})),{registerInitFunc:function(e,t,r){var n=function(e,t,r){for(var n,a=[],i=0,o=M(qe(t));!(n=o()).done;){var s=n.value;if("symbol"==typeof s){if(!e.hasArrayTransition()||!r||i>r.length)throw console.log(e),new Error("transition not found: pathStr "+t+" part "+("symbol"==typeof s?"[]":s));a.push(r[i++]),e=e.makeTransition(_e)}else{if(!e.hasEdge(s))throw new Error("transition not found: pathStr "+t+" part "+("symbol"==typeof s?"[]":s));a.push(s),e=e.makeTransition(s)}}return{node:e,realPath:a}}(s.rootSpecTree,e,r),a=n.node,i=n.realPath;a.hasState(i)||a.createStateCell(i),p(a.getState(i).initialValue,t(s.props,u,s.ctx))||s.registrationsQueue.push({node:a,path:i,f:t})}}),u)).current,c=[];s.specTreeLeaves.flatMap((function(e){return e.states().map((function(t){return{stateCell:t,node:e}}))})).forEach((function(e){var n=e.stateCell,a=e.node;if(n.registeredInitFunc){var i=n.registeredInitFunc(t,l,null!=r?r:{});p(i,n.initialValue)||c.push({stateCell:n,node:a})}}));var f=function(e,t){var r,n,a=He(s,e,t.path,l),i=e.getSpec();i.onChangeProp&&(null==(r=(n=s.props)[i.onChangeProp])||r.call(n,a))};return Fe((function(){c.forEach((function(e){f(e.node,e.stateCell)}))}),[t,c]),Fe((function(){s.registrationsQueue.forEach((function(e){var t=e.node,r=e.f,n=t.getState(e.path);n.registeredInitFunc=r,f(t,n)})),s.registrationsQueue=[]}),[s.registrationsQueue]),Fe((function(){s.specTreeLeaves.forEach((function(e){var t=e.getSpec();!t.isRepeated&&"private"!==t.type&&t.initFunc&&(e.createStateCell(t.pathObj),He(s,e,t.pathObj,l))}))}),[]),d.useSnapshot(s.stateValues,{sync:!0}),l},exports.useIsSSR=je,exports.useMenu=function(e,t,n,a){var i,o;void 0===a&&(a=null),Ae();var s=function(e){var t=e.children,n=k(e,ut),a=Ze(t,V({},lt,{invalidChildError:"Can only use Menu.Item and Menu.Group as children to Menu",requireItemValue:!1})),i=a.items,o=a.disabledKeys;return{ariaProps:V({},n,{children:r.useCallback((function(e){return tt(e,lt)}),[]),items:i,disabledKeys:o})}}(t).ariaProps,u=r.useContext(ot),l=r.useRef(null),c=g.useTreeState(s),p=r.useRef(null),d=h.useMenu(V({},s,{autoFocus:null==u?void 0:u.autoFocus}),c,p).menuProps,f=r.useMemo((function(){return{state:c,menuProps:t}}),[c,t]),v=V({},j.apply(void 0,[t].concat(e.internalVariantProps))),m=((i={})[n.root]={props:H(Qe(t),{ref:l})},i[n.itemsContainer]={as:"ul",props:H(d,{ref:p,style:V({},{outline:"none"})})},i),y=V({},j.apply(void 0,[t].concat(e.internalArgProps)),((o={})[n.itemsSlot]=r.createElement(st.Provider,{value:f},Array.from(c.collection).map((function(e){return et(e)}))),o)),b=r.useMemo((function(){return{getFocusedValue:function(){return c.selectionManager.focusedKey},setFocusedValue:function(e){return c.selectionManager.setFocusedKey(e)}}}),[c]);return r.useImperativeHandle(a,(function(){return{getRoot:function(){return l.current},getFocusedValue:function(){return b.getFocusedValue()},setFocusedValue:function(e){return b.setFocusedValue(e)}}}),[l,b]),{plasmicProps:{variants:v,args:y,overrides:m},state:b}},exports.useMenuButton=function(e,t,n,a){var i,o;void 0===a&&(a=null);var s=t.placement,u=t.isOpen,c=t.defaultOpen,p=t.onOpenChange,d=t.isDisabled,f=t.menu,v=t.autoFocus,m=t.menuMatchTriggerWidth,h=t.menuWidth;Ae();var g=r.useRef(null),y=r.useRef(null),b=P.useMenuTriggerState({isOpen:u,defaultOpen:c,onOpenChange:p,shouldFlip:!0}),w=ct({isDisabled:d,triggerRef:y,placement:s,menuMatchTriggerWidth:m,menuWidth:h,menu:f},b),S=w.triggerProps,E=w.makeMenu,x=w.triggerContext,C=l.useFocusable(t,y).focusableProps,O=V({},j.apply(void 0,[t].concat(e.internalVariantProps)),Be({def:n.isOpenVariant,active:b.isOpen},{def:n.isDisabledVariant,active:d})),k=V({},j.apply(void 0,[t].concat(e.internalArgProps)),((i={})[n.menuSlot]=b.isOpen?E():void 0,i)),I=((o={})[n.root]={wrapChildren:function(e){return r.createElement(ot.Provider,{value:x},e)},props:{ref:g}},o[n.trigger]={props:H(S,C,Qe(t),j(t,"title"),{ref:y,autoFocus:v,disabled:!!d,type:"button"})},o),M=r.useMemo((function(){return{open:function(){return b.open()},close:function(){return b.close()},isOpen:function(){return b.isOpen}}}),[b]);return r.useImperativeHandle(a,(function(){return{getRoot:function(){return g.current},getTrigger:function(){return y.current},focus:function(){return y.current&&y.current.focus()},blur:function(){return y.current&&y.current.blur()},open:M.open,close:M.close,isOpen:M.isOpen}}),[g,y,M]),{plasmicProps:{variants:O,args:k,overrides:I},state:M}},exports.useMenuGroup=function(e,t,n){var a,i,o=r.useContext(st),s=t._node;if(!o||!s){if(Ge)throw new Error("You can only use a Menu.Group within a Menu component.");return $e(e,t)}var u=h.useMenuSection({heading:t.title,"aria-label":t["aria-label"]}),l=u.headingProps,c=u.groupProps,p=b.useSeparator({elementType:"li"}).separatorProps;return{plasmicProps:{variants:V({},j.apply(void 0,[t].concat(e.internalVariantProps)),Be({def:n.noTitleVariant,active:!t.title},{def:n.isFirstVariant,active:o.state.collection.getFirstKey()===s.key})),args:V({},j.apply(void 0,[t].concat(e.internalArgProps)),((a={})[n.titleSlot]=t.title,a[n.itemsSlot]=Array.from(s.childNodes).map((function(e){return et(e)})),a)),overrides:((i={})[n.root]={props:Qe(t)},i[n.separator]={props:V({},p),as:"li"},i[n.titleContainer]=V({props:V({role:"presentation"},l)},!t.title&&{render:function(){return null}}),i[n.itemsContainer]={props:V({},c),as:"ul"},i)}}},exports.useMenuItem=function(e,t,n){var a,i,o=r.useContext(st),s=r.useContext(ot);if(!o){if(Ge)throw new Error("You can only use a Menu.Item within a Menu component.");return $e(e,t)}var u=t.children,l=t.onAction,c=o.state,p=o.menuProps,d=t._node,f=c.disabledKeys.has(d.key),v=c.selectionManager.isFocused&&c.selectionManager.focusedKey===d.key,m=r.useRef(null),g=h.useMenuItem(H({onAction:l},{onAction:p.onAction,onClose:null==s?void 0:s.state.close},{isDisabled:f,"aria-label":d&&d["aria-label"],key:d.key,isVirtualized:!1,closeOnSelect:!0}),c,m),y=g.menuItemProps,b=g.labelProps;return{plasmicProps:{variants:V({},j.apply(void 0,[t].concat(e.internalVariantProps)),Be({def:n.isDisabledVariant,active:f},{def:n.isHighlightedVariant,active:v})),args:V({},j.apply(void 0,[t].concat(e.internalArgProps)),((a={})[n.labelSlot]=u,a)),overrides:((i={})[n.root]={as:"li",props:H(y,{ref:m,style:{outline:"none"}})},i[n.labelContainer]={props:V({},b)},i)}}},exports.useSelect=function(e,t,n,a){var i,o;void 0===a&&(a=null),Ae();var s=function(e){var t=e.value,n=e.defaultValue,a=e.children,i=e.onChange,o=k(e,dt),s=Ze(a,V({},ft,{invalidChildError:"Can only use Select.Option and Select.OptionGroup as children to Select",requireItemValue:!0})),u=s.items,l=s.disabledKeys;return{ariaProps:V({},o,{children:r.useCallback((function(e){return tt(e,ft)}),[]),onSelectionChange:r.useMemo((function(){return i?function(e){return i(null==e||"null"===e?null:e)}:void 0}),[i]),items:u,disabledKeys:l,defaultSelectedKey:n},"value"in e&&{selectedKey:null!=t?t:null})}}(t).ariaProps,u=t.placement,l=x.useSelectState(s),c=r.useRef(null),p=r.useRef(null),d=t.isDisabled,f=t.name,v=t.menuWidth,m=t.menuMatchTriggerWidth,h=t.autoFocus,g=t.placeholder,y=t.selectedContent,b=S.useSelect(s,l,c),P=b.menuProps,E=w.usePress(V({},b.triggerProps,{isDisabled:d})).pressProps,C=l.selectedItem?null!=y?y:nt(l.selectedItem.value,"children"):null,O=V({},j.apply(void 0,[t].concat(e.internalVariantProps)),Be({def:n.isOpenVariant,active:l.isOpen},{def:n.placeholderVariant,active:!l.selectedItem},{def:n.isDisabledVariant,active:d})),I=r.useMemo((function(){return{triggerRef:c,state:l,placement:u,overlayMatchTriggerWidth:m,overlayMinTriggerWidth:!0,overlayWidth:v}}),[c,l,u,m,v]),M=((i={})[n.root]={props:H(Qe(t),{ref:p}),wrapChildren:function(e){return r.createElement(r.Fragment,null,r.createElement(S.HiddenSelect,{state:l,triggerRef:c,name:f,isDisabled:d}),e)}},i[n.trigger]={props:H(E,{ref:c,autoFocus:h,disabled:!!d,type:"button"})},i[n.overlay]={wrap:function(e){return r.createElement(ot.Provider,{value:I},e)}},i[n.optionsContainer]={wrap:function(e){return r.createElement(vt,{state:l,menuProps:P},e)}},i),T=V({},j.apply(void 0,[t].concat(e.internalArgProps)),((o={})[n.triggerContentSlot]=C,o[n.placeholderSlot]=g,o[n.optionsSlot]=r.createElement(pt.Provider,{value:l},Array.from(l.collection).map((function(e){return et(e)}))),o)),A=r.useMemo((function(){return{open:function(){return l.open()},close:function(){return l.close()},isOpen:function(){return l.isOpen},getSelectedValue:function(){return l.selectedKey?""+l.selectedKey:null},setSelectedValue:function(e){return l.setSelectedKey(e)}}}),[l]);return r.useImperativeHandle(a,(function(){return{getRoot:function(){return p.current},getTrigger:function(){return c.current},focus:function(){var e;return null==(e=c.current)?void 0:e.focus()},blur:function(){var e;return null==(e=c.current)?void 0:e.blur()},open:function(){return A.open()},close:function(){return A.close()},isOpen:function(){return A.isOpen()},getSelectedValue:function(){return A.getSelectedValue()},setSelectedValue:function(e){return A.setSelectedValue(e)}}}),[p,c,A]),{plasmicProps:{variants:O,args:T,overrides:M},state:A}},exports.useSelectOption=function(e,t,n,a){var i,o;void 0===a&&(a=null);var s=r.useContext(pt);if(!s){if(Ge)throw new Error("You can only use a Select.Option within a Select component.");return $e(e,t)}var u=t.children,l=r.useRef(null),c=K(l,a),p=t._node,d=s.selectionManager.isSelected(p.key),f=s.disabledKeys.has(p.key),v=s.selectionManager.isFocused&&s.selectionManager.focusedKey===p.key,m=E.useOption({isSelected:d,isDisabled:f,"aria-label":p&&p["aria-label"],key:p.key,shouldSelectOnPressUp:!0,shouldFocusOnHover:!0,isVirtualized:!1},s,l),h=m.optionProps,g=m.labelProps;return{plasmicProps:{variants:V({},j.apply(void 0,[t].concat(e.internalVariantProps)),Be({def:n.isSelectedVariant,active:d},{def:n.isDisabledVariant,active:f},{def:n.isHighlightedVariant,active:v})),args:V({},j.apply(void 0,[t].concat(e.internalArgProps)),((i={})[n.labelSlot]=u,i)),overrides:((o={})[n.root]={props:H(h,Qe(t),{ref:c,style:{outline:"none"}})},o[n.labelContainer]={props:g},o)}}},exports.useSelectOptionGroup=function(e,t,n){var a,i,o=r.useContext(pt),s=t._node;if(!o||!s){if(Ge)throw new Error("You can only use a Select.OptionGroup within a Select component.");return $e(e,t)}var u=E.useListBoxSection({heading:t.title,"aria-label":t["aria-label"]}),l=u.headingProps,c=u.groupProps,p=b.useSeparator({elementType:"li"}).separatorProps;return{plasmicProps:{variants:V({},j.apply(void 0,[t].concat(e.internalVariantProps)),Be({def:n.noTitleVariant,active:!t.title},{def:n.isFirstVariant,active:o.collection.getFirstKey()===s.key})),args:V({},j.apply(void 0,[t].concat(e.internalArgProps)),((a={})[n.titleSlot]=t.title,a[n.optionsSlot]=Array.from(s.childNodes).map((function(e){return et(e)})),a)),overrides:((i={})[n.root]={props:Qe(t)},i[n.separator]={props:V({},p)},i[n.titleContainer]=V({props:V({role:"presentation"},l)},!t.title&&{render:function(){return null}}),i[n.optionsContainer]={props:V({},c)},i)}}},exports.useSwitch=function(e,t,n,a){var i,o;void 0===a&&(a=null);var s=t.children,u=t.isDisabled;Ae();var l=r.useRef(null),c=r.useRef(null),p=function(e){var t=V({},e,{isSelected:e.isChecked,defaultSelected:e.defaultChecked});return delete t.isChecked,delete t.defaultChecked,t}(t),d=m.useToggleState(p),f=C.useSwitch(p,d,l).inputProps,h=V({},j.apply(void 0,[t].concat(e.internalVariantProps)),Be({def:n.isDisabledVariant,active:u},{def:n.isCheckedVariant,active:d.isSelected},{def:n.noLabelVariant,active:!s})),g=((i={})[n.root]={as:"label",props:H(Qe(t),{ref:c}),wrapChildren:function(e){return r.createElement(r.Fragment,null,r.createElement(v.VisuallyHidden,null,r.createElement("input",Object.assign({},f,{ref:l}))),e)}},i),y=V({},j.apply(void 0,[t].concat(e.internalArgProps)),n.labelSlot?((o={})[n.labelSlot]=s,o):{}),b=r.useMemo((function(){return{setChecked:function(e){return d.setSelected(e)}}}),[d]);return r.useImperativeHandle(a,(function(){return{getRoot:function(){return c.current},focus:function(){var e;return null==(e=l.current)?void 0:e.focus()},blur:function(){var e;return null==(e=l.current)?void 0:e.blur()},setChecked:function(e){return b.setChecked(e)}}}),[c,l,b]),{plasmicProps:{variants:h,overrides:g,args:y},state:b}},exports.useTextInput=function(e,t,n,a){var i,o,s;void 0===a&&(a=null);var u=t.isDisabled,l=t.startIcon,c=t.endIcon,p=t.showStartIcon,d=t.showEndIcon,f=t.className,v=t.style,m=t.inputClassName,h=t.inputStyle,g=k(t,mt),y=r.useRef(null),b=r.useRef(null);return r.useImperativeHandle(a,(function(){return{focus:function(){var e;null==(e=b.current)||e.focus()},blur:function(){var e;null==(e=b.current)||e.blur()},getRoot:function(){return y.current},getInput:function(){return b.current}}}),[y,b]),{plasmicProps:{variants:V({},j.apply(void 0,[t].concat(e.internalVariantProps)),Be({def:n.showStartIconVariant,active:p},{def:n.showEndIconVariant,active:d},{def:n.isDisabledVariant,active:u})),args:V({},j.apply(void 0,[t].concat(e.internalArgProps)),n.startIconSlot&&((i={})[n.startIconSlot]=l,i),n.endIconSlot&&((o={})[n.endIconSlot]=c,o)),overrides:((s={})[n.root]={props:{ref:y,className:f,style:v}},s[n.input]={props:V({},A.apply(void 0,[g].concat(e.internalArgProps.filter((function(e){return"required"!==e})),e.internalVariantProps)),{disabled:u,ref:b,className:m,style:h})},s)}}},exports.useTrigger=function(e,t){return Re[e](t)},exports.useTriggeredOverlay=function(e,t,n,a,o){var s,u;void 0===a&&(a=null),void 0===o&&(o=!0);var c=r.useRef(null),p=K(c,a),d=r.useContext(ot);if(!d){if(Ge)throw new Error("You can only use a triggered overlay with a TriggeredOverlayContext");return $e(e,t)}var f=t.children,v=d.triggerRef,m=d.placement,h=d.overlayMatchTriggerWidth,g=d.overlayMinTriggerWidth,y=d.overlayWidth,b=d.state,P=r.useState(!1),w=P[0],S=P[1],E=v.current&&(h||g)?v.current.offsetWidth:void 0;W((function(){!w&&v.current&&(h||g)&&S(!0)}),[v,w,h,g]);var x=O.useOverlay({isOpen:b.isOpen,onClose:b.close,isDismissable:o,shouldCloseOnBlur:!0},c).overlayProps,C=O.useOverlayPosition({targetRef:v,overlayRef:c,placement:null!=m?m:"bottom left",shouldFlip:!0,isOpen:b.isOpen,onClose:b.close,containerPadding:0}),k=C.overlayProps,I=C.updatePosition,M=C.placement;W((function(){b.isOpen&&requestAnimationFrame((function(){I()}))}),[b.isOpen,I]);var T=H({style:{left:"auto",right:"auto",top:"auto",bottom:"auto",position:"absolute",width:null!=y?y:h?E:"auto",minWidth:g?E:"auto"}},x,k);return{plasmicProps:{variants:V({},j.apply(void 0,[t].concat(e.internalVariantProps)),Be({def:n.isPlacedTopVariant,active:"top"===M},{def:n.isPlacedBottomVariant,active:"bottom"===M},{def:n.isPlacedLeftVariant,active:"left"===M},{def:n.isPlacedRightVariant,active:"right"===M})),args:V({},j.apply(void 0,[t].concat(e.internalArgProps)),((s={})[n.contentSlot]=r.createElement(l.FocusScope,{restoreFocus:!0},r.createElement(O.DismissButton,{onDismiss:b.close}),f),s)),overrides:((u={})[n.root]={props:H(T,Qe(t),{ref:p}),wrap:function(e){return"undefined"!=typeof document?i.createPortal(e,document.body):e}},u)}}},exports.wrapWithClassName=function(e,t){var n=r.isValidElement(e)&&e.key||void 0;return r.createElement("div",{key:n,className:t,style:{display:"grid"}},e)}; | ||
//# sourceMappingURL=react-web.cjs.production.min.js.map |
@@ -1,8 +0,16 @@ | ||
import { $StateSpec, Internal$StateSpec } from "."; | ||
import { $StateSpec, InitFunc, Internal$StateSpec, ObjectPath } from "./types"; | ||
export interface StateCell<T> { | ||
initialValue?: T | Symbol; | ||
path: ObjectPath; | ||
registeredInitFunc?: InitFunc<T>; | ||
listeners: (() => void)[]; | ||
} | ||
export declare class StateSpecNode<T> { | ||
private specs; | ||
private edges; | ||
private state; | ||
constructor(specs: Internal$StateSpec<T>[]); | ||
hasEdge(key: string | symbol): boolean; | ||
addEdge(key: string | symbol, node: StateSpecNode<any>): void; | ||
children(): IterableIterator<StateSpecNode<any>>; | ||
makeTransition(key: string | symbol | number): StateSpecNode<any> | undefined; | ||
@@ -13,4 +21,17 @@ isLeaf(): boolean; | ||
getAllSpecs(): Internal$StateSpec<T>[]; | ||
getState(path: ObjectPath): StateCell<T>; | ||
clearStates(): void; | ||
states(): StateCell<T>[]; | ||
hasState(path: ObjectPath): boolean; | ||
createStateCell(path: ObjectPath): void; | ||
setInitialValue(path: ObjectPath, value: any): void; | ||
getInitialValue(path: ObjectPath): Symbol | T | undefined; | ||
addListener(path: ObjectPath, f: () => void): void; | ||
} | ||
export declare const transformPathStringToObj: (str: string) => (string | symbol)[]; | ||
export declare function buildGraph(specs: $StateSpec<any>[]): StateSpecNode<any>; | ||
export declare function buildTree(specs: $StateSpec<any>[]): StateSpecNode<any>; | ||
export declare function getLeaves(root: StateSpecNode<any>): StateSpecNode<any>[]; | ||
export declare function findStateCell(root: StateSpecNode<any>, pathStr: string, repetitionIndex?: number[]): { | ||
node: StateSpecNode<any>; | ||
realPath: ObjectPath; | ||
}; |
@@ -1,4 +0,3 @@ | ||
import get from "dlv"; | ||
import { useLayoutEffect } from "react"; | ||
import { $State } from "."; | ||
import { $State } from "./types"; | ||
export declare function generateStateOnChangeProp($state: $State, stateName: string, dataReps: number[]): (val: any, path: (string | number)[]) => void; | ||
@@ -12,2 +11,7 @@ /** | ||
export declare function generateStateValueProp($state: $State, path: (string | number)[]): any; | ||
export declare const useIsomorphicLayoutEffect: typeof useLayoutEffect; | ||
export declare function shallowEqual<T>(a1: T[], a2: T[]): boolean; | ||
export declare function isNum(value: string | number | symbol): value is number; | ||
declare type StringGen = string | (() => string); | ||
export declare function assert<T>(cond: T, msg?: StringGen): asserts cond; | ||
/** | ||
@@ -18,5 +22,2 @@ * Forked from https://github.com/lukeed/dset | ||
export declare function set(obj: any, keys: any, val: any): void; | ||
export declare const useIsomorphicLayoutEffect: typeof useLayoutEffect; | ||
export declare function shallowEqual<T>(a1: T[], a2: T[]): boolean; | ||
export declare function isNum(value: string | number | symbol): value is number; | ||
export { get }; | ||
export {}; |
@@ -1,24 +0,4 @@ | ||
export declare type InitFunc<T> = ($props: Record<string, any>, $state: $State, $ctx: Record<string, any>, indexes?: number[]) => T; | ||
export declare type ObjectPath = (string | number)[]; | ||
export interface $StateSpec<T> { | ||
path: string; | ||
initFunc?: InitFunc<T>; | ||
initVal?: T; | ||
type: "private" | "readonly" | "writable"; | ||
valueProp?: string; | ||
onChangeProp?: string; | ||
isImmutable?: boolean; | ||
} | ||
export interface $State { | ||
[key: string]: any; | ||
registerInitFunc?: (path: string, f: InitFunc<any>) => any; | ||
} | ||
export declare const ARRAY_SYMBOL: unique symbol; | ||
export interface Internal$StateSpec<T> extends $StateSpec<T> { | ||
isRepeated: boolean; | ||
pathObj: (string | symbol)[]; | ||
} | ||
export interface Internal$StateInstance { | ||
path: ObjectPath; | ||
specKey: string; | ||
} | ||
export { default as get } from "dlv"; | ||
export { generateStateOnChangeProp, generateStateValueProp, set, } from "./helpers"; | ||
export { $State } from "./types"; | ||
export { useDollarState } from "./valtio"; |
@@ -1,4 +0,3 @@ | ||
import { $StateSpec } from "."; | ||
export declare function useDollarState(specs: $StateSpec<any>[], props: Record<string, any>, $ctx?: Record<string, any>): any; | ||
import { $State, $StateSpec } from "./types"; | ||
export declare function useDollarState(specs: $StateSpec<any>[], props: Record<string, any>, $ctx?: Record<string, any>): $State; | ||
export default useDollarState; | ||
export declare function useCanvasDollarState(specs: $StateSpec<any>[], props: Record<string, any>, $ctx?: Record<string, any>): {}; |
@@ -61,4 +61,5 @@ import React from "react"; | ||
}>; | ||
export declare const IsOnChangePropImmediatelyFired: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, {}>; | ||
export declare const ImmutableStateCells: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, { | ||
people: Person[]; | ||
}>; |
{ | ||
"name": "@plasmicapp/react-web", | ||
"version": "0.2.137", | ||
"version": "0.2.138", | ||
"description": "plasmic library for rendering in the presentational style", | ||
@@ -68,3 +68,2 @@ "main": "dist/index.js", | ||
"dlv": "^1.1.3", | ||
"dset": "^3.1.2", | ||
"fast-deep-equal": "^3.1.3", | ||
@@ -114,3 +113,3 @@ "valtio": "^1.6.3" | ||
}, | ||
"gitHead": "e282c9cca3a168a822b34a1a5e6de3a6a072c00f" | ||
"gitHead": "29e95851972acf14bf3ff15462022d322f4c6b57" | ||
} |
@@ -17,5 +17,3 @@ import _classNames from "classnames"; | ||
export { useTrigger } from "./render/triggers"; | ||
export { $State } from "./states"; | ||
export * from "./states/helpers"; | ||
export { default as useDollarState, useCanvasDollarState, } from "./states/valtio"; | ||
export * from "./states"; | ||
export declare const classNames: typeof _classNames; |
@@ -17,4 +17,3 @@ import classNames$1 from 'classnames'; | ||
import deepEqual from 'fast-deep-equal'; | ||
import { proxy, ref, useSnapshot } from 'valtio'; | ||
import { subscribeKey } from 'valtio/utils'; | ||
import { proxy, useSnapshot, ref } from 'valtio'; | ||
export { PlasmicDataSourceContextProvider, useCurrentUser } from '@plasmicapp/data-sources-context'; | ||
@@ -678,2 +677,27 @@ import '@react-aria/ssr'; | ||
} | ||
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect; | ||
function shallowEqual(a1, a2) { | ||
if (a1.length !== a2.length) { | ||
return false; | ||
} | ||
for (var i = 0; i < a1.length; i++) { | ||
if (a1[i] !== a2[i]) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
function isNum$1(value) { | ||
return typeof value === "symbol" ? false : !isNaN(+value); | ||
} | ||
function assert(cond, msg) { | ||
if (msg === void 0) { msg = "Assertion failed"; } | ||
if (!cond) { | ||
// We always generate an non empty message so that it doesn't get swallowed | ||
// by the async library. | ||
msg = (typeof msg === "string" ? msg : msg()) || "Assertion failed"; | ||
debugger; | ||
throw new Error(msg); | ||
} | ||
} | ||
/** | ||
@@ -690,39 +714,43 @@ * Forked from https://github.com/lukeed/dset | ||
break; | ||
if (i === l) { | ||
t[k] = val; | ||
t = t[k]; | ||
} | ||
else { | ||
if (typeof (x = t[k]) === typeof keys) { | ||
t = t[k] = x; | ||
} | ||
else if (keys[i] * 0 !== 0 || !!~("" + keys[i]).indexOf(".")) { | ||
t[k] = {}; | ||
t = t[k]; | ||
} | ||
else { | ||
t[k] = []; | ||
t = t[k]; | ||
} | ||
} | ||
var newValue = i === l | ||
? val | ||
: typeof (x = t[k]) === typeof keys | ||
? x | ||
: keys[i] * 0 !== 0 || !!~("" + keys[i]).indexOf(".") | ||
? {} | ||
: []; | ||
assignValue(t, k, newValue); | ||
t = t[k]; | ||
} | ||
} | ||
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect; | ||
function shallowEqual$1(a1, a2) { | ||
if (a1.length !== a2.length) { | ||
return false; | ||
/** | ||
* Forked from lodash | ||
*/ | ||
function baseAssignValue(object, key, value) { | ||
if (key == "__proto__") { | ||
Object.defineProperty(object, key, { | ||
configurable: true, | ||
enumerable: true, | ||
value: value, | ||
writable: true | ||
}); | ||
} | ||
for (var i = 0; i < a1.length; i++) { | ||
if (a1[i] !== a2[i]) { | ||
return false; | ||
} | ||
else { | ||
object[key] = value; | ||
} | ||
return true; | ||
} | ||
function isNum$1(value) { | ||
return typeof value === "symbol" ? false : !isNaN(+value); | ||
function eq(value, other) { | ||
return value === other || (value !== value && other !== other); | ||
} | ||
function assignValue(object, key, value) { | ||
var objValue = object[key]; | ||
if (!(Object.prototype.hasOwnProperty.call(object, key) && eq(objValue, value)) || | ||
(value === undefined && !(key in object))) { | ||
baseAssignValue(object, key, value); | ||
} | ||
} | ||
var ARRAY_SYMBOL = Symbol("[]"); | ||
var UNINITIALIZED = Symbol("plasmic.unitialized"); | ||
var StateSpecNode = /** @class */ (function () { | ||
@@ -732,2 +760,3 @@ function StateSpecNode(specs) { | ||
this.edges = new Map(); | ||
this.state = {}; | ||
} | ||
@@ -740,2 +769,5 @@ StateSpecNode.prototype.hasEdge = function (key) { | ||
}; | ||
StateSpecNode.prototype.children = function () { | ||
return this.edges.values(); | ||
}; | ||
StateSpecNode.prototype.makeTransition = function (key) { | ||
@@ -757,2 +789,36 @@ key = isNum$1(key) ? ARRAY_SYMBOL : key; | ||
}; | ||
StateSpecNode.prototype.getState = function (path) { | ||
return this.state[JSON.stringify(path)]; | ||
}; | ||
StateSpecNode.prototype.clearStates = function () { | ||
this.state = {}; | ||
}; | ||
StateSpecNode.prototype.states = function () { | ||
return Object.values(this.state); | ||
}; | ||
StateSpecNode.prototype.hasState = function (path) { | ||
var key = JSON.stringify(path); | ||
return key in this.state; | ||
}; | ||
StateSpecNode.prototype.createStateCell = function (path) { | ||
var key = JSON.stringify(path); | ||
this.state[key] = { | ||
listeners: [], | ||
initialValue: UNINITIALIZED, | ||
registeredInitFunc: this.getSpec().initFunc, | ||
path: path | ||
}; | ||
}; | ||
StateSpecNode.prototype.setInitialValue = function (path, value) { | ||
var key = JSON.stringify(path); | ||
this.state[key].initialValue = value; | ||
}; | ||
StateSpecNode.prototype.getInitialValue = function (path) { | ||
var key = JSON.stringify(path); | ||
return this.state[key].initialValue; | ||
}; | ||
StateSpecNode.prototype.addListener = function (path, f) { | ||
var key = JSON.stringify(path); | ||
this.state[key].listeners.push(f); | ||
}; | ||
return StateSpecNode; | ||
@@ -767,3 +833,3 @@ }()); | ||
}; | ||
function buildGraph(specs) { | ||
function buildTree(specs) { | ||
var internalSpec = specs.map(function (spec) { | ||
@@ -774,3 +840,3 @@ return (__assign(__assign({}, spec), { pathObj: transformPathStringToObj(spec.path), isRepeated: spec.path.split(".").some(function (part) { return part.endsWith("[]"); }) })); | ||
var node = new StateSpecNode(internalSpec.filter(function (spec) { | ||
return shallowEqual$1(currentPath, spec.pathObj.slice(0, currentPath.length)); | ||
return shallowEqual(currentPath, spec.pathObj.slice(0, currentPath.length)); | ||
})); | ||
@@ -789,54 +855,134 @@ node.getAllSpecs().forEach(function (spec) { | ||
} | ||
var mkUntrackedValue = function (o) { | ||
return o != null && typeof o === "object" ? ref(o) : o; | ||
}; | ||
function shallowEqual(a1, a2) { | ||
if (a1.length !== a2.length) { | ||
return false; | ||
function getLeaves(root) { | ||
var leaves = []; | ||
var rec = function (node) { | ||
var e_1, _a; | ||
try { | ||
for (var _b = __values(node.children()), _c = _b.next(); !_c.done; _c = _b.next()) { | ||
var child = _c.value; | ||
rec(child); | ||
} | ||
} | ||
catch (e_1_1) { e_1 = { error: e_1_1 }; } | ||
finally { | ||
try { | ||
if (_c && !_c.done && (_a = _b["return"])) _a.call(_b); | ||
} | ||
finally { if (e_1) throw e_1.error; } | ||
} | ||
if (node.isLeaf()) { | ||
leaves.push(node); | ||
} | ||
}; | ||
rec(root); | ||
return leaves; | ||
} | ||
function findStateCell(root, pathStr, repetitionIndex) { | ||
var e_2, _a; | ||
var realPath = []; | ||
var pathObj = transformPathStringToObj(pathStr); | ||
var currRepIndex = 0; | ||
try { | ||
for (var pathObj_1 = __values(pathObj), pathObj_1_1 = pathObj_1.next(); !pathObj_1_1.done; pathObj_1_1 = pathObj_1.next()) { | ||
var part = pathObj_1_1.value; | ||
if (typeof part === "symbol") { | ||
if (!root.hasArrayTransition() || | ||
!repetitionIndex || | ||
currRepIndex > repetitionIndex.length) { | ||
console.log(root); | ||
throw new Error("transition not found: pathStr ".concat(pathStr, " part ").concat(typeof part === "symbol" ? "[]" : part)); | ||
} | ||
realPath.push(repetitionIndex[currRepIndex++]); | ||
root = root.makeTransition(ARRAY_SYMBOL); | ||
} | ||
else { | ||
if (!root.hasEdge(part)) { | ||
throw new Error("transition not found: pathStr ".concat(pathStr, " part ").concat(typeof part === "symbol" ? "[]" : part)); | ||
} | ||
realPath.push(part); | ||
root = root.makeTransition(part); | ||
} | ||
} | ||
} | ||
for (var i = 0; i < a1.length; i++) { | ||
if (a1[i] !== a2[i]) { | ||
return false; | ||
catch (e_2_1) { e_2 = { error: e_2_1 }; } | ||
finally { | ||
try { | ||
if (pathObj_1_1 && !pathObj_1_1.done && (_a = pathObj_1["return"])) _a.call(pathObj_1); | ||
} | ||
finally { if (e_2) throw e_2.error; } | ||
} | ||
return true; | ||
return { | ||
node: root, | ||
realPath: realPath | ||
}; | ||
} | ||
function isNum(value) { | ||
return typeof value === "symbol" ? false : !isNaN(+value); | ||
} | ||
function saveNewState($$state, path, spec) { | ||
var key = JSON.stringify(path); | ||
$$state.existingStates.set(key, { path: path, specKey: spec.path }); | ||
if (!$$state.statesInstanceBySpec.has(spec.path)) { | ||
$$state.statesInstanceBySpec.set(spec.path, []); | ||
function canProxy(value) { | ||
return typeof value === "object" && value != null; | ||
} | ||
function initializeStateValue($$state, initialSpecNode, initialStatePath, proxyRoot) { | ||
var _a, _b; | ||
var stateAccess = new Set(); | ||
var $state = create$StateProxy($$state, function (node, path) { return ({ | ||
get: function () { | ||
stateAccess.add({ path: path, node: node }); | ||
var spec = node.getSpec(); | ||
if (spec.valueProp) { | ||
return $$state.props[spec.valueProp]; | ||
} | ||
else if (!node.hasState(path) && spec.initFunc) { | ||
return initializeStateValue($$state, node, path, proxyRoot); | ||
} | ||
return get(proxyRoot, path); | ||
}, | ||
set: function () { | ||
throw new Error("Cannot update state values during initialization"); | ||
} | ||
}); }); | ||
stateAccess.forEach(function (_a) { | ||
var node = _a.node, path = _a.path; | ||
node.addListener(path, function () { | ||
var newValue = initialSpecNode.getSpec().initFunc($$state.props, $state, $$state.ctx); | ||
set(proxyRoot, initialStatePath, newValue); | ||
}); | ||
}); | ||
var initialValue = initialSpecNode.getState(initialStatePath) | ||
.registeredInitFunc($$state.props, $state, $$state.ctx); | ||
initialSpecNode.setInitialValue(initialStatePath, clone(initialValue)); | ||
var initialSpec = initialSpecNode.getSpec(); | ||
var value = initialSpec.isImmutable | ||
? mkUntrackedValue(initialValue) | ||
: clone(initialValue); | ||
set(proxyRoot, initialStatePath, value); | ||
//immediately fire onChange | ||
if (initialSpec.onChangeProp) { | ||
(_b = (_a = $$state.props)[initialSpec.onChangeProp]) === null || _b === void 0 ? void 0 : _b.call(_a, initialValue); | ||
} | ||
$$state.statesInstanceBySpec | ||
.get(spec.path) | ||
.push({ path: path, specKey: spec.path }); | ||
return initialValue; | ||
} | ||
function create$StateProxy($$state, handlers) { | ||
var rec = function (currPath, currNode) { | ||
function create$StateProxy($$state, leafHandlers) { | ||
var rec = function (currPath, currNode, isOutside, proxyRoot, initialObject) { | ||
var getNextPath = function (property) { return __spreadArray(__spreadArray([], __read(currPath), false), [ | ||
isNum(property) ? +property : property, | ||
], false); }; | ||
return new Proxy(currNode.hasArrayTransition() ? [] : {}, { | ||
var spec = currNode.getSpec(); | ||
var handlers = { | ||
deleteProperty: function (target, property) { | ||
var prefixPath = getNextPath(property); | ||
var specKeysToUpdate = new Set(); | ||
$$state.existingStates.forEach(function (_a) { | ||
var path = _a.path, specKey = _a.specKey; | ||
if (path.length >= prefixPath.length && | ||
shallowEqual(path.slice(0, prefixPath.length), prefixPath)) { | ||
deleteState($$state, path); | ||
specKeysToUpdate.add(specKey); | ||
} | ||
}); | ||
specKeysToUpdate.forEach(function (specKey) { | ||
var _a, _b; | ||
var spec = $$state.specsByKey[specKey]; | ||
if (spec.onChangeProp) { | ||
(_b = (_a = $$state.props)[spec.onChangeProp]) === null || _b === void 0 ? void 0 : _b.call(_a, get($$state.stateValues, currPath), currPath); | ||
} | ||
}); | ||
var _a, _b; | ||
if (!isOutside && | ||
!currNode.isLeaf() && | ||
!currNode.hasArrayTransition() && | ||
!isNum(property)) { | ||
throw new Error("Can't delete a property in the middle of the state spec"); | ||
} | ||
delete get($$state.stateValues, currPath)[property]; | ||
if (spec.onChangeProp) { | ||
//we are always in a leaf, since we only have two cases: | ||
// 1 - delete properties outside the state tree | ||
// 2 - delete indices in repeated implicit states, but these can't be exposed, so they don't have onChangeProp | ||
(_b = (_a = $$state.props)[spec.onChangeProp]) === null || _b === void 0 ? void 0 : _b.call(_a, get($$state.stateValues, currPath.slice(spec.pathObj.length))); | ||
} | ||
return Reflect.deleteProperty(target, property); | ||
@@ -846,227 +992,165 @@ }, | ||
var _a, _b; | ||
proxyRoot = proxyRoot == null ? receiver : proxyRoot; | ||
var nextPath = getNextPath(property); | ||
if (isOutside || currNode.isLeaf()) { | ||
return Reflect.get(target, property, receiver); | ||
} | ||
var nextNode = currNode.makeTransition(property); | ||
if (nextNode) { | ||
if (nextNode.isLeaf()) { | ||
target[property] = (_b = (_a = handlers(nextPath, nextNode.getSpec())).get) === null || _b === void 0 ? void 0 : _b.call(_a, target, property, receiver); | ||
} | ||
else if (!(property in target)) { | ||
target[property] = rec(nextPath, nextNode); | ||
} | ||
if (nextNode === null || nextNode === void 0 ? void 0 : nextNode.isLeaf()) { | ||
return (_b = (_a = leafHandlers(nextNode, nextPath, proxyRoot)).get) === null || _b === void 0 ? void 0 : _b.call(_a, target, property, receiver); | ||
} | ||
else if (nextNode && !(property in target)) { | ||
target[property] = rec(nextPath, nextNode, false, proxyRoot, undefined); | ||
} | ||
return Reflect.get(target, property, receiver); | ||
}, | ||
set: function (target, property, value, receiver) { | ||
var e_1, _a; | ||
var _b, _c, _d, _e; | ||
var _a, _b; | ||
proxyRoot = proxyRoot == null ? receiver : proxyRoot; | ||
var nextPath = getNextPath(property); | ||
var nextNode = currNode.makeTransition(property); | ||
if (nextNode && typeof property !== "symbol") { | ||
if (nextNode.isLeaf()) { | ||
// reached the end of the spec | ||
target[property] = (_c = (_b = handlers(nextPath, nextNode.getSpec())).set) === null || _c === void 0 ? void 0 : _c.call(_b, target, property, value, receiver); | ||
return Reflect.set(target, property, value, receiver); | ||
} | ||
else if (typeof value === "object") { | ||
target[property] = rec(nextPath, nextNode); | ||
try { | ||
for (var _f = __values(Object.keys(value)), _g = _f.next(); !_g.done; _g = _f.next()) { | ||
var key = _g.value; | ||
target[property][key] = value[key]; | ||
} | ||
} | ||
catch (e_1_1) { e_1 = { error: e_1_1 }; } | ||
finally { | ||
try { | ||
if (_g && !_g.done && (_a = _f["return"])) _a.call(_f); | ||
} | ||
finally { if (e_1) throw e_1.error; } | ||
} | ||
return true; | ||
} | ||
} | ||
if (property === "registerInitFunc" && currPath.length === 0) { | ||
return Reflect.set(target, property, value, receiver); | ||
} | ||
if (currNode.hasArrayTransition()) { | ||
if (!nextNode && currNode.hasArrayTransition()) { | ||
set($$state.stateValues, nextPath, value); | ||
(_e = (_d = currNode | ||
.makeTransition(ARRAY_SYMBOL)) === null || _d === void 0 ? void 0 : _d.getAllSpecs()) === null || _e === void 0 ? void 0 : _e.forEach(function (spec) { | ||
var _a, _b; | ||
if (spec.onChangeProp) { | ||
(_b = (_a = $$state.props)[spec.onChangeProp]) === null || _b === void 0 ? void 0 : _b.call(_a, value, nextPath); | ||
} | ||
}); | ||
//array can set his own properties such as length, map, ... | ||
return Reflect.set(target, property, value, receiver); | ||
} | ||
// invalid setting a value that doesn't make part of the spec | ||
return false; | ||
if (nextNode === null || nextNode === void 0 ? void 0 : nextNode.isLeaf()) { | ||
(_b = (_a = leafHandlers(nextNode, nextPath, proxyRoot)).set) === null || _b === void 0 ? void 0 : _b.call(_a, target, property, value, receiver); | ||
} | ||
if (!isOutside && !currNode.isLeaf() && !nextNode) { | ||
// can't set an unknown field in $state | ||
return false; | ||
} | ||
// we keep pointing to the leaf | ||
if (!nextNode) { | ||
assert(isOutside || currNode.isLeaf, "unexpected update in nextNode"); | ||
nextNode = currNode; | ||
} | ||
if (canProxy(value)) { | ||
target[property] = rec(nextPath, nextNode, isOutside || currNode.isLeaf(), proxyRoot, value); | ||
} | ||
else if (!isOutside && !currNode.isLeaf() && !(nextNode === null || nextNode === void 0 ? void 0 : nextNode.isLeaf())) { | ||
throw new Error("inserting a primitive value into a non-leaf"); | ||
} | ||
else { | ||
Reflect.set(target, property, value, receiver); | ||
} | ||
nextNode.getAllSpecs().forEach(function (spec) { | ||
var _a, _b; | ||
if (spec.onChangeProp) { | ||
(_b = (_a = $$state.props)[spec.onChangeProp]) === null || _b === void 0 ? void 0 : _b.call(_a, value); | ||
} | ||
}); | ||
var newValue = (isOutside || currNode.isLeaf()) && currNode.getSpec().isImmutable | ||
? mkUntrackedValue(value) | ||
: value; | ||
set($$state.stateValues, nextPath, newValue); | ||
return true; | ||
} | ||
}); | ||
}; | ||
var baseObject = !isOutside && !currNode.isLeaf() | ||
? currNode.hasArrayTransition() | ||
? [] | ||
: {} | ||
: Array.isArray(initialObject) | ||
? [] | ||
: Object.create(Object.getPrototypeOf(initialObject)); | ||
var proxyObj = new Proxy(baseObject, handlers); | ||
if (initialObject) { | ||
Reflect.ownKeys(initialObject).forEach(function (key) { | ||
var desc = Object.getOwnPropertyDescriptor(initialObject, key); | ||
if (desc.get || desc.set) { | ||
Object.defineProperty(baseObject, key, desc); | ||
} | ||
else { | ||
proxyObj[key] = initialObject[key]; | ||
} | ||
}); | ||
} | ||
return proxyObj; | ||
}; | ||
return rec([], $$state.rootStateSpec); | ||
return rec([], $$state.rootSpecTree, false, undefined, undefined); | ||
} | ||
var deleteState = function ($$state, path) { | ||
var _a; | ||
var key = JSON.stringify(path); | ||
(_a = $$state.unsubscriptionsByState[key]) === null || _a === void 0 ? void 0 : _a.forEach(function (f) { return f(); }); | ||
delete $$state.unsubscriptionsByState[key]; | ||
$$state.existingStates["delete"](key); | ||
// delete get($$state.stateValues, path.slice(-1))[path.slice(-1)[0]]; | ||
// delete get($$state.initStateValues, path.slice(-1))[path.slice(-1)[0]]; | ||
var mkUntrackedValue = function (o) { | ||
return o != null && typeof o === "object" ? ref(o) : o; | ||
}; | ||
var getIndexes = function (path, spec) { | ||
var indexes = []; | ||
if (path.length !== spec.pathObj.length) { | ||
throw new Error("Unexpected error: state path and spec path have different lengths"); | ||
} | ||
for (var i = 0; i < spec.pathObj.length; i++) { | ||
if (spec.pathObj[i] === "[]") { | ||
indexes.push(path[i]); | ||
} | ||
} | ||
return indexes; | ||
}; | ||
function initializeStateValue($$state, initialStatePath, initialSpec) { | ||
var _a; | ||
var initialStateKey = JSON.stringify(initialStatePath); | ||
var stateAccess = new Set(); | ||
var $state = create$StateProxy($$state, function (path, spec) { return ({ | ||
get: function () { | ||
var key = JSON.stringify(path); | ||
stateAccess.add({ path: path, spec: spec }); | ||
if (spec.valueProp) { | ||
return !spec.isRepeated | ||
? $$state.props[spec.valueProp] | ||
: get($$state.props[spec.valueProp], path.slice(1)); | ||
} | ||
if ($$state.existingStates.has(key)) { | ||
// is already initialized | ||
return get($$state.stateValues, path); | ||
} | ||
else if (spec.initFunc) { | ||
initializeStateValue($$state, path, spec); | ||
} | ||
return get($$state.stateValues, path); | ||
}, | ||
set: function () { | ||
throw new Error("Cannot update state values during initialization"); | ||
} | ||
}); }); | ||
(_a = $$state.unsubscriptionsByState[initialStateKey]) === null || _a === void 0 ? void 0 : _a.forEach(function (f) { return f(); }); | ||
$$state.unsubscriptionsByState[initialStateKey] = []; | ||
stateAccess.forEach(function (_a) { | ||
var path = _a.path, spec = _a.spec; | ||
var unsubscribe = subscribeKey(get($$state.stateValues, path.slice(-1)), path.slice(-1)[0], function () { | ||
return saveValue($$state, initialStatePath, initialSpec, initialSpec.initFunc($$state.props, $state, $$state.ctx, getIndexes(path, spec))); | ||
}); | ||
$$state.unsubscriptionsByState[initialStateKey].push(unsubscribe); | ||
}); | ||
var initialValue = initialSpec.initFunc($$state.props, $state, $$state.ctx, getIndexes(initialStatePath, initialSpec)); | ||
saveStateInitialValue($$state, initialStatePath, initialSpec, initialValue); | ||
return initialValue; | ||
} | ||
function saveValue($$state, path, spec, value) { | ||
if (spec.isImmutable) { | ||
set($$state.stateValues, path, mkUntrackedValue(value)); | ||
} | ||
else { | ||
set($$state.stateValues, path, value); | ||
} | ||
} | ||
function saveStateInitialValue($$state, path, spec, initialValue) { | ||
if (spec.isImmutable) { | ||
var untrackedValue = mkUntrackedValue(initialValue); | ||
set($$state.stateValues, path, untrackedValue); | ||
set($$state.initStateValues, path, clone(untrackedValue)); | ||
} | ||
else { | ||
set($$state.stateValues, path, clone(initialValue)); | ||
set($$state.initStateValues, path, clone(initialValue)); | ||
} | ||
} | ||
function useDollarState(specs, props, $ctx) { | ||
var $$state = React__default.useRef(proxy({ | ||
stateValues: {}, | ||
initStateValues: {}, | ||
specsByKey: Object.fromEntries(specs.map(function (spec) { return [ | ||
spec.path, | ||
__assign(__assign({}, spec), { pathObj: transformPathStringToObj(spec.path), isRepeated: spec.path | ||
.split(".") | ||
.some(function (part) { return part.endsWith("[]"); }) }), | ||
]; })), | ||
statesInstanceBySpec: new Map(), | ||
existingStates: new Map(), | ||
unsubscriptionsByState: {}, | ||
props: {}, | ||
ctx: {}, | ||
registrationsQueue: [], | ||
rootStateSpec: buildGraph(specs) | ||
})).current; | ||
$$state.props = mkUntrackedValue(props); | ||
$$state.ctx = mkUntrackedValue($ctx !== null && $ctx !== void 0 ? $ctx : {}); | ||
var $state = React__default.useRef(Object.assign(create$StateProxy($$state, function (path, spec) { | ||
var _a; | ||
var key = JSON.stringify(path); | ||
if (!$$state.existingStates.has(key)) { | ||
saveNewState($$state, path, spec); | ||
var initialValue = !spec.initFunc | ||
? (_a = spec.initVal) !== null && _a !== void 0 ? _a : undefined | ||
: initializeStateValue($$state, path, spec); | ||
saveStateInitialValue($$state, path, spec, initialValue); | ||
} | ||
var $$state = React__default.useRef((function () { | ||
var rootSpecTree = buildTree(specs); | ||
return { | ||
get: function () { | ||
if (spec.valueProp) { | ||
var value = !spec.isRepeated | ||
? $$state.props[spec.valueProp] | ||
: get($$state.props[spec.valueProp], path.slice(1)); | ||
return value; | ||
rootSpecTree: rootSpecTree, | ||
specTreeLeaves: getLeaves(rootSpecTree), | ||
stateValues: proxy({}), | ||
props: {}, | ||
ctx: {}, | ||
registrationsQueue: [] | ||
}; | ||
})()).current; | ||
$$state.props = props; | ||
$$state.ctx = $ctx !== null && $ctx !== void 0 ? $ctx : {}; | ||
var $state = React__default.useRef((function () { | ||
var useRef$state = Object.assign(create$StateProxy($$state, function (node, path, proxyRoot) { | ||
if (!node.hasState(path)) { | ||
node.createStateCell(path); | ||
var spec = node.getSpec(); | ||
if (spec.initFunc) { | ||
initializeStateValue($$state, node, path, proxyRoot); | ||
} | ||
else { | ||
return get($$state.stateValues, path); | ||
else if (!spec.valueProp) { | ||
set(proxyRoot, path, spec.initVal); | ||
} | ||
}, | ||
set: function (_t, _p, value) { | ||
var _a, _b; | ||
saveValue($$state, path, spec, value); | ||
if (spec.onChangeProp) { | ||
(_b = (_a = $$state.props)[spec.onChangeProp]) === null || _b === void 0 ? void 0 : _b.call(_a, value, path); | ||
} | ||
return { | ||
get: function (target, property, receiver) { | ||
var spec = node.getSpec(); | ||
if (spec.valueProp) { | ||
return $$state.props[spec.valueProp]; | ||
} | ||
else { | ||
return Reflect.get(target, property, receiver); | ||
} | ||
} | ||
return true; | ||
}; | ||
}), { | ||
registerInitFunc: function (pathStr, f, repetitionIndex) { | ||
var _a = findStateCell($$state.rootSpecTree, pathStr, repetitionIndex), node = _a.node, realPath = _a.realPath; | ||
if (!node.hasState(realPath)) { | ||
node.createStateCell(realPath); | ||
} | ||
if (!deepEqual(node.getState(realPath).initialValue, f($$state.props, useRef$state, $$state.ctx))) { | ||
$$state.registrationsQueue.push({ node: node, path: realPath, f: f }); | ||
} | ||
} | ||
}; | ||
}), { | ||
registerInitFunc: function (pathStr, f) { | ||
var _a; | ||
if ((_a = $$state.statesInstanceBySpec | ||
.get(pathStr)) === null || _a === void 0 ? void 0 : _a.some(function (_a) { | ||
var path = _a.path, specKey = _a.specKey; | ||
return !deepEqual(get($$state.initStateValues, path), f(props, $state, $ctx !== null && $ctx !== void 0 ? $ctx : {}, getIndexes(path, $$state.specsByKey[specKey]))); | ||
})) { | ||
$$state.registrationsQueue.push({ pathStr: pathStr, f: f }); | ||
} | ||
} | ||
})).current; | ||
}); | ||
return useRef$state; | ||
})()).current; | ||
// For each spec with an initFunc, evaluate it and see if | ||
// the init value has changed. If so, reset its state. | ||
var resetSpecs = []; | ||
$$state.existingStates.forEach(function (_a) { | ||
var path = _a.path, specKey = _a.specKey; | ||
var spec = $$state.specsByKey[specKey]; | ||
if (spec.initFunc) { | ||
var newInit = spec.initFunc(props, $state, $ctx !== null && $ctx !== void 0 ? $ctx : {}, getIndexes(path, spec)); | ||
if (!deepEqual(newInit, get($$state.initStateValues, path))) { | ||
resetSpecs.push({ path: path, spec: spec }); | ||
$$state.specTreeLeaves | ||
.flatMap(function (node) { return node.states().map(function (stateCell) { return ({ stateCell: stateCell, node: node }); }); }) | ||
.forEach(function (_a) { | ||
var stateCell = _a.stateCell, node = _a.node; | ||
if (stateCell.registeredInitFunc) { | ||
var newInit = stateCell.registeredInitFunc(props, $state, $ctx !== null && $ctx !== void 0 ? $ctx : {}); | ||
if (!deepEqual(newInit, stateCell.initialValue)) { | ||
resetSpecs.push({ stateCell: stateCell, node: node }); | ||
} | ||
} | ||
}); | ||
var reInitializeState = function (node, stateCell) { | ||
var _a, _b; | ||
var newInit = initializeStateValue($$state, node, stateCell.path, $state); | ||
var spec = node.getSpec(); | ||
if (spec.onChangeProp) { | ||
(_b = (_a = $$state.props)[spec.onChangeProp]) === null || _b === void 0 ? void 0 : _b.call(_a, newInit); | ||
} | ||
}; | ||
useIsomorphicLayoutEffect(function () { | ||
resetSpecs.forEach(function (_a) { | ||
var _b, _c; | ||
var path = _a.path, spec = _a.spec; | ||
var newInit = initializeStateValue($$state, path, spec); | ||
if (spec.onChangeProp) { | ||
(_c = (_b = $$state.props)[spec.onChangeProp]) === null || _c === void 0 ? void 0 : _c.call(_b, newInit, path); | ||
} | ||
var stateCell = _a.stateCell, node = _a.node; | ||
reInitializeState(node, stateCell); | ||
}); | ||
@@ -1076,56 +1160,23 @@ }, [props, resetSpecs]); | ||
$$state.registrationsQueue.forEach(function (_a) { | ||
var f = _a.f, pathStr = _a.pathStr; | ||
$$state.specsByKey[pathStr].initFunc = f; | ||
var node = _a.node, path = _a.path, f = _a.f; | ||
var stateCell = node.getState(path); | ||
stateCell.registeredInitFunc = f; | ||
reInitializeState(node, stateCell); | ||
}); | ||
$$state.registrationsQueue = []; | ||
}, [$$state.registrationsQueue]); | ||
// immediately initialize exposed non-private states | ||
useIsomorphicLayoutEffect(function () { | ||
$$state.specTreeLeaves.forEach(function (node) { | ||
var spec = node.getSpec(); | ||
if (!spec.isRepeated && spec.type !== "private" && spec.initFunc) { | ||
node.createStateCell(spec.pathObj); | ||
initializeStateValue($$state, node, spec.pathObj, $state); | ||
} | ||
}); | ||
}, []); | ||
// Re-render if any value changed in one of these objects | ||
useSnapshot($$state.stateValues, { sync: true }); | ||
useSnapshot($$state.specsByKey, { sync: true }); | ||
return $state; | ||
} | ||
// Simple version of $state useDollarState for read-only | ||
function useCanvasDollarState(specs, props, $ctx) { | ||
var e_2, _a; | ||
var $$state = proxy({ | ||
stateValues: {}, | ||
initStateValues: {}, | ||
specsByKey: Object.fromEntries(specs.map(function (spec) { return [ | ||
spec.path, | ||
__assign(__assign({}, spec), { pathObj: transformPathStringToObj(spec.path), isRepeated: spec.path.split(".").some(function (part) { return part.endsWith("[]"); }) }), | ||
]; })), | ||
statesInstanceBySpec: new Map(), | ||
existingStates: new Map(), | ||
unsubscriptionsByState: {}, | ||
props: {}, | ||
ctx: {}, | ||
registrationsQueue: [], | ||
rootStateSpec: buildGraph(specs) | ||
}); | ||
$$state.props = mkUntrackedValue(props); | ||
$$state.ctx = mkUntrackedValue($ctx); | ||
var $state = {}; | ||
try { | ||
for (var specs_1 = __values(specs), specs_1_1 = specs_1.next(); !specs_1_1.done; specs_1_1 = specs_1.next()) { | ||
var spec = specs_1_1.value; | ||
var path = transformPathStringToObj(spec.path); | ||
var init = spec.valueProp | ||
? $$state.props[spec.valueProp] | ||
: spec.initVal | ||
? spec.initVal | ||
: spec.initFunc | ||
? initializeStateValue($$state, path, $$state.specsByKey[spec.path]) | ||
: undefined; | ||
set($state, path, init); | ||
} | ||
} | ||
catch (e_2_1) { e_2 = { error: e_2_1 }; } | ||
finally { | ||
try { | ||
if (specs_1_1 && !specs_1_1.done && (_a = specs_1["return"])) _a.call(specs_1); | ||
} | ||
finally { if (e_2) throw e_2.error; } | ||
} | ||
return $state; | ||
} | ||
@@ -1135,3 +1186,3 @@ // Utilities used by generated code | ||
export { PlasmicIcon, PlasmicLink, PlasmicPageGuard, PlasmicSlot, Stack, classNames, createPlasmicElementProxy, createUseScreenVariants, deriveRenderOpts, ensureGlobalVariants, generateStateOnChangeProp, generateStateValueProp, hasVariant, isNum$1 as isNum, makeFragment, mergeVariantsWithStates, renderPlasmicSlot, set, shallowEqual$1 as shallowEqual, useCanvasDollarState, useDollarState, useIsomorphicLayoutEffect, useTrigger, wrapWithClassName }; | ||
export { PlasmicIcon, PlasmicLink, PlasmicPageGuard, PlasmicSlot, Stack, classNames, createPlasmicElementProxy, createUseScreenVariants, deriveRenderOpts, ensureGlobalVariants, generateStateOnChangeProp, generateStateValueProp, hasVariant, makeFragment, mergeVariantsWithStates, renderPlasmicSlot, set, useDollarState, useTrigger, wrapWithClassName }; | ||
//# sourceMappingURL=index.js.map |
@@ -1,8 +0,16 @@ | ||
import { $StateSpec, Internal$StateSpec } from "."; | ||
import { $StateSpec, InitFunc, Internal$StateSpec, ObjectPath } from "./types"; | ||
export interface StateCell<T> { | ||
initialValue?: T | Symbol; | ||
path: ObjectPath; | ||
registeredInitFunc?: InitFunc<T>; | ||
listeners: (() => void)[]; | ||
} | ||
export declare class StateSpecNode<T> { | ||
private specs; | ||
private edges; | ||
private state; | ||
constructor(specs: Internal$StateSpec<T>[]); | ||
hasEdge(key: string | symbol): boolean; | ||
addEdge(key: string | symbol, node: StateSpecNode<any>): void; | ||
children(): IterableIterator<StateSpecNode<any>>; | ||
makeTransition(key: string | symbol | number): StateSpecNode<any> | undefined; | ||
@@ -13,4 +21,17 @@ isLeaf(): boolean; | ||
getAllSpecs(): Internal$StateSpec<T>[]; | ||
getState(path: ObjectPath): StateCell<T>; | ||
clearStates(): void; | ||
states(): StateCell<T>[]; | ||
hasState(path: ObjectPath): boolean; | ||
createStateCell(path: ObjectPath): void; | ||
setInitialValue(path: ObjectPath, value: any): void; | ||
getInitialValue(path: ObjectPath): Symbol | T | undefined; | ||
addListener(path: ObjectPath, f: () => void): void; | ||
} | ||
export declare const transformPathStringToObj: (str: string) => (string | symbol)[]; | ||
export declare function buildGraph(specs: $StateSpec<any>[]): StateSpecNode<any>; | ||
export declare function buildTree(specs: $StateSpec<any>[]): StateSpecNode<any>; | ||
export declare function getLeaves(root: StateSpecNode<any>): StateSpecNode<any>[]; | ||
export declare function findStateCell(root: StateSpecNode<any>, pathStr: string, repetitionIndex?: number[]): { | ||
node: StateSpecNode<any>; | ||
realPath: ObjectPath; | ||
}; |
@@ -1,4 +0,3 @@ | ||
import get from "dlv"; | ||
import { useLayoutEffect } from "react"; | ||
import { $State } from "."; | ||
import { $State } from "./types"; | ||
export declare function generateStateOnChangeProp($state: $State, stateName: string, dataReps: number[]): (val: any, path: (string | number)[]) => void; | ||
@@ -12,2 +11,7 @@ /** | ||
export declare function generateStateValueProp($state: $State, path: (string | number)[]): any; | ||
export declare const useIsomorphicLayoutEffect: typeof useLayoutEffect; | ||
export declare function shallowEqual<T>(a1: T[], a2: T[]): boolean; | ||
export declare function isNum(value: string | number | symbol): value is number; | ||
type StringGen = string | (() => string); | ||
export declare function assert<T>(cond: T, msg?: StringGen): asserts cond; | ||
/** | ||
@@ -18,5 +22,2 @@ * Forked from https://github.com/lukeed/dset | ||
export declare function set(obj: any, keys: any, val: any): void; | ||
export declare const useIsomorphicLayoutEffect: typeof useLayoutEffect; | ||
export declare function shallowEqual<T>(a1: T[], a2: T[]): boolean; | ||
export declare function isNum(value: string | number | symbol): value is number; | ||
export { get }; | ||
export {}; |
@@ -1,24 +0,4 @@ | ||
export type InitFunc<T> = ($props: Record<string, any>, $state: $State, $ctx: Record<string, any>, indexes?: number[]) => T; | ||
export type ObjectPath = (string | number)[]; | ||
export interface $StateSpec<T> { | ||
path: string; | ||
initFunc?: InitFunc<T>; | ||
initVal?: T; | ||
type: "private" | "readonly" | "writable"; | ||
valueProp?: string; | ||
onChangeProp?: string; | ||
isImmutable?: boolean; | ||
} | ||
export interface $State { | ||
[key: string]: any; | ||
registerInitFunc?: (path: string, f: InitFunc<any>) => any; | ||
} | ||
export declare const ARRAY_SYMBOL: unique symbol; | ||
export interface Internal$StateSpec<T> extends $StateSpec<T> { | ||
isRepeated: boolean; | ||
pathObj: (string | symbol)[]; | ||
} | ||
export interface Internal$StateInstance { | ||
path: ObjectPath; | ||
specKey: string; | ||
} | ||
export { default as get } from "dlv"; | ||
export { generateStateOnChangeProp, generateStateValueProp, set, } from "./helpers"; | ||
export { $State } from "./types"; | ||
export { useDollarState } from "./valtio"; |
@@ -1,4 +0,3 @@ | ||
import { $StateSpec } from "."; | ||
export declare function useDollarState(specs: $StateSpec<any>[], props: Record<string, any>, $ctx?: Record<string, any>): any; | ||
import { $State, $StateSpec } from "./types"; | ||
export declare function useDollarState(specs: $StateSpec<any>[], props: Record<string, any>, $ctx?: Record<string, any>): $State; | ||
export default useDollarState; | ||
export declare function useCanvasDollarState(specs: $StateSpec<any>[], props: Record<string, any>, $ctx?: Record<string, any>): {}; |
@@ -62,4 +62,5 @@ import { Story } from "@storybook/react"; | ||
}>; | ||
export declare const IsOnChangePropImmediatelyFired: Story<{}>; | ||
export declare const ImmutableStateCells: Story<{ | ||
people: Person[]; | ||
}>; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1649638
29
176
14567
- Removeddset@^3.1.2
- Removeddset@3.1.4(transitive)