@prismicio/editor-fields 0.4.63 → 0.4.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +102 -11
- package/dist/index.es.js +62279 -10805
- package/package.json +4 -5
package/dist/index.cjs.js
CHANGED
|
@@ -1,6 +1,30 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
`).length;return A.jsx(r.ErrorBoundary,{renderError:()=>A.jsx(r.Alert,{icon:"alert",title:"Oops! We couldn't load the Code Block",color:"error",noShadow:!0,footerButtons:{action:{onClick:()=>window.location.reload(),text:"Refresh page"}}}),children:A.jsx(f.Suspense,{fallback:A.jsx(r.Skeleton,{height:xr+yr+t*Cr,borderRadius:6}),children:A.jsx(r.LazyCodeBlock,{...e})})})}function hA(e){if(K.isRepeatableContent(e))return e;if(K.isLinkContent(e))return{__TYPE__:"RepeatableContent",type:"Link",value:[e]}}function pA(e){if(K.isLinkContent(e))return e;if(K.isRepeatableContent(e)){const[t]=e.value;if(K.isLinkContent(t))return t}}function Br(e,t){let n=Fr(e,t);return n=Ir(e,n),n=jr(e,n),K.fillDocumentWithDefaultValues(e,n)}function Ir(e,t){return w.flattenSections(e).reduce((o,[i,s])=>!t[i]&&s.type==="Group"?{...o,[i]:mA}:o,t)}function jr(e,t){return K.traverseDocument({document:t,customType:e})({transformWidget({model:n,content:o}){return n?o:void 0},transformSlice(n){return n.model?n.content:void 0}})}function Fr(e,t){return K.traverseDocument({document:t,customType:e})({transformWidget({model:n,content:o}){if((n==null?void 0:n.type)==="Link"){const{repeat:i}=n.config??{};switch(o.__TYPE__){case"LinkContent":return i?hA(o)??o:o;case"RepeatableContent":return i?o:pA(o)??o;default:return o}}return o}})}const mA={__TYPE__:"GroupContentType",value:[{__TYPE__:"GroupItemContent",value:[]}]},fA={unclassified:{title:"Draft",color:"amber"},published:{title:"Live",color:"green"},release:{title:"Planned",color:"purple"},archived:{title:"Archived",color:"grey"}},Vt={unclassified:["unclassified","published"],archived:["unclassified","published"],release:["release","published"],published:["published","unclassified"]};function dn(e){const{documentId:t,versionId:n,baseUrl:o,status:i,releaseId:s}=e,a={s:i,v:n,r:s},l=te.createRouteParams({params:a}),d=new URLSearchParams(l).toString();return new URL(`pages/${t}?${d}`,o)}function Sr(e){const{children:t,...n}=e;return A.jsx(oe.QueryErrorResetBoundary,{children:({reset:o})=>A.jsx(r.ErrorBoundary,{...n,onReset:o,children:t})})}const CA=f.createContext(void 0),br={selectedIds:new Set,excludedIds:new Set,isAllSelected:!1};function xA(e){const{children:t,initialState:n,initialTotalItemCount:o,isSelectAllEnabled:i=!1}=e,s=f.useRef(),a=f.useRef(o||0);function l(){if(n&&n.selectedIds){const F=[...n.selectedIds].pop();F&&(s.current=F)}return{...br,...n}}const[d,c]=f.useState(l),u=f.useMemo(()=>{const{selectedIds:F,excludedIds:T,isAllSelected:k}=d;return k?a.current-T.size:F.size},[d]),h=f.useCallback(F=>{const{isAllSelected:T,selectedIds:k,excludedIds:M}=d;return T?!M.has(F):k.has(F)},[d]),g=f.useCallback(()=>{const{isAllSelected:F,selectedIds:T,excludedIds:k}=d;return{selectedIds:[...T],excludedIds:[...k],isAllSelected:F,selectedCount:u}},[d,u]),m=E.useStableCallback(()=>{i&&c({isAllSelected:!0,selectedIds:new Set,excludedIds:new Set})}),C=E.useStableCallback(()=>{c({isAllSelected:!1,selectedIds:new Set,excludedIds:new Set})});f.useEffect(()=>{const{isAllSelected:F,selectedIds:T,excludedIds:k}=d,M=a.current;if(!(M===0||!i)){if(F&&k.size===M){C();return}if(!F&&T.size===M){m();return}}},[d,i,m,C]);const y=E.useStableCallback(F=>{const{id:T,isSingleSelection:k,metaKey:M,shiftKey:_,ids:ge}=F;return _&&ge&&ge.length>0&&s.current?I(T,ge,s.current):k&&!M?x(T):h(T)?S([T]):j([T]),s.current=T,h(T)});function x(F){h(F)&&u===1?c(T=>({...T,selectedIds:new Set})):c({isAllSelected:!1,selectedIds:new Set([F]),excludedIds:new Set})}function I(F,T,k){const M=Kr(T,k,F),_=h(F);return _?S(M):j(M),_}const B=E.useStableCallback(()=>{u>0?C():m()});function j(F){const{isAllSelected:T}=d;if(T){c(k=>({...k,excludedIds:Rn(k.excludedIds,F)}));return}c(k=>({...k,selectedIds:Qn(k.selectedIds,F)}))}function S(F){const{isAllSelected:T}=d;if(T){c(k=>({...k,excludedIds:Qn(k.excludedIds,F)}));return}c(k=>({...k,selectedIds:Rn(k.selectedIds,F)}))}function b(F){a.current=F}const v=f.useMemo(()=>({selectedCount:u,state:d,totalItemCount:a.current,isSelected:h,isSelectAllEnabled:i,getSelectionState:g,toggleSelection:y,toggleSelectAll:B,clearSelection:C,setTotalItemCount:b}),[d,C,g,i,h,u,B,y]);return A.jsx(CA.Provider,{value:v,children:t})}function je(e){const t=f.useContext(CA);if(t===void 0)throw new Error("useSelectionManagerContext must be used within a SelectionManagerProvider");const{totalItemCount:n,onChangeSelection:o}=e||{},{setTotalItemCount:i,totalItemCount:s,state:a,getSelectionState:l,...d}=t;n!==void 0&&n!==s&&i(n);const c=E.useStableCallback(o);return f.useEffect(()=>{c==null||c(l())},[l,c,a]),{...d,getSelectionState:l,isAllSelected:a.isAllSelected}}function Kr(e,t,n){const o=e.indexOf(t),i=e.indexOf(n);if(i===-1)throw new Error("targetId must be in the array");return o===-1?[n]:o<=i?e.slice(o,i+1):e.slice(i,o+1)}function Rn(e,t){const n=new Set(e);return t.forEach(o=>n.delete(o)),n}function Qn(e,t){return new Set([...e,...t])}const jt=f.createContext(void 0);function L(){const e=f.useContext(jt);if(!e)throw new Error("Missing EditorConfigContext.Provider");return e}class Yt extends Error{}function V(e){throw new Yt(`Missing EditorConfig.${e}`)}function Ur(){if(new URL(location.href).searchParams.has("debug"))return;const n=console.error.bind(console);console.error=(...o)=>{o[0]instanceof Yt||Tr(o)||n(...o)},window.addEventListener("error",o=>{o.error instanceof Yt&&o.preventDefault(),wr(o.error)&&o.preventDefault()})}function Tr(e){const t="Warning: flushSync was called from inside a lifecycle method",n=typeof e[0]=="string"&&e[0].includes(t),o=typeof e[1]=="string"&&e[1].includes("RichTextField");return n&&o}function wr(e){const t=/Invalid content for node document: <(bulletList|orderedList)\(listItem*/,n=e.message;return!!(typeof n=="string"&&n.match(t))}const le="meta_title",ue="meta_description",Lr=p.z.object({[le]:p.z.string(),[ue]:p.z.string()});async function yA(e){var s,a,l,d;const{pageTextContent:t,contentLocale:n,config:o}=e,i=new Dn.BedrockRuntimeClient({region:o.region,credentials:{accessKeyId:o.accessKeyId,secretAccessKey:o.secretAccessKey}});try{const c=new Dn.ConverseCommand({modelId:"anthropic.claude-3-5-sonnet-20240620-v1:0",system:[{text:vr(n)}],messages:[{role:"user",content:[{text:`Input:
|
|
3
|
-
${t}`}]}]}),u=await i.send(c);return Lr.parse(JSON.parse(((d=(l=(a=(s=u.output)==null?void 0:s.message)==null?void 0:a.content)==null?void 0:l[0])==null?void 0:d.text)||""))}catch(c){throw console.error("Failed to generate SEO metadata",c),c}}const He={min:50,max:60},_e={min:120,max:165};function vr(e="en-us"){return`
|
|
1
|
+
"use strict";var ute=Object.defineProperty;var lte=(e,t,n)=>t in e?ute(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var en=(e,t,n)=>(lte(e,typeof t!="symbol"?t+"":t,n),n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react/jsx-runtime"),m=require("@prismicio/editor-ui"),E=require("react"),Vr=require("@prismicio/editor-support/URL"),Ti=require("@tanstack/react-query"),Yd=require("@prismicio/editor-support/Object"),We=require("@prismicio/editor-support/React"),O_=require("@prismicio/editor-support/Date"),yt=require("@prismicio/editor-support/Array"),Ye=require("@prismicio/editor-support/Suspense"),bi=require("@prismicio/editor-support/String"),le=require("@prismicio/editor-support/Http"),Kr=require("@prismicio/editor-support/Set"),qi=require("@prismicio/editor-support/Type"),dte=require("@prismicio/editor-support/Map"),M_=require("react-dom"),fte=require("@prismicio/editor-support/DOM"),pte=require("@prismicio/editor-support/Number"),hte=require("@prismicio/editor-support/Animation");function RU(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const Ie=RU(E),Ate=RU(M_),$U={next:"Next.js",nuxt:"Nuxt",sveltekit:"SvelteKit",other:"Other"},kU={next:"npx create-next-app@latest",nuxt:"npx nuxi@latest init",sveltekit:"npx sv create"},mte=18,gte=41,vte=24;function Dw(e){const t=e.code.split(`
|
|
2
|
+
`).length;return f.jsx(m.ErrorBoundary,{renderError:()=>f.jsx(m.Alert,{icon:"alert",title:"Oops! We couldn't load the Code Block",color:"error",noShadow:!0,footerButtons:{action:{onClick:()=>window.location.reload(),text:"Refresh page"}}}),children:f.jsx(E.Suspense,{fallback:f.jsx(m.Skeleton,{height:gte+vte+t*mte,borderRadius:6}),children:f.jsx(m.LazyCodeBlock,{...e})})})}var me=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Mu(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}),n}var ue={},jw=function(e,t){return jw=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])},jw(e,t)};function yte(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");jw(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var Uw=function(){return Uw=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},Uw.apply(this,arguments)};function bte(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function Ste(e,t,n,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(o=(i<3?a(o):i>3?a(t,n,o):a(t,n))||o);return i>3&&o&&Object.defineProperty(t,n,o),o}function Cte(e,t){return function(n,r){t(n,r,e)}}function wte(e,t,n,r,i,o){function a(b){if(b!==void 0&&typeof b!="function")throw new TypeError("Function expected");return b}for(var s=r.kind,c=s==="getter"?"get":s==="setter"?"set":"value",u=!t&&e?r.static?e:e.prototype:null,l=t||(u?Object.getOwnPropertyDescriptor(u,r.name):{}),d,p=!1,h=n.length-1;h>=0;h--){var A={};for(var g in r)A[g]=g==="access"?{}:r[g];for(var g in r.access)A.access[g]=r.access[g];A.addInitializer=function(b){if(p)throw new TypeError("Cannot add initializers after decoration has completed");o.push(a(b||null))};var v=(0,n[h])(s==="accessor"?{get:l.get,set:l.set}:l[c],A);if(s==="accessor"){if(v===void 0)continue;if(v===null||typeof v!="object")throw new TypeError("Object expected");(d=a(v.get))&&(l.get=d),(d=a(v.set))&&(l.set=d),(d=a(v.init))&&i.push(d)}else(d=a(v))&&(s==="field"?i.push(d):l[c]=d)}u&&Object.defineProperty(u,r.name,l),p=!0}function xte(e,t,n){for(var r=arguments.length>2,i=0;i<t.length;i++)n=r?t[i].call(e,n):t[i].call(e);return r?n:void 0}function _te(e){return typeof e=="symbol"?e:"".concat(e)}function Tte(e,t,n){return typeof t=="symbol"&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:n?"".concat(n," ",t):t})}function Ite(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)}function Ete(e,t,n,r){function i(o){return o instanceof n?o:new n(function(a){a(o)})}return new(n||(n=Promise))(function(o,a){function s(l){try{u(r.next(l))}catch(d){a(d)}}function c(l){try{u(r.throw(l))}catch(d){a(d)}}function u(l){l.done?o(l.value):i(l.value).then(s,c)}u((r=r.apply(e,t||[])).next())})}function Rte(e,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(u){return function(l){return c([u,l])}}function c(u){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(n=0)),n;)try{if(r=1,i&&(o=u[0]&2?i.return:u[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;switch(i=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,i=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){n.label=u[1];break}if(u[0]===6&&n.label<o[1]){n.label=o[1],o=u;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(u);break}o[2]&&n.ops.pop(),n.trys.pop();continue}u=t.call(e,n)}catch(l){u=[6,l],i=0}finally{r=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}var F_=Object.create?function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]};function $te(e,t){for(var n in e)n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n)&&F_(t,e,n)}function Pw(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function OU(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,o=[],a;try{for(;(t===void 0||t-- >0)&&!(i=r.next()).done;)o.push(i.value)}catch(s){a={error:s}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(a)throw a.error}}return o}function kte(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(OU(arguments[t]));return e}function Ote(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;for(var r=Array(e),i=0,t=0;t<n;t++)for(var o=arguments[t],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r}function Mte(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,o;r<i;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}function lh(e){return this instanceof lh?(this.v=e,this):new lh(e)}function Fte(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(e,t||[]),i,o=[];return i={},a("next"),a("throw"),a("return"),i[Symbol.asyncIterator]=function(){return this},i;function a(p){r[p]&&(i[p]=function(h){return new Promise(function(A,g){o.push([p,h,A,g])>1||s(p,h)})})}function s(p,h){try{c(r[p](h))}catch(A){d(o[0][3],A)}}function c(p){p.value instanceof lh?Promise.resolve(p.value.v).then(u,l):d(o[0][2],p)}function u(p){s("next",p)}function l(p){s("throw",p)}function d(p,h){p(h),o.shift(),o.length&&s(o[0][0],o[0][1])}}function Lte(e){var t,n;return t={},r("next"),r("throw",function(i){throw i}),r("return"),t[Symbol.iterator]=function(){return this},t;function r(i,o){t[i]=e[i]?function(a){return(n=!n)?{value:lh(e[i](a)),done:!1}:o?o(a):a}:o}}function Bte(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof Pw=="function"?Pw(e):e[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(o){n[o]=e[o]&&function(a){return new Promise(function(s,c){a=e[o](a),i(s,c,a.done,a.value)})}}function i(o,a,s,c){Promise.resolve(c).then(function(u){o({value:u,done:s})},a)}}function Dte(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var jte=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};function Ute(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&F_(t,e,n);return jte(t,e),t}function Pte(e){return e&&e.__esModule?e:{default:e}}function Nte(e,t,n,r){if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(e):r?r.value:t.get(e)}function Wte(e,t,n,r,i){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?i.call(e,n):i?i.value=n:t.set(e,n),n}function Kte(e,t){if(t===null||typeof t!="object"&&typeof t!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof e=="function"?t===e:e.has(t)}const qte=Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return Uw},__asyncDelegator:Lte,__asyncGenerator:Fte,__asyncValues:Bte,__await:lh,__awaiter:Ete,__classPrivateFieldGet:Nte,__classPrivateFieldIn:Kte,__classPrivateFieldSet:Wte,__createBinding:F_,__decorate:Ste,__esDecorate:wte,__exportStar:$te,__extends:yte,__generator:Rte,__importDefault:Pte,__importStar:Ute,__makeTemplateObject:Dte,__metadata:Ite,__param:Cte,__propKey:_te,__read:OU,__rest:bte,__runInitializers:xte,__setFunctionName:Tte,__spread:kte,__spreadArray:Mte,__spreadArrays:Ote,__values:Pw},Symbol.toStringTag,{value:"Module"})),Q=Mu(qte);var hr={};function MU(e){return function(t){return function(n){return n.reduce(function(r,i){return e.alt(r,function(){return i})},t)}}}const Vte=Object.freeze(Object.defineProperty({__proto__:null,altAll:MU},Symbol.toStringTag,{value:"Module"}));function zte(e){return MU(e)(e.zero())}const Qte=Object.freeze(Object.defineProperty({__proto__:null,altAll:zte},Symbol.toStringTag,{value:"Module"}));var FU=function(e){return function(){return{meet:function(t,n){return function(r){return e.meet(t(r),n(r))}},join:function(t,n){return function(r){return e.join(t(r),n(r))}},zero:function(){return e.zero},one:function(){return e.one},implies:function(t,n){return function(r){return e.implies(t(r),n(r))}},not:function(t){return function(n){return e.not(t(n))}}}}},L_=function(e){return function(){return{concat:function(t,n){return function(r){return e.concat(t(r),n(r))}}}}},LU=function(e){var t=L_(e);return function(){return{concat:t().concat,empty:function(){return e.empty}}}},B_=function(e){return{add:function(t,n){return function(r){return e.add(t(r),n(r))}},zero:function(){return e.zero},mul:function(t,n){return function(r){return e.mul(t(r),n(r))}},one:function(){return e.one}}},BU=function(e){var t=B_(e);return{add:t.add,mul:t.mul,one:t.one,zero:t.zero,sub:function(n,r){return function(i){return e.sub(n(i),r(i))}}}},Hte=function(e){return function(t){return t(e)}};function z(e){return e}var md=z;function wr(e){return function(){return e}}var D_=wr(!0),DU=wr(!1),jU=wr(null),j_=wr(void 0),Yte=j_;function Gte(e){return function(t,n){return e(n,t)}}function Z(e,t,n,r,i,o,a,s,c){switch(arguments.length){case 1:return e;case 2:return function(){return t(e.apply(this,arguments))};case 3:return function(){return n(t(e.apply(this,arguments)))};case 4:return function(){return r(n(t(e.apply(this,arguments))))};case 5:return function(){return i(r(n(t(e.apply(this,arguments)))))};case 6:return function(){return o(i(r(n(t(e.apply(this,arguments))))))};case 7:return function(){return a(o(i(r(n(t(e.apply(this,arguments)))))))};case 8:return function(){return s(a(o(i(r(n(t(e.apply(this,arguments))))))))};case 9:return function(){return c(s(a(o(i(r(n(t(e.apply(this,arguments)))))))))}}}function UU(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e}function Jte(e){return e+1}function Zte(e){return e-1}function PU(e){throw new Error("Called `absurd` function which should be uncallable")}function Xte(e){return function(t){return e.apply(void 0,t)}}function ene(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e(t)}}function _(e,t,n,r,i,o,a,s,c){switch(arguments.length){case 1:return e;case 2:return t(e);case 3:return n(t(e));case 4:return r(n(t(e)));case 5:return i(r(n(t(e))));case 6:return o(i(r(n(t(e)))));case 7:return a(o(i(r(n(t(e))))));case 8:return s(a(o(i(r(n(t(e)))))));case 9:return c(s(a(o(i(r(n(t(e))))))));default:{for(var u=arguments[0],l=1;l<arguments.length;l++)u=arguments[l](u);return u}}}var tne=PU,xr=function(e,t){return t};function nne(e){return function(t){return!e(t)}}var rne=function(){return{concat:function(e,t){return Z(e,t)},empty:z}};const NU=Object.freeze(Object.defineProperty({__proto__:null,SK:xr,absurd:PU,apply:Hte,constFalse:DU,constNull:jU,constTrue:D_,constUndefined:j_,constVoid:Yte,constant:wr,decrement:Zte,flip:Gte,flow:Z,getBooleanAlgebra:FU,getEndomorphismMonoid:rne,getMonoid:LU,getRing:BU,getSemigroup:L_,getSemiring:B_,hole:tne,identity:z,increment:Jte,not:nne,pipe:_,tuple:UU,tupled:Xte,unsafeCoerce:md,untupled:ene},Symbol.toStringTag,{value:"Module"}));var ine=function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,o;r<i;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))},qt=function(e){return e._tag==="None"},St=function(e){return e._tag==="Some"},we={_tag:"None"},Ae=function(e){return{_tag:"Some",value:e}},on=function(e){return e._tag==="Left"},U_=function(e){return e._tag==="Right"},ba=function(e){return{_tag:"Left",left:e}},Ys=function(e){return{_tag:"Right",right:e}},oA=function(e){return[e]},pt=function(e){return e.length>0},Xr=function(e){return e[0]},Gd=function(e){return e.slice(1)},wn=[],sn={},st=Object.prototype.hasOwnProperty,Ty=function(e){return ine([e[0]],e.slice(1),!0)};function Ia(e,t){return function(n){return function(r){return e.ap(e.map(r,function(i){return function(o){return t.ap(i,o)}}),n)}}}function Dt(e){return function(t){return function(n){return e.ap(e.map(n,function(r){return function(){return r}}),t)}}}function jt(e){return function(t){return function(n){return e.ap(e.map(n,function(){return function(r){return r}}),t)}}}function Ut(e){return function(t,n){return function(r){return e.ap(e.map(r,function(i){return function(o){var a;return Object.assign({},i,(a={},a[t]=o,a))}}),n)}}}function cn(e){return function(t){return{concat:function(n,r){return e.ap(e.map(n,function(i){return function(o){return t.concat(i,o)}}),r)}}}}function P_(e,t,n){return function(r){for(var i=Array(n.length+1),o=0;o<n.length;o++)i[o]=n[o];return i[n.length]=r,t===0?e.apply(null,i):P_(e,t-1,i)}}var QS={1:function(e){return[e]},2:function(e){return function(t){return[e,t]}},3:function(e){return function(t){return function(n){return[e,t,n]}}},4:function(e){return function(t){return function(n){return function(r){return[e,t,n,r]}}}},5:function(e){return function(t){return function(n){return function(r){return function(i){return[e,t,n,r,i]}}}}}};function one(e){return st.call(QS,e)||(QS[e]=P_(UU,e-1,[])),QS[e]}function ane(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];for(var r=t.length,i=one(r),o=e.map(t[0],i),a=1;a<r;a++)o=e.ap(o,t[a]);return o}}function sne(e){var t=e.length;switch(t){case 1:return function(n){var r;return r={},r[e[0]]=n,r};case 2:return function(n){return function(r){var i;return i={},i[e[0]]=n,i[e[1]]=r,i}};case 3:return function(n){return function(r){return function(i){var o;return o={},o[e[0]]=n,o[e[1]]=r,o[e[2]]=i,o}}};case 4:return function(n){return function(r){return function(i){return function(o){var a;return a={},a[e[0]]=n,a[e[1]]=r,a[e[2]]=i,a[e[3]]=o,a}}}};case 5:return function(n){return function(r){return function(i){return function(o){return function(a){var s;return s={},s[e[0]]=n,s[e[1]]=r,s[e[2]]=i,s[e[3]]=o,s[e[4]]=a,s}}}}};default:return P_(function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];for(var i={},o=0;o<t;o++)i[e[o]]=n[o];return i},t-1,[])}}function cne(e){return function(t){for(var n=Object.keys(t),r=n.length,i=sne(n),o=e.map(t[n[0]],i),a=1;a<r;a++)o=e.ap(o,t[n[a]]);return o}}const une=Object.freeze(Object.defineProperty({__proto__:null,ap:Ia,apFirst:Dt,apS:Ut,apSecond:jt,getApplySemigroup:cn,sequenceS:cne,sequenceT:ane},Symbol.toStringTag,{value:"Module"}));function Jd(e,t){return function(n){return function(r){return e.map(r,function(i){return t.map(i,n)})}}}function qe(e){return function(t){return function(n){return e.map(n,function(r){return r(t)})}}}function Pt(e){return function(t){return function(n){return e.map(n,function(r){var i;return i={},i[t]=r,i})}}}function Zd(e,t){var n=Jd(e,t);return{map:function(r,i){return _(r,n(i))}}}const lne=Object.freeze(Object.defineProperty({__proto__:null,bindTo:Pt,flap:qe,getFunctorComposition:Zd,map:Jd},Symbol.toStringTag,{value:"Module"}));function Ii(e){var t=cn(e);return function(n){return{concat:t(n).concat,empty:e.of(n.empty)}}}function WU(e,t){var n=Zd(e,t).map,r=Ia(e,t);return{map:n,of:function(i){return e.of(t.of(i))},ap:function(i,o){return _(i,r(o))}}}const dne=Object.freeze(Object.defineProperty({__proto__:null,getApplicativeComposition:WU,getApplicativeMonoid:Ii},Symbol.toStringTag,{value:"Module"}));function ct(e){return function(t){return function(n){return e.chain(n,function(r){return e.map(t(r),function(){return r})})}}}function Nt(e){return function(t,n){return function(r){return e.chain(r,function(i){return e.map(n(i),function(o){var a;return Object.assign({},i,(a={},a[t]=o,a))})})}}}const fne=Object.freeze(Object.defineProperty({__proto__:null,bind:Nt,chainFirst:ct},Symbol.toStringTag,{value:"Module"}));function Po(e){return function(t){return function(n){return e.fromEither(qt(n)?ba(t()):Ys(n.value))}}}function Gs(e){return function(t,n){return function(r){return e.fromEither(t(r)?Ys(r):ba(n(r)))}}}function No(e){var t=Po(e);return function(n){var r=t(n);return function(i){return Z(i,r)}}}function Fu(e,t){var n=No(e);return function(r){var i=n(r);return function(o){return function(a){return t.chain(a,i(o))}}}}function ei(e){return function(t){return Z(t,e.fromEither)}}function Ea(e,t){var n=ei(e);return function(r){return function(i){return t.chain(i,n(r))}}}function Ra(e,t){return Z(ei(e),ct(t))}function Lu(e,t){return function(n,r){return function(i){return t.chain(i,function(o){return e.fromEither(n(o)?Ys(o):ba(r(o)))})}}}const pne=Object.freeze(Object.defineProperty({__proto__:null,chainEitherK:Ea,chainFirstEitherK:Ra,chainOptionK:Fu,filterOrElse:Lu,fromEitherK:ei,fromOption:Po,fromOptionK:No,fromPredicate:Gs},Symbol.toStringTag,{value:"Module"}));var Ei=function(e){return{equals:function(t,n){return t===n||e(t,n)}}},KU=function(e){return Ei(function(t,n){for(var r in e)if(!e[r].equals(t[r],n[r]))return!1;return!0})},qU=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Ei(function(n,r){return e.every(function(i,o){return i.equals(n[o],r[o])})})},hne=function(e,t){return _(e,VU(t))},VU=function(e){return function(t){return Ei(function(n,r){return t.equals(e(n),e(r))})}},zU="Eq",Xd={equals:function(e,t){return e===t}},Ane={equals:function(){return!0}},QU=function(){return{concat:function(e,t){return Ei(function(n,r){return e.equals(n,r)&&t.equals(n,r)})}}},mne=function(){return{concat:QU().concat,empty:Ane}},HU={URI:zU,contramap:hne},gne=qU,vne=KU,yne=Xd.equals,bne=HU,Sne=Xd,Cne=Xd,wne=Xd,xne={equals:function(e,t){return e.valueOf()===t.valueOf()}};const _ne=Object.freeze(Object.defineProperty({__proto__:null,Contravariant:HU,URI:zU,contramap:VU,eq:bne,eqBoolean:Sne,eqDate:xne,eqNumber:wne,eqStrict:Xd,eqString:Cne,fromEquals:Ei,getMonoid:mne,getSemigroup:QU,getStructEq:vne,getTupleEq:gne,strictEqual:yne,struct:KU,tuple:qU},Symbol.toStringTag,{value:"Module"}));var YU=function(e){return function(t,n){return t===n||e(t,n)===0}},Bu=function(e){return{equals:YU(e),compare:function(t,n){return t===n?0:e(t,n)}}},GU=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Bu(function(n,r){for(var i=0;i<e.length-1;i++){var o=e[i].compare(n[i],r[i]);if(o!==0)return o}return e[i].compare(n[i],r[i])})},N_=function(e){return Bu(function(t,n){return e.compare(n,t)})},Tne=function(e,t){return _(e,Iy(t))},Iy=function(e){return function(t){return Bu(function(n,r){return t.compare(e(n),e(r))})}},JU="Ord",ZU=function(){return{concat:function(e,t){return Bu(function(n,r){var i=e.compare(n,r);return i!==0?i:t.compare(n,r)})}}},W_=function(){return{concat:ZU().concat,empty:Bu(function(){return 0})}},XU={URI:JU,contramap:Tne},Ine={equals:D_,compare:wr(0)},Ene=function(e){return function(t){return function(n){return n===t||e.compare(n,t)===0}}},eP=function(e){return function(t,n){return e.compare(t,n)===-1}},tP=function(e){return function(t,n){return e.compare(t,n)===1}},Rne=function(e){return function(t,n){return e.compare(t,n)!==1}},$ne=function(e){return function(t,n){return e.compare(t,n)!==-1}},Ey=function(e){return function(t,n){return t===n||e.compare(t,n)<1?t:n}},Ry=function(e){return function(t,n){return t===n||e.compare(t,n)>-1?t:n}},nP=function(e){var t=Ey(e),n=Ry(e);return function(r,i){return function(o){return n(t(o,i),r)}}},kne=function(e){var t=eP(e),n=tP(e);return function(r,i){return function(o){return!(t(o,r)||n(o,i))}}},One=GU,Mne=N_,Fne=XU;function Lne(e,t){return e<t?-1:e>t?1:0}var K_={equals:Xd.equals,compare:Lne},Bne=K_,Dne=K_,gv=K_,jne=_(gv,Iy(function(e){return e.valueOf()}));const Une=Object.freeze(Object.defineProperty({__proto__:null,Contravariant:XU,URI:JU,between:kne,clamp:nP,contramap:Iy,equals:Ene,equalsDefault:YU,fromCompare:Bu,geq:$ne,getDualOrd:Mne,getMonoid:W_,getSemigroup:ZU,getTupleOrd:One,gt:tP,leq:Rne,lt:eP,max:Ry,min:Ey,ord:Fne,ordBoolean:Bne,ordDate:jne,ordNumber:gv,ordString:Dne,reverse:N_,trivial:Ine,tuple:GU},Symbol.toStringTag,{value:"Module"}));var rP=function(e){return{concat:function(t,n){return e.concat(n,t)}}},Pne=function(e){return function(t){return{concat:function(n,r){return e(n)?t.concat(n,r):r}}}},Nne=function(e){return function(t){return{concat:function(n,r){return e(r)?t.concat(n,r):n}}}},Wne=function(e){return function(t){return{concat:function(n,r){return t.concat(e(n),e(r))}}}},iP=function(e){return function(t){return function(n){return n.reduce(function(r,i){return e.concat(r,i)},t)}}};const Kne=Object.freeze(Object.defineProperty({__proto__:null,concatAll:iP,endo:Wne,filterFirst:Pne,filterSecond:Nne,reverse:rP},Symbol.toStringTag,{value:"Module"}));var $y=function(e){return{concat:Ey(e)}},ky=function(e){return{concat:Ry(e)}},q_=function(e){return{concat:function(){return e}}},V_=rP,z_=function(e){return{concat:function(t,n){var r={};for(var i in e)st.call(e,i)&&(r[i]=e[i].concat(t[i],n[i]));return r}}},Q_=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return{concat:function(n,r){return e.map(function(i,o){return i.concat(n[o],r[o])})}}},oP=function(e){return function(t){return{concat:function(n,r){return t.concat(n,t.concat(e,r))}}}},H_=function(){return{concat:z}},Oy=function(){return{concat:function(e,t){return t}}},Y_=iP,aP=q_(void 0),qne=function(){return{concat:function(e,t){return Object.assign({},e,t)}}},Vne=Oy,zne=H_,Qne=Q_,Hne=z_,Yne=V_,Gne=ky,Jne=$y,Zne=oP;function Xne(e){var t=Y_(e);return function(n,r){return r===void 0?t(n):t(n)(r)}}var sP={concat:function(e,t){return e&&t}},cP={concat:function(e,t){return e||t}},ere=L_,uP={concat:function(e,t){return e+t}},lP={concat:function(e,t){return e+t}},dP={concat:function(e,t){return e*t}};const fP=Object.freeze(Object.defineProperty({__proto__:null,concatAll:Y_,constant:q_,first:H_,fold:Xne,getDualSemigroup:Yne,getFirstSemigroup:zne,getFunctionSemigroup:ere,getIntercalateSemigroup:Zne,getJoinSemigroup:Gne,getLastSemigroup:Vne,getMeetSemigroup:Jne,getObjectSemigroup:qne,getStructSemigroup:Hne,getTupleSemigroup:Qne,intercalate:oP,last:Oy,max:ky,min:$y,reverse:V_,semigroupAll:sP,semigroupAny:cP,semigroupProduct:dP,semigroupString:uP,semigroupSum:lP,semigroupVoid:aP,struct:z_,tuple:Q_},Symbol.toStringTag,{value:"Module"}));var dh=function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,o;r<i;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))},aA=wn,Wo=pt,My=function(e,t){return e<0||e>=t.length},G_=function(e){return function(t){return dh([e],t,!0)}},gd=G_,J_=function(e){return function(t){return dh(dh([],t,!0),[e],!1)}},Fy=J_,Ly=function(e,t,n){if(Wo(n)){var r=Ty(n);return r.splice(e,0,t),r}return[t]},Z_=function(e,t,n){if(n[e]===t)return n;var r=Ty(n);return r[e]=t,r},X_=function(e){return function(t){if(t.length===1)return t;for(var n=[ar(t)],r=Qi(t),i=function(c){n.every(function(u){return!e.equals(u,c)})&&n.push(c)},o=0,a=r;o<a.length;o++){var s=a[o];i(s)}return n}},pP=function(e){if(Wo(e)){var t=W_();return rT(e.reduce(t.concat,t.empty))}return z},eT=function(e){var t=X_(e);return function(n){return function(r){return t(_(r,sA(n)))}}},tT=function(e){return function(t){var n=t.length,r=Math.round(e)%n;if(My(Math.abs(r),t)||r===0)return t;if(r<0){var i=jy(-r)(t),o=i[0],a=i[1];return _(a,sA(o))}else return tT(r-n)(t)}},nT=function(e){return Wo(e)?Ae(e):we},By=function(e){return function(t){for(var n=Math.max(0,Math.floor(t)),r=[e(0)],i=1;i<n;i++)r.push(e(i));return r}},tre=function(e){return By(function(){return e})},hP=function(e,t){return e<=t?By(function(n){return e+n})(t-e+1):[e]},AP=function(e){return[ar(e),Qi(e)]},mP=function(e){return[ef(e),Zs(e)]},nre=function(e){return nT(e.slice())};function gP(e){return function(t){return t.concat(e)}}function sA(e,t){return t?e.concat(t):function(n){return n.concat(e)}}var rre=function(e){return e.length===1?e:dh([Zs(e)],e.slice(0,-1).reverse(),!0)};function vP(e){return function(t){var n=t.length;if(n===0)return aA;for(var r=[],i=t[0],o=[i],a=1;a<n;a++){var s=t[a];e.equals(s,i)?o.push(s):(r.push(o),i=s,o=[i])}return r.push(o),r}}var ire=function(e){return function(t){for(var n={},r=0,i=t;r<i.length;r++){var o=i[r],a=e(o);st.call(n,a)?n[a].push(o):n[a]=[o]}return n}},rT=function(e){return function(t){return t.length===1?t:t.slice().sort(e.compare)}},ore=function(e,t){return yP(e,function(){return t})},yP=function(e,t){return function(n){return My(e,n)?we:Ae(Z_(e,t(n[e]),n))}},bP=function(e,t,n){for(var r=[n(e[0],t[0])],i=Math.min(e.length,t.length),o=1;o<i;o++)r[o]=n(e[o],t[o]);return r};function SP(e,t){return t===void 0?function(n){return SP(n,e)}:bP(e,t,function(n,r){return[n,r]})}var are=function(e){for(var t=[e[0][0]],n=[e[0][1]],r=1;r<e.length;r++)t[r]=e[r][0],n[r]=e[r][1];return[t,n]},Dy=function(e){return function(t){for(var n=[e,t[0]],r=1;r<t.length;r++)n.push(e,t[r]);return n}},iT=function(e){return function(t){var n=Qi(t);return Wo(n)?_(n,Dy(e),gd(ar(t))):t}},CP=function(e){return function(t){for(var n=Ty(e(0,ar(t))),r=1;r<t.length;r++)n.push.apply(n,e(r,t[r]));return n}},oT=function(e){return function(t){for(var n=e(t),r=n[0],i=n[1],o=[r],a=i;Wo(a);){var s=e(a),c=s[0],u=s[1];o.push(c),a=u}return o}},jy=function(e){return function(t){var n=Math.max(1,e);return n>=t.length?[t,aA]:[_(t.slice(1,n),gd(ar(t))),t.slice(n)]}},wP=function(e){return oT(jy(e))},Ji=function(e,t){return _(e,pT(t))},aT=function(e,t){return _(e,hT(t))},cA=function(e,t){return _(e,RP(t))},sT=function(e,t){return _(e,Uy(t))},xP=function(e,t){return _(e,fT(t))},uA=function(e,t,n){return _(e,AT(t,n))},lA=function(e){var t=mT(e);return function(n,r){return _(n,t(r))}},dA=function(e,t,n){return _(e,gT(t,n))},cT=function(e){var t=$P(e);return function(n,r){return _(n,t(r))}},_P=function(e,t){return _(e,EP(t))},uT=function(e,t,n){return _(e,Py(t,n))},lT=function(e){var t=vT(e);return function(n,r){return _(n,t(r))}},dT=function(e,t,n){return _(e,Ny(t,n))},TP=function(e){var t=Ky(e);return function(n,r){return _(n,t(r))}},Js=oA,IP=function(e){return function(t){return _(t,gP(e()))}},EP=IP,RP=function(e){return Uy(function(t){return _(e,pT(t))})},Uy=function(e){return CP(function(t,n){return e(n)})},fT=function(e){return function(t){for(var n=Qi(t),r=[e(t)];Wo(n);)r.push(e(n)),n=Qi(n);return r}},sre=fT(z),cre=Uy(z),pT=function(e){return hT(function(t,n){return e(n)})},hT=function(e){return function(t){for(var n=[e(0,ar(t))],r=1;r<t.length;r++)n.push(e(r,t[r]));return n}},AT=function(e,t){return Py(e,function(n,r,i){return t(r,i)})},mT=function(e){return function(t){return function(n){return n.slice(1).reduce(function(r,i){return e.concat(r,t(i))},t(n[0]))}}},gT=function(e,t){return Ny(e,function(n,r,i){return t(r,i)})},Py=function(e,t){return function(n){return n.reduce(function(r,i,o){return t(o,r,i)},e)}},vT=function(e){return function(t){return function(n){return n.slice(1).reduce(function(r,i,o){return e.concat(r,t(o+1,i))},t(0,n[0]))}}},Ny=function(e,t){return function(n){return n.reduceRight(function(r,i,o){return t(o,i,r)},e)}},$P=function(e){var t=Ky(e);return function(n){return t(function(r,i){return n(i)})}},Wy=function(e){return Ky(e)(xr)},Ky=function(e){return function(t){return function(n){for(var r=e.map(t(0,ar(n)),Js),i=1;i<n.length;i++)r=e.ap(e.map(r,function(o){return function(a){return _(o,Fy(a))}}),t(i,n[i]));return r}}},qy=Xr,or="ReadonlyNonEmptyArray",kP=function(e){return{show:function(t){return"[".concat(t.map(e.show).join(", "),"]")}}},ure=function(){return{concat:sA}},OP=function(e){return Ei(function(t,n){return t.length===n.length&&t.every(function(r,i){return e.equals(r,n[i])})})},lre=function(e){var t=eT(e);return{concat:function(n,r){return t(r)(n)}}},yT={URI:or,map:Ji},dre=qe(yT),fre={URI:or,of:Js},pre={URI:or,map:Ji,mapWithIndex:aT},Vy={URI:or,map:Ji,ap:cA},hre=Dt(Vy),Are=jt(Vy),mre={URI:or,map:Ji,ap:cA,of:Js},bT={URI:or,map:Ji,ap:cA,chain:sT},gre=ct(bT),vre={URI:or,map:Ji,ap:cA,of:Js,chain:sT},yre={URI:or,reduce:uA,foldMap:lA,reduceRight:dA},bre={URI:or,reduce:uA,foldMap:lA,reduceRight:dA,reduceWithIndex:uT,foldMapWithIndex:lT,reduceRightWithIndex:dT},Sre={URI:or,map:Ji,reduce:uA,foldMap:lA,reduceRight:dA,traverse:cT,sequence:Wy},Cre={URI:or,map:Ji,mapWithIndex:aT,reduce:uA,foldMap:lA,reduceRight:dA,traverse:cT,sequence:Wy,reduceWithIndex:uT,foldMapWithIndex:lT,reduceRightWithIndex:dT,traverseWithIndex:TP},wre={URI:or,map:Ji,alt:_P},xre={URI:or,map:Ji,extend:xP,extract:qy},_re=Js(sn),Tre=Pt(yT),Ire=Nt(bT),Ere=Ut(Vy),ar=qy,Qi=Gd,Zs=function(e){return e[e.length-1]},ef=function(e){return e.slice(0,-1)},MP=function(e){var t=$y(e);return function(n){return n.reduce(t.concat)}},FP=function(e){var t=ky(e);return function(n){return n.reduce(t.concat)}},zy=function(e){return function(t){return t.reduce(e.concat)}},Rre=function(e){return function(t){return e(ar(t),Qi(t))}},$re=function(e){return function(t){return e(ef(t),Zs(t))}},LP=function(e){return function(t){return dh([e(ar(t))],Qi(t),!0)}},kre=function(e){return LP(function(){return e})},BP=function(e){return function(t){return _(ef(t),Fy(e(Zs(t))))}},Ore=function(e){return BP(function(){return e})},ST=function(e){var t=zy(e);return function(n){return Z(iT(n),t)}};function Mre(e){var t=rT(e),n=vP(e);return function(r){return Wo(r)?n(t(r)):aA}}function Fre(e){return DP(function(t,n){return e(n)})}var DP=function(e){return function(t){return nT(t.filter(function(n,r){return e(r,n)}))}},Lre=AP,Bre=mP;function jP(e,t){return t===void 0?gd(e):_(t,gd(e))}var UP=function(e,t){return _(e,sA([t]))},Dre=function(e,t){return function(n){return e<0||e>n.length?we:Ae(Ly(e,t,n))}},jre=Dy,Ure=zy,Pre={URI:or,of:Js,map:Ji,mapWithIndex:aT,ap:cA,chain:sT,extend:xP,extract:qy,reduce:uA,foldMap:lA,reduceRight:dA,traverse:cT,sequence:Wy,reduceWithIndex:uT,foldMapWithIndex:lT,reduceRightWithIndex:dT,traverseWithIndex:TP,alt:_P};const Nre=Object.freeze(Object.defineProperty({__proto__:null,Alt:wre,Applicative:mre,Apply:Vy,Chain:bT,Comonad:xre,Do:_re,Foldable:yre,FoldableWithIndex:bre,Functor:yT,FunctorWithIndex:pre,Monad:vre,Pointed:fre,Traversable:Sre,TraversableWithIndex:Cre,URI:or,alt:EP,altW:IP,ap:RP,apFirst:hre,apS:Ere,apSecond:Are,append:Fy,appendW:J_,bind:Ire,bindTo:Tre,chain:Uy,chainFirst:gre,chainWithIndex:CP,chop:oT,chunksOf:wP,concat:sA,concatAll:zy,concatW:gP,cons:jP,duplicate:sre,empty:aA,extend:fT,extract:qy,filter:Fre,filterWithIndex:DP,flap:dre,flatten:cre,fold:Ure,foldMap:mT,foldMapWithIndex:vT,fromArray:nre,fromReadonlyArray:nT,getEq:OP,getSemigroup:ure,getShow:kP,getUnionSemigroup:lre,group:vP,groupBy:ire,groupSort:Mre,head:ar,init:ef,insertAt:Dre,intercalate:ST,intersperse:iT,isNonEmpty:Wo,isOutOfBound:My,last:Zs,makeBy:By,map:pT,mapWithIndex:hT,matchLeft:Rre,matchRight:$re,max:FP,min:MP,modifyAt:yP,modifyHead:LP,modifyLast:BP,of:Js,prepend:gd,prependAll:Dy,prependToAll:jre,prependW:G_,range:hP,readonlyNonEmptyArray:Pre,reduce:AT,reduceRight:gT,reduceRightWithIndex:Ny,reduceWithIndex:Py,replicate:tre,reverse:rre,rotate:tT,sequence:Wy,snoc:UP,sort:rT,sortBy:pP,splitAt:jy,tail:Qi,traverse:$P,traverseWithIndex:Ky,unappend:mP,uncons:Lre,union:eT,uniq:X_,unprepend:AP,unsafeInsertAt:Ly,unsafeUpdateAt:Z_,unsnoc:Bre,unzip:are,updateAt:ore,updateHead:kre,updateLast:Ore,zip:SP,zipWith:bP},Symbol.toStringTag,{value:"Module"}));var fh=function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,o;r<i;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))},$a=function(e){return e.length>0},Qy=function(e,t){return e<0||e>=t.length},CT=function(e){return function(t){return fh([e],t,!0)}},vd=CT,wT=function(e){return function(t){return fh(fh([],t,!0),[e],!1)}},fA=wT,xT=function(e,t,n){if($a(n)){var r=pA(n);return r.splice(e,0,t),r}return[t]},_T=function(e,t,n){var r=pA(n);return r[e]=t,r},TT=function(e){return function(t){if(t.length===1)return tf(t);for(var n=[Ri(t)],r=Hi(t),i=function(c){n.every(function(u){return!e.equals(u,c)})&&n.push(c)},o=0,a=r;o<a.length;o++){var s=a[o];i(s)}return n}},PP=function(e){if($a(e)){var t=W_();return $T(e.reduce(t.concat,t.empty))}return tf},IT=function(e){var t=TT(e);return function(n){return function(r){return t(_(r,Yy(n)))}}},ET=function(e){return function(t){var n=t.length,r=Math.round(e)%n;if(Qy(Math.abs(r),t)||r===0)return tf(t);if(r<0){var i=Jy(-r)(t),o=i[0],a=i[1];return _(a,Yy(o))}else return ET(r-n)(t)}},pA=Ty,RT=function(e){return $a(e)?Ae(e):we},Hy=function(e){return function(t){for(var n=Math.max(0,Math.floor(t)),r=[e(0)],i=1;i<n;i++)r.push(e(i));return r}},Wre=function(e){return Hy(function(){return e})},NP=function(e,t){return e<=t?Hy(function(n){return e+n})(t-e+1):[e]},WP=function(e){return[Ri(e),Hi(e)]},KP=function(e){return[rf(e),nf(e)]};function qP(e){return function(t){return t.concat(e)}}function Yy(e,t){return t?e.concat(t):function(n){return n.concat(e)}}var Kre=function(e){return fh([nf(e)],e.slice(0,-1).reverse(),!0)};function VP(e){return function(t){var n=t.length;if(n===0)return[];for(var r=[],i=t[0],o=[i],a=1;a<n;a++){var s=t[a];e.equals(s,i)?o.push(s):(r.push(o),i=s,o=[i])}return r.push(o),r}}var qre=function(e){return function(t){for(var n={},r=0,i=t;r<i.length;r++){var o=i[r],a=e(o);st.call(n,a)?n[a].push(o):n[a]=[o]}return n}},$T=function(e){return function(t){return t.slice().sort(e.compare)}},Vre=function(e,t){return function(n){return e<0||e>n.length?we:Ae(xT(e,t,n))}},zre=function(e,t){return zP(e,function(){return t})},zP=function(e,t){return function(n){return Qy(e,n)?we:Ae(_T(e,t(n[e]),n))}},tf=pA,Xs=function(e){return[e]},QP=function(e,t,n){for(var r=[n(e[0],t[0])],i=Math.min(e.length,t.length),o=1;o<i;o++)r[o]=n(e[o],t[o]);return r};function HP(e,t){return t===void 0?function(n){return HP(n,e)}:QP(e,t,function(n,r){return[n,r]})}var Qre=function(e){for(var t=[e[0][0]],n=[e[0][1]],r=1;r<e.length;r++)t[r]=e[r][0],n[r]=e[r][1];return[t,n]},Gy=function(e){return function(t){for(var n=[e,t[0]],r=1;r<t.length;r++)n.push(e,t[r]);return n}},YP=function(e){return function(t){var n=Hi(t);return $a(n)?_(n,Gy(e),vd(Ri(t))):tf(t)}},GP=vT,JP=mT,ZP=function(e){return function(t){for(var n=pA(e(0,Ri(t))),r=1;r<t.length;r++)n.push.apply(n,e(r,t[r]));return n}},kT=function(e){return function(t){for(var n=e(t),r=n[0],i=n[1],o=[r],a=i;$a(a);){var s=e(a),c=s[0],u=s[1];o.push(c),a=u}return o}},Jy=function(e){return function(t){var n=Math.max(1,e);return n>=t.length?[tf(t),[]]:[_(t.slice(1,n),vd(Ri(t))),t.slice(n)]}},XP=function(e){return kT(Jy(e))},Zi=function(e,t){return _(e,UT(t))},OT=function(e,t){return _(e,PT(t))},hA=function(e,t){return _(e,oN(t))},MT=function(e,t){return _(e,Zy(t))},eN=function(e,t){return _(e,jT(t))},AA=function(e,t,n){return _(e,aN(t,n))},mA=function(e){var t=JP(e);return function(n,r){return _(n,t(r))}},gA=function(e,t,n){return _(e,cN(t,n))},FT=function(e){var t=lN(e);return function(n,r){return _(n,t(r))}},tN=function(e,t){return _(e,iN(t))},LT=function(e,t,n){return _(e,sN(t,n))},BT=function(e){var t=GP(e);return function(n,r){return _(n,t(r))}},DT=function(e,t,n){return _(e,uN(t,n))},nN=function(e){var t=e0(e);return function(n,r){return _(n,t(r))}},rN=function(e){return function(t){return _(t,qP(e()))}},iN=rN,oN=function(e){return Zy(function(t){return _(e,UT(t))})},Zy=function(e){return ZP(function(t,n){return e(n)})},jT=function(e){return function(t){for(var n=Hi(t),r=[e(t)];$a(n);)r.push(e(n)),n=Hi(n);return r}},Hre=jT(z),Yre=Zy(z),UT=function(e){return PT(function(t,n){return e(n)})},PT=function(e){return function(t){for(var n=[e(0,Ri(t))],r=1;r<t.length;r++)n.push(e(r,t[r]));return n}},aN=AT,sN=Py,cN=gT,uN=Ny,lN=function(e){var t=e0(e);return function(n){return t(function(r,i){return n(i)})}},Xy=function(e){return e0(e)(function(t,n){return n})},e0=function(e){return function(t){return function(n){for(var r=e.map(t(0,Ri(n)),Xs),i=1;i<n.length;i++)r=e.ap(e.map(r,function(o){return function(a){return _(o,fA(a))}}),t(i,n[i]));return r}}},NT=ar,sr="NonEmptyArray",Gre=kP,Jre=function(){return{concat:Yy}},Zre=OP,Xre=function(e){var t=IT(e);return{concat:function(n,r){return t(r)(n)}}},WT={URI:sr,map:Zi},eie=qe(WT),tie={URI:sr,of:Xs},nie={URI:sr,map:Zi,mapWithIndex:OT},t0={URI:sr,map:Zi,ap:hA},rie=Dt(t0),iie=jt(t0),oie={URI:sr,map:Zi,ap:hA,of:Xs},KT={URI:sr,map:Zi,ap:hA,chain:MT},aie=ct(KT),sie={URI:sr,map:Zi,ap:hA,of:Xs,chain:MT},cie={URI:sr,reduce:AA,foldMap:mA,reduceRight:gA},uie={URI:sr,reduce:AA,foldMap:mA,reduceRight:gA,reduceWithIndex:LT,foldMapWithIndex:BT,reduceRightWithIndex:DT},lie={URI:sr,map:Zi,reduce:AA,foldMap:mA,reduceRight:gA,traverse:FT,sequence:Xy},die={URI:sr,map:Zi,mapWithIndex:OT,reduce:AA,foldMap:mA,reduceRight:gA,traverse:FT,sequence:Xy,reduceWithIndex:LT,foldMapWithIndex:BT,reduceRightWithIndex:DT,traverseWithIndex:nN},fie={URI:sr,map:Zi,alt:tN},pie={URI:sr,map:Zi,extend:eN,extract:NT},hie=Xs(sn),Aie=Pt(WT),mie=Nt(KT),gie=Ut(t0),Ri=ar,Hi=function(e){return e.slice(1)},nf=Zs,rf=function(e){return e.slice(0,-1)},vie=MP,yie=FP,bie=function(e){return function(t){return t.reduce(e.concat)}},Sie=function(e){return function(t){return e(Ri(t),Hi(t))}},Cie=function(e){return function(t){return e(rf(t),nf(t))}},dN=function(e){return function(t){return fh([e(Ri(t))],Hi(t),!0)}},wie=function(e){return dN(function(){return e})},fN=function(e){return function(t){return _(rf(t),fA(e(nf(t))))}},xie=function(e){return fN(function(){return e})},_ie=ST;function Tie(e){var t=$T(e),n=VP(e);return function(r){return $a(r)?n(t(r)):[]}}function Iie(e){return pN(function(t,n){return e(n)})}var pN=function(e){return function(t){return RT(t.filter(function(n,r){return e(r,n)}))}},Eie=WP,Rie=KP;function hN(e,t){return t===void 0?vd(e):_(t,vd(e))}var AN=function(e,t){return _(e,fA(t))},$ie=Gy,kie=zy,Oie={URI:sr,of:Xs,map:Zi,mapWithIndex:OT,ap:hA,chain:MT,extend:eN,extract:NT,reduce:AA,foldMap:mA,reduceRight:gA,traverse:FT,sequence:Xy,reduceWithIndex:LT,foldMapWithIndex:BT,reduceRightWithIndex:DT,traverseWithIndex:nN,alt:tN};const Mie=Object.freeze(Object.defineProperty({__proto__:null,Alt:fie,Applicative:oie,Apply:t0,Chain:KT,Comonad:pie,Do:hie,Foldable:cie,FoldableWithIndex:uie,Functor:WT,FunctorWithIndex:nie,Monad:sie,Pointed:tie,Traversable:lie,TraversableWithIndex:die,URI:sr,alt:iN,altW:rN,ap:oN,apFirst:rie,apS:gie,apSecond:iie,append:fA,appendW:wT,bind:mie,bindTo:Aie,chain:Zy,chainFirst:aie,chainWithIndex:ZP,chop:kT,chunksOf:XP,concat:Yy,concatAll:bie,concatW:qP,cons:hN,copy:tf,duplicate:Hre,extend:jT,extract:NT,filter:Iie,filterWithIndex:pN,flap:eie,flatten:Yre,fold:kie,foldMap:JP,foldMapWithIndex:GP,fromArray:RT,fromReadonlyNonEmptyArray:pA,getEq:Zre,getSemigroup:Jre,getShow:Gre,getUnionSemigroup:Xre,group:VP,groupBy:qre,groupSort:Tie,head:Ri,init:rf,insertAt:Vre,intercalate:_ie,intersperse:YP,isNonEmpty:$a,isOutOfBound:Qy,last:nf,makeBy:Hy,map:UT,mapWithIndex:PT,matchLeft:Sie,matchRight:Cie,max:yie,min:vie,modifyAt:zP,modifyHead:dN,modifyLast:fN,nonEmptyArray:Oie,of:Xs,prepend:vd,prependAll:Gy,prependToAll:$ie,prependW:CT,range:NP,reduce:aN,reduceRight:cN,reduceRightWithIndex:uN,reduceWithIndex:sN,replicate:Wre,reverse:Kre,rotate:ET,sequence:Xy,snoc:AN,sort:$T,sortBy:PP,splitAt:Jy,tail:Hi,traverse:lN,traverseWithIndex:e0,unappend:KP,uncons:Eie,union:IT,uniq:TT,unprepend:WP,unsafeInsertAt:xT,unsafeUpdateAt:_T,unsnoc:Rie,unzip:Qre,updateAt:zre,updateHead:wie,updateLast:xie,zip:HP,zipWith:QP},Symbol.toStringTag,{value:"Module"}));var Fie=function(e){return typeof e=="number"},qT={equals:function(e,t){return e===t}},n0={equals:qT.equals,compare:function(e,t){return e<t?-1:e>t?1:0}},Lie={equals:qT.equals,compare:n0.compare,top:1/0,bottom:-1/0},Bie={show:function(e){return JSON.stringify(e)}},mN={concat:function(e,t){return e-t}},VT={concat:function(e,t){return e+t}},zT={concat:function(e,t){return e*t}},Die={concat:VT.concat,empty:0},jie={concat:zT.concat,empty:1},Uie={add:VT.concat,zero:0,mul:zT.concat,one:1,sub:mN.concat,degree:function(e){return 1},div:function(e,t){return e/t},mod:function(e,t){return e%t}};const Pie=Object.freeze(Object.defineProperty({__proto__:null,Bounded:Lie,Eq:qT,Field:Uie,MagmaSub:mN,MonoidProduct:jie,MonoidSum:Die,Ord:n0,SemigroupProduct:zT,SemigroupSum:VT,Show:Bie,isNumber:Fie},Symbol.toStringTag,{value:"Module"}));var Me=function(e,t){return{left:e,right:t}},Nie=function(e,t){return _(e,gN(t))},Wie=function(e,t){return _(e,vN(t))},Kie=function(e,t,n){return _(e,yN(t,n))},gN=function(e){return function(t){return Me(r0(t),e(i0(t)))}},vN=function(e){return function(t){return Me(e(r0(t)),i0(t))}},yN=function(e,t){return function(n){return Me(e(r0(n)),t(i0(n)))}},QT="Separated",qie={URI:QT,mapLeft:Wie,bimap:Kie},bN={URI:QT,map:Nie},Vie=qe(bN),r0=function(e){return e.left},i0=function(e){return e.right};const zie=Object.freeze(Object.defineProperty({__proto__:null,Bifunctor:qie,Functor:bN,URI:QT,bimap:yN,flap:Vie,left:r0,map:gN,mapLeft:vN,right:i0,separated:Me},Symbol.toStringTag,{value:"Module"}));function Xi(e,t){return function(n){var r=e.traverse(n);return function(i,o){return n.map(r(i,o),t.separate)}}}function eo(e,t){return function(n){var r=e.traverse(n);return function(i,o){return n.map(r(i,o),t.compact)}}}function HT(e){return function(t){var n=e.wither(t);return function(r){return function(i){return n(i,function(o){return t.map(r(o),function(a){return a?Ae(o):we})})}}}}const Qie=Object.freeze(Object.defineProperty({__proto__:null,filterE:HT,wiltDefault:Xi,witherDefault:eo},Symbol.toStringTag,{value:"Module"}));function of(e,t){return function(n){return n?t.of(void 0):e.zero()}}const Hie=Object.freeze(Object.defineProperty({__proto__:null,guard:of},Symbol.toStringTag,{value:"Module"}));var Yie=function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,o;r<i;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))},Mo=function(e){return e.length===0},Bt=Wo,Gie=gd,Jie=G_,o0=Fy,Zie=J_,SN=function(e,t){return e<=0?It:By(t)(e)},Xie=function(e,t){return SN(e,function(){return t})};function eoe(e){return function(t){return e(t)?[t]:It}}var CN=function(e){return qt(e)?It:[e.value]},wN=function(e){return on(e)?It:[e.right]},xN=function(e,t){return function(n){return Bt(n)?t(n):e()}},_N=xN,TN=function(e,t){return function(n){return Bt(n)?t(ar(n),Qi(n)):e()}},IN=TN,toe=IN,EN=function(e,t){return function(n){return Bt(n)?t(ef(n),Zs(n)):e()}},RN=EN,noe=RN,$N=function(e){return function(t){if(Mo(t))return It;for(var n=[],r=0;r<t.length;r++)n.push.apply(n,e(r,t[r]));return n}},roe=function(e,t){return function(n){var r=n.length,i=new Array(r+1);i[0]=e;for(var o=0;o<r;o++)i[o+1]=t(i[o],n[o]);return i}},ioe=function(e,t){return function(n){var r=n.length,i=new Array(r+1);i[r]=e;for(var o=r-1;o>=0;o--)i[o]=t(n[o],i[o+1]);return i}},ooe=function(e){return e.length},af=My;function du(e,t){return t===void 0?function(n){return du(e,n)}:af(e,t)?we:Ae(t[e])}var kN=function(e){return Bt(e)?Ae(ar(e)):we},ON=function(e){return Bt(e)?Ae(Zs(e)):we},aoe=function(e){return Bt(e)?Ae(Qi(e)):we},soe=function(e){return Bt(e)?Ae(ef(e)):we},coe=function(e){return function(t){return af(e,t)?t:e===0?It:t.slice(0,e)}},uoe=function(e){return function(t){return af(e,t)?t:e===0?It:t.slice(-e)}};function loe(e){return function(t){for(var n=[],r=0,i=t;r<i.length;r++){var o=i[r];if(!e(o))break;n.push(o)}var a=n.length;return a===t.length?t:a===0?It:n}}var MN=function(e,t){for(var n=e.length,r=0;r<n&&t(e[r]);r++);return r};function doe(e){return function(t){var n=WN(MN(t,e))(t),r=n[0],i=n[1];return{init:r,rest:i}}}var foe=function(e){return function(t){return e<=0||Mo(t)?t:e>=t.length?It:t.slice(e,t.length)}},poe=function(e){return function(t){return e<=0||Mo(t)?t:e>=t.length?It:t.slice(0,t.length-e)}};function hoe(e){return function(t){var n=MN(t,e);return n===0?t:n===t.length?It:t.slice(n)}}var a0=function(e){return function(t){for(var n=0;n<t.length;n++)if(e(t[n]))return Ae(n);return we}};function s0(e){return function(t){for(var n=0;n<t.length;n++)if(e(t[n]))return Ae(t[n]);return we}}var FN=function(e){return function(t){for(var n=0;n<t.length;n++){var r=e(t[n]);if(St(r))return r}return we}};function LN(e){return function(t){for(var n=t.length-1;n>=0;n--)if(e(t[n]))return Ae(t[n]);return we}}var BN=function(e){return function(t){for(var n=t.length-1;n>=0;n--){var r=e(t[n]);if(St(r))return r}return we}},DN=function(e){return function(t){for(var n=t.length-1;n>=0;n--)if(e(t[n]))return Ae(n);return we}},Aoe=function(e,t){return function(n){return e<0||e>n.length?we:Ae(Ly(e,t,n))}},moe=function(e,t){return jN(e,function(){return t})},goe=function(e){return function(t){return af(e,t)?we:Ae(h3(e,t))}},jN=function(e,t){return function(n){return af(e,n)?we:Ae(g0(e,t(n[e]),n))}},voe=function(e){return e.length<=1?e:e.slice().reverse()},yoe=function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];r._tag==="Right"&&t.push(r.right)}return t},boe=function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];r._tag==="Left"&&t.push(r.left)}return t},Soe=function(e){return function(t){return t.length<=1?t:t.slice().sort(e.compare)}},UN=function(e,t,n){for(var r=[],i=Math.min(e.length,t.length),o=0;o<i;o++)r[o]=n(e[o],t[o]);return r};function PN(e,t){return t===void 0?function(n){return PN(n,e)}:UN(e,t,function(n,r){return[n,r]})}var Coe=function(e){for(var t=[],n=[],r=0;r<e.length;r++)t[r]=e[r][0],n[r]=e[r][1];return[t,n]},NN=function(e){var t=Dy(e);return function(n){return Bt(n)?t(n):n}},woe=function(e){var t=iT(e);return function(n){return Bt(n)?t(n):n}},xoe=function(e){var t=tT(e);return function(n){return Bt(n)?t(n):n}};function vA(e){return function(t,n){if(n===void 0){var r=vA(e);return function(a){return r(t,a)}}for(var i=function(a){return e.equals(a,t)},o=0;o<n.length;o++)if(i(n[o]))return!0;return!1}}var _oe=function(e){var t=X_(e);return function(n){return Bt(n)?t(n):n}},Toe=function(e){var t=pP(e);return function(n){return Bt(n)?t(n):n}},Ioe=function(e){var t=oT(e);return function(n){return Bt(n)?t(n):It}},WN=function(e){return function(t){return e>=1&&Bt(t)?jy(e)(t):Mo(t)?[t,It]:[It,t]}},Eoe=function(e){var t=wP(e);return function(n){return Bt(n)?t(n):It}},Roe=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return CN(e.apply(void 0,t))}};function $oe(e,t,n){n===void 0&&(n=function(){return!0});var r=function(i,o){return Bt(o)?_(ar(o),bA(function(a){return r(_(i,o0(a)),Qi(o))})):n.apply(void 0,i)?[t.apply(void 0,i)]:It};return r(It,e)}var KN=function(e){return function(t){return Mo(t)?e:Mo(e)?t:t.concat(e)}},koe=KN;function YT(e){var t=eT(e);return function(n,r){if(r===void 0){var i=YT(e);return function(o){return i(o,n)}}return Bt(n)&&Bt(r)?t(r)(n):Bt(n)?n:r}}function GT(e){var t=vA(e);return function(n,r){if(r===void 0){var i=GT(e);return function(o){return i(o,n)}}return n.filter(function(o){return t(o,r)})}}function JT(e){var t=vA(e);return function(n,r){if(r===void 0){var i=JT(e);return function(o){return i(o,n)}}return n.filter(function(o){return!t(o,r)})}}var xn=function(e,t){return _(e,iI(t))},c0=function(e,t){return _(e,XN(t))},ec=function(e,t){return _(e,ZN(t))},yA=function(e,t){return _(e,bA(t))},u0=function(e,t){return _(e,e3(t))},l0=function(e,t){return _(e,aI(t))},d0=function(e,t){return _(e,t3(t))},f0=function(e,t){return _(e,n3(t))},qN=function(e,t){return _(e,sI(t))},VN=function(e,t){return _(e,cI(t))},ZT=function(e,t){return _(e,JN(t))},Du=function(e,t,n){return _(e,lI(t,n))},sf=function(e){var t=dI(e);return function(n,r){return _(n,t(r))}},cf=function(e,t,n){return _(e,fI(t,n))},XT=function(e,t,n){return _(e,SA(t,n))},eI=function(e){var t=h0(e);return function(n,r){return _(n,t(r))}},tI=function(e,t,n){return _(e,A0(t,n))},zN=function(e,t){return _(e,oI(t))},QN=function(e,t){return _(e,r3(t))},HN=function(e,t){return _(e,uI(t))},p0=function(e){var t=i3(e);return function(n,r){return _(n,t(r))}},YN=function(e){var t=pI(e);return function(n,r){return _(n,t(r))}},nI=function(e,t){return _(e,yI(t))},rI=function(e,t){return _(e,bI(t))},ju=Js,uf=function(){return It},GN=function(e){return function(t){return t.concat(e())}},JN=GN,ZN=function(e){return bA(function(t){return _(e,iI(t))})},bA=function(e){return function(t){return _(t,$N(function(n,r){return e(r)}))}},Ooe=bA(z),iI=function(e){return function(t){return t.map(function(n){return e(n)})}},XN=function(e){return function(t){return t.map(function(n,r){return e(r,n)})}},lf=function(e){for(var t=[],n=[],r=0,i=e;r<i.length;r++){var o=i[r];o._tag==="Left"?t.push(o.left):n.push(o.right)}return Me(t,n)},e3=function(e){return function(t){return t.filter(e)}},oI=function(e){return function(t){for(var n=[],r=0;r<t.length;r++){var i=e(r,t[r]);St(i)&&n.push(i.value)}return n}},aI=function(e){return oI(function(t,n){return e(n)})},df=aI(z),t3=function(e){return sI(function(t,n){return e(n)})},sI=function(e){return function(t){for(var n=[],r=[],i=0;i<t.length;i++){var o=t[i];e(i,o)?r.push(o):n.push(o)}return Me(n,r)}},n3=function(e){return cI(function(t,n){return e(n)})},cI=function(e){return function(t){for(var n=[],r=[],i=0;i<t.length;i++){var o=e(i,t[i]);o._tag==="Left"?n.push(o.left):r.push(o.right)}return Me(n,r)}},r3=function(e){return function(t){return t.filter(function(n,r){return e(r,n)})}},uI=function(e){return function(t){return t.map(function(n,r){return e(t.slice(r))})}},Moe=uI(z),h0=function(e){return function(t){return function(n){return n.reduce(function(r,i,o){return e.concat(r,t(o,i))},e.empty)}}},lI=function(e,t){return SA(e,function(n,r,i){return t(r,i)})},dI=function(e){var t=h0(e);return function(n){return t(function(r,i){return n(i)})}},SA=function(e,t){return function(n){for(var r=n.length,i=e,o=0;o<r;o++)i=t(o,i,n[o]);return i}},fI=function(e,t){return A0(e,function(n,r,i){return t(r,i)})},A0=function(e,t){return function(n){return n.reduceRight(function(r,i,o){return t(o,i,r)},e)}},i3=function(e){var t=pI(e);return function(n){return t(function(r,i){return n(i)})}},CA=function(e){return function(t){return Du(t,e.of(uf()),function(n,r){return e.ap(e.map(n,function(i){return function(o){return _(i,o0(o))}}),r)})}},pI=function(e){return function(t){return SA(e.of(uf()),function(n,r,i){return e.ap(e.map(r,function(o){return function(a){return _(o,o0(a))}}),t(n,i))})}},Foe=function(e){var t=SI(e);return function(n){return function(r){return t(r,n)}}},Loe=function(e){var t=CI(e);return function(n){return function(r){return t(r,n)}}},hI=function(e,t){for(var n=[],r=e;;){var i=t(r);if(St(i)){var o=i.value,a=o[0],s=o[1];n.push(a),r=s}else break}return n},ut="ReadonlyArray",o3=function(e){return{show:function(t){return"[".concat(t.map(e.show).join(", "),"]")}}},a3=function(){return{concat:function(e,t){return Mo(e)?t:Mo(t)?e:e.concat(t)}}},Boe=function(){return{concat:a3().concat,empty:It}},s3=function(e){return Ei(function(t,n){return t.length===n.length&&t.every(function(r,i){return e.equals(r,n[i])})})},c3=function(e){return Bu(function(t,n){for(var r=t.length,i=n.length,o=Math.min(r,i),a=0;a<o;a++){var s=e.compare(t[a],n[a]);if(s!==0)return s}return n0.compare(r,i)})},u3=function(e){var t=YT(e);return{concat:function(n,r){return t(r)(n)}}},Doe=function(e){return{concat:u3(e).concat,empty:It}},joe=function(e){var t=GT(e);return{concat:function(n,r){return t(r)(n)}}},Uoe=function(e){var t=JT(e);return{concat:function(n,r){return t(r)(n)}}},AI={URI:ut,map:xn},Poe=qe(AI),l3={URI:ut,of:ju},Noe={URI:ut,map:xn,mapWithIndex:c0},m0={URI:ut,map:xn,ap:ec},Woe=Dt(m0),Koe=jt(m0),qoe={URI:ut,map:xn,ap:ec,of:ju},mI={URI:ut,map:xn,ap:ec,chain:yA},Voe={URI:ut,map:xn,ap:ec,of:ju,chain:yA},zoe=ct(mI),Qoe={URI:ut,unfold:hI},Hoe={URI:ut,map:xn,alt:ZT},d3={URI:ut,zero:uf},Yoe=of(d3,l3),Goe={URI:ut,map:xn,ap:ec,of:ju,alt:ZT,zero:uf},Joe={URI:ut,map:xn,extend:HN},gI={URI:ut,compact:df,separate:lf},Zoe={URI:ut,map:xn,compact:df,separate:lf,filter:u0,filterMap:l0,partition:d0,partitionMap:f0},Xoe={URI:ut,map:xn,mapWithIndex:c0,compact:df,separate:lf,filter:u0,filterMap:l0,partition:d0,partitionMap:f0,partitionMapWithIndex:VN,partitionWithIndex:qN,filterMapWithIndex:zN,filterWithIndex:QN},eae={URI:ut,reduce:Du,foldMap:sf,reduceRight:cf},tae={URI:ut,reduce:Du,foldMap:sf,reduceRight:cf,reduceWithIndex:XT,foldMapWithIndex:eI,reduceRightWithIndex:tI},vI={URI:ut,map:xn,reduce:Du,foldMap:sf,reduceRight:cf,traverse:p0,sequence:CA},nae={URI:ut,map:xn,mapWithIndex:c0,reduce:Du,foldMap:sf,reduceRight:cf,reduceWithIndex:XT,foldMapWithIndex:eI,reduceRightWithIndex:tI,traverse:p0,sequence:CA,traverseWithIndex:YN},yI=function(e){return function(t){for(var n=Yie([],e(t),!0),r=[];n.length>0;){var i=n.shift();on(i)?n.unshift.apply(n,e(i.left)):r.push(i.right)}return r}},rae={URI:ut,map:xn,ap:ec,chain:yA,chainRec:nI},bI=function(e){return function(t){var n=e(t),r=[],i=[];function o(u){on(u)?e(u.left).forEach(function(l){return r.push(l)}):i.push(u.right)}for(var a=0,s=n;a<s.length;a++){var c=s[a];o(c)}for(;r.length>0;)o(r.shift());return i}},iae={URI:ut,map:xn,ap:ec,chain:yA,chainRec:rI},SI=eo(vI,gI),CI=Xi(vI,gI),f3={URI:ut,map:xn,compact:df,separate:lf,filter:u0,filterMap:l0,partition:d0,partitionMap:f0,reduce:Du,foldMap:sf,reduceRight:cf,traverse:p0,sequence:CA,wither:SI,wilt:CI},oae=HT(f3),p3={URI:ut,fromEither:wN},aae=ei(p3),sae=Ly,g0=function(e,t,n){return Bt(n)?Z_(e,t,n):n},h3=function(e,t){var n=t.slice();return n.splice(e,1),n},cae=function(e){return e.slice()},uae=function(e){return Mo(e)?It:e.slice()},It=aA;function A3(e){return function(t){return t.every(e)}}var m3=function(e){return function(t){return t.some(e)}},lae=m3,g3=function(e){var t=ST(e);return function(n){return _N(function(){return e.empty},t(n))}},dae=ju(sn),fae=Pt(AI),pae=Nt(mI),hae=Ut(m0),Aae=hP,mae=jP,gae=UP,vae=NN,yae={URI:ut,compact:df,separate:lf,map:xn,ap:ec,of:ju,chain:yA,filter:u0,filterMap:l0,partition:d0,partitionMap:f0,mapWithIndex:c0,partitionMapWithIndex:VN,partitionWithIndex:qN,filterMapWithIndex:zN,filterWithIndex:QN,alt:ZT,zero:uf,unfold:hI,reduce:Du,foldMap:sf,reduceRight:cf,traverse:p0,sequence:CA,reduceWithIndex:XT,foldMapWithIndex:eI,reduceRightWithIndex:tI,traverseWithIndex:YN,extend:HN,wither:SI,wilt:CI};const bae=Object.freeze(Object.defineProperty({__proto__:null,Alt:Hoe,Alternative:Goe,Applicative:qoe,Apply:m0,Chain:mI,ChainRecBreadthFirst:iae,ChainRecDepthFirst:rae,Compactable:gI,Do:dae,Extend:Joe,Filterable:Zoe,FilterableWithIndex:Xoe,Foldable:eae,FoldableWithIndex:tae,FromEither:p3,Functor:AI,FunctorWithIndex:Noe,Monad:Voe,Pointed:l3,Traversable:vI,TraversableWithIndex:nae,URI:ut,Unfoldable:Qoe,Witherable:f3,Zero:d3,_chainRecBreadthFirst:rI,_chainRecDepthFirst:nI,alt:JN,altW:GN,ap:ZN,apFirst:Woe,apS:hae,apSecond:Koe,append:o0,appendW:Zie,bind:pae,bindTo:fae,chain:bA,chainFirst:zoe,chainRecBreadthFirst:bI,chainRecDepthFirst:yI,chainWithIndex:$N,chop:Ioe,chunksOf:Eoe,compact:df,comprehension:$oe,concat:koe,concatW:KN,cons:mae,deleteAt:goe,difference:JT,dropLeft:foe,dropLeftWhile:hoe,dropRight:poe,duplicate:Moe,elem:vA,empty:It,every:A3,exists:lae,extend:uI,filter:e3,filterE:oae,filterMap:aI,filterMapWithIndex:oI,filterWithIndex:r3,findFirst:s0,findFirstMap:FN,findIndex:a0,findLast:LN,findLastIndex:DN,findLastMap:BN,flap:Poe,flatten:Ooe,foldLeft:toe,foldMap:dI,foldMapWithIndex:h0,foldRight:noe,fromArray:uae,fromEither:wN,fromEitherK:aae,fromOption:CN,fromOptionK:Roe,fromPredicate:eoe,getDifferenceMagma:Uoe,getEq:s3,getIntersectionSemigroup:joe,getMonoid:Boe,getOrd:c3,getSemigroup:a3,getShow:o3,getUnionMonoid:Doe,getUnionSemigroup:u3,guard:Yoe,head:kN,init:soe,insertAt:Aoe,intercalate:g3,intersection:GT,intersperse:woe,isEmpty:Mo,isNonEmpty:Bt,isOutOfBound:af,last:ON,lefts:boe,lookup:du,makeBy:SN,map:iI,mapWithIndex:XN,match:_N,matchLeft:IN,matchLeftW:TN,matchRight:RN,matchRightW:EN,matchW:xN,modifyAt:jN,of:ju,partition:t3,partitionMap:n3,partitionMapWithIndex:cI,partitionWithIndex:sI,prepend:Gie,prependAll:NN,prependToAll:vae,prependW:Jie,range:Aae,readonlyArray:yae,reduce:lI,reduceRight:fI,reduceRightWithIndex:A0,reduceWithIndex:SA,replicate:Xie,reverse:voe,rights:yoe,rotate:xoe,scanLeft:roe,scanRight:ioe,separate:lf,sequence:CA,size:ooe,snoc:gae,some:m3,sort:Soe,sortBy:Toe,spanLeft:doe,splitAt:WN,tail:aoe,takeLeft:coe,takeLeftWhile:loe,takeRight:uoe,toArray:cae,traverse:i3,traverseWithIndex:pI,unfold:hI,union:YT,uniq:_oe,unsafeDeleteAt:h3,unsafeInsertAt:sae,unsafeUpdateAt:g0,unzip:Coe,updateAt:moe,wilt:Loe,wither:Foe,zero:uf,zip:PN,zipWith:UN},Symbol.toStringTag,{value:"Module"}));var Ls=function(e){return e.length===0},Vt=$a,Sae=vd,Cae=CT,v0=fA,wae=wT,v3=function(e,t){return e<=0?[]:Hy(t)(e)},xae=function(e,t){return v3(e,function(){return t})};function _ae(e){return function(t){return e(t)?[t]:[]}}var y3=function(e){return qt(e)?[]:[e.value]},b3=function(e){return on(e)?[]:[e.right]},S3=function(e,t){return function(n){return Vt(n)?t(n):e()}},Tae=S3,C3=function(e,t){return function(n){return Vt(n)?t(Ri(n),Hi(n)):e()}},w3=C3,Iae=w3,x3=function(e,t){return function(n){return Vt(n)?t(rf(n),nf(n)):e()}},_3=x3,Eae=_3,T3=function(e){return function(t){for(var n=[],r=0;r<t.length;r++)n.push.apply(n,e(r,t[r]));return n}},Rae=function(e,t){return function(n){var r=n.length,i=new Array(r+1);i[0]=e;for(var o=0;o<r;o++)i[o+1]=t(i[o],n[o]);return i}},$ae=function(e,t){return function(n){var r=n.length,i=new Array(r+1);i[r]=e;for(var o=r-1;o>=0;o--)i[o]=t(n[o],i[o+1]);return i}},kae=function(e){return e.length},wA=Qy,Oae=du,Mae=kN,Fae=ON,Lae=function(e){return Vt(e)?Ae(Hi(e)):we},Bae=function(e){return Vt(e)?Ae(rf(e)):we},Dae=function(e){return function(t){return wA(e,t)?jn(t):t.slice(0,e)}},jae=function(e){return function(t){return wA(e,t)?jn(t):e===0?[]:t.slice(-e)}};function Uae(e){return function(t){for(var n=[],r=0,i=t;r<i.length;r++){var o=i[r];if(!e(o))break;n.push(o)}return n}}var I3=function(e,t){for(var n=e.length,r=0;r<n&&t(e[r]);r++);return r};function Pae(e){return function(t){var n=O3(I3(t,e))(t),r=n[0],i=n[1];return{init:r,rest:i}}}var Nae=function(e){return function(t){return e<=0||Ls(t)?jn(t):e>=t.length?[]:t.slice(e,t.length)}},Wae=function(e){return function(t){return e<=0||Ls(t)?jn(t):e>=t.length?[]:t.slice(0,t.length-e)}};function Kae(e){return function(t){return t.slice(I3(t,e))}}var qae=a0;function Vae(e){return s0(e)}var zae=FN;function Qae(e){return LN(e)}var Hae=BN,Yae=DN,jn=function(e){return e.slice()},Gae=function(e,t){return function(n){return e<0||e>n.length?we:Ae(s6(e,t,n))}},Jae=function(e,t){return E3(e,function(){return t})},Zae=function(e){return function(t){return wA(e,t)?we:Ae(u6(e,t))}},E3=function(e,t){return function(n){return wA(e,n)?we:Ae(c6(e,t(n[e]),n))}},Xae=function(e){return Ls(e)?[]:e.slice().reverse()},ese=function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];r._tag==="Right"&&t.push(r.right)}return t},tse=function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];r._tag==="Left"&&t.push(r.left)}return t},nse=function(e){return function(t){return t.length<=1?jn(t):t.slice().sort(e.compare)}},R3=function(e,t,n){for(var r=[],i=Math.min(e.length,t.length),o=0;o<i;o++)r[o]=n(e[o],t[o]);return r};function $3(e,t){return t===void 0?function(n){return $3(n,e)}:R3(e,t,function(n,r){return[n,r]})}var rse=function(e){for(var t=[],n=[],r=0;r<e.length;r++)t[r]=e[r][0],n[r]=e[r][1];return[t,n]},k3=function(e){var t=Gy(e);return function(n){return Vt(n)?t(n):[]}},ise=function(e){var t=YP(e);return function(n){return Vt(n)?t(n):jn(n)}},ose=function(e){var t=ET(e);return function(n){return Vt(n)?t(n):jn(n)}},wI=vA,ase=function(e){var t=TT(e);return function(n){return Vt(n)?t(n):jn(n)}},sse=function(e){var t=PP(e);return function(n){return Vt(n)?t(n):jn(n)}},cse=function(e){var t=kT(e);return function(n){return Vt(n)?t(n):[]}},O3=function(e){return function(t){return e>=1&&Vt(t)?Jy(e)(t):Ls(t)?[jn(t),[]]:[[],jn(t)]}},use=function(e){var t=XP(e);return function(n){return Vt(n)?t(n):[]}},lse=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return y3(e.apply(void 0,t))}};function dse(e,t,n){n===void 0&&(n=function(){return!0});var r=function(i,o){return Vt(o)?_(Ri(o),_A(function(a){return r(_(i,v0(a)),Hi(o))})):n.apply(void 0,i)?[t.apply(void 0,i)]:[]};return r([],e)}var M3=function(e){return function(t){return Ls(t)?jn(e):Ls(e)?jn(t):t.concat(e)}},fse=M3;function xI(e){var t=IT(e);return function(n,r){if(r===void 0){var i=xI(e);return function(o){return i(o,n)}}return Vt(n)&&Vt(r)?t(r)(n):Vt(n)?jn(n):jn(r)}}function _I(e){var t=wI(e);return function(n,r){if(r===void 0){var i=_I(e);return function(o){return i(o,n)}}return n.filter(function(o){return t(o,r)})}}function TI(e){var t=wI(e);return function(n,r){if(r===void 0){var i=TI(e);return function(o){return i(o,n)}}return n.filter(function(o){return!t(o,r)})}}var _n=function(e,t){return _(e,kI(t))},y0=function(e,t){return _(e,N3(t))},tc=function(e,t){return _(e,P3(t))},xA=function(e,t){return _(e,_A(t))},b0=function(e,t){return _(e,W3(t))},S0=function(e,t){return _(e,MI(t))},C0=function(e,t){return _(e,K3(t))},w0=function(e,t){return _(e,q3(t))},F3=function(e,t){return _(e,FI(t))},L3=function(e,t){return _(e,LI(t))},II=function(e,t){return _(e,z3(t))},Uu=function(e,t,n){return _(e,G3(t,n))},ff=function(e){var t=H3(e);return function(n,r){return _(n,t(r))}},pf=function(e,t,n){return _(e,J3(t,n))},EI=function(e,t,n){return _(e,DI(t,n))},RI=function(e){var t=Y3(e);return function(n,r){return _(n,t(r))}},$I=function(e,t,n){return _(e,Z3(t,n))},B3=function(e,t){return _(e,OI(t))},D3=function(e,t){return _(e,Q3(t))},j3=function(e,t){return _(e,BI(t))},x0=function(e){var t=_0(e);return function(n,r){return _(n,t(r))}},U3=function(e){var t=jI(e);return function(n,r){return _(n,t(r))}},pse=nI,hse=rI,nc=Xs,hf=function(){return[]},kI=function(e){return function(t){return t.map(function(n){return e(n)})}},P3=function(e){return _A(function(t){return _(e,kI(t))})},_A=function(e){return function(t){return _(t,T3(function(n,r){return e(r)}))}},Ase=_A(z),N3=function(e){return function(t){return t.map(function(n,r){return e(r,n)})}},OI=function(e){return function(t){for(var n=[],r=0;r<t.length;r++){var i=e(r,t[r]);St(i)&&n.push(i.value)}return n}},MI=function(e){return OI(function(t,n){return e(n)})},Af=MI(z),mf=function(e){for(var t=[],n=[],r=0,i=e;r<i.length;r++){var o=i[r];o._tag==="Left"?t.push(o.left):n.push(o.right)}return Me(t,n)},W3=function(e){return function(t){return t.filter(e)}},K3=function(e){return FI(function(t,n){return e(n)})},FI=function(e){return function(t){for(var n=[],r=[],i=0;i<t.length;i++){var o=t[i];e(i,o)?r.push(o):n.push(o)}return Me(n,r)}},q3=function(e){return LI(function(t,n){return e(n)})},LI=function(e){return function(t){for(var n=[],r=[],i=0;i<t.length;i++){var o=e(i,t[i]);o._tag==="Left"?n.push(o.left):r.push(o.right)}return Me(n,r)}},V3=function(e){return function(t){return t.concat(e())}},z3=V3,Q3=function(e){return function(t){return t.filter(function(n,r){return e(r,n)})}},BI=function(e){return function(t){return t.map(function(n,r){return e(t.slice(r))})}},mse=BI(z),H3=dI,Y3=h0,G3=lI,DI=SA,J3=fI,Z3=A0,_0=function(e){var t=jI(e);return function(n){return t(function(r,i){return n(i)})}},TA=function(e){return function(t){return Uu(t,e.of(hf()),function(n,r){return e.ap(e.map(n,function(i){return function(o){return _(i,v0(o))}}),r)})}},jI=function(e){return function(t){return DI(e.of(hf()),function(n,r,i){return e.ap(e.map(r,function(o){return function(a){return _(o,v0(a))}}),t(n,i))})}},gse=function(e){var t=VI(e);return function(n){return function(r){return t(r,n)}}},vse=function(e){var t=zI(e);return function(n){return function(r){return t(r,n)}}},UI=function(e,t){for(var n=[],r=e;;){var i=t(r);if(St(i)){var o=i.value,a=o[0],s=o[1];n.push(a),r=s}else break}return n},lt="Array",yse=o3,X3=function(){return{concat:function(e,t){return e.concat(t)}}},PI=function(){return{concat:X3().concat,empty:[]}},e6=s3,bse=c3,t6=function(e){var t=xI(e);return{concat:function(n,r){return t(r)(n)}}},Sse=function(e){return{concat:t6(e).concat,empty:[]}},Cse=function(e){var t=_I(e);return{concat:function(n,r){return t(r)(n)}}},wse=function(e){var t=TI(e);return{concat:function(n,r){return t(r)(n)}}},NI={URI:lt,map:_n},xse=qe(NI),n6={URI:lt,of:nc},_se={URI:lt,map:_n,mapWithIndex:y0},T0={URI:lt,map:_n,ap:tc},Tse=Dt(T0),Ise=jt(T0),Ese={URI:lt,map:_n,ap:tc,of:nc},WI={URI:lt,map:_n,ap:tc,chain:xA},Rse=ct(WI),$se={URI:lt,map:_n,ap:tc,of:nc,chain:xA},kse={URI:lt,unfold:UI},Ose={URI:lt,map:_n,alt:II},r6={URI:lt,zero:hf},Mse=of(r6,n6),Fse={URI:lt,map:_n,ap:tc,of:nc,alt:II,zero:hf},Lse={URI:lt,map:_n,extend:j3},KI={URI:lt,compact:Af,separate:mf},Bse={URI:lt,map:_n,compact:Af,separate:mf,filter:b0,filterMap:S0,partition:C0,partitionMap:w0},Dse={URI:lt,map:_n,mapWithIndex:y0,compact:Af,separate:mf,filter:b0,filterMap:S0,partition:C0,partitionMap:w0,partitionMapWithIndex:L3,partitionWithIndex:F3,filterMapWithIndex:B3,filterWithIndex:D3},i6={URI:lt,reduce:Uu,foldMap:ff,reduceRight:pf},jse={URI:lt,reduce:Uu,foldMap:ff,reduceRight:pf,reduceWithIndex:EI,foldMapWithIndex:RI,reduceRightWithIndex:$I},qI={URI:lt,map:_n,reduce:Uu,foldMap:ff,reduceRight:pf,traverse:x0,sequence:TA},Use={URI:lt,map:_n,mapWithIndex:y0,reduce:Uu,foldMap:ff,reduceRight:pf,reduceWithIndex:EI,foldMapWithIndex:RI,reduceRightWithIndex:$I,traverse:x0,sequence:TA,traverseWithIndex:U3},VI=eo(qI,KI),zI=Xi(qI,KI),o6={URI:lt,map:_n,compact:Af,separate:mf,filter:b0,filterMap:S0,partition:C0,partitionMap:w0,reduce:Uu,foldMap:ff,reduceRight:pf,traverse:x0,sequence:TA,wither:VI,wilt:zI},Pse=yI,Nse={URI:lt,map:_n,ap:tc,chain:xA,chainRec:pse},Wse=bI,Kse={URI:lt,map:_n,ap:tc,chain:xA,chainRec:hse},qse=HT(o6),a6={URI:lt,fromEither:b3},Vse=ei(a6),s6=xT,c6=function(e,t,n){return Vt(n)?_T(e,t,n):[]},u6=function(e,t){var n=t.slice();return n.splice(e,1),n},zse=A3,l6=function(e){return function(t){return t.some(e)}},Qse=l6,Hse=g3,Yse=nc(sn),Gse=Pt(NI),Jse=Nt(WI),Zse=Ut(T0),Xse=NP,ece=[],tce=hN,nce=AN,rce=k3,ice={URI:lt,compact:Af,separate:mf,map:_n,ap:tc,of:nc,chain:xA,filter:b0,filterMap:S0,partition:C0,partitionMap:w0,mapWithIndex:y0,partitionMapWithIndex:L3,partitionWithIndex:F3,filterMapWithIndex:B3,filterWithIndex:D3,alt:II,zero:hf,unfold:UI,reduce:Uu,foldMap:ff,reduceRight:pf,traverse:x0,sequence:TA,reduceWithIndex:EI,foldMapWithIndex:RI,reduceRightWithIndex:$I,traverseWithIndex:U3,extend:j3,wither:VI,wilt:zI};const oce=Object.freeze(Object.defineProperty({__proto__:null,Alt:Ose,Alternative:Fse,Applicative:Ese,Apply:T0,Chain:WI,ChainRecBreadthFirst:Kse,ChainRecDepthFirst:Nse,Compactable:KI,Do:Yse,Extend:Lse,Filterable:Bse,FilterableWithIndex:Dse,Foldable:i6,FoldableWithIndex:jse,FromEither:a6,Functor:NI,FunctorWithIndex:_se,Monad:$se,Pointed:n6,Traversable:qI,TraversableWithIndex:Use,URI:lt,Unfoldable:kse,Witherable:o6,Zero:r6,alt:z3,altW:V3,ap:P3,apFirst:Tse,apS:Zse,apSecond:Ise,append:v0,appendW:wae,array:ice,bind:Jse,bindTo:Gse,chain:_A,chainFirst:Rse,chainRecBreadthFirst:Wse,chainRecDepthFirst:Pse,chainWithIndex:T3,chop:cse,chunksOf:use,compact:Af,comprehension:dse,concat:fse,concatW:M3,cons:tce,copy:jn,deleteAt:Zae,difference:TI,dropLeft:Nae,dropLeftWhile:Kae,dropRight:Wae,duplicate:mse,elem:wI,empty:ece,every:zse,exists:Qse,extend:BI,filter:W3,filterE:qse,filterMap:MI,filterMapWithIndex:OI,filterWithIndex:Q3,findFirst:Vae,findFirstMap:zae,findIndex:qae,findLast:Qae,findLastIndex:Yae,findLastMap:Hae,flap:xse,flatten:Ase,foldLeft:Iae,foldMap:H3,foldMapWithIndex:Y3,foldRight:Eae,fromEither:b3,fromEitherK:Vse,fromOption:y3,fromOptionK:lse,fromPredicate:_ae,getDifferenceMagma:wse,getEq:e6,getIntersectionSemigroup:Cse,getMonoid:PI,getOrd:bse,getSemigroup:X3,getShow:yse,getUnionMonoid:Sse,getUnionSemigroup:t6,guard:Mse,head:Mae,init:Bae,insertAt:Gae,intercalate:Hse,intersection:_I,intersperse:ise,isEmpty:Ls,isNonEmpty:Vt,isOutOfBound:wA,last:Fae,lefts:tse,lookup:Oae,makeBy:v3,map:kI,mapWithIndex:N3,match:Tae,matchLeft:w3,matchLeftW:C3,matchRight:_3,matchRightW:x3,matchW:S3,modifyAt:E3,of:nc,partition:K3,partitionMap:q3,partitionMapWithIndex:LI,partitionWithIndex:FI,prepend:Sae,prependAll:k3,prependToAll:rce,prependW:Cae,range:Xse,reduce:G3,reduceRight:J3,reduceRightWithIndex:Z3,reduceWithIndex:DI,replicate:xae,reverse:Xae,rights:ese,rotate:ose,scanLeft:Rae,scanRight:$ae,separate:mf,sequence:TA,size:kae,snoc:nce,some:l6,sort:nse,sortBy:sse,spanLeft:Pae,splitAt:O3,tail:Lae,takeLeft:Dae,takeLeftWhile:Uae,takeRight:jae,traverse:_0,traverseWithIndex:jI,unfold:UI,union:xI,uniq:ase,unsafeDeleteAt:u6,unsafeInsertAt:s6,unsafeUpdateAt:c6,unzip:rse,updateAt:Jae,wilt:vse,wither:gse,zero:hf,zip:$3,zipWith:R3},Symbol.toStringTag,{value:"Module"})),ace=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var sce=function(e){return typeof e=="boolean"},d6=function(e,t){return function(n){return n?t():e()}},f6=d6,p6=f6,cce=p6,h6={equals:function(e,t){return e===t}},uce={meet:function(e,t){return e&&t},join:function(e,t){return e||t},zero:!1,one:!0,implies:function(e,t){return!e||t},not:function(e){return!e}},A6={concat:function(e,t){return e&&t}},m6={concat:function(e,t){return e||t}},lce={concat:A6.concat,empty:!0},dce={concat:m6.concat,empty:!1},fce={equals:h6.equals,compare:function(e,t){return e<t?-1:e>t?1:0}},pce={show:function(e){return JSON.stringify(e)}};const hce=Object.freeze(Object.defineProperty({__proto__:null,BooleanAlgebra:uce,Eq:h6,MonoidAll:lce,MonoidAny:dce,Ord:fce,SemigroupAll:A6,SemigroupAny:m6,Show:pce,fold:cce,foldW:f6,isBoolean:sce,match:p6,matchW:d6},Symbol.toStringTag,{value:"Module"}));var g6=function(e){return{meet:function(t,n){return e.join(t,n)},join:function(t,n){return e.meet(t,n)},zero:e.one,one:e.zero,implies:function(t,n){return e.join(e.not(t),n)},not:e.not}},Ace={meet:function(){},join:function(){},zero:void 0,one:void 0,implies:function(){},not:function(){}},mce=g6,gce={meet:function(e,t){return e&&t},join:function(e,t){return e||t},zero:!1,one:!0,implies:function(e,t){return!e||t},not:function(e){return!e}},vce=FU;const yce=Object.freeze(Object.defineProperty({__proto__:null,booleanAlgebraBoolean:gce,booleanAlgebraVoid:Ace,getDualBooleanAlgebra:mce,getFunctionBooleanAlgebra:vce,reverse:g6},Symbol.toStringTag,{value:"Module"}));var bce=function(e){return nP(e)(e.bottom,e.top)},Sce=function(e){var t=N_(e);return{equals:t.equals,compare:t.compare,top:e.bottom,bottom:e.top}},Cce={equals:gv.equals,compare:gv.compare,top:1/0,bottom:-1/0};const wce=Object.freeze(Object.defineProperty({__proto__:null,boundedNumber:Cce,clamp:bce,reverse:Sce},Symbol.toStringTag,{value:"Module"}));function v6(e){return{meet:Ey(e),join:Ry(e)}}const xce=Object.freeze(Object.defineProperty({__proto__:null,getMinMaxDistributiveLattice:v6},Symbol.toStringTag,{value:"Module"}));function _ce(e){var t=v6(e);return function(n,r){return{join:t.join,meet:t.meet,zero:n,one:r}}}const Tce=Object.freeze(Object.defineProperty({__proto__:null,getMinMaxBoundedDistributiveLattice:_ce},Symbol.toStringTag,{value:"Module"})),Ice=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),Ece=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),Rce=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),$ce=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var QI=function(e,t){for(var n=t(e);n._tag==="Left";)n=t(n.left);return n.right};const kce=Object.freeze(Object.defineProperty({__proto__:null,tailRec:QI},Symbol.toStringTag,{value:"Module"}));function HI(e,t){return function(n,r){return t.compose(e.right(r),e.left(n))}}function y6(e,t){var n=HI(e,t);return function(r,i){return t.compose(e.promap(t.id(),function(o){return o._tag==="Left"?o.left:o.right},z),n(r,i))}}function Oce(e){return HI(e,e)}function Mce(e){return y6(e,e)}const Fce=Object.freeze(Object.defineProperty({__proto__:null,fanIn:y6,fanin:Mce,split:HI,splitChoice:Oce},Symbol.toStringTag,{value:"Module"})),Lce=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var Bce=function(e,t){return _(e,b6(t))},b6=function(e){return function(t){return Z(e,t)}},S6="Predicate",C6=function(){return{concat:function(e,t){return _(e,x6(t))}}},Dce=function(){return{concat:C6().concat,empty:DU}},w6=function(){return{concat:function(e,t){return _(e,_6(t))}}},jce=function(){return{concat:w6().concat,empty:D_}},Uce={URI:S6,contramap:Bce},ph=function(e){return function(t){return!e(t)}},x6=function(e){return function(t){return function(n){return t(n)||e(n)}}},_6=function(e){return function(t){return function(n){return t(n)&&e(n)}}};const Pce=Object.freeze(Object.defineProperty({__proto__:null,Contravariant:Uce,URI:S6,and:_6,contramap:b6,getMonoidAll:jce,getMonoidAny:Dce,getSemigroupAll:w6,getSemigroupAny:C6,not:ph,or:x6},Symbol.toStringTag,{value:"Module"}));var rt=we,Ct=Ae;function I0(e){return function(t){return e(t)?Ct(t):rt}}var E0=function(e){return e._tag==="Right"?rt:Ct(e.left)},IA=function(e){return e._tag==="Left"?rt:Ct(e.right)},ti=function(e,t){return _(e,Ko(t))},Pu=function(e,t){return _(e,R6(t))},R0=function(e,t){return _(e,EA(t))},$0=function(e,t,n){return _(e,k6(t,n))},k0=function(e){var t=O6(e);return function(n,r){return _(n,t(r))}},O0=function(e,t,n){return _(e,M6(t,n))},YI=function(e){var t=N6(e);return function(n,r){return _(n,t(r))}},GI=function(e,t){return _(e,L6(t))},hh=function(e,t){return _(e,D6(t))},JI=function(e,t){return _(e,j6(t))},T6=function(e,t){return _(e,tE(t))},ZI=function(e,t){return _(e,U6(t))},XI=function(e,t){return _(e,P6(t))},Gt="Option",Nce=function(e){return{show:function(t){return Ke(t)?"none":"some(".concat(e.show(t.value),")")}}},I6=function(e){return{equals:function(t,n){return t===n||(Ke(t)?Ke(n):Ke(n)?!1:e.equals(t.value,n.value))}}},Wce=function(e){return{equals:I6(e).equals,compare:function(t,n){return t===n?0:vv(t)?vv(n)?e.compare(t.value,n.value):1:-1}}},eE=function(e){return{concat:function(t,n){return Ke(t)?n:Ke(n)?t:Ct(e.concat(t.value,n.value))},empty:rt}},Ko=function(e){return function(t){return Ke(t)?rt:Ct(e(t.value))}},gf={URI:Gt,map:ti},ka=Ct,E6={URI:Gt,of:ka},R6=function(e){return function(t){return Ke(t)||Ke(e)?rt:Ct(t.value(e.value))}},vf={URI:Gt,map:ti,ap:Pu},$6={URI:Gt,map:ti,ap:Pu,of:ka},EA=function(e){return function(t){return Ke(t)?rt:e(t.value)}},RA={URI:Gt,map:ti,ap:Pu,chain:R0},Kce={URI:Gt,map:ti,ap:Pu,of:ka,chain:R0},k6=function(e,t){return function(n){return Ke(n)?e:t(e,n.value)}},O6=function(e){return function(t){return function(n){return Ke(n)?e.empty:t(n.value)}}},M6=function(e,t){return function(n){return Ke(n)?e:t(n.value,e)}},qce={URI:Gt,reduce:$0,foldMap:k0,reduceRight:O0},F6=function(e){return function(t){return Ke(t)?e():t}},L6=F6,Vce={URI:Gt,map:ti,alt:GI},M0=function(){return rt},B6={URI:Gt,zero:M0},zce=of(B6,E6),Qce={URI:Gt,map:ti,ap:Pu,of:ka,alt:GI,zero:M0},tE=function(e){return function(t){return Ke(t)?rt:Ct(e(t))}},Hce={URI:Gt,map:ti,extend:T6},yf=EA(z),Yce=Me(rt,rt),bf=function(e){return Ke(e)?Yce:Me(E0(e.value),IA(e.value))},Nu={URI:Gt,compact:yf,separate:bf},D6=function(e){return function(t){return Ke(t)?rt:e(t.value)?t:rt}},j6=function(e){return function(t){return Ke(t)?rt:e(t.value)}},U6=function(e){return function(t){return Me(hh(t,ph(e)),hh(t,e))}},P6=function(e){return Z(Ko(e),bf)},Oa={URI:Gt,map:ti,compact:yf,separate:bf,filter:hh,filterMap:JI,partition:ZI,partitionMap:XI},N6=function(e){return function(t){return function(n){return Ke(n)?e.of(rt):e.map(t(n.value),Ct)}}},F0=function(e){return function(t){return Ke(t)?e.of(rt):e.map(t.value,Ct)}},nE={URI:Gt,map:ti,reduce:$0,foldMap:k0,reduceRight:O0,traverse:YI,sequence:F0},rE=eo(nE,Nu),iE=Xi(nE,Nu),Gce=function(e){var t=rE(e);return function(n){return function(r){return t(r,n)}}},Jce=function(e){var t=iE(e);return function(n){return function(r){return t(r,n)}}},Zce={URI:Gt,map:ti,reduce:$0,foldMap:k0,reduceRight:O0,traverse:YI,sequence:F0,compact:yf,separate:bf,filter:hh,filterMap:JI,partition:ZI,partitionMap:XI,wither:rE,wilt:iE},oE=function(){return rt},Xce={URI:Gt,map:ti,ap:Pu,of:ka,chain:R0,throwError:oE},Sf=IA,L0={URI:Gt,fromEither:Sf},vv=St,Ke=function(e){return e._tag==="None"},aE=function(e,t){return function(n){return Ke(n)?e():t(n.value)}},eue=aE,Ma=aE,rc=Ma,W6=function(e){return function(t){return Ke(t)?e():t.value}},sE=W6,tue=qe(gf),nue=Dt(vf),rue=jt(vf),iue=yf,oue=ct(RA),aue=tE(z),sue=ei(L0),cue=Ea(L0,RA),uue=Ra(L0,RA),Wu=function(e){return e==null?rt:Ct(e)},K6=function(e){try{return Ct(e())}catch{return rt}},lue=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return K6(function(){return e.apply(void 0,t)})}},due=function(e){return Z(e,Wu)},q6=function(e){return function(t){return Ke(t)?rt:Wu(e(t.value))}},cE=Ma(jU,z),V6=Ma(j_,z);function z6(e){return function(t,n){if(n===void 0){var r=z6(e);return function(i){return r(t,i)}}return Ke(n)?!1:e.equals(t,n.value)}}var fue=function(e){return function(t){return Ke(t)?!1:e(t.value)}},pue=ka(sn),hue=Pt(gf),Aue=Nt(RA),mue=Ut(vf),Q6=ka(wn),B0=function(e){return function(t){var n=e(0,Xr(t));if(Ke(n))return rt;for(var r=[n.value],i=1;i<t.length;i++){var o=e(i,t[i]);if(Ke(o))return rt;r.push(o.value)}return Ct(r)}},uE=function(e){var t=B0(e);return function(n){return pt(n)?t(n):Q6}},gue=uE,H6=function(e){return uE(function(t,n){return e(n)})},vue=H6(z);function yue(e){return function(t){return vv(e(t))}}var bue=q6,Y6={URI:Gt,map:ti,of:ka,ap:Pu,chain:R0,reduce:$0,foldMap:k0,reduceRight:O0,traverse:YI,sequence:F0,zero:M0,alt:GI,extend:T6,compact:yf,separate:bf,filter:hh,filterMap:JI,partition:ZI,partitionMap:XI,wither:rE,wilt:iE,throwError:oE},Sue=cn(vf),Cue=Ii($6),G6=function(){return eE(H_())},wue=function(){return eE(Oy())};const xue=Object.freeze(Object.defineProperty({__proto__:null,Alt:Vce,Alternative:Qce,ApT:Q6,Applicative:$6,Apply:vf,Chain:RA,Compactable:Nu,Do:pue,Extend:Hce,Filterable:Oa,Foldable:qce,FromEither:L0,Functor:gf,Monad:Kce,MonadThrow:Xce,Pointed:E6,Traversable:nE,URI:Gt,Witherable:Zce,Zero:B6,alt:L6,altW:F6,ap:R6,apFirst:nue,apS:mue,apSecond:rue,bind:Aue,bindTo:hue,chain:EA,chainEitherK:cue,chainFirst:oue,chainFirstEitherK:uue,chainNullableK:q6,compact:yf,duplicate:aue,elem:z6,exists:fue,extend:tE,filter:D6,filterMap:j6,flap:tue,flatten:iue,fold:rc,foldMap:O6,foldW:eue,fromEither:Sf,fromEitherK:sue,fromNullable:Wu,fromNullableK:due,fromPredicate:I0,getApplyMonoid:Cue,getApplySemigroup:Sue,getEq:I6,getFirstMonoid:G6,getLastMonoid:wue,getLeft:E0,getMonoid:eE,getOrElse:sE,getOrElseW:W6,getOrd:Wce,getRefinement:yue,getRight:IA,getShow:Nce,guard:zce,isNone:Ke,isSome:vv,map:Ko,mapNullable:bue,match:Ma,matchW:aE,none:rt,of:ka,option:Y6,partition:U6,partitionMap:P6,reduce:k6,reduceRight:M6,separate:bf,sequence:F0,sequenceArray:vue,some:Ct,throwError:oE,toNullable:cE,toUndefined:V6,traverse:N6,traverseArray:H6,traverseArrayWithIndex:gue,traverseReadonlyArrayWithIndex:uE,traverseReadonlyNonEmptyArrayWithIndex:B0,tryCatch:K6,tryCatchK:lue,wilt:Jce,wither:Gce,zero:M0},Symbol.toStringTag,{value:"Module"}));function qo(e,t){return function(n){return e.map(n,t.compact)}}function Fa(e,t,n){var r=qo(e,t),i=Jd(e,n);return function(o){return Me(r(_(o,i(E0))),r(_(o,i(IA))))}}function _ue(e,t){var n=Zd(e,t).map;return{map:n,compact:qo(e,t),separate:Fa(e,t,t)}}const Tue=Object.freeze(Object.defineProperty({__proto__:null,compact:qo,getCompactableComposition:_ue,separate:Fa},Symbol.toStringTag,{value:"Module"}));var Iue=function(e){return function(){return console.log(e)}},Eue=function(e){return function(){return console.warn(e)}},Rue=function(e){return function(){return console.error(e)}},$ue=function(e){return function(){return console.info(e)}};const kue=Object.freeze(Object.defineProperty({__proto__:null,error:Rue,info:$ue,log:Iue,warn:Eue},Symbol.toStringTag,{value:"Module"}));var Cf=md;function Oue(e){return{show:function(t){return"make(".concat(e.show(t),")")}}}var Mue=z,Fue=z,Lue=z,Bue=z,Due=z,jue=z,Uue=z,Pue=z,Nue=z;function J6(e){return{URI:Ku,_E:void 0,map:lE,ap:function(t,n){return Cf(e.concat(t,n))}}}function Z6(e){var t=J6(e);return{URI:Ku,_E:void 0,map:t.map,ap:t.ap,of:function(){return Cf(e.empty)}}}var X6=function(e,t){return _(e,nW())},lE=function(e,t){return _(e,rW())},eW=function(e,t,n){return _(e,iW(t))},tW=function(e,t){return _(e,oW(t))},nW=function(){return md},rW=function(){return md},iW=function(e){return function(t){return Cf(e(t))}},oW=function(e){return function(t){return Cf(e(t))}},Ku="Const",aW={URI:Ku,map:lE},Wue=qe(aW),Kue={URI:Ku,contramap:X6},que={URI:Ku,bimap:eW,mapLeft:tW},Vue={URI:Ku,map:lE,contramap:X6,bimap:eW,mapLeft:tW};const zue=Object.freeze(Object.defineProperty({__proto__:null,Bifunctor:que,Contravariant:Kue,Functor:aW,URI:Ku,bimap:iW,const_:Vue,contramap:nW,flap:Wue,getApplicative:Z6,getApply:J6,getBooleanAlgebra:Nue,getBounded:Lue,getEq:Mue,getHeytingAlgebra:Pue,getMonoid:Due,getOrd:Fue,getRing:Uue,getSemigroup:Bue,getSemiring:jue,getShow:Oue,make:Cf,map:rW,mapLeft:oW},Symbol.toStringTag,{value:"Module"})),Que=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var Hue={equals:function(e,t){return e.valueOf()===t.valueOf()}},Yue={equals:function(e,t){return e.getDate()===t.getDate()}},Gue={equals:function(e,t){return e.getMonth()===t.getMonth()}},Jue={equals:function(e,t){return e.getFullYear()===t.getFullYear()}},Zue=_(n0,Iy(function(e){return e.valueOf()})),Xue=function(){return new Date},ele=function(){return new Date().getTime()};const tle=Object.freeze(Object.defineProperty({__proto__:null,Eq:Hue,Ord:Zue,create:Xue,eqDate:Yue,eqMonth:Gue,eqYear:Jue,now:ele},Symbol.toStringTag,{value:"Module"}));var Et=ba,Qe=Ys,Wn=function(e,t){return _(e,zu(t))},qu=function(e,t){return _(e,lW(t))},wf=function(e,t){return _(e,$i(t))},$A=function(e,t,n){return _(e,fW(t,n))},kA=function(e){return function(t,n){var r=pW(e);return _(t,r(n))}},OA=function(e,t,n){return _(e,hW(t,n))},D0=function(e){var t=AW(e);return function(n,r){return _(n,t(r))}},dE=function(e,t,n){return _(e,mE(t,n))},fE=function(e,t){return _(e,BA(t))},sW=function(e,t){return _(e,gW(t))},pE=function(e,t){return _(e,gE(t))},hE=function(e,t){return QI(t(e),function(n){return ae(n)?Qe(Et(n.left)):ae(n.right)?Et(t(n.right.left)):Qe(Qe(n.right.right))})},$t="Either",nle=function(e,t){return{show:function(n){return ae(n)?"left(".concat(e.show(n.left),")"):"right(".concat(t.show(n.right),")")}}},rle=function(e,t){return{equals:function(n,r){return n===r||(ae(n)?ae(r)&&e.equals(n.left,r.left):vE(r)&&t.equals(n.right,r.right))}}},MA=function(e){return{concat:function(t,n){return ae(n)?t:ae(t)?n:Qe(e.concat(t.right,n.right))}}},Vu=function(e){var t=Et(e.empty);return{URI:$t,_E:void 0,compact:function(n){return ae(n)?n:n.right._tag==="None"?t:Qe(n.right.value)},separate:function(n){return ae(n)?Me(n,n):ae(n.right)?Me(Qe(n.right.left),t):Me(t,Qe(n.right.right))}}},xf=function(e){var t=Et(e.empty),n=Vu(e),r=n.compact,i=n.separate,o=function(s,c){return ae(s)||c(s.right)?s:t},a=function(s,c){return ae(s)?Me(s,s):c(s.right)?Me(t,Qe(s.right)):Me(Qe(s.right),t)};return{URI:$t,_E:void 0,map:Wn,compact:r,separate:i,filter:o,filterMap:function(s,c){if(ae(s))return s;var u=c(s.right);return u._tag==="None"?t:Qe(u.value)},partition:a,partitionMap:function(s,c){if(ae(s))return Me(s,s);var u=c(s.right);return ae(u)?Me(Qe(u.left),t):Me(t,Qe(u.right))}}},ile=function(e){var t=xf(e),n=Vu(e);return{URI:$t,_E:void 0,map:Wn,compact:t.compact,separate:t.separate,filter:t.filter,filterMap:t.filterMap,partition:t.partition,partitionMap:t.partitionMap,traverse:D0,sequence:LA,reduce:$A,foldMap:kA,reduceRight:OA,wither:eo(Nw,n),wilt:Xi(Nw,n)}},ic=function(e){return{URI:$t,_E:void 0,map:Wn,ap:function(t,n){return ae(t)?ae(n)?Et(e.concat(t.left,n.left)):t:ae(n)?n:Qe(t.right(n.right))},of:Vo}},cW=function(e){return{URI:$t,_E:void 0,map:Wn,alt:function(t,n){if(vE(t))return t;var r=n();return ae(r)?Et(e.concat(t.left,r.left)):r}}},zu=function(e){return function(t){return ae(t)?t:Qe(e(t.right))}},oc={URI:$t,map:Wn},Vo=Qe,ole={URI:$t,of:Vo},uW=function(e){return function(t){return ae(t)?t:ae(e)?e:Qe(t.right(e.right))}},lW=uW,_f={URI:$t,map:Wn,ap:qu},dW={URI:$t,map:Wn,ap:qu,of:Vo},AE=function(e){return function(t){return ae(t)?t:e(t.right)}},$i=AE,FA={URI:$t,map:Wn,ap:qu,chain:wf},ale={URI:$t,map:Wn,ap:qu,of:Vo,chain:wf},fW=function(e,t){return function(n){return ae(n)?e:t(e,n.right)}},pW=function(e){return function(t){return function(n){return ae(n)?e.empty:t(n.right)}}},hW=function(e,t){return function(n){return ae(n)?e:t(n.right,e)}},sle={URI:$t,reduce:$A,foldMap:kA,reduceRight:OA},AW=function(e){return function(t){return function(n){return ae(n)?e.of(Et(n.left)):e.map(t(n.right),Qe)}}},LA=function(e){return function(t){return ae(t)?e.of(Et(t.left)):e.map(t.right,Qe)}},Nw={URI:$t,map:Wn,reduce:$A,foldMap:kA,reduceRight:OA,traverse:D0,sequence:LA},mE=function(e,t){return function(n){return ae(n)?Et(e(n.left)):Qe(t(n.right))}},BA=function(e){return function(t){return ae(t)?Et(e(t.left)):t}},cle={URI:$t,bimap:dE,mapLeft:fE},mW=function(e){return function(t){return ae(t)?e():t}},gW=mW,ule={URI:$t,map:Wn,alt:sW},gE=function(e){return function(t){return ae(t)?t:Qe(e(t))}},lle={URI:$t,map:Wn,extend:pE},dle={URI:$t,map:Wn,ap:qu,chain:wf,chainRec:hE},j0=Et,fle={URI:$t,map:Wn,ap:qu,of:Vo,chain:wf,throwError:j0},Tf={URI:$t,fromEither:z},ple=Gs(Tf),vW=Po(Tf),ae=on,vE=U_,yE=function(e,t){return function(n){return ae(n)?e(n.left):t(n.right)}},yW=yE,ac=yE,bE=ac,bW=function(e){return function(t){return ae(t)?e(t.left):t.right}},hle=bW,Ale=qe(oc),SW=Dt(_f),mle=SW,CW=jt(_f),gle=CW,wW=ct(FA),vle=wW,xW=AE(z),yle=xW,ble=gE(z),Sle=No(Tf),Cle=Fu(Tf,FA),_W=Lu(Tf,FA),wle=_W,TW=function(e){return ae(e)?Qe(e.left):Et(e.right)},IW=function(e){return function(t){return ae(t)?e(t.left):t}},EW=IW,SE=function(e){return function(t){return t==null?Et(e):Qe(t)}},Qu=function(e,t){try{return Qe(e())}catch(n){return Et(t(n))}},xle=function(e,t){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return Qu(function(){return e.apply(void 0,n)},t)}},RW=function(e){var t=SE(e);return function(n){return Z(n,t)}},_le=function(e){var t=RW(e);return function(n){return $i(t(n))}},$W=yW(z,z);function Tle(e){return e instanceof Error?e:new Error(String(e))}function kW(e){return function(t,n){if(n===void 0){var r=kW(e);return function(i){return r(t,i)}}return ae(n)?!1:e.equals(t,n.right)}}var Ile=function(e){return function(t){return ae(t)?!1:e(t.right)}},Ele=Vo(sn),Rle=Pt(oc),OW=Nt(FA),$le=OW,MW=Ut(_f),kle=MW,FW=Vo(wn),DA=function(e){return function(t){var n=e(0,Xr(t));if(ae(n))return n;for(var r=[n.right],i=1;i<t.length;i++){var o=e(i,t[i]);if(ae(o))return o;r.push(o.right)}return Qe(r)}},CE=function(e){var t=DA(e);return function(n){return pt(n)?t(n):FW}},Ole=CE,LW=function(e){return CE(function(t,n){return e(n)})},Mle=LW(z);function Fle(e,t){return Qu(function(){return JSON.parse(e)},t)}var Lle=function(e,t){return Qu(function(){var n=JSON.stringify(e);if(typeof n!="string")throw new Error("Converting unsupported structure to JSON");return n},t)},Ble={URI:$t,map:Wn,of:Vo,ap:qu,chain:wf,reduce:$A,foldMap:kA,reduceRight:OA,traverse:D0,sequence:LA,bimap:dE,mapLeft:fE,alt:sW,extend:pE,chainRec:hE,throwError:j0},Dle=cn(_f),jle=Ii(dW),Ule=function(e,t){return cn(ic(e))(t)},Ple=function(e,t){return Ii(ic(e))(t)};function Nle(e){var t=ic(e).ap,n=cW(e).alt;return{URI:$t,_E:void 0,map:Wn,of:Vo,chain:wf,bimap:dE,mapLeft:fE,reduce:$A,foldMap:kA,reduceRight:OA,extend:pE,traverse:D0,sequence:LA,chainRec:hE,throwError:j0,ap:t,alt:n}}const BW=Object.freeze(Object.defineProperty({__proto__:null,Alt:ule,ApT:FW,Applicative:dW,Apply:_f,Bifunctor:cle,Chain:FA,ChainRec:dle,Do:Ele,Extend:lle,Foldable:sle,FromEither:Tf,Functor:oc,Monad:ale,MonadThrow:fle,Pointed:ole,Traversable:Nw,URI:$t,alt:gW,altW:mW,ap:lW,apFirst:SW,apFirstW:mle,apS:MW,apSW:kle,apSecond:CW,apSecondW:gle,apW:uW,bimap:mE,bind:OW,bindTo:Rle,bindW:$le,chain:$i,chainFirst:wW,chainFirstW:vle,chainNullableK:_le,chainOptionK:Cle,chainW:AE,duplicate:ble,either:Ble,elem:kW,exists:Ile,extend:gE,filterOrElse:_W,filterOrElseW:wle,flap:Ale,flatten:yle,flattenW:xW,fold:bE,foldMap:pW,foldW:yW,fromNullable:SE,fromNullableK:RW,fromOption:vW,fromOptionK:Sle,fromPredicate:ple,getAltValidation:cW,getApplicativeValidation:ic,getApplyMonoid:jle,getApplySemigroup:Dle,getCompactable:Vu,getEq:rle,getFilterable:xf,getOrElse:hle,getOrElseW:bW,getSemigroup:MA,getShow:nle,getValidation:Nle,getValidationMonoid:Ple,getValidationSemigroup:Ule,getWitherable:ile,isLeft:ae,isRight:vE,left:Et,map:zu,mapLeft:BA,match:ac,matchW:yE,of:Vo,orElse:EW,orElseW:IW,parseJSON:Fle,reduce:fW,reduceRight:hW,right:Qe,sequence:LA,sequenceArray:Mle,stringifyJSON:Lle,swap:TW,throwError:j0,toError:Tle,toUnion:$W,traverse:AW,traverseArray:LW,traverseArrayWithIndex:Ole,traverseReadonlyArrayWithIndex:CE,traverseReadonlyNonEmptyArrayWithIndex:DA,tryCatch:Qu,tryCatchK:xle},Symbol.toStringTag,{value:"Module"}));function Hu(e){return Z(Qe,e.of)}function If(e){return Z(Et,e.of)}function Ef(e){return function(t){return e.map(t,Qe)}}function Rf(e){return function(t){return e.map(t,Et)}}function U0(e){return function(t){return Z(SE(t),e.of)}}function P0(e){var t=U0(e);return function(n){var r=t(n);return function(i){return Z(i,r)}}}function wE(e){var t=Yu(e),n=P0(e);return function(r){var i=n(r);return function(o){return t(i(o))}}}function $f(e){return Jd(e,oc)}function kf(e){return Ia(e,_f)}function Yu(e){return function(t){return function(n){return e.chain(n,function(r){return ae(r)?e.of(r):t(r.right)})}}}function Of(e){return function(t){return function(n){return e.chain(n,function(r){return ae(r)?t():e.of(r)})}}}function Mf(e){return function(t,n){return function(r){return e.map(r,mE(t,n))}}}function Ff(e){return function(t){return function(n){return e.map(n,BA(t))}}}function jA(e,t){return function(n){return function(r){return e.chain(r,ac(function(i){return e.map(n(),BA(function(o){return t.concat(i,o)}))},Hu(e)))}}}function UA(e){return function(t,n){return function(r){return e.map(r,ac(t,n))}}}function Lf(e){return function(t,n){return function(r){return e.chain(r,ac(t,n))}}}function Bf(e){return function(t){return function(n){return e.chain(n,ac(t,e.of))}}}function Gu(e){return function(t){return function(n){return e.chain(n,function(r){return ae(r)?t(r.left):e.of(r)})}}}function PA(e){var t=Gu(e);return function(n){return t(function(r){return e.map(n(r),function(i){return ae(i)?i:Et(r)})})}}function NA(e){return function(t){return function(n){return e.chain(n,ac(function(r){return e.map(t(r),Et)},function(r){return e.of(Qe(r))}))}}}function Df(e){return function(t){return e.map(t,TW)}}function WA(e){return function(t){return e.map(t,$W)}}function Wle(e){var t=kf(e),n=$f(e),r=Yu(e),i=Of(e),o=Mf(e),a=Ff(e),s=Lf(e),c=Bf(e),u=Gu(e);return{map:function(l,d){return _(l,n(d))},ap:function(l,d){return _(l,t(d))},of:Hu(e),chain:function(l,d){return _(l,r(d))},alt:function(l,d){return _(l,i(d))},bimap:function(l,d,p){return _(l,o(d,p))},mapLeft:function(l,d){return _(l,a(d))},fold:function(l,d,p){return _(l,s(d,p))},getOrElse:function(l,d){return _(l,c(d))},orElse:function(l,d){return _(l,u(d))},swap:Df(e),rightM:Ef(e),leftM:Rf(e),left:If(e)}}const Kle=Object.freeze(Object.defineProperty({__proto__:null,alt:Of,altValidation:jA,ap:kf,bimap:Mf,chain:Yu,chainNullableK:wE,fromNullable:U0,fromNullableK:P0,getEitherM:Wle,getOrElse:Bf,left:If,leftF:Rf,map:$f,mapLeft:Ff,match:UA,matchE:Lf,orElse:Gu,orElseFirst:PA,orLeft:NA,right:Hu,rightF:Ef,swap:Df,toUnion:WA},Symbol.toStringTag,{value:"Module"}));var qle="Endomorphism",DW=function(){return{concat:function(e,t){return Z(e,t)}}},jW=function(){return{concat:DW().concat,empty:z}};const Vle=Object.freeze(Object.defineProperty({__proto__:null,URI:qle,getMonoid:jW,getSemigroup:DW},Symbol.toStringTag,{value:"Module"})),zle=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));function UW(e,t){var n=t.zero,r=function(i,o){return e.equals(o,n)?i:r(o,t.mod(i,o))};return r}function Qle(e,t){var n=t.zero,r=UW(e,t);return function(i,o){return e.equals(i,n)||e.equals(o,n)?n:t.div(t.mul(i,o),r(i,o))}}var Hle={add:function(e,t){return e+t},zero:0,mul:function(e,t){return e*t},one:1,sub:function(e,t){return e-t},degree:function(e){return 1},div:function(e,t){return e/t},mod:function(e,t){return e%t}};const Yle=Object.freeze(Object.defineProperty({__proto__:null,fieldNumber:Hle,gcd:UW,lcm:Qle},Symbol.toStringTag,{value:"Module"}));function La(e,t){return function(n){return function(r){return e.map(r,function(i){return t.filter(i,n)})}}}function Ba(e,t){return function(n){return function(r){return e.map(r,function(i){return t.filterMap(i,n)})}}}function sc(e,t){var n=La(e,t);return function(r){var i=n(ph(r)),o=n(r);return function(a){return Me(i(a),o(a))}}}function cc(e,t){var n=Ba(e,t);return function(r){return function(i){return Me(_(i,n(function(o){return E0(r(o))})),_(i,n(function(o){return IA(r(o))})))}}}function Gle(e,t){var n=Zd(e,t).map,r=qo(e,t),i=Fa(e,t,t),o=La(e,t),a=Ba(e,t),s=sc(e,t),c=cc(e,t);return{map:n,compact:r,separate:i,filter:function(u,l){return _(u,o(l))},filterMap:function(u,l){return _(u,a(l))},partition:function(u,l){return _(u,s(l))},partitionMap:function(u,l){return _(u,c(l))}}}const Jle=Object.freeze(Object.defineProperty({__proto__:null,filter:La,filterMap:Ba,getFilterableComposition:Gle,partition:sc,partitionMap:cc},Symbol.toStringTag,{value:"Module"})),Zle=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));function PW(e,t){return function(n,r){return function(i){return e.reduce(i,n,function(o,a){return t.reduce(a,o,r)})}}}function NW(e,t){return function(n){var r=e.foldMap(n),i=t.foldMap(n);return function(o){return function(a){return r(a,function(s){return i(s,o)})}}}}function WW(e,t){return function(n,r){return function(i){return e.reduceRight(i,n,function(o,a){return t.reduceRight(o,a,r)})}}}function Xle(e,t){return function(n,r){return function(i){return t.reduce(i,e.of(n),function(o,a){return e.chain(o,function(s){return r(s,a)})})}}}function ede(e,t){return function(n,r){var i=function(o,a){var s=o.init,c=o.acc;return s?{init:!1,acc:a}:{init:!1,acc:e.concat(e.concat(c,n),a)}};return t.reduce(r,{init:!0,acc:e.empty},i).acc}}function KW(e){return function(t){return e.reduce(t,[],function(n,r){return n.push(r),n})}}function tde(e,t){var n=function(i,o){return e.ap(e.map(i,wr),o)},r=e.of(void 0);return function(i,o){return t.reduce(i,r,function(a,s){return n(a,o(s))})}}function nde(e,t){return function(n,r,i){return t.reduce(n,e.of(r),function(o,a){return e.chain(o,function(s){return i(s,a)})})}}var rde=KW;function xE(e,t){var n=PW(e,t),r=NW(e,t),i=WW(e,t);return{reduce:function(o,a,s){return _(o,n(a,s))},foldMap:function(o){var a=r(o);return function(s,c){return _(s,a(c))}},reduceRight:function(o,a,s){return _(o,i(a,s))}}}const ide=Object.freeze(Object.defineProperty({__proto__:null,foldM:nde,foldMap:NW,getFoldableComposition:xE,intercalate:ede,reduce:PW,reduceM:Xle,reduceRight:WW,toArray:rde,toReadonlyArray:KW,traverse_:tde},Symbol.toStringTag,{value:"Module"}));function qW(e,t){return function(n,r){return function(i){return e.reduceWithIndex(i,n,function(o,a,s){return t.reduceWithIndex(s,a,function(c,u,l){return r([o,c],u,l)})})}}}function VW(e,t){return function(n){var r=e.foldMapWithIndex(n),i=t.foldMapWithIndex(n);return function(o){return function(a){return r(a,function(s,c){return i(c,function(u,l){return o([s,u],l)})})}}}}function zW(e,t){return function(n,r){return function(i){return e.reduceRightWithIndex(i,n,function(o,a,s){return t.reduceRightWithIndex(a,s,function(c,u,l){return r([o,c],u,l)})})}}}function ode(e,t){var n=xE(e,t),r=qW(e,t),i=VW(e,t),o=zW(e,t);return{reduce:n.reduce,foldMap:n.foldMap,reduceRight:n.reduceRight,reduceWithIndex:function(a,s,c){return _(a,r(s,c))},foldMapWithIndex:function(a){var s=i(a);return function(c,u){return _(c,s(u))}},reduceRightWithIndex:function(a,s,c){return _(a,o(s,c))}}}const ade=Object.freeze(Object.defineProperty({__proto__:null,foldMapWithIndex:VW,getFoldableWithIndexComposition:ode,reduceRightWithIndex:zW,reduceWithIndex:qW},Symbol.toStringTag,{value:"Module"}));function zo(e){return function(t){return Z(t,e.fromIO)}}function Da(e,t){return function(n){var r=Z(n,e.fromIO);return function(i){return t.chain(i,r)}}}function ja(e,t){var n=ct(t);return function(r){return n(Z(r,e.fromIO))}}const sde=Object.freeze(Object.defineProperty({__proto__:null,chainFirstIOK:ja,chainIOK:Da,fromIOK:zo},Symbol.toStringTag,{value:"Module"}));var QW=function(){return z},cde=z,KA=function(e){return function(t){return function(n){return t(e(n))}}},qA=function(e){return function(t){return e(t)(t)}},ude=qA,Ua=function(e,t){return _(e,Ju(t))},VA=function(e,t){return _(e,GW(t))},_E=function(e,t){return _(e,JW(t))},HW=function(e,t){return _(e,XW(t))},N0=function(e,t,n){return _(e,e5(t,n))},Ju=function(e){return function(t){return function(n){return e(t(n))}}},YW=function(e){return function(t){return function(n){return t(n)(e(n))}}},GW=YW,Qo=wr,TE=function(e){return function(t){return function(n){return e(t(n))(n)}}},JW=TE,ZW=TE(z),lde=ZW,XW=function(e){return function(t){return Z(e,t)}},e5=function(e,t){return function(n){return function(r){return t(n(e(r)))}}},IE=function(){return z},EE=function(e){return function(t){var n=t[0],r=t[1];return[e(n),r]}},RE=function(e){return function(t){var n=t[0],r=t[1];return[n,e(r)]}},$E=function(e){return bE(function(t){return ba(e(t))},Qe)},kE=function(e){return bE(Et,function(t){return Ys(e(t))})},ki="Reader",yn={URI:ki,map:Ua},dde=qe(yn),OE={URI:ki,of:Qo},Pa={URI:ki,map:Ua,ap:VA},t5=Dt(Pa),fde=t5,n5=jt(Pa),pde=n5,r5={URI:ki,map:Ua,ap:VA,of:Qo},ME={URI:ki,map:Ua,ap:VA,chain:_E},Na={URI:ki,map:Ua,of:Qo,ap:VA,chain:_E},i5=ct(ME),hde=i5,Ade={URI:ki,map:Ua,promap:N0},mde={URI:ki,compose:HW,id:IE},gde={URI:ki,map:Ua,promap:N0,first:EE,second:RE},vde={URI:ki,map:Ua,promap:N0,left:$E,right:kE},yde=Pt(yn),o5=Nt(ME),bde=o5,Sde=Qo(sn),a5=Ut(Pa),Cde=a5,s5=Qo(wn),Zu=function(e){return function(t){return function(n){for(var r=[e(0,Xr(t))(n)],i=1;i<t.length;i++)r.push(e(i,t[i])(n));return r}}},FE=function(e){var t=Zu(e);return function(n){return pt(n)?t(n):s5}},wde=FE,c5=function(e){return FE(function(t,n){return e(n)})},xde=c5(z),_de={URI:ki,map:Ua,of:Qo,ap:VA,chain:_E,promap:N0,compose:HW,id:IE,first:EE,second:RE,left:$E,right:kE},Tde=cn(Pa),Ide=Ii(r5);const Ede=Object.freeze(Object.defineProperty({__proto__:null,ApT:s5,Applicative:r5,Apply:Pa,Category:mde,Chain:ME,Choice:vde,Do:Sde,Functor:yn,Monad:Na,Pointed:OE,Profunctor:Ade,Strong:gde,URI:ki,ap:GW,apFirst:t5,apFirstW:fde,apS:a5,apSW:Cde,apSecond:n5,apSecondW:pde,apW:YW,ask:QW,asks:cde,asksReader:ude,asksReaderW:qA,bind:o5,bindTo:yde,bindW:bde,chain:JW,chainFirst:i5,chainFirstW:hde,chainW:TE,compose:XW,first:EE,flap:dde,flatten:lde,flattenW:ZW,getMonoid:Ide,getSemigroup:Tde,id:IE,left:$E,local:KA,map:Ju,of:Qo,promap:e5,reader:_de,right:kE,second:RE,sequenceArray:xde,traverseArray:c5,traverseArrayWithIndex:wde,traverseReadonlyArrayWithIndex:FE,traverseReadonlyNonEmptyArrayWithIndex:Zu},Symbol.toStringTag,{value:"Module"}));function zA(e){return function(){return e.fromReader(QW())}}function QA(e){return e.fromReader}function Xu(e){return function(t){return Z(t,e.fromReader)}}function HA(e,t){var n=Xu(e);return function(r){return function(i){return t.chain(i,n(r))}}}function YA(e,t){return Z(Xu(e),ct(t))}const Rde=Object.freeze(Object.defineProperty({__proto__:null,ask:zA,asks:QA,chainFirstReaderK:YA,chainReaderK:HA,fromReaderK:Xu},Symbol.toStringTag,{value:"Module"}));var u5=function(){return function(e){return[e,e]}},l5=function(e){return function(){return[void 0,e]}},d5=function(e){return function(t){return[void 0,e(t)]}},f5=function(e){return function(t){return[e(t),t]}},GA=function(e,t){return _(e,h5(t))},W0=function(e,t){return _(e,A5(t))},p5=function(e,t){return _(e,LE(t))},h5=function(e){return function(t){return function(n){var r=t(n),i=r[0],o=r[1];return[e(i),o]}}},A5=function(e){return function(t){return function(n){var r=t(n),i=r[0],o=r[1],a=e(o),s=a[0],c=a[1];return[i(s),c]}}},JA=function(e){return function(t){return[e,t]}},LE=function(e){return function(t){return function(n){var r=t(n),i=r[0],o=r[1];return e(i)(o)}}},$de=LE(z),uc="State",BE={URI:uc,map:GA},kde=qe(BE),Ode={URI:uc,of:JA},K0={URI:uc,map:GA,ap:W0},Mde=Dt(K0),Fde=jt(K0),Lde={URI:uc,map:GA,ap:W0,of:JA},DE={URI:uc,map:GA,ap:W0,chain:p5},m5={URI:uc,map:GA,ap:W0,of:JA,chain:p5},Bde=ct(DE),Dde={URI:uc,fromState:z},jde=function(e){return function(t){return t(e)[0]}},Ude=function(e){return function(t){return t(e)[1]}},Pde=Pt(BE),Nde=Nt(DE),Wde=Ut(K0),g5=function(e){return function(t){return function(n){for(var r=e(0,Xr(t))(n),i=r[0],o=r[1],a=[i],s=o,c=1;c<t.length;c++){var u=e(c,t[c])(s),l=u[0],d=u[1];a.push(l),s=d}return[a,s]}}},jE=function(e){var t=g5(e);return function(n){return pt(n)?t(n):JA(wn)}},Kde=jE,v5=function(e){return jE(function(t,n){return e(n)})},qde=v5(z),Vde=function(e,t){return e(t)[0]},zde=function(e,t){return e(t)[1]},Qde=m5;const Hde=Object.freeze(Object.defineProperty({__proto__:null,Applicative:Lde,Apply:K0,Chain:DE,FromState:Dde,Functor:BE,Monad:m5,Pointed:Ode,URI:uc,ap:A5,apFirst:Mde,apS:Wde,apSecond:Fde,bind:Nde,bindTo:Pde,chain:LE,chainFirst:Bde,evalState:Vde,evaluate:jde,execState:zde,execute:Ude,flap:kde,flatten:$de,get:u5,gets:f5,map:h5,modify:d5,of:JA,put:l5,sequenceArray:qde,state:Qde,traverseArray:v5,traverseArrayWithIndex:Kde,traverseReadonlyArrayWithIndex:jE,traverseReadonlyNonEmptyArrayWithIndex:g5},Symbol.toStringTag,{value:"Module"}));function y5(e){return function(){return e.fromState(u5())}}function b5(e){return function(t){return e.fromState(l5(t))}}function S5(e){return Z(d5,e.fromState)}function C5(e){return Z(f5,e.fromState)}function UE(e){return function(t){return Z(t,e.fromState)}}function w5(e,t){var n=UE(e);return function(r){return function(i){return t.chain(i,n(r))}}}const Yde=Object.freeze(Object.defineProperty({__proto__:null,chainStateK:w5,fromStateK:UE,get:y5,gets:C5,modify:S5,put:b5},Symbol.toStringTag,{value:"Module"}));function el(e){return function(t){return Z(t,e.fromTask)}}function jf(e,t){return function(n){var r=Z(n,e.fromTask);return function(i){return t.chain(i,r)}}}function Uf(e,t){var n=ct(t);return function(r){return n(Z(r,e.fromTask))}}const Gde=Object.freeze(Object.defineProperty({__proto__:null,chainFirstTaskK:Uf,chainTaskK:jf,fromTaskK:el},Symbol.toStringTag,{value:"Module"}));function x5(e){return function(t){return Z(t,e.fromThese)}}const Jde=Object.freeze(Object.defineProperty({__proto__:null,fromTheseK:x5},Symbol.toStringTag,{value:"Module"}));function _5(e,t){return function(n){return function(r){return e.mapWithIndex(r,function(i,o){return t.mapWithIndex(o,function(a,s){return n([i,a],s)})})}}}function Zde(e,t){var n=Zd(e,t).map,r=_5(e,t);return{map:n,mapWithIndex:function(i,o){return _(i,r(o))}}}const Xde=Object.freeze(Object.defineProperty({__proto__:null,getFunctorWithIndexComposition:Zde,mapWithIndex:_5},Symbol.toStringTag,{value:"Module"})),efe=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),tfe=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),nfe=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var Ho=function(e,t){return _(e,$5(t))},Pf=function(e,t){return _(e,k5(t))},q0=function(e,t){return _(e,KE(t))},PE=function(e,t,n){return _(e,O5(t,n))},NE=function(e){return function(t,n){return _(t,M5()(n))}},WE=function(e,t,n){return _(e,F5(t,n))},T5=function(e,t){return _(e,D5())},I5=function(e,t){return _(e,qE(t))},E5=function(e){var t=L5(e);return function(n,r){return _(n,t(r))}},R5=QI,$5=function(e){return function(t){return e(t)}},k5=function(e){return function(t){return t(e)}},Nf=z,KE=function(e){return function(t){return e(t)}},qE=function(e){return function(t){return e(t)}},VE=z,rfe=qE(z),ife=KE(z),O5=function(e,t){return function(n){return t(e,n)}},M5=function(){return function(e){return function(t){return e(t)}}},F5=function(e,t){return function(n){return t(n,e)}},L5=function(e){return function(t){return function(n){return e.map(t(n),z)}}},zE=function(e){return function(t){return e.map(t,z)}},B5=function(){return z},D5=B5,ni="Identity",ofe=z,afe=z,QE={URI:ni,map:Ho},sfe=qe(QE),cfe={URI:ni,of:Nf},V0={URI:ni,map:Ho,ap:Pf},ufe=Dt(V0),lfe=jt(V0),dfe={URI:ni,map:Ho,ap:Pf,of:Nf},HE={URI:ni,map:Ho,ap:Pf,chain:q0},ffe={URI:ni,map:Ho,ap:Pf,of:Nf,chain:q0},pfe=ct(HE),hfe={URI:ni,reduce:PE,foldMap:NE,reduceRight:WE},Afe={URI:ni,map:Ho,reduce:PE,foldMap:NE,reduceRight:WE,traverse:E5,sequence:zE},mfe={URI:ni,map:Ho,alt:T5},gfe={URI:ni,map:Ho,extend:I5,extract:VE},vfe={URI:ni,map:Ho,ap:Pf,chain:q0,chainRec:R5},yfe=Nf(sn),bfe=Pt(QE),Sfe=Nt(HE),Cfe=Ut(V0),wfe={URI:ni,map:Ho,ap:Pf,of:Nf,chain:q0,reduce:PE,foldMap:NE,reduceRight:WE,traverse:E5,sequence:zE,alt:T5,extract:VE,extend:I5,chainRec:R5};const xfe=Object.freeze(Object.defineProperty({__proto__:null,Alt:mfe,Applicative:dfe,Apply:V0,Chain:HE,ChainRec:vfe,Comonad:gfe,Do:yfe,Foldable:hfe,Functor:QE,Monad:ffe,Pointed:cfe,Traversable:Afe,URI:ni,alt:D5,altW:B5,ap:k5,apFirst:ufe,apS:Cfe,apSecond:lfe,bind:Sfe,bindTo:bfe,chain:KE,chainFirst:pfe,duplicate:rfe,extend:qE,extract:VE,flap:sfe,flatten:ife,foldMap:M5,getEq:afe,getShow:ofe,identity:wfe,map:$5,of:Nf,reduce:O5,reduceRight:F5,sequence:zE,traverse:L5},Symbol.toStringTag,{value:"Module"})),_fe=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var Wa=function(e,t){return function(){return t(e())}},lc=function(e,t){return function(){return e()(t())}},Wf=function(e,t){return function(){return t(e())()}},j5=function(e,t){return function(){for(var n=t(e)();n._tag==="Left";)n=t(n.left)();return n.right}},Yo=function(e){return function(t){return Wa(t,e)}},Tfe=function(e){return function(t){return lc(t,e)}},to=wr,YE=function(e){return function(t){return Wf(t,e)}},Ife=YE(z),no="IO",ot={URI:no,map:Wa},Efe=qe(ot),Go={URI:no,of:to},Ka={URI:no,map:Wa,ap:lc},Rfe=Dt(Ka),$fe=jt(Ka),U5={URI:no,map:Wa,ap:lc,of:to},z0={URI:no,map:Wa,ap:lc,chain:Wf},_r={URI:no,map:Wa,ap:lc,of:to,chain:Wf},kfe=ct(z0),GE=z,Ofe={URI:no,map:Wa,ap:lc,of:to,chain:Wf,fromIO:GE},Mfe={URI:no,map:Wa,ap:lc,chain:Wf,chainRec:j5},Ffe={URI:no,fromIO:z},Lfe=to(sn),Bfe=Pt(ot),Dfe=Nt(z0),jfe=Ut(Ka),P5=to(wn),Q0=function(e){return function(t){return function(){for(var n=[e(0,Xr(t))()],r=1;r<t.length;r++)n.push(e(r,t[r])());return n}}},JE=function(e){var t=Q0(e);return function(n){return pt(n)?t(n):P5}},Ufe=JE,N5=function(e){return JE(function(t,n){return e(n)})},Pfe=N5(z),Nfe={URI:no,map:Wa,of:to,ap:lc,chain:Wf,fromIO:GE,chainRec:j5},Wfe=cn(Ka),Kfe=Ii(U5);const qfe=Object.freeze(Object.defineProperty({__proto__:null,ApT:P5,Applicative:U5,Apply:Ka,Chain:z0,ChainRec:Mfe,Do:Lfe,FromIO:Ffe,Functor:ot,Monad:_r,MonadIO:Ofe,Pointed:Go,URI:no,ap:Tfe,apFirst:Rfe,apS:jfe,apSecond:$fe,bind:Dfe,bindTo:Bfe,chain:YE,chainFirst:kfe,flap:Efe,flatten:Ife,fromIO:GE,getMonoid:Kfe,getSemigroup:Wfe,io:Nfe,map:Yo,of:to,sequenceArray:Pfe,traverseArray:N5,traverseArrayWithIndex:Ufe,traverseReadonlyArrayWithIndex:JE,traverseReadonlyNonEmptyArrayWithIndex:Q0},Symbol.toStringTag,{value:"Module"}));var W5=If(Go),K5=Hu(Go),q5=Ef(ot),Vfe=Rf(ot),V5=to,ZA=q5,z5=UA(ot),zfe=z5,ZE=Lf(_r),Qfe=ZE,Q5=ZE,Hfe=Q5,H5=Bf(_r),Yfe=H5,Y5=function(e,t){return function(){return Qu(e,t)}},Gfe=function(e,t){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return Y5(function(){return e.apply(void 0,n)},t)}},Jfe=WA(ot),G5=Gu(_r),Zfe=G5,XE=PA(_r),Xfe=XE,epe=function(e){return XE(s4(e))},tpe=NA(_r),npe=Df(ot),Tr=function(e,t){return _(e,nR(t))},tl=function(e,t){return _(e,rR(t))},rpe=function(e,t){return _(e,H0(function(n){return _(t,nR(n))}))},Kf=function(e,t){return _(e,H0(t))},eR=function(e,t,n){return _(e,Z5(t,n))},tR=function(e,t){return _(e,X5(t))},J5=function(e,t){return _(e,iR(t))},nR=$f(ot),Z5=Mf(ot),X5=Ff(ot),rR=kf(Ka),ipe=rR,Oi=K5,H0=Yu(_r),yv=H0,e4=yv(z),ope=e4,iR=Of(_r),ape=iR,Y0=W5,zt="IOEither";function t4(e){var t=Ia(Ka,ic(e));return{URI:zt,_E:void 0,map:Tr,ap:function(n,r){return _(n,t(r))},of:Oi}}function n4(e){var t=jA(_r,e);return{URI:zt,_E:void 0,map:Tr,alt:function(n,r){return _(n,t(r))}}}var r4=function(e){var t=Vu(e);return{URI:zt,_E:void 0,compact:qo(ot,t),separate:Fa(ot,t,oc)}};function spe(e){var t=xf(e),n=r4(e),r=La(ot,t),i=Ba(ot,t),o=sc(ot,t),a=cc(ot,t);return{URI:zt,_E:void 0,map:Tr,compact:n.compact,separate:n.separate,filter:function(s,c){return _(s,r(c))},filterMap:function(s,c){return _(s,i(c))},partition:function(s,c){return _(s,o(c))},partitionMap:function(s,c){return _(s,a(c))}}}var oR={URI:zt,map:Tr},cpe=qe(oR),upe={URI:zt,of:Oi},lpe={URI:zt,bimap:eR,mapLeft:tR},XA={URI:zt,map:Tr,ap:tl},i4=Dt(XA),dpe=i4,o4=jt(XA),fpe=o4,aR={URI:zt,map:Tr,ap:tl,of:Oi},ppe={URI:zt,map:Tr,ap:rpe,of:Oi},qa={URI:zt,map:Tr,ap:tl,chain:Kf},hpe={URI:zt,map:Tr,ap:tl,of:Oi,chain:Kf},a4=ct(qa),Ape=a4,mpe={URI:zt,map:Tr,alt:J5},gpe={URI:zt,map:Tr,ap:tl,of:Oi,chain:Kf,fromIO:ZA},vpe={URI:zt,map:Tr,ap:tl,of:Oi,chain:Kf,throwError:Y0},G0={URI:zt,fromIO:ZA},s4=zo(G0),ype=Da(G0,qa),bpe=ja(G0,qa),Va={URI:zt,fromEither:V5},Spe=Po(Va),Cpe=No(Va),wpe=Fu(Va,qa),c4=Ea(Va,qa),xpe=c4,u4=Ra(Va,qa),_pe=u4,Tpe=Gs(Va),l4=Lu(Va,qa),Ipe=l4,Epe=ei(Va),Rpe=function(e,t,n){return d4(e,t,n)},d4=function(e,t,n){return _(e,yv(function(r){return _(t(r),YE(function(i){return _(n(r,i),yv(function(){return to(i)}))}))}))},$pe=Oi(sn),kpe=Pt(oR),f4=Nt(qa),Ope=f4,p4=Ut(XA),Mpe=p4,sR=Oi(wn),h4=function(e){return Z(Q0(e),Yo(DA(xr)))},cR=function(e){var t=h4(e);return function(n){return pt(n)?t(n):sR}},A4=function(e){return function(t){return function(){var n=e(0,Xr(t))();if(on(n))return n;for(var r=[n.right],i=1;i<t.length;i++){var o=e(i,t[i])();if(on(o))return o;r.push(o.right)}return Ys(r)}}},uR=function(e){var t=A4(e);return function(n){return pt(n)?t(n):sR}},Fpe=cR,m4=function(e){return cR(function(t,n){return e(n)})},Lpe=m4(z),Bpe=uR,g4=function(e){return uR(function(t,n){return e(n)})},Dpe=g4(z),jpe=aR,Upe={URI:zt,bimap:eR,mapLeft:tR,map:Tr,of:Oi,ap:tl,chain:Kf,alt:J5,fromIO:ZA,throwError:Y0},Ppe=cn(XA),Npe=Ii(aR),Wpe=function(e){return cn(Ka)(MA(e))};function Kpe(e){var t=t4(e),n=n4(e);return{URI:zt,_E:void 0,map:Tr,ap:t.ap,of:Oi,chain:Kf,bimap:eR,mapLeft:tR,alt:n.alt,fromIO:ZA,throwError:Y0}}const qpe=Object.freeze(Object.defineProperty({__proto__:null,Alt:mpe,ApT:sR,Applicative:jpe,ApplicativePar:aR,ApplicativeSeq:ppe,ApplyPar:XA,Bifunctor:lpe,Chain:qa,Do:$pe,FromEither:Va,FromIO:G0,Functor:oR,Monad:hpe,MonadIO:gpe,MonadThrow:vpe,Pointed:upe,URI:zt,alt:iR,altW:ape,ap:rR,apFirst:i4,apFirstW:dpe,apS:p4,apSW:Mpe,apSecond:o4,apSecondW:fpe,apW:ipe,bimap:Z5,bind:f4,bindTo:kpe,bindW:Ope,bracket:Rpe,bracketW:d4,chain:H0,chainEitherK:c4,chainEitherKW:xpe,chainFirst:a4,chainFirstEitherK:u4,chainFirstEitherKW:_pe,chainFirstIOK:bpe,chainFirstW:Ape,chainIOK:ype,chainOptionK:wpe,chainW:yv,filterOrElse:l4,filterOrElseW:Ipe,flap:cpe,flatten:ope,flattenW:e4,fold:Qfe,foldW:Hfe,fromEither:V5,fromEitherK:Epe,fromIO:ZA,fromIOK:s4,fromOption:Spe,fromOptionK:Cpe,fromPredicate:Tpe,getAltIOValidation:n4,getApplicativeIOValidation:t4,getApplyMonoid:Npe,getApplySemigroup:Ppe,getCompactable:r4,getFilterable:spe,getIOValidation:Kpe,getOrElse:H5,getOrElseW:Yfe,getSemigroup:Wpe,ioEither:Upe,left:W5,leftIO:Vfe,map:nR,mapLeft:X5,match:z5,matchE:ZE,matchEW:Q5,matchW:zfe,of:Oi,orElse:G5,orElseFirst:XE,orElseFirstIOK:epe,orElseFirstW:Xfe,orElseW:Zfe,orLeft:tpe,right:K5,rightIO:q5,sequenceArray:Lpe,sequenceSeqArray:Dpe,swap:npe,throwError:Y0,toUnion:Jfe,traverseArray:m4,traverseArrayWithIndex:Fpe,traverseReadonlyArrayWithIndex:cR,traverseReadonlyArrayWithIndexSeq:uR,traverseReadonlyNonEmptyArrayWithIndex:h4,traverseReadonlyNonEmptyArrayWithIndexSeq:A4,traverseSeqArray:g4,traverseSeqArrayWithIndex:Bpe,tryCatch:Y5,tryCatchK:Gfe},Symbol.toStringTag,{value:"Module"}));function em(e){return Z(Ct,e.of)}function tm(e){return wr(e.of(rt))}function J0(e){return function(t){return e.map(t,Ct)}}function Z0(e){return Z(Wu,e.of)}function X0(e){var t=Z0(e);return function(n){return Z(n,t)}}function lR(e){var t=qf(e),n=X0(e);return function(r){return t(n(r))}}function eb(e){return function(t){return Z(t,e.of)}}function dR(e){var t=qf(e),n=eb(e);return function(r){return t(n(r))}}function fR(e){return function(t){return function(n){return e.of(I0(t)(n))}}}function pR(e){return Z(Sf,e.of)}function hR(e){return function(t,n){return function(r){return e.map(r,Ma(t,n))}}}function tb(e){return function(t,n){return function(r){return e.chain(r,Ma(t,n))}}}function nb(e){return function(t){return function(n){return e.chain(n,Ma(t,e.of))}}}function rb(e){return Jd(e,gf)}function ib(e){return Ia(e,vf)}function qf(e){var t=tm(e);return function(n){return function(r){return e.chain(r,Ma(function(){return t()},n))}}}function ob(e){var t=em(e);return function(n){return function(r){return e.chain(r,Ma(n,t))}}}function Vpe(e){var t=ib(e),n=rb(e),r=qf(e),i=ob(e),o=tb(e),a=nb(e),s=tm(e);return{map:function(c,u){return _(c,n(u))},ap:function(c,u){return _(c,t(u))},of:em(e),chain:function(c,u){return _(c,r(u))},alt:function(c,u){return _(c,i(u))},fold:function(c,u,l){return _(c,o(u,l))},getOrElse:function(c,u){return _(c,a(u))},fromM:J0(e),none:function(){return s()}}}const zpe=Object.freeze(Object.defineProperty({__proto__:null,alt:ob,ap:ib,chain:qf,chainNullableK:lR,chainOptionK:dR,fromEither:pR,fromF:J0,fromNullable:Z0,fromNullableK:X0,fromOptionK:eb,fromPredicate:fR,getOptionM:Vpe,getOrElse:nb,map:rb,match:hR,matchE:tb,some:em,zero:tm},Symbol.toStringTag,{value:"Module"}));var v4=em(Go),Qpe=fR(Go),Hpe=to,y4=pR(Go),AR=J0(ot),Ype=Yo(Sf),b4=hR(ot),Gpe=b4,mR=tb(z0),Jpe=mR,Zpe=mR,S4=nb(_r),Xpe=S4,ehe=Yo(V6),the=Yo(cE),nhe=Z0(Go),rhe=X0(Go),ihe=lR(_r),ohe=eb(Go),ahe=dR(_r),C4=rb(ot),w4=ib(Ka),dc=v4,gR=qf(_r),she=gR(z),vR=ob(_r),che=vR,ab=tm(Go),uhe=ab(),yR=qo(ot,Nu),bR=Fa(ot,Nu,gf),x4=La(ot,Oa),_4=Ba(ot,Oa),T4=sc(ot,Oa),I4=cc(ot,Oa),za=function(e,t){return _(e,C4(t))},Vf=function(e,t){return _(e,w4(t))},SR=function(e,t){return _(e,gR(t))},E4=function(e,t){return _(e,vR(t))},lhe=function(e,t){return _(e,x4(t))},dhe=function(e,t){return _(e,_4(t))},fhe=function(e,t){return _(e,T4(t))},phe=function(e,t){return _(e,I4(t))},Ir="IOOption",CR={URI:Ir,map:za},hhe=qe(CR),R4={URI:Ir,of:dc},sb={URI:Ir,map:za,ap:Vf},Ahe=Dt(sb),mhe=jt(sb),ghe={URI:Ir,map:za,ap:Vf,of:dc},nl={URI:Ir,map:za,ap:Vf,chain:SR},vhe=ct(nl),yhe={URI:Ir,map:za,alt:E4},$4={URI:Ir,zero:ab},bhe=of($4,R4),She={URI:Ir,map:za,ap:Vf,of:dc,alt:E4,zero:ab},Che={URI:Ir,map:za,ap:Vf,of:dc,chain:SR},whe={URI:Ir,map:za,ap:Vf,of:dc,chain:SR,fromIO:AR},xhe={URI:Ir,compact:yR,separate:bR},_he={URI:Ir,map:za,compact:yR,separate:bR,filter:lhe,filterMap:dhe,partition:fhe,partitionMap:phe},cb={URI:Ir,fromIO:AR},The=zo(cb),Ihe=Da(cb,nl),Ehe=ja(cb,nl),ub={URI:Ir,fromEither:y4},Rhe=ei(ub),$he=Ea(ub,nl),khe=Ra(ub,nl),Ohe=dc(sn),Mhe=Pt(CR),Fhe=Nt(nl),Lhe=Ut(sb),k4=dc(wn),O4=function(e){return Z(Q0(e),Yo(B0(xr)))},Bhe=function(e){var t=O4(e);return function(n){return pt(n)?t(n):k4}};const Dhe=Object.freeze(Object.defineProperty({__proto__:null,Alt:yhe,Alternative:She,ApT:k4,Applicative:ghe,Apply:sb,Chain:nl,Compactable:xhe,Do:Ohe,Filterable:_he,FromEither:ub,FromIO:cb,Functor:CR,Monad:Che,MonadIO:whe,Pointed:R4,Zero:$4,alt:vR,altW:che,ap:w4,apFirst:Ahe,apS:Lhe,apSecond:mhe,bind:Fhe,bindTo:Mhe,chain:gR,chainEitherK:$he,chainFirst:vhe,chainFirstEitherK:khe,chainFirstIOK:Ehe,chainIOK:Ihe,chainNullableK:ihe,chainOptionK:ahe,compact:yR,filter:x4,filterMap:_4,flap:hhe,flatten:she,fold:Jpe,fromEither:y4,fromEitherK:Rhe,fromIO:AR,fromIOEither:Ype,fromIOK:The,fromNullable:nhe,fromNullableK:rhe,fromOption:Hpe,fromOptionK:ohe,fromPredicate:Qpe,getOrElse:S4,getOrElseW:Xpe,guard:bhe,map:C4,match:b4,matchE:mR,matchEW:Zpe,matchW:Gpe,none:uhe,of:dc,partition:T4,partitionMap:I4,separate:bR,some:v4,toNullable:the,toUndefined:ehe,traverseReadonlyArrayWithIndex:Bhe,traverseReadonlyNonEmptyArrayWithIndex:O4,zero:ab},Symbol.toStringTag,{value:"Module"}));var M4=function(){function e(t){var n=this;this.value=t,this.read=function(){return n.value},this.write=this.write.bind(this),this.modify=this.modify.bind(this)}return e.prototype.write=function(t){var n=this;return function(){n.value=t}},e.prototype.modify=function(t){var n=this;return function(){n.value=t(n.value)}},e}();function jhe(e){return function(){return new M4(e)}}const Uhe=Object.freeze(Object.defineProperty({__proto__:null,IORef:M4,newIORef:jhe},Symbol.toStringTag,{value:"Module"})),Phe=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var Nhe=function(e){return Qu(function(){return JSON.parse(e)},z)},Whe=function(e){return Qu(function(){var t=JSON.stringify(e);if(typeof t!="string")throw new Error("Converting unsupported structure to JSON");return t},z)};const Khe=Object.freeze(Object.defineProperty({__proto__:null,parse:Nhe,stringify:Whe},Symbol.toStringTag,{value:"Module"})),qhe=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var Vhe=function(e){return new Map(e)};function zhe(e){return new Map(e)}function F4(e,t){return{show:function(n){var r=[];return n.forEach(function(i,o){r.push("[".concat(e.show(o),", ").concat(t.show(i),"]"))}),"new Map([".concat(r.sort().join(", "),"])")}}}var L4=function(e){return e.size},Fo=function(e){return e.size===0};function lb(e){var t=rl(e);return function(n,r){if(r===void 0){var i=lb(e);return function(o){return i(n,o)}}return St(t(n,r))}}function wR(e){return function(t,n){if(n===void 0){var r=wR(e);return function(s){return r(t,s)}}for(var i=n.values(),o;!(o=i.next()).done;){var a=o.value;if(e.equals(t,a))return!0}return!1}}var zf=function(e){return function(t){return Array.from(t.keys()).sort(e.compare)}},Qhe=function(e){return function(t){return Array.from(t.values()).sort(e.compare)}};function B4(e){var t=zf(e);return function(n){return function(r){for(var i=[],o=t(r),a=0,s=o;a<s.length;a++){var c=s[a];i.push(n(c,r.get(c)))}return i}}}var D4=function(e){return B4(e)(function(t,n){return[t,n]})};function Hhe(e,t){var n=D4(e);return function(r){var i=n(r),o=i.length;return t.unfold(0,function(a){return a<o?Ae([i[a],a+1]):we})}}var j4=function(e){var t=Qa(e);return function(n,r){var i=t(n);return function(o){var a=i(o);if(qt(a)){var s=new Map(o);return s.set(n,r),s}else if(a.value[1]!==r){var s=new Map(o);return s.set(a.value[0],r),s}return o}}},U4=function(e){var t=Qa(e);return function(n){return function(r){var i=t(n,r);if(St(i)){var o=new Map(r);return o.delete(i.value[0]),o}return r}}},Yhe=function(e){var t=P4(e);return function(n,r){return t(n,function(){return r})}},P4=function(e){var t=Qa(e);return function(n,r){return function(i){var o=t(n,i);if(qt(o))return we;var a=o.value,s=a[0],c=a[1],u=r(c);if(u===c)return Ae(i);var l=new Map(i);return l.set(s,u),Ae(l)}}};function Ghe(e){var t=rl(e),n=U4(e);return function(r){var i=n(r);return function(o){return _(t(r,o),Ko(function(a){return[a,i(o)]}))}}}function Qa(e){return function(t,n){if(n===void 0){var r=Qa(e);return function(u){return r(t,u)}}for(var i=n.entries(),o;!(o=i.next()).done;){var a=o.value,s=a[0],c=a[1];if(e.equals(s,t))return Ae([s,c])}return we}}function rl(e){var t=Qa(e);return function(n,r){if(r===void 0){var i=rl(e);return function(o){return i(n,o)}}return _(t(n,r),Ko(function(o){o[0];var a=o[1];return a}))}}function db(e,t){var n=Qa(e);return function(r,i){if(i===void 0){var o=db(e,t);return function(p){return o(p,r)}}for(var a=r.entries(),s;!(s=a.next()).done;){var c=s.value,u=c[0],l=c[1],d=n(u,i);if(qt(d)||!e.equals(u,d.value[0])||!t.equals(l,d.value[1]))return!1}return!0}}var fb=new Map;function N4(e,t){var n=db(e,t);return Ei(function(r,i){return n(r,i)&&n(i,r)})}function Jhe(e,t){var n=Qa(e);return{concat:function(r,i){if(Fo(r))return i;if(Fo(i))return r;for(var o=new Map(r),a=i.entries(),s;!(s=a.next()).done;){var c=s.value,u=c[0],l=c[1],d=n(u,r);St(d)?o.set(d.value[0],t.concat(d.value[1],l)):o.set(u,l)}return o},empty:fb}}var Zhe=function(e,t){return new Map([[e,t]])};function Xhe(e,t,n){return function(r){var i=Qa(e);return n.reduce(r,new Map,function(o,a){var s=a[0],c=a[1],u=i(s,o);return St(u)?o.set(u.value[0],t.concat(u.value[1],c)):o.set(s,c),o})}}var Qf=function(e,t){for(var n=new Map,r=e.entries(),i;!(i=r.next()).done;){var o=i.value,a=o[0],s=o[1];n.set(a,t(a,s))}return n},W4=function(e){return function(t){for(var n=new Map,r=new Map,i=t.entries(),o;!(o=i.next()).done;){var a=o.value,s=a[0],c=a[1],u=e(s,c);on(u)?n.set(s,u.left):r.set(s,u.right)}return Me(n,r)}};function K4(e){return function(t){for(var n=new Map,r=new Map,i=t.entries(),o;!(o=i.next()).done;){var a=o.value,s=a[0],c=a[1];e(s,c)?r.set(s,c):n.set(s,c)}return Me(n,r)}}var q4=function(e){return function(t){for(var n=new Map,r=t.entries(),i;!(i=r.next()).done;){var o=i.value,a=o[0],s=o[1],c=e(a,s);St(c)&&n.set(a,c.value)}return n}};function V4(e){return function(t){for(var n=new Map,r=t.entries(),i;!(i=r.next()).done;){var o=i.value,a=o[0],s=o[1];e(a,s)&&n.set(a,s)}return n}}var Ha=function(e,t){return Qf(e,function(n,r){return t(r)})},nm=function(e,t){return z4(e,function(n,r){return t(r)})},rm=function(e,t){return Q4(e,function(n,r){return t(r)})},im=function(e,t){return H4(e,function(n,r){return t(r)})},om=function(e,t){return Y4(e,function(n,r){return t(r)})},z4=function(e,t){return _(e,V4(t))},Q4=function(e,t){return _(e,q4(t))},H4=function(e,t){return _(e,K4(t))},Y4=function(e,t){return _(e,W4(t))},Hf=function(e){for(var t=new Map,n=e.entries(),r;!(r=n.next()).done;){var i=r.value,o=i[0],a=i[1];St(a)&&t.set(o,a.value)}return t},eAe=function(e){return function(t){return nm(t,e)}},tAe=function(e){return function(t){return rm(t,e)}},nAe=function(e){return function(t){return Ha(t,e)}},rAe=function(e){return function(t){return Qf(t,e)}},iAe=function(e){return function(t){return im(t,e)}},oAe=function(e){return function(t){return om(t,e)}},Yf=function(e){for(var t=new Map,n=new Map,r=e.entries(),i;!(i=r.next()).done;){var o=i.value,a=o[0],s=o[1];on(s)?t.set(a,s.left):n.set(a,s.right)}return Me(t,n)},Mi="ReadonlyMap",G4=function(e,t){var n=RR(e,t);return{concat:function(r,i){return n(i)(r)}}},aAe=function(e,t){return{concat:G4(e,t).concat,empty:fb}},sAe=function(e,t){var n=$R(e,t);return{concat:function(r,i){return n(i)(r)}}},cAe=function(e){return function(){var t=kR(e);return{concat:function(n,r){return t(r)(n)}}}};function uAe(){return{URI:Mi,_E:void 0,map:Ha,mapWithIndex:Qf,compact:Hf,separate:Yf,filter:nm,filterMap:rm,partition:im,partitionMap:om,partitionMapWithIndex:Y4,partitionWithIndex:H4,filterMapWithIndex:Q4,filterWithIndex:z4}}var J4={URI:Mi,map:Ha},lAe=qe(J4),dAe=function(){return{URI:Mi,_E:void 0,map:Ha,mapWithIndex:Qf}},Ww={URI:Mi,compact:Hf,separate:Yf},fAe={URI:Mi,map:Ha,compact:Hf,separate:Yf,filter:nm,filterMap:rm,partition:im,partitionMap:om},xR=function(e){var t=hb(e);return function(n,r){return t(n,function(i,o,a){return r(o,a)})}},_R=function(e){var t=Ab(e);return function(n){var r=t(n);return function(i){return r(function(o,a){return i(a)})}}},TR=function(e){var t=mb(e);return function(n,r){return t(n,function(i,o,a){return r(o,a)})}},pb=function(e){var t=xR(e),n=_R(e),r=TR(e);return{URI:Mi,_E:void 0,reduce:function(i,o,a){return _(i,t(o,a))},foldMap:function(i){var o=n(i);return function(a,s){return _(a,o(s))}},reduceRight:function(i,o,a){return _(i,r(o,a))}}},hb=function(e){var t=zf(e);return function(n,r){return function(i){for(var o=n,a=0,s=t(i);a<s.length;a++){var c=s[a];o=r(c,o,i.get(c))}return o}}},Ab=function(e){var t=zf(e);return function(n){return function(r){return function(i){for(var o=n.empty,a=0,s=t(i);a<s.length;a++){var c=s[a];o=n.concat(o,r(c,i.get(c)))}return o}}}},mb=function(e){var t=zf(e);return function(n,r){return function(i){for(var o=n,a=t(i),s=a.length,c=s-1;c>=0;c--){var u=a[c];o=r(u,i.get(u),o)}return o}}},IR=function(e){var t=pb(e),n=hb(e),r=Ab(e),i=mb(e);return{URI:Mi,_E:void 0,reduce:t.reduce,foldMap:t.foldMap,reduceRight:t.reduceRight,reduceWithIndex:function(o,a,s){return _(o,n(a,s))},foldMapWithIndex:function(o){var a=r(o);return function(s,c){return _(s,a(c))}},reduceRightWithIndex:function(o,a,s){return _(o,i(a,s))}}},pAe=function(e){var t=ER(e),n=pb(e);return{URI:Mi,_E:void 0,map:Ha,reduce:n.reduce,foldMap:n.foldMap,reduceRight:n.reduceRight,traverse:t.traverse,sequence:t.sequence}},ER=function(e){var t=IR(e),n=zf(e),r=function(a){return function(s,c){for(var u=a.of(new Map),l=n(s),d=l.length,p=function(A){var g=l[A],v=s.get(g);u=a.ap(a.map(u,function(b){return function(w){return b.set(g,w)}}),c(g,v))},h=0;h<d;h++)p(h);return u}},i=function(a){var s=r(a);return function(c,u){return s(c,function(l,d){return u(d)})}},o=function(a){var s=r(a);return function(c){return s(c,xr)}};return{URI:Mi,_E:void 0,map:Ha,mapWithIndex:Qf,reduce:t.reduce,foldMap:t.foldMap,reduceRight:t.reduceRight,reduceWithIndex:t.reduceWithIndex,foldMapWithIndex:t.foldMapWithIndex,reduceRightWithIndex:t.reduceRightWithIndex,traverse:i,sequence:o,traverseWithIndex:r}};function hAe(e){var t=ER(e);return{URI:Mi,_E:void 0,map:Ha,compact:Hf,separate:Yf,filter:nm,filterMap:rm,partition:im,partitionMap:om,reduce:t.reduce,foldMap:t.foldMap,reduceRight:t.reduceRight,traverse:t.traverse,sequence:t.sequence,mapWithIndex:Qf,reduceWithIndex:t.reduceWithIndex,foldMapWithIndex:t.foldMapWithIndex,reduceRightWithIndex:t.reduceRightWithIndex,traverseWithIndex:t.traverseWithIndex,wilt:Xi(t,Ww),wither:eo(t,Ww)}}var RR=function(e,t){var n=rl(e);return function(r){return function(i){if(Fo(i))return r;if(Fo(r))return i;for(var o=new Map,a=i.entries(),s;!(s=a.next()).done;){var c=s.value,u=c[0],l=c[1],d=n(u)(r);St(d)?o.set(u,t.concat(l,d.value)):o.set(u,l)}for(var p=r.entries();!(s=p.next()).done;){var h=s.value,u=h[0],l=h[1],d=n(u)(o);qt(d)&&o.set(u,l)}return o}}},$R=function(e,t){var n=rl(e);return function(r){return function(i){if(Fo(i)||Fo(r))return fb;for(var o=new Map,a=i.entries(),s;!(s=a.next()).done;){var c=s.value,u=c[0],l=c[1],d=n(u)(r);St(d)&&o.set(u,t.concat(l,d.value))}return o}}},kR=function(e){var t=lb(e);return function(n){return function(r){if(Fo(r))return n;if(Fo(n))return r;for(var i=new Map,o=r.entries(),a;!(a=o.next()).done;){var s=a.value,c=s[0],u=s[1];t(c)(n)||i.set(c,u)}for(var l=n.entries();!(a=l.next()).done;){var d=a.value,c=d[0],u=d[1];t(c)(r)||i.set(c,u)}return i}}},AAe=j4,mAe={URI:Mi,map:Ha,compact:Hf,separate:Yf,filter:nm,filterMap:rm,partition:im,partitionMap:om};const gAe=Object.freeze(Object.defineProperty({__proto__:null,Compactable:Ww,Filterable:fAe,Functor:J4,URI:Mi,collect:B4,compact:Hf,deleteAt:U4,difference:kR,elem:wR,empty:fb,filter:eAe,filterMap:tAe,filterMapWithIndex:q4,filterWithIndex:V4,flap:lAe,foldMap:_R,foldMapWithIndex:Ab,fromFoldable:Xhe,fromMap:Vhe,getDifferenceMagma:cAe,getEq:N4,getFilterableWithIndex:uAe,getFoldable:pb,getFoldableWithIndex:IR,getFunctorWithIndex:dAe,getIntersectionSemigroup:sAe,getMonoid:Jhe,getShow:F4,getTraversable:pAe,getTraversableWithIndex:ER,getUnionMonoid:aAe,getUnionSemigroup:G4,getWitherable:hAe,insertAt:AAe,intersection:$R,isEmpty:Fo,isSubmap:db,keys:zf,lookup:rl,lookupWithKey:Qa,map:nAe,mapWithIndex:rAe,member:lb,modifyAt:P4,partition:iAe,partitionMap:oAe,partitionMapWithIndex:W4,partitionWithIndex:K4,pop:Ghe,readonlyMap:mAe,reduce:xR,reduceRight:TR,reduceRightWithIndex:mb,reduceWithIndex:hb,separate:Yf,singleton:Zhe,size:L4,toMap:zhe,toReadonlyArray:D4,toUnfoldable:Hhe,union:RR,updateAt:Yhe,upsertAt:j4,values:Qhe},Symbol.toStringTag,{value:"Module"}));var yd=function(){return yd=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},yd.apply(this,arguments)},vAe=F4,yAe=L4,Sa=Fo,bAe=lb,SAe=wR,OR=function(e){return function(t){return Array.from(t.keys()).sort(e.compare)}},CAe=function(e){return function(t){return Array.from(t.values()).sort(e.compare)}};function Z4(e){var t=OR(e);return function(n){return function(r){for(var i=[],o=t(r),a=0,s=o;a<s.length;a++){var c=s[a];i.push(n(c,r.get(c)))}return i}}}function X4(e){return Z4(e)(function(t,n){return[t,n]})}function wAe(e,t){var n=X4(e);return function(r){var i=n(r),o=i.length;return t.unfold(0,function(a){return a<o?Ae([i[a],a+1]):we})}}var eK=function(e){var t=il(e);return function(n,r){var i=t(n);return function(o){var a=i(o);if(qt(a)){var s=new Map(o);return s.set(n,r),s}else if(a.value[1]!==r){var s=new Map(o);return s.set(a.value[0],r),s}return o}}},tK=function(e){var t=il(e);return function(n){return function(r){var i=t(n,r);if(St(i)){var o=new Map(r);return o.delete(i.value[0]),o}return r}}},xAe=function(e){var t=nK(e);return function(n,r){return t(n,function(){return r})}},nK=function(e){var t=il(e);return function(n,r){return function(i){var o=t(n,i);if(qt(o))return we;var a=new Map(i);return a.set(o.value[0],r(o.value[1])),Ae(a)}}};function _Ae(e){var t=rK(e),n=tK(e);return function(r){var i=n(r);return function(o){return _(t(r,o),Ko(function(a){return[a,i(o)]}))}}}function il(e){return function(t,n){if(n===void 0){var r=il(e);return function(u){return r(t,u)}}for(var i=n.entries(),o;!(o=i.next()).done;){var a=o.value,s=a[0],c=a[1];if(e.equals(s,t))return Ae([s,c])}return we}}var rK=rl,TAe=db,IAe=N4;function EAe(e,t){var n=il(e);return{concat:function(r,i){if(Sa(r))return i;if(Sa(i))return r;for(var o=new Map(r),a=i.entries(),s;!(s=a.next()).done;){var c=s.value,u=c[0],l=c[1],d=n(u,r);St(d)?o.set(d.value[0],t.concat(d.value[1],l)):o.set(u,l)}return o},empty:new Map}}var RAe=function(e,t){return new Map([[e,t]])};function $Ae(e,t,n){return function(r){var i=il(e);return n.reduce(r,new Map,function(o,a){var s=a[0],c=a[1],u=i(s,o);return St(u)?o.set(u.value[0],t.concat(u.value[1],c)):o.set(s,c),o})}}var am=function(e,t){for(var n=new Map,r=e.entries(),i;!(i=r.next()).done;){var o=i.value,a=o[0],s=o[1];n.set(a,t(a,s))}return n},iK=function(e){return function(t){for(var n=new Map,r=new Map,i=t.entries(),o;!(o=i.next()).done;){var a=o.value,s=a[0],c=a[1],u=e(s,c);on(u)?n.set(s,u.left):r.set(s,u.right)}return Me(n,r)}};function oK(e){return function(t){for(var n=new Map,r=new Map,i=t.entries(),o;!(o=i.next()).done;){var a=o.value,s=a[0],c=a[1];e(s,c)?r.set(s,c):n.set(s,c)}return Me(n,r)}}var aK=function(e){return function(t){for(var n=new Map,r=t.entries(),i;!(i=r.next()).done;){var o=i.value,a=o[0],s=o[1],c=e(a,s);St(c)&&n.set(a,c.value)}return n}};function sK(e){return function(t){for(var n=new Map,r=t.entries(),i;!(i=r.next()).done;){var o=i.value,a=o[0],s=o[1];e(a,s)&&n.set(a,s)}return n}}var Gf=function(e,t){return am(e,function(n,r){return t(r)})},gb=function(e,t){return cK(e,function(n,r){return t(r)})},vb=function(e,t){return uK(e,function(n,r){return t(r)})},yb=function(e,t){return lK(e,function(n,r){return t(r)})},bb=function(e,t){return dK(e,function(n,r){return t(r)})},cK=function(e,t){return _(e,sK(t))},uK=function(e,t){return _(e,aK(t))},lK=function(e,t){return _(e,oK(t))},dK=function(e,t){return _(e,iK(t))},sm=function(e){for(var t=new Map,n=e.entries(),r;!(r=n.next()).done;){var i=r.value,o=i[0],a=i[1];St(a)&&t.set(o,a.value)}return t},kAe=function(e){return function(t){return gb(t,e)}},OAe=function(e){return function(t){return vb(t,e)}},MAe=function(e){return function(t){return Gf(t,e)}},FAe=function(e){return function(t){return am(t,e)}},LAe=function(e){return function(t){return yb(t,e)}},BAe=function(e){return function(t){return bb(t,e)}},cm=function(e){for(var t=new Map,n=new Map,r=e.entries(),i;!(i=r.next()).done;){var o=i.value,a=o[0],s=o[1];on(s)?t.set(a,s.left):n.set(a,s.right)}return Me(t,n)},Ya="Map",fK=function(e,t){var n=gK(e,t);return{concat:function(r,i){return n(i)(r)}}},DAe=function(e,t){return{concat:fK(e,t).concat,empty:new Map}},jAe=function(e,t){var n=vK(e,t);return{concat:function(r,i){return n(i)(r)}}},UAe=function(e){return function(){var t=yK(e);return{concat:function(n,r){return t(r)(n)}}}};function PAe(){return{URI:Ya,_E:void 0,map:Gf,mapWithIndex:am,compact:sm,separate:cm,filter:gb,filterMap:vb,partition:yb,partitionMap:bb,partitionMapWithIndex:dK,partitionWithIndex:lK,filterMapWithIndex:uK,filterWithIndex:cK}}function NAe(e){var t=hK(e);return{URI:Ya,_E:void 0,map:Gf,compact:sm,separate:cm,filter:gb,filterMap:vb,partition:yb,partitionMap:bb,reduce:t.reduce,foldMap:t.foldMap,reduceRight:t.reduceRight,traverse:t.traverse,sequence:t.sequence,mapWithIndex:am,reduceWithIndex:t.reduceWithIndex,foldMapWithIndex:t.foldMapWithIndex,reduceRightWithIndex:t.reduceRightWithIndex,traverseWithIndex:t.traverseWithIndex,wilt:Xi(t,Kw),wither:eo(t,Kw)}}var WAe=xR,KAe=_R,qAe=TR,VAe=function(e){return yd(yd({},pb(e)),{URI:Ya})},zAe=hb,QAe=Ab,HAe=mb,pK=function(e){return yd(yd({},IR(e)),{URI:Ya})},hK=function(e){var t=pK(e),n=OR(e),r=function(a){return function(s,c){for(var u=a.of(new Map),l=n(s),d=l.length,p=function(A){var g=l[A],v=s.get(g);u=a.ap(a.map(u,function(b){return function(w){return b.set(g,w)}}),c(g,v))},h=0;h<d;h++)p(h);return u}},i=function(a){var s=r(a);return function(c,u){return s(c,function(l,d){return u(d)})}},o=function(a){var s=r(a);return function(c){return s(c,function(u,l){return l})}};return{URI:Ya,_E:void 0,map:Gf,mapWithIndex:am,reduce:t.reduce,foldMap:t.foldMap,reduceRight:t.reduceRight,reduceWithIndex:t.reduceWithIndex,foldMapWithIndex:t.foldMapWithIndex,reduceRightWithIndex:t.reduceRightWithIndex,traverse:i,sequence:o,traverseWithIndex:r}},AK={URI:Ya,map:Gf},YAe=qe(AK),Kw={URI:Ya,compact:sm,separate:cm},mK={URI:Ya,map:Gf,compact:sm,separate:cm,filter:gb,filterMap:vb,partition:yb,partitionMap:bb},bv=function(e){return new Map(e)},gK=function(e,t){var n=RR(e,t);return function(r){return function(i){return Sa(i)?bv(r):Sa(r)?bv(i):n(r)(i)}}},vK=function(e,t){var n=$R(e,t);return function(r){return function(i){return Sa(i)||Sa(r)?new Map:n(r)(i)}}},yK=function(e){var t=kR(e);return function(n){return function(r){return Sa(r)?bv(n):Sa(n)?bv(r):t(n)(r)}}},GAe=new Map,JAe=eK,ZAe=mK;const XAe=Object.freeze(Object.defineProperty({__proto__:null,Compactable:Kw,Filterable:mK,Functor:AK,URI:Ya,collect:Z4,compact:sm,deleteAt:tK,difference:yK,elem:SAe,empty:GAe,filter:kAe,filterMap:OAe,filterMapWithIndex:aK,filterWithIndex:sK,flap:YAe,foldMap:KAe,foldMapWithIndex:QAe,fromFoldable:$Ae,getDifferenceMagma:UAe,getEq:IAe,getFilterableWithIndex:PAe,getFoldable:VAe,getFoldableWithIndex:pK,getIntersectionSemigroup:jAe,getMonoid:EAe,getShow:vAe,getTraversableWithIndex:hK,getUnionMonoid:DAe,getUnionSemigroup:fK,getWitherable:NAe,insertAt:JAe,intersection:vK,isEmpty:Sa,isSubmap:TAe,keys:OR,lookup:rK,lookupWithKey:il,map:MAe,mapWithIndex:FAe,map_:ZAe,member:bAe,modifyAt:nK,partition:LAe,partitionMap:BAe,partitionMapWithIndex:iK,partitionWithIndex:oK,pop:_Ae,reduce:WAe,reduceRight:qAe,reduceRightWithIndex:HAe,reduceWithIndex:zAe,separate:cm,singleton:RAe,size:yAe,toArray:X4,toUnfoldable:wAe,union:gK,updateAt:xAe,upsertAt:eK,values:CAe},Symbol.toStringTag,{value:"Module"})),eme=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),tme=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),nme=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),rme=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),ime=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var bK=function(e){return{concat:$y(e).concat,empty:e.top}},SK=function(e){return{concat:ky(e).concat,empty:e.bottom}},MR=function(e){return{concat:V_(e).concat,empty:e.empty}},CK=function(e){var t={};for(var n in e)st.call(e,n)&&(t[n]=e[n].empty);return{concat:z_(e).concat,empty:t}},wK=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return{concat:Q_.apply(fP,e).concat,empty:e.map(function(n){return n.empty})}},xK=function(e){return Y_(e)(e.empty)},ome={concat:aP.concat,empty:void 0},ame=wK,sme=CK,cme=MR,ume=SK,lme=bK,dme=xK,_K={concat:sP.concat,empty:!0},TK={concat:cP.concat,empty:!1},fme=LU,pme=function(){return MR(jW())},hme={concat:uP.concat,empty:""},Ame={concat:lP.concat,empty:0},mme={concat:dP.concat,empty:1};const gme=Object.freeze(Object.defineProperty({__proto__:null,concatAll:xK,fold:dme,getDualMonoid:cme,getEndomorphismMonoid:pme,getFunctionMonoid:fme,getJoinMonoid:ume,getMeetMonoid:lme,getStructMonoid:sme,getTupleMonoid:ame,max:SK,min:bK,monoidAll:_K,monoidAny:TK,monoidProduct:mme,monoidString:hme,monoidSum:Ame,monoidVoid:ome,reverse:MR,struct:CK,tuple:wK},Symbol.toStringTag,{value:"Module"})),vme=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var IK=function(e,t,n){return function(r){return r===-1?e():r===0?t():n()}},yme=IK,EK=function(e){return e===-1?1:e===1?-1:0},RK={equals:function(e,t){return e===t}},FR={concat:function(e,t){return e!==0?e:t}},$K={concat:FR.concat,empty:0},bme=function(e){return e<=-1?-1:e>=1?1:0},Sme=EK,Cme=FR,wme=RK,xme=$K;const _me=Object.freeze(Object.defineProperty({__proto__:null,Eq:RK,Monoid:$K,Semigroup:FR,eqOrdering:wme,invert:Sme,match:yme,matchW:IK,monoidOrdering:xme,reverse:EK,semigroupOrdering:Cme,sign:bme},Symbol.toStringTag,{value:"Module"}));var Tme=function(e){return typeof e.map=="function"},Ime=function(e){return typeof e.contramap=="function"},Eme=function(e){return typeof e.mapWithIndex=="function"},Rme=function(e){return typeof e.ap=="function"},$me=function(e){return typeof e.chain=="function"},kme=function(e){return typeof e.bimap=="function"},Ome=function(e){return typeof e.extend=="function"},Mme=function(e){return typeof e.reduce=="function"},Fme=function(e){return typeof e.reduceWithIndex=="function"},Lme=function(e){return typeof e.alt=="function"},Bme=function(e){return typeof e.compact=="function"},Dme=function(e){return typeof e.filter=="function"},jme=function(e){return typeof e.filterWithIndex=="function"},Ume=function(e){return typeof e.promap=="function"},Pme=function(e){return typeof e.compose=="function"},Nme=function(e){return typeof e.throwError=="function"};function Wme(e){var t={};if(Tme(e)){var n=function(F){return function(M){return e.map(M,F)}};t.map=n}if(Ime(e)){var r=function(F){return function(M){return e.contramap(M,F)}};t.contramap=r}if(Eme(e)){var i=function(F){return function(M){return e.mapWithIndex(M,F)}};t.mapWithIndex=i}if(Rme(e)){var o=function(F){return function(M){return e.ap(M,F)}},a=function(F){return function(M){return e.ap(e.map(M,function(N){return function(){return N}}),F)}};t.ap=o,t.apFirst=a,t.apSecond=function(F){return function(M){return e.ap(e.map(M,function(){return function(N){return N}}),F)}}}if($me(e)){var s=function(F){return function(M){return e.chain(M,F)}},c=function(F){return function(M){return e.chain(M,function(N){return e.map(F(N),function(){return N})})}},u=function(F){return e.chain(F,z)};t.chain=s,t.chainFirst=c,t.flatten=u}if(kme(e)){var l=function(F,M){return function(N){return e.bimap(N,F,M)}},d=function(F){return function(M){return e.mapLeft(M,F)}};t.bimap=l,t.mapLeft=d}if(Ome(e)){var p=function(F){return function(M){return e.extend(M,F)}},h=function(F){return e.extend(F,z)};t.extend=p,t.duplicate=h}if(Mme(e)){var A=function(F,M){return function(N){return e.reduce(N,F,M)}},g=function(F){var M=e.foldMap(F);return function(N){return function(se){return M(se,N)}}},v=function(F,M){return function(N){return e.reduceRight(N,F,M)}};t.reduce=A,t.foldMap=g,t.reduceRight=v}if(Fme(e)){var b=function(F,M){return function(N){return e.reduceWithIndex(N,F,M)}},w=function(F){var M=e.foldMapWithIndex(F);return function(N){return function(se){return M(se,N)}}},S=function(F,M){return function(N){return e.reduceRightWithIndex(N,F,M)}};t.reduceWithIndex=b,t.foldMapWithIndex=w,t.reduceRightWithIndex=S}if(Lme(e)){var y=function(F){return function(M){return e.alt(M,F)}};t.alt=y}if(Bme(e)&&(t.compact=e.compact,t.separate=e.separate),Dme(e)){var C=function(F){return function(M){return e.filter(M,F)}},x=function(F){return function(M){return e.filterMap(M,F)}},T=function(F){return function(M){return e.partition(M,F)}},I=function(F){return function(M){return e.partitionMap(M,F)}};t.filter=C,t.filterMap=x,t.partition=T,t.partitionMap=I}if(jme(e)){var R=function(F){return function(M){return e.filterWithIndex(M,F)}},O=function(F){return function(M){return e.filterMapWithIndex(M,F)}},k=function(F){return function(M){return e.partitionWithIndex(M,F)}},P=function(F){return function(M){return e.partitionMapWithIndex(M,F)}};t.filterWithIndex=R,t.filterMapWithIndex=O,t.partitionWithIndex=k,t.partitionMapWithIndex=P}if(Ume(e)){var q=function(F,M){return function(N){return e.promap(N,F,M)}};t.promap=q}if(Pme(e)){var Y=function(F){return function(M){return e.compose(M,F)}};t.compose=Y}if(Nme(e)){var te=function(F){return function(M){return M._tag==="None"?e.throwError(F()):e.of(M.value)}},G=function(F){return F._tag==="Left"?e.throwError(F.left):e.of(F.right)},ee=function(F,M){return function(N){return F(N)?e.of(N):e.throwError(M(N))}},ne=function(F,M){return function(N){return e.chain(N,function(se){return F(se)?e.of(se):e.throwError(M(se))})}};t.fromOption=te,t.fromEither=G,t.fromPredicate=ee,t.filterOrElse=ne}return t}var pe=_;const Kme=Object.freeze(Object.defineProperty({__proto__:null,pipe:pe,pipeable:Wme},Symbol.toStringTag,{value:"Module"})),qme=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),Vme=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var Sb=function(){return Math.random()};function kK(e,t){return _(Sb,Yo(function(n){return Math.floor((t-e+1)*n+e)}))}function zme(e,t){return _(Sb,Yo(function(n){return(t-e)*n+e}))}var Qme=_(Sb,Yo(function(e){return e<.5})),Hme=function(e){return _(kK(0,e.length-1),Yo(function(t){return e[t]}))};const Yme=Object.freeze(Object.defineProperty({__proto__:null,random:Sb,randomBool:Qme,randomElem:Hme,randomInt:kK,randomRange:zme},Symbol.toStringTag,{value:"Module"}));var LR=If(OE),OK=Hu(OE),MK=Ef(yn),Gme=Rf(yn),FK=Qo,LK=MK,BK=UA(yn),Jme=BK,BR=Lf(Na),Zme=BR,DK=BR,Xme=DK,jK=Bf(Na),ege=jK,tge=WA(yn),nge=KA,UK=qA,rge=UK,PK=Gu(Na),ige=PK,NK=PA(Na),oge=NK,age=NA(Na),sge=Df(yn),Fi=function(e,t){return _(e,KK(t))},DR=function(e,t,n){return _(e,qK(t,n))},jR=function(e,t){return _(e,VK(t))},Jf=function(e,t){return _(e,UR(t))},um=function(e,t){return _(e,PR(t))},WK=function(e,t){return _(e,NR(t))},KK=$f(yn),qK=Mf(yn),VK=Ff(yn),UR=kf(Pa),cge=UR,Jo=OK,PR=Yu(Na),zK=PR,QK=zK(z),uge=QK,NR=Of(Na),lge=NR,WR=LR,un="ReaderEither",HK=function(e){var t=Vu(e);return{URI:un,_E:void 0,compact:qo(yn,t),separate:Fa(yn,t,oc)}};function dge(e){var t=xf(e),n=HK(e),r=La(yn,t),i=Ba(yn,t),o=sc(yn,t),a=cc(yn,t);return{URI:un,_E:void 0,map:Fi,compact:n.compact,separate:n.separate,filter:function(s,c){return _(s,r(c))},filterMap:function(s,c){return _(s,i(c))},partition:function(s,c){return _(s,o(c))},partitionMap:function(s,c){return _(s,a(c))}}}function YK(e){var t=Ia(Pa,ic(e));return{URI:un,_E:void 0,map:Fi,ap:function(n,r){return _(n,t(r))},of:Jo}}function GK(e){var t=jA(Na,e);return{URI:un,_E:void 0,map:Fi,alt:function(n,r){return _(n,t(r))}}}var KR={URI:un,map:Fi},fge=qe(KR),pge={URI:un,of:Jo},lm={URI:un,map:Fi,ap:Jf},JK=Dt(lm),hge=JK,ZK=jt(lm),Age=ZK,XK={URI:un,map:Fi,ap:Jf,of:Jo},Ga={URI:un,map:Fi,ap:Jf,chain:um},mge={URI:un,map:Fi,ap:Jf,of:Jo,chain:um},e8=ct(Ga),gge=e8,vge={URI:un,bimap:DR,mapLeft:jR},yge={URI:un,map:Fi,alt:WK},Zf={URI:un,fromReader:LK},bge=zA(Zf),Sge=QA(Zf),Cge=Xu(Zf),t8=HA(Zf,Ga),wge=t8,n8=YA(Zf,Ga),xge=n8,_ge={URI:un,map:Fi,ap:Jf,of:Jo,chain:um,throwError:WR},Ja={URI:un,fromEither:FK},Tge=Po(Ja),Ige=No(Ja),Ege=Fu(Ja,Ga),r8=Ea(Ja,Ga),Rge=r8,i8=Ra(Ja,Ga),$ge=i8,kge=Gs(Ja),o8=Lu(Ja,Ga),Oge=o8,Mge=ei(Ja),Fge=Jo(sn),Lge=Pt(KR),a8=Nt(Ga),Bge=a8,s8=Ut(lm),Dge=s8,c8=Jo(wn),u8=function(e){return Z(Zu(e),Ju(DA(xr)))},qR=function(e){var t=u8(e);return function(n){return pt(n)?t(n):c8}},jge=qR,l8=function(e){return qR(function(t,n){return e(n)})},Uge=l8(z),Pge={URI:un,bimap:DR,mapLeft:jR,map:Fi,of:Jo,ap:Jf,chain:um,alt:WK,throwError:LR},Nge=cn(lm),Wge=Ii(XK),Kge=function(e){return cn(Pa)(MA(e))};function qge(e){var t=YK(e),n=GK(e);return{URI:un,_E:void 0,map:Fi,ap:t.ap,of:Jo,chain:um,bimap:DR,mapLeft:jR,alt:n.alt,throwError:WR}}const Vge=Object.freeze(Object.defineProperty({__proto__:null,Alt:yge,ApT:c8,Applicative:XK,Apply:lm,Bifunctor:vge,Chain:Ga,Do:Fge,FromEither:Ja,FromReader:Zf,Functor:KR,Monad:mge,MonadThrow:_ge,Pointed:pge,URI:un,alt:NR,altW:lge,ap:UR,apFirst:JK,apFirstW:hge,apS:s8,apSW:Dge,apSecond:ZK,apSecondW:Age,apW:cge,ask:bge,asks:Sge,asksReaderEither:rge,asksReaderEitherW:UK,bimap:qK,bind:a8,bindTo:Lge,bindW:Bge,chain:PR,chainEitherK:r8,chainEitherKW:Rge,chainFirst:e8,chainFirstEitherK:i8,chainFirstEitherKW:$ge,chainFirstReaderK:n8,chainFirstReaderKW:xge,chainFirstW:gge,chainOptionK:Ege,chainReaderK:t8,chainReaderKW:wge,chainW:zK,filterOrElse:o8,filterOrElseW:Oge,flap:fge,flatten:uge,flattenW:QK,fold:Zme,foldW:Xme,fromEither:FK,fromEitherK:Mge,fromOption:Tge,fromOptionK:Ige,fromPredicate:kge,fromReader:LK,fromReaderK:Cge,getAltReaderValidation:GK,getApplicativeReaderValidation:YK,getApplyMonoid:Wge,getApplySemigroup:Nge,getCompactable:HK,getFilterable:dge,getOrElse:jK,getOrElseW:ege,getReaderValidation:qge,getSemigroup:Kge,left:LR,leftReader:Gme,local:nge,map:KK,mapLeft:VK,match:BK,matchE:BR,matchEW:DK,matchW:Jme,of:Jo,orElse:PK,orElseFirst:NK,orElseFirstW:oge,orElseW:ige,orLeft:age,readerEither:Pge,right:OK,rightReader:MK,sequenceArray:Uge,swap:sge,throwError:WR,toUnion:tge,traverseArray:l8,traverseArrayWithIndex:jge,traverseReadonlyArrayWithIndex:qR,traverseReadonlyNonEmptyArrayWithIndex:u8},Symbol.toStringTag,{value:"Module"}));function VR(e){return function(t){return function(){return e.of(t)}}}function zR(e){return function(t){return function(n){return function(r){return e.map(n(r),t)}}}}function QR(e){return function(t){return function(n){return function(r){return e.ap(n(r),t(r))}}}}function HR(e){return function(t){return function(n){return function(r){return e.chain(n(r),function(i){return t(i)(r)})}}}}function YR(e){return function(t){return Z(t,e.of)}}function zge(e){return function(t){return Z(t,e)}}function Qge(e){var t=QR(e),n=zR(e),r=HR(e);return{map:function(i,o){return _(i,n(o))},ap:function(i,o){return _(i,t(o))},of:VR(e),chain:function(i,o){return _(i,r(o))},ask:function(){return e.of},asks:function(i){return Z(i,e.of)},local:function(i,o){return function(a){return i(o(a))}},fromReader:YR(e),fromM:function(i){return function(){return i}}}}const Hge=Object.freeze(Object.defineProperty({__proto__:null,ap:QR,chain:HR,fromNaturalTransformation:zge,fromReader:YR,getReaderM:Qge,map:zR,of:VR},Symbol.toStringTag,{value:"Module"}));var cr=function(e){return function(){return Promise.resolve().then(e)}};function Yge(e){return function(t){return function(){return new Promise(function(n){setTimeout(function(){Promise.resolve().then(t).then(n)},e)})}}}var ro=function(e,t){return _(e,fc(t))},ol=function(e,t){return _(e,d8(t))},GR=function(e,t){return _(e,dm(function(n){return _(t,fc(n))}))},Xf=function(e,t){return _(e,dm(t))},fc=function(e){return function(t){return function(){return Promise.resolve().then(t).then(e)}}},d8=function(e){return function(t){return function(){return Promise.all([Promise.resolve().then(t),Promise.resolve().then(e)]).then(function(n){var r=n[0],i=n[1];return r(i)})}}},Kn=function(e){return function(){return Promise.resolve(e)}},dm=function(e){return function(t){return function(){return Promise.resolve().then(t).then(function(n){return e(n)()})}}},Gge=dm(z),ur="Task";function Jge(){return{concat:function(e,t){return function(){return Promise.race([Promise.resolve().then(e),Promise.resolve().then(t)])}},empty:p8}}var Ue={URI:ur,map:ro},Zge=qe(Ue),Tn={URI:ur,of:Kn},al={URI:ur,map:ro,ap:ol},Xge=Dt(al),eve=jt(al),fm={URI:ur,map:ro,ap:ol,of:Kn},Cb={URI:ur,map:ro,ap:GR},f8={URI:ur,map:ro,ap:GR,of:Kn},ep={URI:ur,map:ro,ap:ol,chain:Xf},ln={URI:ur,map:ro,of:Kn,ap:ol,chain:Xf},tve={URI:ur,map:ro,of:Kn,ap:ol,chain:Xf,fromIO:cr},pm=z,nve={URI:ur,map:ro,of:Kn,ap:ol,chain:Xf,fromIO:cr,fromTask:pm},rve=ct(ep),wb={URI:ur,fromIO:cr},ive=zo(wb),ove=Da(wb,ep),ave=ja(wb,ep),sve={URI:ur,fromIO:cr,fromTask:pm},p8=function(){return new Promise(function(e){})},cve=Kn(sn),uve=Pt(Ue),lve=Nt(ep),dve=Ut(al),JR=Kn(wn),tp=function(e){return function(t){return function(){return Promise.all(t.map(function(n,r){return Promise.resolve().then(function(){return e(r,n)()})}))}}},ZR=function(e){var t=tp(e);return function(n){return pt(n)?t(n):JR}},XR=function(e){return function(t){return function(){return Gd(t).reduce(function(n,r,i){return n.then(function(o){return Promise.resolve().then(e(i+1,r)).then(function(a){return o.push(a),o})})},Promise.resolve().then(e(0,Xr(t))).then(oA))}}},e$=function(e){var t=XR(e);return function(n){return pt(n)?t(n):JR}},fve=ZR,h8=function(e){return ZR(function(t,n){return e(n)})},pve=h8(z),hve=e$,A8=function(e){return e$(function(t,n){return e(n)})},Ave=A8(z),mve={URI:ur,map:ro,of:Kn,ap:ol,chain:Xf,fromIO:cr,fromTask:pm},gve={URI:ur,map:ro,of:Kn,ap:GR,chain:Xf,fromIO:cr,fromTask:pm},vve=cn(Cb),yve=Ii(f8);const bve=Object.freeze(Object.defineProperty({__proto__:null,ApT:JR,ApplicativePar:fm,ApplicativeSeq:f8,ApplyPar:al,ApplySeq:Cb,Chain:ep,Do:cve,FromIO:wb,FromTask:sve,Functor:Ue,Monad:ln,MonadIO:tve,MonadTask:nve,Pointed:Tn,URI:ur,ap:d8,apFirst:Xge,apS:dve,apSecond:eve,bind:lve,bindTo:uve,chain:dm,chainFirst:rve,chainFirstIOK:ave,chainIOK:ove,delay:Yge,flap:Zge,flatten:Gge,fromIO:cr,fromIOK:ive,fromTask:pm,getMonoid:yve,getRaceMonoid:Jge,getSemigroup:vve,map:fc,never:p8,of:Kn,sequenceArray:pve,sequenceSeqArray:Ave,task:mve,taskSeq:gve,traverseArray:h8,traverseArrayWithIndex:fve,traverseReadonlyArrayWithIndex:ZR,traverseReadonlyArrayWithIndexSeq:e$,traverseReadonlyNonEmptyArrayWithIndex:tp,traverseReadonlyNonEmptyArrayWithIndexSeq:XR,traverseSeqArray:A8,traverseSeqArrayWithIndex:hve},Symbol.toStringTag,{value:"Module"}));var m8=YR(Tn),np=Qo,sl=Z(cr,np),Sve=KA,g8=qA,Cve=g8,io=function(e,t){return _(e,n$(t))},cl=function(e,t){return _(e,r$(t))},t$=function(e,t){return _(e,xb(function(n){return _(t,n$(n))}))},rp=function(e,t){return _(e,xb(t))},n$=zR(Ue),r$=QR(al),wve=r$,Li=VR(Tn),xb=HR(ln),v8=xb,y8=v8(z),xve=y8,qn="ReaderTask",bn={URI:qn,map:io},_ve=qe(bn),hm={URI:qn,of:Li},Am={URI:qn,map:io,ap:cl},Tve=Dt(Am),Ive=jt(Am),Eve={URI:qn,map:io,ap:cl,of:Li},i$={URI:qn,map:io,ap:t$},b8={URI:qn,map:io,ap:t$,of:Li},Zo={URI:qn,map:io,ap:cl,chain:rp},Za={URI:qn,map:io,of:Li,ap:cl,chain:rp},Rve={URI:qn,map:io,of:Li,ap:cl,chain:rp,fromIO:sl},$ve={URI:qn,map:io,of:Li,ap:cl,chain:rp,fromIO:sl,fromTask:np},S8=ct(Zo),kve=S8,_b={URI:qn,fromIO:sl},Ove=zo(_b),Mve=Da(_b,Zo),Fve=ja(_b,Zo),ip={URI:qn,fromReader:m8},Lve=zA(ip),Bve=QA(ip),Dve=Xu(ip),C8=HA(ip,Zo),jve=C8,w8=YA(ip,Zo),Uve=w8,Tb={URI:qn,fromIO:sl,fromTask:np},Pve=el(Tb),Nve=jf(Tb,Zo),Wve=Uf(Tb,Zo),Kve=Li(sn),qve=Pt(bn),x8=Nt(Zo),Vve=x8,_8=Ut(Am),zve=_8,o$=Li(wn),T8=function(e){return Z(Zu(e),Ju(tp(xr)))},a$=function(e){var t=T8(e);return function(n){return pt(n)?t(n):o$}},I8=function(e){return Z(Zu(e),Ju(XR(xr)))},s$=function(e){var t=I8(e);return function(n){return pt(n)?t(n):o$}},Qve=a$,E8=function(e){return a$(function(t,n){return e(n)})},Hve=E8(z),Yve=s$,R8=function(e){return s$(function(t,n){return e(n)})},Gve=R8(z),Jve={URI:qn,map:io,of:Li,ap:cl,chain:rp,fromIO:sl,fromTask:np},Zve={URI:qn,map:io,of:Li,ap:t$,chain:rp,fromIO:sl,fromTask:np},Xve=cn(i$),eye=Ii(b8);function tye(e,t){return e(t)()}const nye=Object.freeze(Object.defineProperty({__proto__:null,ApT:o$,ApplicativePar:Eve,ApplicativeSeq:b8,ApplyPar:Am,ApplySeq:i$,Chain:Zo,Do:Kve,FromIO:_b,FromReader:ip,FromTask:Tb,Functor:bn,Monad:Za,MonadIO:Rve,MonadTask:$ve,Pointed:hm,URI:qn,ap:r$,apFirst:Tve,apS:_8,apSW:zve,apSecond:Ive,apW:wve,ask:Lve,asks:Bve,asksReaderTask:Cve,asksReaderTaskW:g8,bind:x8,bindTo:qve,bindW:Vve,chain:xb,chainFirst:S8,chainFirstIOK:Fve,chainFirstReaderK:w8,chainFirstReaderKW:Uve,chainFirstTaskK:Wve,chainFirstW:kve,chainIOK:Mve,chainReaderK:C8,chainReaderKW:jve,chainTaskK:Nve,chainW:v8,flap:_ve,flatten:xve,flattenW:y8,fromIO:sl,fromIOK:Ove,fromReader:m8,fromReaderK:Dve,fromTask:np,fromTaskK:Pve,getMonoid:eye,getSemigroup:Xve,local:Sve,map:n$,of:Li,readerTask:Jve,readerTaskSeq:Zve,run:tye,sequenceArray:Hve,sequenceSeqArray:Gve,traverseArray:E8,traverseArrayWithIndex:Qve,traverseReadonlyArrayWithIndex:a$,traverseReadonlyArrayWithIndexSeq:s$,traverseReadonlyNonEmptyArrayWithIndex:T8,traverseReadonlyNonEmptyArrayWithIndexSeq:I8,traverseSeqArray:R8,traverseSeqArrayWithIndex:Yve},Symbol.toStringTag,{value:"Module"}));var rye=function(e,t,n,r){function i(o){return o instanceof n?o:new n(function(a){a(o)})}return new(n||(n=Promise))(function(o,a){function s(l){try{u(r.next(l))}catch(d){a(d)}}function c(l){try{u(r.throw(l))}catch(d){a(d)}}function u(l){l.done?o(l.value):i(l.value).then(s,c)}u((r=r.apply(e,t||[])).next())})},iye=function(e,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(u){return function(l){return c([u,l])}}function c(u){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,i&&(o=u[0]&2?i.return:u[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;switch(i=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,i=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){n.label=u[1];break}if(u[0]===6&&n.label<o[1]){n.label=o[1],o=u;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(u);break}o[2]&&n.ops.pop(),n.trys.pop();continue}u=t.call(e,n)}catch(l){u=[6,l],i=0}finally{r=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}},c$=If(Tn),u$=Hu(Tn),Ib=Ef(Ue),l$=Rf(Ue),d$=Z(cr,Ib),$8=Z(cr,l$),pc=d$,op=Ib,f$=Kn,p$=cr,k8=function(e){return fc(vW(e))},O8=UA(Ue),oye=O8,h$=Lf(ln),aye=h$,M8=h$,sye=M8,F8=Bf(ln),cye=F8,L8=function(e,t){return function(){return rye(void 0,void 0,void 0,function(){var n;return iye(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,e().then(Ys)];case 1:return[2,r.sent()];case 2:return n=r.sent(),[2,ba(t(n))];case 3:return[2]}})})}},uye=function(e,t){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return L8(function(){return e.apply(void 0,n)},t)}},lye=WA(Ue),dye=U0(Tn),fye=P0(Tn),pye=wE(ln),B8=Gu(ln),hye=B8,Eb=PA(ln),Aye=Eb,mye=function(e){return Eb(e9(e))},gye=function(e){return Eb(t9(e))},vye=NA(ln),yye=Df(Ue),D8=function(e){var t=k8(e);return function(n){return Z(n,t)}},j8=function(e){return function(t){return function(n){return _(n,mm(D8(e)(t)))}}},bye=j8,U8=function(e){return Z(e,p$)},P8=function(e){return Ah(U8(e))},Sye=P8,In=function(e,t){return _(e,g$(t))},hc=function(e,t){return _(e,v$(t))},A$=function(e,t){return _(e,mm(function(n){return _(t,g$(n))}))},Ac=function(e,t){return _(e,mm(t))},Rb=function(e,t,n){return _(e,N8(t,n))},$b=function(e,t){return _(e,W8(t))},m$=function(e,t){return _(e,y$(t))},g$=$f(Ue),N8=Mf(Ue),W8=Ff(Ue),v$=kf(al),Cye=v$,mm=Yu(ln),Ah=mm,K8=Ah(z),wye=K8,y$=Of(ln),xye=y$,Er=u$,gm=c$,ht="TaskEither";function b$(e,t){var n=Ia(e,ic(t));return{URI:ht,_E:void 0,map:In,ap:function(r,i){return _(r,n(i))},of:Er}}function q8(e){var t=jA(ln,e);return{URI:ht,_E:void 0,map:In,alt:function(n,r){return _(n,t(r))}}}var V8=function(e){var t=Vu(e);return{URI:ht,_E:void 0,compact:qo(Ue,t),separate:Fa(Ue,t,oc)}};function _ye(e){var t=xf(e),n=V8(e),r=La(Ue,t),i=Ba(Ue,t),o=sc(Ue,t),a=cc(Ue,t);return{URI:ht,_E:void 0,map:In,compact:n.compact,separate:n.separate,filter:function(s,c){return _(s,r(c))},filterMap:function(s,c){return _(s,i(c))},partition:function(s,c){return _(s,o(c))},partitionMap:function(s,c){return _(s,a(c))}}}var S$={URI:ht,map:In},Tye=qe(S$),Iye={URI:ht,of:Er},kb={URI:ht,map:In,ap:hc},z8=Dt(kb),Eye=z8,Q8=jt(kb),Rye=Q8,$ye={URI:ht,map:In,ap:hc,of:Er},H8={URI:ht,map:In,ap:A$},Y8={URI:ht,map:In,ap:A$,of:Er},oo={URI:ht,map:In,ap:hc,chain:Ac},kye={URI:ht,map:In,ap:hc,chain:Ac,of:Er},Oye={URI:ht,map:In,ap:hc,chain:Ac,of:Er,fromIO:pc},Mye={URI:ht,map:In,ap:hc,chain:Ac,of:Er,fromIO:pc,fromTask:op},Fye={URI:ht,map:In,ap:hc,chain:Ac,of:Er,throwError:gm},G8=ct(oo),Lye=G8,Bye={URI:ht,bimap:Rb,mapLeft:$b},Dye={URI:ht,map:In,alt:m$},Xa={URI:ht,fromEither:f$},jye=Po(Xa),Uye=No(Xa),Pye=Fu(Xa,oo),J8=Ea(Xa,oo),Nye=J8,Z8=Ra(Xa,oo),Wye=Z8,Kye=Gs(Xa),X8=Lu(Xa,oo),qye=X8,Vye=ei(Xa),Ob={URI:ht,fromIO:pc},e9=zo(Ob),zye=Da(Ob,oo),Qye=ja(Ob,oo),Mb={URI:ht,fromIO:pc,fromTask:op},t9=el(Mb),Hye=jf(Mb,oo),Yye=Uf(Mb,oo);function Gye(e){return function(){var t=Array.prototype.slice.call(arguments);return function(){return new Promise(function(n){var r=function(i,o){return i!=null?n(ba(i)):n(Ys(o))};e.apply(null,t.concat(r))})}}}var Jye=function(e,t,n){return C$(e,t,n)},C$=function(e,t,n){return _(e,Ah(function(r){return _(t(r),dm(function(i){return _(n(r,i),Ah(function(){return Kn(i)}))}))}))},Zye=Er(sn),Xye=Pt(S$),n9=Nt(oo),e0e=n9,r9=Ut(kb),t0e=r9,w$=Er(wn),x$=function(e){return Z(tp(e),fc(DA(xr)))},_$=function(e){var t=x$(e);return function(n){return pt(n)?t(n):w$}},T$=function(e){return function(t){return function(){return Gd(t).reduce(function(n,r,i){return n.then(function(o){return on(o)?n:e(i+1,r)().then(function(a){return on(a)?a:(o.right.push(a.right),o)})})},e(0,Xr(t))().then(zu(oA)))}}},I$=function(e){var t=T$(e);return function(n){return pt(n)?t(n):w$}},n0e=_$,i9=function(e){return _$(function(t,n){return e(n)})},r0e=i9(z),i0e=I$,o9=function(e){return I$(function(t,n){return e(n)})},o0e=o9(z),a0e={URI:ht,bimap:Rb,mapLeft:$b,map:In,of:Er,ap:hc,chain:Ac,alt:m$,fromIO:pc,fromTask:op,throwError:gm},s0e={URI:ht,bimap:Rb,mapLeft:$b,map:In,of:Er,ap:A$,chain:Ac,alt:m$,fromIO:pc,fromTask:op,throwError:gm},c0e=cn(H8),u0e=Ii(Y8),l0e=function(e){return cn(Cb)(MA(e))};function d0e(e){var t=b$(fm,e),n=q8(e);return{URI:ht,_E:void 0,map:In,ap:t.ap,of:Er,chain:Ac,bimap:Rb,mapLeft:$b,alt:n.alt,fromIO:pc,fromTask:op,throwError:gm}}const f0e=Object.freeze(Object.defineProperty({__proto__:null,Alt:Dye,ApT:w$,ApplicativePar:$ye,ApplicativeSeq:Y8,ApplyPar:kb,ApplySeq:H8,Bifunctor:Bye,Chain:oo,Do:Zye,FromEither:Xa,FromIO:Ob,FromTask:Mb,Functor:S$,Monad:kye,MonadIO:Oye,MonadTask:Mye,MonadThrow:Fye,Pointed:Iye,URI:ht,alt:y$,altW:xye,ap:v$,apFirst:z8,apFirstW:Eye,apS:r9,apSW:t0e,apSecond:Q8,apSecondW:Rye,apW:Cye,bimap:N8,bind:n9,bindTo:Xye,bindW:e0e,bracket:Jye,bracketW:C$,chain:mm,chainEitherK:J8,chainEitherKW:Nye,chainFirst:G8,chainFirstEitherK:Z8,chainFirstEitherKW:Wye,chainFirstIOK:Qye,chainFirstTaskK:Yye,chainFirstW:Lye,chainIOEitherK:Sye,chainIOEitherKW:P8,chainIOK:zye,chainNullableK:pye,chainOptionK:Pye,chainTaskK:Hye,chainTaskOptionK:bye,chainTaskOptionKW:j8,chainW:Ah,filterOrElse:X8,filterOrElseW:qye,flap:Tye,flatten:wye,flattenW:K8,fold:aye,foldW:sye,fromEither:f$,fromEitherK:Vye,fromIO:pc,fromIOEither:p$,fromIOEitherK:U8,fromIOK:e9,fromNullable:dye,fromNullableK:fye,fromOption:jye,fromOptionK:Uye,fromPredicate:Kye,fromTask:op,fromTaskK:t9,fromTaskOption:k8,fromTaskOptionK:D8,getAltTaskValidation:q8,getApplicativeTaskValidation:b$,getApplyMonoid:u0e,getApplySemigroup:c0e,getCompactable:V8,getFilterable:_ye,getOrElse:F8,getOrElseW:cye,getSemigroup:l0e,getTaskValidation:d0e,left:c$,leftIO:$8,leftTask:l$,map:g$,mapLeft:W8,match:O8,matchE:h$,matchEW:M8,matchW:oye,of:Er,orElse:B8,orElseFirst:Eb,orElseFirstIOK:mye,orElseFirstTaskK:gye,orElseFirstW:Aye,orElseW:hye,orLeft:vye,right:u$,rightIO:d$,rightTask:Ib,sequenceArray:r0e,sequenceSeqArray:o0e,swap:yye,taskEither:a0e,taskEitherSeq:s0e,taskify:Gye,throwError:gm,toUnion:lye,traverseArray:i9,traverseArrayWithIndex:n0e,traverseReadonlyArrayWithIndex:_$,traverseReadonlyArrayWithIndexSeq:I$,traverseReadonlyNonEmptyArrayWithIndex:x$,traverseReadonlyNonEmptyArrayWithIndexSeq:T$,traverseSeqArray:o9,traverseSeqArrayWithIndex:i0e,tryCatch:L8,tryCatchK:uye},Symbol.toStringTag,{value:"Module"}));var mc=Qo,Fb=If(hm),E$=Hu(hm),R$=Z(Ib,mc),a9=Z(l$,mc),$$=function(e){return Z(e,u$)},s9=function(e){return Z(e,c$)},c9=Ef(bn),p0e=Rf(bn),k$=Z(d$,mc),u9=Z($8,mc),l9=Li,d9=$$,gc=k$,ap=R$,O$=Z(p$,mc),M$=function(e){return Z(e,f$)},f9=UA(bn),h0e=f9,F$=Lf(Zo),A0e=F$,p9=F$,m0e=p9,h9=Bf(Za),g0e=h9,v0e=WA(bn),y0e=U0(hm),b0e=P0(hm),S0e=wE(Za),C0e=KA,A9=qA,w0e=A9,m9=Gu(Za),x0e=m9,g9=PA(Za),_0e=g9,T0e=NA(Za),I0e=Df(bn),v9=function(e){return Z(e,O$)},y9=function(e){return sp(v9(e))},E0e=y9,L$=function(e){return Z(e,mc)},b9=function(e){return sp(L$(e))},R0e=b9,S9=function(e){return Pb(L$(e))},$0e=S9,B$=function(e){return Z(e,M$)},C9=function(e){return sp(B$(e))},k0e=C9,w9=function(e){return Pb(B$(e))},O0e=w9,En=function(e,t){return _(e,vm(t))},vc=function(e,t){return _(e,N$(t))},D$=function(e,t){return _(e,Db(function(n){return _(t,vm(n))}))},yc=function(e,t){return _(e,Db(t))},j$=function(e,t){return _(e,jb(t))},Lb=function(e,t,n){return _(e,U$(t,n))},Bb=function(e,t){return _(e,P$(t))},vm=$f(bn),U$=Mf(bn),P$=Ff(bn),N$=kf(Am),M0e=N$,Rr=E$,Db=Yu(Za),sp=Db,x9=sp(z),F0e=x9,jb=Of(Za),_9=jb,ym=Fb,dt="ReaderTaskEither",T9=function(e){var t=Vu(e);return{URI:dt,_E:void 0,compact:qo(bn,t),separate:Fa(bn,t,oc)}};function L0e(e){var t=xf(e),n=T9(e),r=La(bn,t),i=Ba(bn,t),o=sc(bn,t),a=cc(bn,t);return{URI:dt,_E:void 0,map:En,compact:n.compact,separate:n.separate,filter:function(s,c){return _(s,r(c))},filterMap:function(s,c){return _(s,i(c))},partition:function(s,c){return _(s,o(c))},partitionMap:function(s,c){return _(s,a(c))}}}function I9(e,t){var n=Ia(Pa,b$(e,t));return{URI:dt,_E:void 0,map:En,ap:function(r,i){return _(r,n(i))},of:Rr}}function E9(e){var t=jA(Za,e);return{URI:dt,_E:void 0,map:En,alt:function(n,r){return _(n,t(r))}}}var ul={URI:dt,map:En},B0e=qe(ul),W$={URI:dt,of:Rr},Ub={URI:dt,map:En,ap:vc},R9=Dt(Ub),D0e=R9,$9=jt(Ub),j0e=$9,U0e={URI:dt,map:En,ap:vc,of:Rr},k9={URI:dt,map:En,ap:D$},O9={URI:dt,map:En,ap:D$,of:Rr},lr={URI:dt,map:En,ap:vc,chain:yc},P0e={URI:dt,map:En,ap:vc,chain:yc,of:Rr},N0e={URI:dt,map:En,ap:vc,chain:yc,of:Rr,fromIO:gc},W0e={URI:dt,map:En,ap:vc,chain:yc,of:Rr,fromIO:gc,fromTask:ap},K0e={URI:dt,map:En,ap:vc,chain:yc,of:Rr,throwError:ym},M9=ct(lr),Pb=M9,q0e={URI:dt,bimap:Lb,mapLeft:Bb},V0e={URI:dt,map:En,alt:j$},cp={URI:dt,fromReader:d9},z0e=zA(cp),Q0e=QA(cp),H0e=Xu(cp),F9=HA(cp,lr),Y0e=F9,L9=YA(cp,lr),G0e=L9,K$=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return c9(e.apply(void 0,t))}},B9=function(e){return sp(K$(e))},J0e=B9,D9=function(e){return Pb(K$(e))},Z0e=D9,es={URI:dt,fromEither:l9},X0e=Po(es),ebe=No(es),tbe=Fu(es,lr),j9=Ea(es,lr),nbe=j9,U9=Ra(es,lr),rbe=U9,ibe=Gs(es),P9=Lu(es,lr),obe=P9,abe=ei(es),Nb={URI:dt,fromIO:gc},sbe=zo(Nb),cbe=Da(Nb,lr),ube=ja(Nb,lr),Wb={URI:dt,fromIO:gc,fromTask:ap},lbe=el(Wb),dbe=jf(Wb,lr),fbe=Uf(Wb,lr);function pbe(e,t,n){return N9(e,t,n)}function N9(e,t,n){return function(r){return C$(e(r),function(i){return t(i)(r)},function(i,o){return n(i,o)(r)})}}var hbe=Rr(sn),Abe=Pt(ul),W9=Nt(lr),mbe=W9,K9=Ut(Ub),gbe=K9,q$=Rr(wn),q9=function(e){return Z(Zu(e),Ju(x$(xr)))},V$=function(e){var t=q9(e);return function(n){return pt(n)?t(n):q$}},V9=function(e){return Z(Zu(e),Ju(T$(xr)))},z$=function(e){var t=V9(e);return function(n){return pt(n)?t(n):q$}},vbe=V$,z9=function(e){return V$(function(t,n){return e(n)})},ybe=z9(z),bbe=z$,Q9=function(e){return z$(function(t,n){return e(n)})},Sbe=Q9(z),Cbe={URI:dt,map:En,of:Rr,ap:vc,chain:yc,alt:j$,bimap:Lb,mapLeft:Bb,fromIO:gc,fromTask:ap,throwError:ym},wbe={URI:dt,map:En,of:Rr,ap:D$,chain:yc,alt:j$,bimap:Lb,mapLeft:Bb,fromIO:gc,fromTask:ap,throwError:ym},xbe=cn(k9),_be=Ii(O9),Tbe=function(e){return cn(i$)(MA(e))};function Ibe(e){var t=I9(fm,e),n=E9(e);return{URI:dt,_E:void 0,map:En,of:Rr,chain:yc,bimap:Lb,mapLeft:Bb,ap:t.ap,alt:n.alt,fromIO:gc,fromTask:ap,throwError:ym}}function Ebe(e,t){return e(t)()}const Rbe=Object.freeze(Object.defineProperty({__proto__:null,Alt:V0e,ApT:q$,ApplicativePar:U0e,ApplicativeSeq:O9,ApplyPar:Ub,ApplySeq:k9,Bifunctor:q0e,Chain:lr,Do:hbe,FromEither:es,FromIO:Nb,FromReader:cp,FromTask:Wb,Functor:ul,Monad:P0e,MonadIO:N0e,MonadTask:W0e,MonadThrow:K0e,Pointed:W$,URI:dt,alt:jb,altW:_9,ap:N$,apFirst:R9,apFirstW:D0e,apS:K9,apSW:gbe,apSecond:$9,apSecondW:j0e,apW:M0e,ask:z0e,asks:Q0e,asksReaderTaskEither:w0e,asksReaderTaskEitherW:A9,bimap:U$,bind:W9,bindTo:Abe,bindW:mbe,bracket:pbe,bracketW:N9,chain:Db,chainEitherK:j9,chainEitherKW:nbe,chainFirst:M9,chainFirstEitherK:U9,chainFirstEitherKW:rbe,chainFirstIOK:ube,chainFirstReaderEitherK:O0e,chainFirstReaderEitherKW:w9,chainFirstReaderK:L9,chainFirstReaderKW:G0e,chainFirstReaderTaskK:Z0e,chainFirstReaderTaskKW:D9,chainFirstTaskEitherK:$0e,chainFirstTaskEitherKW:S9,chainFirstTaskK:fbe,chainFirstW:Pb,chainIOEitherK:E0e,chainIOEitherKW:y9,chainIOK:cbe,chainNullableK:S0e,chainOptionK:tbe,chainReaderEitherK:k0e,chainReaderEitherKW:C9,chainReaderK:F9,chainReaderKW:Y0e,chainReaderTaskK:J0e,chainReaderTaskKW:B9,chainTaskEitherK:R0e,chainTaskEitherKW:b9,chainTaskK:dbe,chainW:sp,filterOrElse:P9,filterOrElseW:obe,flap:B0e,flatten:F0e,flattenW:x9,fold:A0e,foldW:m0e,fromEither:l9,fromEitherK:abe,fromIO:gc,fromIOEither:O$,fromIOEitherK:v9,fromIOK:sbe,fromNullable:y0e,fromNullableK:b0e,fromOption:X0e,fromOptionK:ebe,fromPredicate:ibe,fromReader:d9,fromReaderEither:M$,fromReaderEitherK:B$,fromReaderK:H0e,fromReaderTaskK:K$,fromTask:ap,fromTaskEither:mc,fromTaskEitherK:L$,fromTaskK:lbe,getAltReaderTaskValidation:E9,getApplicativeReaderTaskValidation:I9,getApplyMonoid:_be,getApplySemigroup:xbe,getCompactable:T9,getFilterable:L0e,getOrElse:h9,getOrElseW:g0e,getReaderTaskValidation:Ibe,getSemigroup:Tbe,left:Fb,leftIO:u9,leftReader:s9,leftReaderTask:p0e,leftTask:a9,local:C0e,map:vm,mapLeft:P$,match:f9,matchE:F$,matchEW:p9,matchW:h0e,of:Rr,orElse:m9,orElseFirst:g9,orElseFirstW:_0e,orElseW:x0e,orLeft:T0e,readerTaskEither:Cbe,readerTaskEitherSeq:wbe,right:E$,rightIO:k$,rightReader:$$,rightReaderTask:c9,rightTask:R$,run:Ebe,sequenceArray:ybe,sequenceSeqArray:Sbe,swap:I0e,throwError:ym,toUnion:v0e,traverseArray:z9,traverseArrayWithIndex:vbe,traverseReadonlyArrayWithIndex:V$,traverseReadonlyArrayWithIndexSeq:z$,traverseReadonlyNonEmptyArrayWithIndex:q9,traverseReadonlyNonEmptyArrayWithIndexSeq:V9,traverseSeqArray:Q9,traverseSeqArrayWithIndex:bbe},Symbol.toStringTag,{value:"Module"}));var H9={equals:function(e,t){return e===t}},Y9={concat:function(e,t){return e+t}},G9="",$be={concat:Y9.concat,empty:G9},J={equals:H9.equals,compare:function(e,t){return e<t?-1:e>t?1:0}},kbe={show:function(e){return JSON.stringify(e)}},Obe=function(e){return typeof e=="string"},Mbe=function(e){return e.toUpperCase()},Fbe=function(e){return e.toLowerCase()},Lbe=function(e,t){return function(n){return n.replace(e,t)}},Bbe=function(e){return e.trim()},Dbe=function(e){return e.trimLeft()},jbe=function(e){return e.trimRight()},Ube=function(e,t){return function(n){return n.slice(e,t)}},Pbe=function(e){return e.length===0},Nbe=function(e){return e.length},Wbe=function(e){return function(t){var n=t.split(e);return Wo(n)?n:[t]}},Kbe=function(e,t){return function(n){return n.includes(e,t)}},qbe=function(e,t){return function(n){return n.startsWith(e,t)}},Vbe=function(e,t){return function(n){return n.endsWith(e,t)}};const zbe=Object.freeze(Object.defineProperty({__proto__:null,Eq:H9,Monoid:$be,Ord:J,Semigroup:Y9,Show:kbe,empty:G9,endsWith:Vbe,includes:Kbe,isEmpty:Pbe,isString:Obe,replace:Lbe,size:Nbe,slice:Ube,split:Wbe,startsWith:qbe,toLowerCase:Fbe,toUpperCase:Mbe,trim:Bbe,trimLeft:Dbe,trimRight:jbe},Symbol.toStringTag,{value:"Module"}));var Qbe=function(e){return Object.assign({},e)},Hbe=function(e){return Object.assign({},e)},J9=function(e){return Object.keys(e).length},Lo=function(e){for(var t in e)if(st.call(e,t))return!1;return!0},up=function(e){return function(t){return Object.keys(t).sort(e.compare)}},Ybe=up(J);function Kb(e){if(typeof e=="function")return Kb(J)(e);var t=up(e);return function(n){return function(r){for(var i=[],o=0,a=t(r);o<a.length;o++){var s=a[o];i.push(n(s,r[s]))}return i}}}var Q$=Kb(J)(function(e,t){return[e,t]});function Gbe(e){return function(t){var n=Q$(t),r=n.length;return e.unfold(0,function(i){return i<r?Ae([n[i],i+1]):we})}}var H$=function(e,t){return function(n){if(st.call(n,e)&&n[e]===t)return n;var r=Object.assign({},n);return r[e]=t,r}},Ca=function(e,t){return st.call(t,e)};function Y$(e){return function(t){if(!st.call(t,e))return t;var n=Object.assign({},t);return delete n[e],n}}var Jbe=function(e,t){return function(n){if(!Ca(e,n))return we;if(n[e]===t)return Ae(n);var r=Object.assign({},n);return r[e]=t,Ae(r)}},Zbe=function(e,t){return function(n){if(!Ca(e,n))return we;var r=t(n[e]);if(r===n[e])return Ae(n);var i=Object.assign({},n);return i[e]=r,Ae(i)}};function Xbe(e){var t=Y$(e);return function(n){var r=fu(e,n);return qt(r)?we:Ae([r.value,t(n)])}}function qb(e){return function(t,n){if(n===void 0){var r=qb(e);return function(o){return r(o,t)}}for(var i in t)if(!st.call(n,i)||!e.equals(t[i],n[i]))return!1;return!0}}function fu(e,t){return t===void 0?function(n){return fu(e,n)}:st.call(t,e)?Ae(t[e]):we}var bm={};function Vb(e){return function(t){var n={};for(var r in t)st.call(t,r)&&(n[r]=e(r,t[r]));return n}}function G$(e){return Vb(function(t,n){return e(n)})}function bd(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(e.length===2)return bd(J).apply(void 0,e);var n=up(e[0]);return function(r,i){return function(o){for(var a=r,s=n(o),c=s.length,u=0;u<c;u++){var l=s[u];a=i(l,a,o[l])}return a}}}function Sd(e){if("compare"in e){var t=up(e);return function(n){return function(r){return function(i){for(var o=n.empty,a=t(i),s=a.length,c=0;c<s;c++){var u=a[c];o=n.concat(o,r(u,i[u]))}return o}}}}return Sd(J)(e)}function Cd(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(e.length===2)return Cd(J).apply(void 0,e);var n=up(e[0]);return function(r,i){return function(o){for(var a=r,s=n(o),c=s.length,u=c-1;u>=0;u--){var l=s[u];a=i(l,o[l],a)}return a}}}var Z9=function(e,t){var n;return n={},n[e]=t,n};function X9(e){var t=Cm(J)(e);return function(n){return function(r){return t(r,n)}}}function zb(e){var t=Xo(J)(e);return function(n){return function(r){return t(r,n)}}}function lp(e){return Sm(J)(e)}var e1e=function(e){var t=zb(e);return function(n){return function(r){return e.map(_(r,t(n)),ts)}}},t1e=function(e){var t=zb(e);return function(n){return function(r){return e.map(_(r,t(n)),ns)}}};function Qb(e){return function(t){var n={},r={};for(var i in t)if(st.call(t,i)){var o=e(i,t[i]);switch(o._tag){case"Left":n[i]=o.left;break;case"Right":r[i]=o.right;break}}return Me(n,r)}}function Hb(e){return function(t){var n={},r={};for(var i in t)if(st.call(t,i)){var o=t[i];e(i,o)?r[i]=o:n[i]=o}return Me(n,r)}}function Yb(e){return function(t){var n={};for(var r in t)if(st.call(t,r)){var i=e(r,t[r]);St(i)&&(n[r]=i.value)}return n}}function Gb(e){return function(t){var n={},r=!1;for(var i in t)if(st.call(t,i)){var o=t[i];e(i,o)?n[i]=o:r=!0}return r?n:t}}function e7(e,t){var n=J$(e,t);return function(r){return n(r,z)}}function J$(e,t){return function(n,r){return t.reduce(n,{},function(i,o){var a=r(o),s=a[0],c=a[1];return i[s]=st.call(i,s)?e.concat(i[s],c):c,i})}}var n1e=Q$,r1e=function(e){for(var t={},n=0,r=e;n<r.length;n++){var i=r[n];t[i[0]]=i[1]}return t};function t7(e){return function(t){for(var n in t)if(!e(t[n]))return!1;return!0}}function n7(e){return function(t){for(var n in t)if(e(t[n]))return!0;return!1}}function Z$(e){return function(t,n){if(n===void 0){var r=Z$(e);return function(o){return r(t,o)}}for(var i in n)if(e.equals(n[i],t))return!0;return!1}}var X$=function(e){return function(t){return function(n){if(Lo(n))return t;if(Lo(t))return n;var r={};for(var i in n)Ca(i,t)?r[i]=e.concat(n[i],t[i]):r[i]=n[i];for(var i in t)Ca(i,r)||(r[i]=t[i]);return r}}},ek=function(e){return function(t){return function(n){if(Lo(n)||Lo(t))return bm;var r={};for(var i in n)Ca(i,t)&&(r[i]=e.concat(n[i],t[i]));return r}}},tk=function(e){return function(t){if(Lo(t))return e;if(Lo(e))return t;var n={};for(var r in t)Ca(r,e)||(n[r]=t[r]);for(var r in e)Ca(r,t)||(n[r]=e[r]);return n}},ri=function(e,t){return _(e,G$(t))},ll=function(e,t){return _(e,Vb(t))},ii=function(e){var t=mh(e);return function(n,r,i){return _(n,t(r,i))}},oi=function(e){return function(t){var n=gh(e)(t);return function(r,i){return _(r,n(i))}}},ai=function(e){var t=vh(e);return function(n,r,i){return _(n,t(r,i))}},dl=function(e,t){return _(e,nk(t))},fl=function(e,t){return _(e,rk(t))},pl=function(e,t){return _(e,ik(t))},hl=function(e,t){return _(e,ok(t))},Al=function(e){var t=bd(e);return function(n,r,i){return _(n,t(r,i))}},ml=function(e){var t=Sd(e);return function(n){var r=t(n);return function(i,o){return _(i,r(o))}}},gl=function(e){var t=Cd(e);return function(n,r,i){return _(n,t(r,i))}},Jb=function(e,t){return _(e,Qb(t))},Zb=function(e,t){return _(e,Hb(t))},Xb=function(e,t){return _(e,Yb(t))},e1=function(e,t){return _(e,Gb(t))},Xo=function(e){var t=Cm(e);return function(n){var r=t(n);return function(i,o){return r(i,Z(xr,o))}}},Sm=function(e){var t=Xo(e);return function(n){var r=t(n);return function(i){return r(i,z)}}},Cm=function(e){return function(t){var n=up(e);return function(r,i){var o=n(r);if(o.length===0)return t.of(bm);for(var a=t.of({}),s=function(d){a=t.ap(t.map(a,function(p){return function(h){var A;return Object.assign({},p,(A={},A[d]=h,A))}}),i(d,r[d]))},c=0,u=o;c<u.length;c++){var l=u[c];s(l)}return a}}},nk=function(e){return Gb(function(t,n){return e(n)})},rk=function(e){return Yb(function(t,n){return e(n)})},ik=function(e){return Hb(function(t,n){return e(n)})},ok=function(e){return Qb(function(t,n){return e(n)})};function mh(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(e.length===1){var n=bd(e[0]);return function(r,i){return n(r,function(o,a,s){return i(a,s)})}}return mh(J).apply(void 0,e)}function gh(e){if("compare"in e){var t=Sd(e);return function(n){var r=t(n);return function(i){return r(function(o,a){return i(a)})}}}return gh(J)(e)}function vh(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(e.length===1){var n=Cd(e[0]);return function(r,i){return n(r,function(o,a,s){return i(a,s)})}}return vh(J).apply(void 0,e)}var ts=function(e){var t={};for(var n in e)if(st.call(e,n)){var r=e[n];St(r)&&(t[n]=r.value)}return t},ns=function(e){var t={},n={};for(var r in e)if(st.call(e,r)){var i=e[r];on(i)?t[r]=i.left:n[r]=i.right}return Me(t,n)},Rn="ReadonlyRecord";function Sv(e){return"compare"in e?function(t){return{show:function(n){var r=Kb(e)(function(i,o){return"".concat(JSON.stringify(i),": ").concat(t.show(o))})(n).join(", ");return r===""?"{}":"{ ".concat(r," }")}}}:Sv(J)(e)}function r7(e){var t=qb(e);return Ei(function(n,r){return t(n)(r)&&t(r)(n)})}function i7(e){return{concat:function(t,n){if(Lo(t))return n;if(Lo(n))return t;var r=Object.assign({},t);for(var i in n)st.call(n,i)&&(r[i]=st.call(t,i)?e.concat(t[i],n[i]):n[i]);return r},empty:bm}}var o7={URI:Rn,map:ri},i1e=qe(o7),o1e={URI:Rn,map:ri,mapWithIndex:ll},a1e=function(e){return{URI:Rn,reduce:ii(e),foldMap:oi(e),reduceRight:ai(e)}},s1e=function(e){return{URI:Rn,reduce:ii(e),foldMap:oi(e),reduceRight:ai(e),reduceWithIndex:Al(e),foldMapWithIndex:ml(e),reduceRightWithIndex:gl(e)}},yh={URI:Rn,compact:ts,separate:ns},c1e={URI:Rn,map:ri,compact:ts,separate:ns,filter:dl,filterMap:fl,partition:pl,partitionMap:hl},u1e={URI:Rn,map:ri,mapWithIndex:ll,compact:ts,separate:ns,filter:dl,filterMap:fl,partition:pl,partitionMap:hl,filterMapWithIndex:Xb,filterWithIndex:e1,partitionMapWithIndex:Jb,partitionWithIndex:Zb},a7=function(e){return{URI:Rn,map:ri,reduce:ii(e),foldMap:oi(e),reduceRight:ai(e),traverse:Xo(e),sequence:Sm(e)}},l1e=function(e){return{URI:Rn,map:ri,mapWithIndex:ll,reduce:ii(e),foldMap:oi(e),reduceRight:ai(e),reduceWithIndex:Al(e),foldMapWithIndex:ml(e),reduceRightWithIndex:gl(e),traverse:Xo(e),sequence:Sm(e),traverseWithIndex:Cm(e)}},d1e=function(e){var t=a7(e);return{URI:Rn,map:ri,reduce:ii(e),foldMap:oi(e),reduceRight:ai(e),traverse:t.traverse,sequence:t.sequence,compact:ts,separate:ns,filter:dl,filterMap:fl,partition:pl,partitionMap:hl,wither:eo(t,yh),wilt:Xi(t,yh)}},s7=function(e){var t=X$(e);return{concat:function(n,r){return t(r)(n)}}},f1e=function(e){return{concat:s7(e).concat,empty:bm}},p1e=function(e){var t=ek(e);return{concat:function(n,r){return t(r)(n)}}},h1e=function(){return{concat:function(e,t){return tk(t)(e)}}},A1e={URI:Rn,reduce:ii(J),foldMap:oi(J),reduceRight:ai(J)},m1e={URI:Rn,reduce:ii(J),foldMap:oi(J),reduceRight:ai(J),reduceWithIndex:Al(J),foldMapWithIndex:ml(J),reduceRightWithIndex:gl(J)},ak={URI:Rn,map:ri,reduce:ii(J),foldMap:oi(J),reduceRight:ai(J),traverse:Xo(J),sequence:lp},g1e={URI:Rn,map:ri,mapWithIndex:ll,reduce:ii(J),foldMap:oi(J),reduceRight:ai(J),reduceWithIndex:Al(J),foldMapWithIndex:ml(J),reduceRightWithIndex:gl(J),traverse:Xo(J),sequence:lp,traverseWithIndex:Cm(J)},c7=eo(ak,yh),u7=Xi(ak,yh),v1e={URI:Rn,map:ri,reduce:ii(J),foldMap:oi(J),reduceRight:ai(J),traverse:Xo(J),sequence:lp,compact:ts,separate:ns,filter:dl,filterMap:fl,partition:pl,partitionMap:hl,wither:c7,wilt:u7},sk=H$;function l7(e,t){return st.call(t===void 0?this:t,e)}var y1e={URI:Rn,map:ri,reduce:ii(J),foldMap:oi(J),reduceRight:ai(J),traverse:Xo(J),sequence:lp,compact:ts,separate:ns,filter:dl,filterMap:fl,partition:pl,partitionMap:hl,mapWithIndex:ll,reduceWithIndex:Al(J),foldMapWithIndex:ml(J),reduceRightWithIndex:gl(J),filterMapWithIndex:Xb,filterWithIndex:e1,partitionMapWithIndex:Jb,partitionWithIndex:Zb,traverseWithIndex:Cm(J),wither:c7,wilt:u7};const b1e=Object.freeze(Object.defineProperty({__proto__:null,Compactable:yh,Filterable:c1e,FilterableWithIndex:u1e,Foldable:A1e,FoldableWithIndex:m1e,Functor:o7,FunctorWithIndex:o1e,Traversable:ak,TraversableWithIndex:g1e,URI:Rn,Witherable:v1e,_filter:dl,_filterMap:fl,_filterMapWithIndex:Xb,_filterWithIndex:e1,_foldMap:oi,_foldMapWithIndex:ml,_map:ri,_mapWithIndex:ll,_partition:pl,_partitionMap:hl,_partitionMapWithIndex:Jb,_partitionWithIndex:Zb,_reduce:ii,_reduceRight:ai,_reduceRightWithIndex:gl,_reduceWithIndex:Al,_sequence:Sm,_traverse:Xo,collect:Kb,compact:ts,deleteAt:Y$,difference:tk,elem:Z$,empty:bm,every:t7,filter:nk,filterMap:rk,filterMapWithIndex:Yb,filterWithIndex:Gb,flap:i1e,foldMap:gh,foldMapWithIndex:Sd,fromEntries:r1e,fromFoldable:e7,fromFoldableMap:J$,fromRecord:Qbe,getDifferenceMagma:h1e,getEq:r7,getFoldable:a1e,getFoldableWithIndex:s1e,getIntersectionSemigroup:p1e,getMonoid:i7,getShow:Sv,getTraversable:a7,getTraversableWithIndex:l1e,getUnionMonoid:f1e,getUnionSemigroup:s7,getWitherable:d1e,has:Ca,hasOwnProperty:l7,insertAt:sk,intersection:ek,isEmpty:Lo,isSubrecord:qb,keys:Ybe,lookup:fu,map:G$,mapWithIndex:Vb,modifyAt:Zbe,partition:ik,partitionMap:ok,partitionMapWithIndex:Qb,partitionWithIndex:Hb,pop:Xbe,readonlyRecord:y1e,reduce:mh,reduceRight:vh,reduceRightWithIndex:Cd,reduceWithIndex:bd,separate:ns,sequence:lp,singleton:Z9,size:J9,some:n7,toEntries:n1e,toReadonlyArray:Q$,toRecord:Hbe,toUnfoldable:Gbe,traverse:zb,traverseWithIndex:X9,union:X$,updateAt:Jbe,upsertAt:H$,wilt:t1e,wither:e1e},Symbol.toStringTag,{value:"Module"}));var S1e=function(e){return new Set(e)},C1e=function(e){return new Set([e])},d7=function(e){return function(t){for(var n=t.length,r=new Set,i=Sn(e),o=0;o<n;o++){var a=t[o];i(a,r)||r.add(a)}return r}};function w1e(e){return new Set(e)}function x1e(e){var t=Sn(e);return function(n){return function(r){var i=new Set;return r.forEach(function(o){var a=n(o);t(a,i)||i.add(a)}),i}}}function _1e(e){var t=Sn(e);return function(n){return function(r){var i=new Set;return r.forEach(function(o){n(o).forEach(function(a){t(a,i)||i.add(a)})}),i}}}function ck(e){return function(t){for(var n=t.values(),r,i=new Set;!(r=n.next()).done;){var o=r.value;e(o)&&i.add(o)}return i}}function T1e(e){return function(t){for(var n=t.values(),r,i=new Set,o=new Set;!(r=n.next()).done;){var a=r.value;e(a)?i.add(a):o.add(a)}return Me(o,i)}}function uk(e){var t=Sn(e);return function(n,r){if(r===void 0){var i=uk(e);return function(a){return i(n,a)}}if(bh(n))return r;if(bh(r))return n;var o=new Set(n);return r.forEach(function(a){t(a,o)||o.add(a)}),o}}function lk(e){var t=Sn(e);return function(n,r){if(r===void 0){var i=lk(e);return function(a){return i(a,n)}}if(bh(n)||bh(r))return fk;var o=new Set;return n.forEach(function(a){t(a,r)&&o.add(a)}),o}}function I1e(e,t){return function(n){return function(r){for(var i=r.values(),o,a=new Set,s=new Set,c=Sn(e),u=Sn(t);!(o=i.next()).done;){var l=n(o.value);switch(l._tag){case"Left":c(l.left,a)||a.add(l.left);break;case"Right":u(l.right,s)||s.add(l.right);break}}return Me(a,s)}}}function dk(e){var t=Sn(e);return function(n,r){if(r===void 0){var i=dk(e);return function(o){return i(o,n)}}return ck(function(o){return!t(o,r)})(n)}}function f7(e){var t=t1(e);return function(n,r){return function(i){return t(i).reduce(r,n)}}}function p7(e,t){var n=t1(e);return function(r){return function(i){return n(i).reduce(function(o,a){return t.concat(o,r(a))},t.empty)}}}var h7=function(e){var t=t1(e);return function(n,r){return function(i){return t(i).reduceRight(function(o,a){return r(a,o)},n)}}};function A7(e){var t=Sn(e);return function(n){return function(r){if(t(n)(r))return r;var i=new Set(r);return i.add(n),i}}}var m7=function(e){return function(t){return function(n){return ck(function(r){return!e.equals(t,r)})(n)}}},E1e=function(e){var t=Sn(e),n=m7(e),r=A7(e);return function(i){return function(o){return(t(i,o)?n:r)(i)(o)}}},R1e=function(e){return g7(e)(z)};function $1e(e,t){return function(n){var r=Sn(e),i=Sn(t),o=new Set,a=new Set;return n.forEach(function(s){switch(s._tag){case"Left":r(s.left,o)||o.add(s.left);break;case"Right":i(s.right,a)||a.add(s.right);break}}),Me(o,a)}}function g7(e){var t=Sn(e);return function(n){return function(r){var i=new Set;return r.forEach(function(o){var a=n(o);a._tag==="Some"&&!t(a.value,i)&&i.add(a.value)}),i}}}var fk=new Set,bh=function(e){return e.size===0},k1e=function(e){return e.size},pk=function(e){return function(t){for(var n=t.values(),r,i=!1;!i&&!(r=n.next()).done;)i=e(r.value);return i}};function hk(e){return ph(pk(ph(e)))}function wm(e){var t=Sn(e);return function(n,r){if(r===void 0){var i=wm(e);return function(o){return i(o,n)}}return hk(function(o){return t(o,r)})(n)}}function Sn(e){return function(t,n){if(n===void 0){var r=Sn(e);return function(s){return r(t,s)}}for(var i=n.values(),o,a=!1;!a&&!(o=i.next()).done;)a=e.equals(t,o.value);return a}}var t1=function(e){return function(t){var n=[];return t.forEach(function(r){return n.push(r)}),n.sort(e.compare)}},O1e="ReadonlySet";function v7(e){return{show:function(t){var n=[];return t.forEach(function(r){n.push(e.show(r))}),"new Set([".concat(n.sort().join(", "),"])")}}}function y7(e){var t=wm(e);return Ei(function(n,r){return t(n,r)&&t(r,n)})}var b7=function(e){return{concat:uk(e)}},M1e=function(e){return{concat:b7(e).concat,empty:fk}},F1e=function(e){return{concat:lk(e)}},L1e=function(e){return{concat:dk(e)}},B1e=d7;const D1e=Object.freeze(Object.defineProperty({__proto__:null,URI:O1e,chain:_1e,compact:R1e,difference:dk,elem:Sn,empty:fk,every:hk,filter:ck,filterMap:g7,foldMap:p7,fromArray:B1e,fromReadonlyArray:d7,fromSet:S1e,getDifferenceMagma:L1e,getEq:y7,getIntersectionSemigroup:F1e,getShow:v7,getUnionMonoid:M1e,getUnionSemigroup:b7,insert:A7,intersection:lk,isEmpty:bh,isSubset:wm,map:x1e,partition:T1e,partitionMap:I1e,reduce:f7,reduceRight:h7,remove:m7,separate:$1e,singleton:C1e,size:k1e,some:pk,toReadonlyArray:t1,toSet:w1e,toggle:E1e,union:uk},Symbol.toStringTag,{value:"Module"}));function an(e){return e[0]}function Un(e){return e[1]}var j1e=function(e){return[Un(e),an(e)]};function Ak(e){return{URI:si,_E:void 0,map:xm,ap:function(t,n){return[an(t)(an(n)),e.concat(Un(t),Un(n))]}}}var S7=function(e){return function(t){return[t,e.empty]}};function U1e(e){var t=Ak(e);return{URI:si,_E:void 0,map:t.map,ap:t.ap,of:S7(e)}}function mk(e){var t=Ak(e);return{URI:si,_E:void 0,map:t.map,ap:t.ap,chain:function(n,r){var i=r(an(n)),o=i[0],a=i[1];return[o,e.concat(Un(n),a)]}}}function P1e(e){var t=mk(e);return{URI:si,_E:void 0,map:t.map,ap:t.ap,chain:t.chain,of:S7(e)}}function N1e(e){var t=function(r,i){for(var o=i(r),a=e.empty,s=an(o);s._tag==="Left";)a=e.concat(a,Un(o)),o=i(s.left),s=an(o);return[s.right,e.concat(a,Un(o))]},n=mk(e);return{URI:si,_E:void 0,map:n.map,ap:n.ap,chain:n.chain,chainRec:t}}var C7=function(e,t){return _(e,E7(t))},xm=function(e,t){return _(e,bk(t))},w7=function(e,t,n){return _(e,I7(t,n))},x7=function(e,t){return _(e,Sk(t))},_7=function(e,t){return _(e,Ck(t))},gk=function(e,t,n){return _(e,wk(t,n))},vk=function(e){var t=xk();return function(n,r){return _(n,t(r))}},yk=function(e,t,n){return _(e,_k(t,n))},T7=function(e){var t=R7(e);return function(n,r){return _(n,t(r))}},I7=function(e,t){return function(n){return[t(an(n)),e(Un(n))]}},bk=function(e){return function(t){return[e(an(t)),Un(t)]}},Sk=function(e){return function(t){return[an(t),e(Un(t))]}},E7=function(e){return function(t){return[an(t),Un(e)]}},Ck=function(e){return function(t){return[e(t),Un(t)]}},n1=an,W1e=Ck(z),wk=function(e,t){return function(n){return t(e,an(n))}},xk=function(){return function(e){return function(t){return e(an(t))}}},_k=function(e,t){return function(n){return t(an(n),e)}},R7=function(e){return function(t){return function(n){return e.map(t(an(n)),function(r){return[r,Un(n)]})}}},Tk=function(e){return function(t){return e.map(an(t),function(n){return[n,Un(t)]})}},si="ReadonlyTuple",$7={URI:si,map:xm},K1e=qe($7),q1e={URI:si,bimap:w7,mapLeft:x7},V1e={URI:si,compose:C7},z1e={URI:si,map:xm,extend:_7,extract:n1},Q1e={URI:si,reduce:gk,foldMap:vk,reduceRight:yk},H1e={URI:si,map:xm,reduce:gk,foldMap:vk,reduceRight:yk,traverse:T7,sequence:Tk},Y1e=bk,G1e=Sk,J1e={URI:si,compose:C7,map:xm,bimap:w7,mapLeft:x7,extract:n1,extend:_7,reduce:gk,foldMap:vk,reduceRight:yk,traverse:T7,sequence:Tk};const Z1e=Object.freeze(Object.defineProperty({__proto__:null,Bifunctor:q1e,Comonad:z1e,Foldable:Q1e,Functor:$7,Semigroupoid:V1e,Traversable:H1e,URI:si,bimap:I7,compose:E7,duplicate:W1e,extend:Ck,extract:n1,flap:K1e,foldMap:xk,fst:an,getApplicative:U1e,getApply:Ak,getChain:mk,getChainRec:N1e,getMonad:P1e,map:Y1e,mapFst:bk,mapLeft:G1e,mapSnd:Sk,readonlyTuple:J1e,reduce:wk,reduceRight:_k,sequence:Tk,snd:Un,swap:j1e,traverse:R7},Symbol.toStringTag,{value:"Module"}));var wd=function(){return wd=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},wd.apply(this,arguments)},X1e=J9,pu=Lo,Ik=function(e){return function(t){return Object.keys(t).sort(e.compare)}},eSe=Ik(J);function Ek(e){if(typeof e=="function")return Ek(J)(e);var t=Ik(e);return function(n){return function(r){for(var i=[],o=0,a=t(r);o<a.length;o++){var s=a[o];i.push(n(s,r[s]))}return i}}}var Rk=Ek(J)(function(e,t){return[e,t]});function tSe(e){return function(t){var n=Rk(t),r=n.length;return e.unfold(0,function(i){return i<r?Ae([n[i],i+1]):we})}}var k7=H$,O7=Ca;function M7(e){return function(t){if(!st.call(t,e))return t;var n=Object.assign({},t);return delete n[e],n}}var nSe=function(e,t){return F7(e,function(){return t})},F7=function(e,t){return function(n){if(!O7(e,n))return we;var r=Object.assign({},n);return r[e]=t(n[e]),Ae(r)}};function rSe(e){var t=M7(e);return function(n){var r=L7(e,n);return qt(r)?we:Ae([r.value,t(n)])}}var iSe=qb,L7=fu,oSe=Vb,aSe=G$;function sSe(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.length===1?bd(e[0]):bd(J).apply(void 0,e)}function cSe(e){return"compare"in e?Sd(e):Sd(J)(e)}function uSe(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.length===1?Cd(e[0]):Cd(J).apply(void 0,e)}var lSe=Z9;function dSe(e){return X9(e)}function $k(e){return zb(e)}function _m(e){return lp(e)}var fSe=function(e){var t=$k(e);return function(n){return function(r){return e.map(_(r,t(n)),bc)}}},pSe=function(e){var t=$k(e);return function(n){return function(r){return e.map(_(r,t(n)),Sc)}}},hSe=Qb;function ASe(e){return Hb(e)}var mSe=Yb;function gSe(e){return Gb(e)}function B7(e,t){return e7(e,t)}var vSe=Rk,ySe=function(e){return B7(Oy(),i6)(e)};function bSe(e,t){return J$(e,t)}var SSe=t7,CSe=n7,wSe=Z$,D7=function(e){var t=X$(e);return function(n){return function(r){return pu(r)?wd({},n):pu(n)?wd({},r):t(n)(r)}}},j7=function(e){return function(t){return function(n){return pu(n)||pu(t)?{}:ek(e)(t)(n)}}},U7=function(e){return function(t){return pu(t)?wd({},e):pu(e)?wd({},t):tk(e)(t)}},ao=ri,Tm=ll,so=ii,co=oi,uo=ai,Im=dl,Em=fl,Rm=pl,$m=hl,km=Al,Om=ml,Mm=gl,P7=Jb,N7=Zb,W7=Xb,K7=e1,dp=Xo,q7=Sm,kk=function(e){return function(t){var n=Ik(e);return function(r,i){var o=n(r);if(o.length===0)return t.of({});for(var a=t.of({}),s=function(d){a=t.ap(t.map(a,function(p){return function(h){return p[d]=h,p}}),i(d,r[d]))},c=0,u=o;c<u.length;c++){var l=u[c];s(l)}return a}}},xSe=nk,_Se=rk,TSe=ik,ISe=ok;function ESe(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.length===1?mh(e[0]):mh(J).apply(void 0,e)}function RSe(e){return"compare"in e?gh(e):gh(J)(e)}function $Se(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.length===1?vh(e[0]):vh(J).apply(void 0,e)}var bc=ts,Sc=ns,$n="Record";function kSe(e){return"compare"in e?Sv(e):Sv(J)(e)}var OSe=r7,MSe=i7,V7={URI:$n,map:ao},FSe=qe(V7),LSe={URI:$n,map:ao,mapWithIndex:Tm},BSe=function(e){return{URI:$n,reduce:so(e),foldMap:co(e),reduceRight:uo(e)}},DSe=function(e){return{URI:$n,reduce:so(e),foldMap:co(e),reduceRight:uo(e),reduceWithIndex:km(e),foldMapWithIndex:Om(e),reduceRightWithIndex:Mm(e)}},Sh={URI:$n,compact:bc,separate:Sc},jSe={URI:$n,map:ao,compact:bc,separate:Sc,filter:Im,filterMap:Em,partition:Rm,partitionMap:$m},USe={URI:$n,map:ao,mapWithIndex:Tm,compact:bc,separate:Sc,filter:Im,filterMap:Em,partition:Rm,partitionMap:$m,filterMapWithIndex:W7,filterWithIndex:K7,partitionMapWithIndex:P7,partitionWithIndex:N7},z7=function(e){return{URI:$n,map:ao,reduce:so(e),foldMap:co(e),reduceRight:uo(e),traverse:dp(e),sequence:q7(e)}},PSe=function(e){return{URI:$n,map:ao,mapWithIndex:Tm,reduce:so(e),foldMap:co(e),reduceRight:uo(e),reduceWithIndex:km(e),foldMapWithIndex:Om(e),reduceRightWithIndex:Mm(e),traverse:dp(e),sequence:q7(e),traverseWithIndex:kk(e)}},NSe=function(e){var t=z7(e);return{URI:$n,map:ao,reduce:so(e),foldMap:co(e),reduceRight:uo(e),traverse:t.traverse,sequence:t.sequence,compact:bc,separate:Sc,filter:Im,filterMap:Em,partition:Rm,partitionMap:$m,wither:eo(t,Sh),wilt:Xi(t,Sh)}},Q7=function(e){var t=D7(e);return{concat:function(n,r){return t(r)(n)}}},WSe=function(e){return{concat:Q7(e).concat,empty:{}}},KSe=function(e){var t=j7(e);return{concat:function(n,r){return t(r)(n)}}},qSe=function(){return{concat:function(e,t){return U7(t)(e)}}},VSe={URI:$n,reduce:so(J),foldMap:co(J),reduceRight:uo(J)},zSe={URI:$n,reduce:so(J),foldMap:co(J),reduceRight:uo(J),reduceWithIndex:km(J),foldMapWithIndex:Om(J),reduceRightWithIndex:Mm(J)},Ok={URI:$n,map:ao,reduce:so(J),foldMap:co(J),reduceRight:uo(J),traverse:dp(J),sequence:_m},QSe={URI:$n,map:ao,mapWithIndex:Tm,reduce:so(J),foldMap:co(J),reduceRight:uo(J),reduceWithIndex:km(J),foldMapWithIndex:Om(J),reduceRightWithIndex:Mm(J),traverse:dp(J),sequence:_m,traverseWithIndex:kk(J)},H7=eo(Ok,Sh),Y7=Xi(Ok,Sh),HSe={URI:$n,map:ao,reduce:so(J),foldMap:co(J),reduceRight:uo(J),traverse:dp(J),sequence:_m,compact:bc,separate:Sc,filter:Im,filterMap:Em,partition:Rm,partitionMap:$m,wither:H7,wilt:Y7},YSe={},GSe=k7,JSe=l7,ZSe={URI:$n,map:ao,reduce:so(J),foldMap:co(J),reduceRight:uo(J),traverse:dp(J),sequence:_m,compact:bc,separate:Sc,filter:Im,filterMap:Em,partition:Rm,partitionMap:$m,mapWithIndex:Tm,reduceWithIndex:km(J),foldMapWithIndex:Om(J),reduceRightWithIndex:Mm(J),filterMapWithIndex:W7,filterWithIndex:K7,partitionMapWithIndex:P7,partitionWithIndex:N7,traverseWithIndex:kk(J),wither:H7,wilt:Y7};const XSe=Object.freeze(Object.defineProperty({__proto__:null,Compactable:Sh,Filterable:jSe,FilterableWithIndex:USe,Foldable:VSe,FoldableWithIndex:zSe,Functor:V7,FunctorWithIndex:LSe,Traversable:Ok,TraversableWithIndex:QSe,URI:$n,Witherable:HSe,collect:Ek,compact:bc,deleteAt:M7,difference:U7,elem:wSe,empty:YSe,every:SSe,filter:xSe,filterMap:_Se,filterMapWithIndex:mSe,filterWithIndex:gSe,flap:FSe,foldMap:RSe,foldMapWithIndex:cSe,fromEntries:ySe,fromFoldable:B7,fromFoldableMap:bSe,getDifferenceMagma:qSe,getEq:OSe,getFoldable:BSe,getFoldableWithIndex:DSe,getIntersectionSemigroup:KSe,getMonoid:MSe,getShow:kSe,getTraversable:z7,getTraversableWithIndex:PSe,getUnionMonoid:WSe,getUnionSemigroup:Q7,getWitherable:NSe,has:O7,hasOwnProperty:JSe,insertAt:GSe,intersection:j7,isEmpty:pu,isSubrecord:iSe,keys:eSe,lookup:L7,map:aSe,mapWithIndex:oSe,modifyAt:F7,partition:TSe,partitionMap:ISe,partitionMapWithIndex:hSe,partitionWithIndex:ASe,pop:rSe,record:ZSe,reduce:ESe,reduceRight:$Se,reduceRightWithIndex:uSe,reduceWithIndex:sSe,separate:Sc,sequence:_m,singleton:lSe,size:X1e,some:CSe,toArray:Rk,toEntries:vSe,toUnfoldable:tSe,traverse:$k,traverseWithIndex:dSe,union:D7,updateAt:nSe,upsertAt:k7,wilt:pSe,wither:fSe},Symbol.toStringTag,{value:"Module"}));var eCe=function(e){return function(t){return St(e(t))}},tCe=function(e){return function(t){return U_(e(t))}},nCe=function(){return function(e){return!0}},rCe=function(e){return function(t){return!e(t)}},iCe=function(e){return function(t){return function(n){return t(n)||e(n)}}},oCe=function(e){return function(t){return function(n){return t(n)&&e(n)}}},aCe=function(){return function(e){return!1}},sCe=function(e){return function(t){return function(n){return t(n)&&e(n)}}};const cCe=Object.freeze(Object.defineProperty({__proto__:null,and:oCe,compose:sCe,fromEitherK:tCe,fromOptionK:eCe,id:nCe,not:rCe,or:iCe,zero:aCe},Symbol.toStringTag,{value:"Module"}));var G7=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return{add:function(n,r){return e.map(function(i,o){return i.add(n[o],r[o])})},zero:e.map(function(n){return n.zero}),mul:function(n,r){return e.map(function(i,o){return i.mul(n[o],r[o])})},one:e.map(function(n){return n.one}),sub:function(n,r){return e.map(function(i,o){return i.sub(n[o],r[o])})}}},uCe=function(e){return function(t){return e.sub(e.zero,t)}},lCe=G7,dCe=BU;const fCe=Object.freeze(Object.defineProperty({__proto__:null,getFunctionRing:dCe,getTupleRing:lCe,negate:uCe,tuple:G7},Symbol.toStringTag,{value:"Module"})),pCe=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var hCe=B_;const ACe=Object.freeze(Object.defineProperty({__proto__:null,getFunctionSemiring:hCe},Symbol.toStringTag,{value:"Module"}));var mCe=v7,gCe=y7;function vCe(e){var t=Sr(e);return function(n){return function(r){var i=new Set;return r.forEach(function(o){var a=n(o);t(a,i)||i.add(a)}),i}}}function yCe(e){var t=Sr(e);return function(n){return function(r){var i=new Set;return r.forEach(function(o){n(o).forEach(function(a){t(a,i)||i.add(a)})}),i}}}function Mk(e){return function(t){for(var n=t.values(),r,i=new Set;!(r=n.next()).done;){var o=r.value;e(o)&&i.add(o)}return i}}function bCe(e){return function(t){for(var n=t.values(),r,i=new Set,o=new Set;!(r=n.next()).done;){var a=r.value;e(a)?i.add(a):o.add(a)}return Me(o,i)}}function Fk(e){var t=Sr(e);return function(n,r){if(r===void 0){var i=Fk(e);return function(a){return i(n,a)}}if(Ch(n))return r;if(Ch(r))return n;var o=new Set(n);return r.forEach(function(a){t(a,o)||o.add(a)}),o}}function Lk(e){var t=Sr(e);return function(n,r){if(r===void 0){var i=Lk(e);return function(a){return i(a,n)}}if(Ch(n)||Ch(r))return new Set;var o=new Set;return n.forEach(function(a){t(a,r)&&o.add(a)}),o}}function SCe(e,t){return function(n){return function(r){for(var i=r.values(),o,a=new Set,s=new Set,c=Sr(e),u=Sr(t);!(o=i.next()).done;){var l=n(o.value);switch(l._tag){case"Left":c(l.left,a)||a.add(l.left);break;case"Right":u(l.right,s)||s.add(l.right);break}}return Me(a,s)}}}function Bk(e){var t=Sr(e);return function(n,r){if(r===void 0){var i=Bk(e);return function(o){return i(o,n)}}return Mk(function(o){return!t(o,r)})(n)}}var J7=function(e){return{concat:Fk(e)}},CCe=function(e){return{concat:J7(e).concat,empty:new Set}},wCe=function(e){return{concat:Lk(e)}},xCe=function(e){return{concat:Bk(e)}},_Ce=f7,TCe=p7,ICe=h7,ECe=function(e){return new Set([e])};function Z7(e){var t=Sr(e);return function(n){return function(r){if(t(n)(r))return r;var i=new Set(r);return i.add(n),i}}}var X7=function(e){return function(t){return function(n){return Mk(function(r){return!e.equals(t,r)})(n)}}},RCe=function(e){var t=Sr(e),n=X7(e),r=Z7(e);return function(i){return function(o){return(t(i,o)?n:r)(i)(o)}}},eq=function(e){return function(t){for(var n=t.length,r=new Set,i=Sr(e),o=0;o<n;o++){var a=t[o];i(a,r)||r.add(a)}return r}},$Ce=function(e){return tq(e)(z)};function kCe(e,t){return function(n){var r=Sr(e),i=Sr(t),o=new Set,a=new Set;return n.forEach(function(s){switch(s._tag){case"Left":r(s.left,o)||o.add(s.left);break;case"Right":i(s.right,a)||a.add(s.right);break}}),Me(o,a)}}function tq(e){var t=Sr(e);return function(n){return function(r){var i=new Set;return r.forEach(function(o){var a=n(o);a._tag==="Some"&&!t(a.value,i)&&i.add(a.value)}),i}}}var OCe=new Set,Ch=function(e){return e.size===0},MCe=function(e){return e.size},FCe=pk,nq=hk,LCe=wm,Sr=Sn,rq=function(e){return function(t){var n=[];return t.forEach(function(r){return n.push(r)}),n.sort(e.compare)}},BCe=wm;const DCe=Object.freeze(Object.defineProperty({__proto__:null,chain:yCe,compact:$Ce,difference:Bk,elem:Sr,empty:OCe,every:nq,filter:Mk,filterMap:tq,foldMap:TCe,fromArray:eq,getDifferenceMagma:xCe,getEq:gCe,getIntersectionSemigroup:wCe,getShow:mCe,getUnionMonoid:CCe,getUnionSemigroup:J7,insert:Z7,intersection:Lk,isEmpty:Ch,isSubset:LCe,map:vCe,partition:bCe,partitionMap:SCe,reduce:_Ce,reduceRight:ICe,remove:X7,separate:kCe,singleton:ECe,size:MCe,some:FCe,subset:BCe,toArray:rq,toggle:RCe,union:Fk},Symbol.toStringTag,{value:"Module"}));var iq=function(e){return{show:function(t){var n="{";for(var r in e)st.call(e,r)&&(n+=" ".concat(r,": ").concat(e[r].show(t[r]),","));return n.length>1&&(n=n.slice(0,-1)+" "),n+="}",n}}},oq=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return{show:function(n){return"[".concat(n.map(function(r,i){return e[i].show(r)}).join(", "),"]")}}},jCe=oq,UCe=iq,PCe={show:function(e){return JSON.stringify(e)}},NCe={show:function(e){return JSON.stringify(e)}},WCe={show:function(e){return JSON.stringify(e)}};const KCe=Object.freeze(Object.defineProperty({__proto__:null,getStructShow:UCe,getTupleShow:jCe,showBoolean:PCe,showNumber:WCe,showString:NCe,struct:iq,tuple:oq},Symbol.toStringTag,{value:"Module"}));function Dk(e){return function(t){return function(n){return e.of([t,n])}}}function jk(e){return function(t){return function(n){return function(r){return e.map(n(r),function(i){var o=i[0],a=i[1];return[t(o),a]})}}}}function Uk(e){return function(t){return function(n){return function(r){return e.chain(n(r),function(i){var o=i[0],a=i[1];return e.map(t(a),function(s){var c=s[0],u=s[1];return[o(c),u]})})}}}}function Pk(e){return function(t){return function(n){return function(r){return e.chain(n(r),function(i){var o=i[0],a=i[1];return t(o)(a)})}}}}function Nk(e){return function(t){return function(n){return e.of(t(n))}}}function Wk(e){return function(t){return function(n){return e.map(t,function(r){return[r,n]})}}}function Kk(e){return function(t){return function(n){return e.map(n(t),function(r){var i=r[0];return i})}}}function qk(e){return function(t){return function(n){return e.map(n(t),Un)}}}function qCe(e){var t=Uk(e),n=jk(e),r=Pk(e),i=Kk(e),o=qk(e);return{map:function(a,s){return _(a,n(s))},ap:function(a,s){return _(a,t(s))},of:Dk(e),chain:function(a,s){return _(a,r(s))},get:function(){return function(a){return e.of([a,a])}},put:function(a){return function(){return e.of([void 0,a])}},modify:function(a){return function(s){return e.of([void 0,a(s)])}},gets:function(a){return function(s){return e.of([a(s),s])}},fromState:Nk(e),fromM:Wk(e),evalState:function(a,s){return _(a,i(s))},execState:function(a,s){return _(a,o(s))}}}const VCe=Object.freeze(Object.defineProperty({__proto__:null,ap:Uk,chain:Pk,evaluate:Kk,execute:qk,fromF:Wk,fromState:Nk,getStateM:qCe,map:jk,of:Dk},Symbol.toStringTag,{value:"Module"}));var Vk=function(e){return function(){return Fb(e)}},zk=Dk(W$);function aq(e){return lo(R$(e))}function zCe(e){return lo(a9(e))}function sq(e){return lo($$(e))}function QCe(e){return lo(s9(e))}function cq(e){return lo(k$(e))}function HCe(e){return lo(u9(e))}var YCe=function(e){return Z(e,E$)},GCe=function(e){return function(t){return Fb(e(t)[0])}},uq=ac(function(e){return Vk(e)},zk),lq=sq,vl=cq,Fm=aq,dq=Nk(W$),fq=function(e){return lo(mc(e))},pq=function(e){return lo(O$(e))},JCe=function(e){return lo(M$(e))},lo=Wk(ul),ZCe=function(e){return function(t){return Z(t,KA(e))}},hq=function(e){return function(t){return function(n){return e(n)(t)(n)}}},XCe=hq,Aq=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return pq(e.apply(void 0,t))}},mq=function(e){return function(t){return _(t,Lm(Aq(e)))}},ewe=mq,gq=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return fq(e.apply(void 0,t))}},vq=function(e){return function(t){return _(t,Lm(gq(e)))}},twe=vq,yq=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return lo(e.apply(void 0,t))}},bq=function(e){return function(t){return _(t,Lm(yq(e)))}},nwe=bq,fo=function(e,t){return _(e,Sq(t))},rs=function(e,t){return _(e,Hk(t))},yl=function(e,t){return _(e,Yk(t))},Qk=function(e,t){return function(n){return _(e(n),jb(function(){return t()(n)}))}},r1=function(e,t,n){return function(r){return _(e(r),U$(t,function(i){var o=i[0],a=i[1];return[n(o),a]}))}},i1=function(e,t){return function(n){return _(e(n),P$(t))}},Sq=jk(ul),rwe=function(e,t){return function(n){return r1(n,e,t)}},iwe=function(e){return function(t){return i1(t,e)}},Hk=Uk(lr),owe=Hk,ea=zk,Yk=Pk(lr),Lm=Yk,Cq=Lm(z),awe=Cq,wq=function(e){return function(t){return function(n){return _(t(n),_9(function(){return e()(n)}))}}},swe=wq,o1=Vk,Jt="StateReaderTaskEither",Gk={URI:Jt,map:fo},cwe=qe(Gk),uwe={URI:Jt,of:ea},a1={URI:Jt,map:fo,ap:rs},xq=Dt(a1),lwe=xq,_q=jt(a1),dwe=_q,fwe={URI:Jt,map:fo,ap:rs,of:ea},$r={URI:Jt,map:fo,ap:rs,chain:yl},bl={URI:Jt,fromState:dq},pwe=y5(bl),hwe=b5(bl),Awe=S5(bl),mwe=C5(bl),gwe=UE(bl),vwe=w5(bl,$r),ywe={URI:Jt,map:fo,ap:rs,of:ea,chain:yl},bwe={URI:Jt,map:fo,ap:rs,of:ea,chain:yl,fromIO:vl},Swe={URI:Jt,map:fo,ap:rs,of:ea,chain:yl,fromIO:vl,fromTask:Fm},Cwe={URI:Jt,map:fo,ap:rs,of:ea,chain:yl,throwError:o1},Tq=ct($r),wwe=Tq,xwe={URI:Jt,bimap:r1,mapLeft:i1},_we={URI:Jt,map:fo,alt:Qk},fp={URI:Jt,fromReader:lq},Twe=zA(fp),Iwe=QA(fp),Ewe=Xu(fp),Iq=HA(fp,$r),Rwe=Iq,Eq=YA(fp,$r),$we=Eq,is={URI:Jt,fromEither:uq},kwe=Po(is),Owe=No(is),Mwe=Fu(is,$r),Rq=Ea(is,$r),Fwe=Rq,$q=Ra(is,$r),Lwe=$q,Bwe=Gs(is),kq=Lu(is,$r),Dwe=kq,jwe=ei(is),s1={URI:Jt,fromIO:vl},Uwe=zo(s1),Pwe=Da(s1,$r),Nwe=ja(s1,$r),c1={URI:Jt,fromIO:vl,fromTask:Fm},Wwe=el(c1),Kwe=jf(c1,$r),qwe=Uf(c1,$r),Vwe=Kk(ul),zwe=qk(ul),Qwe=Pt(Gk),Oq=Nt($r),Hwe=Oq,Mq=Ut(a1),Ywe=Mq,Fq=function(e){return function(t){return function(n){return function(r){return function(){return Gd(t).reduce(function(i,o,a){return i.then(function(s){return on(s)?i:e(a+1,o)(s.right[1])(r)().then(function(c){if(on(c))return c;var u=c.right,l=u[0],d=u[1];return s.right[0].push(l),s.right[1]=d,s})})},e(0,Xr(t))(n)(r)().then(zu(function(i){var o=i[0],a=i[1];return[[o],a]})))}}}}},Jk=function(e){var t=Fq(e);return function(n){return pt(n)?t(n):ea(wn)}},Gwe=Jk,Lq=function(e){return Jk(function(t,n){return e(n)})},Jwe=Lq(z),Zwe={URI:Jt,map:fo,of:ea,ap:rs,chain:yl,bimap:r1,mapLeft:i1,alt:Qk,fromIO:vl,fromTask:Fm,throwError:o1},Xwe={URI:Jt,map:fo,of:ea,ap:rs,chain:yl,bimap:r1,mapLeft:i1,alt:Qk,fromIO:vl,fromTask:Fm,throwError:o1},exe=function(e,t){return _(e(t),vm(function(n){var r=n[0];return r}))},txe=function(e,t){return _(e(t),vm(function(n){n[0];var r=n[1];return r}))};function nxe(e,t,n){return e(t)(n)()}const rxe=Object.freeze(Object.defineProperty({__proto__:null,Alt:_we,Applicative:fwe,Apply:a1,Bifunctor:xwe,Chain:$r,FromEither:is,FromIO:s1,FromReader:fp,FromState:bl,FromTask:c1,Functor:Gk,Monad:ywe,MonadIO:bwe,MonadTask:Swe,MonadThrow:Cwe,Pointed:uwe,URI:Jt,alt:swe,altW:wq,ap:Hk,apFirst:xq,apFirstW:lwe,apS:Mq,apSW:Ywe,apSecond:_q,apSecondW:dwe,apW:owe,ask:Twe,asks:Iwe,asksStateReaderTaskEither:XCe,asksStateReaderTaskEitherW:hq,bimap:rwe,bind:Oq,bindTo:Qwe,bindW:Hwe,chain:Yk,chainEitherK:Rq,chainEitherKW:Fwe,chainFirst:Tq,chainFirstEitherK:$q,chainFirstEitherKW:Lwe,chainFirstIOK:Nwe,chainFirstReaderK:Eq,chainFirstReaderKW:$we,chainFirstTaskK:qwe,chainFirstW:wwe,chainIOEitherK:ewe,chainIOEitherKW:mq,chainIOK:Pwe,chainOptionK:Mwe,chainReaderK:Iq,chainReaderKW:Rwe,chainReaderTaskEitherK:nwe,chainReaderTaskEitherKW:bq,chainStateK:vwe,chainTaskEitherK:twe,chainTaskEitherKW:vq,chainTaskK:Kwe,chainW:Lm,evalState:exe,evaluate:Vwe,execState:txe,execute:zwe,filterOrElse:kq,filterOrElseW:Dwe,flap:cwe,flatten:awe,flattenW:Cq,fromEither:uq,fromEitherK:jwe,fromIO:vl,fromIOEither:pq,fromIOEitherK:Aq,fromIOK:Uwe,fromOption:kwe,fromOptionK:Owe,fromPredicate:Bwe,fromReader:lq,fromReaderEither:JCe,fromReaderK:Ewe,fromReaderTaskEither:lo,fromReaderTaskEitherK:yq,fromState:dq,fromStateK:gwe,fromTask:Fm,fromTaskEither:fq,fromTaskEitherK:gq,fromTaskK:Wwe,get:pwe,gets:mwe,left:Vk,leftIO:HCe,leftReader:QCe,leftState:GCe,leftTask:zCe,local:ZCe,map:Sq,mapLeft:iwe,modify:Awe,of:ea,put:hwe,right:zk,rightIO:cq,rightReader:sq,rightState:YCe,rightTask:aq,run:nxe,sequenceArray:Jwe,stateReaderTaskEither:Zwe,stateReaderTaskEitherSeq:Xwe,throwError:o1,traverseArray:Lq,traverseArrayWithIndex:Gwe,traverseReadonlyArrayWithIndex:Jk,traverseReadonlyNonEmptyArrayWithIndex:Fq},Symbol.toStringTag,{value:"Module"}));function ixe(e){return function(t){return{peek:t.peek,pos:e}}}function oxe(e){return function(t){return{peek:t.peek,pos:e(t.pos)}}}function axe(e){return function(t){return t.peek(e(t.pos))}}function sxe(e){return function(t){return function(n){return e.map(t(n.pos),function(r){return n.peek(r)})}}}var Bq=function(e,t){return _(e,jq(t))},cxe=function(e,t){return _(e,Zk(t))},Zk=function(e){return function(t){return{peek:function(n){return e({peek:t.peek,pos:n})},pos:t.pos}}},Dq=function(e){return e.peek(e.pos)},uxe=Zk(z),jq=function(e){return function(t){return{peek:function(n){return e(t.peek(n))},pos:t.pos}}},Xk="Store",Uq={URI:Xk,map:Bq},lxe=qe(Uq),Pq={URI:Xk,map:Bq,extend:cxe,extract:Dq},dxe=Pq;const fxe=Object.freeze(Object.defineProperty({__proto__:null,Comonad:Pq,Functor:Uq,URI:Xk,duplicate:uxe,experiment:sxe,extend:Zk,extract:Dq,flap:lxe,map:jq,peeks:axe,seek:ixe,seeks:oxe,store:dxe},Symbol.toStringTag,{value:"Module"}));function eO(e,t){return function(n,r){return t.compose(e.second(r),e.first(n))}}function Nq(e,t){var n=eO(e,t);return function(r,i){return t.compose(n(r,i),e.promap(t.id(),z,function(o){return[o,o]}))}}function pxe(e){return eO(e,e)}function hxe(e){return Nq(e,e)}const Axe=Object.freeze(Object.defineProperty({__proto__:null,fanOut:Nq,fanout:hxe,split:eO,splitStrong:pxe},Symbol.toStringTag,{value:"Module"}));var mxe=function(){return{concat:function(e,t){return Object.assign({},e,t)}}},gxe=function(e){return function(t){var n={};for(var r in t)st.call(t,r)&&(n[r]=e[r](t[r]));return n}};const vxe=Object.freeze(Object.defineProperty({__proto__:null,evolve:gxe,getAssignSemigroup:mxe},Symbol.toStringTag,{value:"Module"}));var yxe=function(e,t,n,r){function i(o){return o instanceof n?o:new n(function(a){a(o)})}return new(n||(n=Promise))(function(o,a){function s(l){try{u(r.next(l))}catch(d){a(d)}}function c(l){try{u(r.throw(l))}catch(d){a(d)}}function u(l){l.done?o(l.value):i(l.value).then(s,c)}u((r=r.apply(e,t||[])).next())})},bxe=function(e,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(u){return function(l){return c([u,l])}}function c(u){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,i&&(o=u[0]&2?i.return:u[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;switch(i=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,i=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){n.label=u[1];break}if(u[0]===6&&n.label<o[1]){n.label=o[1],o=u;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(u);break}o[2]&&n.ops.pop(),n.trys.pop();continue}u=t.call(e,n)}catch(l){u=[6,l],i=0}finally{r=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}},Wq=em(Tn),Sxe=fR(Tn),Cxe=Kn,Kq=pR(Tn),Bm=function(e){return u1(cr(e))},u1=J0(Ue),wxe=fc(Sf),qq=hR(Ue),xxe=qq,tO=tb(ep),_xe=tO,Vq=tO,Txe=Vq,zq=nb(ln),Ixe=zq,Exe=Z0(Tn),Qq=function(e){return function(){return yxe(void 0,void 0,void 0,function(){return bxe(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,e().then(Ae)];case 1:return[2,t.sent()];case 2:return t.sent(),[2,we];case 3:return[2]}})})}},Rxe=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return Qq(function(){return e.apply(void 0,t)})}},$xe=X0(Tn),kxe=lR(ln),Oxe=eb(Tn),Mxe=dR(ln),nO=rb(Ue),Hq=ib(al),ta=Wq,l1=qf(ln),Fxe=l1(z),rO=ob(ln),Lxe=rO,d1=tm(Tn),Bxe=d1(),iO=qo(Ue,Nu),oO=Fa(Ue,Nu,gf),Yq=La(Ue,Oa),Gq=Ba(Ue,Oa),Jq=sc(Ue,Oa),Zq=cc(Ue,Oa),Bi=function(e,t){return _(e,nO(t))},Sl=function(e,t){return _(e,Hq(t))},f1=function(e,t){return _(e,l1(t))},Xq=function(e,t){return _(e,rO(t))},Dxe=function(e,t){return _(e,Yq(t))},jxe=function(e,t){return _(e,Gq(t))},Uxe=function(e,t){return _(e,Jq(t))},Pxe=function(e,t){return _(e,Zq(t))},dn="TaskOption",aO={URI:dn,map:Bi},Nxe=qe(aO),eV={URI:dn,of:ta},p1={URI:dn,map:Bi,ap:Sl},Wxe=Dt(p1),Kxe=jt(p1),qxe={URI:dn,map:Bi,ap:Sl,of:ta},tV=function(e,t){return _(e,l1(function(n){return _(t,nO(n))}))},Vxe={URI:dn,map:Bi,ap:tV},zxe={URI:dn,map:Bi,ap:tV,of:ta},as={URI:dn,map:Bi,ap:Sl,chain:f1},Qxe=ct(as),Hxe={URI:dn,map:Bi,alt:Xq},nV={URI:dn,zero:d1},Yxe=of(nV,eV),Gxe={URI:dn,map:Bi,ap:Sl,of:ta,alt:Xq,zero:d1},Jxe={URI:dn,map:Bi,ap:Sl,of:ta,chain:f1},Zxe={URI:dn,map:Bi,ap:Sl,of:ta,chain:f1,fromIO:Bm},Xxe={URI:dn,map:Bi,ap:Sl,of:ta,chain:f1,fromIO:Bm,fromTask:u1},e_e={URI:dn,compact:iO,separate:oO},t_e={URI:dn,map:Bi,compact:iO,separate:oO,filter:Dxe,filterMap:jxe,partition:Uxe,partitionMap:Pxe},h1={URI:dn,fromIO:Bm},n_e=zo(h1),r_e=Da(h1,as),i_e=ja(h1,as),A1={URI:dn,fromEither:Kq},o_e=ei(A1),a_e=Ea(A1,as),s_e=Ra(A1,as),m1={URI:dn,fromIO:Bm,fromTask:u1},c_e=el(m1),u_e=jf(m1,as),l_e=Uf(m1,as),d_e=ta(sn),f_e=Pt(aO),p_e=Nt(as),h_e=Ut(p1),sO=ta(wn),rV=function(e){return Z(tp(e),fc(B0(xr)))},cO=function(e){var t=rV(e);return function(n){return pt(n)?t(n):sO}},iV=function(e){return function(t){return function(){return Gd(t).reduce(function(n,r,i){return n.then(function(o){return qt(o)?n:e(i+1,r)().then(function(a){return qt(a)?a:(o.value.push(a.value),o)})})},e(0,Xr(t))().then(Ko(oA)))}}},uO=function(e){var t=iV(e);return function(n){return pt(n)?t(n):sO}},A_e=cO,oV=function(e){return cO(function(t,n){return e(n)})},m_e=oV(z),g_e=uO,aV=function(e){return uO(function(t,n){return e(n)})},v_e=aV(z);const y_e=Object.freeze(Object.defineProperty({__proto__:null,Alt:Hxe,Alternative:Gxe,ApT:sO,ApplicativePar:qxe,ApplicativeSeq:zxe,ApplyPar:p1,ApplySeq:Vxe,Chain:as,Compactable:e_e,Do:d_e,Filterable:t_e,FromEither:A1,FromIO:h1,FromTask:m1,Functor:aO,Monad:Jxe,MonadIO:Zxe,MonadTask:Xxe,Pointed:eV,Zero:nV,alt:rO,altW:Lxe,ap:Hq,apFirst:Wxe,apS:h_e,apSecond:Kxe,bind:p_e,bindTo:f_e,chain:l1,chainEitherK:a_e,chainFirst:Qxe,chainFirstEitherK:s_e,chainFirstIOK:i_e,chainFirstTaskK:l_e,chainIOK:r_e,chainNullableK:kxe,chainOptionK:Mxe,chainTaskK:u_e,compact:iO,filter:Yq,filterMap:Gq,flap:Nxe,flatten:Fxe,fold:_xe,foldW:Txe,fromEither:Kq,fromEitherK:o_e,fromIO:Bm,fromIOK:n_e,fromNullable:Exe,fromNullableK:$xe,fromOption:Cxe,fromOptionK:Oxe,fromPredicate:Sxe,fromTask:u1,fromTaskEither:wxe,fromTaskK:c_e,getOrElse:zq,getOrElseW:Ixe,guard:Yxe,map:nO,match:qq,matchE:tO,matchEW:Vq,matchW:xxe,none:Bxe,of:ta,partition:Jq,partitionMap:Zq,separate:oO,sequenceArray:m_e,sequenceSeqArray:v_e,some:Wq,traverseArray:oV,traverseArrayWithIndex:A_e,traverseReadonlyArrayWithIndex:cO,traverseReadonlyArrayWithIndexSeq:uO,traverseReadonlyNonEmptyArrayWithIndex:rV,traverseReadonlyNonEmptyArrayWithIndexSeq:iV,traverseSeqArray:aV,traverseSeqArrayWithIndex:g_e,tryCatch:Qq,tryCatchK:Rxe,zero:d1},Symbol.toStringTag,{value:"Module"}));var He=function(e){return e._tag==="Left"},Lt=function(e){return e._tag==="Right"};function hu(e){return e._tag==="Both"}function vn(e){return{_tag:"Left",left:e}}function kr(e){return{_tag:"Right",right:e}}function et(e,t){return{_tag:"Both",left:e,right:t}}var lO=function(e,t,n){return function(r){switch(r._tag){case"Left":return e(r.left);case"Right":return t(r.right);case"Both":return n(r.left,r.right)}}},b_e=lO,Bs=lO,S_e=Bs,sV=Bs(kr,vn,function(e,t){return et(t,e)});function C_e(e,t){return{show:Bs(function(n){return"left(".concat(e.show(n),")")},function(n){return"right(".concat(t.show(n),")")},function(n,r){return"both(".concat(e.show(n),", ").concat(t.show(r),")")})}}function w_e(e,t){return Ei(function(n,r){return He(n)?He(r)&&e.equals(n.left,r.left):Lt(n)?Lt(r)&&t.equals(n.right,r.right):hu(r)&&e.equals(n.left,r.left)&&t.equals(n.right,r.right)})}function cV(e,t){return{concat:function(n,r){return He(n)?He(r)?vn(e.concat(n.left,r.left)):Lt(r)?et(n.left,r.right):et(e.concat(n.left,r.left),r.right):Lt(n)?He(r)?et(r.left,n.right):Lt(r)?kr(t.concat(n.right,r.right)):et(r.left,t.concat(n.right,r.right)):He(r)?et(e.concat(n.left,r.left),n.right):Lt(r)?et(n.left,t.concat(n.right,r.right)):et(e.concat(n.left,r.left),t.concat(n.right,r.right))}}}var g1=function(e){return{URI:ci,_E:void 0,map:Cl,ap:function(t,n){return He(t)?He(n)?vn(e.concat(t.left,n.left)):Lt(n)?vn(t.left):vn(e.concat(t.left,n.left)):Lt(t)?He(n)?vn(n.left):Lt(n)?kr(t.right(n.right)):et(n.left,t.right(n.right)):He(n)?vn(e.concat(t.left,n.left)):Lt(n)?et(t.left,t.right(n.right)):et(e.concat(t.left,n.left),t.right(n.right))}}};function x_e(e){var t=g1(e);return{URI:ci,_E:void 0,map:Cl,ap:t.ap,of:Dm}}function uV(e){var t=g1(e),n=function(r,i){if(He(r))return r;if(Lt(r))return i(r.right);var o=i(r.right);return He(o)?vn(e.concat(r.left,o.left)):Lt(o)?et(r.left,o.right):et(e.concat(r.left,o.left),o.right)};return{URI:ci,_E:void 0,map:Cl,ap:t.ap,chain:n}}function __e(e){var t=uV(e);return{URI:ci,_E:void 0,map:Cl,of:Dm,ap:t.ap,chain:t.chain,throwError:vn}}function T_e(e){return He(e)?Ae(e.left):Lt(e)?we:Ae(e.left)}function I_e(e){return He(e)?we:(Lt(e),Ae(e.right))}function E_e(e){return function(t){return qt(t)?vn(e):et(e,t.value)}}function R_e(e){return function(t){return qt(t)?kr(e):et(t.value,e)}}function $_e(e){return He(e)?Ae(e.left):we}function k_e(e){return Lt(e)?Ae(e.right):we}var O_e=function(e,t){return qt(e)?qt(t)?we:Ae(kr(t.value)):qt(t)?Ae(vn(e.value)):Ae(et(e.value,t.value))},Cl=function(e,t){return _(e,mO(t))},lV=function(e,t,n){return _(e,hO(t,n))},dV=function(e,t){return _(e,AO(t))},dO=function(e,t,n){return _(e,pV(t,n))},fO=function(e){var t=hV(e);return function(n,r){return _(n,t(r))}},pO=function(e,t,n){return _(e,AV(t,n))},fV=function(e){var t=mV(e);return function(n,r){return _(n,t(r))}},hO=function(e,t){return function(n){return He(n)?vn(e(n.left)):Lt(n)?kr(t(n.right)):et(e(n.left),t(n.right))}},AO=function(e){return function(t){return He(t)?vn(e(t.left)):hu(t)?et(e(t.left),t.right):t}},mO=function(e){return function(t){return He(t)?t:Lt(t)?kr(e(t.right)):et(t.left,e(t.right))}},pV=function(e,t){return function(n){return He(n)?e:t(e,n.right)}},hV=function(e){return function(t){return function(n){return He(n)?e.empty:t(n.right)}}},AV=function(e,t){return function(n){return He(n)?e:t(n.right,e)}},mV=function(e){return function(t){return function(n){return He(n)?e.of(n):Lt(n)?e.map(t(n.right),kr):e.map(t(n.right),function(r){return et(n.left,r)})}}},gO=function(e){return function(t){return He(t)?e.of(t):Lt(t)?e.map(t.right,kr):e.map(t.right,function(n){return et(t.left,n)})}},Dm=kr,ci="These",vO={URI:ci,map:Cl},M_e=qe(vO),F_e={URI:ci,of:Dm},L_e={URI:ci,bimap:lV,mapLeft:dV},B_e={URI:ci,fromThese:z},D_e={URI:ci,reduce:dO,foldMap:fO,reduceRight:pO},j_e={URI:ci,map:Cl,reduce:dO,foldMap:fO,reduceRight:pO,traverse:fV,sequence:gO},yO={URI:ci,fromEither:z},U_e=Po(yO),P_e=No(yO),N_e=function(e){return function(t){return function(n){return He(n)?!1:e.equals(t,n.right)}}},W_e=function(e){return function(t){return He(t)?!1:e(t.right)}},bO=function(e,t){return function(n){return He(n)?[n.left,t()]:Lt(n)?[e(),n.right]:[n.left,n.right]}},K_e=function(e,t){return bO(function(){return e},function(){return t})},gV=Dm(wn),SO=function(e){return function(t){return function(n){var r=we,i=t(0,Xr(n));if(He(i))return i;hu(i)&&(r=Ae(i.left));for(var o=[i.right],a=1;a<n.length;a++){var s=t(a,n[a]);if(He(s))return s;hu(s)&&(r=qt(r)?Ae(s.left):Ae(e.concat(r.value,s.left))),o.push(s.right)}return qt(r)?kr(o):et(r.value,o)}}},q_e=function(e){return function(t){var n=SO(e)(t);return function(r){return pt(r)?n(r):gV}}},V_e={URI:ci,map:Cl,bimap:lV,mapLeft:dV,reduce:dO,foldMap:fO,reduceRight:pO,traverse:fV,sequence:gO};const z_e=Object.freeze(Object.defineProperty({__proto__:null,ApT:gV,Bifunctor:L_e,Foldable:D_e,FromEither:yO,FromThese:B_e,Functor:vO,Pointed:F_e,Traversable:j_e,URI:ci,bimap:hO,both:et,elem:N_e,exists:W_e,flap:M_e,fold:S_e,foldMap:hV,foldW:b_e,fromOption:U_e,fromOptionK:P_e,fromOptions:O_e,getApplicative:x_e,getApply:g1,getChain:uV,getEq:w_e,getLeft:T_e,getLeftOnly:$_e,getMonad:__e,getRight:I_e,getRightOnly:k_e,getSemigroup:cV,getShow:C_e,isBoth:hu,isLeft:He,isRight:Lt,left:vn,leftOrBoth:E_e,map:mO,mapLeft:AO,match:Bs,matchW:lO,of:Dm,reduce:pV,reduceRight:AV,right:kr,rightOrBoth:R_e,sequence:gO,swap:sV,these:V_e,toTuple:K_e,toTuple2:bO,traverse:mV,traverseReadonlyArrayWithIndex:q_e,traverseReadonlyNonEmptyArrayWithIndex:SO},Symbol.toStringTag,{value:"Module"}));function Cv(e){return Z(kr,e.of)}function v1(e){return Z(vn,e.of)}function CO(e){return Z(et,e.of)}function wO(e){return function(t){return e.map(t,kr)}}function xO(e){return function(t){return e.map(t,vn)}}function _O(e){return Jd(e,vO)}function TO(e,t){return Ia(e,g1(t))}function IO(e,t){var n=v1(e);return function(r){return function(i){return e.chain(i,Bs(n,r,function(o,a){return e.map(r(a),Bs(function(s){return vn(t.concat(o,s))},function(s){return et(o,s)},function(s,c){return et(t.concat(o,s),c)}))}))}}}function EO(e){return function(t,n){return function(r){return e.map(r,hO(t,n))}}}function RO(e){return function(t){return function(n){return e.map(n,AO(t))}}}function vV(e){return function(t,n,r){return function(i){return e.map(i,Bs(t,n,r))}}}function $O(e){return function(t,n,r){return function(i){return e.chain(i,Bs(t,n,r))}}}function kO(e){return function(t){return e.map(t,sV)}}function OO(e){return function(t,n){return function(r){return e.map(r,bO(t,n))}}}function Q_e(e){var t=_O(e),n=EO(e),r=RO(e),i=$O(e),o=OO(e),a=Cv(e),s=function(c,u){return _(c,t(u))};return{map:s,bimap:function(c,u,l){return _(c,n(u,l))},mapLeft:function(c,u){return _(c,r(u))},fold:function(c,u,l,d){return _(c,i(u,l,d))},swap:kO(e),rightM:wO(e),leftM:xO(e),left:v1(e),right:Cv(e),both:CO(e),toTuple:function(c,u,l){return _(c,o(function(){return u},function(){return l}))},getMonad:function(c){var u=TO(e,c),l=IO(e,c);return{_E:void 0,map:s,of:a,ap:function(d,p){return _(d,u(p))},chain:function(d,p){return _(d,l(p))}}}}}const H_e=Object.freeze(Object.defineProperty({__proto__:null,ap:TO,bimap:EO,both:CO,chain:IO,getTheseM:Q_e,left:v1,leftF:xO,map:_O,mapLeft:RO,match:vV,matchE:$O,right:Cv,rightF:wO,swap:kO,toTuple2:OO},Symbol.toStringTag,{value:"Module"}));var Y_e=v1(Tn),yV=Cv(Tn),G_e=CO(Tn),MO=wO(Ue),bV=xO(Ue),SV=Z(cr,MO),J_e=Z(cr,bV),CV=Kn,wV=Kn,y1=SV,Z_e=cr,FO=MO,xV=vV(Ue),X_e=xV,_V=$O(ln),TV=_V,IV=TV,eTe=IV,tTe=kO(Ue),wl=function(e,t){return _(e,EV(t))},LO=function(e,t,n){return _(e,RV(t,n))},BO=function(e,t){return _(e,$V(t))},EV=_O(Ue),RV=EO(Ue),$V=RO(Ue),jm=yV,dr="TaskThese",DO=function(e,t){var n=TO(e,t);return{URI:dr,_E:void 0,map:wl,ap:function(r,i){return _(r,n(i))}}};function kV(e,t){var n=DO(e,t).ap;return{URI:dr,_E:void 0,map:wl,ap:n,of:jm}}function OV(e){var t=DO(fm,e),n=IO(ln,e);return{URI:dr,_E:void 0,map:wl,ap:t.ap,chain:function(r,i){return _(r,n(i))}}}function nTe(e){var t=kV(fm,e),n=OV(e);return{URI:dr,_E:void 0,map:wl,ap:t.ap,of:jm,chain:n.chain,fromIO:y1,fromTask:FO}}var MV={URI:dr,map:wl},rTe=qe(MV),iTe={URI:dr,of:jm},oTe={URI:dr,bimap:LO,mapLeft:BO},b1={URI:dr,fromEither:CV},aTe=Po(b1),sTe=No(b1),cTe=Gs(b1),FV={URI:dr,fromThese:wV},uTe=x5(FV),LV={URI:dr,fromIO:y1},lTe=zo(LV),BV={URI:dr,fromIO:y1,fromTask:FO},dTe=el(BV),DV=OO(Ue),jO=jm(wn),jV=function(e){var t=SO(e);return function(n){return Z(tp(n),fc(t(xr)))}},fTe=function(e){return function(t){var n=jV(e)(t);return function(r){return pt(r)?n(r):jO}}},UV=function(e){return function(t){return function(n){return function(){return Gd(n).reduce(function(r,i,o){return r.then(function(a){return He(a)?r:t(o+1,i)().then(function(s){if(He(s))return s;if(hu(s)){var c=a.right;return c.push(s.right),hu(a)?et(e.concat(a.left,s.left),c):et(s.left,c)}return a.right.push(s.right),a})})},t(0,Xr(n))().then(mO(oA)))}}}},pTe=function(e){return function(t){var n=UV(e)(t);return function(r){return pt(r)?n(r):jO}}},hTe={URI:dr,map:wl},ATe={URI:dr,bimap:LO,mapLeft:BO},mTe=function(e,t){return DV(function(){return e},function(){return t})},gTe={URI:dr,map:wl,bimap:LO,mapLeft:BO},vTe=function(e,t){return cn(Cb)(cV(e,t))};const yTe=Object.freeze(Object.defineProperty({__proto__:null,ApT:jO,Bifunctor:oTe,FromEither:b1,FromIO:LV,FromTask:BV,FromThese:FV,Functor:MV,Pointed:iTe,URI:dr,bifunctorTaskThese:ATe,bimap:RV,both:G_e,flap:rTe,fold:TV,foldW:eTe,fromEither:CV,fromIO:y1,fromIOEither:Z_e,fromIOK:lTe,fromOption:aTe,fromOptionK:sTe,fromPredicate:cTe,fromTask:FO,fromTaskK:dTe,fromThese:wV,fromTheseK:uTe,functorTaskThese:hTe,getApplicative:kV,getApply:DO,getChain:OV,getMonad:nTe,getSemigroup:vTe,left:Y_e,leftIO:J_e,leftTask:bV,map:EV,mapLeft:$V,match:xV,matchE:_V,matchEW:IV,matchW:X_e,of:jm,right:yV,rightIO:SV,rightTask:MO,swap:tTe,taskThese:gTe,toTuple:mTe,toTuple2:DV,traverseReadonlyArrayWithIndex:fTe,traverseReadonlyArrayWithIndexSeq:pTe,traverseReadonlyNonEmptyArrayWithIndex:jV,traverseReadonlyNonEmptyArrayWithIndexSeq:UV},Symbol.toStringTag,{value:"Module"}));function bTe(e,t){return function(n){return n(t(n(e.empty)))}}function STe(e){return function(t){return[e(t),t]}}function CTe(e){return function(t){return function(n){return[t(n),e(n)]}}}function wTe(e){return function(t){return function(n){return t(e(n))}}}function xTe(e){function t(r,i){return function(o){return i(function(a){return r(e.concat(o,a))})}}function n(r){return r(e.empty)}return{URI:UO,_E:void 0,map:PV,extend:t,extract:n}}var PV=function(e,t){return _(e,NV(t))},NV=function(e){return function(t){return function(n){return e(t(n))}}},UO="Traced",PO={URI:UO,map:PV},_Te=qe(PO),TTe=PO;const ITe=Object.freeze(Object.defineProperty({__proto__:null,Functor:PO,URI:UO,censor:wTe,flap:_Te,getComonad:xTe,listen:STe,listens:CTe,map:NV,traced:TTe,tracks:bTe},Symbol.toStringTag,{value:"Module"}));function WV(e,t){return function(n){var r=e.traverse(n),i=t.traverse(n);return function(o){return function(a){return r(a,function(s){return i(s,o)})}}}}function KV(e,t){return function(n){var r=e.sequence(n),i=t.sequence(n);return function(o){return r(e.map(o,i))}}}function ETe(e,t){var n=Zd(e,t).map,r=xE(e,t),i=WV(e,t),o=KV(e,t);return{map:n,reduce:r.reduce,foldMap:r.foldMap,reduceRight:r.reduceRight,traverse:function(a){var s=i(a);return function(c,u){return _(c,s(u))}},sequence:function(a){var s=o(a);return function(c){return _(c,s)}}}}const RTe=Object.freeze(Object.defineProperty({__proto__:null,getTraversableComposition:ETe,sequence:KV,traverse:WV},Symbol.toStringTag,{value:"Module"})),$Te=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));function qV(e,t){return t===void 0&&(t=[]),{value:e,forest:t}}function kTe(e){var t=function(n){return Ls(n.forest)?"make(".concat(e.show(n.value),")"):"make(".concat(e.show(n.value),", [").concat(n.forest.map(t).join(", "),"])")};return{show:t}}function OTe(e){var t,n=Ei(function(r,i){return e.equals(r.value,i.value)&&t.equals(r.forest,i.forest)});return t=e6(n),n}var VV=function(e,t){for(var n="",r=t.length,i,o=0;o<r;o++){i=t[o];var a=o===r-1;n+=e+(a?"└":"├")+"─ "+i.value,n+=VV(e+(r>1&&!a?"│ ":" "),i.forest)}return n};function zV(e){return VV(`
|
|
3
|
+
`,e)}function MTe(e){return e.value+zV(e.forest)}function QV(e,t){var n=t(e),r=n[0],i=n[1];return{value:r,forest:HV(i,t)}}function HV(e,t){return e.map(function(n){return QV(n,t)})}function YV(e){var t=GV(e);return function(n,r){return e.chain(r(n),function(i){var o=i[0],a=i[1];return e.map(t(a,r),function(s){return{value:o,forest:s}})})}}function GV(e){var t=_0(e);return function(n,r){return _(n,t(function(i){return YV(e)(i,r)}))}}function FTe(e){var t=function(n){return e(n.value,n.forest.map(t))};return t}var Cc=function(e,t){return _(e,C1(t))},pp=function(e,t){return _(e,Um(function(n){return _(t,C1(n))}))},NO=function(e,t){return _(e,Um(t))},WO=function(e,t,n){return _(e,w1(t,n))},KO=function(e){var t=XV(e);return function(n,r){return _(n,t(r))}},qO=function(e,t,n){return _(e,VO(t,n))},JV=function(e,t){return _(e,S1(t))},ZV=function(e){var t=QO(e);return function(n,r){return _(n,t(r))}},LTe=function(e){return function(t){return pp(t,e)}},Um=function(e){return function(t){var n=e(t.value),r=n.value,i=n.forest,o=PI().concat;return{value:r,forest:o(i,t.forest.map(Um(e)))}}},S1=function(e){return function(t){return{value:e(t),forest:t.forest.map(S1(e))}}},BTe=S1(z),DTe=Um(z),C1=function(e){return function(t){return{value:e(t.value),forest:t.forest.map(C1(e))}}},w1=function(e,t){return function(n){for(var r=t(e,n.value),i=n.forest.length,o=0;o<i;o++)r=_(n.forest[o],w1(r,t));return r}},XV=function(e){return function(t){return w1(e.empty,function(n,r){return e.concat(n,t(r))})}},VO=function(e,t){return function(n){for(var r=e,i=n.forest.length,o=i-1;o>=0;o--)r=_(n.forest[o],VO(r,t));return t(n.value,r)}},zO=function(e){return e.value},QO=function(e){var t=_0(e),n=function(r){return function(i){return e.ap(e.map(r(i.value),function(o){return function(a){return{value:o,forest:a}}}),_(i.forest,t(n(r))))}};return n},HO=function(e){return QO(e)(z)},hp=function(e){return qV(e)},po="Tree",YO={URI:po,map:Cc},jTe=qe(YO),UTe={URI:po,of:hp},x1={URI:po,map:Cc,ap:pp},PTe=Dt(x1),NTe=jt(x1),WTe={URI:po,map:Cc,ap:pp,of:hp},GO={URI:po,map:Cc,ap:pp,chain:NO},KTe={URI:po,map:Cc,ap:pp,of:hp,chain:NO},qTe=ct(GO),VTe={URI:po,reduce:WO,foldMap:KO,reduceRight:qO},zTe={URI:po,map:Cc,reduce:WO,foldMap:KO,reduceRight:qO,traverse:ZV,sequence:HO},QTe={URI:po,map:Cc,extend:JV,extract:zO},HTe=hp(sn),YTe=Pt(YO),GTe=Nt(GO),JTe=Ut(x1);function ZTe(e){var t=function(n,r){return e.equals(n,r.value)||r.forest.some(function(i){return t(n,i)})};return t}var ez=function(e){return function(t){return e(t.value)||t.forest.some(ez(e))}},XTe={URI:po,map:Cc,of:hp,ap:pp,chain:NO,reduce:WO,foldMap:KO,reduceRight:qO,traverse:ZV,sequence:HO,extract:zO,extend:JV};const eIe=Object.freeze(Object.defineProperty({__proto__:null,Applicative:WTe,Apply:x1,Chain:GO,Comonad:QTe,Do:HTe,Foldable:VTe,Functor:YO,Monad:KTe,Pointed:UTe,Traversable:zTe,URI:po,ap:LTe,apFirst:PTe,apS:JTe,apSecond:NTe,bind:GTe,bindTo:YTe,chain:Um,chainFirst:qTe,drawForest:zV,drawTree:MTe,duplicate:BTe,elem:ZTe,exists:ez,extend:S1,extract:zO,flap:jTe,flatten:DTe,fold:FTe,foldMap:XV,getEq:OTe,getShow:kTe,make:qV,map:C1,of:hp,reduce:w1,reduceRight:VO,sequence:HO,traverse:QO,tree:XTe,unfoldForest:HV,unfoldForestM:GV,unfoldTree:QV,unfoldTreeM:YV},Symbol.toStringTag,{value:"Module"}));var Qr=an,Cr=Un,tIe=function(e){return[Cr(e),Qr(e)]};function JO(e){return{URI:ui,_E:void 0,map:Pm,ap:function(t,n){return[Qr(t)(Qr(n)),e.concat(Cr(t),Cr(n))]}}}var tz=function(e){return function(t){return[t,e.empty]}};function nIe(e){var t=JO(e);return{URI:ui,_E:void 0,map:t.map,ap:t.ap,of:tz(e)}}function ZO(e){var t=JO(e);return{URI:ui,_E:void 0,map:t.map,ap:t.ap,chain:function(n,r){var i=r(Qr(n)),o=i[0],a=i[1];return[o,e.concat(Cr(n),a)]}}}function rIe(e){var t=ZO(e);return{URI:ui,_E:void 0,map:t.map,ap:t.ap,chain:t.chain,of:tz(e)}}function iIe(e){var t=function(r,i){for(var o=i(r),a=e.empty,s=Qr(o);s._tag==="Left";)a=e.concat(a,Cr(o)),o=i(s.left),s=Qr(o);return[s.right,e.concat(a,Cr(o))]},n=ZO(e);return{URI:ui,_E:void 0,map:n.map,ap:n.ap,chain:n.chain,chainRec:t}}var nz=function(e,t){return _(e,cz(t))},Pm=function(e,t){return _(e,nM(t))},rz=function(e,t,n){return _(e,sz(t,n))},iz=function(e,t){return _(e,rM(t))},oz=function(e,t){return _(e,iM(t))},XO=function(e,t,n){return _(e,lz(t,n))},eM=function(e){var t=uz();return function(n,r){return _(n,t(r))}},tM=function(e,t,n){return _(e,dz(t,n))};function az(e){var t=fz(e);return function(n,r){return _(n,t(r))}}var sz=function(e,t){return function(n){return[t(Qr(n)),e(Cr(n))]}},nM=function(e){return function(t){return[e(Qr(t)),Cr(t)]}},rM=function(e){return function(t){return[Qr(t),e(Cr(t))]}},cz=function(e){return function(t){return[Qr(t),Cr(e)]}},iM=function(e){return function(t){return[e(t),Cr(t)]}},oIe=iM(z),oM=n1,uz=xk,lz=wk,dz=_k,fz=function(e){return function(t){return function(n){return e.map(t(Qr(n)),function(r){return[r,Cr(n)]})}}},aM=function(e){return function(t){return e.map(Qr(t),function(n){return[n,Cr(t)]})}},ui="Tuple",pz={URI:ui,map:Pm},aIe=qe(pz),sIe={URI:ui,bimap:rz,mapLeft:iz},cIe={URI:ui,compose:nz},uIe={URI:ui,map:Pm,extend:oz,extract:oM},lIe={URI:ui,reduce:XO,foldMap:eM,reduceRight:tM},dIe={URI:ui,map:Pm,reduce:XO,foldMap:eM,reduceRight:tM,traverse:az,sequence:aM},fIe=nM,pIe=rM,hIe={URI:ui,compose:nz,map:Pm,bimap:rz,mapLeft:iz,extract:oM,extend:oz,reduce:XO,foldMap:eM,reduceRight:tM,traverse:az,sequence:aM};const AIe=Object.freeze(Object.defineProperty({__proto__:null,Bifunctor:sIe,Comonad:uIe,Foldable:lIe,Functor:pz,Semigroupoid:cIe,Traversable:dIe,URI:ui,bimap:sz,compose:cz,duplicate:oIe,extend:iM,extract:oM,flap:aIe,foldMap:uz,fst:Qr,getApplicative:nIe,getApply:JO,getChain:ZO,getChainRec:iIe,getMonad:rIe,map:fIe,mapFst:nM,mapLeft:pIe,mapSnd:rM,reduce:lz,reduceRight:dz,sequence:aM,snd:Cr,swap:tIe,traverse:fz,tuple:hIe},Symbol.toStringTag,{value:"Module"})),mIe=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));function gIe(e,t){var n=WU(t,ic(e));return{map:n.map,ap:n.ap,of:n.of,chain:function(r,i){return t.chain(r,function(o){return on(o)?t.of(ba(o.left)):i(o.right)})},alt:function(r,i){return t.chain(r,function(o){return U_(o)?t.of(o):t.map(i(),function(a){return on(a)?ba(e.concat(o.left,a.left)):a})})}}}const vIe=Object.freeze(Object.defineProperty({__proto__:null,getValidationM:gIe},Symbol.toStringTag,{value:"Module"}));var hz=q_(void 0),yIe={concat:hz.concat,empty:void 0};const bIe=Object.freeze(Object.defineProperty({__proto__:null,Monoid:yIe,Semigroup:hz},Symbol.toStringTag,{value:"Module"}));var SIe=function(e){return function(){return[void 0,e]}},CIe=function(e){return function(){var t=e(),n=t[0],r=t[1];return[[n,r],r]}},wIe=function(e){return function(){var t=e(),n=t[0],r=n[0],i=n[1],o=t[1];return[r,i(o)]}},xIe=function(e){return function(t){return function(){var n=t(),r=n[0],i=n[1];return[[r,e(i)],i]}}},_Ie=function(e){return function(t){return function(){var n=t(),r=n[0],i=n[1];return[r,e(i)]}}},Nm=function(e,t){return _(e,Az(t))},Az=function(e){return function(t){return function(){var n=t(),r=n[0],i=n[1];return[e(r),i]}}},xl="Writer",mz=function(e){return{URI:xl,_E:void 0,of:function(t){return function(){return[t,e.empty]}}}},sM=function(e){return{URI:xl,_E:void 0,map:Nm,ap:function(t,n){return function(){var r=t(),i=r[0],o=r[1],a=n(),s=a[0],c=a[1];return[i(s),e.concat(o,c)]}}}},gz=function(e){var t=sM(e),n=mz(e);return{URI:xl,_E:void 0,map:Nm,ap:t.ap,of:n.of}};function vz(e){var t=sM(e);return{URI:xl,_E:void 0,map:Nm,ap:t.ap,chain:function(n,r){return function(){var i=n(),o=i[0],a=i[1],s=r(o)(),c=s[0],u=s[1];return[c,e.concat(a,u)]}}}}function TIe(e){var t=gz(e),n=vz(e);return{URI:xl,_E:void 0,map:Nm,ap:t.ap,of:t.of,chain:n.chain}}var cM={URI:xl,map:Nm},IIe=qe(cM),EIe=function(e){return e()[0]},RIe=function(e){return e()[1]},$Ie=function(e){return e()[0]},kIe=function(e){return e()[1]},OIe=cM;const MIe=Object.freeze(Object.defineProperty({__proto__:null,Functor:cM,URI:xl,censor:_Ie,evalWriter:$Ie,evaluate:EIe,execWriter:kIe,execute:RIe,flap:IIe,getApplicative:gz,getApply:sM,getChain:vz,getMonad:TIe,getPointed:mz,listen:CIe,listens:xIe,map:Az,pass:wIe,tell:SIe,writer:OIe},Symbol.toStringTag,{value:"Module"}));function FIe(e){var t=function(n,r){return function(){return e.map(n(),function(i){var o=i[0],a=i[1];return[r(o),a]})}};return{map:t,evalWriter:function(n){return e.map(n(),function(r){var i=r[0];return i})},execWriter:function(n){return e.map(n(),function(r){r[0];var i=r[1];return i})},tell:function(n){return function(){return e.of([void 0,n])}},listen:function(n){return function(){return e.map(n(),function(r){var i=r[0],o=r[1];return[[i,o],o]})}},pass:function(n){return function(){return e.map(n(),function(r){var i=r[0],o=i[0],a=i[1],s=r[1];return[o,a(s)]})}},listens:function(n,r){return function(){return e.map(n(),function(i){var o=i[0],a=i[1];return[[o,r(a)],a]})}},censor:function(n,r){return function(){return e.map(n(),function(i){var o=i[0],a=i[1];return[o,r(a)]})}},getMonad:function(n){return{_E:void 0,map:t,of:function(r){return function(){return e.of([r,n.empty])}},ap:function(r,i){return function(){return e.chain(r(),function(o){var a=o[0],s=o[1];return e.map(i(),function(c){var u=c[0],l=c[1];return[a(u),n.concat(s,l)]})})}},chain:function(r,i){return function(){return e.chain(r(),function(o){var a=o[0],s=o[1];return e.map(i(a)(),function(c){var u=c[0],l=c[1];return[u,n.concat(s,l)]})})}}}}}}const LIe=Object.freeze(Object.defineProperty({__proto__:null,getWriterM:FIe},Symbol.toStringTag,{value:"Module"})),BIe=Object.freeze(Object.defineProperty({__proto__:null,alt:Vte,alternative:Qte,applicative:dne,apply:une,array:oce,bifunctor:ace,boolean:hce,booleanAlgebra:yce,bounded:wce,boundedDistributiveLattice:Tce,boundedJoinSemilattice:Ice,boundedLattice:Ece,boundedMeetSemilattice:Rce,category:$ce,chain:fne,chainRec:kce,choice:Fce,comonad:Lce,compactable:Tue,console:kue,const:zue,contravariant:Que,date:tle,distributiveLattice:xce,either:BW,eitherT:Kle,endomorphism:Vle,eq:_ne,extend:zle,field:Yle,filterable:Jle,filterableWithIndex:Zle,foldable:ide,foldableWithIndex:ade,fromEither:pne,fromIO:sde,fromReader:Rde,fromState:Yde,fromTask:Gde,fromThese:Jde,function:NU,functor:lne,functorWithIndex:Xde,group:efe,heytingAlgebra:tfe,hkt:nfe,identity:xfe,invariant:_fe,io:qfe,ioEither:qpe,ioOption:Dhe,ioRef:Uhe,joinSemilattice:Phe,json:Khe,lattice:qhe,magma:Kne,map:XAe,meetSemilattice:eme,monad:tme,monadIO:nme,monadTask:rme,monadThrow:ime,monoid:gme,naturalTransformation:vme,nonEmptyArray:Mie,number:Pie,option:xue,optionT:zpe,ord:Une,ordering:_me,pipeable:Kme,pointed:qme,predicate:Pce,profunctor:Vme,random:Yme,reader:Ede,readerEither:Vge,readerT:Hge,readerTask:nye,readerTaskEither:Rbe,readonlyArray:bae,readonlyMap:gAe,readonlyNonEmptyArray:Nre,readonlyRecord:b1e,readonlySet:D1e,readonlyTuple:Z1e,record:XSe,refinement:cCe,ring:fCe,semigroup:fP,semigroupoid:pCe,semiring:ACe,separated:zie,set:DCe,show:KCe,state:Hde,stateReaderTaskEither:rxe,stateT:VCe,store:fxe,string:zbe,strong:Axe,struct:vxe,task:bve,taskEither:f0e,taskOption:y_e,taskThese:yTe,these:z_e,theseT:H_e,traced:ITe,traversable:RTe,traversableWithIndex:$Te,tree:eIe,tuple:AIe,unfoldable:mIe,validationT:vIe,void:bIe,witherable:Qie,writer:MIe,writerT:LIe,zero:Hie},Symbol.toStringTag,{value:"Module"})),tt=Mu(BIe);var Zt={},xd={},mn={},Ve={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getEndomorphismMonoid=e.not=e.SK=e.hole=e.pipe=e.untupled=e.tupled=e.absurd=e.decrement=e.increment=e.tuple=e.flow=e.flip=e.constVoid=e.constUndefined=e.constNull=e.constFalse=e.constTrue=e.constant=e.unsafeCoerce=e.identity=e.apply=e.getRing=e.getSemiring=e.getMonoid=e.getSemigroup=e.getBooleanAlgebra=void 0;var t=function(C){return function(){return{meet:function(x,T){return function(I){return C.meet(x(I),T(I))}},join:function(x,T){return function(I){return C.join(x(I),T(I))}},zero:function(){return C.zero},one:function(){return C.one},implies:function(x,T){return function(I){return C.implies(x(I),T(I))}},not:function(x){return function(T){return C.not(x(T))}}}}};e.getBooleanAlgebra=t;var n=function(C){return function(){return{concat:function(x,T){return function(I){return C.concat(x(I),T(I))}}}}};e.getSemigroup=n;var r=function(C){var x=(0,e.getSemigroup)(C);return function(){return{concat:x().concat,empty:function(){return C.empty}}}};e.getMonoid=r;var i=function(C){return{add:function(x,T){return function(I){return C.add(x(I),T(I))}},zero:function(){return C.zero},mul:function(x,T){return function(I){return C.mul(x(I),T(I))}},one:function(){return C.one}}};e.getSemiring=i;var o=function(C){var x=(0,e.getSemiring)(C);return{add:x.add,mul:x.mul,one:x.one,zero:x.zero,sub:function(T,I){return function(R){return C.sub(T(R),I(R))}}}};e.getRing=o;var a=function(C){return function(x){return x(C)}};e.apply=a;function s(C){return C}e.identity=s,e.unsafeCoerce=s;function c(C){return function(){return C}}e.constant=c,e.constTrue=c(!0),e.constFalse=c(!1),e.constNull=c(null),e.constUndefined=c(void 0),e.constVoid=e.constUndefined;function u(C){return function(x,T){return C(T,x)}}e.flip=u;function l(C,x,T,I,R,O,k,P,q){switch(arguments.length){case 1:return C;case 2:return function(){return x(C.apply(this,arguments))};case 3:return function(){return T(x(C.apply(this,arguments)))};case 4:return function(){return I(T(x(C.apply(this,arguments))))};case 5:return function(){return R(I(T(x(C.apply(this,arguments)))))};case 6:return function(){return O(R(I(T(x(C.apply(this,arguments))))))};case 7:return function(){return k(O(R(I(T(x(C.apply(this,arguments)))))))};case 8:return function(){return P(k(O(R(I(T(x(C.apply(this,arguments))))))))};case 9:return function(){return q(P(k(O(R(I(T(x(C.apply(this,arguments)))))))))}}}e.flow=l;function d(){for(var C=[],x=0;x<arguments.length;x++)C[x]=arguments[x];return C}e.tuple=d;function p(C){return C+1}e.increment=p;function h(C){return C-1}e.decrement=h;function A(C){throw new Error("Called `absurd` function which should be uncallable")}e.absurd=A;function g(C){return function(x){return C.apply(void 0,x)}}e.tupled=g;function v(C){return function(){for(var x=[],T=0;T<arguments.length;T++)x[T]=arguments[T];return C(x)}}e.untupled=v;function b(C,x,T,I,R,O,k,P,q){switch(arguments.length){case 1:return C;case 2:return x(C);case 3:return T(x(C));case 4:return I(T(x(C)));case 5:return R(I(T(x(C))));case 6:return O(R(I(T(x(C)))));case 7:return k(O(R(I(T(x(C))))));case 8:return P(k(O(R(I(T(x(C)))))));case 9:return q(P(k(O(R(I(T(x(C))))))));default:{for(var Y=arguments[0],te=1;te<arguments.length;te++)Y=arguments[te](Y);return Y}}}e.pipe=b,e.hole=A;var w=function(C,x){return x};e.SK=w;function S(C){return function(x){return!C(x)}}e.not=S;var y=function(){return{concat:function(C,x){return l(C,x)},empty:s}};e.getEndomorphismMonoid=y})(Ve);var Be={},DIe=me&&me.__spreadArray||function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,o;r<i;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))};Object.defineProperty(Be,"__esModule",{value:!0});Be.fromReadonlyNonEmptyArray=Be.has=Be.emptyRecord=Be.emptyReadonlyArray=Be.tail=Be.head=Be.isNonEmpty=Be.singleton=Be.right=Be.left=Be.isRight=Be.isLeft=Be.some=Be.none=Be.isSome=Be.isNone=void 0;var jIe=function(e){return e._tag==="None"};Be.isNone=jIe;var UIe=function(e){return e._tag==="Some"};Be.isSome=UIe;Be.none={_tag:"None"};var PIe=function(e){return{_tag:"Some",value:e}};Be.some=PIe;var NIe=function(e){return e._tag==="Left"};Be.isLeft=NIe;var WIe=function(e){return e._tag==="Right"};Be.isRight=WIe;var KIe=function(e){return{_tag:"Left",left:e}};Be.left=KIe;var qIe=function(e){return{_tag:"Right",right:e}};Be.right=qIe;var VIe=function(e){return[e]};Be.singleton=VIe;var zIe=function(e){return e.length>0};Be.isNonEmpty=zIe;var QIe=function(e){return e[0]};Be.head=QIe;var HIe=function(e){return e.slice(1)};Be.tail=HIe;Be.emptyReadonlyArray=[];Be.emptyRecord={};Be.has=Object.prototype.hasOwnProperty;var YIe=function(e){return DIe([e[0]],e.slice(1),!0)};Be.fromReadonlyNonEmptyArray=YIe;var GIe=me&&me.__createBinding||(Object.create?function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}),JIe=me&&me.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),ZIe=me&&me.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&GIe(t,e,n);return JIe(t,e),t};Object.defineProperty(mn,"__esModule",{value:!0});mn.sequenceS=mn.sequenceT=mn.getApplySemigroup=mn.apS=mn.apSecond=mn.apFirst=mn.ap=void 0;var XIe=Ve,eEe=ZIe(Be);function tEe(e,t){return function(n){return function(r){return e.ap(e.map(r,function(i){return function(o){return t.ap(i,o)}}),n)}}}mn.ap=tEe;function nEe(e){return function(t){return function(n){return e.ap(e.map(n,function(r){return function(){return r}}),t)}}}mn.apFirst=nEe;function rEe(e){return function(t){return function(n){return e.ap(e.map(n,function(){return function(r){return r}}),t)}}}mn.apSecond=rEe;function iEe(e){return function(t,n){return function(r){return e.ap(e.map(r,function(i){return function(o){var a;return Object.assign({},i,(a={},a[t]=o,a))}}),n)}}}mn.apS=iEe;function oEe(e){return function(t){return{concat:function(n,r){return e.ap(e.map(n,function(i){return function(o){return t.concat(i,o)}}),r)}}}}mn.getApplySemigroup=oEe;function uM(e,t,n){return function(r){for(var i=Array(n.length+1),o=0;o<n.length;o++)i[o]=n[o];return i[n.length]=r,t===0?e.apply(null,i):uM(e,t-1,i)}}var HS={1:function(e){return[e]},2:function(e){return function(t){return[e,t]}},3:function(e){return function(t){return function(n){return[e,t,n]}}},4:function(e){return function(t){return function(n){return function(r){return[e,t,n,r]}}}},5:function(e){return function(t){return function(n){return function(r){return function(i){return[e,t,n,r,i]}}}}}};function aEe(e){return eEe.has.call(HS,e)||(HS[e]=uM(XIe.tuple,e-1,[])),HS[e]}function sEe(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];for(var r=t.length,i=aEe(r),o=e.map(t[0],i),a=1;a<r;a++)o=e.ap(o,t[a]);return o}}mn.sequenceT=sEe;function cEe(e){var t=e.length;switch(t){case 1:return function(n){var r;return r={},r[e[0]]=n,r};case 2:return function(n){return function(r){var i;return i={},i[e[0]]=n,i[e[1]]=r,i}};case 3:return function(n){return function(r){return function(i){var o;return o={},o[e[0]]=n,o[e[1]]=r,o[e[2]]=i,o}}};case 4:return function(n){return function(r){return function(i){return function(o){var a;return a={},a[e[0]]=n,a[e[1]]=r,a[e[2]]=i,a[e[3]]=o,a}}}};case 5:return function(n){return function(r){return function(i){return function(o){return function(a){var s;return s={},s[e[0]]=n,s[e[1]]=r,s[e[2]]=i,s[e[3]]=o,s[e[4]]=a,s}}}}};default:return uM(function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];for(var i={},o=0;o<t;o++)i[e[o]]=n[o];return i},t-1,[])}}function uEe(e){return function(t){for(var n=Object.keys(t),r=n.length,i=cEe(n),o=e.map(t[n[0]],i),a=1;a<r;a++)o=e.ap(o,t[n[a]]);return o}}mn.sequenceS=uEe;var vi={};Object.defineProperty(vi,"__esModule",{value:!0});vi.getFunctorComposition=vi.bindTo=vi.flap=vi.map=void 0;var lEe=Ve;function yz(e,t){return function(n){return function(r){return e.map(r,function(i){return t.map(i,n)})}}}vi.map=yz;function dEe(e){return function(t){return function(n){return e.map(n,function(r){return r(t)})}}}vi.flap=dEe;function fEe(e){return function(t){return function(n){return e.map(n,function(r){var i;return i={},i[t]=r,i})}}}vi.bindTo=fEe;function pEe(e,t){var n=yz(e,t);return{map:function(r,i){return(0,lEe.pipe)(r,n(i))}}}vi.getFunctorComposition=pEe;Object.defineProperty(xd,"__esModule",{value:!0});xd.getApplicativeComposition=xd.getApplicativeMonoid=void 0;var bz=mn,hEe=Ve,AEe=vi;function mEe(e){var t=(0,bz.getApplySemigroup)(e);return function(n){return{concat:t(n).concat,empty:e.of(n.empty)}}}xd.getApplicativeMonoid=mEe;function gEe(e,t){var n=(0,AEe.getFunctorComposition)(e,t).map,r=(0,bz.ap)(e,t);return{map:n,of:function(i){return e.of(t.of(i))},ap:function(i,o){return(0,hEe.pipe)(i,r(o))}}}xd.getApplicativeComposition=gEe;var Au={};Object.defineProperty(Au,"__esModule",{value:!0});Au.bind=Au.chainFirst=void 0;function vEe(e){return function(t){return function(n){return e.chain(n,function(r){return e.map(t(r),function(){return r})})}}}Au.chainFirst=vEe;function yEe(e){return function(t,n){return function(r){return e.chain(r,function(i){return e.map(n(i),function(o){var a;return Object.assign({},i,(a={},a[t]=o,a))})})}}}Au.bind=yEe;var _1={};Object.defineProperty(_1,"__esModule",{value:!0});_1.tailRec=void 0;var bEe=function(e,t){for(var n=t(e);n._tag==="Left";)n=t(n.left);return n.right};_1.tailRec=bEe;var tn={},SEe=me&&me.__createBinding||(Object.create?function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}),CEe=me&&me.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),wEe=me&&me.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&SEe(t,e,n);return CEe(t,e),t};Object.defineProperty(tn,"__esModule",{value:!0});tn.filterOrElse=tn.chainFirstEitherK=tn.chainEitherK=tn.fromEitherK=tn.chainOptionK=tn.fromOptionK=tn.fromPredicate=tn.fromOption=void 0;var xEe=Au,lM=Ve,Gc=wEe(Be);function Sz(e){return function(t){return function(n){return e.fromEither(Gc.isNone(n)?Gc.left(t()):Gc.right(n.value))}}}tn.fromOption=Sz;function _Ee(e){return function(t,n){return function(r){return e.fromEither(t(r)?Gc.right(r):Gc.left(n(r)))}}}tn.fromPredicate=_Ee;function Cz(e){var t=Sz(e);return function(n){var r=t(n);return function(i){return(0,lM.flow)(i,r)}}}tn.fromOptionK=Cz;function TEe(e,t){var n=Cz(e);return function(r){var i=n(r);return function(o){return function(a){return t.chain(a,i(o))}}}}tn.chainOptionK=TEe;function dM(e){return function(t){return(0,lM.flow)(t,e.fromEither)}}tn.fromEitherK=dM;function IEe(e,t){var n=dM(e);return function(r){return function(i){return t.chain(i,n(r))}}}tn.chainEitherK=IEe;function EEe(e,t){return(0,lM.flow)(dM(e),(0,xEe.chainFirst)(t))}tn.chainFirstEitherK=EEe;function REe(e,t){return function(n,r){return function(i){return t.chain(i,function(o){return e.fromEither(n(o)?Gc.right(o):Gc.left(r(o)))})}}}tn.filterOrElse=REe;var wz={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.right=e.left=e.flap=e.Functor=e.Bifunctor=e.URI=e.bimap=e.mapLeft=e.map=e.separated=void 0;var t=Ve,n=vi,r=function(p,h){return{left:p,right:h}};e.separated=r;var i=function(p,h){return(0,t.pipe)(p,(0,e.map)(h))},o=function(p,h){return(0,t.pipe)(p,(0,e.mapLeft)(h))},a=function(p,h,A){return(0,t.pipe)(p,(0,e.bimap)(h,A))},s=function(p){return function(h){return(0,e.separated)((0,e.left)(h),p((0,e.right)(h)))}};e.map=s;var c=function(p){return function(h){return(0,e.separated)(p((0,e.left)(h)),(0,e.right)(h))}};e.mapLeft=c;var u=function(p,h){return function(A){return(0,e.separated)(p((0,e.left)(A)),h((0,e.right)(A)))}};e.bimap=u,e.URI="Separated",e.Bifunctor={URI:e.URI,mapLeft:o,bimap:a},e.Functor={URI:e.URI,map:i},e.flap=(0,n.flap)(e.Functor);var l=function(p){return p.left};e.left=l;var d=function(p){return p.right};e.right=d})(wz);var $s={},$Ee=me&&me.__createBinding||(Object.create?function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}),kEe=me&&me.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),OEe=me&&me.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&$Ee(t,e,n);return kEe(t,e),t};Object.defineProperty($s,"__esModule",{value:!0});$s.filterE=$s.witherDefault=$s.wiltDefault=void 0;var zL=OEe(Be);function MEe(e,t){return function(n){var r=e.traverse(n);return function(i,o){return n.map(r(i,o),t.separate)}}}$s.wiltDefault=MEe;function FEe(e,t){return function(n){var r=e.traverse(n);return function(i,o){return n.map(r(i,o),t.compact)}}}$s.witherDefault=FEe;function LEe(e){return function(t){var n=e.wither(t);return function(r){return function(i){return n(i,function(o){return t.map(r(o),function(a){return a?zL.some(o):zL.none})})}}}}$s.filterE=LEe;(function(e){var t=me&&me.__createBinding||(Object.create?function(B,L,K,je){je===void 0&&(je=K);var D=Object.getOwnPropertyDescriptor(L,K);(!D||("get"in D?!L.__esModule:D.writable||D.configurable))&&(D={enumerable:!0,get:function(){return L[K]}}),Object.defineProperty(B,je,D)}:function(B,L,K,je){je===void 0&&(je=K),B[je]=L[K]}),n=me&&me.__setModuleDefault||(Object.create?function(B,L){Object.defineProperty(B,"default",{enumerable:!0,value:L})}:function(B,L){B.default=L}),r=me&&me.__importStar||function(B){if(B&&B.__esModule)return B;var L={};if(B!=null)for(var K in B)K!=="default"&&Object.prototype.hasOwnProperty.call(B,K)&&t(L,B,K);return n(L,B),L};Object.defineProperty(e,"__esModule",{value:!0}),e.fold=e.match=e.foldW=e.matchW=e.isRight=e.isLeft=e.fromOption=e.fromPredicate=e.FromEither=e.MonadThrow=e.throwError=e.ChainRec=e.Extend=e.extend=e.Alt=e.alt=e.altW=e.Bifunctor=e.mapLeft=e.bimap=e.Traversable=e.sequence=e.traverse=e.Foldable=e.reduceRight=e.foldMap=e.reduce=e.Monad=e.Chain=e.chain=e.chainW=e.Applicative=e.Apply=e.ap=e.apW=e.Pointed=e.of=e.Functor=e.map=e.getAltValidation=e.getApplicativeValidation=e.getWitherable=e.getFilterable=e.getCompactable=e.getSemigroup=e.getEq=e.getShow=e.URI=e.right=e.left=void 0,e.getValidation=e.getValidationMonoid=e.getValidationSemigroup=e.getApplyMonoid=e.getApplySemigroup=e.either=e.stringifyJSON=e.parseJSON=e.sequenceArray=e.traverseArray=e.traverseArrayWithIndex=e.traverseReadonlyArrayWithIndex=e.traverseReadonlyNonEmptyArrayWithIndex=e.ApT=e.apSW=e.apS=e.bindW=e.bind=e.bindTo=e.Do=e.exists=e.elem=e.toError=e.toUnion=e.chainNullableK=e.fromNullableK=e.tryCatchK=e.tryCatch=e.fromNullable=e.orElse=e.orElseW=e.swap=e.filterOrElseW=e.filterOrElse=e.chainOptionK=e.fromOptionK=e.duplicate=e.flatten=e.flattenW=e.chainFirstW=e.chainFirst=e.apSecondW=e.apSecond=e.apFirstW=e.apFirst=e.flap=e.getOrElse=e.getOrElseW=void 0;var i=xd,o=mn,a=Au,s=_1,c=tn,u=Ve,l=vi,d=r(Be),p=wz,h=$s;e.left=d.left,e.right=d.right;var A=function(B,L){return(0,u.pipe)(B,(0,e.map)(L))},g=function(B,L){return(0,u.pipe)(B,(0,e.ap)(L))},v=function(B,L){return(0,u.pipe)(B,(0,e.chain)(L))},b=function(B,L,K){return(0,u.pipe)(B,(0,e.reduce)(L,K))},w=function(B){return function(L,K){var je=(0,e.foldMap)(B);return(0,u.pipe)(L,je(K))}},S=function(B,L,K){return(0,u.pipe)(B,(0,e.reduceRight)(L,K))},y=function(B){var L=(0,e.traverse)(B);return function(K,je){return(0,u.pipe)(K,L(je))}},C=function(B,L,K){return(0,u.pipe)(B,(0,e.bimap)(L,K))},x=function(B,L){return(0,u.pipe)(B,(0,e.mapLeft)(L))},T=function(B,L){return(0,u.pipe)(B,(0,e.alt)(L))},I=function(B,L){return(0,u.pipe)(B,(0,e.extend)(L))},R=function(B,L){return(0,s.tailRec)(L(B),function(K){return(0,e.isLeft)(K)?(0,e.right)((0,e.left)(K.left)):(0,e.isLeft)(K.right)?(0,e.left)(L(K.right.left)):(0,e.right)((0,e.right)(K.right.right))})};e.URI="Either";var O=function(B,L){return{show:function(K){return(0,e.isLeft)(K)?"left(".concat(B.show(K.left),")"):"right(".concat(L.show(K.right),")")}}};e.getShow=O;var k=function(B,L){return{equals:function(K,je){return K===je||((0,e.isLeft)(K)?(0,e.isLeft)(je)&&B.equals(K.left,je.left):(0,e.isRight)(je)&&L.equals(K.right,je.right))}}};e.getEq=k;var P=function(B){return{concat:function(L,K){return(0,e.isLeft)(K)?L:(0,e.isLeft)(L)?K:(0,e.right)(B.concat(L.right,K.right))}}};e.getSemigroup=P;var q=function(B){var L=(0,e.left)(B.empty);return{URI:e.URI,_E:void 0,compact:function(K){return(0,e.isLeft)(K)?K:K.right._tag==="None"?L:(0,e.right)(K.right.value)},separate:function(K){return(0,e.isLeft)(K)?(0,p.separated)(K,K):(0,e.isLeft)(K.right)?(0,p.separated)((0,e.right)(K.right.left),L):(0,p.separated)(L,(0,e.right)(K.right.right))}}};e.getCompactable=q;var Y=function(B){var L=(0,e.left)(B.empty),K=(0,e.getCompactable)(B),je=K.compact,D=K.separate,oe=function(ge,$e){return(0,e.isLeft)(ge)||$e(ge.right)?ge:L},be=function(ge,$e){return(0,e.isLeft)(ge)?(0,p.separated)(ge,ge):$e(ge.right)?(0,p.separated)(L,(0,e.right)(ge.right)):(0,p.separated)((0,e.right)(ge.right),L)};return{URI:e.URI,_E:void 0,map:A,compact:je,separate:D,filter:oe,filterMap:function(ge,$e){if((0,e.isLeft)(ge))return ge;var xt=$e(ge.right);return xt._tag==="None"?L:(0,e.right)(xt.value)},partition:be,partitionMap:function(ge,$e){if((0,e.isLeft)(ge))return(0,p.separated)(ge,ge);var xt=$e(ge.right);return(0,e.isLeft)(xt)?(0,p.separated)((0,e.right)(xt.left),L):(0,p.separated)(L,(0,e.right)(xt.right))}}};e.getFilterable=Y;var te=function(B){var L=(0,e.getFilterable)(B),K=(0,e.getCompactable)(B);return{URI:e.URI,_E:void 0,map:A,compact:L.compact,separate:L.separate,filter:L.filter,filterMap:L.filterMap,partition:L.partition,partitionMap:L.partitionMap,traverse:y,sequence:e.sequence,reduce:b,foldMap:w,reduceRight:S,wither:(0,h.witherDefault)(e.Traversable,K),wilt:(0,h.wiltDefault)(e.Traversable,K)}};e.getWitherable=te;var G=function(B){return{URI:e.URI,_E:void 0,map:A,ap:function(L,K){return(0,e.isLeft)(L)?(0,e.isLeft)(K)?(0,e.left)(B.concat(L.left,K.left)):L:(0,e.isLeft)(K)?K:(0,e.right)(L.right(K.right))},of:e.of}};e.getApplicativeValidation=G;var ee=function(B){return{URI:e.URI,_E:void 0,map:A,alt:function(L,K){if((0,e.isRight)(L))return L;var je=K();return(0,e.isLeft)(je)?(0,e.left)(B.concat(L.left,je.left)):je}}};e.getAltValidation=ee;var ne=function(B){return function(L){return(0,e.isLeft)(L)?L:(0,e.right)(B(L.right))}};e.map=ne,e.Functor={URI:e.URI,map:A},e.of=e.right,e.Pointed={URI:e.URI,of:e.of};var F=function(B){return function(L){return(0,e.isLeft)(L)?L:(0,e.isLeft)(B)?B:(0,e.right)(L.right(B.right))}};e.apW=F,e.ap=e.apW,e.Apply={URI:e.URI,map:A,ap:g},e.Applicative={URI:e.URI,map:A,ap:g,of:e.of};var M=function(B){return function(L){return(0,e.isLeft)(L)?L:B(L.right)}};e.chainW=M,e.chain=e.chainW,e.Chain={URI:e.URI,map:A,ap:g,chain:v},e.Monad={URI:e.URI,map:A,ap:g,of:e.of,chain:v};var N=function(B,L){return function(K){return(0,e.isLeft)(K)?B:L(B,K.right)}};e.reduce=N;var se=function(B){return function(L){return function(K){return(0,e.isLeft)(K)?B.empty:L(K.right)}}};e.foldMap=se;var Oe=function(B,L){return function(K){return(0,e.isLeft)(K)?B:L(K.right,B)}};e.reduceRight=Oe,e.Foldable={URI:e.URI,reduce:b,foldMap:w,reduceRight:S};var _e=function(B){return function(L){return function(K){return(0,e.isLeft)(K)?B.of((0,e.left)(K.left)):B.map(L(K.right),e.right)}}};e.traverse=_e;var j=function(B){return function(L){return(0,e.isLeft)(L)?B.of((0,e.left)(L.left)):B.map(L.right,e.right)}};e.sequence=j,e.Traversable={URI:e.URI,map:A,reduce:b,foldMap:w,reduceRight:S,traverse:y,sequence:e.sequence};var he=function(B,L){return function(K){return(0,e.isLeft)(K)?(0,e.left)(B(K.left)):(0,e.right)(L(K.right))}};e.bimap=he;var kt=function(B){return function(L){return(0,e.isLeft)(L)?(0,e.left)(B(L.left)):L}};e.mapLeft=kt,e.Bifunctor={URI:e.URI,bimap:C,mapLeft:x};var Qt=function(B){return function(L){return(0,e.isLeft)(L)?B():L}};e.altW=Qt,e.alt=e.altW,e.Alt={URI:e.URI,map:A,alt:T};var fi=function(B){return function(L){return(0,e.isLeft)(L)?L:(0,e.right)(B(L))}};e.extend=fi,e.Extend={URI:e.URI,map:A,extend:I},e.ChainRec={URI:e.URI,map:A,ap:g,chain:v,chainRec:R},e.throwError=e.left,e.MonadThrow={URI:e.URI,map:A,ap:g,of:e.of,chain:v,throwError:e.throwError},e.FromEither={URI:e.URI,fromEither:u.identity},e.fromPredicate=(0,c.fromPredicate)(e.FromEither),e.fromOption=(0,c.fromOption)(e.FromEither),e.isLeft=d.isLeft,e.isRight=d.isRight;var pi=function(B,L){return function(K){return(0,e.isLeft)(K)?B(K.left):L(K.right)}};e.matchW=pi,e.foldW=e.matchW,e.match=e.matchW,e.fold=e.match;var vo=function(B){return function(L){return(0,e.isLeft)(L)?B(L.left):L.right}};e.getOrElseW=vo,e.getOrElse=e.getOrElseW,e.flap=(0,l.flap)(e.Functor),e.apFirst=(0,o.apFirst)(e.Apply),e.apFirstW=e.apFirst,e.apSecond=(0,o.apSecond)(e.Apply),e.apSecondW=e.apSecond,e.chainFirst=(0,a.chainFirst)(e.Chain),e.chainFirstW=e.chainFirst,e.flattenW=(0,e.chainW)(u.identity),e.flatten=e.flattenW,e.duplicate=(0,e.extend)(u.identity),e.fromOptionK=(0,c.fromOptionK)(e.FromEither),e.chainOptionK=(0,c.chainOptionK)(e.FromEither,e.Chain),e.filterOrElse=(0,c.filterOrElse)(e.FromEither,e.Chain),e.filterOrElseW=e.filterOrElse;var aa=function(B){return(0,e.isLeft)(B)?(0,e.right)(B.left):(0,e.left)(B.right)};e.swap=aa;var ze=function(B){return function(L){return(0,e.isLeft)(L)?B(L.left):L}};e.orElseW=ze,e.orElse=e.orElseW;var mt=function(B){return function(L){return L==null?(0,e.left)(B):(0,e.right)(L)}};e.fromNullable=mt;var Xt=function(B,L){try{return(0,e.right)(B())}catch(K){return(0,e.left)(L(K))}};e.tryCatch=Xt;var Ot=function(B,L){return function(){for(var K=[],je=0;je<arguments.length;je++)K[je]=arguments[je];return(0,e.tryCatch)(function(){return B.apply(void 0,K)},L)}};e.tryCatchK=Ot;var fn=function(B){var L=(0,e.fromNullable)(B);return function(K){return(0,u.flow)(K,L)}};e.fromNullableK=fn;var fs=function(B){var L=(0,e.fromNullableK)(B);return function(K){return(0,e.chain)(L(K))}};e.chainNullableK=fs,e.toUnion=(0,e.foldW)(u.identity,u.identity);function ps(B){return B instanceof Error?B:new Error(String(B))}e.toError=ps;function hi(B){return function(L,K){if(K===void 0){var je=hi(B);return function(D){return je(L,D)}}return(0,e.isLeft)(K)?!1:B.equals(L,K.right)}}e.elem=hi;var yo=function(B){return function(L){return(0,e.isLeft)(L)?!1:B(L.right)}};e.exists=yo,e.Do=(0,e.of)(d.emptyRecord),e.bindTo=(0,l.bindTo)(e.Functor),e.bind=(0,a.bind)(e.Chain),e.bindW=e.bind,e.apS=(0,o.apS)(e.Apply),e.apSW=e.apS,e.ApT=(0,e.of)(d.emptyReadonlyArray);var Oc=function(B){return function(L){var K=B(0,d.head(L));if((0,e.isLeft)(K))return K;for(var je=[K.right],D=1;D<L.length;D++){var oe=B(D,L[D]);if((0,e.isLeft)(oe))return oe;je.push(oe.right)}return(0,e.right)(je)}};e.traverseReadonlyNonEmptyArrayWithIndex=Oc;var sa=function(B){var L=(0,e.traverseReadonlyNonEmptyArrayWithIndex)(B);return function(K){return d.isNonEmpty(K)?L(K):e.ApT}};e.traverseReadonlyArrayWithIndex=sa,e.traverseArrayWithIndex=e.traverseReadonlyArrayWithIndex;var Mc=function(B){return(0,e.traverseReadonlyArrayWithIndex)(function(L,K){return B(K)})};e.traverseArray=Mc,e.sequenceArray=(0,e.traverseArray)(u.identity);function Bl(B,L){return(0,e.tryCatch)(function(){return JSON.parse(B)},L)}e.parseJSON=Bl;var Dl=function(B,L){return(0,e.tryCatch)(function(){var K=JSON.stringify(B);if(typeof K!="string")throw new Error("Converting unsupported structure to JSON");return K},L)};e.stringifyJSON=Dl,e.either={URI:e.URI,map:A,of:e.of,ap:g,chain:v,reduce:b,foldMap:w,reduceRight:S,traverse:y,sequence:e.sequence,bimap:C,mapLeft:x,alt:T,extend:I,chainRec:R,throwError:e.throwError},e.getApplySemigroup=(0,o.getApplySemigroup)(e.Apply),e.getApplyMonoid=(0,i.getApplicativeMonoid)(e.Applicative);var jl=function(B,L){return(0,o.getApplySemigroup)((0,e.getApplicativeValidation)(B))(L)};e.getValidationSemigroup=jl;var Ul=function(B,L){return(0,i.getApplicativeMonoid)((0,e.getApplicativeValidation)(B))(L)};e.getValidationMonoid=Ul;function qS(B){var L=(0,e.getApplicativeValidation)(B).ap,K=(0,e.getAltValidation)(B).alt;return{URI:e.URI,_E:void 0,map:A,of:e.of,chain:v,bimap:C,mapLeft:x,reduce:b,foldMap:w,reduceRight:S,extend:I,traverse:y,sequence:e.sequence,chainRec:R,throwError:e.throwError,ap:L,alt:K}}e.getValidation=qS})(Zt);var Ze=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(r[o]=i[o])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),_d=function(){return _d=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},_d.apply(this,arguments)},BEe=function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,o;r<i;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))},na=Et,Xe=function(e,t,n){return na([{value:e,context:t,message:n}])},ke=Qe,xe=function(){function e(t,n,r,i){this.name=t,this.is=n,this.validate=r,this.encode=i,this.decode=this.decode.bind(this)}return e.prototype.pipe=function(t,n){var r=this;return n===void 0&&(n="pipe(".concat(this.name,", ").concat(t.name,")")),new e(n,t.is,function(i,o){var a=r.validate(i,o);return ae(a)?a:t.validate(a.right,o)},this.encode===Pe&&t.encode===Pe?Pe:function(i){return r.encode(t.encode(i))})},e.prototype.asDecoder=function(){return this},e.prototype.asEncoder=function(){return this},e.prototype.decode=function(t){return this.validate(t,[{key:"",type:this,actual:t}])},e}(),Pe=function(e){return e};function xz(e){return e.displayName||e.name||"<function".concat(e.length,">")}function DEe(e,t){return{key:e,type:t}}function Yi(e,t,n,r){for(var i=e.length,o=Array(i+1),a=0;a<i;a++)o[a]=e[a];return o[i]={key:t,type:n,actual:r},o}function wa(e,t){for(var n=t.length,r=0;r<n;r++)e.push(t[r])}var mu=Object.prototype.hasOwnProperty;function qw(e){return Object.keys(e).map(function(t){return"".concat(t,": ").concat(e[t].name)}).join(", ")}function wh(e){for(var t=0;t<e.length;t++)if(e[t].encode!==Pe)return!1;return!0}function _z(e){return"{ ".concat(qw(e)," }")}function Tz(e){return"Partial<".concat(e,">")}function jEe(e,t,n,r){r===void 0&&(r="{ [K in ".concat(t.name,"]: ").concat(n.name," }"));var i=e.length;return new AM(r,function(o){return rr.is(o)&&e.every(function(a){return n.is(o[a])})},function(o,a){var s=rr.validate(o,a);if(ae(s))return s;for(var c=s.right,u={},l=[],d=!1,p=0;p<i;p++){var h=e[p],A=c[h],g=n.validate(A,Yi(a,h,n,A));if(ae(g))wa(l,g.left);else{var v=g.right;d=d||v!==A,u[h]=v}}return l.length>0?na(l):ke(d||Object.keys(c).length!==i?u:c)},n.encode===Pe?Pe:function(o){for(var a={},s=0;s<i;s++){var c=e[s];a[c]=n.encode(o[c])}return a},t,n)}function fM(e){var t;if(Rz(e)){var n=e.value;if(ho.is(n))return t={},t[n]=null,t}else{if(qEe(e))return e.keys;if(kz(e)){var r=e.types.map(function(i){return fM(i)});return r.some(wv.is)?void 0:Object.assign.apply(Object,BEe([{}],r,!1))}}}function UEe(e,t,n){return n===void 0&&(n="{ [K in ".concat(e.name,"]: ").concat(t.name," }")),new AM(n,function(r){return rr.is(r)?Object.keys(r).every(function(i){return e.is(i)&&t.is(r[i])}):HL(t)&&Array.isArray(r)},function(r,i){if(rr.is(r)){for(var o={},a=[],s=Object.keys(r),c=s.length,u=!1,l=0;l<c;l++){var d=s[l],p=r[d],h=e.validate(d,Yi(i,d,e,d));if(ae(h))wa(a,h.left);else{var A=h.right;u=u||A!==d,d=A;var g=t.validate(p,Yi(i,d,t,p));if(ae(g))wa(a,g.left);else{var v=g.right;u=u||v!==p,o[d]=v}}}return a.length>0?na(a):ke(u?o:r)}return HL(t)&&Array.isArray(r)?ke(r):Xe(r,i)},e.encode===Pe&&t.encode===Pe?Pe:function(r){for(var i={},o=Object.keys(r),a=o.length,s=0;s<a;s++){var c=o[s];i[String(e.encode(c))]=t.encode(r[c])}return i},e,t)}function Iz(e){return"("+e.map(function(t){return t.name}).join(" | ")+")"}function Vw(e,t){for(var n=!0,r=!0,i=!rr.is(e),o=0,a=t;o<a.length;o++){var s=a[o];s!==e&&(n=!1),rr.is(s)&&(r=!1)}if(n)return e;if(r)return t[t.length-1];for(var c={},u=0,l=t;u<l.length;u++){var s=l[u];for(var d in s)(!mu.call(c,d)||i||s[d]!==e[d])&&(c[d]=s[d])}return c}function zw(e){switch(e._tag){case"RefinementType":case"ReadonlyType":return zw(e.type);case"InterfaceType":case"StrictType":case"PartialType":return e.props;case"IntersectionType":return e.types.reduce(function(t,n){return Object.assign(t,zw(n))},{})}}function QL(e,t){for(var n=Object.getOwnPropertyNames(e),r=!1,i={},o=0;o<n.length;o++){var a=n[o];mu.call(t,a)?i[a]=e[a]:r=!0}return r?i:e}function PEe(e){return $z(e)?"{| ".concat(qw(e.props)," |}"):VEe(e)?Tz("{| ".concat(qw(e.props)," |}")):"Exact<".concat(e.name,">")}function NEe(e){return e.length>0}var Ar={};function Ez(e,t){for(var n=[],r=0,i=e;r<i.length;r++){var o=i[r];t.indexOf(o)!==-1&&n.push(o)}return n}function WEe(e,t){if(e===Ar)return t;if(t===Ar)return e;var n=Object.assign({},e);for(var r in t)if(mu.call(e,r)){var i=Ez(e[r],t[r]);if(NEe(i))n[r]=i;else{n=Ar;break}}else n[r]=t[r];return n}function KEe(e,t){if(e===Ar||t===Ar)return Ar;var n=Ar;for(var r in e)if(mu.call(t,r)){var i=Ez(e[r],t[r]);i.length===0&&(n===Ar&&(n={}),n[r]=e[r].concat(t[r]))}return n}function HL(e){return e._tag==="AnyType"}function Rz(e){return e._tag==="LiteralType"}function qEe(e){return e._tag==="KeyofType"}function $z(e){return e._tag==="InterfaceType"}function VEe(e){return e._tag==="PartialType"}function zEe(e){return e._tag==="StrictType"}function QEe(e){return e._tag==="ExactType"}function HEe(e){return e._tag==="RefinementType"}function YEe(e){return e._tag==="IntersectionType"}function kz(e){return e._tag==="UnionType"}function GEe(e){return e._tag==="RecursiveType"}var YS=[];function bs(e){if(YS.indexOf(e)!==-1)return Ar;if($z(e)||zEe(e)){var t=Ar;for(var n in e.props){var r=e.props[n];Rz(r)&&(t===Ar&&(t={}),t[n]=[r.value])}return t}else{if(QEe(e)||HEe(e))return bs(e.type);if(YEe(e))return e.types.reduce(function(o,a){return WEe(o,bs(a))},Ar);if(kz(e))return e.types.slice(1).reduce(function(o,a){return KEe(o,bs(a))},bs(e.types[0]));if(GEe(e)){YS.push(e);var i=bs(e.type);return YS.pop(),i}}return Ar}function Oz(e){var t=bs(e[0]),n=Object.keys(t),r=e.length,i=function(u){for(var l=t[u].slice(),d=[t[u]],p=1;p<r;p++){var h=e[p],A=bs(h),g=A[u];if(g===void 0)return"continue-keys";if(g.some(function(v){return l.indexOf(v)!==-1}))return"continue-keys";l.push.apply(l,g),d.push(g)}return{value:[u,d]}};e:for(var o=0,a=n;o<a.length;o++){var s=a[o],c=i(s);if(typeof c=="object")return c.value;switch(c){case"continue-keys":continue e}}}var Mz=function(e){Ze(t,e);function t(){var n=e.call(this,"null",function(r){return r===null},function(r,i){return n.is(r)?ke(r):Xe(r,i)},Pe)||this;return n._tag="NullType",n}return t}(xe),Qw=new Mz,Fz=function(e){Ze(t,e);function t(){var n=e.call(this,"undefined",function(r){return r===void 0},function(r,i){return n.is(r)?ke(r):Xe(r,i)},Pe)||this;return n._tag="UndefinedType",n}return t}(xe),wv=new Fz,Lz=function(e){Ze(t,e);function t(){var n=e.call(this,"void",wv.is,wv.validate,Pe)||this;return n._tag="VoidType",n}return t}(xe),YL=new Lz,Bz=function(e){Ze(t,e);function t(){var n=e.call(this,"unknown",function(r){return!0},ke,Pe)||this;return n._tag="UnknownType",n}return t}(xe),JEe=new Bz,Dz=function(e){Ze(t,e);function t(){var n=e.call(this,"string",function(r){return typeof r=="string"},function(r,i){return n.is(r)?ke(r):Xe(r,i)},Pe)||this;return n._tag="StringType",n}return t}(xe),ho=new Dz,jz=function(e){Ze(t,e);function t(){var n=e.call(this,"number",function(r){return typeof r=="number"},function(r,i){return n.is(r)?ke(r):Xe(r,i)},Pe)||this;return n._tag="NumberType",n}return t}(xe),_l=new jz,Uz=function(e){Ze(t,e);function t(){var n=e.call(this,"bigint",function(r){return typeof r=="bigint"},function(r,i){return n.is(r)?ke(r):Xe(r,i)},Pe)||this;return n._tag="BigIntType",n}return t}(xe),ZEe=new Uz,Pz=function(e){Ze(t,e);function t(){var n=e.call(this,"boolean",function(r){return typeof r=="boolean"},function(r,i){return n.is(r)?ke(r):Xe(r,i)},Pe)||this;return n._tag="BooleanType",n}return t}(xe),T1=new Pz,Nz=function(e){Ze(t,e);function t(){var n=e.call(this,"UnknownArray",Array.isArray,function(r,i){return n.is(r)?ke(r):Xe(r,i)},Pe)||this;return n._tag="AnyArrayType",n}return t}(xe),Td=new Nz,Wz=function(e){Ze(t,e);function t(){var n=e.call(this,"UnknownRecord",function(r){var i=Object.prototype.toString.call(r);return i==="[object Object]"||i==="[object Window]"},function(r,i){return n.is(r)?ke(r):Xe(r,i)},Pe)||this;return n._tag="AnyDictionaryType",n}return t}(xe),rr=new Wz,Kz=function(e){Ze(t,e);function t(n,r,i,o,a){var s=e.call(this,n,r,i,o)||this;return s.value=a,s._tag="LiteralType",s}return t}(xe);function Wm(e,t){t===void 0&&(t=JSON.stringify(e));var n=function(r){return r===e};return new Kz(t,n,function(r,i){return n(r)?ke(e):Xe(r,i)},Pe,e)}var qz=function(e){Ze(t,e);function t(n,r,i,o,a){var s=e.call(this,n,r,i,o)||this;return s.keys=a,s._tag="KeyofType",s}return t}(xe);function XEe(e,t){t===void 0&&(t=Object.keys(e).map(function(r){return JSON.stringify(r)}).join(" | "));var n=function(r){return ho.is(r)&&mu.call(e,r)};return new qz(t,n,function(r,i){return n(r)?ke(r):Xe(r,i)},Pe,e)}var Vz=function(e){Ze(t,e);function t(n,r,i,o,a,s){var c=e.call(this,n,r,i,o)||this;return c.type=a,c.predicate=s,c._tag="RefinementType",c}return t}(xe);function I1(e,t,n){return vM(e,t,n)}var xv=I1(_l,function(e){return Number.isInteger(e)},"Int"),pM=function(e){Ze(t,e);function t(n,r,i,o,a){var s=e.call(this,n,r,i,o)||this;return s.runDefinition=a,s._tag="RecursiveType",s}return t}(xe);Object.defineProperty(pM.prototype,"type",{get:function(){return this.runDefinition()},enumerable:!0,configurable:!0});function hM(e,t){var n,r=function(){return n||(n=t(i),n.name=e),n},i=new pM(e,function(o){return r().is(o)},function(o,a){return r().validate(o,a)},function(o){return r().encode(o)},r);return i}var zz=function(e){Ze(t,e);function t(n,r,i,o,a){var s=e.call(this,n,r,i,o)||this;return s.type=a,s._tag="ArrayType",s}return t}(xe);function E1(e,t){return t===void 0&&(t="Array<".concat(e.name,">")),new zz(t,function(n){return Td.is(n)&&n.every(e.is)},function(n,r){var i=Td.validate(n,r);if(ae(i))return i;for(var o=i.right,a=o.length,s=o,c=[],u=0;u<a;u++){var l=o[u],d=e.validate(l,Yi(r,String(u),e,l));if(ae(d))wa(c,d.left);else{var p=d.right;p!==l&&(s===o&&(s=o.slice()),s[u]=p)}}return c.length>0?na(c):ke(s)},e.encode===Pe?Pe:function(n){return n.map(e.encode)},e)}var Qz=function(e){Ze(t,e);function t(n,r,i,o,a){var s=e.call(this,n,r,i,o)||this;return s.props=a,s._tag="InterfaceType",s}return t}(xe);function Hw(e,t){t===void 0&&(t=_z(e));var n=Object.keys(e),r=n.map(function(o){return e[o]}),i=n.length;return new Qz(t,function(o){if(rr.is(o)){for(var a=0;a<i;a++){var s=n[a],c=o[s];if(c===void 0&&!mu.call(o,s)||!r[a].is(c))return!1}return!0}return!1},function(o,a){var s=rr.validate(o,a);if(ae(s))return s;for(var c=s.right,u=c,l=[],d=0;d<i;d++){var p=n[d],h=u[p],A=r[d],g=A.validate(h,Yi(a,p,A,h));if(ae(g))wa(l,g.left);else{var v=g.right;(v!==h||v===void 0&&!mu.call(u,p))&&(u===c&&(u=_d({},c)),u[p]=v)}}return l.length>0?na(l):ke(u)},wh(r)?Pe:function(o){for(var a=_d({},o),s=0;s<i;s++){var c=n[s],u=r[s].encode;u!==Pe&&(a[c]=u(o[c]))}return a},e)}var Hz=function(e){Ze(t,e);function t(n,r,i,o,a){var s=e.call(this,n,r,i,o)||this;return s.props=a,s._tag="PartialType",s}return t}(xe);function eRe(e,t){t===void 0&&(t=Tz(_z(e)));var n=Object.keys(e),r=n.map(function(o){return e[o]}),i=n.length;return new Hz(t,function(o){if(rr.is(o)){for(var a=0;a<i;a++){var s=n[a],c=o[s];if(c!==void 0&&!e[s].is(c))return!1}return!0}return!1},function(o,a){var s=rr.validate(o,a);if(ae(s))return s;for(var c=s.right,u=c,l=[],d=0;d<i;d++){var p=n[d],h=u[p],A=e[p],g=A.validate(h,Yi(a,p,A,h));if(ae(g))h!==void 0&&wa(l,g.left);else{var v=g.right;v!==h&&(u===c&&(u=_d({},c)),u[p]=v)}}return l.length>0?na(l):ke(u)},wh(r)?Pe:function(o){for(var a=_d({},o),s=0;s<i;s++){var c=n[s],u=o[c];u!==void 0&&(a[c]=r[s].encode(u))}return a},e)}var AM=function(e){Ze(t,e);function t(n,r,i,o,a,s){var c=e.call(this,n,r,i,o)||this;return c.domain=a,c.codomain=s,c._tag="DictionaryType",c}return t}(xe);function mM(e,t,n){var r=fM(e);return r?jEe(Object.keys(r),e,t,n):UEe(e,t,n)}var gM=function(e){Ze(t,e);function t(n,r,i,o,a){var s=e.call(this,n,r,i,o)||this;return s.types=a,s._tag="UnionType",s}return t}(xe);function Km(e,t){t===void 0&&(t=Iz(e));var n=Oz(e);if(n!==void 0&&e.length>0){var r=n[0],i=n[1],o=i.length,a=function(s){for(var c=0;c<o;c++)if(i[c].indexOf(s)!==-1)return c};return new _v(t,function(s){if(rr.is(s)){var c=a(s[r]);return c!==void 0?e[c].is(s):!1}return!1},function(s,c){var u=rr.validate(s,c);if(ae(u))return u;var l=u.right,d=a(l[r]);if(d===void 0)return Xe(s,c);var p=e[d];return p.validate(l,Yi(c,String(d),p,l))},wh(e)?Pe:function(s){var c=a(s[r]);if(c===void 0)throw new Error("no codec found to encode value in union codec ".concat(t));return e[c].encode(s)},e,r)}else return new gM(t,function(s){return e.some(function(c){return c.is(s)})},function(s,c){for(var u=[],l=0;l<e.length;l++){var d=e[l],p=d.validate(s,Yi(c,String(l),d,s));if(ae(p))wa(u,p.left);else return ke(p.right)}return na(u)},wh(e)?Pe:function(s){for(var c=0,u=e;c<u.length;c++){var l=u[c];if(l.is(s))return l.encode(s)}throw new Error("no codec found to encode value in union type ".concat(t))},e)}var Yz=function(e){Ze(t,e);function t(n,r,i,o,a){var s=e.call(this,n,r,i,o)||this;return s.types=a,s._tag="IntersectionType",s}return t}(xe);function tRe(e,t){t===void 0&&(t="(".concat(e.map(function(r){return r.name}).join(" & "),")"));var n=e.length;return new Yz(t,function(r){return e.every(function(i){return i.is(r)})},e.length===0?ke:function(r,i){for(var o=[],a=[],s=0;s<n;s++){var c=e[s],u=c.validate(r,Yi(i,String(s),c,r));ae(u)?wa(a,u.left):o.push(u.right)}return a.length>0?na(a):ke(Vw(r,o))},e.length===0?Pe:function(r){return Vw(r,e.map(function(i){return i.encode(r)}))},e)}var Gz=function(e){Ze(t,e);function t(n,r,i,o,a){var s=e.call(this,n,r,i,o)||this;return s.types=a,s._tag="TupleType",s}return t}(xe);function nRe(e,t){t===void 0&&(t="[".concat(e.map(function(r){return r.name}).join(", "),"]"));var n=e.length;return new Gz(t,function(r){return Td.is(r)&&r.length===n&&e.every(function(i,o){return i.is(r[o])})},function(r,i){var o=Td.validate(r,i);if(ae(o))return o;for(var a=o.right,s=a.length>n?a.slice(0,n):a,c=[],u=0;u<n;u++){var l=a[u],d=e[u],p=d.validate(l,Yi(i,String(u),d,l));if(ae(p))wa(c,p.left);else{var h=p.right;h!==l&&(s===a&&(s=a.slice()),s[u]=h)}}return c.length>0?na(c):ke(s)},wh(e)?Pe:function(r){return e.map(function(i,o){return i.encode(r[o])})},e)}var Jz=function(e){Ze(t,e);function t(n,r,i,o,a){var s=e.call(this,n,r,i,o)||this;return s.type=a,s._tag="ReadonlyType",s}return t}(xe);function rRe(e,t){return t===void 0&&(t="Readonly<".concat(e.name,">")),new Jz(t,e.is,e.validate,e.encode,e)}var Zz=function(e){Ze(t,e);function t(n,r,i,o,a){var s=e.call(this,n,r,i,o)||this;return s.type=a,s._tag="ReadonlyArrayType",s}return t}(xe);function Xz(e,t){t===void 0&&(t="ReadonlyArray<".concat(e.name,">"));var n=E1(e);return new Zz(t,n.is,n.validate,n.encode,e)}var xh=function(e,t){return tQ(Hw(e),t)},eQ=function(e){Ze(t,e);function t(n,r,i,o,a){var s=e.call(this,n,r,i,o)||this;return s.type=a,s._tag="ExactType",s}return t}(xe);function tQ(e,t){t===void 0&&(t=PEe(e));var n=zw(e);return new eQ(t,e.is,function(r,i){var o=rr.validate(r,i);if(ae(o))return o;var a=e.validate(r,i);return ae(a)?a:Qe(QL(a.right,n))},function(r){return e.encode(QL(r,n))},e)}var nQ=function(e){Ze(t,e);function t(){var n=e.call(this,"Function",function(r){return typeof r=="function"},function(r,i){return n.is(r)?ke(r):Xe(r,i)},Pe)||this;return n._tag="FunctionType",n}return t}(xe),iRe=new nQ,_v=function(e){Ze(t,e);function t(n,r,i,o,a,s){var c=e.call(this,n,r,i,o,a)||this;return c.tag=s,c}return t}(gM),oRe=function(e,t,n){n===void 0&&(n=Iz(t));var r=Km(t,n);return r instanceof _v?r:(console.warn("[io-ts] Cannot build a tagged union for ".concat(n,", returning a de-optimized union")),new _v(n,r.is,r.validate,r.encode,t,e))},aRe=function(e,t){return{value:e,context:t}},rQ=function(e){return[{key:"",type:e}]},iQ=function(e){Ze(t,e);function t(){var n=e.call(this,"never",function(r){return!1},function(r,i){return Xe(r,i)},function(){throw new Error("cannot encode never")})||this;return n._tag="NeverType",n}return t}(xe),sRe=new iQ,oQ=function(e){Ze(t,e);function t(){var n=e.call(this,"any",function(r){return!0},ke,Pe)||this;return n._tag="AnyType",n}return t}(xe),cRe=new oQ,uRe=rr,aQ=function(e){Ze(t,e);function t(){var n=e.call(this,"object",function(r){return r!==null&&typeof r=="object"},function(r,i){return n.is(r)?ke(r):Xe(r,i)},Pe)||this;return n._tag="ObjectType",n}return t}(xe),lRe=new aQ;function vM(e,t,n){return n===void 0&&(n="(".concat(e.name," | ").concat(xz(t),")")),new Vz(n,function(r){return e.is(r)&&t(r)},function(r,i){var o=e.validate(r,i);if(ae(o))return o;var a=o.right;return t(a)?ke(a):Xe(a,i)},e.encode,e,t)}var dRe=vM(_l,Number.isInteger,"Integer"),fRe=mM,pRe=function(e){Ze(t,e);function t(n,r,i,o,a){var s=e.call(this,n,r,i,o)||this;return s.props=a,s._tag="StrictType",s}return t}(xe);function hRe(e){return e}function ARe(e){return function(){return e}}const mRe=Object.freeze(Object.defineProperty({__proto__:null,AnyArrayType:Nz,AnyDictionaryType:Wz,AnyType:oQ,Array:Td,ArrayType:zz,BigIntType:Uz,BooleanType:Pz,Dictionary:uRe,DictionaryType:AM,ExactType:eQ,Function:iRe,FunctionType:nQ,Int:xv,Integer:dRe,InterfaceType:Qz,IntersectionType:Yz,KeyofType:qz,LiteralType:Kz,NeverType:iQ,NullType:Mz,NumberType:jz,ObjectType:aQ,PartialType:Hz,ReadonlyArrayType:Zz,ReadonlyType:Jz,RecursiveType:pM,RefinementType:Vz,StrictType:pRe,StringType:Dz,TaggedUnionType:_v,TupleType:Gz,Type:xe,UndefinedType:Fz,UnionType:gM,UnknownArray:Td,UnknownRecord:rr,UnknownType:Bz,VoidType:Lz,alias:ARe,any:cRe,appendContext:Yi,array:E1,bigint:ZEe,boolean:T1,brand:I1,clean:hRe,dictionary:fRe,emptyTags:Ar,exact:tQ,failure:Xe,failures:na,getContextEntry:DEe,getDefaultContext:rQ,getDomainKeys:fM,getFunctionName:xz,getIndex:Oz,getTags:bs,getValidationError:aRe,identity:Pe,interface:Hw,intersection:tRe,keyof:XEe,literal:Wm,mergeAll:Vw,never:sRe,null:Qw,nullType:Qw,number:_l,object:lRe,partial:eRe,readonly:rRe,readonlyArray:Xz,record:mM,recursion:hM,refinement:vM,strict:xh,string:ho,success:ke,taggedUnion:oRe,tuple:nRe,type:Hw,undefined:wv,union:Km,unknown:JEe,void:YL,voidType:YL},Symbol.toStringTag,{value:"Module"})),X=Mu(mRe);var qm={};Object.defineProperty(qm,"__esModule",{value:!0});qm.ContentPath=void 0;const GL="::";qm.ContentPath={serialize(e){return e.map(t=>t.key).join(GL)},current(e){return e[e.length-1]},append(e,t){return e+GL+t},make(e){return e.reduce((t,{key:n,type:r})=>n?t.concat({key:n,type:r}):t,[])}};var Tl={},R1={};Object.defineProperty(R1,"__esModule",{value:!0});R1.getAssetOrThrow=void 0;const gRe=e=>t=>{const n=e[t];if(!n)throw new Error(`Missing asset with id '${t}'!`);return n};R1.getAssetOrThrow=gRe;var $1={};Object.defineProperty($1,"__esModule",{value:!0});$1.getEmbedOrThrow=void 0;const vRe=e=>t=>{const n=e[t];if(!n)throw new Error(`Missing embed with url '${t}'`);return n};$1.getEmbedOrThrow=vRe;var k1={},Je={};const Ao=Mu(NU);function sQ(e,t,n){return n===void 0&&(n=e.name),new xe(n,e.is,e.validate,function(r){return t(e.encode(r))})}const yRe=Object.freeze(Object.defineProperty({__proto__:null,mapOutput:sQ},Symbol.toStringTag,{value:"Module"}));var cQ=I1(ho,function(e){return e.length>0},"NonEmptyString");function uQ(e,t){t===void 0&&(t="NonEmptyArray<"+e.name+">");var n=E1(e);return new xe(t,function(r){return n.is(r)&&Vt(r)},function(r,i){return pe(n.validate(r,i),$i(function(o){var a=RT(o);return Ke(a)?Xe(r,i):ke(a.value)}))},function(r){return n.encode(r)})}function lQ(e,t,n){n===void 0&&(n="Set<"+e.name+">");var r=E1(e),i=rq(t),o=eq(t);return new xe(n,function(a){return a instanceof Set&&nq(e.is)(a)},function(a,s){return pe(r.validate(a,s),$i(function(c){var u=o(c);return u.size!==c.length?Xe(a,s):ke(u)}))},function(a){return r.encode(i(a))})}function bRe(e,t,n){return n===void 0&&(n="ReadonlySet<"+e.name+">"),lQ(e,t,n)}function yM(e,t){return new xe(e,t,function(n,r){return t(n)?ke(n):Xe(n,r)},Pe)}var SRe=function(e){return e instanceof Date},CRe=yM("Date",SRe),wRe=function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,o;r<i;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))},xRe=function(e,t){return{get:e,reverseGet:t}},dQ=function(e){return wc(e.get,Z(e.reverseGet,wr))},_Re=function(e){return Il(Z(e.get,Ct),e.reverseGet)},TRe=function(e){return ss(Z(e.get,Ct),Z(e.reverseGet,wr))},IRe=function(e){return Ap(function(t){return function(n){return function(r){return t.map(n(e.get(r)),function(i){return e.reverseGet(i)})}}})},wc=function(e,t){return{get:e,set:t}},bM=function(e){return ss(Z(e.get,Ct),e.set)},ERe=function(e){return Ap(function(t){return function(n){return function(r){return t.map(n(e.get(r)),function(i){return e.set(i)(r)})}}})},fQ=function(e){return function(t){return wc(function(n){return e.get(t.get(n))},function(n){return function(r){return t.set(e.set(n)(t.get(r)))(r)}})}},RRe=function(e){return function(t){return Il(Z(t.getOption,EA(e.getOption)),Z(e.reverseGet,t.reverseGet))}},$Re=function(e){return function(t){return El(SM(e))(bM(t))}},kRe=function(){return wc(z,wr)},ORe=function(e){return function(t){return wc(function(n){return t.get(n)[e]},function(n){return function(r){var i,o=t.get(r);return n===o[e]?r:t.set(Object.assign({},o,(i={},i[e]=n,i)))(r)}})}},MRe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(n){return wc(function(r){for(var i=n.get(r),o={},a=0,s=e;a<s.length;a++){var c=s[a];o[c]=i[c]}return o},function(r){return function(i){for(var o=n.get(i),a=0,s=e;a<s.length;a++){var c=s[a];if(r[c]!==o[c])return n.set(Object.assign({},o,r))(i)}return i}})}},FRe=function(e){return function(t){return wc(function(n){return t.get(n)[e]},function(n){return function(r){var i=t.get(r);if(n===i[e])return r;var o=i.slice();return o[e]=n,t.set(o)(r)}})}},LRe=function(e){return function(t){return pe(t,fQ(r$e().at(e)))}},Il=function(e,t){return{getOption:e,reverseGet:t}},SM=function(e){return ss(e.getOption,function(t){return hQ(t)(e)})},pQ=function(e){return Ap(function(t){return function(n){return function(r){return pe(e.getOption(r),rc(function(){return t.of(r)},function(i){return t.map(n(i),function(o){return hQ(o)(e)(r)})}))}}})},BRe=function(e){return function(t){return function(n){return pe(t.getOption(n),Ko(function(r){var i=e(r);return i===r?n:t.reverseGet(i)}))}}},DRe=function(e){return function(t){var n=BRe(e)(t);return function(r){return pe(n(r),sE(function(){return r}))}}},hQ=function(e){return DRe(function(){return e})},jRe=function(e){return function(t){return El(bM(e))(SM(t))}},URe=function(){return Il(Wu,z)},CM=function(e){return Il(I0(e),z)},PRe=function(){return Il(z,Ct)},NRe=function(){return Il(Sf,Qe)},WRe=function(){return Il(function(e){return ae(e)?Ct(e.left):rt},Et)},ss=function(e,t){return{getOption:e,set:t}},KRe=function(e){return Ap(function(t){return function(n){return function(r){return pe(e.getOption(r),rc(function(){return t.of(r)},function(i){return t.map(n(i),function(o){return e.set(o)(r)})}))}}})},AQ=function(e){return function(t){return function(n){return pe(t.getOption(n),Ko(function(r){var i=e(r);return i===r?n:t.set(i)(n)}))}}},mQ=function(e){return function(t){var n=AQ(e)(t);return function(r){return pe(n(r),sE(function(){return r}))}}},El=function(e){return function(t){return ss(Z(t.getOption,EA(e.getOption)),function(n){return mQ(e.set(n))(t)})}},qRe=function(e){return function(t){return pe(t,El(XRe().index(e)))}},VRe=function(e){return function(t){return pe(t,El(e$e().index(e)))}},zRe=function(e){return function(t){return pe(t,El(t$e().index(e)))}},QRe=function(e){return ss(s0(e),function(t){return function(n){return pe(a0(e)(n),rc(function(){return n},function(r){return g0(r,t,n)}))}})},gQ=function(e,t,n){if(n[e]===t)return n;var r=wRe([n[0]],n.slice(1),!0);return r[e]=t,r},HRe=function(e){return ss(s0(e),function(t){return function(n){return pe(a0(e)(n),rc(function(){return n},function(r){return gQ(r,t,n)}))}})},Ap=function(e){return{modifyF:e}};function wM(e){return function(t){return Ap(function(n){return function(r){return t.modifyF(n)(e.modifyF(n)(r))}})}}var YRe={URI:"Identity",map:function(e,t){return t(e)},of:z,ap:function(e,t){return e(t)}},GRe=function(e){return e.URI==="Identity"};function JRe(e){return function(){return Ap(function(t){var n=GRe(t)?e.map:e.traverse(t);return function(r){return function(i){return n(i,r)}}})}}function ZRe(e){return wM(JRe(e)())}var xM=function(e){return{index:e}},XRe=function(){return xM(function(e){return ss(function(t){return du(e,t)},function(t){return function(n){return pe(du(e,n),rc(function(){return n},function(){return g0(e,t,n)}))}})})},e$e=function(){return xM(function(e){return ss(function(t){return du(e,t)},function(t){return function(n){return pe(du(e,n),rc(function(){return n},function(){return gQ(e,t,n)}))}})})},t$e=function(){return xM(function(e){return ss(function(t){return fu(e,t)},function(t){return function(n){return n[e]===t||Ke(fu(e,n))?n:sk(e,t)(n)}})})},n$e=function(e){return{at:e}};function r$e(){return n$e(function(e){return wc(function(t){return fu(e,t)},rc(function(){return Y$(e)},function(t){return sk(e,t)}))})}var vQ=xRe,Yw=dQ,Gw=_Re,Jw=TRe,Zw=IRe,i$e=function(e){return function(t){return vQ(Z(t.get,e.get),Z(e.reverseGet,t.reverseGet))}},o$e=function(e){return vQ(e.reverseGet,e.get)},a$e=function(e){return function(t){return function(n){return t.reverseGet(e(t.get(n)))}}},yQ=wc,Tv=kRe,Ds=bM,Id=ERe,gu=fQ,s$e=gu,c$e=Z(dQ,gu),Rl=$Re,_M=function(e){return Z(Ds,El(e))},u$e=function(e){return Z(Id,wM(e))},bQ=function(e){return function(t){return function(n){var r=t.get(n),i=e(r);return r===i?n:t.set(i)(n)}}};function l$e(e){return function(t){return function(n){return function(r){return pe(n.get(r),t,function(i){return e.map(i,function(o){return n.set(o)(r)})})}}}}var d$e=function(e){return Rl(URe())(e)};function f$e(e){return Rl(CM(e))}var SQ=ORe,CQ=MRe,p$e=FRe,h$e=function(e){return Z(Ds,qRe(e))},A$e=function(e){return Z(Ds,VRe(e))},m$e=function(e){return Z(Ds,zRe(e))},g$e=LRe,v$e=Rl(PRe()),y$e=Rl(NRe()),b$e=Rl(WRe());function S$e(e){return Z(Id,ZRe(e))}function C$e(e){return _M(QRe(e))}function w$e(e){return _M(HRe(e))}var x$e=function(e,t){return function(n){return wQ(n,e,t)}},wQ=function(e,t,n){return yQ(Z(e.get,t),Z(n,e.set))},O1="monocle-ts/Lens",_$e={URI:O1,imap:wQ},xQ={URI:O1,compose:function(e,t){return gu(e)(t)}},T$e={URI:O1,compose:xQ.compose,id:Tv};const I$e=Object.freeze(Object.defineProperty({__proto__:null,Category:T$e,Invariant:_$e,Semigroupoid:xQ,URI:O1,asOptional:Ds,asTraversal:Id,atKey:g$e,component:p$e,compose:gu,composeIso:c$e,composeLens:s$e,composeOptional:_M,composePrism:Rl,composeTraversal:u$e,filter:f$e,findFirst:C$e,findFirstNonEmpty:w$e,fromNullable:d$e,id:Tv,imap:x$e,index:h$e,indexNonEmpty:A$e,key:m$e,left:b$e,lens:yQ,modify:bQ,modifyF:l$e,prop:SQ,props:CQ,right:y$e,some:v$e,traverse:S$e},Symbol.toStringTag,{value:"Module"}));var JL=KRe,Qc=El,E$e=AQ,R$e=mQ,$$e=CM,Xw=SM,ex=pQ,tx=RRe,k$e=jRe,ga=wM,_Q=function(e){return function(t){return t.modifyF(YRe)(e)}},O$e=function(e){return _Q(function(){return e})};function M$e(e){return ga(pQ(CM(e)))}var ZL=function(e){return new IQ(e.get,e.reverseGet)},ad=function(e){return new TM(e.get,e.set)},Gp=function(e){return new EQ(e.getOption,e.reverseGet)},yi=function(e){return new F$e(e.getOption,e.set)},Lr=function(e){return new L$e(e.modifyF)},TQ=function(e,t,n){var r;return n===e[t]?e:Object.assign({},e,(r={},r[t]=n,r))},IQ=function(){function e(t,n){this.get=t,this.reverseGet=n,this._tag="Iso",this.unwrap=this.get,this.to=this.get,this.wrap=this.reverseGet,this.from=this.reverseGet}return e.prototype.reverse=function(){return ZL(o$e(this))},e.prototype.modify=function(t){return a$e(t)(this)},e.prototype.asLens=function(){return ad(Yw(this))},e.prototype.asPrism=function(){return Gp(Gw(this))},e.prototype.asOptional=function(){return yi(Jw(this))},e.prototype.asTraversal=function(){return Lr(Zw(this))},e.prototype.asFold=function(){var t=this;return new mp(function(){return function(n){return function(r){return n(t.get(r))}}})},e.prototype.asGetter=function(){var t=this;return new $Q(function(n){return t.get(n)})},e.prototype.asSetter=function(){var t=this;return new Vm(function(n){return t.modify(n)})},e.prototype.compose=function(t){return ZL(i$e(t)(this))},e.prototype.composeIso=function(t){return this.compose(t)},e.prototype.composeLens=function(t){return ad(pe(this,Yw,gu(t)))},e.prototype.composePrism=function(t){return Gp(pe(this,Gw,tx(t)))},e.prototype.composeOptional=function(t){return yi(pe(this,Jw,Qc(t)))},e.prototype.composeTraversal=function(t){return Lr(pe(this,Zw,ga(t)))},e.prototype.composeFold=function(t){return this.asFold().compose(t)},e.prototype.composeGetter=function(t){return this.asGetter().compose(t)},e.prototype.composeSetter=function(t){return this.asSetter().compose(t)},e}(),TM=function(){function e(t,n){this.get=t,this.set=n,this._tag="Lens"}return e.fromPath=function(){var t=e.fromProp();return function(n){var r=t(n[0]);return n.slice(1).reduce(function(i,o){return i.compose(t(o))},r)}},e.fromProp=function(){return function(t){return ad(pe(Tv(),SQ(t)))}},e.fromProps=function(){return function(t){return ad(pe(Tv(),CQ.apply(I$e,t)))}},e.fromNullableProp=function(){return function(t,n){return new e(function(r){var i=Wu(r[t]);return Ke(i)?n:i.value},function(r){return function(i){return TQ(i,t,r)}})}},e.prototype.modify=function(t){return bQ(t)(this)},e.prototype.asOptional=function(){return yi(Ds(this))},e.prototype.asTraversal=function(){return Lr(Id(this))},e.prototype.asSetter=function(){var t=this;return new Vm(function(n){return t.modify(n)})},e.prototype.asGetter=function(){var t=this;return new $Q(function(n){return t.get(n)})},e.prototype.asFold=function(){var t=this;return new mp(function(){return function(n){return function(r){return n(t.get(r))}}})},e.prototype.compose=function(t){return ad(gu(t)(this))},e.prototype.composeLens=function(t){return this.compose(t)},e.prototype.composeGetter=function(t){return this.asGetter().compose(t)},e.prototype.composeFold=function(t){return this.asFold().compose(t)},e.prototype.composeOptional=function(t){return yi(pe(this,Ds,Qc(t)))},e.prototype.composeTraversal=function(t){return Lr(pe(this,Id,ga(t)))},e.prototype.composeSetter=function(t){return this.asSetter().compose(t)},e.prototype.composeIso=function(t){return ad(pe(this,gu(pe(t,Yw))))},e.prototype.composePrism=function(t){return yi(Rl(t)(this))},e}(),EQ=function(){function e(t,n){this.getOption=t,this.reverseGet=n,this._tag="Prism"}return e.fromPredicate=function(t){return Gp($$e(t))},e.some=function(){return RQ},e.prototype.modify=function(t){var n=this;return function(r){var i=n.modifyOption(t)(r);return Ke(i)?r:i.value}},e.prototype.modifyOption=function(t){var n=this;return function(r){return Y6.map(n.getOption(r),function(i){var o=t(i);return o===i?r:n.reverseGet(o)})}},e.prototype.set=function(t){return this.modify(function(){return t})},e.prototype.asOptional=function(){return yi(Xw(this))},e.prototype.asTraversal=function(){return Lr(ex(this))},e.prototype.asSetter=function(){var t=this;return new Vm(function(n){return t.modify(n)})},e.prototype.asFold=function(){var t=this;return new mp(function(n){return function(r){return function(i){var o=t.getOption(i);return Ke(o)?n.empty:r(o.value)}}})},e.prototype.compose=function(t){return Gp(tx(t)(this))},e.prototype.composePrism=function(t){return this.compose(t)},e.prototype.composeOptional=function(t){return yi(pe(this,Xw,Qc(t)))},e.prototype.composeTraversal=function(t){return Lr(pe(this,ex,ga(t)))},e.prototype.composeFold=function(t){return this.asFold().compose(t)},e.prototype.composeSetter=function(t){return this.asSetter().compose(t)},e.prototype.composeIso=function(t){return Gp(pe(this,tx(pe(t,Gw))))},e.prototype.composeLens=function(t){return yi(k$e(t)(this))},e.prototype.composeGetter=function(t){return this.asFold().compose(t.asFold())},e}(),RQ=new EQ(z,Ct),F$e=function(){function e(t,n){this.getOption=t,this.set=n,this._tag="Optional"}return e.fromPath=function(){var t=e.fromNullableProp();return function(n){var r=t(n[0]);return n.slice(1).reduce(function(i,o){return i.compose(t(o))},r)}},e.fromNullableProp=function(){return function(t){return new e(function(n){return Wu(n[t])},function(n){return function(r){return r[t]==null?r:TQ(r,t,n)}})}},e.fromOptionProp=function(){var t=TM.fromProp();return function(n){return t(n).composePrism(RQ)}},e.prototype.modify=function(t){return R$e(t)(this)},e.prototype.modifyOption=function(t){return E$e(t)(this)},e.prototype.asTraversal=function(){return Lr(JL(this))},e.prototype.asFold=function(){var t=this;return new mp(function(n){return function(r){return function(i){var o=t.getOption(i);return Ke(o)?n.empty:r(o.value)}}})},e.prototype.asSetter=function(){var t=this;return new Vm(function(n){return t.modify(n)})},e.prototype.compose=function(t){return yi(Qc(t)(this))},e.prototype.composeOptional=function(t){return this.compose(t)},e.prototype.composeTraversal=function(t){return Lr(pe(this,JL,ga(t)))},e.prototype.composeFold=function(t){return this.asFold().compose(t)},e.prototype.composeSetter=function(t){return this.asSetter().compose(t)},e.prototype.composeLens=function(t){return yi(pe(this,Qc(pe(t,Ds))))},e.prototype.composePrism=function(t){return yi(pe(this,Qc(pe(t,Xw))))},e.prototype.composeIso=function(t){return yi(pe(this,Qc(pe(t,Jw))))},e.prototype.composeGetter=function(t){return this.asFold().compose(t.asFold())},e}(),L$e=function(){function e(t){this.modifyF=t,this._tag="Traversal"}return e.prototype.modify=function(t){return _Q(t)(this)},e.prototype.set=function(t){return O$e(t)(this)},e.prototype.filter=function(t){return Lr(M$e(t)(this))},e.prototype.asFold=function(){var t=this;return new mp(function(n){return function(r){return t.modifyF(Z6(n))(function(i){return Cf(r(i))})}})},e.prototype.asSetter=function(){var t=this;return new Vm(function(n){return t.modify(n)})},e.prototype.compose=function(t){return Lr(ga(t)(this))},e.prototype.composeTraversal=function(t){return this.compose(t)},e.prototype.composeFold=function(t){return this.asFold().compose(t)},e.prototype.composeSetter=function(t){return this.asSetter().compose(t)},e.prototype.composeOptional=function(t){return this.compose(t.asTraversal())},e.prototype.composeLens=function(t){return Lr(pe(this,ga(pe(t,Id))))},e.prototype.composePrism=function(t){return Lr(pe(this,ga(pe(t,ex))))},e.prototype.composeIso=function(t){return Lr(pe(this,ga(pe(t,Zw))))},e.prototype.composeGetter=function(t){return this.asFold().compose(t.asFold())},e}(),$Q=function(){function e(t){this.get=t,this._tag="Getter"}return e.prototype.asFold=function(){var t=this;return new mp(function(){return function(n){return function(r){return n(t.get(r))}}})},e.prototype.compose=function(t){var n=this;return new e(function(r){return t.get(n.get(r))})},e.prototype.composeGetter=function(t){return this.compose(t)},e.prototype.composeFold=function(t){return this.asFold().compose(t)},e.prototype.composeLens=function(t){return this.compose(t.asGetter())},e.prototype.composeIso=function(t){return this.compose(t.asGetter())},e.prototype.composeTraversal=function(t){return this.asFold().compose(t.asFold())},e.prototype.composeOptional=function(t){return this.asFold().compose(t.asFold())},e.prototype.composePrism=function(t){return this.asFold().compose(t.asFold())},e}(),mp=function(){function e(t){this.foldMap=t,this._tag="Fold",this.getAll=t(PI())(nc),this.exist=t(TK),this.all=t(_K),this.foldMapFirst=t(G6())}return e.prototype.compose=function(t){var n=this;return new e(function(r){return function(i){return n.foldMap(r)(t.foldMap(r)(i))}})},e.prototype.composeFold=function(t){return this.compose(t)},e.prototype.composeGetter=function(t){return this.compose(t.asFold())},e.prototype.composeTraversal=function(t){return this.compose(t.asFold())},e.prototype.composeOptional=function(t){return this.compose(t.asFold())},e.prototype.composeLens=function(t){return this.compose(t.asFold())},e.prototype.composePrism=function(t){return this.compose(t.asFold())},e.prototype.composeIso=function(t){return this.compose(t.asFold())},e.prototype.find=function(t){return this.foldMapFirst(I0(t))},e.prototype.headOption=function(t){return this.find(function(){return!0})(t)},e}(),Vm=function(){function e(t){this.modify=t,this._tag="Setter"}return e.prototype.set=function(t){return this.modify(wr(t))},e.prototype.compose=function(t){var n=this;return new e(function(r){return n.modify(t.modify(r))})},e.prototype.composeSetter=function(t){return this.compose(t)},e.prototype.composeTraversal=function(t){return this.compose(t.asSetter())},e.prototype.composeOptional=function(t){return this.compose(t.asSetter())},e.prototype.composeLens=function(t){return this.compose(t.asSetter())},e.prototype.composePrism=function(t){return this.compose(t.asSetter())},e.prototype.composeIso=function(t){return this.compose(t.asSetter())},e}(),B$e=new IQ(md,md);function D$e(){return B$e}function j$e(e,t){t===void 0&&(t="fromNewtype("+e.name+")");var n=D$e();return new xe(t,function(r){return e.is(r)},function(r,i){return pe(e.validate(r,i),zu(n.wrap))},function(r){return e.encode(n.unwrap(r))})}var U$e=xh({_tag:Wm("None")}),P$e=Wm("Some");function kQ(e,t){return t===void 0&&(t="Option<"+e.name+">"),Km([U$e,xh({_tag:P$e,value:e},"Some<"+e.name+">")],t)}function N$e(e,t){return t===void 0&&(t="Option<"+e.name+">"),new xe(t,kQ(e).is,function(n,r){return n==null?ke(rt):pe(e.validate(n,r),zu(Ct))},function(n){return cE(pe(n,Ko(e.encode)))})}var W$e=new xe("DateFromISOString",function(e){return e instanceof Date},function(e,t){return pe(ho.validate(e,t),$i(function(n){var r=new Date(n);return isNaN(r.getTime())?Xe(e,t):ke(r)}))},function(e){return e.toISOString()});function K$e(e,t){return t===void 0&&(t="ReadonlyNonEmptyArray<"+e.name+">"),uQ(e,t)}function OQ(e){var t=Object.create(Object.getPrototypeOf(e));return Object.assign(t,e),t}var q$e=new xe("DateFromNumber",function(e){return e instanceof Date},function(e,t){return pe(_l.validate(e,t),$i(function(n){var r=new Date(n);return isNaN(r.getTime())?Xe(e,t):ke(r)}))},function(e){return e.getTime()});function M1(e,t,n){n===void 0&&(n=e.name);var r=OQ(e);return r.validate=t,r.decode=function(i){return t(i,rQ(r))},r.name=n,r}function V$e(e,t,n){return n===void 0&&(n="withFallback("+e.name+")"),M1(e,function(r,i){return EW(function(){return ke(t)})(e.validate(r,i))},n)}var z$e=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,Q$e=I1(ho,function(e){return z$e.test(e)},"UUID");function H$e(e,t,n){return n===void 0&&(n="fromNullable("+e.name+")"),M1(e,function(r,i){return r==null?ke(t):e.validate(r,i)},n)}var Y$e=new xe("BooleanFromString",T1.is,function(e,t){return pe(ho.validate(e,t),$i(function(n){return n==="true"?ke(!0):n==="false"?ke(!1):Xe(e,t)}))},String);function G$e(e,t){return M1(e,function(n,r){return BA(function(){return[{value:n,context:r,message:t(n,r),actual:n}]})(e.validate(n,r))})}function MQ(e){switch(e._tag){case"InterfaceType":return e.props;case"ExactType":return MQ(e.type)}}var J$e=TM.fromProp();function Z$e(e){var t={};for(var n in MQ(e))t[n]=J$e(n);return t}var X$e=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},eke=yM("RegExp",X$e),tke=new xe("DateFromUnixTime",function(e){return e instanceof Date},function(e,t){return pe(xv.validate(e,t),$i(function(n){var r=new Date(n*1e3);return isNaN(r.getTime())?Xe(e,t):ke(r)}))},function(e){return Math.floor(e.getTime()/1e3)}),nx=new xe("NumberFromString",_l.is,function(e,t){return pe(ho.validate(e,t),$i(function(n){var r=+n;return isNaN(r)||n.trim()===""?Xe(e,t):ke(r)}))},String),nke=new xe("IntFromString",xv.is,function(e,t){return pe(nx.validate(e,t),$i(function(n){return xv.is(n)?ke(n):Xe(e,t)}))},nx.encode),FQ=hM("JsonArray",function(){return Xz(F1)}),LQ=hM("JsonRecord",function(){return mM(ho,F1)}),F1=Km([T1,_l,ho,Qw,FQ,LQ],"Json"),rke=new xe("JsonFromString",F1.is,function(e,t){try{return ke(JSON.parse(e))}catch{return Xe(e,t)}},function(e){return JSON.stringify(e)}),ike=Wm("Left"),oke=Wm("Right");function ake(e,t,n){return n===void 0&&(n="Either<"+e.name+", "+t.name+">"),Km([xh({_tag:ike,left:e},"Left<"+e.name+">"),xh({_tag:oke,right:t},"Right<"+e.name+">")],n)}var ske=new xe("BigIntFromString",function(e){return typeof e=="bigint"},function(e,t){return pe(ho.validate(e,t),$i(function(n){if(!cQ.is(n.trim()))return Xe(e,t);try{return ke(BigInt(n))}catch{return Xe(e,t)}}))},String);function cke(e,t,n){return n===void 0&&(n=e.name),new xe(n,e.is,e.validate,t)}var uke=new xe("BooleanFromNumber",T1.is,function(e,t){return pe(_l.validate(e,t),zu(function(n){return n!==0}))},Number);const lke=Object.freeze(Object.defineProperty({__proto__:null,BigIntFromString:ske,BooleanFromNumber:uke,BooleanFromString:Y$e,DateFromISOString:W$e,DateFromNumber:q$e,DateFromUnixTime:tke,IntFromString:nke,Json:F1,JsonArray:FQ,JsonFromString:rke,JsonRecord:LQ,NonEmptyString:cQ,NumberFromString:nx,UUID:Q$e,clone:OQ,date:CRe,either:ake,fromNewtype:j$e,fromNullable:H$e,fromRefinement:yM,getLenses:Z$e,mapOutput:sQ,nonEmptyArray:uQ,option:kQ,optionFromNullable:N$e,readonlyNonEmptyArray:K$e,readonlySetFromArray:bRe,regexp:eke,setFromArray:lQ,withEncode:cke,withFallback:V$e,withMessage:G$e,withValidate:M1},Symbol.toStringTag,{value:"Module"})),L1=Mu(lke),dke=Mu(yRe);Object.defineProperty(Je,"__esModule",{value:!0});Je.withCustomError=Je.addType=Je.isEmpty=Je.objectToMap=Je.grouped=Je.formatDate=Je.formatDateTime=Je.filterDouble=Je.refineType=Je.nullable=void 0;const fke=Q,BQ=tt,pke=Ao,ud=(0,fke.__importStar)(X),hke=L1,Ake=dke;function mke(e){return ud.union([e,ud.null,ud.undefined])}Je.nullable=mke;function gke(e,t,n){return new ud.Type(t,e.is,(r,i)=>(0,pke.pipe)(e.validate(r,i),BQ.either.chain(o=>n(o)?ud.success(o):ud.failure(r,i))),e.encode)}Je.refineType=gke;function vke(e){if(e==="")return null;const t=Number(e);return Number.isNaN(t)?null:t}Je.filterDouble=vke;function yke(e){return e.toISOString().replace(/\.\d{3}Z$/,"+0000")}Je.formatDateTime=yke;function bke(e){return e.toISOString().replace(/T.*/,"")}Je.formatDate=bke;function Ske(e,t){return e.reduce((n,r,i)=>(i%t===0?n.push([r]):n[Math.floor(i/t)].push(r),n),new Array)}Je.grouped=Ske;function Cke(e){return new Map(Object.entries(e))}Je.objectToMap=Cke;function wke(e){for(const t in e)return!1;return!0}Je.isEmpty=wke;function xke(e,t){return(0,Ake.mapOutput)(e,n=>({...n,__TYPE__:t}))}Je.addType=xke;function _ke(e,t){return(0,hke.withValidate)(e,(n,r)=>BQ.either.mapLeft(i=>i.find(o=>o.message)?i:[{value:n,context:r,message:t(n,r),actual:n}])(e.validate(n,r)))}Je.withCustomError=_ke;Object.defineProperty(k1,"__esModule",{value:!0});k1.WidgetKey=void 0;const Tke=Q,Ike=(0,Tke.__importStar)(X),Eke=Je,Rke=new RegExp("^[^<>]+$");k1.WidgetKey=(0,Eke.refineType)(Ike.string,"WidgetKey",e=>e.length===0||Rke.test(e));(function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=Q;(0,t.__exportStar)(R1,e),(0,t.__exportStar)($1,e),(0,t.__exportStar)(k1,e)})(Tl);var de={},DQ={},gp={},B1={},D1={};Object.defineProperty(D1,"__esModule",{value:!0});D1.clone=void 0;function $ke(e){var t=Object.create(Object.getPrototypeOf(e));return Object.assign(t,e),t}D1.clone=$ke;var kke=me&&me.__createBinding||(Object.create?function(e,t,n,r){r===void 0&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}),Oke=me&&me.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Mke=me&&me.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)Object.hasOwnProperty.call(e,n)&&kke(t,e,n);return Oke(t,e),t};Object.defineProperty(B1,"__esModule",{value:!0});B1.withValidate=void 0;var Fke=Mke(X),Lke=D1;function Bke(e,t,n){n===void 0&&(n=e.name);var r=Lke.clone(e);return r.validate=t,r.decode=function(i){return t(i,Fke.getDefaultContext(r))},r.name=n,r}B1.withValidate=Bke;var Dke=me&&me.__createBinding||(Object.create?function(e,t,n,r){r===void 0&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}),jke=me&&me.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Uke=me&&me.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)Object.hasOwnProperty.call(e,n)&&Dke(t,e,n);return jke(t,e),t};Object.defineProperty(gp,"__esModule",{value:!0});gp.withFallback=void 0;var Pke=Uke(X),Nke=B1,Wke=Zt;function Kke(e,t,n){return n===void 0&&(n="withFallback("+e.name+")"),Nke.withValidate(e,function(r,i){return Wke.orElse(function(){return Pke.success(t)})(e.validate(r,i))},n)}gp.withFallback=Kke;var GS={},nn={};Object.defineProperty(nn,"__esModule",{value:!0});nn.EmptyArray=nn.EmptyObject=nn.Boolean=nn.NumberOrNull=nn.Number=nn.StringOrNull=nn.String=void 0;const qke=Q,Vke=tt,zke=Ve,Wt=(0,qke.__importStar)(X),zm=Je;nn.String=(0,zm.withCustomError)(Wt.string,()=>"The value must be a string");nn.StringOrNull=(0,zm.withCustomError)(Wt.union([Wt.string,Wt.null]),()=>"The value must be a string or null");nn.Number=(0,zm.withCustomError)(Wt.number,()=>"The value must be a number");nn.NumberOrNull=(0,zm.withCustomError)(Wt.union([Wt.number,Wt.null]),()=>"The value must be a number or null");nn.Boolean=(0,zm.withCustomError)(Wt.boolean,()=>"The value must be a boolean");nn.EmptyObject=Wt.UnknownRecord.pipe(new Wt.Type("emptyObject",e=>Wt.UnknownRecord.is(e),(e,t)=>Object.keys(e).length>0?Wt.failure(e,t,"The object is not empty."):Wt.success({}),Wt.identity));nn.EmptyArray=new Wt.Type("emptyArray",e=>Wt.UnknownArray.is(e)&&e.length===0,(e,t)=>(0,zke.pipe)(Wt.UnknownArray.decode(e),Vke.either.chain(n=>n.length>0?Wt.failure(e,t,"The array is not empty."):Wt.success(new Array))),()=>[]);var mg={};const cs=Mu(BW);var XL;function Qke(){if(XL)return mg;XL=1,Object.defineProperty(mg,"__esModule",{value:!0});const e=Q,t=cs,n=Ao,r=(0,e.__importStar)(X),i=it();return mg.default=new r.Type("dateFromString",o=>o instanceof Date,(o,a)=>(0,n.pipe)(i.String.validate(o,a),(0,t.chain)(s=>{const c=new Date(s);return isNaN(c.getTime())?r.failure(o,a):r.success(c)})),o=>o.toISOString()),mg}var IM={};Object.defineProperty(IM,"__esModule",{value:!0});const Hke=Q,Yke=cs,Gke=Ao,Wl=(0,Hke.__importStar)(X);IM.default=new Wl.Type("dateFromStringOrNumber",e=>e instanceof Date,(e,t)=>(0,Gke.pipe)(Wl.union([Wl.number,Wl.string]).validate(e,t),(0,Yke.chain)(n=>{const r=new Date(n);return isNaN(r.getTime())?Wl.failure(e,t):Wl.success(r)})),e=>e);var EM={};Object.defineProperty(EM,"__esModule",{value:!0});const Jke=Q,Zke=cs,Xke=Ao,gg=(0,Jke.__importStar)(X);EM.default=new gg.Type("dateFromTsMs",e=>e instanceof Date,(e,t)=>(0,Xke.pipe)(gg.number.validate(e,t),(0,Zke.chain)(n=>{const r=new Date(n);return isNaN(r.getTime())?gg.failure(e,t):gg.success(r)})),e=>e.getTime());var jQ={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.EmptyArrayOrElse=e.EmptyObjectOrElse=e.NullOrElse=e.DefaultOrElse=void 0;const t=Q,n=Zt,r=(0,t.__importStar)(X),i=nn,o=u=>l=>new r.Type(`DefaultOrElse<${u.name}, ${l.name}>`,d=>d===null||l.is(d),(d,p)=>(0,n.isRight)(u.validate(d,p))?r.success(null):l.validate(d,p),d=>d?l.encode(d):void 0);e.DefaultOrElse=o;const a=u=>(0,e.DefaultOrElse)(r.null)(u);e.NullOrElse=a;const s=u=>(0,e.DefaultOrElse)(i.EmptyObject)(u);e.EmptyObjectOrElse=s;const c=u=>(0,e.DefaultOrElse)(i.EmptyArray)(u);e.EmptyArrayOrElse=c})(jQ);var RM={};Object.defineProperty(RM,"__esModule",{value:!0});const eOe=Q,tOe=cs,nOe=Ao,Lc=(0,eOe.__importStar)(X);RM.default=new Lc.Type("IntFromNumber",Lc.Int.is,(e,t)=>(0,nOe.pipe)(Lc.number.validate(e,t),(0,tOe.chain)(n=>Lc.Int.is(n)?Lc.success(n):Lc.success(Math.round(n)))),Lc.Int.encode);var $M={};Object.defineProperty($M,"__esModule",{value:!0});const rOe=Q,iOe=cs,oOe=Ao,Kl=(0,rOe.__importStar)(X),aOe=/^([0-9]+)px$/;$M.default=new Kl.Type("IntFromPixels",Kl.Int.is,(e,t)=>(0,oOe.pipe)(Kl.string.validate(e,t),(0,iOe.chain)(n=>{try{const r=n.match(aOe);if(!r)return Kl.failure(e,t);const i=parseInt(r[1]);return Kl.success(i)}catch{return Kl.failure(e,t)}})),String);var kM={};Object.defineProperty(kM,"__esModule",{value:!0});const sOe=Q,cOe=(0,sOe.__importStar)(X),e2=Je;kM.default=(0,e2.withCustomError)((0,e2.refineType)(cOe.string,"nonEmptyString",e=>e.trim().length>0),()=>"The value must be a non-empty string");var OM={},j1={};Object.defineProperty(j1,"__esModule",{value:!0});const uOe=Q,lOe=(0,uOe.__importStar)(X),dOe=Je;j1.default=(0,dOe.nullable)(lOe.string);Object.defineProperty(OM,"__esModule",{value:!0});const fOe=Q,pOe=cs,hOe=Ao,JS=X,AOe=(0,fOe.__importDefault)(j1);OM.default=new JS.Type("nonEmptyStringOrNull",e=>typeof e=="string"||e===null,(e,t)=>(0,hOe.pipe)(AOe.default.validate(e,t),(0,pOe.chain)(n=>typeof n=="string"&&n.length>0?(0,JS.success)(n):(0,JS.success)(null))),e=>e);var MM={};Object.defineProperty(MM,"__esModule",{value:!0});const mOe=Q,gOe=(0,mOe.__importStar)(X),vOe=Je;MM.default=(0,vOe.nullable)(gOe.number);var FM={};Object.defineProperty(FM,"__esModule",{value:!0});const yOe=Q,vg=(0,yOe.__importStar)(X),t2=nn;FM.default=(e,t,n)=>t2.Number.pipe(new vg.Type("numberInRange",r=>t2.Number.is(r),(r,i)=>r>t||r<e?vg.failure(r,i,`${n} must be a number between ${e} and ${t}`):vg.success(r),vg.identity));var LM={};Object.defineProperty(LM,"__esModule",{value:!0});const bOe=Q,SOe=cs,COe=Ao,yg=(0,bOe.__importStar)(X);LM.default=new yg.Type("StringFromInt",yg.string.is,(e,t)=>(0,COe.pipe)(yg.boolean.validate(e,t),(0,SOe.chain)(n=>yg.success(n.toString()))),e=>e);var BM={};Object.defineProperty(BM,"__esModule",{value:!0});const wOe=Q,xOe=cs,_Oe=Ao,bg=(0,wOe.__importStar)(X);BM.default=new bg.Type("StringFromInt",bg.string.is,(e,t)=>(0,_Oe.pipe)(bg.number.validate(e,t),(0,xOe.chain)(n=>bg.success(n.toString()))),e=>e);var n2;function it(){return n2||(n2=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.StringOrNull=e.StringFromNumber=e.StringFromBoolean=e.NumberRange=e.NumberOrNull=e.NonEmptyStringOrNull=e.NonEmptyString=e.IntFromPixels=e.IntFromNumber=e.Function=e.DateFromTsMs=e.DateFromStringOrNumber=e.DateFromString=void 0;const t=Q;(0,t.__exportStar)(nn,e);var n=Qke();Object.defineProperty(e,"DateFromString",{enumerable:!0,get:function(){return(0,t.__importDefault)(n).default}});var r=IM;Object.defineProperty(e,"DateFromStringOrNumber",{enumerable:!0,get:function(){return(0,t.__importDefault)(r).default}});var i=EM;Object.defineProperty(e,"DateFromTsMs",{enumerable:!0,get:function(){return(0,t.__importDefault)(i).default}}),(0,t.__exportStar)(jQ,e),e.Function=(0,t.__importStar)(Je);var o=RM;Object.defineProperty(e,"IntFromNumber",{enumerable:!0,get:function(){return(0,t.__importDefault)(o).default}});var a=$M;Object.defineProperty(e,"IntFromPixels",{enumerable:!0,get:function(){return(0,t.__importDefault)(a).default}});var s=kM;Object.defineProperty(e,"NonEmptyString",{enumerable:!0,get:function(){return(0,t.__importDefault)(s).default}});var c=OM;Object.defineProperty(e,"NonEmptyStringOrNull",{enumerable:!0,get:function(){return(0,t.__importDefault)(c).default}});var u=MM;Object.defineProperty(e,"NumberOrNull",{enumerable:!0,get:function(){return(0,t.__importDefault)(u).default}});var l=FM;Object.defineProperty(e,"NumberRange",{enumerable:!0,get:function(){return(0,t.__importDefault)(l).default}});var d=LM;Object.defineProperty(e,"StringFromBoolean",{enumerable:!0,get:function(){return(0,t.__importDefault)(d).default}});var p=BM;Object.defineProperty(e,"StringFromNumber",{enumerable:!0,get:function(){return(0,t.__importDefault)(p).default}});var h=j1;Object.defineProperty(e,"StringOrNull",{enumerable:!0,get:function(){return(0,t.__importDefault)(h).default}})}(GS)),GS}var Wi={},Br={},vp={},us={},DM={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.BooleanField=e.BooleanConfig=e.BooleanFieldType=void 0;const n=(0,Q.__importStar)(X),r=it();e.BooleanFieldType="Boolean",e.BooleanConfig=n.exact(n.partial({label:r.StringOrNull,default_value:n.boolean,placeholder_true:n.string,placeholder_false:n.string})),e.BooleanField=n.exact(n.intersection([n.type({type:n.literal(e.BooleanFieldType)}),n.partial({config:e.BooleanConfig})]))})(DM);var jM={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Color=e.ColorConfig=e.ColorFieldType=void 0;const n=(0,Q.__importStar)(X),r=it();e.ColorFieldType="Color",e.ColorConfig=n.exact(n.partial({label:r.StringOrNull,placeholder:n.string})),e.Color=n.exact(n.intersection([n.type({type:n.literal(e.ColorFieldType)}),n.partial({fieldset:r.StringOrNull,config:e.ColorConfig})]))})(jM);var UM={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Date=e.DateConfig=e.DateFieldType=void 0;const n=(0,Q.__importStar)(X),r=it();e.DateFieldType="Date",e.DateConfig=n.exact(n.partial({label:r.StringOrNull,placeholder:n.string,default:n.string})),e.Date=n.exact(n.intersection([n.type({type:n.literal(e.DateFieldType)}),n.partial({fieldset:r.StringOrNull,config:e.DateConfig})]))})(UM);var PM={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Embed=e.EmbedConfig=e.EmbedFieldType=void 0;const n=(0,Q.__importStar)(X),r=it();e.EmbedFieldType="Embed",e.EmbedConfig=n.exact(n.partial({label:r.StringOrNull,placeholder:n.string,useAsTitle:n.boolean})),e.Embed=n.exact(n.intersection([n.type({type:n.literal(e.EmbedFieldType)}),n.partial({fieldset:r.StringOrNull,config:e.EmbedConfig})]))})(PM);var NM={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.GeoPoint=e.GeoPointConfig=e.GeoPointFieldType=void 0;const n=(0,Q.__importStar)(X),r=it();e.GeoPointFieldType="GeoPoint",e.GeoPointConfig=n.exact(n.partial({label:r.StringOrNull})),e.GeoPoint=n.exact(n.intersection([n.type({type:n.literal(e.GeoPointFieldType)}),n.partial({fieldset:r.StringOrNull,config:e.GeoPointConfig})]))})(NM);var WM={},Qm={},U1={},yp={},vu={};Object.defineProperty(vu,"__esModule",{value:!0});vu.pipe=vu.pipeable=void 0;var rx=Ve,TOe=function(e){return typeof e.map=="function"},IOe=function(e){return typeof e.contramap=="function"},EOe=function(e){return typeof e.mapWithIndex=="function"},ROe=function(e){return typeof e.ap=="function"},$Oe=function(e){return typeof e.chain=="function"},kOe=function(e){return typeof e.bimap=="function"},OOe=function(e){return typeof e.extend=="function"},MOe=function(e){return typeof e.reduce=="function"},FOe=function(e){return typeof e.reduceWithIndex=="function"},LOe=function(e){return typeof e.alt=="function"},BOe=function(e){return typeof e.compact=="function"},DOe=function(e){return typeof e.filter=="function"},jOe=function(e){return typeof e.filterWithIndex=="function"},UOe=function(e){return typeof e.promap=="function"},POe=function(e){return typeof e.compose=="function"},NOe=function(e){return typeof e.throwError=="function"};function WOe(e){var t={};if(TOe(e)){var n=function(F){return function(M){return e.map(M,F)}};t.map=n}if(IOe(e)){var r=function(F){return function(M){return e.contramap(M,F)}};t.contramap=r}if(EOe(e)){var i=function(F){return function(M){return e.mapWithIndex(M,F)}};t.mapWithIndex=i}if(ROe(e)){var o=function(F){return function(M){return e.ap(M,F)}},a=function(F){return function(M){return e.ap(e.map(M,function(N){return function(){return N}}),F)}};t.ap=o,t.apFirst=a,t.apSecond=function(F){return function(M){return e.ap(e.map(M,function(){return function(N){return N}}),F)}}}if($Oe(e)){var s=function(F){return function(M){return e.chain(M,F)}},c=function(F){return function(M){return e.chain(M,function(N){return e.map(F(N),function(){return N})})}},u=function(F){return e.chain(F,rx.identity)};t.chain=s,t.chainFirst=c,t.flatten=u}if(kOe(e)){var l=function(F,M){return function(N){return e.bimap(N,F,M)}},d=function(F){return function(M){return e.mapLeft(M,F)}};t.bimap=l,t.mapLeft=d}if(OOe(e)){var p=function(F){return function(M){return e.extend(M,F)}},h=function(F){return e.extend(F,rx.identity)};t.extend=p,t.duplicate=h}if(MOe(e)){var A=function(F,M){return function(N){return e.reduce(N,F,M)}},g=function(F){var M=e.foldMap(F);return function(N){return function(se){return M(se,N)}}},v=function(F,M){return function(N){return e.reduceRight(N,F,M)}};t.reduce=A,t.foldMap=g,t.reduceRight=v}if(FOe(e)){var b=function(F,M){return function(N){return e.reduceWithIndex(N,F,M)}},w=function(F){var M=e.foldMapWithIndex(F);return function(N){return function(se){return M(se,N)}}},S=function(F,M){return function(N){return e.reduceRightWithIndex(N,F,M)}};t.reduceWithIndex=b,t.foldMapWithIndex=w,t.reduceRightWithIndex=S}if(LOe(e)){var y=function(F){return function(M){return e.alt(M,F)}};t.alt=y}if(BOe(e)&&(t.compact=e.compact,t.separate=e.separate),DOe(e)){var C=function(F){return function(M){return e.filter(M,F)}},x=function(F){return function(M){return e.filterMap(M,F)}},T=function(F){return function(M){return e.partition(M,F)}},I=function(F){return function(M){return e.partitionMap(M,F)}};t.filter=C,t.filterMap=x,t.partition=T,t.partitionMap=I}if(jOe(e)){var R=function(F){return function(M){return e.filterWithIndex(M,F)}},O=function(F){return function(M){return e.filterMapWithIndex(M,F)}},k=function(F){return function(M){return e.partitionWithIndex(M,F)}},P=function(F){return function(M){return e.partitionMapWithIndex(M,F)}};t.filterWithIndex=R,t.filterMapWithIndex=O,t.partitionWithIndex=k,t.partitionMapWithIndex=P}if(UOe(e)){var q=function(F,M){return function(N){return e.promap(N,F,M)}};t.promap=q}if(POe(e)){var Y=function(F){return function(M){return e.compose(M,F)}};t.compose=Y}if(NOe(e)){var te=function(F){return function(M){return M._tag==="None"?e.throwError(F()):e.of(M.value)}},G=function(F){return F._tag==="Left"?e.throwError(F.left):e.of(F.right)},ee=function(F,M){return function(N){return F(N)?e.of(N):e.throwError(M(N))}},ne=function(F,M){return function(N){return e.chain(N,function(se){return F(se)?e.of(se):e.throwError(M(se))})}};t.fromOption=te,t.fromEither=G,t.fromPredicate=ee,t.filterOrElse=ne}return t}vu.pipeable=WOe;vu.pipe=rx.pipe;var KOe=me&&me.__createBinding||(Object.create?function(e,t,n,r){r===void 0&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}),qOe=me&&me.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),VOe=me&&me.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)Object.hasOwnProperty.call(e,n)&&KOe(t,e,n);return qOe(t,e),t};Object.defineProperty(yp,"__esModule",{value:!0});yp.NumberFromString=void 0;var _p=VOe(X),zOe=vu,QOe=Zt;yp.NumberFromString=new _p.Type("NumberFromString",_p.number.is,function(e,t){return zOe.pipe(_p.string.validate(e,t),QOe.chain(function(n){var r=+n;return isNaN(r)||n.trim()===""?_p.failure(e,t):_p.success(r)}))},String);var HOe=me&&me.__createBinding||(Object.create?function(e,t,n,r){r===void 0&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}),YOe=me&&me.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),GOe=me&&me.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)Object.hasOwnProperty.call(e,n)&&HOe(t,e,n);return YOe(t,e),t};Object.defineProperty(U1,"__esModule",{value:!0});U1.IntFromString=void 0;var Tp=GOe(X),r2=yp,JOe=vu,ZOe=Zt;U1.IntFromString=new Tp.Type("IntFromString",Tp.Int.is,function(e,t){return JOe.pipe(r2.NumberFromString.validate(e,t),ZOe.chain(function(n){return Tp.Int.is(n)?Tp.success(n):Tp.failure(e,t)}))},r2.NumberFromString.encode);Object.defineProperty(Qm,"__esModule",{value:!0});const XOe=Q,eMe=Zt,da=(0,XOe.__importStar)(X),tMe=U1,i2=it(),o2=new da.Type("SideConstraints",e=>!e||typeof e=="number",(e,t)=>eMe.either.chain(da.union([da.literal("auto"),da.literal(""),da.Int,tMe.IntFromString,i2.IntFromNumber,i2.IntFromPixels,da.null]).validate(e,t),n=>n==="auto"||n===""?da.success(null):da.success(n)),e=>e),nMe=da.partial({width:o2,height:o2});Qm.default=nMe;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Image=e.ImageConfig=e.Thumbnail=e.ImageFieldType=void 0;const t=Q,n=(0,t.__importStar)(X),r=it(),i=(0,t.__importDefault)(Qm);e.ImageFieldType="Image",e.Thumbnail=n.exact(n.intersection([n.type({name:n.string}),i.default])),e.ImageConfig=n.exact(n.partial({label:r.StringOrNull,placeholder:n.string,constraint:i.default,thumbnails:n.readonlyArray(e.Thumbnail)})),e.Image=n.exact(n.intersection([n.type({type:n.literal(e.ImageFieldType)}),n.partial({fieldset:r.StringOrNull,config:e.ImageConfig})]))})(WM);var KM={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.IntegrationField=e.IntegrationFieldConfig=e.IntegrationFieldType=void 0;const n=(0,Q.__importStar)(X),r=it();e.IntegrationFieldType="IntegrationFields",e.IntegrationFieldConfig=n.exact(n.partial({label:r.StringOrNull,placeholder:n.string,catalog:n.string})),e.IntegrationField=n.exact(n.intersection([n.type({type:n.literal(e.IntegrationFieldType)}),n.partial({fieldset:r.StringOrNull,config:e.IntegrationFieldConfig})]))})(KM);var qM={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Link=e.LinkConfig=e.LinkFieldType=void 0;const t=Q,n=Zt,r=(0,t.__importStar)(X),i=gp,o=it(),a=u=>{if(u instanceof Array&&u.reduce((d,p)=>d&&typeof p=="string",!0))return r.success(u)},s=u=>{if(typeof u=="string")return r.success([u])},c=new r.Type("MasksArrayString",u=>u instanceof Array,(u,l)=>n.either.chain(r.union([r.array(r.string),r.string]).validate(u,l),d=>a(d)||s(d)||r.failure(u,l)),u=>u);e.LinkFieldType="Link",e.LinkConfig=r.exact(r.partial({label:o.StringOrNull,useAsTitle:r.boolean,placeholder:r.string,select:(0,i.withFallback)(r.union([r.literal("media"),r.literal("document"),r.literal("web"),r.null]),null),customtypes:r.readonlyArray(r.string),masks:c,tags:c,allowTargetBlank:r.boolean,allowText:r.boolean,repeat:r.boolean,variants:r.array(r.string)})),e.Link=r.exact(r.intersection([r.type({type:r.literal(e.LinkFieldType)}),r.partial({fieldset:o.StringOrNull,config:e.LinkConfig})]))})(qM);var VM={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Number=e.NumberConfig=e.NumberFieldType=void 0;const n=(0,Q.__importStar)(X),r=yp,i=it();e.NumberFieldType="Number",e.NumberConfig=n.exact(n.partial({label:i.StringOrNull,placeholder:n.string,min:n.union([n.number,r.NumberFromString]),max:n.union([n.number,r.NumberFromString]),step:n.union([n.number,r.NumberFromString])})),e.Number=n.exact(n.intersection([n.type({type:n.literal(e.NumberFieldType)}),n.partial({fieldset:i.StringOrNull,config:e.NumberConfig})]))})(VM);var zM={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Range=e.RangeConfig=e.RangeFieldType=void 0;const n=(0,Q.__importStar)(X),r=yp,i=it();e.RangeFieldType="Range",e.RangeConfig=n.exact(n.partial({label:i.StringOrNull,placeholder:n.string,min:n.union([n.number,r.NumberFromString]),max:n.union([n.number,r.NumberFromString]),step:n.union([n.number,r.NumberFromString])})),e.Range=n.exact(n.intersection([n.type({type:n.literal(e.RangeFieldType)}),n.partial({fieldset:i.StringOrNull,config:e.RangeConfig})]))})(zM);var P1={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.RichText=e.RichTextConfig=e.RichTextNodeTypeCodec=e.RichTextNodeType=e.DEFAULT_OPTION=e.RichTextFieldType=void 0;const t=Q,n=tt,r=Zt,i=Ve,o=(0,t.__importStar)(X),a=it(),s=(0,t.__importDefault)(Qm);e.RichTextFieldType="StructuredText",e.DEFAULT_OPTION="paragraph",e.RichTextNodeType={heading1:"heading1",heading2:"heading2",heading3:"heading3",heading4:"heading4",heading5:"heading5",heading6:"heading6",paragraph:"paragraph",strong:"strong",em:"em",preformatted:"preformatted",hyperlink:"hyperlink",image:"image",embed:"embed",list:"list-item",orderedList:"o-list-item",rtl:"rtl"},e.RichTextNodeTypeCodec=o.keyof({[e.RichTextNodeType.heading1]:null,[e.RichTextNodeType.heading2]:null,[e.RichTextNodeType.heading3]:null,[e.RichTextNodeType.heading4]:null,[e.RichTextNodeType.heading5]:null,[e.RichTextNodeType.heading6]:null,[e.RichTextNodeType.paragraph]:null,[e.RichTextNodeType.strong]:null,[e.RichTextNodeType.em]:null,[e.RichTextNodeType.preformatted]:null,[e.RichTextNodeType.hyperlink]:null,[e.RichTextNodeType.image]:null,[e.RichTextNodeType.embed]:null,[e.RichTextNodeType.list]:null,[e.RichTextNodeType.orderedList]:null,[e.RichTextNodeType.rtl]:null});const c=new o.Type("RichTextOptions",A=>typeof A=="string",A=>(0,i.pipe)(o.union([o.string,o.null]).decode(A),n.either.map(g=>{if(!g)return e.DEFAULT_OPTION;const b=g.split(",").map(w=>w.trim()).filter(w=>(0,r.getOrElseW)(()=>{})(e.RichTextNodeTypeCodec.decode(w)));return b.length?b.join(","):e.DEFAULT_OPTION})),A=>A),u=A=>{if(!A)return o.success([])},l=A=>{if(A instanceof Object){const g=A;if(!Object.entries(g).length)return o.success([]);if(g[""])return o.success(g[""].map(b=>b.name));const v=Object.entries(g).reduce((b,[,w])=>b.concat(w.map(S=>S.name)),[]).filter(Boolean);return o.success(v)}},d=A=>{if(A instanceof Array&&A.reduce((v,b)=>v&&typeof b=="string",!0))return o.success(A)},p=A=>{if(typeof A=="string")return o.success([A])},h=new o.Type("RichTextLabels",A=>A instanceof Array,(A,g)=>{const v=o.record(o.string,o.readonlyArray(o.record(o.literal("name"),o.string))),b=o.readonlyArray(o.string);return(0,i.pipe)(o.union([v,b,o.string,o.null]).decode(A),n.either.chain(w=>u(w)||d(w)||l(w)||p(w)||o.failure(A,g)))},A=>A);e.RichTextConfig=o.exact(o.partial({label:a.StringOrNull,placeholder:o.string,useAsTitle:o.boolean,single:c,multi:c,imageConstraint:s.default,labels:h,allowTargetBlank:o.boolean})),e.RichText=o.exact(o.intersection([o.type({type:o.literal(e.RichTextFieldType)}),o.partial({fieldset:a.StringOrNull,config:e.RichTextConfig})]))})(P1);var QM={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Select=e.SelectConfig=e.SelectFieldType=void 0;const n=(0,Q.__importStar)(X),r=it();e.SelectFieldType="Select",e.SelectConfig=n.exact(n.partial({label:r.StringOrNull,placeholder:n.string,default_value:n.string,options:n.readonlyArray(n.union([n.string,r.StringFromNumber,r.StringFromBoolean]))})),e.Select=n.exact(n.intersection([n.type({type:n.literal(e.SelectFieldType)}),n.partial({fieldset:r.StringOrNull,config:e.SelectConfig})]))})(QM);var HM={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Separator=e.SeparatorConfig=e.SeparatorFieldType=void 0;const n=(0,Q.__importStar)(X),r=it();e.SeparatorFieldType="Separator",e.SeparatorConfig=n.exact(n.partial({label:r.StringOrNull})),e.Separator=n.exact(n.intersection([n.type({type:n.literal(e.SeparatorFieldType)}),n.partial({config:e.SeparatorConfig})]))})(HM);var YM={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.TableCell=e.Table=e.TableFieldType=void 0;const n=(0,Q.__importStar)(X),r=it(),i=P1;e.TableFieldType="Table";const o=n.exact(n.partial({label:r.StringOrNull}));e.Table=n.exact(n.intersection([n.type({type:n.literal(e.TableFieldType)}),n.partial({config:o})])),e.TableCell={type:"StructuredText",config:{multi:[i.RichTextNodeType.paragraph,i.RichTextNodeType.strong,i.RichTextNodeType.em,i.RichTextNodeType.hyperlink].join(",")}}})(YM);var GM={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Text=e.TextConfig=e.TextFieldType=void 0;const n=(0,Q.__importStar)(X),r=it();e.TextFieldType="Text",e.TextConfig=n.exact(n.partial({label:r.StringOrNull,useAsTitle:n.boolean,placeholder:n.string})),e.Text=n.exact(n.intersection([n.type({type:n.literal(e.TextFieldType)}),n.partial({fieldset:r.StringOrNull,config:e.TextConfig})]))})(GM);var JM={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Timestamp=e.TimestampConfig=e.TimestampFieldType=void 0;const n=(0,Q.__importStar)(X),r=it();e.TimestampFieldType="Timestamp",e.TimestampConfig=n.exact(n.partial({label:r.StringOrNull,placeholder:n.string,default:n.string})),e.Timestamp=n.exact(n.intersection([n.type({type:n.literal(e.TimestampFieldType)}),n.partial({fieldset:r.StringOrNull,config:e.TimestampConfig})]))})(JM);Object.defineProperty(us,"__esModule",{value:!0});us.NestableWidget=void 0;const rMe=Q,iMe=(0,rMe.__importStar)(X),oMe=DM,aMe=jM,sMe=UM,cMe=PM,uMe=NM,lMe=WM,dMe=KM,fMe=qM,pMe=VM,hMe=zM,AMe=P1,mMe=QM,gMe=HM,vMe=YM,yMe=GM,bMe=JM;us.NestableWidget=iMe.union([aMe.Color,oMe.BooleanField,cMe.Embed,uMe.GeoPoint,sMe.Date,pMe.Number,hMe.Range,AMe.RichText,mMe.Select,gMe.Separator,vMe.Table,yMe.Text,bMe.Timestamp,fMe.Link,lMe.Image,dMe.IntegrationField]);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Group=e.GroupConfig=e.NestedGroup=e.NestedGroupConfig=e.GroupFieldType=void 0;const n=(0,Q.__importStar)(X),r=Tl,i=it(),o=us;e.GroupFieldType="Group";const a=c=>n.exact(n.partial({label:i.StringOrNull,repeat:n.boolean,fields:n.record(r.WidgetKey,c)})),s=c=>n.exact(n.intersection([n.type({type:n.literal(e.GroupFieldType)}),n.partial({fieldset:i.StringOrNull,icon:n.string,description:n.string,config:a(c)})]));e.NestedGroupConfig=a(o.NestableWidget),e.NestedGroup=s(o.NestableWidget),e.GroupConfig=a(n.union([o.NestableWidget,e.NestedGroup])),e.Group=s(n.union([o.NestableWidget,e.NestedGroup]))})(vp);var Hm={};(function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=Q;(0,t.__exportStar)(DM,e),(0,t.__exportStar)(jM,e),(0,t.__exportStar)(UM,e),(0,t.__exportStar)(PM,e),(0,t.__exportStar)(NM,e),(0,t.__exportStar)(WM,e),(0,t.__exportStar)(KM,e),(0,t.__exportStar)(qM,e),(0,t.__exportStar)(us,e),(0,t.__exportStar)(VM,e),(0,t.__exportStar)(zM,e),(0,t.__exportStar)(P1,e),(0,t.__exportStar)(QM,e),(0,t.__exportStar)(HM,e),(0,t.__exportStar)(YM,e),(0,t.__exportStar)(GM,e),(0,t.__exportStar)(JM,e)})(Hm);var ZM={},N1={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.isCompositeSlice=e.CompositeSlice=e.CompositeSliceConfig=e.CompositeSliceType=void 0;const n=(0,Q.__importStar)(X),r=Tl,i=it(),o=us;e.CompositeSliceType="Slice",e.CompositeSliceConfig=n.exact(n.partial({label:i.StringOrNull})),e.CompositeSlice=n.exact(n.intersection([n.type({type:n.literal(e.CompositeSliceType)}),n.partial({fieldset:i.StringOrNull,description:n.string,icon:n.string,display:n.string,"non-repeat":n.record(r.WidgetKey,o.NestableWidget),repeat:n.record(r.WidgetKey,o.NestableWidget),config:e.CompositeSliceConfig})]));function a(s){return s.type==="Slice"}e.isCompositeSlice=a})(N1);var yu={};Object.defineProperty(yu,"__esModule",{value:!0});yu.isLegacySlice=yu.LegacySlice=void 0;const SMe=Q,CMe=(0,SMe.__importStar)(X),wMe=vp,xMe=us;yu.LegacySlice=CMe.union([xMe.NestableWidget,wMe.NestedGroup]);function _Me(e){return e.type!=="Slice"&&e.type!=="SharedSlice"}yu.isLegacySlice=_Me;var Ym={},bu={};Object.defineProperty(bu,"__esModule",{value:!0});bu.isSlicePrimaryWidget=bu.SlicePrimaryWidget=void 0;const TMe=Q,IMe=(0,TMe.__importStar)(X),UQ=vp,PQ=Hm;bu.SlicePrimaryWidget=IMe.union([PQ.NestableWidget,UQ.Group]);const EMe=e=>PQ.NestableWidget.is(e)||UQ.Group.is(e);bu.isSlicePrimaryWidget=EMe;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.isDynamicSharedSlice=e.isStaticSharedSlice=e.SharedSlice=e.SharedSliceType=e.Variation=void 0;const n=(0,Q.__importStar)(X),r=gp,i=Tl,o=us,a=bu,s="https://images.prismic.io/slice-machine/621a5ec4-0387-4bc5-9860-2dd46cbc07cd_default_ss.png?auto=compress,format";e.Variation=n.exact(n.intersection([n.type({id:n.string,name:n.string,description:n.string,imageUrl:(0,r.withFallback)(n.string,s),docURL:n.string,version:n.string}),n.partial({display:n.string,primary:n.record(i.WidgetKey,a.SlicePrimaryWidget),items:n.record(i.WidgetKey,o.NestableWidget)})])),e.SharedSliceType="SharedSlice";const c=n.string,u=n.string;e.SharedSlice=n.exact(n.intersection([n.type({id:n.string,type:n.literal(e.SharedSliceType),name:n.string,variations:n.readonlyArray(e.Variation)}),n.partial({description:n.string,legacyPaths:n.record(c,u)})]));function l(p){return p.type==="SharedSlice"}e.isStaticSharedSlice=l;function d(p){return p.type==="SharedSlice"}e.isDynamicSharedSlice=d})(Ym);var Gm={};Object.defineProperty(Gm,"__esModule",{value:!0});Gm.SharedSliceRef=void 0;const RMe=Q,ZS=(0,RMe.__importStar)(X),$Me=Ym;Gm.SharedSliceRef=ZS.exact(ZS.type({type:ZS.literal($Me.SharedSliceType)}));(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Slices=e.DynamicSlices=e.StaticSlices=e.slicesReader=e.DynamicSlicesConfig=e.StaticSlicesConfig=e.slicesConfigReader=e.SlicesLabels=e.SlicesFieldType=e.LegacySlicesFieldType=void 0;const n=(0,Q.__importStar)(X),r=Tl,i=it(),o=N1,a=yu,s=Ym,c=Gm;e.LegacySlicesFieldType="Choice",e.SlicesFieldType="Slices",e.SlicesLabels=n.union([n.record(n.string,n.readonlyArray(n.exact(n.intersection([n.type({name:n.string}),n.partial({display:n.string})])))),n.null]);function u(p){return n.exact(n.partial({label:i.StringOrNull,labels:e.SlicesLabels,choices:n.record(r.WidgetKey,n.union([a.LegacySlice,o.CompositeSlice,p]))}))}e.slicesConfigReader=u,e.StaticSlicesConfig=u(s.SharedSlice),e.DynamicSlicesConfig=u(c.SharedSliceRef);const l={toStatic(p,h){const A=Object.entries(p.choices||{}).reduce((g,[v,b])=>{if(b.type==="SharedSlice"){const w=h.get(v);return w?{...g,[v]:w}:g}else return{...g,[v]:b}},{});return{...p,choices:A}}};function d(p){return n.exact(n.intersection([n.type({type:n.keyof({[e.SlicesFieldType]:null,[e.LegacySlicesFieldType]:null})}),n.partial({fieldset:i.StringOrNull,config:p})]))}e.slicesReader=d,e.StaticSlices=d(e.StaticSlicesConfig),e.DynamicSlices=d(e.DynamicSlicesConfig),e.Slices={toStatic(p,h){return p.config?{...p,config:l.toStatic(p.config,h)}:p}}})(ZM);var XM={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.UID=e.UIDConfig=e.UIDFieldType=void 0;const n=(0,Q.__importStar)(X),r=it();e.UIDFieldType="UID",e.UIDConfig=n.exact(n.partial({label:r.StringOrNull,useAsTitle:n.boolean,placeholder:n.string})),e.UID=n.exact(n.intersection([n.type({type:n.literal(e.UIDFieldType)}),n.partial({fieldset:r.StringOrNull,config:e.UIDConfig})]))})(XM);Object.defineProperty(Br,"__esModule",{value:!0});Br.Widgets=Br.FieldType=Br.DynamicWidget=Br.StaticWidget=Br.widgetReader=void 0;const kMe=Q,NQ=(0,kMe.__importStar)(X),WQ=vp,On=Hm,OMe=us,_h=ZM,KQ=XM;function eF(e){return NQ.union([KQ.UID,OMe.NestableWidget,WQ.Group,e])}Br.widgetReader=eF;Br.StaticWidget=eF(_h.StaticSlices);Br.DynamicWidget=eF(_h.DynamicSlices);Br.FieldType=NQ.keyof({[On.ColorFieldType]:null,[On.BooleanFieldType]:null,[On.NumberFieldType]:null,[On.EmbedFieldType]:null,[On.GeoPointFieldType]:null,[On.DateFieldType]:null,[On.RangeFieldType]:null,[On.RichTextFieldType]:null,[On.SelectFieldType]:null,[On.SeparatorFieldType]:null,[On.TableFieldType]:null,[On.TextFieldType]:null,[On.TimestampFieldType]:null,[On.LinkFieldType]:null,[On.ImageFieldType]:null,[On.IntegrationFieldType]:null,[KQ.UIDFieldType]:null,[WQ.GroupFieldType]:null,[_h.SlicesFieldType]:null,[_h.LegacySlicesFieldType]:null});Br.Widgets={toStatic(e,t){switch(e.type){case"Choice":case"Slices":return _h.Slices.toStatic(e,t);default:return e}}};Object.defineProperty(Wi,"__esModule",{value:!0});Wi.Sections=Wi.DynamicSection=Wi.StaticSection=Wi.sectionReader=void 0;const MMe=Q,FMe=(0,MMe.__importStar)(X),LMe=Tl,tF=Br;function nF(e){return FMe.record(LMe.WidgetKey,e)}Wi.sectionReader=nF;Wi.StaticSection=nF(tF.StaticWidget);Wi.DynamicSection=nF(tF.DynamicWidget);Wi.Sections={toStatic(e,t){return Object.entries(e).reduce((r,[i,o])=>({...r,[i]:tF.Widgets.toStatic(o,t)}),{})}};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.collectSharedSlices=e.flattenCustomTypeFields=e.filterMissingSharedSlices=e.collectWidgets=e.validateSlices=e.toStatic=e.flattenSections=e.flattenWidgets=e.CustomType=e.StaticCustomType=e.CustomTypeFormat=void 0;const t=Q,n=Zt,r=(0,t.__importStar)(X),i=gp,o=it(),a=Wi;e.CustomTypeFormat={page:"page",custom:"custom"};class s extends Error{constructor(y){super(),Object.defineProperty(this,"slices",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"message",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.slices=y,this.message=this._formatError(y)}_formatError(y){return`The following slices doesn't exists in your Prismic repository:
|
|
4
|
+
${y.map(x=>` - ${x}`).join(`
|
|
5
|
+
`)}
|
|
6
|
+
`}}function c(S){return r.exact(r.intersection([r.type({id:r.string,label:o.StringOrNull,repeatable:(0,i.withFallback)(r.boolean,!0),json:r.record(r.string,S),status:(0,i.withFallback)(r.boolean,!0)}),r.partial({format:(0,i.withFallback)(r.keyof(e.CustomTypeFormat),"custom")})]))}e.StaticCustomType=c(a.StaticSection),e.CustomType=c(a.DynamicSection);function u(S){return Object.entries(S.json).reduce((y,[,C])=>{const x=Object.entries(C);return y.concat(x)},[])}e.flattenWidgets=u;function l(S){return Object.entries(S.json).reduce((y,[,C])=>{const x=Object.entries(C);return y.concat(x)},[])}e.flattenSections=l;function d(S){return u(S).filter(([,x])=>x.type==="Slices").reduce((x,[,T])=>{const I=Object.entries(T.config&&T.config.choices?T.config.choices:{}).filter(([,R])=>R.type==="SharedSlice").map(([R])=>R);return x.concat(I)},[])}function p(S){const y=d(S);return function(C){return y.map(C)}}function h(S,y){const C=Object.entries(S.json).reduce((x,[T,I])=>({...x,[T]:a.Sections.toStatic(I,y)}),{});return{...S,json:C}}e.toStatic=h;function A(S,y){const C=p(S)(x=>{if(!y.get(x))return x}).filter(Boolean);return C.length>0?(0,n.left)(new s(C)):(0,n.right)(S)}e.validateSlices=A;function g(S,y){const C=Object.entries(S.json).reduce((x,[T,I])=>{const R=Object.entries(I).reduce((O,[k,P])=>{const q=y(k,P);return q?{...O,[k]:q}:O},{});return{...x,[T]:R}},{});return{...S,json:C}}e.collectWidgets=g;function v(S,y){return g(S,(C,x)=>{if(x.type==="Slices"){if(!x.config||!x.config.choices)return x;const T=Object.entries(x.config.choices).reduce((R,[O,k])=>k.type==="SharedSlice"&&!y.get(O)?R:{...R,[O]:k},{}),I={...x.config,choices:T};return{...x,config:I}}return x})}e.filterMissingSharedSlices=v;function b(S){return Object.values(S.json).reduce((y,C)=>({...y,...C}),{})}e.flattenCustomTypeFields=b;function w(S){return Object.entries(S.fields).reduce((y,[,C])=>{var x;return C.type==="Slices"||C.type==="Choice"?{...y,...Object.entries(((x=C.config)===null||x===void 0?void 0:x.choices)||{}).reduce((T,[I,R])=>R.type==="SharedSlice"?{...T,[I]:R}:T,{})}:y},{})}e.collectSharedSlices=w})(DQ);var qQ={},W1={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DiffOperation=void 0,function(t){t.Added="added",t.Removed="removed",t.Updated="updated"}(e.DiffOperation||(e.DiffOperation={}))})(W1);var K1={},ya={},q1={};Object.defineProperty(q1,"__esModule",{value:!0});q1.HexaColor=void 0;const BMe=/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;q1.HexaColor={is:e=>BMe.test(e)};var V1={};Object.defineProperty(V1,"__esModule",{value:!0});V1.toRecord=void 0;function DMe(e,t){return e.reduce((n,r)=>{const i=t(r);return{...n,[i]:r}},{})}V1.toRecord=DMe;var Dr={};Object.defineProperty(Dr,"__esModule",{value:!0});Dr.mapValues=Dr.isObject=Dr.withOptionals=Dr.isNotEmpty=Dr.zipObjects=void 0;const jMe=Q,UMe=Zt,XS=(0,jMe.__importStar)(X);function PMe(e,t){return[...new Set(Object.keys(e||{}).concat(Object.keys(t||{})))].reduce((r,i)=>{const o=e==null?void 0:e[i],a=t==null?void 0:t[i];return{...r,[i]:{left:o,right:a}}},{})}Dr.zipObjects=PMe;function NMe(e){return!!Object.keys(e).length}Dr.isNotEmpty=NMe;function WMe(e,t){return{...e,...t.reduce((n,[r,i])=>i?{...n,[r]:i}:n,{})}}Dr.withOptionals=WMe;const KMe=XS.record(XS.string,XS.unknown);function qMe(e){return(0,UMe.isRight)(KMe.decode(e))}Dr.isObject=qMe;function VMe(e,t){return Object.entries(e).reduce((n,[r,i])=>({...n,[r]:t(i,r)}),{})}Dr.mapValues=VMe;Object.defineProperty(ya,"__esModule",{value:!0});ya.Objects=ya.Arrays=ya.HexaColorCode=void 0;const rF=Q;ya.HexaColorCode=(0,rF.__importStar)(q1);ya.Arrays=(0,rF.__importStar)(V1);ya.Objects=(0,rF.__importStar)(Dr);var Jm={};Object.defineProperty(Jm,"__esModule",{value:!0});Jm.VariationComparator=void 0;const Iv=ya,eC=vp,Ss=W1;function zMe(e,t){const n=Iv.Objects.zipObjects(e,t);return Object.entries(n).reduce((r,[i,o])=>i==="primary"||i==="items"||(o==null?void 0:o.left)===(o==null?void 0:o.right)?r:{...r,[i]:o==null?void 0:o.right},{})}function Ev(e,t){const n=Iv.Objects.zipObjects(e,t),r=Object.entries(n).reduce((i,[o,a])=>{if(JSON.stringify(a==null?void 0:a.left)===JSON.stringify(a==null?void 0:a.right))return i;const s=(()=>{var c,u,l,d,p,h,A;if(!(!(a!=null&&a.left)&&!(a!=null&&a.right))){if(a!=null&&a.left&&!a.right)return{op:Ss.DiffOperation.Removed};if(!(a!=null&&a.left)&&(a!=null&&a.right)){if(((c=a.right)===null||c===void 0?void 0:c.type)===eC.GroupFieldType){const g={...a.right,config:{...a.right.config,fields:{}}};return g.config.fields=Ev(void 0,(u=a.right.config)===null||u===void 0?void 0:u.fields)||{},{op:Ss.DiffOperation.Added,value:g}}return{op:Ss.DiffOperation.Added,value:a.right}}if(((l=a.right)===null||l===void 0?void 0:l.type)===eC.GroupFieldType){const g={...a.right,config:{...a.right.config,fields:{}}};return g.config.fields=Ev(((d=a.left)===null||d===void 0?void 0:d.type)===eC.GroupFieldType?(h=(p=a.left)===null||p===void 0?void 0:p.config)===null||h===void 0?void 0:h.fields:void 0,(A=a.right.config)===null||A===void 0?void 0:A.fields)||{},{op:Ss.DiffOperation.Updated,value:g}}return{op:Ss.DiffOperation.Updated,value:a.right}}})();return s?{...i,[o]:s}:i},{});return Iv.Objects.isNotEmpty(r)?r:void 0}Jm.VariationComparator={compare(e,t){if(e&&!t)return{op:Ss.DiffOperation.Removed};if(!e&&t)return{op:Ss.DiffOperation.Added,value:t};const n=zMe(e,t),r=Ev(e==null?void 0:e.primary,t==null?void 0:t.primary),i=Ev(e==null?void 0:e.items,t==null?void 0:t.items),o={...n,...r?{primary:r}:{},...i?{items:i}:{}};if(Iv.Objects.isNotEmpty(o))return{op:Ss.DiffOperation.Updated,value:o}}};Object.defineProperty(K1,"__esModule",{value:!0});K1.SliceComparator=void 0;const Yl=ya,tC=W1,QMe=Jm;function HMe(e,t){const n=Yl.Objects.zipObjects(e,t);return Object.entries(n).reduce((r,[i,o])=>i==="variations"||(o==null?void 0:o.left)===(o==null?void 0:o.right)?r:{...r,[i]:o==null?void 0:o.right},{})}K1.SliceComparator={compare(e,t){if(!e&&t)return{op:tC.DiffOperation.Added,value:t};if(e&&!t)return{op:tC.DiffOperation.Removed};const n=HMe(e,t),r=Yl.Objects.zipObjects(e&&Yl.Arrays.toRecord(e.variations,a=>a.id),t&&Yl.Arrays.toRecord(t.variations,a=>a.id)),i=Object.entries(r).reduce((a,[s,c])=>{if(!c)return a;const u=QMe.VariationComparator.compare(c.left,c.right);return u?{...a,[s]:u}:a},{}),o={...n,...Yl.Objects.isNotEmpty(i)?{variations:i}:{}};if(Yl.Objects.isNotEmpty(o))return{op:tC.DiffOperation.Updated,value:o}}};var VQ={};Object.defineProperty(VQ,"__esModule",{value:!0});(function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=Q;(0,t.__exportStar)(W1,e),(0,t.__exportStar)(K1,e),(0,t.__exportStar)(Jm,e),(0,t.__exportStar)(VQ,e)})(qQ);var ra={},zQ={};(function(e){var t=me&&me.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(e,"__esModule",{value:!0}),e.ImageConstraint=void 0;var n=Qm;Object.defineProperty(e,"ImageConstraint",{enumerable:!0,get:function(){return t(n).default}})})(zQ);var QQ={},HQ={};Object.defineProperty(HQ,"__esModule",{value:!0});var z1={};Object.defineProperty(z1,"__esModule",{value:!0});z1.SlicesTypes=void 0;const YMe=Q,GMe=(0,YMe.__importStar)(X),JMe=N1,ZMe=Ym;z1.SlicesTypes=GMe.keyof({[JMe.CompositeSliceType]:null,[ZMe.SharedSliceType]:null});(function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=Q;(0,t.__exportStar)(N1,e),(0,t.__exportStar)(yu,e),(0,t.__exportStar)(Ym,e),(0,t.__exportStar)(Gm,e),(0,t.__exportStar)(HQ,e),(0,t.__exportStar)(bu,e),(0,t.__exportStar)(ZM,e),(0,t.__exportStar)(z1,e)})(QQ);(function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=Q;(0,t.__exportStar)(vp,e),(0,t.__exportStar)(Hm,e),(0,t.__exportStar)(zQ,e),(0,t.__exportStar)(QQ,e),(0,t.__exportStar)(XM,e),(0,t.__exportStar)(Br,e)})(ra);(function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=Q;(0,t.__exportStar)(DQ,e),(0,t.__exportStar)(qQ,e),(0,t.__exportStar)(Wi,e),(0,t.__exportStar)(ra,e)})(de);var nC={},rC={},Bc={},a2;function wt(){if(a2)return Bc;a2=1,Object.defineProperty(Bc,"__esModule",{value:!0}),Bc.hasContentType=Bc.hasFieldContentType=void 0;const e=Zt,t=uF();function n(i){var o;return r(i)&&i.__TYPE__===t.FieldContentType&&((o=i)===null||o===void 0?void 0:o.type)!==void 0&&typeof i.type=="string"&&(0,e.isRight)(t.FieldType.decode(i.type))}Bc.hasFieldContentType=n;function r(i){return typeof i=="object"&&i!==null&&"__TYPE__"in i}return Bc.hasContentType=r,Bc}var s2;function YQ(){return s2||(s2=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.EmptyContent=e.EmptyLegacy=e.isEmptyContent=e.EmptyContentType=void 0;const t=Q,n=tt,r=Ve,i=(0,t.__importStar)(X),o=wt();e.EmptyContentType="EmptyContent";const a=u=>(0,o.hasContentType)(u)&&u.__TYPE__===e.EmptyContentType;e.isEmptyContent=a;const s=i.union([i.null,i.type({value:i.null})]),c=u=>new i.Type("EmptyLegacy",e.isEmptyContent,l=>(0,r.pipe)(s.decode(l),n.either.map(()=>({type:u,__TYPE__:e.EmptyContentType}))),()=>null);e.EmptyLegacy=c,e.EmptyContent=i.strict({type:i.string,__TYPE__:i.literal(e.EmptyContentType)})}(rC)),rC}var iC={},er={};Object.defineProperty(er,"__esModule",{value:!0});er.defaultCtx=er.getFieldCtx=er.LegacyContentCtx=er.FieldOrSliceType=void 0;const XMe=Q,oC=(0,XMe.__importStar)(X),c2=ra;er.FieldOrSliceType=oC.union([oC.union([c2.FieldType,c2.SlicesTypes]),oC.literal("Repeatable.Link")]);class iF{constructor(t,n,r){Object.defineProperty(this,"fieldKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"prefixedKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"keyOfType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fieldPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fieldType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"allTypes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.fieldKey=t,this.fieldPath=n||[],this.allTypes=r||new Map;const i=Array.of(this.fieldPath,[this.fieldKey]).flat().join(".");this.prefixedKey=i,this.keyOfType=`${i}_TYPE`,this.fieldType=this.allTypes.get(this.prefixedKey)}}er.LegacyContentCtx=iF;function eFe(e,t,n){return new iF(e,[...t.fieldPath,t.fieldKey,...n||[]],t.allTypes)}er.getFieldCtx=eFe;function tFe(e,t=new Map){return new iF(e,[],t)}er.defaultCtx=tFe;var aC={},sC={},u2;function GQ(){return u2||(u2=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.BooleanContentDefaultValue=e.BooleanContent=e.BooleanLegacy=e.isBooleanContent=e.BooleanContentType=void 0;const t=Q,n=tt,r=Ve,i=(0,t.__importStar)(X),o=wt();e.BooleanContentType="BooleanContent";const a=u=>(0,o.hasContentType)(u)&&u.__TYPE__===e.BooleanContentType;e.isBooleanContent=a;const s=u=>new i.Type("BooleanLegacy",e.isBooleanContent,l=>(0,r.pipe)(i.boolean.decode(l),n.either.map(d=>e.BooleanContent.encode({value:d,__TYPE__:e.BooleanContentType}))),l=>({content:l.value,types:{[u.keyOfType]:"Boolean"}}));e.BooleanLegacy=s,e.BooleanContent=i.strict({__TYPE__:i.literal(e.BooleanContentType),value:i.boolean});const c=u=>{var l;return((l=u.config)===null||l===void 0?void 0:l.default_value)!==void 0?{__TYPE__:e.BooleanContentType,value:u.config.default_value||!1}:void 0};e.BooleanContentDefaultValue=c}(sC)),sC}var cC={},l2;function oF(){return l2||(l2=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.EmbedContent=e.EmbedLegacy=e.EmbedContentLegacy=e.isEmbedContent=e.EmbedContentType=void 0;const t=Q,n=tt,r=Ve,i=(0,t.__importStar)(X),o=it(),a=wt();e.EmbedContentType="EmbedContent";const s=u=>(0,a.hasContentType)(u)&&u.__TYPE__===e.EmbedContentType;e.isEmbedContent=s,e.EmbedContentLegacy=i.exact(i.intersection([i.type({embed_url:i.string,type:i.string}),i.partial({version:i.union([i.string,i.number,i.null]),title:o.StringOrNull,author_name:o.StringOrNull,author_url:o.StringOrNull,provider_name:o.StringOrNull,provider_url:o.StringOrNull,cache_age:i.union([i.string,i.number,i.null]),thumbnail_url:o.StringOrNull,thumbnail_width:o.NumberOrNull,thumbnail_height:o.NumberOrNull,html:o.StringOrNull})]));const c=u=>new i.Type("EmbedLegacy",e.isEmbedContent,l=>(0,r.pipe)(e.EmbedContentLegacy.decode(l),n.either.map(d=>({...d,all:l,__TYPE__:e.EmbedContentType}))),l=>({content:l.all,types:{[u.keyOfType]:"Embed"}}));e.EmbedLegacy=c,e.EmbedContent=i.intersection([e.EmbedContentLegacy,i.strict({__TYPE__:i.literal(e.EmbedContentType),all:i.unknown})])}(cC)),cC}var uC={},lC={},ls={};Object.defineProperty(ls,"__esModule",{value:!0});const nFe=Q,rFe=cs,iFe=Ao,Sg=(0,nFe.__importStar)(X);function oFe(e){let t=0;for(;t<e.length&&e[t]<=" ";)t++;let n=e.length;for(;t<n&&e[n-1]<=" ";)n--;return e.substring(t,n)}ls.default=new Sg.Type("TrimmedString",Sg.string.is,(e,t)=>(0,iFe.pipe)(Sg.string.validate(e,t),(0,rFe.chain)(n=>Sg.success(oFe(n)))),e=>e);var Di={};Object.defineProperty(Di,"__esModule",{value:!0});Di.FieldContentType=void 0;Di.FieldContentType="FieldContent";var d2;function f2(){return d2||(d2=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ColorContent=e.ColorLegacy=e.isColorContent=void 0;const t=Q,n=tt,r=Ve,i=(0,t.__importStar)(X),o=ra,a=(0,t.__importDefault)(ls),s=wt(),c=Di,u=d=>(0,s.hasContentType)(d)&&d.__TYPE__===c.FieldContentType&&(0,s.hasFieldContentType)(d)&&d.type==="Color";e.isColorContent=u;const l=d=>new i.Type("ColorLegacy",e.isColorContent,p=>(0,r.pipe)(a.default.decode(p),n.either.map(h=>e.ColorContent.encode({value:h,type:o.ColorFieldType,__TYPE__:c.FieldContentType}))),p=>({content:p.value,types:{[d.keyOfType]:o.ColorFieldType}}));e.ColorLegacy=l,e.ColorContent=i.strict({type:i.literal(o.ColorFieldType),value:a.default,__TYPE__:i.literal(c.FieldContentType)})}(lC)),lC}var dC={},p2;function h2(){return p2||(p2=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DateContent=e.DateLegacy=e.isDateContent=void 0;const t=Q,n=tt,r=Ve,i=(0,t.__importStar)(X),o=ra,a=(0,t.__importDefault)(ls),s=wt(),c=Di,u=d=>(0,s.hasContentType)(d)&&d.__TYPE__===c.FieldContentType&&(0,s.hasFieldContentType)(d)&&d.type==="Date";e.isDateContent=u;const l=d=>new i.Type("DateLegacy",e.isDateContent,p=>(0,r.pipe)(a.default.decode(p),n.either.map(h=>e.DateContent.encode({value:h,type:o.DateFieldType,__TYPE__:c.FieldContentType}))),p=>({content:p.value,types:{[d.keyOfType]:o.DateFieldType}}));e.DateLegacy=l,e.DateContent=i.strict({type:i.literal(o.DateFieldType),value:a.default,__TYPE__:i.literal(c.FieldContentType)})}(dC)),dC}var fC={},A2;function m2(){return A2||(A2=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.NumberContent=e.NumberLegacy=e.isNumberContent=void 0;const t=Q,n=tt,r=Ve,i=(0,t.__importStar)(X),o=ra,a=(0,t.__importDefault)(ls),s=wt(),c=Di,u=d=>(0,s.hasContentType)(d)&&d.__TYPE__===c.FieldContentType&&(0,s.hasFieldContentType)(d)&&d.type==="Number";e.isNumberContent=u;const l=d=>new i.Type("NumberLegacy",e.isNumberContent,p=>(0,r.pipe)(a.default.decode(p),n.either.map(h=>e.NumberContent.encode({value:h,type:o.NumberFieldType,__TYPE__:c.FieldContentType}))),p=>({content:p.value,types:{[d.keyOfType]:o.NumberFieldType}}));e.NumberLegacy=l,e.NumberContent=i.strict({type:i.literal(o.NumberFieldType),value:a.default,__TYPE__:i.literal(c.FieldContentType)})}(fC)),fC}var pC={},g2;function v2(){return g2||(g2=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.RangeContent=e.RangeLegacy=e.isRangeContent=void 0;const t=Q,n=tt,r=Ve,i=(0,t.__importStar)(X),o=ra,a=(0,t.__importDefault)(ls),s=wt(),c=Di,u=d=>(0,s.hasContentType)(d)&&d.__TYPE__===c.FieldContentType&&(0,s.hasFieldContentType)(d)&&d.type==="Range";e.isRangeContent=u;const l=d=>new i.Type("RangeLegacy",e.isRangeContent,p=>(0,r.pipe)(a.default.decode(p),n.either.map(h=>e.RangeContent.encode({value:h,type:o.RangeFieldType,__TYPE__:c.FieldContentType}))),p=>({content:p.value,types:{[d.keyOfType]:o.RangeFieldType}}));e.RangeLegacy=l,e.RangeContent=i.strict({type:i.literal(o.RangeFieldType),value:a.default,__TYPE__:i.literal(c.FieldContentType)})}(pC)),pC}var hC={},y2;function b2(){return y2||(y2=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SelectContentDefaultValue=e.SelectContent=e.SelectLegacy=e.isSelectContent=void 0;const t=Q,n=tt,r=Ve,i=(0,t.__importStar)(X),o=ra,a=(0,t.__importDefault)(ls),s=wt(),c=Di,u=p=>(0,s.hasContentType)(p)&&p.__TYPE__===c.FieldContentType&&(0,s.hasFieldContentType)(p)&&p.type==="Select";e.isSelectContent=u;const l=p=>new i.Type("SelectLegacy",e.isSelectContent,h=>(0,r.pipe)(a.default.decode(h),n.either.map(A=>e.SelectContent.encode({value:A,type:o.SelectFieldType,__TYPE__:c.FieldContentType}))),h=>({content:h.value,types:{[p.keyOfType]:o.SelectFieldType}}));e.SelectLegacy=l,e.SelectContent=i.strict({type:i.literal(o.SelectFieldType),value:a.default,__TYPE__:i.literal(c.FieldContentType)});const d=p=>{var h;return!((h=p.config)===null||h===void 0)&&h.default_value?{__TYPE__:c.FieldContentType,type:o.SelectFieldType,value:p.config.default_value||""}:void 0};e.SelectContentDefaultValue=d}(hC)),hC}var AC={},S2;function C2(){return S2||(S2=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.TextContent=e.TextLegacy=e.isTextContent=void 0;const t=Q,n=tt,r=Ve,i=(0,t.__importStar)(X),o=ra,a=(0,t.__importDefault)(ls),s=wt(),c=Di,u=d=>(0,s.hasContentType)(d)&&d.__TYPE__===c.FieldContentType&&(0,s.hasFieldContentType)(d)&&d.type==="Text";e.isTextContent=u;const l=d=>new i.Type("TextLegacy",e.isTextContent,p=>(0,r.pipe)(a.default.decode(p),n.either.map(h=>e.TextContent.encode({value:h,type:o.TextFieldType,__TYPE__:c.FieldContentType}))),p=>({content:p.value,types:{[d.keyOfType]:o.TextFieldType}}));e.TextLegacy=l,e.TextContent=i.strict({type:i.literal(o.TextFieldType),value:a.default,__TYPE__:i.literal(c.FieldContentType)})}(AC)),AC}var mC={},w2;function x2(){return w2||(w2=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.TimestampContent=e.TimestampLegacy=e.isTimestampContent=void 0;const t=Q,n=tt,r=Ve,i=(0,t.__importStar)(X),o=ra,a=(0,t.__importDefault)(ls),s=wt(),c=Di,u=d=>(0,s.hasContentType)(d)&&d.__TYPE__===c.FieldContentType&&(0,s.hasFieldContentType)(d)&&d.type==="Timestamp";e.isTimestampContent=u;const l=d=>new i.Type("TimestampLegacy",e.isTimestampContent,p=>(0,r.pipe)(a.default.decode(p),n.either.map(h=>e.TimestampContent.encode({value:h,type:o.TimestampFieldType,__TYPE__:c.FieldContentType}))),p=>({content:p.value,types:{[d.keyOfType]:o.TimestampFieldType}}));e.TimestampLegacy=l,e.TimestampContent=i.strict({type:i.literal(o.TimestampFieldType),value:a.default,__TYPE__:i.literal(c.FieldContentType)})}(mC)),mC}var _2;function JQ(){return _2||(_2=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.FieldContent=e.FieldType=void 0;const t=Q,n=(0,t.__importStar)(X),r=f2(),i=h2(),o=m2(),a=v2(),s=b2(),c=C2(),u=x2();e.FieldType=n.keyof({Text:null,Date:null,Timestamp:null,Color:null,Number:null,Range:null,Select:null}),e.FieldContent=n.union([i.DateContent,r.ColorContent,o.NumberContent,a.RangeContent,s.SelectContent,c.TextContent,u.TimestampContent]),(0,t.__exportStar)(f2(),e),(0,t.__exportStar)(Di,e),(0,t.__exportStar)(h2(),e),(0,t.__exportStar)(m2(),e),(0,t.__exportStar)(v2(),e),(0,t.__exportStar)(b2(),e),(0,t.__exportStar)(C2(),e),(0,t.__exportStar)(x2(),e)}(uC)),uC}var gC={},T2;function ZQ(){return T2||(T2=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.GeoPointContent=e.GeoPointLegacy=e.isGeoPointContent=e.GeoPointContentType=void 0;const t=Q,n=tt,r=Ao,i=(0,t.__importStar)(X),o=wt();e.GeoPointContentType="GeoPointContent";const a=u=>(0,o.hasContentType)(u)&&u.__TYPE__===e.GeoPointContentType;e.isGeoPointContent=a;const s=i.strict({position:i.strict({lat:i.number,lng:i.number})}),c=u=>new i.Type("GeoPointLegacy",e.isGeoPointContent,l=>(0,r.pipe)(s.decode(l),n.either.map(d=>e.GeoPointContent.encode({...d,__TYPE__:e.GeoPointContentType}))),l=>({content:{position:l.position},types:{[u.keyOfType]:"GeoPoint"}}));e.GeoPointLegacy=c,e.GeoPointContent=i.intersection([s,i.strict({__TYPE__:i.literal(e.GeoPointContentType)})])}(gC)),gC}var vC={},I2;function aF(){return I2||(I2=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ImageContent=e.ImageLegacy=e.ImageContentView=e.isImageContent=e.ImageContentType=void 0;const t=Q,n=tt,r=Ve,i=(0,t.__importStar)(X),o=Dr,a=it(),s=wt();e.ImageContentType="ImageContent";const c=p=>(0,s.hasContentType)(p)&&p.__TYPE__===e.ImageContentType;e.isImageContent=c;const u=i.exact(i.type({id:i.string,url:i.string,width:i.number,height:i.number}));e.ImageContentView=i.exact(i.intersection([i.type({origin:u,width:i.number,height:i.number,edit:i.type({zoom:i.number,crop:i.type({x:i.number,y:i.number}),background:i.string})}),i.partial({url:i.string,credits:a.NonEmptyStringOrNull,alt:a.NonEmptyStringOrNull,provider:a.StringOrNull})]));const l=i.intersection([e.ImageContentView,i.partial({thumbnails:i.record(i.string,e.ImageContentView)})]),d=p=>new i.Type("ImageLegacy",e.isImageContent,h=>(0,r.pipe)(l.decode(h),n.either.map(A=>e.ImageContent.encode({...A,__TYPE__:e.ImageContentType}))),h=>({content:(0,o.withOptionals)({edit:h.edit,height:h.height,origin:h.origin,width:h.width},[["alt",h.alt],["credits",h.credits],["provider",h.provider],["thumbnails",h.thumbnails],["url",h.url]]),types:{[p.keyOfType]:"Image"}}));e.ImageLegacy=d,e.ImageContent=i.intersection([l,i.strict({__TYPE__:i.literal(e.ImageContentType)})])}(vC)),vC}var yC={},E2;function XQ(){return E2||(E2=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.IntegrationFieldContent=e.IntegrationFieldLegacy=e.isIntegrationFieldContent=e.IntegrationFieldContentType=void 0;const t=Q,n=tt,r=Ve,i=(0,t.__importStar)(X),o=wt();e.IntegrationFieldContentType="IntegrationFieldsContent";const a=c=>(0,o.hasContentType)(c)&&c.__TYPE__===e.IntegrationFieldContentType;e.isIntegrationFieldContent=a;const s=c=>new i.Type("IntegrationFieldLegacy",e.isIntegrationFieldContent,u=>(0,r.pipe)(i.string.decode(u),n.either.map(l=>e.IntegrationFieldContent.encode({value:l,__TYPE__:e.IntegrationFieldContentType}))),u=>({content:u.value,types:{[c.keyOfType]:"IntegrationFields"}}));e.IntegrationFieldLegacy=s,e.IntegrationFieldContent=i.strict({__TYPE__:i.literal(e.IntegrationFieldContentType),value:i.string})}(yC)),yC}var bC={},sF={},Q1={},H1={};Object.defineProperty(H1,"__esModule",{value:!0});H1.default=sFe;let Cg;const aFe=new Uint8Array(16);function sFe(){if(!Cg&&(Cg=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Cg))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Cg(aFe)}var xc={},$l={},Y1={};Object.defineProperty(Y1,"__esModule",{value:!0});Y1.default=void 0;var cFe=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;Y1.default=cFe;Object.defineProperty($l,"__esModule",{value:!0});$l.default=void 0;var uFe=lFe(Y1);function lFe(e){return e&&e.__esModule?e:{default:e}}function dFe(e){return typeof e=="string"&&uFe.default.test(e)}var fFe=dFe;$l.default=fFe;Object.defineProperty(xc,"__esModule",{value:!0});xc.default=void 0;xc.unsafeStringify=eH;var pFe=hFe($l);function hFe(e){return e&&e.__esModule?e:{default:e}}const hn=[];for(let e=0;e<256;++e)hn.push((e+256).toString(16).slice(1));function eH(e,t=0){return hn[e[t+0]]+hn[e[t+1]]+hn[e[t+2]]+hn[e[t+3]]+"-"+hn[e[t+4]]+hn[e[t+5]]+"-"+hn[e[t+6]]+hn[e[t+7]]+"-"+hn[e[t+8]]+hn[e[t+9]]+"-"+hn[e[t+10]]+hn[e[t+11]]+hn[e[t+12]]+hn[e[t+13]]+hn[e[t+14]]+hn[e[t+15]]}function AFe(e,t=0){const n=eH(e,t);if(!(0,pFe.default)(n))throw TypeError("Stringified UUID is invalid");return n}var mFe=AFe;xc.default=mFe;Object.defineProperty(Q1,"__esModule",{value:!0});Q1.default=void 0;var gFe=yFe(H1),vFe=xc;function yFe(e){return e&&e.__esModule?e:{default:e}}let R2,SC,CC=0,wC=0;function bFe(e,t,n){let r=t&&n||0;const i=t||new Array(16);e=e||{};let o=e.node||R2,a=e.clockseq!==void 0?e.clockseq:SC;if(o==null||a==null){const p=e.random||(e.rng||gFe.default)();o==null&&(o=R2=[p[0]|1,p[1],p[2],p[3],p[4],p[5]]),a==null&&(a=SC=(p[6]<<8|p[7])&16383)}let s=e.msecs!==void 0?e.msecs:Date.now(),c=e.nsecs!==void 0?e.nsecs:wC+1;const u=s-CC+(c-wC)/1e4;if(u<0&&e.clockseq===void 0&&(a=a+1&16383),(u<0||s>CC)&&e.nsecs===void 0&&(c=0),c>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");CC=s,wC=c,SC=a,s+=122192928e5;const l=((s&268435455)*1e4+c)%4294967296;i[r++]=l>>>24&255,i[r++]=l>>>16&255,i[r++]=l>>>8&255,i[r++]=l&255;const d=s/4294967296*1e4&268435455;i[r++]=d>>>8&255,i[r++]=d&255,i[r++]=d>>>24&15|16,i[r++]=d>>>16&255,i[r++]=a>>>8|128,i[r++]=a&255;for(let p=0;p<6;++p)i[r+p]=o[p];return t||(0,vFe.unsafeStringify)(i)}var SFe=bFe;Q1.default=SFe;var G1={},js={},Zm={};Object.defineProperty(Zm,"__esModule",{value:!0});Zm.default=void 0;var CFe=wFe($l);function wFe(e){return e&&e.__esModule?e:{default:e}}function xFe(e){if(!(0,CFe.default)(e))throw TypeError("Invalid UUID");let t;const n=new Uint8Array(16);return n[0]=(t=parseInt(e.slice(0,8),16))>>>24,n[1]=t>>>16&255,n[2]=t>>>8&255,n[3]=t&255,n[4]=(t=parseInt(e.slice(9,13),16))>>>8,n[5]=t&255,n[6]=(t=parseInt(e.slice(14,18),16))>>>8,n[7]=t&255,n[8]=(t=parseInt(e.slice(19,23),16))>>>8,n[9]=t&255,n[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,n[11]=t/4294967296&255,n[12]=t>>>24&255,n[13]=t>>>16&255,n[14]=t>>>8&255,n[15]=t&255,n}var _Fe=xFe;Zm.default=_Fe;Object.defineProperty(js,"__esModule",{value:!0});js.URL=js.DNS=void 0;js.default=$Fe;var TFe=xc,IFe=EFe(Zm);function EFe(e){return e&&e.__esModule?e:{default:e}}function RFe(e){e=unescape(encodeURIComponent(e));const t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n));return t}const tH="6ba7b810-9dad-11d1-80b4-00c04fd430c8";js.DNS=tH;const nH="6ba7b811-9dad-11d1-80b4-00c04fd430c8";js.URL=nH;function $Fe(e,t,n){function r(i,o,a,s){var c;if(typeof i=="string"&&(i=RFe(i)),typeof o=="string"&&(o=(0,IFe.default)(o)),((c=o)===null||c===void 0?void 0:c.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let u=new Uint8Array(16+i.length);if(u.set(o),u.set(i,o.length),u=n(u),u[6]=u[6]&15|t,u[8]=u[8]&63|128,a){s=s||0;for(let l=0;l<16;++l)a[s+l]=u[l];return a}return(0,TFe.unsafeStringify)(u)}try{r.name=e}catch{}return r.DNS=tH,r.URL=nH,r}var J1={};Object.defineProperty(J1,"__esModule",{value:!0});J1.default=void 0;function kFe(e){if(typeof e=="string"){const t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(let n=0;n<t.length;++n)e[n]=t.charCodeAt(n)}return OFe(MFe(FFe(e),e.length*8))}function OFe(e){const t=[],n=e.length*32,r="0123456789abcdef";for(let i=0;i<n;i+=8){const o=e[i>>5]>>>i%32&255,a=parseInt(r.charAt(o>>>4&15)+r.charAt(o&15),16);t.push(a)}return t}function rH(e){return(e+64>>>9<<4)+14+1}function MFe(e,t){e[t>>5]|=128<<t%32,e[rH(t)-1]=t;let n=1732584193,r=-271733879,i=-1732584194,o=271733878;for(let a=0;a<e.length;a+=16){const s=n,c=r,u=i,l=o;n=Mn(n,r,i,o,e[a],7,-680876936),o=Mn(o,n,r,i,e[a+1],12,-389564586),i=Mn(i,o,n,r,e[a+2],17,606105819),r=Mn(r,i,o,n,e[a+3],22,-1044525330),n=Mn(n,r,i,o,e[a+4],7,-176418897),o=Mn(o,n,r,i,e[a+5],12,1200080426),i=Mn(i,o,n,r,e[a+6],17,-1473231341),r=Mn(r,i,o,n,e[a+7],22,-45705983),n=Mn(n,r,i,o,e[a+8],7,1770035416),o=Mn(o,n,r,i,e[a+9],12,-1958414417),i=Mn(i,o,n,r,e[a+10],17,-42063),r=Mn(r,i,o,n,e[a+11],22,-1990404162),n=Mn(n,r,i,o,e[a+12],7,1804603682),o=Mn(o,n,r,i,e[a+13],12,-40341101),i=Mn(i,o,n,r,e[a+14],17,-1502002290),r=Mn(r,i,o,n,e[a+15],22,1236535329),n=Fn(n,r,i,o,e[a+1],5,-165796510),o=Fn(o,n,r,i,e[a+6],9,-1069501632),i=Fn(i,o,n,r,e[a+11],14,643717713),r=Fn(r,i,o,n,e[a],20,-373897302),n=Fn(n,r,i,o,e[a+5],5,-701558691),o=Fn(o,n,r,i,e[a+10],9,38016083),i=Fn(i,o,n,r,e[a+15],14,-660478335),r=Fn(r,i,o,n,e[a+4],20,-405537848),n=Fn(n,r,i,o,e[a+9],5,568446438),o=Fn(o,n,r,i,e[a+14],9,-1019803690),i=Fn(i,o,n,r,e[a+3],14,-187363961),r=Fn(r,i,o,n,e[a+8],20,1163531501),n=Fn(n,r,i,o,e[a+13],5,-1444681467),o=Fn(o,n,r,i,e[a+2],9,-51403784),i=Fn(i,o,n,r,e[a+7],14,1735328473),r=Fn(r,i,o,n,e[a+12],20,-1926607734),n=Ln(n,r,i,o,e[a+5],4,-378558),o=Ln(o,n,r,i,e[a+8],11,-2022574463),i=Ln(i,o,n,r,e[a+11],16,1839030562),r=Ln(r,i,o,n,e[a+14],23,-35309556),n=Ln(n,r,i,o,e[a+1],4,-1530992060),o=Ln(o,n,r,i,e[a+4],11,1272893353),i=Ln(i,o,n,r,e[a+7],16,-155497632),r=Ln(r,i,o,n,e[a+10],23,-1094730640),n=Ln(n,r,i,o,e[a+13],4,681279174),o=Ln(o,n,r,i,e[a],11,-358537222),i=Ln(i,o,n,r,e[a+3],16,-722521979),r=Ln(r,i,o,n,e[a+6],23,76029189),n=Ln(n,r,i,o,e[a+9],4,-640364487),o=Ln(o,n,r,i,e[a+12],11,-421815835),i=Ln(i,o,n,r,e[a+15],16,530742520),r=Ln(r,i,o,n,e[a+2],23,-995338651),n=Bn(n,r,i,o,e[a],6,-198630844),o=Bn(o,n,r,i,e[a+7],10,1126891415),i=Bn(i,o,n,r,e[a+14],15,-1416354905),r=Bn(r,i,o,n,e[a+5],21,-57434055),n=Bn(n,r,i,o,e[a+12],6,1700485571),o=Bn(o,n,r,i,e[a+3],10,-1894986606),i=Bn(i,o,n,r,e[a+10],15,-1051523),r=Bn(r,i,o,n,e[a+1],21,-2054922799),n=Bn(n,r,i,o,e[a+8],6,1873313359),o=Bn(o,n,r,i,e[a+15],10,-30611744),i=Bn(i,o,n,r,e[a+6],15,-1560198380),r=Bn(r,i,o,n,e[a+13],21,1309151649),n=Bn(n,r,i,o,e[a+4],6,-145523070),o=Bn(o,n,r,i,e[a+11],10,-1120210379),i=Bn(i,o,n,r,e[a+2],15,718787259),r=Bn(r,i,o,n,e[a+9],21,-343485551),n=xs(n,s),r=xs(r,c),i=xs(i,u),o=xs(o,l)}return[n,r,i,o]}function FFe(e){if(e.length===0)return[];const t=e.length*8,n=new Uint32Array(rH(t));for(let r=0;r<t;r+=8)n[r>>5]|=(e[r/8]&255)<<r%32;return n}function xs(e,t){const n=(e&65535)+(t&65535);return(e>>16)+(t>>16)+(n>>16)<<16|n&65535}function LFe(e,t){return e<<t|e>>>32-t}function Z1(e,t,n,r,i,o){return xs(LFe(xs(xs(t,e),xs(r,o)),i),n)}function Mn(e,t,n,r,i,o,a){return Z1(t&n|~t&r,e,t,i,o,a)}function Fn(e,t,n,r,i,o,a){return Z1(t&r|n&~r,e,t,i,o,a)}function Ln(e,t,n,r,i,o,a){return Z1(t^n^r,e,t,i,o,a)}function Bn(e,t,n,r,i,o,a){return Z1(n^(t|~r),e,t,i,o,a)}var BFe=kFe;J1.default=BFe;Object.defineProperty(G1,"__esModule",{value:!0});G1.default=void 0;var DFe=iH(js),jFe=iH(J1);function iH(e){return e&&e.__esModule?e:{default:e}}const UFe=(0,DFe.default)("v3",48,jFe.default);var PFe=UFe;G1.default=PFe;var X1={},eS={};Object.defineProperty(eS,"__esModule",{value:!0});eS.default=void 0;const NFe=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);var WFe={randomUUID:NFe};eS.default=WFe;Object.defineProperty(X1,"__esModule",{value:!0});X1.default=void 0;var $2=oH(eS),KFe=oH(H1),qFe=xc;function oH(e){return e&&e.__esModule?e:{default:e}}function VFe(e,t,n){if($2.default.randomUUID&&!t&&!e)return $2.default.randomUUID();e=e||{};const r=e.random||(e.rng||KFe.default)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){n=n||0;for(let i=0;i<16;++i)t[n+i]=r[i];return t}return(0,qFe.unsafeStringify)(r)}var zFe=VFe;X1.default=zFe;var tS={},nS={};Object.defineProperty(nS,"__esModule",{value:!0});nS.default=void 0;function QFe(e,t,n,r){switch(e){case 0:return t&n^~t&r;case 1:return t^n^r;case 2:return t&n^t&r^n&r;case 3:return t^n^r}}function xC(e,t){return e<<t|e>>>32-t}function HFe(e){const t=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof e=="string"){const a=unescape(encodeURIComponent(e));e=[];for(let s=0;s<a.length;++s)e.push(a.charCodeAt(s))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);const r=e.length/4+2,i=Math.ceil(r/16),o=new Array(i);for(let a=0;a<i;++a){const s=new Uint32Array(16);for(let c=0;c<16;++c)s[c]=e[a*64+c*4]<<24|e[a*64+c*4+1]<<16|e[a*64+c*4+2]<<8|e[a*64+c*4+3];o[a]=s}o[i-1][14]=(e.length-1)*8/Math.pow(2,32),o[i-1][14]=Math.floor(o[i-1][14]),o[i-1][15]=(e.length-1)*8&4294967295;for(let a=0;a<i;++a){const s=new Uint32Array(80);for(let h=0;h<16;++h)s[h]=o[a][h];for(let h=16;h<80;++h)s[h]=xC(s[h-3]^s[h-8]^s[h-14]^s[h-16],1);let c=n[0],u=n[1],l=n[2],d=n[3],p=n[4];for(let h=0;h<80;++h){const A=Math.floor(h/20),g=xC(c,5)+QFe(A,u,l,d)+p+t[A]+s[h]>>>0;p=d,d=l,l=xC(u,30)>>>0,u=c,c=g}n[0]=n[0]+c>>>0,n[1]=n[1]+u>>>0,n[2]=n[2]+l>>>0,n[3]=n[3]+d>>>0,n[4]=n[4]+p>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,n[0]&255,n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,n[1]&255,n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,n[2]&255,n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,n[3]&255,n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,n[4]&255]}var YFe=HFe;nS.default=YFe;Object.defineProperty(tS,"__esModule",{value:!0});tS.default=void 0;var GFe=aH(js),JFe=aH(nS);function aH(e){return e&&e.__esModule?e:{default:e}}const ZFe=(0,GFe.default)("v5",80,JFe.default);var XFe=ZFe;tS.default=XFe;var rS={};Object.defineProperty(rS,"__esModule",{value:!0});rS.default=void 0;var eLe="00000000-0000-0000-0000-000000000000";rS.default=eLe;var iS={};Object.defineProperty(iS,"__esModule",{value:!0});iS.default=void 0;var tLe=nLe($l);function nLe(e){return e&&e.__esModule?e:{default:e}}function rLe(e){if(!(0,tLe.default)(e))throw TypeError("Invalid UUID");return parseInt(e.slice(14,15),16)}var iLe=rLe;iS.default=iLe;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"NIL",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(e,"parse",{enumerable:!0,get:function(){return u.default}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(e,"v1",{enumerable:!0,get:function(){return t.default}}),Object.defineProperty(e,"v3",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(e,"v4",{enumerable:!0,get:function(){return r.default}}),Object.defineProperty(e,"v5",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(e,"validate",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(e,"version",{enumerable:!0,get:function(){return a.default}});var t=l(Q1),n=l(G1),r=l(X1),i=l(tS),o=l(rS),a=l(iS),s=l($l),c=l(xc),u=l(Zm);function l(d){return d&&d.__esModule?d:{default:d}}})(sF);var k2;function oS(){return k2||(k2=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.FilledLinkContent=e.FilledLink=e.FilledLinkContentLegacy=e.FilledLinkLegacy=e.isFilledLinkContent=e.LinkContent=e.Link=e.LinkContentLegacy=e.LinkLegacy=e.isLinkContent=e.LinkContentType=e.AnyLinkContent=e.AnyLinkType=e.ExternalLinkContent=e.FilledExternalLinkContent=e.ExternalLinkType=e.DocumentLinkContent=e.FilledDocumentLinkContent=e.DocumentLinkType=e.MediaLinkContent=e.MediaLinkType=e.FileLinkContent=e.FilledFileLinkContent=e.FileLinkType=e.ImageLinkContent=e.FilledImageLinkContent=e.ImageLinkType=void 0;const t=Q,n=tt,r=Ve,i=(0,t.__importStar)(X),o=L1,a=sF,s=it(),c=Je,u=wt(),l=j=>typeof j=="string"&&(0,a.validate)(j),d=new i.Type("UUID",l,(j,he)=>typeof j>"u"?i.success((0,a.v4)()):l(j)?i.success(j):i.failure(j,he),i.identity);function p(j){return i.intersection([i.strict({key:d}),j])}e.ImageLinkType="ImageLink";const h=j=>typeof j=="string",A=new i.Type("ImageLinkKind",j=>h(j),(j,he)=>h(j)?i.success("image"):i.failure(j,he),()=>"image"),g=i.intersection([i.strict({kind:A,id:i.string,url:i.string,height:i.string,width:i.string,size:i.string,name:i.string}),i.exact(i.partial({date:s.StringOrNull}))]),v=new i.Type("FilledImageLink",j=>(0,u.hasContentType)(j)&&j.__TYPE__===e.ImageLinkType,j=>(0,r.pipe)(g.decode(j),n.either.map(he=>e.FilledImageLinkContent.encode({...he,__TYPE__:e.ImageLinkType}))),j=>g.encode(j));e.FilledImageLinkContent=i.intersection([i.strict({__TYPE__:i.literal(e.ImageLinkType)}),g]);const b=i.intersection([i.union([g,i.strict({kind:i.literal("image")})]),i.exact(i.partial({text:i.string,variant:i.string}))]),w=new i.Type("ImageLink",j=>(0,u.hasContentType)(j)&&j.__TYPE__===e.ImageLinkType,j=>(0,r.pipe)(b.decode(j),n.either.map(he=>e.ImageLinkContent.encode({...he,__TYPE__:e.ImageLinkType}))),j=>b.encode(j));e.ImageLinkContent=i.intersection([i.strict({__TYPE__:i.literal(e.ImageLinkType)}),b]),e.FileLinkType="FileLink";const S=j=>typeof j=="string",y=new i.Type("FileLinkKind",j=>S(j),(j,he)=>S(j)?i.success("file"):i.failure(j,he),()=>"file"),C=i.exact(i.intersection([i.type({kind:y,id:i.string,url:i.string,name:i.string,size:(0,o.withFallback)(i.string,"0")}),i.partial({date:s.StringOrNull})])),x=new i.Type("FilledFileLink",j=>(0,u.hasContentType)(j)&&j.__TYPE__===e.FileLinkType,j=>(0,r.pipe)(C.decode(j),n.either.map(he=>e.FilledFileLinkContent.encode({...he,__TYPE__:e.FileLinkType}))),j=>C.encode(j));e.FilledFileLinkContent=i.intersection([i.strict({__TYPE__:i.literal(e.FileLinkType)}),C]);const T=i.intersection([i.union([C,i.strict({kind:i.literal("file")})]),i.exact(i.partial({text:i.string,variant:i.string}))]),I=new i.Type("FileLink",j=>(0,u.hasContentType)(j)&&j.__TYPE__===e.FileLinkType,j=>(0,r.pipe)(T.decode(j),n.either.map(he=>e.FileLinkContent.encode({...he,__TYPE__:e.FileLinkType}))),j=>T.encode(j));e.FileLinkContent=i.intersection([i.strict({__TYPE__:i.literal(e.FileLinkType)}),T]),e.MediaLinkType="MediaLink";const R=i.intersection([i.strict({kind:i.literal("media")}),i.exact(i.partial({text:i.string,variant:i.string}))]),O=new i.Type("MediaLink",j=>(0,u.hasContentType)(j)&&j.__TYPE__===e.MediaLinkType,j=>(0,r.pipe)(R.decode(j),n.either.map(he=>e.MediaLinkContent.encode({...he,__TYPE__:e.MediaLinkType}))),j=>R.encode(j));e.MediaLinkContent=i.intersection([i.strict({__TYPE__:i.literal(e.MediaLinkType)}),R]),e.DocumentLinkType="DocumentLink";const k=i.strict({id:s.NonEmptyString}),P=new i.Type("FilledDocumentLink",j=>(0,u.hasContentType)(j)&&j.__TYPE__===e.DocumentLinkType,j=>(0,r.pipe)(k.decode(j),n.either.map(he=>e.FilledDocumentLinkContent.encode({...he,__TYPE__:e.DocumentLinkType}))),j=>k.encode(j));e.FilledDocumentLinkContent=i.intersection([i.strict({__TYPE__:i.literal(e.DocumentLinkType)}),k]);const q=i.intersection([i.union([k,i.strict({kind:i.literal("document")})]),i.exact(i.partial({text:i.string,variant:i.string}))]),Y=new i.Type("DocumentLink",j=>(0,u.hasContentType)(j)&&j.__TYPE__===e.DocumentLinkType,j=>(0,r.pipe)(q.decode(j),n.either.map(he=>e.DocumentLinkContent.encode({...he,__TYPE__:e.DocumentLinkType}))),j=>q.encode(j));e.DocumentLinkContent=i.intersection([i.strict({__TYPE__:i.literal(e.DocumentLinkType)}),q]),e.ExternalLinkType="ExternalLink";const te=i.exact(i.intersection([i.type({url:i.string}),i.partial({kind:i.literal("web"),target:s.StringOrNull,preview:(0,c.nullable)(i.partial({title:i.string}))})])),G=new i.Type("FilledExternalLink",j=>(0,u.hasContentType)(j)&&j.__TYPE__===e.ExternalLinkType,j=>(0,r.pipe)(te.decode(j),n.either.map(he=>e.FilledExternalLinkContent.encode({...he,__TYPE__:e.ExternalLinkType}))),j=>te.encode(j));e.FilledExternalLinkContent=i.intersection([i.strict({__TYPE__:i.literal(e.ExternalLinkType)}),te]);const ee=i.intersection([i.union([te,i.strict({kind:i.literal("web")})]),i.exact(i.partial({text:i.string,variant:i.string}))]),ne=new i.Type("ExternalLink",j=>(0,u.hasContentType)(j)&&j.__TYPE__===e.ExternalLinkType,j=>(0,r.pipe)(ee.decode(j),n.either.map(he=>e.ExternalLinkContent.encode({...he,__TYPE__:e.ExternalLinkType}))),j=>ee.encode(j));e.ExternalLinkContent=i.intersection([i.strict({__TYPE__:i.literal(e.ExternalLinkType)}),ee]),e.AnyLinkType="AnyLink";const F=i.exact(i.intersection([i.type({kind:(0,o.withFallback)(i.literal("any"),"any")}),i.partial({text:i.string,variant:i.string})])),M=new i.Type("AnyLink",j=>(0,u.hasContentType)(j)&&j.__TYPE__===e.AnyLinkType,j=>(0,r.pipe)(F.decode(j),n.either.map(he=>e.AnyLinkContent.encode({...he,__TYPE__:e.AnyLinkType}))),j=>F.encode(j));e.AnyLinkContent=i.intersection([i.strict({__TYPE__:i.literal(e.AnyLinkType)}),F]),e.LinkContentType="LinkContent";const N=j=>(0,u.hasContentType)(j)&&j.__TYPE__===e.LinkContentType;e.isLinkContent=N,e.LinkLegacy=p(i.union([w,I,Y,ne,O,M]));const se=j=>new i.Type("LinkLegacy",e.isLinkContent,he=>(0,r.pipe)(e.LinkLegacy.decode(he),n.either.map(({key:kt,...Qt})=>e.LinkContent.encode({__TYPE__:"LinkContent",key:kt,value:Qt}))),({key:he,value:kt})=>({content:e.LinkLegacy.encode({...kt,key:he}),types:{[j.keyOfType]:"Link"}}));e.LinkContentLegacy=se,e.Link=i.union([e.ImageLinkContent,e.FileLinkContent,e.DocumentLinkContent,e.ExternalLinkContent,e.MediaLinkContent,e.AnyLinkContent]),e.LinkContent=p(i.strict({__TYPE__:i.literal(e.LinkContentType),value:e.Link}));const Oe=j=>(0,u.hasContentType)(j)&&j.__TYPE__===e.LinkContentType;e.isFilledLinkContent=Oe,e.FilledLinkLegacy=i.union([v,x,P,G]);const _e=j=>{const he=p(e.FilledLinkLegacy);return new i.Type("FilledLinkLegacy",e.isFilledLinkContent,kt=>(0,r.pipe)(he.decode(kt),n.either.map(({key:Qt,...fi})=>e.FilledLinkContent.encode({__TYPE__:"LinkContent",key:Qt,value:fi}))),({key:kt,value:Qt})=>({content:he.encode({...Qt,key:kt}),types:{[j.keyOfType]:"Link"}}))};e.FilledLinkContentLegacy=_e,e.FilledLink=i.union([e.FilledImageLinkContent,e.FilledFileLinkContent,e.FilledDocumentLinkContent,e.FilledExternalLinkContent]),e.FilledLinkContent=p(i.strict({__TYPE__:i.literal(e.LinkContentType),value:e.FilledLink}))}(bC)),bC}var Ui={},_C={},O2;function sH(){return O2||(O2=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.traverseRepeatableContent=e.RepeatableLegacy=e.isRepeatableContent=e.RepeatableContent=void 0;const t=Q,n=tt,r=Zt,i=Ve,o=(0,t.__importStar)(X),a=wt(),s=oS(),c="RepeatableContent";e.RepeatableContent=o.strict({__TYPE__:o.literal(c),type:o.literal("Link"),value:o.array(s.LinkContent)});const u=p=>(0,a.hasContentType)(p)&&p.__TYPE__===c;e.isRepeatableContent=u;const l=(p,h)=>new o.Type("RepeatableLegacy",e.isRepeatableContent,A=>(0,i.pipe)(o.array(o.unknown).decode(A),n.either.map(v=>({value:v.reduce((w,S)=>{let y;switch(h){case"Link":y=(0,s.LinkContentLegacy)(p).decode(S);break}return!y||(0,r.isLeft)(y)?w:[...w,y.right]},[]),type:h,__TYPE__:"RepeatableContent"}))),A=>({content:o.array(s.LinkContent).encode(A.value).reduce((b,w)=>{let S;switch(w.__TYPE__){case s.LinkContentType:S=(0,s.LinkContentLegacy)(p).encode(w);break}return S?[...b,S]:b},[]).map(b=>b.content),types:{[p.keyOfType]:`Repeatable.${h}`}}));e.RepeatableLegacy=l;function d({path:p,key:h,apiId:A,model:g,content:v}){return b=>{const w=v.value.reduce((S,y,C)=>{const x=p.concat([{key:C.toString(),type:"Widget"}]),T=(g==null?void 0:g.type)==="Link"&&g.config?{...g,config:{...g.config,repeat:!1}}:g,I=b({path:x,key:h,apiId:A,model:T,content:y});return!I||!(0,s.isLinkContent)(I)?S:S.concat(I)},[]);return b({path:p,key:h,apiId:A,model:g,content:{__TYPE__:v.__TYPE__,type:v.type,value:w}})}}e.traverseRepeatableContent=d}(_C)),_C}var TC={},IC={},M2;function F2(){return M2||(M2=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Block=e.BlockLegacy=e.TextBlockLegacy=e.TextBlock=e.checkEmbedBlock=e.EmbedBlock=e.checkImageBlock=e.ImageBlock=e.ValidatedSpans=e.SpanLegacy=e.Span=void 0;const t=Q,n=tt,r=Zt,i=Ve,o=(0,t.__importStar)(X),a=L1,s=Hm,c=it(),u=Je,l=oF(),d=aF(),p=oS(),h=R=>o.strict({data:R,start:o.number,end:o.number,type:o.literal(s.RichTextNodeType.hyperlink)}),A=o.strict({data:(0,a.withFallback)(o.string,""),start:o.number,end:o.number,type:o.literal("label")}),g=o.strict({start:o.number,end:o.number,type:o.keyof({[s.RichTextNodeType.strong]:null,[s.RichTextNodeType.em]:null,"list-item":null})});e.Span=o.union([h(p.FilledLink),A,g]),e.SpanLegacy=o.union([h(p.FilledLinkLegacy),A,g]);const v=R=>new o.Type("ValidatedSpans",O=>Array.isArray(O)&&O.every(R.is),(O,k)=>{if(Array.isArray(O)){const P=O.reduce((q,Y)=>{const te=R.decode(Y);return(0,r.isLeft)(te)?q:[...q,te.right]},[]).sort((q,Y)=>q.start-Y.start);return o.success(P)}else return o.failure(O,k)},O=>O.reduce((k,P)=>{const q=R.encode(P);return[...k,q]},[]));e.ValidatedSpans=v;const b=R=>o.exact(o.intersection([o.type({type:o.literal(s.RichTextNodeType.image),data:o.intersection([d.ImageContentView,o.partial({linkTo:(0,u.nullable)(R)})])}),o.partial({label:c.StringOrNull,direction:c.StringOrNull})]));e.ImageBlock=b(p.FilledLink);const w=b(p.FilledLinkLegacy);function S(R){return R.type===s.RichTextNodeType.image}e.checkImageBlock=S;const y=o.exact(o.intersection([o.type({type:o.literal(s.RichTextNodeType.embed),data:o.unknown}),o.partial({label:c.StringOrNull,direction:c.StringOrNull})])),C=new o.Type("EmbedBlockLegacy",R=>R.type==="embed",R=>(0,i.pipe)(y.decode(R),n.either.chain(O=>n.either.map(k=>[O,k])(l.EmbedContentLegacy.decode(O.data))),n.either.map(([O,k])=>e.EmbedBlock.encode({...O,data:{...k,__TYPE__:l.EmbedContentType,all:O.data}}))),R=>({...y.encode(R),data:l.EmbedContentLegacy.encode(R.data)}));e.EmbedBlock=o.exact(o.intersection([o.type({type:o.literal(s.RichTextNodeType.embed),data:l.EmbedContent}),o.partial({label:c.StringOrNull,direction:c.StringOrNull})]));function x(R){return R.type===s.RichTextNodeType.embed}e.checkEmbedBlock=x;const T=R=>o.exact(o.intersection([o.type({type:(0,u.refineType)(s.RichTextNodeTypeCodec,`string which isn't ${s.RichTextNodeType.image} ${s.RichTextNodeType.embed}`,O=>O!==s.RichTextNodeType.image&&O!==s.RichTextNodeType.embed),content:o.intersection([o.type({text:o.string}),o.partial({spans:(0,e.ValidatedSpans)(R)})])}),o.partial({label:o.string,direction:o.string})]));e.TextBlock=T(e.Span),e.TextBlockLegacy=T(e.SpanLegacy);const I=o.union([C,w,e.TextBlockLegacy]);e.BlockLegacy=new o.Type("BlockLegacy",R=>C.is(R)||w.is(R)||e.TextBlockLegacy.is(R),R=>I.decode(R),R=>(()=>e.ImageBlock.is(R)?w.encode(R):e.EmbedBlock.is(R)?C.encode(R):e.TextBlockLegacy.encode(R))()),e.Block=o.union([e.ImageBlock,e.EmbedBlock,e.TextBlock])}(IC)),IC}var L2;function cF(){return L2||(L2=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.RichTextLegacy=e.RichTextContent=e.RichTextLegacyContent=e.isRichTextContent=e.RichTextContentType=void 0;const t=Q,n=tt,r=Ve,i=(0,t.__importStar)(X),o=wt(),a=F2();e.RichTextContentType="StructuredTextContent";const s=u=>(0,o.hasContentType)(u)&&u.__TYPE__===e.RichTextContentType;e.isRichTextContent=s,e.RichTextLegacyContent=i.array(a.BlockLegacy),e.RichTextContent=i.strict({__TYPE__:i.literal(e.RichTextContentType),value:i.array(a.Block)}),(0,t.__exportStar)(F2(),e);const c=u=>new i.Type("RichTextLegacy",e.isRichTextContent,l=>(0,r.pipe)(e.RichTextLegacyContent.decode(l),n.either.map(d=>({value:d,__TYPE__:e.RichTextContentType}))),l=>({content:e.RichTextLegacyContent.encode(l.value),types:{[u.keyOfType]:"StructuredText"}}));e.RichTextLegacy=c}(TC)),TC}var EC={},B2;function cH(){return B2||(B2=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SeparatorContent=e.SeparatorLegacy=e.isSeparatorContent=e.SeparatorContentType=void 0;const n=(0,Q.__importStar)(X),r=wt();e.SeparatorContentType="SeparatorContent";const i=a=>(0,r.hasContentType)(a)&&a.__TYPE__===e.SeparatorContentType;e.isSeparatorContent=i;const o=a=>new n.Type("SeparatorLegacy",e.isSeparatorContent,()=>n.success(e.SeparatorContent.encode({__TYPE__:e.SeparatorContentType})),()=>({content:{},types:{[a.keyOfType]:"Separator"}}));e.SeparatorLegacy=o,e.SeparatorContent=n.strict({__TYPE__:n.literal(e.SeparatorContentType)})}(EC)),EC}var RC={},D2;function uH(){return D2||(D2=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.traverseTableContent=e.TableLegacy=e.TableContent=e.isTableContent=e.TableContentType=void 0;const t=Q,n=tt,r=Ve,i=(0,t.__importStar)(X),o=de,a=wt(),s=cF();e.TableContentType="TableContent";const c=v=>(0,a.hasContentType)(v)&&v.__TYPE__===e.TableContentType;e.isTableContent=c;const u=i.strict({type:i.union([i.literal("tableHeader"),i.literal("tableCell")]),content:s.RichTextContent}),l=i.strict({type:i.literal("tableRow"),content:i.array(u)});e.TableContent=i.strict({__TYPE__:i.literal(e.TableContentType),content:i.array(l)});const d=i.strict({type:i.union([i.literal("tableHeader"),i.literal("tableCell")]),content:s.RichTextLegacyContent}),p=i.strict({type:i.literal("tableRow"),content:i.array(d)}),h=i.strict({content:i.array(p)}),A=v=>new i.Type("TableLegacy",e.isTableContent,b=>(0,r.pipe)(h.decode(b),n.either.map(w=>({__TYPE__:"TableContent",content:w.content.map(S=>({...S,content:S.content.map(y=>({...y,content:{__TYPE__:"StructuredTextContent",value:y.content}}))}))}))),b=>({content:h.encode({content:b.content.map(w=>({...w,content:w.content.map(S=>({...S,content:S.content.value}))}))}),types:{[v.keyOfType]:"Table"}}));e.TableLegacy=A;function g({path:v,key:b,apiId:w,model:S,content:y}){return C=>{const x=y.content.map((T,I)=>({...T,content:T.content.map((R,O)=>{const k=v.concat([{key:[I.toString(),O.toString()].join(","),type:"Widget"}]),P=C({path:k,key:b,apiId:w,model:o.TableCell,content:{__TYPE__:R.content.__TYPE__,value:R.content.value}})||{__TYPE__:"StructuredTextContent",value:[]};return{...R,content:P}})}));return C({path:v,key:b,apiId:w,model:S,content:{__TYPE__:y.__TYPE__,content:x}})}}e.traverseTableContent=g}(RC)),RC}var j2;function oLe(){if(j2)return Ui;j2=1,Object.defineProperty(Ui,"__esModule",{value:!0}),Ui.NestableLegacy=Ui.isNestableContent=Ui.NestableContentDefaultValue=Ui.NestableContent=void 0;const e=Q,t=Zt,n=(0,e.__importStar)(X),r=YQ(),i=GQ(),o=oF(),a=JQ(),s=Di,c=ZQ(),u=aF(),l=XQ(),d=oS(),p=sH(),h=cF(),A=cH(),g=uH();Ui.NestableContent=n.union([r.EmptyContent,i.BooleanContent,o.EmbedContent,a.TextContent,a.TimestampContent,a.SelectContent,a.RangeContent,a.NumberContent,a.DateContent,a.ColorContent,c.GeoPointContent,u.ImageContent,l.IntegrationFieldContent,d.LinkContent,h.RichTextContent,A.SeparatorContent,g.TableContent,p.RepeatableContent]);const v=S=>{switch(S.type){case"Boolean":return(0,i.BooleanContentDefaultValue)(S);case"Select":return(0,a.SelectContentDefaultValue)(S);default:return}};Ui.NestableContentDefaultValue=v;const b=S=>(0,a.isTextContent)(S)||(0,a.isColorContent)(S)||(0,a.isDateContent)(S)||(0,a.isTimestampContent)(S)||(0,a.isNumberContent)(S)||(0,a.isRangeContent)(S)||(0,a.isSelectContent)(S)||(0,c.isGeoPointContent)(S)||(0,h.isRichTextContent)(S)||(0,i.isBooleanContent)(S)||(0,o.isEmbedContent)(S)||(0,u.isImageContent)(S)||(0,l.isIntegrationFieldContent)(S)||(0,d.isLinkContent)(S)||(0,A.isSeparatorContent)(S)||(0,g.isTableContent)(S)||(0,r.isEmptyContent)(S)||(0,p.isRepeatableContent)(S);Ui.isNestableContent=b;const w=S=>({decode(y){if(!S.fieldType)return;const C=(0,r.EmptyLegacy)(S.fieldType).decode(y);if((0,t.isRight)(C))return C;const x=(()=>{switch(S.fieldType){case"Text":return(0,a.TextLegacy)(S);case"Color":return(0,a.ColorLegacy)(S);case"Date":return(0,a.DateLegacy)(S);case"Timestamp":return(0,a.TimestampLegacy)(S);case"Number":return(0,a.NumberLegacy)(S);case"Range":return(0,a.RangeLegacy)(S);case"Select":return(0,a.SelectLegacy)(S);case"GeoPoint":return(0,c.GeoPointLegacy)(S);case"StructuredText":return(0,h.RichTextLegacy)(S);case"Boolean":return(0,i.BooleanLegacy)(S);case"Embed":return(0,o.EmbedLegacy)(S);case"Image":return(0,u.ImageLegacy)(S);case"IntegrationFields":return(0,l.IntegrationFieldLegacy)(S);case"Link":return(0,d.LinkContentLegacy)(S);case"Separator":return(0,A.SeparatorLegacy)(S);case"Table":return(0,g.TableLegacy)(S);case"Repeatable.Link":return(0,p.RepeatableLegacy)(S,"Link");default:return}})();if(x)return x.decode(y)},encode(y){switch(y.__TYPE__){case s.FieldContentType:return y.type==="Text"?(0,a.TextLegacy)(S).encode(y):y.type==="Color"?(0,a.ColorLegacy)(S).encode(y):y.type==="Range"?(0,a.RangeLegacy)(S).encode(y):y.type==="Date"?(0,a.DateLegacy)(S).encode(y):y.type==="Number"?(0,a.NumberLegacy)(S).encode(y):y.type==="Timestamp"?(0,a.TimestampLegacy)(S).encode(y):y.type==="Select"?(0,a.SelectLegacy)(S).encode(y):void 0;case c.GeoPointContentType:return(0,c.GeoPointLegacy)(S).encode(y);case h.RichTextContentType:return(0,h.RichTextLegacy)(S).encode(y);case o.EmbedContentType:return(0,o.EmbedLegacy)(S).encode(y);case i.BooleanContentType:return(0,i.BooleanLegacy)(S).encode(y);case u.ImageContentType:return(0,u.ImageLegacy)(S).encode(y);case l.IntegrationFieldContentType:return(0,l.IntegrationFieldLegacy)(S).encode(y);case d.LinkContentType:return(0,d.LinkContentLegacy)(S).encode(y);case A.SeparatorContentType:return(0,A.SeparatorLegacy)(S).encode(y);case g.TableContentType:return(0,g.TableLegacy)(S).encode(y);case"RepeatableContent":return(0,p.RepeatableLegacy)(S,y.type).encode(y);default:return}}});return Ui.NestableLegacy=w,Ui}var U2;function ia(){return U2||(U2=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=Q;(0,t.__exportStar)(GQ(),e),(0,t.__exportStar)(oF(),e),(0,t.__exportStar)(JQ(),e),(0,t.__exportStar)(ZQ(),e),(0,t.__exportStar)(aF(),e),(0,t.__exportStar)(XQ(),e),(0,t.__exportStar)(oS(),e),(0,t.__exportStar)(oLe(),e),(0,t.__exportStar)(sH(),e),(0,t.__exportStar)(cF(),e),(0,t.__exportStar)(cH(),e),(0,t.__exportStar)(uH(),e)}(aC)),aC}var ca={},P2;function aS(){if(P2)return ca;P2=1,Object.defineProperty(ca,"__esModule",{value:!0}),ca.repeatableContentWithDefaultNestableContentValues=ca.withDefaultNestableContentValues=ca.withDefaultSlicePrimaryContentValues=void 0;const e=de,t=ds(),n=ia();function r(a,s){const c=s;for(const[u,l]of Object.entries(a)){const d=s[u];if(d===void 0){if(l.type===e.GroupFieldType)c[u]=(0,t.groupContentWithDefaultValues)(l,t.GroupContentDefaultValue);else{const p=(0,n.NestableContentDefaultValue)(l);p&&(c[u]=p)}continue}l.type===e.GroupFieldType&&(0,t.isGroupContent)(d)&&(c[u]=(0,t.groupContentWithDefaultValues)(l,d))}return c}ca.withDefaultSlicePrimaryContentValues=r;function i(a,s){return Object.entries(a).reduce((c,[u,l])=>{if(s[u]===void 0){const d=(0,n.NestableContentDefaultValue)(l);return d!==void 0?{...c,[u]:d}:c}return c},s)}ca.withDefaultNestableContentValues=i;function o(a,s){const c=Object.entries(a);return s.map(u=>c.reduce((l,[d,p])=>{var h;const A=u.value.find(([g])=>g===d);if(p.type==="Group"){const g=(0,t.groupContentWithDefaultValues)(p,(h=A==null?void 0:A[1])!==null&&h!==void 0?h:{__TYPE__:t.GroupContentType,value:[]});return{...l,value:[...l.value.filter(([v])=>v!==d),...g?[[d,g]]:[]]}}else if(!A){const g=(0,n.NestableContentDefaultValue)(p);return{...l,value:[...l.value,...g?[[d,g]]:[]]}}return l},u))}return ca.repeatableContentWithDefaultNestableContentValues=o,ca}var N2;function ds(){return N2||(N2=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.traverseGroupItemsContent=e.traverseGroupContent=e.groupContentWithDefaultValues=e.GroupLegacy=e.GroupItemLegacy=e.GroupContentDefaultValue=e.isGroupContent=e.GroupContent=e.GroupItemContent=e.GroupContentType=e.GroupItemContentType=void 0;const t=Q,n=tt,r=Zt,i=Ve,o=(0,t.__importStar)(X),a=de,s=er,c=wt(),u=ia(),l=aS();e.GroupItemContentType="GroupItemContent",e.GroupContentType="GroupContentType",e.GroupItemContent=o.recursion("GroupItemContent",()=>o.strict({__TYPE__:o.literal(e.GroupItemContentType),value:o.array(o.tuple([o.string,o.union([u.NestableContent,e.GroupContent])]))})),e.GroupContent=o.recursion("GroupContent",()=>o.strict({__TYPE__:o.literal(e.GroupContentType),value:o.array(e.GroupItemContent)}));const d=w=>(0,c.hasContentType)(w)&&w.__TYPE__===e.GroupContentType;e.isGroupContent=d,e.GroupContentDefaultValue={__TYPE__:e.GroupContentType,value:[]};const p=o.record(o.string,o.unknown),h=w=>new o.Type("GroupItemLegacy",S=>(0,c.hasContentType)(S)&&S.__TYPE__===e.GroupItemContentType,S=>(0,i.pipe)(p.decode(S),n.either.map(C=>({value:Object.entries(C).reduce((T,[I,R])=>{const O=(0,s.getFieldCtx)(I,w),k=O.fieldType===a.GroupFieldType?(0,e.GroupLegacy)(O).decode(R):(0,u.NestableLegacy)(O).decode(R);return!k||(0,r.isLeft)(k)?T:[...T,[I,k.right]]},[]),__TYPE__:e.GroupItemContentType}))),S=>S.value.reduce((y,[C,x])=>{const T=(0,s.getFieldCtx)(C,w),I=(0,e.isGroupContent)(x)?(0,e.GroupLegacy)(T).encode(x):(0,u.NestableLegacy)(T).encode(x);return I?{content:{...y.content,[C]:I.content},types:{...y.types,...I.types}}:y},{content:{},types:{}}));e.GroupItemLegacy=h;const A=w=>{const S=o.array(o.union([o.null,(0,e.GroupItemLegacy)(w)])),y=o.array((0,e.GroupItemLegacy)(w));return new o.Type("GroupLegacy",e.isGroupContent,C=>(0,i.pipe)(S.decode(C),n.either.map(x=>({value:x.map(T=>T===null?{__TYPE__:e.GroupItemContentType,value:[]}:T),__TYPE__:e.GroupContentType}))),C=>{const x=y.encode(C.value);return{content:x.map(T=>T.content),types:x.reduce((T,I)=>({...T,...I.types}),{[w.keyOfType]:a.GroupFieldType})}})};e.GroupLegacy=A;function g(w,S){var y;const C=(y=w.config)===null||y===void 0?void 0:y.fields;return C?{...S,value:(0,l.repeatableContentWithDefaultNestableContentValues)(C,S.value)}:S}e.groupContentWithDefaultValues=g;function v({path:w,key:S,apiId:y,model:C,content:x}){return T=>{var I;const R=b({path:w,model:(I=C==null?void 0:C.config)===null||I===void 0?void 0:I.fields,content:x.value})(T);return T({path:w,key:S,apiId:y,model:C,content:{__TYPE__:x.__TYPE__,value:R}})}}e.traverseGroupContent=v;function b({path:w,model:S,content:y}){return C=>y.map((x,T)=>{const I=w.concat([{key:T.toString(),type:"GroupItem"}]),R=x.value.reduce((O,[k,P])=>{const q=S==null?void 0:S[k];let Y;return(0,e.isGroupContent)(P)?Y=v({path:I.concat([{key:k,type:"Widget"}]),key:k,apiId:k,model:(q==null?void 0:q.type)==="Group"?q:void 0,content:P})(C):(0,u.isRepeatableContent)(P)?Y=(0,u.traverseRepeatableContent)({path:I.concat([{key:k,type:"Widget"}]),key:k,apiId:k,model:(q==null?void 0:q.type)==="Link"?q:void 0,content:P})(C):(0,u.isTableContent)(P)?Y=(0,u.traverseTableContent)({path:I.concat([{key:k,type:"Widget"}]),key:k,apiId:k,model:(q==null?void 0:q.type)==="Table"?q:void 0,content:P})(C):Y=C({path:I.concat([{key:k,type:"Widget"}]),key:k,apiId:k,model:q,content:P}),!Y||!((0,u.isNestableContent)(Y)||(0,e.isGroupContent)(Y))?O:O.concat([[k,Y]])},[]);return{__TYPE__:x.__TYPE__,value:R}})}e.traverseGroupItemsContent=b}(iC)),iC}var $C={},kC={},OC={},Dc={},W2;function lH(){if(W2)return Dc;W2=1,Object.defineProperty(Dc,"__esModule",{value:!0}),Dc.RepeatableWidgets=Dc.RepeatableWidgetsLegacy=void 0;const t=(0,Q.__importStar)(X),n=ds(),r=ia(),i=s=>t.array((0,n.GroupItemLegacy)(s));Dc.RepeatableWidgetsLegacy=i;const o=t.tuple([t.string,t.union([r.NestableContent,n.GroupContent])]),a=t.strict({__TYPE__:t.literal(n.GroupItemContentType),value:t.array(o)});return Dc.RepeatableWidgets=t.array(a),Dc}var K2;function Rv(){return K2||(K2=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.migrateCompositeSlice=e.traverseCompositeSliceContent=e.compositeSliceContentWithDefaultValues=e.CompositeSliceContent=e.CompositeSliceLegacy=e.isCompositeSliceContent=e.CompositeSliceContentType=void 0;const t=Q,n=tt,r=Zt,i=Ve,o=(0,t.__importStar)(X),a=er,s=wt(),c=ds(),u=ia(),l=aS(),d=lH();e.CompositeSliceContentType="CompositeSliceContent";const p=w=>(0,s.hasContentType)(w)&&w.__TYPE__===e.CompositeSliceContentType;e.isCompositeSliceContent=p;const h=o.exact(o.partial({repeat:o.array(o.unknown),"non-repeat":o.UnknownRecord})),A=w=>new o.Type("CompositeSliceLegacy",e.isCompositeSliceContent,S=>(0,i.pipe)(h.decode(S),n.either.map(y=>{const C=(()=>{const T=(0,a.getFieldCtx)("repeat",w),I=(0,d.RepeatableWidgetsLegacy)(T).decode(y.repeat);if(!(!I||(0,r.isLeft)(I)))return I.right})()||[];return{nonRepeat:Object.entries(y["non-repeat"]||{}).reduce((T,[I,R])=>{const O=(0,a.getFieldCtx)(I,w,["non-repeat"]);if(!O)return T;const k=(0,u.NestableLegacy)(O).decode(R);return!k||(0,r.isLeft)(k)?T:{...T,[I]:k.right}},{}),repeat:C,__TYPE__:e.CompositeSliceContentType}})),S=>{const y=Object.entries(S.nonRepeat).reduce((x,[T,I])=>{const R=(0,a.getFieldCtx)(T,w,["non-repeat"]),O=(0,u.NestableLegacy)(R).encode(I);return O?{content:{...x.content,[T]:O.content},types:{...x.types,...O.types}}:x},{content:{},types:{}}),C=(()=>{const x=(0,a.getFieldCtx)("repeat",w);return(0,d.RepeatableWidgetsLegacy)(x).encode(S.repeat)})()||[];return{content:{"non-repeat":y.content,repeat:C.map(x=>x.content)},types:{[w.keyOfType]:"Slice",...y.types,...C.reduce((x,T)=>({...x,...T.types}),{})}}});e.CompositeSliceLegacy=A,e.CompositeSliceContent=o.strict({__TYPE__:o.literal(e.CompositeSliceContentType),nonRepeat:o.record(o.string,u.NestableContent),repeat:d.RepeatableWidgets});function g(w,S){var y,C;const x=(0,l.withDefaultNestableContentValues)((y=w["non-repeat"])!==null&&y!==void 0?y:{},S.nonRepeat),T=(0,l.repeatableContentWithDefaultNestableContentValues)((C=w.repeat)!==null&&C!==void 0?C:{},S.repeat);return{...S,nonRepeat:x,repeat:T}}e.compositeSliceContentWithDefaultValues=g;function v({path:w,sliceKey:S,sliceName:y,model:C,content:x}){return(T,I)=>{const R=Object.entries(x.widget.nonRepeat).reduce((k,[P,q])=>{const Y=(()=>{var G,ee,ne;return(C==null?void 0:C.type)==="SharedSlice"?(ee=(G=C==null?void 0:C.fields)===null||G===void 0?void 0:G.primary)===null||ee===void 0?void 0:ee[P]:(ne=C==null?void 0:C["non-repeat"])===null||ne===void 0?void 0:ne[P]})(),te=T({path:w.concat([{key:"non-repeat",type:"primary"},{key:P,type:"Widget"}]),key:P,apiId:y,model:Y,content:q});return te?(0,u.isNestableContent)(te)?{...k,[P]:te}:(console.warn(`Warn: Non nestable content with key [${P}] detected in a composite slice [${y}] with key [${S}]`),k):k},{}),O=(0,c.traverseGroupItemsContent)({path:w.concat([{key:"repeat",type:"items"}]),model:(C==null?void 0:C.type)==="SharedSlice"?C==null?void 0:C.fields.items:C==null?void 0:C.repeat,content:x.widget.repeat})(T);return I({key:S,apiId:y,path:w,model:C,content:{...x,widget:{__TYPE__:"CompositeSliceContent",repeat:O,nonRepeat:R}}})}}e.traverseCompositeSliceContent=v;function b(w,S){const[,y]=S.key.split("$");return{key:`${w.sliceName}$${y}`,name:w.sliceName,maybeLabel:S.maybeLabel,widget:{__TYPE__:"SharedSliceContent",variation:w.variationId,primary:Object.entries(S.widget.nonRepeat).reduce((C,[x,T])=>{var I;return!((I=w.fields.primary)===null||I===void 0)&&I[x]?{...C,[x]:T}:(console.warn(`The widget ${x} in the non-repeat zone of the composite slice [${w.sliceName}] with key [${S.key}] doesn't exist in the model.`),C)},{}),items:S.widget.repeat.map(C=>({__TYPE__:"GroupItemContent",value:C.value.reduce((x,[T,I])=>{var R;return!((R=w.fields.items)===null||R===void 0)&&R[T]?x.concat([[T,I]]):(console.warn(`The widget ${T} in the repeat zone of the composite slice [${w.sliceName}] with key [${S.key}] doesn't exist in the model.`),x)},[])}),[])}}}e.migrateCompositeSlice=b}(OC)),OC}var MC={},ua={},q2;function dH(){if(q2)return ua;q2=1,Object.defineProperty(ua,"__esModule",{value:!0}),ua.isSlicePrimaryContent=ua.SlicePrimaryLegacy=ua.SlicePrimaryContent=void 0;const t=(0,Q.__importStar)(X),n=de,r=ds(),i=ia();ua.SlicePrimaryContent=t.union([i.NestableContent,r.GroupContent]);const o=s=>{const c=(0,r.GroupLegacy)(s),u=(0,i.NestableLegacy)(s);return{decode(l){return s.fieldType===n.GroupFieldType?c.decode(l):u.decode(l)},encode(l){return(0,r.isGroupContent)(l)?c.encode(l):u.encode(l)}}};ua.SlicePrimaryLegacy=o;const a=s=>(0,i.isNestableContent)(s)||(0,r.isGroupContent)(s);return ua.isSlicePrimaryContent=a,ua}var V2;function $v(){return V2||(V2=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.traverseSharedSliceContent=e.sharedSliceContentWithDefaultValues=e.SharedSliceContent=e.SharedSliceLegacy=e.isSharedSliceContent=e.SharedSliceContentType=void 0;const t=Q,n=tt,r=Zt,i=Ve,o=(0,t.__importStar)(X),a=L1,s=de,c=er,u=wt(),l=ds(),d=ia(),p=aS(),h=lH(),A=dH();e.SharedSliceContentType="SharedSliceContent";const g=y=>(0,u.hasContentType)(y)&&y.__TYPE__===e.SharedSliceContentType;e.isSharedSliceContent=g;const v=o.exact(o.type({variation:o.string,items:(0,a.withFallback)(o.array(o.unknown),[]),primary:(0,a.withFallback)(o.UnknownRecord,{})})),b=y=>new o.Type("SharedSliceLegacy",e.isSharedSliceContent,C=>(0,i.pipe)(v.decode(C),n.either.map(x=>{const T=(()=>{const R=(0,c.getFieldCtx)("items",y,["variations",x.variation]),O=(0,h.RepeatableWidgetsLegacy)(R).decode(x.items);if(!(!O||(0,r.isLeft)(O)))return O.right})()||[],I=Object.entries(x.primary).reduce((R,[O,k])=>{const P=(0,c.getFieldCtx)(O,y,["variations",x.variation,"primary"]),q=(0,A.SlicePrimaryLegacy)(P).decode(k);return!q||(0,r.isLeft)(q)?R:{...R,[O]:q.right}},{});return{variation:x.variation,primary:I,items:T,__TYPE__:e.SharedSliceContentType}})),C=>{const x=Object.entries(C.primary).reduce((I,[R,O])=>{const k=(0,c.getFieldCtx)(R,y,["variations",C.variation,"primary"]),P=(0,A.SlicePrimaryLegacy)(k).encode(O);return P?{content:{...I.content,[R]:P.content},types:{...I.types,...P.types}}:I},{content:{},types:{}}),T=(()=>{const I=(0,c.getFieldCtx)("items",y,["variations",C.variation]);return(0,h.RepeatableWidgetsLegacy)(I).encode(C.items)})()||[];return{content:{primary:x.content,items:T.map(I=>I.content),variation:C.variation},types:{[y.keyOfType]:"SharedSlice",...x.types,...T.reduce((I,R)=>({...I,...R.types}),{})}}});e.SharedSliceLegacy=b,e.SharedSliceContent=o.strict({__TYPE__:o.literal(e.SharedSliceContentType),variation:o.string,primary:o.record(o.string,A.SlicePrimaryContent),items:h.RepeatableWidgets});function w(y,C){var x,T;const I=y.variations.find(q=>q.id===C.variation),R=(x=I==null?void 0:I.primary)!==null&&x!==void 0?x:{},O=(T=I==null?void 0:I.items)!==null&&T!==void 0?T:{},k=(0,p.withDefaultSlicePrimaryContentValues)(R,C.primary),P=(0,p.repeatableContentWithDefaultNestableContentValues)(O,C.items);return{...C,primary:k,items:P}}e.sharedSliceContentWithDefaultValues=w;function S({path:y,sliceKey:C,sliceName:x,model:T,content:I}){return(R,O)=>{const k=Object.entries(I.widget.primary).reduce((q,[Y,te])=>{var G,ee;const ne=(ee=(G=T==null?void 0:T.fields)===null||G===void 0?void 0:G.primary)===null||ee===void 0?void 0:ee[Y],F=(()=>(0,l.isGroupContent)(te)?(0,l.traverseGroupContent)({path:y.concat([{key:"primary",type:"primary"},{key:Y,type:"Widget"}]),key:Y,apiId:Y,content:te,model:(ne==null?void 0:ne.type)===s.GroupFieldType?ne:void 0})(R):(0,d.isRepeatableContent)(te)?(0,d.traverseRepeatableContent)({path:y.concat([{key:"primary",type:"primary"},{key:Y,type:"Widget"}]),key:Y,apiId:Y,content:te,model:(ne==null?void 0:ne.type)==="Link"?ne:void 0})(R):(0,d.isTableContent)(te)?(0,d.traverseTableContent)({path:y.concat([{key:"primary",type:"primary"},{key:Y,type:"Widget"}]),key:Y,apiId:Y,content:te,model:(ne==null?void 0:ne.type)==="Table"?ne:void 0})(R):(0,d.isNestableContent)(te)?R({path:y.concat([{key:"primary",type:"primary"},{key:Y,type:"Widget"}]),key:Y,apiId:Y,model:ne,content:te}):void 0)();return F?((0,A.isSlicePrimaryContent)(F)||console.warn(`Warn: Non nestable or group content with key [${Y}] detected in a shared slice [${x}] with key [${C}]`),{...q,[Y]:F}):q},{}),P=(0,l.traverseGroupItemsContent)({path:y.concat([{key:"items",type:"items"}]),model:T==null?void 0:T.fields.items,content:I.widget.items})(R);return O({key:C,apiId:x,path:y,model:T,content:{...I,widget:{__TYPE__:"SharedSliceContent",variation:I.widget.variation,primary:k,items:P}}})}}e.traverseSharedSliceContent=S}(MC)),MC}var Fr={},z2;function kv(){if(z2)return Fr;z2=1,Object.defineProperty(Fr,"__esModule",{value:!0}),Fr.migrateSimpleSlice=Fr.traverseSimpleSliceContent=Fr.SimpleSliceLegacy=Fr.isSimpleSliceContent=Fr.SimpleSliceContent=void 0;const t=(0,Q.__importStar)(X),n=ds(),r=ia();Fr.SimpleSliceContent=t.union([r.NestableContent,n.GroupContent]);const i=c=>(0,r.isNestableContent)(c)||(0,n.isGroupContent)(c);Fr.isSimpleSliceContent=i;const o=c=>({decode:(()=>c.fieldType==="Group"?(0,n.GroupLegacy)(c).decode.bind(null):(0,r.NestableLegacy)(c).decode.bind(null))(),encode:u=>{switch(u.__TYPE__){case"GroupContentType":return(0,n.GroupLegacy)(c).encode(u);default:return(0,r.NestableLegacy)(c).encode(u)}}});Fr.SimpleSliceLegacy=o;function a({path:c,sliceKey:u,sliceName:l,model:d,content:p}){return(h,A)=>{if((0,n.isGroupContent)(p.widget)){const v=(0,n.traverseGroupContent)({path:c,key:p.key,apiId:p.name,model:(()=>{if((d==null?void 0:d.type)==="Group")return d;if((d==null?void 0:d.type)==="SharedSlice")return{type:"Group",config:{fields:d.fields.items||{}}}})(),content:p.widget})(h);return v&&A({key:p.key,apiId:p.name,path:c,model:d,content:{...p,widget:v}})}const g=h({key:p.key,apiId:p.name,path:c,model:(()=>{var v;if((d==null?void 0:d.type)==="SharedSlice")return(v=d.fields.primary)===null||v===void 0?void 0:v[p.name];if((d==null?void 0:d.type)!=="Group")return d})(),content:p.widget});return g&&A({key:u,apiId:l,path:c,model:d,content:{...p,widget:g}})}}Fr.traverseSimpleSliceContent=a;function s(c,u){var l;const[,d]=u.key.split("$"),p=`${c.sliceName}$${d}`;return u.widget.__TYPE__==="GroupContentType"?{key:p,name:c.sliceName,maybeLabel:u.maybeLabel,widget:{__TYPE__:"SharedSliceContent",variation:c.variationId,primary:{},items:u.widget.value.map(h=>({__TYPE__:"GroupItemContent",value:h.value.reduce((A,[g,v])=>{var b;return!((b=c.fields.items)===null||b===void 0)&&b[g]?A.concat([[g,v]]):A},[])}),[])}}:{key:p,name:c.sliceName,maybeLabel:u.maybeLabel,widget:{__TYPE__:"SharedSliceContent",variation:c.variationId,primary:!((l=c.fields.primary)===null||l===void 0)&&l[u.name]?{[u.name]:u.widget}:{},items:[]}}}return Fr.migrateSimpleSlice=s,Fr}var Q2;function fH(){return Q2||(Q2=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SliceContent=e.SliceLegacy=void 0;const t=Q,n=(0,t.__importStar)(X),r=Rv(),i=$v(),o=kv(),a=s=>({decode:c=>(()=>{switch(s.fieldType){case"Slice":return(0,r.CompositeSliceLegacy)(s);case"SharedSlice":return(0,i.SharedSliceLegacy)(s);default:return(0,o.SimpleSliceLegacy)(s)}})().decode(c),encode:c=>{switch(c.__TYPE__){case"SharedSliceContent":return(0,i.SharedSliceLegacy)(s).encode(c);case"CompositeSliceContent":return(0,r.CompositeSliceLegacy)(s).encode(c);default:return(0,o.SimpleSliceLegacy)(s).encode(c)}}});e.SliceLegacy=a,e.SliceContent=n.union([r.CompositeSliceContent,i.SharedSliceContent,o.SimpleSliceContent]),(0,t.__exportStar)(Rv(),e),(0,t.__exportStar)($v(),e),(0,t.__exportStar)(kv(),e),(0,t.__exportStar)(dH(),e)}(kC)),kC}var pn={},H2;function pH(){if(H2)return pn;H2=1,Object.defineProperty(pn,"__esModule",{value:!0}),pn.migrateSliceItem=pn.SlicesItemLegacy=pn.sliceItemContentWithDefaultValues=pn.isSimpleSliceItemContent=pn.isCompositeSliceItemContent=pn.isSharedSliceItemContent=pn.SliceItemContent=void 0;const e=Q,t=tt,n=Zt,r=Ve,i=(0,e.__importStar)(X),o=Je,a=er,s=ds(),c=ia(),u=aS(),l=fH(),d=Rv(),p=$v(),h=kv();pn.SliceItemContent=i.type({key:i.string,name:i.string,maybeLabel:i.union([i.string,i.undefined]),widget:l.SliceContent});function A(C){return(0,p.isSharedSliceContent)(C.widget)}pn.isSharedSliceItemContent=A;function g(C){return(0,d.isCompositeSliceContent)(C.widget)}pn.isCompositeSliceItemContent=g;function v(C){return(0,s.isGroupContent)(C.widget)||(0,c.isNestableContent)(C.widget)}pn.isSimpleSliceItemContent=v;function b(C,x){var T;if(C.type==="SharedSlice"&&(0,p.isSharedSliceContent)(x))return(0,l.sharedSliceContentWithDefaultValues)(C,x);if(C.type==="Slice"&&(0,d.isCompositeSliceContent)(x))return(0,l.compositeSliceContentWithDefaultValues)(C,x);if(C.type==="Group"&&(0,s.isGroupContent)(x)&&(!((T=C.config)===null||T===void 0)&&T.fields)){const I=(0,u.repeatableContentWithDefaultNestableContentValues)(C.config.fields,x.value);return{...x,value:I}}return x}pn.sliceItemContentWithDefaultValues=b;const w=i.exact(i.intersection([i.type({key:i.string,value:i.unknown}),i.partial({label:(0,o.nullable)(i.string)})])),S=C=>new i.Type("SlicesItemLegacy",x=>((0,p.isSharedSliceContent)(x.widget),(0,d.isCompositeSliceContent)(x.widget),(0,h.isSimpleSliceContent)(x.widget)),(x,T)=>(0,r.pipe)(w.decode(x),t.either.chain(I=>{var R;const O=I.key.indexOf("$"),k=I.key.substring(0,O>0?O:void 0),P=(0,a.getFieldCtx)(k,C),q=(0,l.SliceLegacy)(P).decode(I.value);return!q||(0,n.isLeft)(q)?i.failure(x,T):i.success({key:I.key,name:k,maybeLabel:(R=I.label)!==null&&R!==void 0?R:void 0,widget:q.right})})),x=>{const T=(0,a.getFieldCtx)(x.name,C),I=(0,l.SliceLegacy)(T).encode(x.widget);return{content:{key:x.key,label:x.maybeLabel,value:(I==null?void 0:I.content)||{}},types:(I==null?void 0:I.types)||{}}});pn.SlicesItemLegacy=S;const y=({model:C,content:x})=>g(x)&&(C==null?void 0:C.type)==="SharedSlice"?(0,d.migrateCompositeSlice)(C,x):v(x)&&(C==null?void 0:C.type)==="SharedSlice"?(0,h.migrateSimpleSlice)(C,x):x;return pn.migrateSliceItem=y,pn}var FC={},Y2;function aLe(){return Y2||(Y2=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.traverseSlices=e.slicesContentWithDefaultValues=e.SlicesContent=e.SlicesLegacy=e.isSlicesContent=e.SlicesContentType=void 0;const t=Q,n=tt,r=Ve,i=(0,t.__importStar)(X),o=qm,a=de,s=wt(),c=Rv(),u=$v(),l=kv(),d=pH();e.SlicesContentType="SliceContentType";const p=b=>(0,s.hasContentType)(b)&&b.__TYPE__===e.SlicesContentType;e.isSlicesContent=p;const h=b=>{const w=i.array((0,d.SlicesItemLegacy)(b));return new i.Type("SlicesLegacy",e.isSlicesContent,S=>(0,r.pipe)(w.decode(S),n.either.map(y=>({__TYPE__:e.SlicesContentType,value:y}))),S=>{const y=w.encode(S.value);return{content:y.map(C=>C.content),types:y.reduce((C,x)=>({...C,...x.types}),{[b.keyOfType]:"Slices"})}})};e.SlicesLegacy=h,e.SlicesContent=i.type({__TYPE__:i.literal(e.SlicesContentType),value:i.array(d.SliceItemContent)});function A(b,w){var S;const y=(S=b==null?void 0:b.config)===null||S===void 0?void 0:S.choices;if(y===void 0)return w;const C=w.value.map(x=>{const T=y[x.name];if(T){const I=(0,d.sliceItemContentWithDefaultValues)(T,x.widget);return{...x,widget:I}}return x});return{...w,value:C}}e.slicesContentWithDefaultValues=A;function g(b,w,S){var y,C;const x=(C=(y=w==null?void 0:w.config)===null||y===void 0?void 0:y.choices)===null||C===void 0?void 0:C[S.name],T=()=>{if((0,d.isSharedSliceItemContent)(S)&&x&&(0,a.isStaticSharedSlice)(x)){const O=x.variations.find(k=>k.id===S.widget.variation);return O?{type:"SharedSlice",sliceName:x.id,variationId:O.id,fields:{primary:O.primary||{},items:O.items||{}}}:void 0}},I=()=>{var O;const k=o.ContentPath.append(o.ContentPath.serialize(b),S.name),P=Object.values(((O=w==null?void 0:w.config)===null||O===void 0?void 0:O.choices)||{}).find(Y=>{var te;return(0,a.isStaticSharedSlice)(Y)?!!(!((te=Y.legacyPaths)===null||te===void 0)&&te[k]):!1});if(!P)return;const q=P==null?void 0:P.variations.find(Y=>{var te;return Y.id===((te=P.legacyPaths)===null||te===void 0?void 0:te[k])});if(q)return{type:"SharedSlice",sliceName:P.id,variationId:q.id,fields:{primary:q.primary||{},items:q.items||{}}}},R=()=>{if(x){if((0,a.isCompositeSlice)(x))return{type:"Slice","non-repeat":x["non-repeat"]||{},repeat:x.repeat||{}};if((0,a.isLegacySlice)(x))return x}};return T()||I()||R()}function v({path:b,key:w,model:S,content:y}){return({transformWidget:C=({content:T})=>T,transformSlice:x=({content:T})=>T})=>{const T=y.value.reduce((I,R)=>{const O=S&&g(b,S,R),k=(()=>{if((0,d.isSharedSliceItemContent)(R))return(0,u.traverseSharedSliceContent)({path:b.concat({key:R.key,type:"SharedSlice"}),sliceKey:R.key,sliceName:R.name,model:(O==null?void 0:O.type)==="SharedSlice"?O:void 0,content:R})(C,x);if((0,d.isCompositeSliceItemContent)(R))return(0,c.traverseCompositeSliceContent)({path:b.concat({key:R.key,type:"Slice"}),sliceKey:R.key,sliceName:R.name,model:(O==null?void 0:O.type)==="Slice"||(O==null?void 0:O.type)==="SharedSlice"?O:void 0,content:R})(C,x);if((0,d.isSimpleSliceItemContent)(R))return(0,l.traverseSimpleSliceContent)({path:b.concat({key:R.key,type:"LegacySlice"}),sliceKey:R.key,sliceName:R.name,model:O&&(O==null?void 0:O.type)!=="Slice"?O:void 0,content:R})(C,x)})();return k?I.concat(k):I},[]);return C({path:b,key:w,apiId:w,model:S,content:{__TYPE__:y.__TYPE__,value:T}})}}e.traverseSlices=v}(FC)),FC}var G2;function hH(){return G2||(G2=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=Q;(0,t.__exportStar)(fH(),e),(0,t.__exportStar)(pH(),e),(0,t.__exportStar)(aLe(),e)}($C)),$C}var LC={},J2;function AH(){return J2||(J2=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.UIDContent=e.UIDLegacy=e.isUIDContent=e.UIDContentType=void 0;const t=Q,n=tt,r=Ve,i=(0,t.__importStar)(X),o=wt();e.UIDContentType="UIDContent";const a=c=>(0,o.hasContentType)(c)&&c.__TYPE__===e.UIDContentType;e.isUIDContent=a;const s=c=>new i.Type("UIDLegacy",e.isUIDContent,u=>(0,r.pipe)(i.string.decode(u),n.either.map(l=>e.UIDContent.encode({value:l,__TYPE__:e.UIDContentType}))),u=>({content:u.value,types:{[c.keyOfType]:"UID"}}));e.UIDLegacy=s,e.UIDContent=i.type({__TYPE__:i.literal(e.UIDContentType),value:i.string})}(LC)),LC}var la={},Z2;function sLe(){if(Z2)return la;Z2=1,Object.defineProperty(la,"__esModule",{value:!0}),la.WidgetLegacy=la.isWidgetContent=la.WidgetContent=void 0;const t=(0,Q.__importStar)(X),n=ds(),r=ia(),i=hH(),o=AH();la.WidgetContent=t.union([n.GroupContent,r.NestableContent,o.UIDContent,i.SlicesContent]);const a=c=>(0,n.isGroupContent)(c)||(0,r.isNestableContent)(c)||(0,o.isUIDContent)(c)||(0,i.isSlicesContent)(c);la.isWidgetContent=a;const s=c=>({decode(u){if(!c.fieldType)return;const l=(()=>{switch(c.fieldType){case"UID":return(0,o.UIDLegacy)(c);case"Group":return(0,n.GroupLegacy)(c);case"Choice":case"Slices":return(0,i.SlicesLegacy)(c);default:return(0,r.NestableLegacy)(c)}})();if(l)return l.decode(u)},encode(u){switch(u.__TYPE__){case o.UIDContentType:return(0,o.UIDLegacy)(c).encode(u);case n.GroupContentType:return(0,n.GroupLegacy)(c).encode(u);case i.SlicesContentType:return(0,i.SlicesLegacy)(c).encode(u);default:return(0,r.NestableLegacy)(c).encode(u)}}});return la.WidgetLegacy=s,la}var X2;function uF(){return X2||(X2=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=Q;(0,t.__exportStar)(YQ(),e),(0,t.__exportStar)(ds(),e),(0,t.__exportStar)(ia(),e),(0,t.__exportStar)(hH(),e),(0,t.__exportStar)(AH(),e),(0,t.__exportStar)(sLe(),e)}(nC)),nC}Object.defineProperty(hr,"__esModule",{value:!0});hr.migrateDocument=hr.collectWidgets=hr.traverseDocument=hr.fillDocumentWithDefaultValues=hr.DocumentLegacy=hr.Document=void 0;const cLe=Q,mH=tt,lF=Zt,gH=Ve,Ed=(0,cLe.__importStar)(X),vH=qm,dF=Tl,Rd=de,jr=uF(),ix=er;hr.Document=Ed.record(dF.WidgetKey,jr.WidgetContent);const uLe=Ed.record(dF.WidgetKey,Ed.unknown),fF=e=>new Ed.Type("Document",t=>!!t&&typeof t=="object",t=>(0,gH.pipe)(uLe.decode(t),mH.either.map(n=>Object.entries(n).reduce((r,[i,o])=>{const a=(0,ix.defaultCtx)(i,e),s=(0,jr.WidgetLegacy)(a).decode(o);return!s||(0,lF.isLeft)(s)?r:{...r,[i]:s.right}},{}))),t=>Object.entries(t).reduce((n,[r,i])=>{const o=(0,ix.defaultCtx)(r,e),a=(0,jr.WidgetLegacy)(o).encode(i);return a?{content:{...n.content,[r]:a.content},types:{...n.types,...a.types}}:n},{content:{},types:{}}));function yH(e){const t=Object.entries(e),{types:n,widgets:r}=t.reduce((a,[s,c])=>{if(s.endsWith("_TYPE")){const u=ix.FieldOrSliceType.decode(c);if((0,lF.isRight)(u))return{...a,types:a.types.set(s.substring(0,s.length-5),u.right)}}return!s.endsWith("_POSITION")&&!s.endsWith("_TYPE")?{...a,widgets:{...a.widgets,[s]:c}}:a},{types:new Map,widgets:{}}),i=e.slugs_INTERNAL||[],o=e.uid;return{widgets:r,types:n,uid:o,slugs:i}}function lLe(e,t){const n=(0,gH.pipe)(Ed.record(dF.WidgetKey,Ed.unknown).decode(e),mH.either.chain(r=>{const{types:i,widgets:o}=yH(r);return fF(i).decode(o)}));return(0,lF.isLeft)(n)?void 0:bH(n.right,t)}function dLe(e){const t=fF().encode(e);return{...t.content,...t.types}}hr.DocumentLegacy={_codec:fF,extractMetadata:yH,parse:lLe,encode:dLe};function pF(e){return{customTypeId:e==null?void 0:e.id,fields:Object.fromEntries((0,Rd.flattenSections)(e))}}function fLe(e,t){const{fields:n}=e&&Rd.StaticCustomType.is(e)?pF(e):e;return Object.entries(n).reduce((r,[i,o])=>{const a=t[i],s=(()=>{switch(o.type){case"Group":return(0,jr.isGroupContent)(a)?(0,jr.groupContentWithDefaultValues)(o,a):a;case"Choice":case"Slices":return(0,jr.isSlicesContent)(a)?(0,jr.slicesContentWithDefaultValues)(o,a):a;default:return a===void 0&&Rd.NestableWidget.is(o)?(0,jr.NestableContentDefaultValue)(o):a}})();return s?{...r,[i]:s}:r},t)}hr.fillDocumentWithDefaultValues=fLe;function hF({document:e,customType:t}){const n=t&&Rd.StaticCustomType.is(t)?pF(t):t;return({transformWidget:r=({content:o})=>o,transformSlice:i=({content:o})=>o})=>{const o=n&&Object.entries(n.fields).reduce((a,[s,c])=>({...a,[s]:c}),{});return Object.entries(e).reduce((a,[s,c])=>{const u=o&&o[s],l=vH.ContentPath.make([{key:n==null?void 0:n.customTypeId,type:"CustomType"},{key:s,type:"Widget"}]),d=(()=>{switch(c.__TYPE__){case"SliceContentType":return(0,jr.traverseSlices)({path:l,key:s,model:(u==null?void 0:u.type)==="Slices"||(u==null?void 0:u.type)==="Choice"?u:void 0,content:c})({transformWidget:r,transformSlice:i});case"GroupContentType":return(0,jr.traverseGroupContent)({path:l,key:s,apiId:s,model:(u==null?void 0:u.type)==="Group"?u:void 0,content:c})(r);case"RepeatableContent":return(0,jr.traverseRepeatableContent)({path:l,key:s,apiId:s,model:(u==null?void 0:u.type)==="Link"?u:void 0,content:c})(r);case"TableContent":return(0,jr.traverseTableContent)({path:l,key:s,apiId:s,model:(u==null?void 0:u.type)==="Table"?u:void 0,content:c})(r);default:return r({path:l,key:s,apiId:s,model:(u==null?void 0:u.type)!=="Group"&&(u==null?void 0:u.type)!=="Slices"&&(u==null?void 0:u.type)!=="Choice"?u:void 0,content:c})}})();return{...a,...d?{[s]:d}:{}}},{})}}hr.traverseDocument=hF;function pLe(e,t){const n={};return hF({document:e})({transformWidget:({content:r,path:i})=>{const o=vH.ContentPath.serialize(i);return t(r,i)&&(n[o]=r),r}}),n}hr.collectWidgets=pLe;function bH(e,t){const n=Rd.StaticCustomType.is(t)?pF(t):t;return Object.values((0,Rd.collectSharedSlices)(n)).some(i=>!!i.legacyPaths)?hF({document:e,customType:t})({transformSlice:jr.migrateSliceItem}):e}hr.migrateDocument=bH;(function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=Q;(0,t.__exportStar)(hr,e),(0,t.__exportStar)(uF(),e),(0,t.__exportStar)(er,e)})(ue);function SH(e){if(ue.isRepeatableContent(e))return e;if(ue.isLinkContent(e))return{__TYPE__:"RepeatableContent",type:"Link",value:[e]}}function CH(e){if(ue.isLinkContent(e))return e;if(ue.isRepeatableContent(e)){const[t]=e.value;if(ue.isLinkContent(t))return t}}function hLe(e,t){let n=gLe(e,t);return n=ALe(e,n),n=mLe(e,n),ue.fillDocumentWithDefaultValues(e,n)}function ALe(e,t){return de.flattenSections(e).reduce((r,[i,o])=>!t[i]&&o.type==="Group"?{...r,[i]:wH}:r,t)}function mLe(e,t){return ue.traverseDocument({document:t,customType:e})({transformWidget({model:n,content:r}){return n?r:void 0},transformSlice(n){return n.model?n.content:void 0}})}function gLe(e,t){return ue.traverseDocument({document:t,customType:e})({transformWidget({model:n,content:r}){if((n==null?void 0:n.type)==="Link"){const{repeat:i}=n.config??{};switch(r.__TYPE__){case"LinkContent":return i?SH(r)??r:r;case"RepeatableContent":return i?r:CH(r)??r;default:return r}}return r}})}const wH={__TYPE__:"GroupContentType",value:[{__TYPE__:"GroupItemContent",value:[]}]},xH={unclassified:{title:"Draft",color:"amber"},published:{title:"Live",color:"green"},release:{title:"Planned",color:"purple"},archived:{title:"Archived",color:"grey"}},ox={unclassified:["unclassified","published"],archived:["unclassified","published"],release:["release","published"],published:["published","unclassified"]};function AF(e){const{documentId:t,versionId:n,baseUrl:r,status:i,releaseId:o}=e,a={s:i,v:n,r:o},s=Vr.createRouteParams({params:a}),c=new URLSearchParams(s).toString();return new URL(`pages/${t}?${c}`,r)}function vLe(e){const{children:t,...n}=e;return f.jsx(Ti.QueryErrorResetBoundary,{children:({reset:r})=>f.jsx(m.ErrorBoundary,{...n,onReset:r,children:t})})}const _H=E.createContext(void 0),yLe={selectedIds:new Set,excludedIds:new Set,isAllSelected:!1};function TH(e){const{children:t,initialState:n,initialTotalItemCount:r,isSelectAllEnabled:i=!1}=e,o=E.useRef(),a=E.useRef(r||0);function s(){if(n&&n.selectedIds){const T=[...n.selectedIds].pop();T&&(o.current=T)}return{...yLe,...n}}const[c,u]=E.useState(s),l=E.useMemo(()=>{const{selectedIds:T,excludedIds:I,isAllSelected:R}=c;return R?a.current-I.size:T.size},[c]),d=E.useCallback(T=>{const{isAllSelected:I,selectedIds:R,excludedIds:O}=c;return I?!O.has(T):R.has(T)},[c]),p=E.useCallback(()=>{const{isAllSelected:T,selectedIds:I,excludedIds:R}=c;return{selectedIds:[...I],excludedIds:[...R],isAllSelected:T,selectedCount:l}},[c,l]),h=We.useStableCallback(()=>{i&&u({isAllSelected:!0,selectedIds:new Set,excludedIds:new Set})}),A=We.useStableCallback(()=>{u({isAllSelected:!1,selectedIds:new Set,excludedIds:new Set})});E.useEffect(()=>{const{isAllSelected:T,selectedIds:I,excludedIds:R}=c,O=a.current;if(!(O===0||!i)){if(T&&R.size===O){A();return}if(!T&&I.size===O){h();return}}},[c,i,h,A]);const g=We.useStableCallback(T=>{const{id:I,isSingleSelection:R,metaKey:O,shiftKey:k,ids:P}=T;return k&&P&&P.length>0&&o.current?b(I,P,o.current):R&&!O?v(I):d(I)?y([I]):S([I]),o.current=I,d(I)});function v(T){d(T)&&l===1?u(I=>({...I,selectedIds:new Set})):u({isAllSelected:!1,selectedIds:new Set([T]),excludedIds:new Set})}function b(T,I,R){const O=bLe(I,R,T),k=d(T);return k?y(O):S(O),k}const w=We.useStableCallback(()=>{l>0?A():h()});function S(T){const{isAllSelected:I}=c;if(I){u(R=>({...R,excludedIds:eB(R.excludedIds,T)}));return}u(R=>({...R,selectedIds:tB(R.selectedIds,T)}))}function y(T){const{isAllSelected:I}=c;if(I){u(R=>({...R,excludedIds:tB(R.excludedIds,T)}));return}u(R=>({...R,selectedIds:eB(R.selectedIds,T)}))}function C(T){a.current=T}const x=E.useMemo(()=>({selectedCount:l,state:c,totalItemCount:a.current,isSelected:d,isSelectAllEnabled:i,getSelectionState:p,toggleSelection:g,toggleSelectAll:w,clearSelection:A,setTotalItemCount:C}),[c,A,p,i,d,l,w,g]);return f.jsx(_H.Provider,{value:x,children:t})}function _c(e){const t=E.useContext(_H);if(t===void 0)throw new Error("useSelectionManagerContext must be used within a SelectionManagerProvider");const{totalItemCount:n,onChangeSelection:r}=e||{},{setTotalItemCount:i,totalItemCount:o,state:a,getSelectionState:s,...c}=t;n!==void 0&&n!==o&&i(n);const u=We.useStableCallback(r);return E.useEffect(()=>{u==null||u(s())},[s,u,a]),{...c,getSelectionState:s,isAllSelected:a.isAllSelected}}function bLe(e,t,n){const r=e.indexOf(t),i=e.indexOf(n);if(i===-1)throw new Error("targetId must be in the array");return r===-1?[n]:r<=i?e.slice(r,i+1):e.slice(i,r+1)}function eB(e,t){const n=new Set(e);return t.forEach(r=>n.delete(r)),n}function tB(e,t){return new Set([...e,...t])}const sS=E.createContext(void 0);function ye(){const e=E.useContext(sS);if(!e)throw new Error("Missing EditorConfigContext.Provider");return e}class ax extends Error{}function bt(e){throw new ax(`Missing EditorConfig.${e}`)}function SLe(){if(new URL(location.href).searchParams.has("debug"))return;const n=console.error.bind(console);console.error=(...r)=>{r[0]instanceof ax||CLe(r)||n(...r)},window.addEventListener("error",r=>{r.error instanceof ax&&r.preventDefault(),wLe(r.error)&&r.preventDefault()})}function CLe(e){const t="Warning: flushSync was called from inside a lifecycle method",n=typeof e[0]=="string"&&e[0].includes(t),r=typeof e[1]=="string"&&e[1].includes("RichTextField");return n&&r}function wLe(e){const t=/Invalid content for node document: <(bulletList|orderedList)\(listItem*/,n=e.message;return!!(typeof n=="string"&&n.match(t))}const xLe=e=>{let t=e.httpHandler;return{setHttpHandler(n){t=n},httpHandler(){return t},updateHttpClientConfig(n,r){t.updateHttpClientConfig(n,r)},httpHandlerConfigs(){return t.httpHandlerConfigs()}}},_Le=e=>({httpHandler:e.httpHandler()});var nB;(function(e){e.HEADER="header",e.QUERY="query"})(nB||(nB={}));var rB;(function(e){e.HEADER="header",e.QUERY="query"})(rB||(rB={}));var Th;(function(e){e.HTTP="http",e.HTTPS="https"})(Th||(Th={}));var Ov;(function(e){e.MD5="md5",e.CRC32="crc32",e.CRC32C="crc32c",e.SHA1="sha1",e.SHA256="sha256"})(Ov||(Ov={}));var iB;(function(e){e[e.HEADER=0]="HEADER",e[e.TRAILER=1]="TRAILER"})(iB||(iB={}));const sx="__smithy_context";var oB;(function(e){e.PROFILE="profile",e.SSO_SESSION="sso-session",e.SERVICES="services"})(oB||(oB={}));var aB;(function(e){e.HTTP_0_9="http/0.9",e.HTTP_1_0="http/1.0",e.TDS_8_0="tds/8.0"})(aB||(aB={}));class Hr{constructor(t){this.method=t.method||"GET",this.hostname=t.hostname||"localhost",this.port=t.port,this.query=t.query||{},this.headers=t.headers||{},this.body=t.body,this.protocol=t.protocol?t.protocol.slice(-1)!==":"?`${t.protocol}:`:t.protocol:"https:",this.path=t.path?t.path.charAt(0)!=="/"?`/${t.path}`:t.path:"/",this.username=t.username,this.password=t.password,this.fragment=t.fragment}static clone(t){const n=new Hr({...t,headers:{...t.headers}});return n.query&&(n.query=TLe(n.query)),n}static isInstance(t){if(!t)return!1;const n=t;return"method"in n&&"protocol"in n&&"hostname"in n&&"path"in n&&typeof n.query=="object"&&typeof n.headers=="object"}clone(){return Hr.clone(this)}}function TLe(e){return Object.keys(e).reduce((t,n)=>{const r=e[n];return{...t,[n]:Array.isArray(r)?[...r]:r}},{})}class Mv{constructor(t){this.statusCode=t.statusCode,this.reason=t.reason,this.headers=t.headers||{},this.body=t.body}static isInstance(t){if(!t)return!1;const n=t;return typeof n.statusCode=="number"&&typeof n.headers=="object"}}const ILe=e=>t=>async n=>{if(!Hr.isInstance(n.request))return t(n);const{request:r}=n,{handlerProtocol:i=""}=e.requestHandler.metadata||{};if(i.indexOf("h2")>=0&&!r.headers[":authority"])delete r.headers.host,r.headers[":authority"]=r.hostname+(r.port?":"+r.port:"");else if(!r.headers.host){let o=r.hostname;r.port!=null&&(o+=`:${r.port}`),r.headers.host=o}return t(n)},ELe={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},RLe=e=>({applyToStack:t=>{t.add(ILe(e),ELe)}}),$Le=()=>(e,t)=>async n=>{var r,i;try{const o=await e(n),{clientName:a,commandName:s,logger:c,dynamoDbDocumentClientOptions:u={}}=t,{overrideInputFilterSensitiveLog:l,overrideOutputFilterSensitiveLog:d}=u,p=l??t.inputFilterSensitiveLog,h=d??t.outputFilterSensitiveLog,{$metadata:A,...g}=o.output;return(r=c==null?void 0:c.info)==null||r.call(c,{clientName:a,commandName:s,input:p(n.input),output:h(g),metadata:A}),o}catch(o){const{clientName:a,commandName:s,logger:c,dynamoDbDocumentClientOptions:u={}}=t,{overrideInputFilterSensitiveLog:l}=u,d=l??t.inputFilterSensitiveLog;throw(i=c==null?void 0:c.error)==null||i.call(c,{clientName:a,commandName:s,input:d(n.input),error:o,metadata:o.$metadata}),o}},kLe={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},OLe=e=>({applyToStack:t=>{t.add($Le(),kLe)}}),sB="X-Amzn-Trace-Id",MLe="AWS_LAMBDA_FUNCTION_NAME",FLe="_X_AMZN_TRACE_ID",LLe=e=>t=>async n=>{const{request:r}=n;if(!Hr.isInstance(r)||e.runtime!=="node"||r.headers.hasOwnProperty(sB))return t(n);const i=process.env[MLe],o=process.env[FLe],a=s=>typeof s=="string"&&s.length>0;return a(i)&&a(o)&&(r.headers[sB]=o),t({...n,request:r})},BLe={step:"build",tags:["RECURSION_DETECTION"],name:"recursionDetectionMiddleware",override:!0,priority:"low"},DLe=e=>({applyToStack:t=>{t.add(LLe(e),BLe)}}),cS=e=>e[sx]||(e[sx]={}),ks=e=>{if(typeof e=="function")return e;const t=Promise.resolve(e);return()=>t};function jLe(e){const t=new Map;for(const n of e)t.set(n.schemeId,n);return t}const ULe=(e,t)=>(n,r)=>async i=>{var u;const o=e.httpAuthSchemeProvider(await t.httpAuthSchemeParametersProvider(e,r,i.input)),a=jLe(e.httpAuthSchemes),s=cS(r),c=[];for(const l of o){const d=a.get(l.schemeId);if(!d){c.push(`HttpAuthScheme \`${l.schemeId}\` was not enabled for this service.`);continue}const p=d.identityProvider(await t.identityProviderConfigProvider(e));if(!p){c.push(`HttpAuthScheme \`${l.schemeId}\` did not have an IdentityProvider configured.`);continue}const{identityProperties:h={},signingProperties:A={}}=((u=l.propertiesExtractor)==null?void 0:u.call(l,e,r))||{};l.identityProperties=Object.assign(l.identityProperties||{},h),l.signingProperties=Object.assign(l.signingProperties||{},A),s.selectedHttpAuthScheme={httpAuthOption:l,identity:await p(l.identityProperties),signer:d.signer};break}if(!s.selectedHttpAuthScheme)throw new Error(c.join(`
|
|
7
|
+
`));return n(i)},PLe={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:"endpointV2Middleware"},NLe=(e,{httpAuthSchemeParametersProvider:t,identityProviderConfigProvider:n})=>({applyToStack:r=>{r.addRelativeTo(ULe(e,{httpAuthSchemeParametersProvider:t,identityProviderConfigProvider:n}),PLe)}}),WLe=(e,t)=>n=>async r=>{const{response:i}=await n(r);try{const o=await t(i,e);return{response:i,output:o}}catch(o){if(Object.defineProperty(o,"$response",{value:i}),!("$metadata"in o)){const a="Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.";o.message+=`
|
|
8
|
+
`+a,typeof o.$responseBodyText<"u"&&o.$response&&(o.$response.body=o.$responseBodyText)}throw o}},KLe=(e,t)=>(n,r)=>async i=>{var s;const o=(s=r.endpointV2)!=null&&s.url&&e.urlParser?async()=>e.urlParser(r.endpointV2.url):e.endpoint;if(!o)throw new Error("No valid endpoint provider available.");const a=await t(i.input,{...e,endpoint:o});return n({...i,request:a})},qLe={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},mF={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0};function VLe(e,t,n){return{applyToStack:r=>{r.add(WLe(e,n),qLe),r.add(KLe(e,t),mF)}}}mF.name;const zLe=e=>t=>{throw t},QLe=(e,t)=>{},HLe=e=>(t,n)=>async r=>{if(!Hr.isInstance(r.request))return t(r);const o=cS(n).selectedHttpAuthScheme;if(!o)throw new Error("No HttpAuthScheme was selected: unable to sign request");const{httpAuthOption:{signingProperties:a={}},identity:s,signer:c}=o,u=await t({...r,request:await c.sign(r.request,s,a)}).catch((c.errorHandler||zLe)(a));return(c.successHandler||QLe)(u.response,a),u},YLe={step:"finalizeRequest",tags:["HTTP_SIGNING"],name:"httpSigningMiddleware",aliases:["apiKeyMiddleware","tokenMiddleware","awsAuthMiddleware"],override:!0,relation:"after",toMiddleware:"retryMiddleware"},GLe=e=>({applyToStack:t=>{t.addRelativeTo(HLe(),YLe)}}),kp=e=>{if(typeof e=="function")return e;const t=Promise.resolve(e);return()=>t},Us={},bp=new Array(64);for(let e=0,t="A".charCodeAt(0),n="Z".charCodeAt(0);e+t<=n;e++){const r=String.fromCharCode(e+t);Us[r]=e,bp[e]=r}for(let e=0,t="a".charCodeAt(0),n="z".charCodeAt(0);e+t<=n;e++){const r=String.fromCharCode(e+t),i=e+26;Us[r]=i,bp[i]=r}for(let e=0;e<10;e++){Us[e.toString(10)]=e+52;const t=e.toString(10),n=e+52;Us[t]=n,bp[n]=t}Us["+"]=62;bp[62]="+";Us["/"]=63;bp[63]="/";const ld=6,Jp=8,JLe=63,IH=e=>{let t=e.length/4*3;e.slice(-2)==="=="?t-=2:e.slice(-1)==="="&&t--;const n=new ArrayBuffer(t),r=new DataView(n);for(let i=0;i<e.length;i+=4){let o=0,a=0;for(let u=i,l=i+3;u<=l;u++)if(e[u]!=="="){if(!(e[u]in Us))throw new TypeError(`Invalid character ${e[u]} in base64 string.`);o|=Us[e[u]]<<(l-u)*ld,a+=ld}else o>>=ld;const s=i/4*3;o>>=a%Jp;const c=Math.floor(a/Jp);for(let u=0;u<c;u++){const l=(c-u-1)*Jp;r.setUint8(s+u,(o&255<<l)>>l)}}return new Uint8Array(n)},$d=e=>new TextEncoder().encode(e),Zp=e=>typeof e=="string"?$d(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e),EH=e=>{if(typeof e=="string")return e;if(typeof e!="object"||typeof e.byteOffset!="number"||typeof e.byteLength!="number")throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return new TextDecoder("utf-8").decode(e)};function RH(e){let t;typeof e=="string"?t=$d(e):t=e;const n=typeof t=="object"&&typeof t.length=="number",r=typeof t=="object"&&typeof t.byteOffset=="number"&&typeof t.byteLength=="number";if(!n&&!r)throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");let i="";for(let o=0;o<t.length;o+=3){let a=0,s=0;for(let u=o,l=Math.min(o+3,t.length);u<l;u++)a|=t[u]<<(l-u-1)*Jp,s+=Jp;const c=Math.ceil(s/ld);a<<=c*ld-s;for(let u=1;u<=c;u++){const l=(c-u)*ld;i+=bp[(a&JLe<<l)>>l]}i+="==".slice(0,4-c)}return i}function ZLe(e,t="utf-8"){return t==="base64"?RH(e):EH(e)}function XLe(e,t){return t==="base64"?Jc.mutate(IH(e)):Jc.mutate($d(e))}class Jc extends Uint8Array{static fromString(t,n="utf-8"){switch(typeof t){case"string":return XLe(t,n);default:throw new Error(`Unsupported conversion from ${typeof t} to Uint8ArrayBlobAdapter.`)}}static mutate(t){return Object.setPrototypeOf(t,Jc.prototype),t}transformToString(t="utf-8"){return ZLe(this,t)}}const Zc=e=>encodeURIComponent(e).replace(/[!'()*]/g,e2e),e2e=e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`;function t2e(e){const t=[];for(let n of Object.keys(e).sort()){const r=e[n];if(n=Zc(n),Array.isArray(r))for(let i=0,o=r.length;i<o;i++)t.push(`${n}=${Zc(r[i])}`);else{let i=n;(r||typeof r=="string")&&(i+=`=${Zc(r)}`),t.push(i)}}return t.join("&")}function cB(e,t){return new Request(e,t)}function n2e(e=0){return new Promise((t,n)=>{e&&setTimeout(()=>{const r=new Error(`Request did not complete within ${e} ms`);r.name="TimeoutError",n(r)},e)})}const BC={supported:void 0};class gF{static create(t){return typeof(t==null?void 0:t.handle)=="function"?t:new gF(t)}constructor(t){typeof t=="function"?this.configProvider=t().then(n=>n||{}):(this.config=t??{},this.configProvider=Promise.resolve(this.config)),BC.supported===void 0&&(BC.supported=typeof Request<"u"&&"keepalive"in cB("https://[::1]"))}destroy(){}async handle(t,{abortSignal:n}={}){var b;this.config||(this.config=await this.configProvider);const r=this.config.requestTimeout,i=this.config.keepAlive===!0,o=this.config.credentials;if(n!=null&&n.aborted){const w=new Error("Request aborted");return w.name="AbortError",Promise.reject(w)}let a=t.path;const s=t2e(t.query||{});s&&(a+=`?${s}`),t.fragment&&(a+=`#${t.fragment}`);let c="";if(t.username!=null||t.password!=null){const w=t.username??"",S=t.password??"";c=`${w}:${S}@`}const{port:u,method:l}=t,d=`${t.protocol}//${c}${t.hostname}${u?`:${u}`:""}${a}`,p=l==="GET"||l==="HEAD"?void 0:t.body,h={body:p,headers:new Headers(t.headers),method:l,credentials:o};(b=this.config)!=null&&b.cache&&(h.cache=this.config.cache),p&&(h.duplex="half"),typeof AbortController<"u"&&(h.signal=n),BC.supported&&(h.keepalive=i),typeof this.config.requestInit=="function"&&Object.assign(h,this.config.requestInit(t));let A=()=>{};const g=cB(d,h),v=[fetch(g).then(w=>{const S=w.headers,y={};for(const x of S.entries())y[x[0]]=x[1];return w.body!=null?{response:new Mv({headers:y,reason:w.statusText,statusCode:w.status,body:w.body})}:w.blob().then(x=>({response:new Mv({headers:y,reason:w.statusText,statusCode:w.status,body:x})}))}),n2e(r)];return n&&v.push(new Promise((w,S)=>{const y=()=>{const C=new Error("Request aborted");C.name="AbortError",S(C)};if(typeof n.addEventListener=="function"){const C=n;C.addEventListener("abort",y,{once:!0}),A=()=>C.removeEventListener("abort",y)}else n.onabort=y})),Promise.race(v).finally(A)}updateHttpClientConfig(t,n){this.config=void 0,this.configProvider=this.configProvider.then(r=>(r[t]=n,r))}httpHandlerConfigs(){return this.config??{}}}const r2e=async e=>{var t;return typeof Blob=="function"&&e instanceof Blob||((t=e.constructor)==null?void 0:t.name)==="Blob"?new Uint8Array(await e.arrayBuffer()):i2e(e)};async function i2e(e){const t=[],n=e.getReader();let r=!1,i=0;for(;!r;){const{done:s,value:c}=await n.read();c&&(t.push(c),i+=c.length),r=s}const o=new Uint8Array(i);let a=0;for(const s of t)o.set(s,a),a+=s.length;return o}const $H={},cx={};for(let e=0;e<256;e++){let t=e.toString(16).toLowerCase();t.length===1&&(t=`0${t}`),$H[e]=t,cx[t]=e}function kH(e){if(e.length%2!==0)throw new Error("Hex encoded strings must have an even number length");const t=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2){const r=e.slice(n,n+2).toLowerCase();if(r in cx)t[n/2]=cx[r];else throw new Error(`Cannot decode unrecognized sequence ${r} as hexadecimal`)}return t}function Ur(e){let t="";for(let n=0;n<e.byteLength;n++)t+=$H[e[n]];return t}const o2e=async(e=new Uint8Array,t)=>{if(e instanceof Uint8Array)return Jc.mutate(e);if(!e)return Jc.mutate(new Uint8Array);const n=t.streamCollector(e);return Jc.mutate(await n)};function uB(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}const a2e=(e,t,n,r,i,o)=>{if(t!=null&&t[n]!==void 0){const a=r();if(a.length<=0)throw new Error("Empty value provided for input HTTP label: "+n+".");e=e.replace(i,o?a.split("/").map(s=>uB(s)).join("/"):uB(a))}else throw new Error("No value provided for input HTTP label: "+n+".");return e};function s2e(e,t){return new c2e(e,t)}class c2e{constructor(t,n){this.input=t,this.context=n,this.query={},this.method="",this.headers={},this.path="",this.body=null,this.hostname="",this.resolvePathStack=[]}async build(){const{hostname:t,protocol:n="https",port:r,path:i}=await this.context.endpoint();this.path=i;for(const o of this.resolvePathStack)o(this.path);return new Hr({protocol:n,hostname:this.hostname||t,port:r,method:this.method,path:this.path,query:this.query,body:this.body,headers:this.headers})}hn(t){return this.hostname=t,this}bp(t){return this.resolvePathStack.push(n=>{this.path=`${n!=null&&n.endsWith("/")?n.slice(0,-1):n||""}`+t}),this}p(t,n,r,i){return this.resolvePathStack.push(o=>{this.path=a2e(o,this.input,t,n,r,i)}),this}h(t){return this.headers=t,this}q(t){return this.query=t,this}b(t){return this.body=t,this}m(t){return this.method=t,this}}function u2e(e,t,n){e.__smithy_context?e.__smithy_context.features||(e.__smithy_context.features={}):e.__smithy_context={features:{}},e.__smithy_context.features[t]=n}class l2e{constructor(t){this.authSchemes=new Map;for(const[n,r]of Object.entries(t))r!==void 0&&this.authSchemes.set(n,r)}getIdentityProvider(t){return this.authSchemes.get(t)}}const d2e=e=>t=>OH(t)&&t.expiration.getTime()-Date.now()<e,f2e=3e5,p2e=d2e(f2e),OH=e=>e.expiration!==void 0,h2e=(e,t,n)=>{if(e===void 0)return;const r=typeof e!="function"?async()=>Promise.resolve(e):e;let i,o,a,s=!1;const c=async u=>{o||(o=r(u));try{i=await o,a=!0,s=!1}finally{o=void 0}return i};return t===void 0?async u=>((!a||u!=null&&u.forceRefresh)&&(i=await c(u)),i):async u=>((!a||u!=null&&u.forceRefresh)&&(i=await c(u)),s?i:n(i)?(t(i)&&await c(u),i):(s=!0,i))},A2e=void 0;function m2e(e){return e===void 0?!0:typeof e=="string"&&e.length<=50}function g2e(e){const t=kp(e.userAgentAppId??A2e);return{...e,customUserAgent:typeof e.customUserAgent=="string"?[[e.customUserAgent]]:e.customUserAgent,userAgentAppId:async()=>{var r,i;const n=await t();if(!m2e(n)){const o=((i=(r=e.logger)==null?void 0:r.constructor)==null?void 0:i.name)==="NoOpLogger"||!e.logger?console:e.logger;typeof n!="string"?o==null||o.warn("userAgentAppId must be a string or undefined."):n.length>50&&(o==null||o.warn("The provided userAgentAppId exceeds the maximum length of 50 characters."))}return n}}}class v2e{constructor({size:t,params:n}){this.data=new Map,this.parameters=[],this.capacity=t??50,n&&(this.parameters=n)}get(t,n){const r=this.hash(t);if(r===!1)return n();if(!this.data.has(r)){if(this.data.size>this.capacity+10){const i=this.data.keys();let o=0;for(;;){const{value:a,done:s}=i.next();if(this.data.delete(a),s||++o>10)break}}this.data.set(r,n())}return this.data.get(r)}size(){return this.data.size}hash(t){let n="";const{parameters:r}=this;if(r.length===0)return!1;for(const i of r){const o=String(t[i]??"");if(o.includes("|;"))return!1;n+=o+"|;"}return n}}const y2e=new RegExp("^(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}$"),MH=e=>y2e.test(e)||e.startsWith("[")&&e.endsWith("]"),b2e=new RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"),vF=(e,t=!1)=>{if(!t)return b2e.test(e);const n=e.split(".");for(const r of n)if(!vF(r))return!1;return!0},Fv={},Ih="endpoints";function Ps(e){return typeof e!="object"||e==null?e:"ref"in e?`$${Ps(e.ref)}`:"fn"in e?`${e.fn}(${(e.argv||[]).map(Ps).join(", ")})`:JSON.stringify(e,null,2)}class Yr extends Error{constructor(t){super(t),this.name="EndpointError"}}const S2e=(e,t)=>e===t,C2e=e=>{const t=e.split("."),n=[];for(const r of t){const i=r.indexOf("[");if(i!==-1){if(r.indexOf("]")!==r.length-1)throw new Yr(`Path: '${e}' does not end with ']'`);const o=r.slice(i+1,-1);if(Number.isNaN(parseInt(o)))throw new Yr(`Invalid array index: '${o}' in path: '${e}'`);i!==0&&n.push(r.slice(0,i)),n.push(o)}else n.push(r)}return n},FH=(e,t)=>C2e(t).reduce((n,r)=>{if(typeof n!="object")throw new Yr(`Index '${r}' in '${t}' not found in '${JSON.stringify(e)}'`);return Array.isArray(n)?n[parseInt(r)]:n[r]},e),w2e=e=>e!=null,x2e=e=>!e,DC={[Th.HTTP]:80,[Th.HTTPS]:443},_2e=e=>{const t=(()=>{try{if(e instanceof URL)return e;if(typeof e=="object"&&"hostname"in e){const{hostname:p,port:h,protocol:A="",path:g="",query:v={}}=e,b=new URL(`${A}//${p}${h?`:${h}`:""}${g}`);return b.search=Object.entries(v).map(([w,S])=>`${w}=${S}`).join("&"),b}return new URL(e)}catch{return null}})();if(!t)return console.error(`Unable to parse ${JSON.stringify(e)} as a whatwg URL.`),null;const n=t.href,{host:r,hostname:i,pathname:o,protocol:a,search:s}=t;if(s)return null;const c=a.slice(0,-1);if(!Object.values(Th).includes(c))return null;const u=MH(i),l=n.includes(`${r}:${DC[c]}`)||typeof e=="string"&&e.includes(`${r}:${DC[c]}`),d=`${r}${l?`:${DC[c]}`:""}`;return{scheme:c,authority:d,path:o,normalizedPath:o.endsWith("/")?o:`${o}/`,isIp:u}},T2e=(e,t)=>e===t,I2e=(e,t,n,r)=>t>=n||e.length<n?null:r?e.substring(e.length-n,e.length-t):e.substring(t,n),E2e=e=>encodeURIComponent(e).replace(/[!*'()]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`),R2e={booleanEquals:S2e,getAttr:FH,isSet:w2e,isValidHostLabel:vF,not:x2e,parseURL:_2e,stringEquals:T2e,substring:I2e,uriEncode:E2e},LH=(e,t)=>{const n=[],r={...t.endpointParams,...t.referenceRecord};let i=0;for(;i<e.length;){const o=e.indexOf("{",i);if(o===-1){n.push(e.slice(i));break}n.push(e.slice(i,o));const a=e.indexOf("}",o);if(a===-1){n.push(e.slice(o));break}e[o+1]==="{"&&e[a+1]==="}"&&(n.push(e.slice(o+1,a)),i=a+2);const s=e.substring(o+1,a);if(s.includes("#")){const[c,u]=s.split("#");n.push(FH(r[c],u))}else n.push(r[s]);i=a+1}return n.join("")},$2e=({ref:e},t)=>({...t.endpointParams,...t.referenceRecord})[e],uS=(e,t,n)=>{if(typeof e=="string")return LH(e,n);if(e.fn)return BH(e,n);if(e.ref)return $2e(e,n);throw new Yr(`'${t}': ${String(e)} is not a string, function or reference.`)},BH=({fn:e,argv:t},n)=>{const r=t.map(o=>["boolean","number"].includes(typeof o)?o:uS(o,"arg",n)),i=e.split(".");return i[0]in Fv&&i[1]!=null?Fv[i[0]][i[1]](...r):R2e[e](...r)},k2e=({assign:e,...t},n)=>{var i,o;if(e&&e in n.referenceRecord)throw new Yr(`'${e}' is already defined in Reference Record.`);const r=BH(t,n);return(o=(i=n.logger)==null?void 0:i.debug)==null||o.call(i,`${Ih} evaluateCondition: ${Ps(t)} = ${Ps(r)}`),{result:r===""?!0:!!r,...e!=null&&{toAssign:{name:e,value:r}}}},yF=(e=[],t)=>{var r,i;const n={};for(const o of e){const{result:a,toAssign:s}=k2e(o,{...t,referenceRecord:{...t.referenceRecord,...n}});if(!a)return{result:a};s&&(n[s.name]=s.value,(i=(r=t.logger)==null?void 0:r.debug)==null||i.call(r,`${Ih} assign: ${s.name} := ${Ps(s.value)}`))}return{result:!0,referenceRecord:n}},O2e=(e,t)=>Object.entries(e).reduce((n,[r,i])=>({...n,[r]:i.map(o=>{const a=uS(o,"Header value entry",t);if(typeof a!="string")throw new Yr(`Header '${r}' value '${a}' is not a string`);return a})}),{}),DH=(e,t)=>{if(Array.isArray(e))return e.map(n=>DH(n,t));switch(typeof e){case"string":return LH(e,t);case"object":if(e===null)throw new Yr(`Unexpected endpoint property: ${e}`);return jH(e,t);case"boolean":return e;default:throw new Yr(`Unexpected endpoint property type: ${typeof e}`)}},jH=(e,t)=>Object.entries(e).reduce((n,[r,i])=>({...n,[r]:DH(i,t)}),{}),M2e=(e,t)=>{const n=uS(e,"Endpoint URL",t);if(typeof n=="string")try{return new URL(n)}catch(r){throw console.error(`Failed to construct URL with ${n}`,r),r}throw new Yr(`Endpoint URL must be a string, got ${typeof n}`)},F2e=(e,t)=>{var l,d;const{conditions:n,endpoint:r}=e,{result:i,referenceRecord:o}=yF(n,t);if(!i)return;const a={...t,referenceRecord:{...t.referenceRecord,...o}},{url:s,properties:c,headers:u}=r;return(d=(l=t.logger)==null?void 0:l.debug)==null||d.call(l,`${Ih} Resolving endpoint from template: ${Ps(r)}`),{...u!=null&&{headers:O2e(u,a)},...c!=null&&{properties:jH(c,a)},url:M2e(s,a)}},L2e=(e,t)=>{const{conditions:n,error:r}=e,{result:i,referenceRecord:o}=yF(n,t);if(i)throw new Yr(uS(r,"Error",{...t,referenceRecord:{...t.referenceRecord,...o}}))},B2e=(e,t)=>{const{conditions:n,rules:r}=e,{result:i,referenceRecord:o}=yF(n,t);if(i)return UH(r,{...t,referenceRecord:{...t.referenceRecord,...o}})},UH=(e,t)=>{for(const n of e)if(n.type==="endpoint"){const r=F2e(n,t);if(r)return r}else if(n.type==="error")L2e(n,t);else if(n.type==="tree"){const r=B2e(n,t);if(r)return r}else throw new Yr(`Unknown endpoint rule: ${n}`);throw new Yr("Rules evaluation failed")},D2e=(e,t)=>{var u,l,d,p;const{endpointParams:n,logger:r}=t,{parameters:i,rules:o}=e;(l=(u=t.logger)==null?void 0:u.debug)==null||l.call(u,`${Ih} Initial EndpointParams: ${Ps(n)}`);const a=Object.entries(i).filter(([,h])=>h.default!=null).map(([h,A])=>[h,A.default]);if(a.length>0)for(const[h,A]of a)n[h]=n[h]??A;const s=Object.entries(i).filter(([,h])=>h.required).map(([h])=>h);for(const h of s)if(n[h]==null)throw new Yr(`Missing required parameter: '${h}'`);const c=UH(o,{endpointParams:n,logger:r,referenceRecord:{}});return(p=(d=t.logger)==null?void 0:d.debug)==null||p.call(d,`${Ih} Resolved endpoint: ${Ps(c)}`),c},PH=(e,t=!1)=>{if(t){for(const n of e.split("."))if(!PH(n))return!1;return!0}return!(!vF(e)||e.length<3||e.length>63||e!==e.toLowerCase()||MH(e))},lB=":",j2e="/",U2e=e=>{const t=e.split(lB);if(t.length<6)return null;const[n,r,i,o,a,...s]=t;if(n!=="arn"||r===""||i===""||s.join(lB)==="")return null;const c=s.map(u=>u.split(j2e)).flat();return{partition:r,service:i,region:o,accountId:a,resourceId:c}},P2e=[{id:"aws",outputs:{dnsSuffix:"amazonaws.com",dualStackDnsSuffix:"api.aws",implicitGlobalRegion:"us-east-1",name:"aws",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^(us|eu|ap|sa|ca|me|af|il|mx)\\-\\w+\\-\\d+$",regions:{"af-south-1":{description:"Africa (Cape Town)"},"ap-east-1":{description:"Asia Pacific (Hong Kong)"},"ap-northeast-1":{description:"Asia Pacific (Tokyo)"},"ap-northeast-2":{description:"Asia Pacific (Seoul)"},"ap-northeast-3":{description:"Asia Pacific (Osaka)"},"ap-south-1":{description:"Asia Pacific (Mumbai)"},"ap-south-2":{description:"Asia Pacific (Hyderabad)"},"ap-southeast-1":{description:"Asia Pacific (Singapore)"},"ap-southeast-2":{description:"Asia Pacific (Sydney)"},"ap-southeast-3":{description:"Asia Pacific (Jakarta)"},"ap-southeast-4":{description:"Asia Pacific (Melbourne)"},"ap-southeast-5":{description:"Asia Pacific (Malaysia)"},"aws-global":{description:"AWS Standard global region"},"ca-central-1":{description:"Canada (Central)"},"ca-west-1":{description:"Canada West (Calgary)"},"eu-central-1":{description:"Europe (Frankfurt)"},"eu-central-2":{description:"Europe (Zurich)"},"eu-north-1":{description:"Europe (Stockholm)"},"eu-south-1":{description:"Europe (Milan)"},"eu-south-2":{description:"Europe (Spain)"},"eu-west-1":{description:"Europe (Ireland)"},"eu-west-2":{description:"Europe (London)"},"eu-west-3":{description:"Europe (Paris)"},"il-central-1":{description:"Israel (Tel Aviv)"},"me-central-1":{description:"Middle East (UAE)"},"me-south-1":{description:"Middle East (Bahrain)"},"sa-east-1":{description:"South America (Sao Paulo)"},"us-east-1":{description:"US East (N. Virginia)"},"us-east-2":{description:"US East (Ohio)"},"us-west-1":{description:"US West (N. California)"},"us-west-2":{description:"US West (Oregon)"}}},{id:"aws-cn",outputs:{dnsSuffix:"amazonaws.com.cn",dualStackDnsSuffix:"api.amazonwebservices.com.cn",implicitGlobalRegion:"cn-northwest-1",name:"aws-cn",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^cn\\-\\w+\\-\\d+$",regions:{"aws-cn-global":{description:"AWS China global region"},"cn-north-1":{description:"China (Beijing)"},"cn-northwest-1":{description:"China (Ningxia)"}}},{id:"aws-us-gov",outputs:{dnsSuffix:"amazonaws.com",dualStackDnsSuffix:"api.aws",implicitGlobalRegion:"us-gov-west-1",name:"aws-us-gov",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-gov\\-\\w+\\-\\d+$",regions:{"aws-us-gov-global":{description:"AWS GovCloud (US) global region"},"us-gov-east-1":{description:"AWS GovCloud (US-East)"},"us-gov-west-1":{description:"AWS GovCloud (US-West)"}}},{id:"aws-iso",outputs:{dnsSuffix:"c2s.ic.gov",dualStackDnsSuffix:"c2s.ic.gov",implicitGlobalRegion:"us-iso-east-1",name:"aws-iso",supportsDualStack:!1,supportsFIPS:!0},regionRegex:"^us\\-iso\\-\\w+\\-\\d+$",regions:{"aws-iso-global":{description:"AWS ISO (US) global region"},"us-iso-east-1":{description:"US ISO East"},"us-iso-west-1":{description:"US ISO WEST"}}},{id:"aws-iso-b",outputs:{dnsSuffix:"sc2s.sgov.gov",dualStackDnsSuffix:"sc2s.sgov.gov",implicitGlobalRegion:"us-isob-east-1",name:"aws-iso-b",supportsDualStack:!1,supportsFIPS:!0},regionRegex:"^us\\-isob\\-\\w+\\-\\d+$",regions:{"aws-iso-b-global":{description:"AWS ISOB (US) global region"},"us-isob-east-1":{description:"US ISOB East (Ohio)"}}},{id:"aws-iso-e",outputs:{dnsSuffix:"cloud.adc-e.uk",dualStackDnsSuffix:"cloud.adc-e.uk",implicitGlobalRegion:"eu-isoe-west-1",name:"aws-iso-e",supportsDualStack:!1,supportsFIPS:!0},regionRegex:"^eu\\-isoe\\-\\w+\\-\\d+$",regions:{"eu-isoe-west-1":{description:"EU ISOE West"}}},{id:"aws-iso-f",outputs:{dnsSuffix:"csp.hci.ic.gov",dualStackDnsSuffix:"csp.hci.ic.gov",implicitGlobalRegion:"us-isof-south-1",name:"aws-iso-f",supportsDualStack:!1,supportsFIPS:!0},regionRegex:"^us\\-isof\\-\\w+\\-\\d+$",regions:{}}],N2e="1.1",W2e={partitions:P2e,version:N2e};let K2e=W2e;const q2e=e=>{const{partitions:t}=K2e;for(const r of t){const{regions:i,outputs:o}=r;for(const[a,s]of Object.entries(i))if(a===e)return{...o,...s}}for(const r of t){const{regionRegex:i,outputs:o}=r;if(new RegExp(i).test(e))return{...o}}const n=t.find(r=>r.id==="aws");if(!n)throw new Error("Provided region was not found in the partition array or regex, and default partition with id 'aws' doesn't exist.");return{...n.outputs}},NH={isVirtualHostableS3Bucket:PH,parseArn:U2e,partition:q2e};Fv.aws=NH;function V2e(e,t,n){return e.$source||(e.$source={}),e.$source[t]=n,e}function bo(e,t,n){e.__aws_sdk_context?e.__aws_sdk_context.features||(e.__aws_sdk_context.features={}):e.__aws_sdk_context={features:{}},e.__aws_sdk_context.features[t]=n}const dB=e=>{var t,n;return Mv.isInstance(e)?((t=e.headers)==null?void 0:t.date)??((n=e.headers)==null?void 0:n.Date):void 0},WH=e=>new Date(Date.now()+e),z2e=(e,t)=>Math.abs(WH(t).getTime()-e)>=3e5,fB=(e,t)=>{const n=Date.parse(e);return z2e(n,t)?n-Date.now():t},Xp=(e,t)=>{if(!t)throw new Error(`Property \`${e}\` is not resolved for AWS SDK SigV4Auth`);return t},Q2e=async e=>{var u,l,d;const t=Xp("context",e.context),n=Xp("config",e.config),r=(d=(l=(u=t.endpointV2)==null?void 0:u.properties)==null?void 0:l.authSchemes)==null?void 0:d[0],o=await Xp("signer",n.signer)(r),a=e==null?void 0:e.signingRegion,s=e==null?void 0:e.signingRegionSet,c=e==null?void 0:e.signingName;return{config:n,signer:o,signingRegion:a,signingRegionSet:s,signingName:c}};class H2e{async sign(t,n,r){var d;if(!Hr.isInstance(t))throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");const i=await Q2e(r),{config:o,signer:a}=i;let{signingRegion:s,signingName:c}=i;const u=r.context;if(((d=u==null?void 0:u.authSchemes)==null?void 0:d.length)??0>1){const[p,h]=u.authSchemes;(p==null?void 0:p.name)==="sigv4a"&&(h==null?void 0:h.name)==="sigv4"&&(s=(h==null?void 0:h.signingRegion)??s,c=(h==null?void 0:h.signingName)??c)}return await a.sign(t,{signingDate:WH(o.systemClockOffset),signingRegion:s,signingService:c})}errorHandler(t){return n=>{const r=n.ServerTime??dB(n.$response);if(r){const i=Xp("config",t.config),o=i.systemClockOffset;i.systemClockOffset=fB(r,i.systemClockOffset),i.systemClockOffset!==o&&n.$metadata&&(n.$metadata.clockSkewCorrected=!0)}throw n}}successHandler(t,n){const r=dB(t);if(r){const i=Xp("config",n.config);i.systemClockOffset=fB(r,i.systemClockOffset)}}}const Y2e=(e,t,n)=>{let r,i,o,a=!1;const s=async()=>{i||(i=e());try{r=await i,o=!0,a=!1}finally{i=void 0}return r};return t===void 0?async c=>((!o||c!=null&&c.forceRefresh)&&(r=await s()),r):async c=>((!o||c!=null&&c.forceRefresh)&&(r=await s()),a?r:n&&!n(r)?(a=!0,r):(t(r)&&await s(),r))},G2e="X-Amz-Algorithm",J2e="X-Amz-Credential",KH="X-Amz-Date",Z2e="X-Amz-SignedHeaders",X2e="X-Amz-Expires",qH="X-Amz-Signature",VH="X-Amz-Security-Token",zH="authorization",QH=KH.toLowerCase(),eBe="date",tBe=[zH,QH,eBe],nBe=qH.toLowerCase(),ux="x-amz-content-sha256",rBe=VH.toLowerCase(),iBe={authorization:!0,"cache-control":!0,connection:!0,expect:!0,from:!0,"keep-alive":!0,"max-forwards":!0,pragma:!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,"user-agent":!0,"x-amzn-trace-id":!0},oBe=/^proxy-/,aBe=/^sec-/,jC="AWS4-HMAC-SHA256",sBe="AWS4-HMAC-SHA256-PAYLOAD",cBe="UNSIGNED-PAYLOAD",uBe=50,HH="aws4_request",lBe=60*60*24*7,wg={},UC=[],PC=(e,t,n)=>`${e}/${t}/${n}/${HH}`,dBe=async(e,t,n,r,i)=>{const o=await pB(e,t.secretAccessKey,t.accessKeyId),a=`${n}:${r}:${i}:${Ur(o)}:${t.sessionToken}`;if(a in wg)return wg[a];for(UC.push(a);UC.length>uBe;)delete wg[UC.shift()];let s=`AWS4${t.secretAccessKey}`;for(const c of[n,r,i,HH])s=await pB(e,s,c);return wg[a]=s},pB=(e,t,n)=>{const r=new e(t);return r.update(Zp(n)),r.digest()},hB=({headers:e},t,n)=>{const r={};for(const i of Object.keys(e).sort()){if(e[i]==null)continue;const o=i.toLowerCase();(o in iBe||t!=null&&t.has(o)||oBe.test(o)||aBe.test(o))&&(!n||n&&!n.has(o))||(r[o]=e[i].trim().replace(/\s+/g," "))}return r},fBe=({query:e={}})=>{const t=[],n={};for(const r of Object.keys(e)){if(r.toLowerCase()===nBe)continue;const i=Zc(r);t.push(i);const o=e[r];typeof o=="string"?n[i]=`${i}=${Zc(o)}`:Array.isArray(o)&&(n[i]=o.slice(0).reduce((a,s)=>a.concat([`${i}=${Zc(s)}`]),[]).sort().join("&"))}return t.sort().map(r=>n[r]).filter(r=>r).join("&")},pBe=e=>typeof ArrayBuffer=="function"&&e instanceof ArrayBuffer||Object.prototype.toString.call(e)==="[object ArrayBuffer]",NC=async({headers:e,body:t},n)=>{for(const r of Object.keys(e))if(r.toLowerCase()===ux)return e[r];if(t==null)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if(typeof t=="string"||ArrayBuffer.isView(t)||pBe(t)){const r=new n;return r.update(Zp(t)),Ur(await r.digest())}return cBe};class hBe{format(t){const n=[];for(const o of Object.keys(t)){const a=$d(o);n.push(Uint8Array.from([a.byteLength]),a,this.formatHeaderValue(t[o]))}const r=new Uint8Array(n.reduce((o,a)=>o+a.byteLength,0));let i=0;for(const o of n)r.set(o,i),i+=o.byteLength;return r}formatHeaderValue(t){switch(t.type){case"boolean":return Uint8Array.from([t.value?0:1]);case"byte":return Uint8Array.from([2,t.value]);case"short":const n=new DataView(new ArrayBuffer(3));return n.setUint8(0,3),n.setInt16(1,t.value,!1),new Uint8Array(n.buffer);case"integer":const r=new DataView(new ArrayBuffer(5));return r.setUint8(0,4),r.setInt32(1,t.value,!1),new Uint8Array(r.buffer);case"long":const i=new Uint8Array(9);return i[0]=5,i.set(t.value.bytes,1),i;case"binary":const o=new DataView(new ArrayBuffer(3+t.value.byteLength));o.setUint8(0,6),o.setUint16(1,t.value.byteLength,!1);const a=new Uint8Array(o.buffer);return a.set(t.value,3),a;case"string":const s=$d(t.value),c=new DataView(new ArrayBuffer(3+s.byteLength));c.setUint8(0,7),c.setUint16(1,s.byteLength,!1);const u=new Uint8Array(c.buffer);return u.set(s,3),u;case"timestamp":const l=new Uint8Array(9);return l[0]=8,l.set(mBe.fromNumber(t.value.valueOf()).bytes,1),l;case"uuid":if(!ABe.test(t.value))throw new Error(`Invalid UUID received: ${t.value}`);const d=new Uint8Array(17);return d[0]=9,d.set(kH(t.value.replace(/\-/g,"")),1),d}}}var AB;(function(e){e[e.boolTrue=0]="boolTrue",e[e.boolFalse=1]="boolFalse",e[e.byte=2]="byte",e[e.short=3]="short",e[e.integer=4]="integer",e[e.long=5]="long",e[e.byteArray=6]="byteArray",e[e.string=7]="string",e[e.timestamp=8]="timestamp",e[e.uuid=9]="uuid"})(AB||(AB={}));const ABe=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;let mBe=class YH{constructor(t){if(this.bytes=t,t.byteLength!==8)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(t){if(t>9223372036854776e3||t<-9223372036854776e3)throw new Error(`${t} is too large (or, if negative, too small) to represent as an Int64`);const n=new Uint8Array(8);for(let r=7,i=Math.abs(Math.round(t));r>-1&&i>0;r--,i/=256)n[r]=i;return t<0&&mB(n),new YH(n)}valueOf(){const t=this.bytes.slice(0),n=t[0]&128;return n&&mB(t),parseInt(Ur(t),16)*(n?-1:1)}toString(){return String(this.valueOf())}};function mB(e){for(let t=0;t<8;t++)e[t]^=255;for(let t=7;t>-1&&(e[t]++,e[t]===0);t--);}const gBe=(e,t)=>{e=e.toLowerCase();for(const n of Object.keys(t))if(e===n.toLowerCase())return!0;return!1},vBe=(e,t={})=>{var i,o;const{headers:n,query:r={}}=Hr.clone(e);for(const a of Object.keys(n)){const s=a.toLowerCase();(s.slice(0,6)==="x-amz-"&&!((i=t.unhoistableHeaders)!=null&&i.has(s))||(o=t.hoistableHeaders)!=null&&o.has(s))&&(r[a]=n[a],delete n[a])}return{...e,headers:n,query:r}},gB=e=>{e=Hr.clone(e);for(const t of Object.keys(e.headers))tBe.indexOf(t.toLowerCase())>-1&&delete e.headers[t];return e},yBe=e=>bBe(e).toISOString().replace(/\.\d{3}Z$/,"Z"),bBe=e=>typeof e=="number"?new Date(e*1e3):typeof e=="string"?Number(e)?new Date(Number(e)*1e3):new Date(e):e;class vB{constructor({applyChecksum:t,credentials:n,region:r,service:i,sha256:o,uriEscapePath:a=!0}){this.headerFormatter=new hBe,this.service=i,this.sha256=o,this.uriEscapePath=a,this.applyChecksum=typeof t=="boolean"?t:!0,this.regionProvider=ks(r),this.credentialProvider=ks(n)}async presign(t,n={}){const{signingDate:r=new Date,expiresIn:i=3600,unsignableHeaders:o,unhoistableHeaders:a,signableHeaders:s,hoistableHeaders:c,signingRegion:u,signingService:l}=n,d=await this.credentialProvider();this.validateResolvedCredentials(d);const p=u??await this.regionProvider(),{longDate:h,shortDate:A}=xg(r);if(i>lBe)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");const g=PC(A,p,l??this.service),v=vBe(gB(t),{unhoistableHeaders:a,hoistableHeaders:c});d.sessionToken&&(v.query[VH]=d.sessionToken),v.query[G2e]=jC,v.query[J2e]=`${d.accessKeyId}/${g}`,v.query[KH]=h,v.query[X2e]=i.toString(10);const b=hB(v,o,s);return v.query[Z2e]=yB(b),v.query[qH]=await this.getSignature(h,g,this.getSigningKey(d,p,A,l),this.createCanonicalRequest(v,b,await NC(t,this.sha256))),v}async sign(t,n){return typeof t=="string"?this.signString(t,n):t.headers&&t.payload?this.signEvent(t,n):t.message?this.signMessage(t,n):this.signRequest(t,n)}async signEvent({headers:t,payload:n},{signingDate:r=new Date,priorSignature:i,signingRegion:o,signingService:a}){const s=o??await this.regionProvider(),{shortDate:c,longDate:u}=xg(r),l=PC(c,s,a??this.service),d=await NC({headers:{},body:n},this.sha256),p=new this.sha256;p.update(t);const h=Ur(await p.digest()),A=[sBe,u,l,i,h,d].join(`
|
|
9
|
+
`);return this.signString(A,{signingDate:r,signingRegion:s,signingService:a})}async signMessage(t,{signingDate:n=new Date,signingRegion:r,signingService:i}){return this.signEvent({headers:this.headerFormatter.format(t.message.headers),payload:t.message.body},{signingDate:n,signingRegion:r,signingService:i,priorSignature:t.priorSignature}).then(a=>({message:t.message,signature:a}))}async signString(t,{signingDate:n=new Date,signingRegion:r,signingService:i}={}){const o=await this.credentialProvider();this.validateResolvedCredentials(o);const a=r??await this.regionProvider(),{shortDate:s}=xg(n),c=new this.sha256(await this.getSigningKey(o,a,s,i));return c.update(Zp(t)),Ur(await c.digest())}async signRequest(t,{signingDate:n=new Date,signableHeaders:r,unsignableHeaders:i,signingRegion:o,signingService:a}={}){const s=await this.credentialProvider();this.validateResolvedCredentials(s);const c=o??await this.regionProvider(),u=gB(t),{longDate:l,shortDate:d}=xg(n),p=PC(d,c,a??this.service);u.headers[QH]=l,s.sessionToken&&(u.headers[rBe]=s.sessionToken);const h=await NC(u,this.sha256);!gBe(ux,u.headers)&&this.applyChecksum&&(u.headers[ux]=h);const A=hB(u,i,r),g=await this.getSignature(l,p,this.getSigningKey(s,c,d,a),this.createCanonicalRequest(u,A,h));return u.headers[zH]=`${jC} Credential=${s.accessKeyId}/${p}, SignedHeaders=${yB(A)}, Signature=${g}`,u}createCanonicalRequest(t,n,r){const i=Object.keys(n).sort();return`${t.method}
|
|
10
|
+
${this.getCanonicalPath(t)}
|
|
11
|
+
${fBe(t)}
|
|
12
|
+
${i.map(o=>`${o}:${n[o]}`).join(`
|
|
13
|
+
`)}
|
|
14
|
+
|
|
15
|
+
${i.join(";")}
|
|
16
|
+
${r}`}async createStringToSign(t,n,r){const i=new this.sha256;i.update(Zp(r));const o=await i.digest();return`${jC}
|
|
17
|
+
${t}
|
|
18
|
+
${n}
|
|
19
|
+
${Ur(o)}`}getCanonicalPath({path:t}){if(this.uriEscapePath){const n=[];for(const o of t.split("/"))(o==null?void 0:o.length)!==0&&o!=="."&&(o===".."?n.pop():n.push(o));const r=`${t!=null&&t.startsWith("/")?"/":""}${n.join("/")}${n.length>0&&(t!=null&&t.endsWith("/"))?"/":""}`;return Zc(r).replace(/%2F/g,"/")}return t}async getSignature(t,n,r,i){const o=await this.createStringToSign(t,n,i),a=new this.sha256(await r);return a.update(Zp(o)),Ur(await a.digest())}getSigningKey(t,n,r,i){return dBe(this.sha256,t,r,n,i||this.service)}validateResolvedCredentials(t){if(typeof t!="object"||typeof t.accessKeyId!="string"||typeof t.secretAccessKey!="string")throw new Error("Resolved credential object is not valid")}}const xg=e=>{const t=yBe(e).replace(/[\-:]/g,"");return{longDate:t,shortDate:t.slice(0,8)}},yB=e=>Object.keys(e).sort().join(";"),SBe=e=>{let t=!1,n;e.credentials&&(t=!0,n=h2e(e.credentials,p2e,OH)),n||(e.credentialDefaultProvider?n=kp(e.credentialDefaultProvider(Object.assign({},e,{parentClientConfig:e}))):n=async()=>{throw new Error("`credentials` is missing")});const{signingEscapePath:r=!0,systemClockOffset:i=e.systemClockOffset||0,sha256:o}=e;let a;return e.signer?a=kp(e.signer):e.regionInfoProvider?a=()=>kp(e.region)().then(async s=>[await e.regionInfoProvider(s,{useFipsEndpoint:await e.useFipsEndpoint(),useDualstackEndpoint:await e.useDualstackEndpoint()})||{},s]).then(([s,c])=>{const{signingRegion:u,signingService:l}=s;e.signingRegion=e.signingRegion||u||c,e.signingName=e.signingName||l||e.serviceId;const d={...e,credentials:n,region:e.signingRegion,service:e.signingName,sha256:o,uriEscapePath:r},p=e.signerConstructor||vB;return new p(d)}):a=async s=>{s=Object.assign({},{name:"sigv4",signingName:e.signingName||e.defaultSigningName,signingRegion:await kp(e.region)(),properties:{}},s);const c=s.signingRegion,u=s.signingName;e.signingRegion=e.signingRegion||c,e.signingName=e.signingName||u||e.serviceId;const l={...e,credentials:n,region:e.signingRegion,service:e.signingName,sha256:o,uriEscapePath:r},d=e.signerConstructor||vB;return new d(l)},{...e,systemClockOffset:i,signingEscapePath:r,credentials:t?async()=>n().then(s=>V2e(s,"CREDENTIALS_CODE","e")):n,signer:a}},jc=(e,t)=>{const n=[];if(e&&n.push(e),t)for(const r of t)n.push(r);return n},hs=(e,t)=>`${e||"anonymous"}${t&&t.length>0?` (a.k.a. ${t.join(",")})`:""}`,Lv=()=>{let e=[],t=[],n=!1;const r=new Set,i=d=>d.sort((p,h)=>bB[h.step]-bB[p.step]||SB[h.priority||"normal"]-SB[p.priority||"normal"]),o=d=>{let p=!1;const h=A=>{const g=jc(A.name,A.aliases);if(g.includes(d)){p=!0;for(const v of g)r.delete(v);return!1}return!0};return e=e.filter(h),t=t.filter(h),p},a=d=>{let p=!1;const h=A=>{if(A.middleware===d){p=!0;for(const g of jc(A.name,A.aliases))r.delete(g);return!1}return!0};return e=e.filter(h),t=t.filter(h),p},s=d=>{var p;return e.forEach(h=>{d.add(h.middleware,{...h})}),t.forEach(h=>{d.addRelativeTo(h.middleware,{...h})}),(p=d.identifyOnResolve)==null||p.call(d,l.identifyOnResolve()),d},c=d=>{const p=[];return d.before.forEach(h=>{h.before.length===0&&h.after.length===0?p.push(h):p.push(...c(h))}),p.push(d),d.after.reverse().forEach(h=>{h.before.length===0&&h.after.length===0?p.push(h):p.push(...c(h))}),p},u=(d=!1)=>{const p=[],h=[],A={};return e.forEach(v=>{const b={...v,before:[],after:[]};for(const w of jc(b.name,b.aliases))A[w]=b;p.push(b)}),t.forEach(v=>{const b={...v,before:[],after:[]};for(const w of jc(b.name,b.aliases))A[w]=b;h.push(b)}),h.forEach(v=>{if(v.toMiddleware){const b=A[v.toMiddleware];if(b===void 0){if(d)return;throw new Error(`${v.toMiddleware} is not found when adding ${hs(v.name,v.aliases)} middleware ${v.relation} ${v.toMiddleware}`)}v.relation==="after"&&b.after.push(v),v.relation==="before"&&b.before.push(v)}}),i(p).map(c).reduce((v,b)=>(v.push(...b),v),[])},l={add:(d,p={})=>{const{name:h,override:A,aliases:g}=p,v={step:"initialize",priority:"normal",middleware:d,...p},b=jc(h,g);if(b.length>0){if(b.some(w=>r.has(w))){if(!A)throw new Error(`Duplicate middleware name '${hs(h,g)}'`);for(const w of b){const S=e.findIndex(C=>{var x;return C.name===w||((x=C.aliases)==null?void 0:x.some(T=>T===w))});if(S===-1)continue;const y=e[S];if(y.step!==v.step||v.priority!==y.priority)throw new Error(`"${hs(y.name,y.aliases)}" middleware with ${y.priority} priority in ${y.step} step cannot be overridden by "${hs(h,g)}" middleware with ${v.priority} priority in ${v.step} step.`);e.splice(S,1)}}for(const w of b)r.add(w)}e.push(v)},addRelativeTo:(d,p)=>{const{name:h,override:A,aliases:g}=p,v={middleware:d,...p},b=jc(h,g);if(b.length>0){if(b.some(w=>r.has(w))){if(!A)throw new Error(`Duplicate middleware name '${hs(h,g)}'`);for(const w of b){const S=t.findIndex(C=>{var x;return C.name===w||((x=C.aliases)==null?void 0:x.some(T=>T===w))});if(S===-1)continue;const y=t[S];if(y.toMiddleware!==v.toMiddleware||y.relation!==v.relation)throw new Error(`"${hs(y.name,y.aliases)}" middleware ${y.relation} "${y.toMiddleware}" middleware cannot be overridden by "${hs(h,g)}" middleware ${v.relation} "${v.toMiddleware}" middleware.`);t.splice(S,1)}}for(const w of b)r.add(w)}t.push(v)},clone:()=>s(Lv()),use:d=>{d.applyToStack(l)},remove:d=>typeof d=="string"?o(d):a(d),removeByTag:d=>{let p=!1;const h=A=>{const{tags:g,name:v,aliases:b}=A;if(g&&g.includes(d)){const w=jc(v,b);for(const S of w)r.delete(S);return p=!0,!1}return!0};return e=e.filter(h),t=t.filter(h),p},concat:d=>{var h;const p=s(Lv());return p.use(d),p.identifyOnResolve(n||p.identifyOnResolve()||(((h=d.identifyOnResolve)==null?void 0:h.call(d))??!1)),p},applyToStack:s,identify:()=>u(!0).map(d=>{const p=d.step??d.relation+" "+d.toMiddleware;return hs(d.name,d.aliases)+" - "+p}),identifyOnResolve(d){return typeof d=="boolean"&&(n=d),n},resolve:(d,p)=>{for(const h of u().map(A=>A.middleware).reverse())d=h(d,p);return n&&console.log(l.identify()),d}};return l},bB={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},SB={high:3,normal:2,low:1};class CBe{constructor(t){this.config=t,this.middlewareStack=Lv()}send(t,n,r){const i=typeof n!="function"?n:void 0,o=typeof n=="function"?n:r,a=i===void 0&&this.config.cacheMiddleware===!0;let s;if(a){this.handlers||(this.handlers=new WeakMap);const c=this.handlers;c.has(t.constructor)?s=c.get(t.constructor):(s=t.resolveMiddleware(this.middlewareStack,this.config,i),c.set(t.constructor,s))}else delete this.handlers,s=t.resolveMiddleware(this.middlewareStack,this.config,i);if(o)s(t).then(c=>o(null,c.output),c=>o(c)).catch(()=>{});else return s(t).then(c=>c.output)}destroy(){var t,n,r;(r=(n=(t=this.config)==null?void 0:t.requestHandler)==null?void 0:n.destroy)==null||r.call(n),delete this.handlers}}class GH{constructor(){this.middlewareStack=Lv()}static classBuilder(){return new wBe}resolveMiddlewareWithContext(t,n,r,{middlewareFn:i,clientName:o,commandName:a,inputFilterSensitiveLog:s,outputFilterSensitiveLog:c,smithyContext:u,additionalContext:l,CommandCtor:d}){for(const v of i.bind(this)(d,t,n,r))this.middlewareStack.use(v);const p=t.concat(this.middlewareStack),{logger:h}=n,A={logger:h,clientName:o,commandName:a,inputFilterSensitiveLog:s,outputFilterSensitiveLog:c,[sx]:{commandInstance:this,...u},...l},{requestHandler:g}=n;return p.resolve(v=>g.handle(v.request,r||{}),A)}}class wBe{constructor(){this._init=()=>{},this._ep={},this._middlewareFn=()=>[],this._commandName="",this._clientName="",this._additionalContext={},this._smithyContext={},this._inputFilterSensitiveLog=t=>t,this._outputFilterSensitiveLog=t=>t,this._serializer=null,this._deserializer=null}init(t){this._init=t}ep(t){return this._ep=t,this}m(t){return this._middlewareFn=t,this}s(t,n,r={}){return this._smithyContext={service:t,operation:n,...r},this}c(t={}){return this._additionalContext=t,this}n(t,n){return this._clientName=t,this._commandName=n,this}f(t=r=>r,n=r=>r){return this._inputFilterSensitiveLog=t,this._outputFilterSensitiveLog=n,this}ser(t){return this._serializer=t,this}de(t){return this._deserializer=t,this}build(){const t=this;let n;return n=class extends GH{static getEndpointParameterInstructions(){return t._ep}constructor(...[r]){super(),this.serialize=t._serializer,this.deserialize=t._deserializer,this.input=r??{},t._init(this)}resolveMiddleware(r,i,o){return this.resolveMiddlewareWithContext(r,i,o,{CommandCtor:n,middlewareFn:t._middlewareFn,clientName:t._clientName,commandName:t._commandName,inputFilterSensitiveLog:t._inputFilterSensitiveLog,outputFilterSensitiveLog:t._outputFilterSensitiveLog,smithyContext:t._smithyContext,additionalContext:t._additionalContext})}}}}const lx="***SensitiveInformation***",xBe=e=>{if(e!=null){if(typeof e=="string"){const t=parseFloat(e);if(!Number.isNaN(t))return String(t)!==String(e)&&eY.warn(XH(`Expected number but observed string: ${e}`)),t}if(typeof e=="number")return e;throw new TypeError(`Expected number, got ${typeof e}: ${e}`)}},_Be=e=>{if(e!=null){if(Number.isInteger(e)&&!Number.isNaN(e))return e;throw new TypeError(`Expected integer, got ${typeof e}: ${e}`)}},JH=e=>TBe(e,32),TBe=(e,t)=>{const n=_Be(e);if(n!==void 0&&IBe(n,t)!==n)throw new TypeError(`Expected ${t}-bit integer, got ${e}`);return n},IBe=(e,t)=>{switch(t){case 32:return Int32Array.of(e)[0];case 16:return Int16Array.of(e)[0];case 8:return Int8Array.of(e)[0]}},EBe=(e,t)=>{if(e==null)throw t?new TypeError(`Expected a non-null value for ${t}`):new TypeError("Expected a non-null value");return e},ZH=e=>{if(e==null)return;if(typeof e=="object"&&!Array.isArray(e))return e;const t=Array.isArray(e)?"array":typeof e;throw new TypeError(`Expected object, got ${t}: ${e}`)},Ge=e=>{if(e!=null){if(typeof e=="string")return e;if(["boolean","number","bigint"].includes(typeof e))return eY.warn(XH(`Expected string, got ${typeof e}: ${e}`)),String(e);throw new TypeError(`Expected string, got ${typeof e}: ${e}`)}},RBe=e=>{if(e==null)return;const t=ZH(e),n=Object.entries(t).filter(([,r])=>r!=null).map(([r])=>r);if(n.length===0)throw new TypeError("Unions must have exactly one non-null member. None were found.");if(n.length>1)throw new TypeError(`Unions must have exactly one non-null member. Keys ${n} were not null.`);return t},CB=e=>typeof e=="string"?$Be(e):xBe(e),$Be=e=>{switch(e){case"NaN":return NaN;case"Infinity":return 1/0;case"-Infinity":return-1/0;default:throw new Error(`Unable to parse float value: ${e}`)}},XH=e=>String(new TypeError(e).stack||e).split(`
|
|
20
|
+
`).slice(0,5).filter(t=>!t.includes("stackTraceWarning")).join(`
|
|
21
|
+
`),eY={warn:console.warn};class bF extends Error{constructor(t){super(t.message),Object.setPrototypeOf(this,bF.prototype),this.name=t.name,this.$fault=t.$fault,this.$metadata=t.$metadata}}const li=(e,t={})=>{Object.entries(t).filter(([,r])=>r!==void 0).forEach(([r,i])=>{(e[r]==null||e[r]==="")&&(e[r]=i)});const n=e.message||e.Message||"UnknownError";return e.message=n,delete e.Message,e},kBe=({output:e,parsedBody:t,exceptionCtor:n,errorCode:r})=>{const i=MBe(e),o=i.httpStatusCode?i.httpStatusCode+"":void 0,a=new n({name:(t==null?void 0:t.code)||(t==null?void 0:t.Code)||r||o||"UnknownError",$fault:"client",$metadata:i});throw li(a,t)},OBe=e=>({output:t,parsedBody:n,errorCode:r})=>{kBe({output:t,parsedBody:n,exceptionCtor:e,errorCode:r})},MBe=e=>({httpStatusCode:e.statusCode,requestId:e.headers["x-amzn-requestid"]??e.headers["x-amzn-request-id"]??e.headers["x-amz-request-id"],extendedRequestId:e.headers["x-amz-id-2"],cfId:e.headers["x-amz-cf-id"]}),FBe=e=>{switch(e){case"standard":return{retryMode:"standard",connectionTimeout:3100};case"in-region":return{retryMode:"standard",connectionTimeout:1100};case"cross-region":return{retryMode:"standard",connectionTimeout:3100};case"mobile":return{retryMode:"standard",connectionTimeout:3e4};default:return{}}},LBe=e=>{const t=[];for(const n in Ov){const r=Ov[n];e[r]!==void 0&&t.push({algorithmId:()=>r,checksumConstructor:()=>e[r]})}return{_checksumAlgorithms:t,addChecksumAlgorithm(n){this._checksumAlgorithms.push(n)},checksumAlgorithms(){return this._checksumAlgorithms}}},BBe=e=>{const t={};return e.checksumAlgorithms().forEach(n=>{t[n.algorithmId()]=n.checksumConstructor()}),t},DBe=e=>{let t=e.retryStrategy;return{setRetryStrategy(n){t=n},retryStrategy(){return t}}},jBe=e=>{const t={};return t.retryStrategy=e.retryStrategy(),t},UBe=e=>({...LBe(e),...DBe(e)}),PBe=e=>({...BBe(e),...jBe(e)});class tY{trace(){}debug(){}info(){}warn(){}error(){}}function Or(e,t,n){let r,i,o;if(typeof t>"u"&&typeof n>"u")r={},o=e;else{if(r=e,typeof t=="function")return i=t,o=n,NBe(r,i,o);o=t}for(const a of Object.keys(o)){if(!Array.isArray(o[a])){r[a]=o[a];continue}nY(r,null,o,a)}return r}const De=(e,t)=>{const n={};for(const r in t)nY(n,e,t,r);return n},NBe=(e,t,n)=>Or(e,Object.entries(n).reduce((r,[i,o])=>(Array.isArray(o)?r[i]=o:typeof o=="function"?r[i]=[t,o()]:r[i]=[t,o],r),{})),nY=(e,t,n,r)=>{if(t!==null){let a=n[r];typeof a=="function"&&(a=[,a]);const[s=WBe,c=KBe,u=r]=a;(typeof s=="function"&&s(t[u])||typeof s!="function"&&s)&&(e[r]=c(t[u]));return}let[i,o]=n[r];if(typeof o=="function"){let a;const s=i===void 0&&(a=o())!=null,c=typeof i=="function"&&!!i(void 0)||typeof i!="function"&&!!i;s?e[r]=a:c&&(e[r]=o())}else{const a=i===void 0&&o!=null,s=typeof i=="function"&&!!i(o)||typeof i!="function"&&!!i;(a||s)&&(e[r]=o)}},WBe=e=>e!=null,KBe=e=>e,wB=e=>{if(e!==e)return"NaN";switch(e){case 1/0:return"Infinity";case-1/0:return"-Infinity";default:return e}},vt=e=>{if(e==null)return{};if(Array.isArray(e))return e.filter(t=>t!=null).map(vt);if(typeof e=="object"){const t={};for(const n of Object.keys(e))e[n]!=null&&(t[n]=vt(e[n]));return t}return e},Tc=e=>{if(e!=null)return typeof e=="object"&&"__type"in e&&delete e.__type,RBe(e)},qBe=(e,t)=>o2e(e,t).then(n=>t.utf8Encoder(n)),rY=(e,t)=>qBe(e,t).then(n=>{if(n.length)try{return JSON.parse(n)}catch(r){throw(r==null?void 0:r.name)==="SyntaxError"&&Object.defineProperty(r,"$responseBodyText",{value:n}),r}return{}}),VBe=async(e,t)=>{const n=await rY(e,t);return n.message=n.message??n.Message,n},zBe=(e,t)=>{const n=(o,a)=>Object.keys(o).find(s=>s.toLowerCase()===a.toLowerCase()),r=o=>{let a=o;return typeof a=="number"&&(a=a.toString()),a.indexOf(",")>=0&&(a=a.split(",")[0]),a.indexOf(":")>=0&&(a=a.split(":")[0]),a.indexOf("#")>=0&&(a=a.split("#")[1]),a},i=n(e.headers,"x-amzn-errortype");if(i!==void 0)return r(e.headers[i]);if(t.code!==void 0)return r(t.code);if(t.__type!==void 0)return r(t.__type)},QBe=/\d{12}\.ddb/;async function HBe(e,t,n){var o,a,s,c,u,l,d;const r=n.request;if(((o=r==null?void 0:r.headers)==null?void 0:o["smithy-protocol"])==="rpc-v2-cbor"&&bo(e,"PROTOCOL_RPC_V2_CBOR","M"),typeof t.retryStrategy=="function"){const p=await t.retryStrategy();typeof p.acquireInitialRetryToken=="function"?(s=(a=p.constructor)==null?void 0:a.name)!=null&&s.includes("Adaptive")?bo(e,"RETRY_MODE_ADAPTIVE","F"):bo(e,"RETRY_MODE_STANDARD","E"):bo(e,"RETRY_MODE_LEGACY","D")}if(typeof t.accountIdEndpointMode=="function"){const p=e.endpointV2;switch(String((c=p==null?void 0:p.url)==null?void 0:c.hostname).match(QBe)&&bo(e,"ACCOUNT_ID_ENDPOINT","O"),await((u=t.accountIdEndpointMode)==null?void 0:u.call(t))){case"disabled":bo(e,"ACCOUNT_ID_MODE_DISABLED","Q");break;case"preferred":bo(e,"ACCOUNT_ID_MODE_PREFERRED","P");break;case"required":bo(e,"ACCOUNT_ID_MODE_REQUIRED","R");break}}const i=(d=(l=e.__smithy_context)==null?void 0:l.selectedHttpAuthScheme)==null?void 0:d.identity;if(i!=null&&i.$source){const p=i;p.accountId&&bo(e,"RESOLVED_ACCOUNT_ID","T");for(const[h,A]of Object.entries(p.$source??{}))bo(e,h,A)}}const xB="user-agent",WC="x-amz-user-agent",_B=" ",KC="/",YBe=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w]/g,GBe=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w\#]/g,TB="-",JBe=1024;function ZBe(e){let t="";for(const n in e){const r=e[n];if(t.length+r.length+1<=JBe){t.length?t+=","+r:t+=r;continue}break}return t}const XBe=e=>(t,n)=>async r=>{var h,A,g,v;const{request:i}=r;if(!Hr.isInstance(i))return t(r);const{headers:o}=i,a=((h=n==null?void 0:n.userAgent)==null?void 0:h.map(_g))||[],s=(await e.defaultUserAgentProvider()).map(_g);await HBe(n,e,r);const c=n;s.push(`m/${ZBe(Object.assign({},(A=n.__smithy_context)==null?void 0:A.features,(g=c.__aws_sdk_context)==null?void 0:g.features))}`);const u=((v=e==null?void 0:e.customUserAgent)==null?void 0:v.map(_g))||[],l=await e.userAgentAppId();l&&s.push(_g([`app/${l}`]));const d=[].concat([...s,...a,...u]).join(_B),p=[...s.filter(b=>b.startsWith("aws-sdk-")),...u].join(_B);return e.runtime!=="browser"?(p&&(o[WC]=o[WC]?`${o[xB]} ${p}`:p),o[xB]=d):o[WC]=d,t({...r,request:i})},_g=e=>{var a;const t=e[0].split(KC).map(s=>s.replace(YBe,TB)).join(KC),n=(a=e[1])==null?void 0:a.replace(GBe,TB),r=t.indexOf(KC),i=t.substring(0,r);let o=t.substring(r+1);return i==="api"&&(o=o.toLowerCase()),[i,o,n].filter(s=>s&&s.length>0).reduce((s,c,u)=>{switch(u){case 0:return c;case 1:return`${s}/${c}`;default:return`${s}#${c}`}},"")},eDe={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},tDe=e=>({applyToStack:t=>{t.add(XBe(e),eDe)}});var IB;(function(e){e.ENV="env",e.CONFIG="shared config entry"})(IB||(IB={}));const nDe=!1,rDe=!1,iY=e=>typeof e=="string"&&(e.startsWith("fips-")||e.endsWith("-fips")),EB=e=>iY(e)?["fips-aws-global","aws-fips"].includes(e)?"us-east-1":e.replace(/fips-(dkr-|prod-)?|-fips/,""):e,iDe=e=>{const{region:t,useFipsEndpoint:n}=e;if(!t)throw new Error("Region is missing");return{...e,region:async()=>{if(typeof t=="string")return EB(t);const r=await t();return EB(r)},useFipsEndpoint:async()=>{const r=typeof t=="string"?t:await t();return iY(r)?!0:typeof n!="function"?Promise.resolve(!!n):n()}}},oDe=e=>({...e,eventStreamMarshaller:e.eventStreamSerdeProvider(e)}),RB="content-length";function aDe(e){return t=>async n=>{const r=n.request;if(Hr.isInstance(r)){const{body:i,headers:o}=r;if(i&&Object.keys(o).map(a=>a.toLowerCase()).indexOf(RB)===-1)try{const a=e(i);r.headers={...r.headers,[RB]:String(a)}}catch{}}return t({...n,request:r})}}const sDe={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},cDe=e=>({applyToStack:t=>{t.add(aDe(e.bodyLengthChecker),sDe)}}),uDe=async e=>{const t=(e==null?void 0:e.Bucket)||"";if(typeof e.Bucket=="string"&&(e.Bucket=t.replace(/#/g,encodeURIComponent("#")).replace(/\?/g,encodeURIComponent("?"))),hDe(t)){if(e.ForcePathStyle===!0)throw new Error("Path-style addressing cannot be used with ARN buckets")}else(!pDe(t)||t.indexOf(".")!==-1&&!String(e.Endpoint).startsWith("http:")||t.toLowerCase()!==t||t.length<3)&&(e.ForcePathStyle=!0);return e.DisableMultiRegionAccessPoints&&(e.disableMultiRegionAccessPoints=!0,e.DisableMRAP=!0),e},lDe=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/,dDe=/(\d+\.){3}\d+/,fDe=/\.\./,pDe=e=>lDe.test(e)&&!dDe.test(e)&&!fDe.test(e),hDe=e=>{const[t,n,r,,,i]=e.split(":"),o=t==="arn"&&e.split(":").length>=6,a=!!(o&&n&&r&&i);if(o&&!a)throw new Error(`Invalid ARN: ${e} was an invalid ARN.`);return a},ADe=(e,t,n)=>{const r=async()=>{const i=n[e]??n[t];return typeof i=="function"?i():i};return e==="credentialScope"||t==="CredentialScope"?async()=>{const i=typeof n.credentials=="function"?await n.credentials():n.credentials;return(i==null?void 0:i.credentialScope)??(i==null?void 0:i.CredentialScope)}:e==="accountId"||t==="AccountId"?async()=>{const i=typeof n.credentials=="function"?await n.credentials():n.credentials;return(i==null?void 0:i.accountId)??(i==null?void 0:i.AccountId)}:e==="endpoint"||t==="endpoint"?async()=>{const i=await r();if(i&&typeof i=="object"){if("url"in i)return i.url.href;if("hostname"in i){const{protocol:o,hostname:a,port:s,path:c}=i;return`${o}//${a}${s?":"+s:""}${c}`}}return i}:r},oY=async e=>{};function mDe(e){const t={};if(e=e.replace(/^\?/,""),e)for(const n of e.split("&")){let[r,i=null]=n.split("=");r=decodeURIComponent(r),i&&(i=decodeURIComponent(i)),r in t?Array.isArray(t[r])?t[r].push(i):t[r]=[t[r],i]:t[r]=i}return t}const Bv=e=>{if(typeof e=="string")return Bv(new URL(e));const{hostname:t,pathname:n,port:r,protocol:i,search:o}=e;let a;return o&&(a=mDe(o)),{hostname:t,port:r?parseInt(r):void 0,protocol:i,path:n,query:a}},aY=e=>typeof e=="object"?"url"in e?Bv(e.url):e:Bv(e),gDe=async(e,t,n,r)=>{if(!n.endpoint){let a;n.serviceConfiguredEndpoint?a=await n.serviceConfiguredEndpoint():a=await oY(n.serviceId),a&&(n.endpoint=()=>Promise.resolve(aY(a)))}const i=await vDe(e,t,n);if(typeof n.endpointProvider!="function")throw new Error("config.endpointProvider is not set.");return n.endpointProvider(i,r)},vDe=async(e,t,n)=>{var o;const r={},i=((o=t==null?void 0:t.getEndpointParameterInstructions)==null?void 0:o.call(t))||{};for(const[a,s]of Object.entries(i))switch(s.type){case"staticContextParams":r[a]=s.value;break;case"contextParams":r[a]=e[s.name];break;case"clientContextParams":case"builtInParams":r[a]=await ADe(s.name,a,n)();break;default:throw new Error("Unrecognized endpoint parameter instruction: "+JSON.stringify(s))}return Object.keys(i).length===0&&Object.assign(r,n),String(n.serviceId).toLowerCase()==="s3"&&await uDe(r),r},yDe=({config:e,instructions:t})=>(n,r)=>async i=>{var s,c,u;e.endpoint&&u2e(r,"ENDPOINT_OVERRIDE","N");const o=await gDe(i.input,{getEndpointParameterInstructions(){return t}},{...e},r);r.endpointV2=o,r.authSchemes=(s=o.properties)==null?void 0:s.authSchemes;const a=(c=r.authSchemes)==null?void 0:c[0];if(a){r.signing_region=a.signingRegion,r.signing_service=a.signingName;const l=cS(r),d=(u=l==null?void 0:l.selectedHttpAuthScheme)==null?void 0:u.httpAuthOption;d&&(d.signingProperties=Object.assign(d.signingProperties||{},{signing_region:a.signingRegion,signingRegion:a.signingRegion,signing_service:a.signingName,signingName:a.signingName,signingRegionSet:a.signingRegionSet},a.properties))}return n({...i})},bDe={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:mF.name},SDe=(e,t)=>({applyToStack:n=>{n.addRelativeTo(yDe({config:e,instructions:t}),bDe)}}),CDe=e=>{const t=e.tls??!0,{endpoint:n}=e,r=n!=null?async()=>aY(await ks(n)()):void 0,o={...e,endpoint:r,tls:t,isCustomEndpoint:!!n,useDualstackEndpoint:ks(e.useDualstackEndpoint??!1),useFipsEndpoint:ks(e.useFipsEndpoint??!1)};let a;return o.serviceConfiguredEndpoint=async()=>(e.serviceId&&!a&&(a=oY(e.serviceId)),a),o};var kd;(function(e){e.STANDARD="standard",e.ADAPTIVE="adaptive"})(kd||(kd={}));const Dv=3,wDe=kd.STANDARD,xDe=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],_De=["TimeoutError","RequestTimeout","RequestTimeoutException"],TDe=[500,502,503,504],IDe=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT"],EDe=e=>{var t;return(t=e.$metadata)==null?void 0:t.clockSkewCorrected},sY=e=>{var t,n;return((t=e.$metadata)==null?void 0:t.httpStatusCode)===429||xDe.includes(e.name)||((n=e.$retryable)==null?void 0:n.throttling)==!0},SF=(e,t=0)=>{var n;return EDe(e)||_De.includes(e.name)||IDe.includes((e==null?void 0:e.code)||"")||TDe.includes(((n=e.$metadata)==null?void 0:n.httpStatusCode)||0)||e.cause!==void 0&&t<=10&&SF(e.cause,t+1)},RDe=e=>{var t;if(((t=e.$metadata)==null?void 0:t.httpStatusCode)!==void 0){const n=e.$metadata.httpStatusCode;return 500<=n&&n<=599&&!SF(e)}return!1};class lS{constructor(t){this.currentCapacity=0,this.enabled=!1,this.lastMaxRate=0,this.measuredTxRate=0,this.requestCount=0,this.lastTimestamp=0,this.timeWindow=0,this.beta=(t==null?void 0:t.beta)??.7,this.minCapacity=(t==null?void 0:t.minCapacity)??1,this.minFillRate=(t==null?void 0:t.minFillRate)??.5,this.scaleConstant=(t==null?void 0:t.scaleConstant)??.4,this.smooth=(t==null?void 0:t.smooth)??.8;const n=this.getCurrentTimeInSeconds();this.lastThrottleTime=n,this.lastTxRateBucket=Math.floor(this.getCurrentTimeInSeconds()),this.fillRate=this.minFillRate,this.maxCapacity=this.minCapacity}getCurrentTimeInSeconds(){return Date.now()/1e3}async getSendToken(){return this.acquireTokenBucket(1)}async acquireTokenBucket(t){if(this.enabled){if(this.refillTokenBucket(),t>this.currentCapacity){const n=(t-this.currentCapacity)/this.fillRate*1e3;await new Promise(r=>lS.setTimeoutFn(r,n))}this.currentCapacity=this.currentCapacity-t}}refillTokenBucket(){const t=this.getCurrentTimeInSeconds();if(!this.lastTimestamp){this.lastTimestamp=t;return}const n=(t-this.lastTimestamp)*this.fillRate;this.currentCapacity=Math.min(this.maxCapacity,this.currentCapacity+n),this.lastTimestamp=t}updateClientSendingRate(t){let n;if(this.updateMeasuredRate(),sY(t)){const i=this.enabled?Math.min(this.measuredTxRate,this.fillRate):this.measuredTxRate;this.lastMaxRate=i,this.calculateTimeWindow(),this.lastThrottleTime=this.getCurrentTimeInSeconds(),n=this.cubicThrottle(i),this.enableTokenBucket()}else this.calculateTimeWindow(),n=this.cubicSuccess(this.getCurrentTimeInSeconds());const r=Math.min(n,2*this.measuredTxRate);this.updateTokenBucketRate(r)}calculateTimeWindow(){this.timeWindow=this.getPrecise(Math.pow(this.lastMaxRate*(1-this.beta)/this.scaleConstant,1/3))}cubicThrottle(t){return this.getPrecise(t*this.beta)}cubicSuccess(t){return this.getPrecise(this.scaleConstant*Math.pow(t-this.lastThrottleTime-this.timeWindow,3)+this.lastMaxRate)}enableTokenBucket(){this.enabled=!0}updateTokenBucketRate(t){this.refillTokenBucket(),this.fillRate=Math.max(t,this.minFillRate),this.maxCapacity=Math.max(t,this.minCapacity),this.currentCapacity=Math.min(this.currentCapacity,this.maxCapacity)}updateMeasuredRate(){const t=this.getCurrentTimeInSeconds(),n=Math.floor(t*2)/2;if(this.requestCount++,n>this.lastTxRateBucket){const r=this.requestCount/(n-this.lastTxRateBucket);this.measuredTxRate=this.getPrecise(r*this.smooth+this.measuredTxRate*(1-this.smooth)),this.requestCount=0,this.lastTxRateBucket=n}}getPrecise(t){return parseFloat(t.toFixed(8))}}lS.setTimeoutFn=setTimeout;const dx=100,cY=20*1e3,$De=500,$B=500,kDe=5,ODe=10,MDe=1,FDe="amz-sdk-invocation-id",LDe="amz-sdk-request",BDe=()=>{let e=dx;return{computeNextBackoffDelay:r=>Math.floor(Math.min(cY,Math.random()*2**r*e)),setDelayBase:r=>{e=r}}},kB=({retryDelay:e,retryCount:t,retryCost:n})=>({getRetryCount:()=>t,getRetryDelay:()=>Math.min(cY,e),getRetryCost:()=>n});class uY{constructor(t){this.maxAttempts=t,this.mode=kd.STANDARD,this.capacity=$B,this.retryBackoffStrategy=BDe(),this.maxAttemptsProvider=typeof t=="function"?t:async()=>t}async acquireInitialRetryToken(t){return kB({retryDelay:dx,retryCount:0})}async refreshRetryTokenForRetry(t,n){const r=await this.getMaxAttempts();if(this.shouldRetry(t,n,r)){const i=n.errorType;this.retryBackoffStrategy.setDelayBase(i==="THROTTLING"?$De:dx);const o=this.retryBackoffStrategy.computeNextBackoffDelay(t.getRetryCount()),a=n.retryAfterHint?Math.max(n.retryAfterHint.getTime()-Date.now()||0,o):o,s=this.getCapacityCost(i);return this.capacity-=s,kB({retryDelay:a,retryCount:t.getRetryCount()+1,retryCost:s})}throw new Error("No retry token available")}recordSuccess(t){this.capacity=Math.max($B,this.capacity+(t.getRetryCost()??MDe))}getCapacity(){return this.capacity}async getMaxAttempts(){try{return await this.maxAttemptsProvider()}catch{return console.warn(`Max attempts provider could not resolve. Using default of ${Dv}`),Dv}}shouldRetry(t,n,r){return t.getRetryCount()+1<r&&this.capacity>=this.getCapacityCost(n.errorType)&&this.isRetryableError(n.errorType)}getCapacityCost(t){return t==="TRANSIENT"?ODe:kDe}isRetryableError(t){return t==="THROTTLING"||t==="TRANSIENT"}}class DDe{constructor(t,n){this.maxAttemptsProvider=t,this.mode=kd.ADAPTIVE;const{rateLimiter:r}=n??{};this.rateLimiter=r??new lS,this.standardRetryStrategy=new uY(t)}async acquireInitialRetryToken(t){return await this.rateLimiter.getSendToken(),this.standardRetryStrategy.acquireInitialRetryToken(t)}async refreshRetryTokenForRetry(t,n){return this.rateLimiter.updateClientSendingRate(n),this.standardRetryStrategy.refreshRetryTokenForRetry(t,n)}recordSuccess(t){this.rateLimiter.updateClientSendingRate({}),this.standardRetryStrategy.recordSuccess(t)}}const jDe=e=>e instanceof Error?e:e instanceof Object?Object.assign(new Error,e):typeof e=="string"?new Error(e):new Error(`AWS SDK error wrapper for ${e}`),UDe=e=>{const{retryStrategy:t}=e,n=ks(e.maxAttempts??Dv);return{...e,maxAttempts:n,retryStrategy:async()=>t||(await ks(e.retryMode)()===kd.ADAPTIVE?new DDe(n):new uY(n))}},PDe=e=>(e==null?void 0:e.body)instanceof ReadableStream,NDe=e=>(t,n)=>async r=>{var a;let i=await e.retryStrategy();const o=await e.maxAttempts();if(WDe(i)){i=i;let s=await i.acquireInitialRetryToken(n.partition_id),c=new Error,u=0,l=0;const{request:d}=r,p=Hr.isInstance(d);for(p&&(d.headers[FDe]=sF.v4());;)try{p&&(d.headers[LDe]=`attempt=${u+1}; max=${o}`);const{response:h,output:A}=await t(r);return i.recordSuccess(s),A.$metadata.attempts=u+1,A.$metadata.totalRetryDelay=l,{response:h,output:A}}catch(h){const A=KDe(h);if(c=jDe(h),p&&PDe(d))throw(a=n.logger instanceof tY?console:n.logger)==null||a.warn("An error was encountered in a non-retryable streaming request."),c;try{s=await i.refreshRetryTokenForRetry(s,A)}catch{throw c.$metadata||(c.$metadata={}),c.$metadata.attempts=u+1,c.$metadata.totalRetryDelay=l,c}u=s.getRetryCount();const g=s.getRetryDelay();l+=g,await new Promise(v=>setTimeout(v,g))}}else return i=i,i!=null&&i.mode&&(n.userAgent=[...n.userAgent||[],["cfg/retry-mode",i.mode]]),i.retry(t,r)},WDe=e=>typeof e.acquireInitialRetryToken<"u"&&typeof e.refreshRetryTokenForRetry<"u"&&typeof e.recordSuccess<"u",KDe=e=>{const t={error:e,errorType:qDe(e)},n=QDe(e.$response);return n&&(t.retryAfterHint=n),t},qDe=e=>sY(e)?"THROTTLING":SF(e)?"TRANSIENT":RDe(e)?"SERVER_ERROR":"CLIENT_ERROR",VDe={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0},zDe=e=>({applyToStack:t=>{t.add(NDe(e),VDe)}}),QDe=e=>{if(!Mv.isInstance(e))return;const t=Object.keys(e.headers).find(o=>o.toLowerCase()==="retry-after");if(!t)return;const n=e.headers[t],r=Number(n);return Number.isNaN(r)?new Date(n):new Date(r*1e3)},HDe=async(e,t,n)=>({operation:cS(t).operation,region:await ks(e.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});function YDe(e){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"bedrock",region:e.region},propertiesExtractor:(t,n)=>({signingProperties:{config:t,context:n}})}}const GDe=e=>{const t=[];switch(e.operation){default:t.push(YDe(e))}return t},JDe=e=>({...SBe(e)}),ZDe=e=>({...e,useDualstackEndpoint:e.useDualstackEndpoint??!1,useFipsEndpoint:e.useFipsEndpoint??!1,defaultSigningName:"bedrock"}),XDe={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}},eje="@aws-sdk/client-bedrock-runtime",tje="AWS SDK for JavaScript Bedrock Runtime Client for Node.js, Browser and React Native",nje="3.709.0",rje={build:"concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'","build:cjs":"node ../../scripts/compilation/inline client-bedrock-runtime","build:es":"tsc -p tsconfig.es.json","build:include:deps":"lerna run --scope $npm_package_name --include-dependencies build","build:types":"tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4",clean:"rimraf ./dist-* && rimraf *.tsbuildinfo","extract:docs":"api-extractor run --local","generate:client":"node ../../scripts/generate-clients/single-service --solo bedrock-runtime"},ije="./dist-cjs/index.js",oje="./dist-types/index.d.ts",aje="./dist-es/index.js",sje=!1,cje={"@aws-crypto/sha256-browser":"5.2.0","@aws-crypto/sha256-js":"5.2.0","@aws-sdk/client-sso-oidc":"3.709.0","@aws-sdk/client-sts":"3.709.0","@aws-sdk/core":"3.709.0","@aws-sdk/credential-provider-node":"3.709.0","@aws-sdk/middleware-host-header":"3.709.0","@aws-sdk/middleware-logger":"3.709.0","@aws-sdk/middleware-recursion-detection":"3.709.0","@aws-sdk/middleware-user-agent":"3.709.0","@aws-sdk/region-config-resolver":"3.709.0","@aws-sdk/types":"3.709.0","@aws-sdk/util-endpoints":"3.709.0","@aws-sdk/util-user-agent-browser":"3.709.0","@aws-sdk/util-user-agent-node":"3.709.0","@smithy/config-resolver":"^3.0.13","@smithy/core":"^2.5.5","@smithy/eventstream-serde-browser":"^3.0.14","@smithy/eventstream-serde-config-resolver":"^3.0.11","@smithy/eventstream-serde-node":"^3.0.13","@smithy/fetch-http-handler":"^4.1.2","@smithy/hash-node":"^3.0.11","@smithy/invalid-dependency":"^3.0.11","@smithy/middleware-content-length":"^3.0.13","@smithy/middleware-endpoint":"^3.2.5","@smithy/middleware-retry":"^3.0.30","@smithy/middleware-serde":"^3.0.11","@smithy/middleware-stack":"^3.0.11","@smithy/node-config-provider":"^3.1.12","@smithy/node-http-handler":"^3.3.2","@smithy/protocol-http":"^4.1.8","@smithy/smithy-client":"^3.5.0","@smithy/types":"^3.7.2","@smithy/url-parser":"^3.0.11","@smithy/util-base64":"^3.0.0","@smithy/util-body-length-browser":"^3.0.0","@smithy/util-body-length-node":"^3.0.0","@smithy/util-defaults-mode-browser":"^3.0.30","@smithy/util-defaults-mode-node":"^3.0.30","@smithy/util-endpoints":"^2.1.7","@smithy/util-middleware":"^3.0.11","@smithy/util-retry":"^3.0.11","@smithy/util-stream":"^3.3.2","@smithy/util-utf8":"^3.0.0","@types/uuid":"^9.0.1",tslib:"^2.6.2",uuid:"^9.0.1"},uje={"@tsconfig/node16":"16.1.3","@types/node":"^16.18.96",concurrently:"7.0.0","downlevel-dts":"0.10.1",rimraf:"3.0.2",typescript:"~4.9.5"},lje={node:">=16.0.0"},dje={"<4.0":{"dist-types/*":["dist-types/ts3.4/*"]}},fje=["dist-*/**"],pje={name:"AWS SDK for JavaScript Team",url:"https://aws.amazon.com/javascript/"},hje="Apache-2.0",Aje={"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.browser"},mje="https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-bedrock-runtime",gje={type:"git",url:"https://github.com/aws/aws-sdk-js-v3.git",directory:"clients/client-bedrock-runtime"},vje={name:eje,description:tje,version:nje,scripts:rje,main:ije,types:oje,module:aje,sideEffects:sje,dependencies:cje,devDependencies:uje,engines:lje,typesVersions:dje,files:fje,author:pje,license:hje,browser:Aje,"react-native":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.native"},homepage:mje,repository:gje},yje=e=>new TextEncoder().encode(e);var bje=typeof Buffer<"u"&&Buffer.from?function(e){return Buffer.from(e,"utf8")}:yje;function Eh(e){return e instanceof Uint8Array?e:typeof e=="string"?bje(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}function fx(e){return typeof e=="string"?e.length===0:e.byteLength===0}function Sje(e){if(!Uint32Array.from){for(var t=new Uint32Array(e.length),n=0;n<e.length;)t[n]=e[n],n+=1;return t}return Uint32Array.from(e)}var lY={name:"SHA-256"},OB={name:"HMAC",hash:lY},Cje=new Uint8Array([227,176,196,66,152,252,28,20,154,251,244,200,153,111,185,36,39,174,65,228,100,155,147,76,164,149,153,27,120,82,184,85]);const wje={};function zg(){return typeof window<"u"?window:typeof self<"u"?self:wje}var xje=function(){function e(t){this.toHash=new Uint8Array(0),this.secret=t,this.reset()}return e.prototype.update=function(t){if(!fx(t)){var n=Eh(t),r=new Uint8Array(this.toHash.byteLength+n.byteLength);r.set(this.toHash,0),r.set(n,this.toHash.byteLength),this.toHash=r}},e.prototype.digest=function(){var t=this;return this.key?this.key.then(function(n){return zg().crypto.subtle.sign(OB,n,t.toHash).then(function(r){return new Uint8Array(r)})}):fx(this.toHash)?Promise.resolve(Cje):Promise.resolve().then(function(){return zg().crypto.subtle.digest(lY,t.toHash)}).then(function(n){return Promise.resolve(new Uint8Array(n))})},e.prototype.reset=function(){var t=this;this.toHash=new Uint8Array(0),this.secret&&this.secret!==void 0&&(this.key=new Promise(function(n,r){zg().crypto.subtle.importKey("raw",Eh(t.secret),OB,!1,["sign"]).then(n,r)}),this.key.catch(function(){}))},e}();function _je(e,t,n,r){function i(o){return o instanceof n?o:new n(function(a){a(o)})}return new(n||(n=Promise))(function(o,a){function s(l){try{u(r.next(l))}catch(d){a(d)}}function c(l){try{u(r.throw(l))}catch(d){a(d)}}function u(l){l.done?o(l.value):i(l.value).then(s,c)}u((r=r.apply(e,t||[])).next())})}function Tje(e,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(u){return function(l){return c([u,l])}}function c(u){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(n=0)),n;)try{if(r=1,i&&(o=u[0]&2?i.return:u[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;switch(i=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,i=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){n.label=u[1];break}if(u[0]===6&&n.label<o[1]){n.label=o[1],o=u;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(u);break}o[2]&&n.ops.pop(),n.trys.pop();continue}u=t.call(e,n)}catch(l){u=[6,l],i=0}finally{r=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}var mi=64,Ije=32,Eje=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Rje=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],$je=Math.pow(2,53)-1,Qg=function(){function e(){this.state=Int32Array.from(Rje),this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}return e.prototype.update=function(t){if(this.finished)throw new Error("Attempted to update an already finished hash.");var n=0,r=t.byteLength;if(this.bytesHashed+=r,this.bytesHashed*8>$je)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;r>0;)this.buffer[this.bufferLength++]=t[n++],r--,this.bufferLength===mi&&(this.hashBuffer(),this.bufferLength=0)},e.prototype.digest=function(){if(!this.finished){var t=this.bytesHashed*8,n=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),r=this.bufferLength;if(n.setUint8(this.bufferLength++,128),r%mi>=mi-8){for(var i=this.bufferLength;i<mi;i++)n.setUint8(i,0);this.hashBuffer(),this.bufferLength=0}for(var i=this.bufferLength;i<mi-8;i++)n.setUint8(i,0);n.setUint32(mi-8,Math.floor(t/4294967296),!0),n.setUint32(mi-4,t),this.hashBuffer(),this.finished=!0}for(var o=new Uint8Array(Ije),i=0;i<8;i++)o[i*4]=this.state[i]>>>24&255,o[i*4+1]=this.state[i]>>>16&255,o[i*4+2]=this.state[i]>>>8&255,o[i*4+3]=this.state[i]>>>0&255;return o},e.prototype.hashBuffer=function(){for(var t=this,n=t.buffer,r=t.state,i=r[0],o=r[1],a=r[2],s=r[3],c=r[4],u=r[5],l=r[6],d=r[7],p=0;p<mi;p++){if(p<16)this.temp[p]=(n[p*4]&255)<<24|(n[p*4+1]&255)<<16|(n[p*4+2]&255)<<8|n[p*4+3]&255;else{var h=this.temp[p-2],A=(h>>>17|h<<15)^(h>>>19|h<<13)^h>>>10;h=this.temp[p-15];var g=(h>>>7|h<<25)^(h>>>18|h<<14)^h>>>3;this.temp[p]=(A+this.temp[p-7]|0)+(g+this.temp[p-16]|0)}var v=(((c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7))+(c&u^~c&l)|0)+(d+(Eje[p]+this.temp[p]|0)|0)|0,b=((i>>>2|i<<30)^(i>>>13|i<<19)^(i>>>22|i<<10))+(i&o^i&a^o&a)|0;d=l,l=u,u=c,c=s+v|0,s=a,a=o,o=i,i=v+b|0}r[0]+=i,r[1]+=o,r[2]+=a,r[3]+=s,r[4]+=c,r[5]+=u,r[6]+=l,r[7]+=d},e}(),kje=function(){function e(t){this.secret=t,this.hash=new Qg,this.reset()}return e.prototype.update=function(t){if(!(fx(t)||this.error))try{this.hash.update(Eh(t))}catch(n){this.error=n}},e.prototype.digestSync=function(){if(this.error)throw this.error;return this.outer?(this.outer.finished||this.outer.update(this.hash.digest()),this.outer.digest()):this.hash.digest()},e.prototype.digest=function(){return _je(this,void 0,void 0,function(){return Tje(this,function(t){return[2,this.digestSync()]})})},e.prototype.reset=function(){if(this.hash=new Qg,this.secret){this.outer=new Qg;var t=Oje(this.secret),n=new Uint8Array(mi);n.set(t);for(var r=0;r<mi;r++)t[r]^=54,n[r]^=92;this.hash.update(t),this.outer.update(n);for(var r=0;r<t.byteLength;r++)t[r]=0}},e}();function Oje(e){var t=Eh(e);if(t.byteLength>mi){var n=new Qg;n.update(t),t=n.digest()}var r=new Uint8Array(mi);return r.set(t),r}var Mje=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"];function Fje(e){if(Lje(e)&&typeof e.crypto.subtle=="object"){var t=e.crypto.subtle;return Bje(t)}return!1}function Lje(e){if(typeof e=="object"&&typeof e.crypto=="object"){var t=e.crypto.getRandomValues;return typeof t=="function"}return!1}function Bje(e){return e&&Mje.every(function(t){return typeof e[t]=="function"})}var Dje=function(){function e(t){Fje(zg())?this.hash=new xje(t):this.hash=new kje(t)}return e.prototype.update=function(t,n){this.hash.update(Eh(t))},e.prototype.digest=function(){return this.hash.digest()},e.prototype.reset=function(){this.hash.reset()},e}();const jje={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},dY={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},Mt={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},Gn={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},ms={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"};class V{static getFirstMatch(t,n){const r=n.match(t);return r&&r.length>0&&r[1]||""}static getSecondMatch(t,n){const r=n.match(t);return r&&r.length>1&&r[2]||""}static matchAndReturnConst(t,n,r){if(t.test(n))return r}static getWindowsVersionName(t){switch(t){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}}static getMacOSVersionName(t){const n=t.split(".").splice(0,2).map(r=>parseInt(r,10)||0);if(n.push(0),n[0]===10)switch(n[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}}static getAndroidVersionName(t){const n=t.split(".").splice(0,2).map(r=>parseInt(r,10)||0);if(n.push(0),!(n[0]===1&&n[1]<5)){if(n[0]===1&&n[1]<6)return"Cupcake";if(n[0]===1&&n[1]>=6)return"Donut";if(n[0]===2&&n[1]<2)return"Eclair";if(n[0]===2&&n[1]===2)return"Froyo";if(n[0]===2&&n[1]>2)return"Gingerbread";if(n[0]===3)return"Honeycomb";if(n[0]===4&&n[1]<1)return"Ice Cream Sandwich";if(n[0]===4&&n[1]<4)return"Jelly Bean";if(n[0]===4&&n[1]>=4)return"KitKat";if(n[0]===5)return"Lollipop";if(n[0]===6)return"Marshmallow";if(n[0]===7)return"Nougat";if(n[0]===8)return"Oreo";if(n[0]===9)return"Pie"}}static getVersionPrecision(t){return t.split(".").length}static compareVersions(t,n,r=!1){const i=V.getVersionPrecision(t),o=V.getVersionPrecision(n);let a=Math.max(i,o),s=0;const c=V.map([t,n],u=>{const l=a-V.getVersionPrecision(u),d=u+new Array(l+1).join(".0");return V.map(d.split("."),p=>new Array(20-p.length).join("0")+p).reverse()});for(r&&(s=a-Math.min(i,o)),a-=1;a>=s;){if(c[0][a]>c[1][a])return 1;if(c[0][a]===c[1][a]){if(a===s)return 0;a-=1}else if(c[0][a]<c[1][a])return-1}}static map(t,n){const r=[];let i;if(Array.prototype.map)return Array.prototype.map.call(t,n);for(i=0;i<t.length;i+=1)r.push(n(t[i]));return r}static find(t,n){let r,i;if(Array.prototype.find)return Array.prototype.find.call(t,n);for(r=0,i=t.length;r<i;r+=1){const o=t[r];if(n(o,r))return o}}static assign(t,...n){const r=t;let i,o;if(Object.assign)return Object.assign(t,...n);for(i=0,o=n.length;i<o;i+=1){const a=n[i];typeof a=="object"&&a!==null&&Object.keys(a).forEach(c=>{r[c]=a[c]})}return t}static getBrowserAlias(t){return jje[t]}static getBrowserTypeByAlias(t){return dY[t]||""}}const nt=/version\/(\d+(\.?_?\d+)+)/i,Uje=[{test:[/googlebot/i],describe(e){const t={name:"Googlebot"},n=V.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||V.getFirstMatch(nt,e);return n&&(t.version=n),t}},{test:[/opera/i],describe(e){const t={name:"Opera"},n=V.getFirstMatch(nt,e)||V.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opr\/|opios/i],describe(e){const t={name:"Opera"},n=V.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||V.getFirstMatch(nt,e);return n&&(t.version=n),t}},{test:[/SamsungBrowser/i],describe(e){const t={name:"Samsung Internet for Android"},n=V.getFirstMatch(nt,e)||V.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Whale/i],describe(e){const t={name:"NAVER Whale Browser"},n=V.getFirstMatch(nt,e)||V.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MZBrowser/i],describe(e){const t={name:"MZ Browser"},n=V.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||V.getFirstMatch(nt,e);return n&&(t.version=n),t}},{test:[/focus/i],describe(e){const t={name:"Focus"},n=V.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||V.getFirstMatch(nt,e);return n&&(t.version=n),t}},{test:[/swing/i],describe(e){const t={name:"Swing"},n=V.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||V.getFirstMatch(nt,e);return n&&(t.version=n),t}},{test:[/coast/i],describe(e){const t={name:"Opera Coast"},n=V.getFirstMatch(nt,e)||V.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe(e){const t={name:"Opera Touch"},n=V.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||V.getFirstMatch(nt,e);return n&&(t.version=n),t}},{test:[/yabrowser/i],describe(e){const t={name:"Yandex Browser"},n=V.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||V.getFirstMatch(nt,e);return n&&(t.version=n),t}},{test:[/ucbrowser/i],describe(e){const t={name:"UC Browser"},n=V.getFirstMatch(nt,e)||V.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Maxthon|mxios/i],describe(e){const t={name:"Maxthon"},n=V.getFirstMatch(nt,e)||V.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/epiphany/i],describe(e){const t={name:"Epiphany"},n=V.getFirstMatch(nt,e)||V.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/puffin/i],describe(e){const t={name:"Puffin"},n=V.getFirstMatch(nt,e)||V.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sleipnir/i],describe(e){const t={name:"Sleipnir"},n=V.getFirstMatch(nt,e)||V.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/k-meleon/i],describe(e){const t={name:"K-Meleon"},n=V.getFirstMatch(nt,e)||V.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/micromessenger/i],describe(e){const t={name:"WeChat"},n=V.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||V.getFirstMatch(nt,e);return n&&(t.version=n),t}},{test:[/qqbrowser/i],describe(e){const t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},n=V.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||V.getFirstMatch(nt,e);return n&&(t.version=n),t}},{test:[/msie|trident/i],describe(e){const t={name:"Internet Explorer"},n=V.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/\sedg\//i],describe(e){const t={name:"Microsoft Edge"},n=V.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/edg([ea]|ios)/i],describe(e){const t={name:"Microsoft Edge"},n=V.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/vivaldi/i],describe(e){const t={name:"Vivaldi"},n=V.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/seamonkey/i],describe(e){const t={name:"SeaMonkey"},n=V.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sailfish/i],describe(e){const t={name:"Sailfish"},n=V.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return n&&(t.version=n),t}},{test:[/silk/i],describe(e){const t={name:"Amazon Silk"},n=V.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/phantom/i],describe(e){const t={name:"PhantomJS"},n=V.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/slimerjs/i],describe(e){const t={name:"SlimerJS"},n=V.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(e){const t={name:"BlackBerry"},n=V.getFirstMatch(nt,e)||V.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(web|hpw)[o0]s/i],describe(e){const t={name:"WebOS Browser"},n=V.getFirstMatch(nt,e)||V.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/bada/i],describe(e){const t={name:"Bada"},n=V.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/tizen/i],describe(e){const t={name:"Tizen"},n=V.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||V.getFirstMatch(nt,e);return n&&(t.version=n),t}},{test:[/qupzilla/i],describe(e){const t={name:"QupZilla"},n=V.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||V.getFirstMatch(nt,e);return n&&(t.version=n),t}},{test:[/firefox|iceweasel|fxios/i],describe(e){const t={name:"Firefox"},n=V.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/electron/i],describe(e){const t={name:"Electron"},n=V.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MiuiBrowser/i],describe(e){const t={name:"Miui"},n=V.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/chromium/i],describe(e){const t={name:"Chromium"},n=V.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||V.getFirstMatch(nt,e);return n&&(t.version=n),t}},{test:[/chrome|crios|crmo/i],describe(e){const t={name:"Chrome"},n=V.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/GSA/i],describe(e){const t={name:"Google Search"},n=V.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test(e){const t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe(e){const t={name:"Android Browser"},n=V.getFirstMatch(nt,e);return n&&(t.version=n),t}},{test:[/playstation 4/i],describe(e){const t={name:"PlayStation 4"},n=V.getFirstMatch(nt,e);return n&&(t.version=n),t}},{test:[/safari|applewebkit/i],describe(e){const t={name:"Safari"},n=V.getFirstMatch(nt,e);return n&&(t.version=n),t}},{test:[/.*/i],describe(e){const t=/^(.*)\/(.*) /,n=/^(.*)\/(.*)[ \t]\((.*)/,i=e.search("\\(")!==-1?n:t;return{name:V.getFirstMatch(i,e),version:V.getSecondMatch(i,e)}}}],Pje=[{test:[/Roku\/DVP/],describe(e){const t=V.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:Gn.Roku,version:t}}},{test:[/windows phone/i],describe(e){const t=V.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:Gn.WindowsPhone,version:t}}},{test:[/windows /i],describe(e){const t=V.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),n=V.getWindowsVersionName(t);return{name:Gn.Windows,version:t,versionName:n}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(e){const t={name:Gn.iOS},n=V.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return n&&(t.version=n),t}},{test:[/macintosh/i],describe(e){const t=V.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),n=V.getMacOSVersionName(t),r={name:Gn.MacOS,version:t};return n&&(r.versionName=n),r}},{test:[/(ipod|iphone|ipad)/i],describe(e){const t=V.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:Gn.iOS,version:t}}},{test(e){const t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe(e){const t=V.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),n=V.getAndroidVersionName(t),r={name:Gn.Android,version:t};return n&&(r.versionName=n),r}},{test:[/(web|hpw)[o0]s/i],describe(e){const t=V.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),n={name:Gn.WebOS};return t&&t.length&&(n.version=t),n}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(e){const t=V.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||V.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||V.getFirstMatch(/\bbb(\d+)/i,e);return{name:Gn.BlackBerry,version:t}}},{test:[/bada/i],describe(e){const t=V.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:Gn.Bada,version:t}}},{test:[/tizen/i],describe(e){const t=V.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:Gn.Tizen,version:t}}},{test:[/linux/i],describe(){return{name:Gn.Linux}}},{test:[/CrOS/],describe(){return{name:Gn.ChromeOS}}},{test:[/PlayStation 4/],describe(e){const t=V.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:Gn.PlayStation4,version:t}}}],Nje=[{test:[/googlebot/i],describe(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe(e){const t=V.getFirstMatch(/(can-l01)/i,e)&&"Nova",n={type:Mt.mobile,vendor:"Huawei"};return t&&(n.model=t),n}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe(){return{type:Mt.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe(){return{type:Mt.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(){return{type:Mt.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe(){return{type:Mt.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe(){return{type:Mt.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe(){return{type:Mt.tablet}}},{test(e){const t=e.test(/ipod|iphone/i),n=e.test(/like (ipod|iphone)/i);return t&&!n},describe(e){const t=V.getFirstMatch(/(ipod|iphone)/i,e);return{type:Mt.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe(){return{type:Mt.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe(){return{type:Mt.mobile}}},{test(e){return e.getBrowserName(!0)==="blackberry"},describe(){return{type:Mt.mobile,vendor:"BlackBerry"}}},{test(e){return e.getBrowserName(!0)==="bada"},describe(){return{type:Mt.mobile}}},{test(e){return e.getBrowserName()==="windows phone"},describe(){return{type:Mt.mobile,vendor:"Microsoft"}}},{test(e){const t=Number(String(e.getOSVersion()).split(".")[0]);return e.getOSName(!0)==="android"&&t>=3},describe(){return{type:Mt.tablet}}},{test(e){return e.getOSName(!0)==="android"},describe(){return{type:Mt.mobile}}},{test(e){return e.getOSName(!0)==="macos"},describe(){return{type:Mt.desktop,vendor:"Apple"}}},{test(e){return e.getOSName(!0)==="windows"},describe(){return{type:Mt.desktop}}},{test(e){return e.getOSName(!0)==="linux"},describe(){return{type:Mt.desktop}}},{test(e){return e.getOSName(!0)==="playstation 4"},describe(){return{type:Mt.tv}}},{test(e){return e.getOSName(!0)==="roku"},describe(){return{type:Mt.tv}}}],Wje=[{test(e){return e.getBrowserName(!0)==="microsoft edge"},describe(e){if(/\sedg\//i.test(e))return{name:ms.Blink};const n=V.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:ms.EdgeHTML,version:n}}},{test:[/trident/i],describe(e){const t={name:ms.Trident},n=V.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test(e){return e.test(/presto/i)},describe(e){const t={name:ms.Presto},n=V.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test(e){const t=e.test(/gecko/i),n=e.test(/like gecko/i);return t&&!n},describe(e){const t={name:ms.Gecko},n=V.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(apple)?webkit\/537\.36/i],describe(){return{name:ms.Blink}}},{test:[/(apple)?webkit/i],describe(e){const t={name:ms.WebKit},n=V.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}}];class MB{constructor(t,n=!1){if(t==null||t==="")throw new Error("UserAgent parameter can't be empty");this._ua=t,this.parsedResult={},n!==!0&&this.parse()}getUA(){return this._ua}test(t){return t.test(this._ua)}parseBrowser(){this.parsedResult.browser={};const t=V.find(Uje,n=>{if(typeof n.test=="function")return n.test(this);if(n.test instanceof Array)return n.test.some(r=>this.test(r));throw new Error("Browser's test function is not valid")});return t&&(this.parsedResult.browser=t.describe(this.getUA())),this.parsedResult.browser}getBrowser(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()}getBrowserName(t){return t?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""}getBrowserVersion(){return this.getBrowser().version}getOS(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()}parseOS(){this.parsedResult.os={};const t=V.find(Pje,n=>{if(typeof n.test=="function")return n.test(this);if(n.test instanceof Array)return n.test.some(r=>this.test(r));throw new Error("Browser's test function is not valid")});return t&&(this.parsedResult.os=t.describe(this.getUA())),this.parsedResult.os}getOSName(t){const{name:n}=this.getOS();return t?String(n).toLowerCase()||"":n||""}getOSVersion(){return this.getOS().version}getPlatform(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()}getPlatformType(t=!1){const{type:n}=this.getPlatform();return t?String(n).toLowerCase()||"":n||""}parsePlatform(){this.parsedResult.platform={};const t=V.find(Nje,n=>{if(typeof n.test=="function")return n.test(this);if(n.test instanceof Array)return n.test.some(r=>this.test(r));throw new Error("Browser's test function is not valid")});return t&&(this.parsedResult.platform=t.describe(this.getUA())),this.parsedResult.platform}getEngine(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()}getEngineName(t){return t?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""}parseEngine(){this.parsedResult.engine={};const t=V.find(Wje,n=>{if(typeof n.test=="function")return n.test(this);if(n.test instanceof Array)return n.test.some(r=>this.test(r));throw new Error("Browser's test function is not valid")});return t&&(this.parsedResult.engine=t.describe(this.getUA())),this.parsedResult.engine}parse(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this}getResult(){return V.assign({},this.parsedResult)}satisfies(t){const n={};let r=0;const i={};let o=0;if(Object.keys(t).forEach(s=>{const c=t[s];typeof c=="string"?(i[s]=c,o+=1):typeof c=="object"&&(n[s]=c,r+=1)}),r>0){const s=Object.keys(n),c=V.find(s,l=>this.isOS(l));if(c){const l=this.satisfies(n[c]);if(l!==void 0)return l}const u=V.find(s,l=>this.isPlatform(l));if(u){const l=this.satisfies(n[u]);if(l!==void 0)return l}}if(o>0){const s=Object.keys(i),c=V.find(s,u=>this.isBrowser(u,!0));if(c!==void 0)return this.compareVersion(i[c])}}isBrowser(t,n=!1){const r=this.getBrowserName().toLowerCase();let i=t.toLowerCase();const o=V.getBrowserTypeByAlias(i);return n&&o&&(i=o.toLowerCase()),i===r}compareVersion(t){let n=[0],r=t,i=!1;const o=this.getBrowserVersion();if(typeof o=="string")return t[0]===">"||t[0]==="<"?(r=t.substr(1),t[1]==="="?(i=!0,r=t.substr(2)):n=[],t[0]===">"?n.push(1):n.push(-1)):t[0]==="="?r=t.substr(1):t[0]==="~"&&(i=!0,r=t.substr(1)),n.indexOf(V.compareVersions(o,r,i))>-1}isOS(t){return this.getOSName(!0)===String(t).toLowerCase()}isPlatform(t){return this.getPlatformType(!0)===String(t).toLowerCase()}isEngine(t){return this.getEngineName(!0)===String(t).toLowerCase()}is(t,n=!1){return this.isBrowser(t,n)||this.isOS(t)||this.isPlatform(t)}some(t=[]){return t.some(n=>this.is(n))}}/*!
|
|
22
|
+
* Bowser - a browser detector
|
|
23
|
+
* https://github.com/lancedikson/bowser
|
|
24
|
+
* MIT License | (c) Dustin Diaz 2012-2015
|
|
25
|
+
* MIT License | (c) Denis Demchenko 2015-2019
|
|
26
|
+
*/class fY{static getParser(t,n=!1){if(typeof t!="string")throw new Error("UserAgent should be a string");return new MB(t,n)}static parse(t){return new MB(t).getResult()}static get BROWSER_MAP(){return dY}static get ENGINE_MAP(){return ms}static get OS_MAP(){return Gn}static get PLATFORMS_MAP(){return Mt}}const Kje=({serviceId:e,clientVersion:t})=>async n=>{var a,s,c,u,l,d;const r=typeof window<"u"&&((a=window==null?void 0:window.navigator)!=null&&a.userAgent)?fY.parse(window.navigator.userAgent):void 0,i=[["aws-sdk-js",t],["ua","2.1"],[`os/${((s=r==null?void 0:r.os)==null?void 0:s.name)||"other"}`,(c=r==null?void 0:r.os)==null?void 0:c.version],["lang/js"],["md/browser",`${((u=r==null?void 0:r.browser)==null?void 0:u.name)??"unknown"}_${((l=r==null?void 0:r.browser)==null?void 0:l.version)??"unknown"}`]];e&&i.push([`api/${e}`,t]);const o=await((d=n==null?void 0:n.userAgentAppId)==null?void 0:d.call(n));return o&&i.push([`app/${o}`]),i};function qje(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}var pY=function(){function e(){this.checksum=4294967295}return e.prototype.update=function(t){var n,r;try{for(var i=qje(t),o=i.next();!o.done;o=i.next()){var a=o.value;this.checksum=this.checksum>>>8^zje[(this.checksum^a)&255]}}catch(s){n={error:s}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return this},e.prototype.digest=function(){return(this.checksum^4294967295)>>>0},e}(),Vje=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],zje=Sje(Vje);class eh{constructor(t){if(this.bytes=t,t.byteLength!==8)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(t){if(t>9223372036854776e3||t<-9223372036854776e3)throw new Error(`${t} is too large (or, if negative, too small) to represent as an Int64`);const n=new Uint8Array(8);for(let r=7,i=Math.abs(Math.round(t));r>-1&&i>0;r--,i/=256)n[r]=i;return t<0&&FB(n),new eh(n)}valueOf(){const t=this.bytes.slice(0),n=t[0]&128;return n&&FB(t),parseInt(Ur(t),16)*(n?-1:1)}toString(){return String(this.valueOf())}}function FB(e){for(let t=0;t<8;t++)e[t]^=255;for(let t=7;t>-1&&(e[t]++,e[t]===0);t--);}class Qje{constructor(t,n){this.toUtf8=t,this.fromUtf8=n}format(t){const n=[];for(const o of Object.keys(t)){const a=this.fromUtf8(o);n.push(Uint8Array.from([a.byteLength]),a,this.formatHeaderValue(t[o]))}const r=new Uint8Array(n.reduce((o,a)=>o+a.byteLength,0));let i=0;for(const o of n)r.set(o,i),i+=o.byteLength;return r}formatHeaderValue(t){switch(t.type){case"boolean":return Uint8Array.from([t.value?0:1]);case"byte":return Uint8Array.from([2,t.value]);case"short":const n=new DataView(new ArrayBuffer(3));return n.setUint8(0,3),n.setInt16(1,t.value,!1),new Uint8Array(n.buffer);case"integer":const r=new DataView(new ArrayBuffer(5));return r.setUint8(0,4),r.setInt32(1,t.value,!1),new Uint8Array(r.buffer);case"long":const i=new Uint8Array(9);return i[0]=5,i.set(t.value.bytes,1),i;case"binary":const o=new DataView(new ArrayBuffer(3+t.value.byteLength));o.setUint8(0,6),o.setUint16(1,t.value.byteLength,!1);const a=new Uint8Array(o.buffer);return a.set(t.value,3),a;case"string":const s=this.fromUtf8(t.value),c=new DataView(new ArrayBuffer(3+s.byteLength));c.setUint8(0,7),c.setUint16(1,s.byteLength,!1);const u=new Uint8Array(c.buffer);return u.set(s,3),u;case"timestamp":const l=new Uint8Array(9);return l[0]=8,l.set(eh.fromNumber(t.value.valueOf()).bytes,1),l;case"uuid":if(!nUe.test(t.value))throw new Error(`Invalid UUID received: ${t.value}`);const d=new Uint8Array(17);return d[0]=9,d.set(kH(t.value.replace(/\-/g,"")),1),d}}parse(t){const n={};let r=0;for(;r<t.byteLength;){const i=t.getUint8(r++),o=this.toUtf8(new Uint8Array(t.buffer,t.byteOffset+r,i));switch(r+=i,t.getUint8(r++)){case 0:n[o]={type:BB,value:!0};break;case 1:n[o]={type:BB,value:!1};break;case 2:n[o]={type:Hje,value:t.getInt8(r++)};break;case 3:n[o]={type:Yje,value:t.getInt16(r,!1)},r+=2;break;case 4:n[o]={type:Gje,value:t.getInt32(r,!1)},r+=4;break;case 5:n[o]={type:Jje,value:new eh(new Uint8Array(t.buffer,t.byteOffset+r,8))},r+=8;break;case 6:const a=t.getUint16(r,!1);r+=2,n[o]={type:Zje,value:new Uint8Array(t.buffer,t.byteOffset+r,a)},r+=a;break;case 7:const s=t.getUint16(r,!1);r+=2,n[o]={type:Xje,value:this.toUtf8(new Uint8Array(t.buffer,t.byteOffset+r,s))},r+=s;break;case 8:n[o]={type:eUe,value:new Date(new eh(new Uint8Array(t.buffer,t.byteOffset+r,8)).valueOf())},r+=8;break;case 9:const c=new Uint8Array(t.buffer,t.byteOffset+r,16);r+=16,n[o]={type:tUe,value:`${Ur(c.subarray(0,4))}-${Ur(c.subarray(4,6))}-${Ur(c.subarray(6,8))}-${Ur(c.subarray(8,10))}-${Ur(c.subarray(10))}`};break;default:throw new Error("Unrecognized header type tag")}}return n}}var LB;(function(e){e[e.boolTrue=0]="boolTrue",e[e.boolFalse=1]="boolFalse",e[e.byte=2]="byte",e[e.short=3]="short",e[e.integer=4]="integer",e[e.long=5]="long",e[e.byteArray=6]="byteArray",e[e.string=7]="string",e[e.timestamp=8]="timestamp",e[e.uuid=9]="uuid"})(LB||(LB={}));const BB="boolean",Hje="byte",Yje="short",Gje="integer",Jje="long",Zje="binary",Xje="string",eUe="timestamp",tUe="uuid",nUe=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/,hY=4,gs=hY*2,Uc=4,rUe=gs+Uc*2;function iUe({byteLength:e,byteOffset:t,buffer:n}){if(e<rUe)throw new Error("Provided message too short to accommodate event stream message overhead");const r=new DataView(n,t,e),i=r.getUint32(0,!1);if(e!==i)throw new Error("Reported message length does not match received message length");const o=r.getUint32(hY,!1),a=r.getUint32(gs,!1),s=r.getUint32(e-Uc,!1),c=new pY().update(new Uint8Array(n,t,gs));if(a!==c.digest())throw new Error(`The prelude checksum specified in the message (${a}) does not match the calculated CRC32 checksum (${c.digest()})`);if(c.update(new Uint8Array(n,t+gs,e-(gs+Uc))),s!==c.digest())throw new Error(`The message checksum (${c.digest()}) did not match the expected value of ${s}`);return{headers:new DataView(n,t+gs+Uc,o),body:new Uint8Array(n,t+gs+Uc+o,i-o-(gs+Uc+Uc))}}class oUe{constructor(t,n){this.headerMarshaller=new Qje(t,n),this.messageBuffer=[],this.isEndOfStream=!1}feed(t){this.messageBuffer.push(this.decode(t))}endOfStream(){this.isEndOfStream=!0}getMessage(){const t=this.messageBuffer.pop(),n=this.isEndOfStream;return{getMessage(){return t},isEndOfStream(){return n}}}getAvailableMessages(){const t=this.messageBuffer;this.messageBuffer=[];const n=this.isEndOfStream;return{getMessages(){return t},isEndOfStream(){return n}}}encode({headers:t,body:n}){const r=this.headerMarshaller.format(t),i=r.byteLength+n.byteLength+16,o=new Uint8Array(i),a=new DataView(o.buffer,o.byteOffset,o.byteLength),s=new pY;return a.setUint32(0,i,!1),a.setUint32(4,r.byteLength,!1),a.setUint32(8,s.update(o.subarray(0,8)).digest(),!1),o.set(r,12),o.set(n,r.byteLength+12),a.setUint32(i-4,s.update(o.subarray(8,i-4)).digest(),!1),o}decode(t){const{headers:n,body:r}=iUe(t);return{headers:this.headerMarshaller.parse(n),body:r}}formatHeaders(t){return this.headerMarshaller.format(t)}}class aUe{constructor(t){this.options=t}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(const t of this.options.inputStream)yield this.options.decoder.decode(t)}}class sUe{constructor(t){this.options=t}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(const t of this.options.messageStream)yield this.options.encoder.encode(t);this.options.includeEndFrame&&(yield new Uint8Array(0))}}class cUe{constructor(t){this.options=t}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(const t of this.options.messageStream){const n=await this.options.deserializer(t);n!==void 0&&(yield n)}}}class uUe{constructor(t){this.options=t}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(const t of this.options.inputStream)yield this.options.serializer(t)}}function lUe(e){let t=0,n=0,r=null,i=null;const o=s=>{if(typeof s!="number")throw new Error("Attempted to allocate an event message where size was not a number: "+s);t=s,n=4,r=new Uint8Array(s),new DataView(r.buffer).setUint32(0,s,!1)},a=async function*(){const s=e[Symbol.asyncIterator]();for(;;){const{value:c,done:u}=await s.next();if(u){if(t)if(t===n)yield r;else throw new Error("Truncated event message received.");else return;return}const l=c.length;let d=0;for(;d<l;){if(!r){const h=l-d;i||(i=new Uint8Array(4));const A=Math.min(4-n,h);if(i.set(c.slice(d,d+A),n),n+=A,d+=A,n<4)break;o(new DataView(i.buffer).getUint32(0,!1)),i=null}const p=Math.min(t-n,l-d);r.set(c.slice(d,d+p),n),n+=p,d+=p,t&&t===n&&(yield r,r=null,t=0,n=0)}}};return{[Symbol.asyncIterator]:a}}function dUe(e,t){return async function(n){const{value:r}=n.headers[":message-type"];if(r==="error"){const i=new Error(n.headers[":error-message"].value||"UnknownError");throw i.name=n.headers[":error-code"].value,i}else if(r==="exception"){const i=n.headers[":exception-type"].value,o={[i]:n},a=await e(o);if(a.$unknown){const s=new Error(t(n.body));throw s.name=i,s}throw a[i]}else if(r==="event"){const i={[n.headers[":event-type"].value]:n},o=await e(i);return o.$unknown?void 0:o}else throw Error(`Unrecognizable event type: ${n.headers[":event-type"].value}`)}}let fUe=class{constructor({utf8Encoder:t,utf8Decoder:n}){this.eventStreamCodec=new oUe(t,n),this.utfEncoder=t}deserialize(t,n){const r=lUe(t);return new cUe({messageStream:new aUe({inputStream:r,decoder:this.eventStreamCodec}),deserializer:dUe(n,this.utfEncoder)})}serialize(t,n){return new sUe({messageStream:new uUe({inputStream:t,serializer:n}),encoder:this.eventStreamCodec,includeEndFrame:!0})}};const pUe=e=>({[Symbol.asyncIterator]:async function*(){const t=e.getReader();try{for(;;){const{done:n,value:r}=await t.read();if(n)return;yield r}}finally{t.releaseLock()}}}),hUe=e=>{const t=e[Symbol.asyncIterator]();return new ReadableStream({async pull(n){const{done:r,value:i}=await t.next();if(r)return n.close();n.enqueue(i)}})};class AUe{constructor({utf8Encoder:t,utf8Decoder:n}){this.universalMarshaller=new fUe({utf8Decoder:n,utf8Encoder:t})}deserialize(t,n){const r=mUe(t)?pUe(t):t;return this.universalMarshaller.deserialize(r,n)}serialize(t,n){const r=this.universalMarshaller.serialize(t,n);return typeof ReadableStream=="function"?hUe(r):r}}const mUe=e=>typeof ReadableStream=="function"&&e instanceof ReadableStream,gUe=e=>new AUe(e),vUe=e=>()=>Promise.reject(e),DB=typeof TextEncoder=="function"?new TextEncoder:null,yUe=e=>{if(typeof e=="string"){if(DB)return DB.encode(e).byteLength;let t=e.length;for(let n=t-1;n>=0;n--){const r=e.charCodeAt(n);r>127&&r<=2047?t++:r>2047&&r<=65535&&(t+=2),r>=56320&&r<=57343&&n--}return t}else{if(typeof e.byteLength=="number")return e.byteLength;if(typeof e.size=="number")return e.size}throw new Error(`Body Length computation failed for ${e}`)},AY="required",xo="fn",_o="argv",Sp="ref",jB=!0,UB="isSet",Rh="booleanEquals",ql="error",Ip="endpoint",Yn="tree",CF="PartitionResult",PB={[AY]:!1,type:"String"},NB={[AY]:!0,default:!1,type:"Boolean"},WB={[Sp]:"Endpoint"},mY={[xo]:Rh,[_o]:[{[Sp]:"UseFIPS"},!0]},gY={[xo]:Rh,[_o]:[{[Sp]:"UseDualStack"},!0]},So={},KB={[xo]:"getAttr",[_o]:[{[Sp]:CF},"supportsFIPS"]},qB={[xo]:Rh,[_o]:[!0,{[xo]:"getAttr",[_o]:[{[Sp]:CF},"supportsDualStack"]}]},VB=[mY],zB=[gY],QB=[{[Sp]:"Region"}],bUe={version:"1.0",parameters:{Region:PB,UseDualStack:NB,UseFIPS:NB,Endpoint:PB},rules:[{conditions:[{[xo]:UB,[_o]:[WB]}],rules:[{conditions:VB,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:ql},{rules:[{conditions:zB,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:ql},{endpoint:{url:WB,properties:So,headers:So},type:Ip}],type:Yn}],type:Yn},{rules:[{conditions:[{[xo]:UB,[_o]:QB}],rules:[{conditions:[{[xo]:"aws.partition",[_o]:QB,assign:CF}],rules:[{conditions:[mY,gY],rules:[{conditions:[{[xo]:Rh,[_o]:[jB,KB]},qB],rules:[{rules:[{endpoint:{url:"https://bedrock-runtime-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:So,headers:So},type:Ip}],type:Yn}],type:Yn},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:ql}],type:Yn},{conditions:VB,rules:[{conditions:[{[xo]:Rh,[_o]:[KB,jB]}],rules:[{rules:[{endpoint:{url:"https://bedrock-runtime-fips.{Region}.{PartitionResult#dnsSuffix}",properties:So,headers:So},type:Ip}],type:Yn}],type:Yn},{error:"FIPS is enabled but this partition does not support FIPS",type:ql}],type:Yn},{conditions:zB,rules:[{conditions:[qB],rules:[{rules:[{endpoint:{url:"https://bedrock-runtime.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:So,headers:So},type:Ip}],type:Yn}],type:Yn},{error:"DualStack is enabled but this partition does not support DualStack",type:ql}],type:Yn},{rules:[{endpoint:{url:"https://bedrock-runtime.{Region}.{PartitionResult#dnsSuffix}",properties:So,headers:So},type:Ip}],type:Yn}],type:Yn}],type:Yn},{error:"Invalid Configuration: Missing Region",type:ql}],type:Yn}]},SUe=bUe,CUe=new v2e({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS"]}),wUe=(e,t={})=>CUe.get(e,()=>D2e(SUe,{endpointParams:e,logger:t.logger}));Fv.aws=NH;const xUe=e=>({apiVersion:"2023-09-30",base64Decoder:(e==null?void 0:e.base64Decoder)??IH,base64Encoder:(e==null?void 0:e.base64Encoder)??RH,disableHostPrefix:(e==null?void 0:e.disableHostPrefix)??!1,endpointProvider:(e==null?void 0:e.endpointProvider)??wUe,extensions:(e==null?void 0:e.extensions)??[],httpAuthSchemeProvider:(e==null?void 0:e.httpAuthSchemeProvider)??GDe,httpAuthSchemes:(e==null?void 0:e.httpAuthSchemes)??[{schemeId:"aws.auth#sigv4",identityProvider:t=>t.getIdentityProvider("aws.auth#sigv4"),signer:new H2e}],logger:(e==null?void 0:e.logger)??new tY,serviceId:(e==null?void 0:e.serviceId)??"Bedrock Runtime",urlParser:(e==null?void 0:e.urlParser)??Bv,utf8Decoder:(e==null?void 0:e.utf8Decoder)??$d,utf8Encoder:(e==null?void 0:e.utf8Encoder)??EH}),_Ue=["in-region","cross-region","mobile","standard","legacy"],TUe=({defaultsMode:e}={})=>Y2e(async()=>{const t=typeof e=="function"?await e():e;switch(t==null?void 0:t.toLowerCase()){case"auto":return Promise.resolve(IUe()?"mobile":"standard");case"mobile":case"in-region":case"cross-region":case"standard":case"legacy":return Promise.resolve(t==null?void 0:t.toLocaleLowerCase());case void 0:return Promise.resolve("legacy");default:throw new Error(`Invalid parameter for "defaultsMode", expect ${_Ue.join(", ")}, got ${t}`)}}),IUe=()=>{var n,r;const e=typeof window<"u"&&((n=window==null?void 0:window.navigator)!=null&&n.userAgent)?fY.parse(window.navigator.userAgent):void 0,t=(r=e==null?void 0:e.platform)==null?void 0:r.type;return t==="tablet"||t==="mobile"},EUe=e=>{const t=TUe(e),n=()=>t().then(FBe),r=xUe(e);return{...r,...e,runtime:"browser",defaultsMode:t,bodyLengthChecker:(e==null?void 0:e.bodyLengthChecker)??yUe,credentialDefaultProvider:(e==null?void 0:e.credentialDefaultProvider)??(i=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:(e==null?void 0:e.defaultUserAgentProvider)??Kje({serviceId:r.serviceId,clientVersion:vje.version}),eventStreamSerdeProvider:(e==null?void 0:e.eventStreamSerdeProvider)??gUe,maxAttempts:(e==null?void 0:e.maxAttempts)??Dv,region:(e==null?void 0:e.region)??vUe("Region is missing"),requestHandler:gF.create((e==null?void 0:e.requestHandler)??n),retryMode:(e==null?void 0:e.retryMode)??(async()=>(await n()).retryMode||wDe),sha256:(e==null?void 0:e.sha256)??Dje,streamCollector:(e==null?void 0:e.streamCollector)??r2e,useDualstackEndpoint:(e==null?void 0:e.useDualstackEndpoint)??(()=>Promise.resolve(nDe)),useFipsEndpoint:(e==null?void 0:e.useFipsEndpoint)??(()=>Promise.resolve(rDe))}},RUe=e=>{let t=async()=>{if(e.region===void 0)throw new Error("Region is missing from runtimeConfig");const n=e.region;return typeof n=="string"?n:n()};return{setRegion(n){t=n},region(){return t}}},$Ue=e=>({region:e.region()}),kUe=e=>{const t=e.httpAuthSchemes;let n=e.httpAuthSchemeProvider,r=e.credentials;return{setHttpAuthScheme(i){const o=t.findIndex(a=>a.schemeId===i.schemeId);o===-1?t.push(i):t.splice(o,1,i)},httpAuthSchemes(){return t},setHttpAuthSchemeProvider(i){n=i},httpAuthSchemeProvider(){return n},setCredentials(i){r=i},credentials(){return r}}},OUe=e=>({httpAuthSchemes:e.httpAuthSchemes(),httpAuthSchemeProvider:e.httpAuthSchemeProvider(),credentials:e.credentials()}),Tg=e=>e,MUe=(e,t)=>{const n={...Tg(RUe(e)),...Tg(UBe(e)),...Tg(xLe(e)),...Tg(kUe(e))};return t.forEach(r=>r.configure(n)),{...e,...$Ue(n),...PBe(n),..._Le(n),...OUe(n)}};class FUe extends CBe{constructor(...[t]){const n=EUe(t||{}),r=ZDe(n),i=g2e(r),o=UDe(i),a=iDe(o),s=a,c=CDe(s),u=oDe(c),l=JDe(u),d=MUe(l,(t==null?void 0:t.extensions)||[]);super(d),this.config=d,this.middlewareStack.use(tDe(this.config)),this.middlewareStack.use(zDe(this.config)),this.middlewareStack.use(cDe(this.config)),this.middlewareStack.use(RLe(this.config)),this.middlewareStack.use(OLe(this.config)),this.middlewareStack.use(DLe(this.config)),this.middlewareStack.use(NLe(this.config,{httpAuthSchemeParametersProvider:HDe,identityProviderConfigProvider:async p=>new l2e({"aws.auth#sigv4":p.credentials})})),this.middlewareStack.use(GLe(this.config))}destroy(){super.destroy()}}class fr extends bF{constructor(t){super(t),Object.setPrototypeOf(this,fr.prototype)}}class wF extends fr{constructor(t){super({name:"AccessDeniedException",$fault:"client",...t}),this.name="AccessDeniedException",this.$fault="client",Object.setPrototypeOf(this,wF.prototype)}}var HB;(function(e){e.visit=(t,n)=>t.s3OutputDataConfig!==void 0?n.s3OutputDataConfig(t.s3OutputDataConfig):n._(t.$unknown[0],t.$unknown[1])})(HB||(HB={}));class xF extends fr{constructor(t){super({name:"InternalServerException",$fault:"server",...t}),this.name="InternalServerException",this.$fault="server",Object.setPrototypeOf(this,xF.prototype)}}class _F extends fr{constructor(t){super({name:"ThrottlingException",$fault:"client",...t}),this.name="ThrottlingException",this.$fault="client",Object.setPrototypeOf(this,_F.prototype)}}class TF extends fr{constructor(t){super({name:"ValidationException",$fault:"client",...t}),this.name="ValidationException",this.$fault="client",Object.setPrototypeOf(this,TF.prototype)}}class IF extends fr{constructor(t){super({name:"ConflictException",$fault:"client",...t}),this.name="ConflictException",this.$fault="client",Object.setPrototypeOf(this,IF.prototype)}}class EF extends fr{constructor(t){super({name:"ResourceNotFoundException",$fault:"client",...t}),this.name="ResourceNotFoundException",this.$fault="client",Object.setPrototypeOf(this,EF.prototype)}}class RF extends fr{constructor(t){super({name:"ServiceQuotaExceededException",$fault:"client",...t}),this.name="ServiceQuotaExceededException",this.$fault="client",Object.setPrototypeOf(this,RF.prototype)}}class $F extends fr{constructor(t){super({name:"ServiceUnavailableException",$fault:"server",...t}),this.name="ServiceUnavailableException",this.$fault="server",Object.setPrototypeOf(this,$F.prototype)}}var YB;(function(e){e.visit=(t,n)=>t.bytes!==void 0?n.bytes(t.bytes):n._(t.$unknown[0],t.$unknown[1])})(YB||(YB={}));var GB;(function(e){e.visit=(t,n)=>t.text!==void 0?n.text(t.text):t.image!==void 0?n.image(t.image):n._(t.$unknown[0],t.$unknown[1])})(GB||(GB={}));var px;(function(e){e.visit=(t,n)=>t.bytes!==void 0?n.bytes(t.bytes):n._(t.$unknown[0],t.$unknown[1])})(px||(px={}));var hx;(function(e){e.visit=(t,n)=>t.bytes!==void 0?n.bytes(t.bytes):n._(t.$unknown[0],t.$unknown[1])})(hx||(hx={}));var Ax;(function(e){e.visit=(t,n)=>t.text!==void 0?n.text(t.text):t.image!==void 0?n.image(t.image):n._(t.$unknown[0],t.$unknown[1])})(Ax||(Ax={}));var mx;(function(e){e.visit=(t,n)=>t.bytes!==void 0?n.bytes(t.bytes):n._(t.$unknown[0],t.$unknown[1])})(mx||(mx={}));var gx;(function(e){e.visit=(t,n)=>t.bytes!==void 0?n.bytes(t.bytes):t.s3Location!==void 0?n.s3Location(t.s3Location):n._(t.$unknown[0],t.$unknown[1])})(gx||(gx={}));var vx;(function(e){e.visit=(t,n)=>t.json!==void 0?n.json(t.json):t.text!==void 0?n.text(t.text):t.image!==void 0?n.image(t.image):t.document!==void 0?n.document(t.document):t.video!==void 0?n.video(t.video):n._(t.$unknown[0],t.$unknown[1])})(vx||(vx={}));var yx;(function(e){e.visit=(t,n)=>t.text!==void 0?n.text(t.text):t.image!==void 0?n.image(t.image):t.document!==void 0?n.document(t.document):t.video!==void 0?n.video(t.video):t.toolUse!==void 0?n.toolUse(t.toolUse):t.toolResult!==void 0?n.toolResult(t.toolResult):t.guardContent!==void 0?n.guardContent(t.guardContent):n._(t.$unknown[0],t.$unknown[1])})(yx||(yx={}));var JB;(function(e){e.visit=(t,n)=>t.text!==void 0?n.text(t.text):n._(t.$unknown[0],t.$unknown[1])})(JB||(JB={}));var bx;(function(e){e.visit=(t,n)=>t.text!==void 0?n.text(t.text):t.guardContent!==void 0?n.guardContent(t.guardContent):n._(t.$unknown[0],t.$unknown[1])})(bx||(bx={}));var ZB;(function(e){e.visit=(t,n)=>t.auto!==void 0?n.auto(t.auto):t.any!==void 0?n.any(t.any):t.tool!==void 0?n.tool(t.tool):n._(t.$unknown[0],t.$unknown[1])})(ZB||(ZB={}));var Sx;(function(e){e.visit=(t,n)=>t.json!==void 0?n.json(t.json):n._(t.$unknown[0],t.$unknown[1])})(Sx||(Sx={}));var Cx;(function(e){e.visit=(t,n)=>t.toolSpec!==void 0?n.toolSpec(t.toolSpec):n._(t.$unknown[0],t.$unknown[1])})(Cx||(Cx={}));var XB;(function(e){e.visit=(t,n)=>t.message!==void 0?n.message(t.message):n._(t.$unknown[0],t.$unknown[1])})(XB||(XB={}));class kF extends fr{constructor(t){super({name:"ModelErrorException",$fault:"client",...t}),this.name="ModelErrorException",this.$fault="client",Object.setPrototypeOf(this,kF.prototype),this.originalStatusCode=t.originalStatusCode,this.resourceName=t.resourceName}}class OF extends fr{constructor(t){super({name:"ModelNotReadyException",$fault:"client",...t}),this.name="ModelNotReadyException",this.$fault="client",this.$retryable={},Object.setPrototypeOf(this,OF.prototype)}}class MF extends fr{constructor(t){super({name:"ModelTimeoutException",$fault:"client",...t}),this.name="ModelTimeoutException",this.$fault="client",Object.setPrototypeOf(this,MF.prototype)}}var eD;(function(e){e.visit=(t,n)=>t.text!==void 0?n.text(t.text):t.toolUse!==void 0?n.toolUse(t.toolUse):n._(t.$unknown[0],t.$unknown[1])})(eD||(eD={}));var tD;(function(e){e.visit=(t,n)=>t.toolUse!==void 0?n.toolUse(t.toolUse):n._(t.$unknown[0],t.$unknown[1])})(tD||(tD={}));class FF extends fr{constructor(t){super({name:"ModelStreamErrorException",$fault:"client",...t}),this.name="ModelStreamErrorException",this.$fault="client",Object.setPrototypeOf(this,FF.prototype),this.originalStatusCode=t.originalStatusCode,this.originalMessage=t.originalMessage}}var nD;(function(e){e.visit=(t,n)=>t.messageStart!==void 0?n.messageStart(t.messageStart):t.contentBlockStart!==void 0?n.contentBlockStart(t.contentBlockStart):t.contentBlockDelta!==void 0?n.contentBlockDelta(t.contentBlockDelta):t.contentBlockStop!==void 0?n.contentBlockStop(t.contentBlockStop):t.messageStop!==void 0?n.messageStop(t.messageStop):t.metadata!==void 0?n.metadata(t.metadata):t.internalServerException!==void 0?n.internalServerException(t.internalServerException):t.modelStreamErrorException!==void 0?n.modelStreamErrorException(t.modelStreamErrorException):t.validationException!==void 0?n.validationException(t.validationException):t.throttlingException!==void 0?n.throttlingException(t.throttlingException):t.serviceUnavailableException!==void 0?n.serviceUnavailableException(t.serviceUnavailableException):n._(t.$unknown[0],t.$unknown[1])})(nD||(nD={}));var rD;(function(e){e.visit=(t,n)=>t.chunk!==void 0?n.chunk(t.chunk):t.internalServerException!==void 0?n.internalServerException(t.internalServerException):t.modelStreamErrorException!==void 0?n.modelStreamErrorException(t.modelStreamErrorException):t.validationException!==void 0?n.validationException(t.validationException):t.throttlingException!==void 0?n.throttlingException(t.throttlingException):t.modelTimeoutException!==void 0?n.modelTimeoutException(t.modelTimeoutException):t.serviceUnavailableException!==void 0?n.serviceUnavailableException(t.serviceUnavailableException):n._(t.$unknown[0],t.$unknown[1])})(rD||(rD={}));const vY=e=>{if(e.text!==void 0)return{text:e.text};if(e.image!==void 0)return{image:lx};if(e.$unknown!==void 0)return{[e.$unknown[0]]:"UNKNOWN"}},LUe=e=>{if(e.text!==void 0)return{text:e.text};if(e.image!==void 0)return{image:e.image};if(e.document!==void 0)return{document:e.document};if(e.video!==void 0)return{video:e.video};if(e.toolUse!==void 0)return{toolUse:e.toolUse};if(e.toolResult!==void 0)return{toolResult:e.toolResult};if(e.guardContent!==void 0)return{guardContent:vY(e.guardContent)};if(e.$unknown!==void 0)return{[e.$unknown[0]]:"UNKNOWN"}},yY=e=>({...e,...e.content&&{content:e.content.map(t=>LUe(t))}}),BUe=e=>{if(e.text!==void 0)return{text:e.text};if(e.guardContent!==void 0)return{guardContent:vY(e.guardContent)};if(e.$unknown!==void 0)return{[e.$unknown[0]]:"UNKNOWN"}},DUe=e=>({...e,...e.messages&&{messages:e.messages.map(t=>yY(t))},...e.system&&{system:e.system.map(t=>BUe(t))},...e.toolConfig&&{toolConfig:e.toolConfig},...e.promptVariables&&{promptVariables:lx},...e.requestMetadata&&{requestMetadata:lx}}),jUe=e=>{if(e.message!==void 0)return{message:yY(e.message)};if(e.$unknown!==void 0)return{[e.$unknown[0]]:"UNKNOWN"}},UUe=e=>({...e,...e.output&&{output:jUe(e.output)}}),PUe=async(e,t)=>{const n=s2e(e,t),r={"content-type":"application/json"};n.bp("/model/{modelId}/converse"),n.p("modelId",()=>e.modelId,"{modelId}",!1);let i;return i=JSON.stringify(De(e,{additionalModelRequestFields:o=>dS(o),additionalModelResponseFieldPaths:o=>vt(o),guardrailConfig:o=>vt(o),inferenceConfig:o=>cPe(o),messages:o=>lPe(o,t),performanceConfig:o=>vt(o),promptVariables:o=>vt(o),requestMetadata:o=>vt(o),system:o=>fPe(o,t),toolConfig:o=>hPe(o)})),n.m("POST").h(r).b(i),n.build()},NUe=async(e,t)=>{if(e.statusCode!==200&&e.statusCode>=300)return WUe(e,t);const n=Or({$metadata:di(e)}),r=EBe(ZH(await rY(e.body,t)),"body"),i=De(r,{additionalModelResponseFields:o=>LF(o),metrics:vt,output:o=>_Pe(Tc(o),t),performanceConfig:vt,stopReason:Ge,trace:o=>TPe(o),usage:vt});return Object.assign(n,i),n},WUe=async(e,t)=>{const n={...e,body:await VBe(e.body,t)},r=zBe(e,n.body);switch(r){case"AccessDeniedException":case"com.amazonaws.bedrockruntime#AccessDeniedException":throw await qUe(n);case"InternalServerException":case"com.amazonaws.bedrockruntime#InternalServerException":throw await zUe(n);case"ResourceNotFoundException":case"com.amazonaws.bedrockruntime#ResourceNotFoundException":throw await JUe(n);case"ServiceQuotaExceededException":case"com.amazonaws.bedrockruntime#ServiceQuotaExceededException":throw await ZUe(n);case"ThrottlingException":case"com.amazonaws.bedrockruntime#ThrottlingException":throw await ePe(n);case"ValidationException":case"com.amazonaws.bedrockruntime#ValidationException":throw await tPe(n);case"ModelErrorException":case"com.amazonaws.bedrockruntime#ModelErrorException":throw await QUe(n);case"ModelNotReadyException":case"com.amazonaws.bedrockruntime#ModelNotReadyException":throw await HUe(n);case"ModelTimeoutException":case"com.amazonaws.bedrockruntime#ModelTimeoutException":throw await GUe(n);case"ServiceUnavailableException":case"com.amazonaws.bedrockruntime#ServiceUnavailableException":throw await XUe(n);case"ModelStreamErrorException":case"com.amazonaws.bedrockruntime#ModelStreamErrorException":throw await YUe(n);case"ConflictException":case"com.amazonaws.bedrockruntime#ConflictException":throw await VUe(n);default:const i=n.body;return KUe({output:e,parsedBody:i,errorCode:r})}},KUe=OBe(fr),qUe=async(e,t)=>{const n=Or({}),r=e.body,i=De(r,{message:Ge});Object.assign(n,i);const o=new wF({$metadata:di(e),...n});return li(o,e.body)},VUe=async(e,t)=>{const n=Or({}),r=e.body,i=De(r,{message:Ge});Object.assign(n,i);const o=new IF({$metadata:di(e),...n});return li(o,e.body)},zUe=async(e,t)=>{const n=Or({}),r=e.body,i=De(r,{message:Ge});Object.assign(n,i);const o=new xF({$metadata:di(e),...n});return li(o,e.body)},QUe=async(e,t)=>{const n=Or({}),r=e.body,i=De(r,{message:Ge,originalStatusCode:JH,resourceName:Ge});Object.assign(n,i);const o=new kF({$metadata:di(e),...n});return li(o,e.body)},HUe=async(e,t)=>{const n=Or({}),r=e.body,i=De(r,{message:Ge});Object.assign(n,i);const o=new OF({$metadata:di(e),...n});return li(o,e.body)},YUe=async(e,t)=>{const n=Or({}),r=e.body,i=De(r,{message:Ge,originalMessage:Ge,originalStatusCode:JH});Object.assign(n,i);const o=new FF({$metadata:di(e),...n});return li(o,e.body)},GUe=async(e,t)=>{const n=Or({}),r=e.body,i=De(r,{message:Ge});Object.assign(n,i);const o=new MF({$metadata:di(e),...n});return li(o,e.body)},JUe=async(e,t)=>{const n=Or({}),r=e.body,i=De(r,{message:Ge});Object.assign(n,i);const o=new EF({$metadata:di(e),...n});return li(o,e.body)},ZUe=async(e,t)=>{const n=Or({}),r=e.body,i=De(r,{message:Ge});Object.assign(n,i);const o=new RF({$metadata:di(e),...n});return li(o,e.body)},XUe=async(e,t)=>{const n=Or({}),r=e.body,i=De(r,{message:Ge});Object.assign(n,i);const o=new $F({$metadata:di(e),...n});return li(o,e.body)},ePe=async(e,t)=>{const n=Or({}),r=e.body,i=De(r,{message:Ge});Object.assign(n,i);const o=new _F({$metadata:di(e),...n});return li(o,e.body)},tPe=async(e,t)=>{const n=Or({}),r=e.body,i=De(r,{message:Ge});Object.assign(n,i);const o=new TF({$metadata:di(e),...n});return li(o,e.body)},nPe=(e,t)=>yx.visit(e,{document:n=>({document:bY(n,t)}),guardContent:n=>({guardContent:SY(n,t)}),image:n=>({image:CY(n,t)}),text:n=>({text:n}),toolResult:n=>({toolResult:mPe(n,t)}),toolUse:n=>({toolUse:SPe(n)}),video:n=>({video:wY(n,t)}),_:(n,r)=>({name:r})}),rPe=(e,t)=>e.filter(n=>n!=null).map(n=>nPe(n,t)),bY=(e,t)=>De(e,{format:[],name:[],source:n=>iPe(n,t)}),iPe=(e,t)=>px.visit(e,{bytes:n=>({bytes:t.base64Encoder(n)}),_:(n,r)=>({name:r})}),SY=(e,t)=>Ax.visit(e,{image:n=>({image:oPe(n,t)}),text:n=>({text:vt(n)}),_:(n,r)=>({name:r})}),oPe=(e,t)=>De(e,{format:[],source:n=>aPe(n,t)}),aPe=(e,t)=>hx.visit(e,{bytes:n=>({bytes:t.base64Encoder(n)}),_:(n,r)=>({name:r})}),CY=(e,t)=>De(e,{format:[],source:n=>sPe(n,t)}),sPe=(e,t)=>mx.visit(e,{bytes:n=>({bytes:t.base64Encoder(n)}),_:(n,r)=>({name:r})}),cPe=(e,t)=>De(e,{maxTokens:[],stopSequences:vt,temperature:wB,topP:wB}),uPe=(e,t)=>De(e,{content:n=>rPe(n,t),role:[]}),lPe=(e,t)=>e.filter(n=>n!=null).map(n=>uPe(n,t)),dPe=(e,t)=>bx.visit(e,{guardContent:n=>({guardContent:SY(n,t)}),text:n=>({text:n}),_:(n,r)=>({name:r})}),fPe=(e,t)=>e.filter(n=>n!=null).map(n=>dPe(n,t)),pPe=(e,t)=>Cx.visit(e,{toolSpec:n=>({toolSpec:bPe(n)}),_:(n,r)=>({name:r})}),hPe=(e,t)=>De(e,{toolChoice:vt,tools:n=>yPe(n)}),APe=(e,t)=>Sx.visit(e,{json:n=>({json:dS(n)}),_:(n,r)=>({name:r})}),mPe=(e,t)=>De(e,{content:n=>vPe(n,t),status:[],toolUseId:[]}),gPe=(e,t)=>vx.visit(e,{document:n=>({document:bY(n,t)}),image:n=>({image:CY(n,t)}),json:n=>({json:dS(n)}),text:n=>({text:n}),video:n=>({video:wY(n,t)}),_:(n,r)=>({name:r})}),vPe=(e,t)=>e.filter(n=>n!=null).map(n=>gPe(n,t)),yPe=(e,t)=>e.filter(n=>n!=null).map(n=>pPe(n)),bPe=(e,t)=>De(e,{description:[],inputSchema:n=>APe(n),name:[]}),SPe=(e,t)=>De(e,{input:n=>dS(n),name:[],toolUseId:[]}),wY=(e,t)=>De(e,{format:[],source:n=>CPe(n,t)}),CPe=(e,t)=>gx.visit(e,{bytes:n=>({bytes:t.base64Encoder(n)}),s3Location:n=>({s3Location:vt(n)}),_:(n,r)=>({name:r})}),dS=(e,t)=>e,wPe=(e,t)=>e.document!=null?{document:xY(e.document,t)}:e.guardContent!=null?{guardContent:FPe(Tc(e.guardContent),t)}:e.image!=null?{image:TY(e.image,t)}:Ge(e.text)!==void 0?{text:Ge(e.text)}:e.toolResult!=null?{toolResult:PPe(e.toolResult,t)}:e.toolUse!=null?{toolUse:KPe(e.toolUse)}:e.video!=null?{video:IY(e.video,t)}:{$unknown:Object.entries(e)[0]},xPe=(e,t)=>(e||[]).filter(r=>r!=null).map(r=>wPe(Tc(r),t)),_Pe=(e,t)=>e.message!=null?{message:UPe(e.message,t)}:{$unknown:Object.entries(e)[0]},TPe=(e,t)=>De(e,{guardrail:n=>DPe(n),promptRouter:vt}),xY=(e,t)=>De(e,{format:Ge,name:Ge,source:n=>IPe(Tc(n),t)}),IPe=(e,t)=>e.bytes!=null?{bytes:t.base64Decoder(e.bytes)}:{$unknown:Object.entries(e)[0]},_Y=(e,t)=>De(e,{contentPolicy:vt,contextualGroundingPolicy:n=>MPe(n),invocationMetrics:vt,sensitiveInformationPolicy:vt,topicPolicy:vt,wordPolicy:vt}),EPe=(e,t)=>(e||[]).filter(r=>r!=null).map(r=>_Y(r)),RPe=(e,t)=>Object.entries(e).reduce((n,[r,i])=>(i===null||(n[r]=EPe(i)),n),{}),$Pe=(e,t)=>Object.entries(e).reduce((n,[r,i])=>(i===null||(n[r]=_Y(i)),n),{}),kPe=(e,t)=>De(e,{action:Ge,score:CB,threshold:CB,type:Ge}),OPe=(e,t)=>(e||[]).filter(r=>r!=null).map(r=>kPe(r)),MPe=(e,t)=>De(e,{filters:n=>OPe(n)}),FPe=(e,t)=>e.image!=null?{image:LPe(e.image,t)}:e.text!=null?{text:vt(e.text)}:{$unknown:Object.entries(e)[0]},LPe=(e,t)=>De(e,{format:Ge,source:n=>BPe(Tc(n),t)}),BPe=(e,t)=>e.bytes!=null?{bytes:t.base64Decoder(e.bytes)}:{$unknown:Object.entries(e)[0]},DPe=(e,t)=>De(e,{inputAssessment:n=>$Pe(n),modelOutput:vt,outputAssessments:n=>RPe(n)}),TY=(e,t)=>De(e,{format:Ge,source:n=>jPe(Tc(n),t)}),jPe=(e,t)=>e.bytes!=null?{bytes:t.base64Decoder(e.bytes)}:{$unknown:Object.entries(e)[0]},UPe=(e,t)=>De(e,{content:n=>xPe(n,t),role:Ge}),PPe=(e,t)=>De(e,{content:n=>WPe(n,t),status:Ge,toolUseId:Ge}),NPe=(e,t)=>e.document!=null?{document:xY(e.document,t)}:e.image!=null?{image:TY(e.image,t)}:e.json!=null?{json:LF(e.json)}:Ge(e.text)!==void 0?{text:Ge(e.text)}:e.video!=null?{video:IY(e.video,t)}:{$unknown:Object.entries(e)[0]},WPe=(e,t)=>(e||[]).filter(r=>r!=null).map(r=>NPe(Tc(r),t)),KPe=(e,t)=>De(e,{input:n=>LF(n),name:Ge,toolUseId:Ge}),IY=(e,t)=>De(e,{format:Ge,source:n=>qPe(Tc(n),t)}),qPe=(e,t)=>e.bytes!=null?{bytes:t.base64Decoder(e.bytes)}:e.s3Location!=null?{s3Location:vt(e.s3Location)}:{$unknown:Object.entries(e)[0]},LF=(e,t)=>e,di=e=>({httpStatusCode:e.statusCode,requestId:e.headers["x-amzn-requestid"]??e.headers["x-amzn-request-id"]??e.headers["x-amz-request-id"],extendedRequestId:e.headers["x-amz-id-2"],cfId:e.headers["x-amz-cf-id"]});class VPe extends GH.classBuilder().ep(XDe).m(function(t,n,r,i){return[VLe(r,this.serialize,this.deserialize),SDe(r,t.getEndpointParameterInstructions())]}).s("AmazonBedrockFrontendService","Converse",{}).n("BedrockRuntimeClient","ConverseCommand").f(DUe,UUe).ser(PUe).de(NUe).build(){}var Ne;(function(e){e.assertEqual=i=>i;function t(i){}e.assertIs=t;function n(i){throw new Error}e.assertNever=n,e.arrayToEnum=i=>{const o={};for(const a of i)o[a]=a;return o},e.getValidEnumValues=i=>{const o=e.objectKeys(i).filter(s=>typeof i[i[s]]!="number"),a={};for(const s of o)a[s]=i[s];return e.objectValues(a)},e.objectValues=i=>e.objectKeys(i).map(function(o){return i[o]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const o=[];for(const a in i)Object.prototype.hasOwnProperty.call(i,a)&&o.push(a);return o},e.find=(i,o)=>{for(const a of i)if(o(a))return a},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function r(i,o=" | "){return i.map(a=>typeof a=="string"?`'${a}'`:a).join(o)}e.joinValues=r,e.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(Ne||(Ne={}));var wx;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(wx||(wx={}));const ie=Ne.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Cs=e=>{switch(typeof e){case"undefined":return ie.undefined;case"string":return ie.string;case"number":return isNaN(e)?ie.nan:ie.number;case"boolean":return ie.boolean;case"function":return ie.function;case"bigint":return ie.bigint;case"symbol":return ie.symbol;case"object":return Array.isArray(e)?ie.array:e===null?ie.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?ie.promise:typeof Map<"u"&&e instanceof Map?ie.map:typeof Set<"u"&&e instanceof Set?ie.set:typeof Date<"u"&&e instanceof Date?ie.date:ie.object;default:return ie.unknown}},H=Ne.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),zPe=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class zr extends Error{constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}get errors(){return this.issues}format(t){const n=t||function(o){return o.message},r={_errors:[]},i=o=>{for(const a of o.issues)if(a.code==="invalid_union")a.unionErrors.map(i);else if(a.code==="invalid_return_type")i(a.returnTypeError);else if(a.code==="invalid_arguments")i(a.argumentsError);else if(a.path.length===0)r._errors.push(n(a));else{let s=r,c=0;for(;c<a.path.length;){const u=a.path[c];c===a.path.length-1?(s[u]=s[u]||{_errors:[]},s[u]._errors.push(n(a))):s[u]=s[u]||{_errors:[]},s=s[u],c++}}};return i(this),r}static assert(t){if(!(t instanceof zr))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ne.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},r=[];for(const i of this.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}zr.create=e=>new zr(e);const Od=(e,t)=>{let n;switch(e.code){case H.invalid_type:e.received===ie.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case H.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Ne.jsonStringifyReplacer)}`;break;case H.unrecognized_keys:n=`Unrecognized key(s) in object: ${Ne.joinValues(e.keys,", ")}`;break;case H.invalid_union:n="Invalid input";break;case H.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Ne.joinValues(e.options)}`;break;case H.invalid_enum_value:n=`Invalid enum value. Expected ${Ne.joinValues(e.options)}, received '${e.received}'`;break;case H.invalid_arguments:n="Invalid function arguments";break;case H.invalid_return_type:n="Invalid function return type";break;case H.invalid_date:n="Invalid date";break;case H.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Ne.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case H.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case H.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case H.custom:n="Invalid input";break;case H.invalid_intersection_types:n="Intersection results could not be merged";break;case H.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case H.not_finite:n="Number must be finite";break;default:n=t.defaultError,Ne.assertNever(e)}return{message:n}};let EY=Od;function QPe(e){EY=e}function jv(){return EY}const Uv=e=>{const{data:t,path:n,errorMaps:r,issueData:i}=e,o=[...n,...i.path||[]],a={...i,path:o};if(i.message!==void 0)return{...i,path:o,message:i.message};let s="";const c=r.filter(u=>!!u).slice().reverse();for(const u of c)s=u(a,{data:t,defaultError:s}).message;return{...i,path:o,message:s}},HPe=[];function re(e,t){const n=jv(),r=Uv({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Od?void 0:Od].filter(i=>!!i)});e.common.issues.push(r)}class Pn{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const i of n){if(i.status==="aborted")return Ce;i.status==="dirty"&&t.dirty(),r.push(i.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const i of n){const o=await i.key,a=await i.value;r.push({key:o,value:a})}return Pn.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const i of n){const{key:o,value:a}=i;if(o.status==="aborted"||a.status==="aborted")return Ce;o.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof a.value<"u"||i.alwaysSet)&&(r[o.value]=a.value)}return{status:t.value,value:r}}}const Ce=Object.freeze({status:"aborted"}),sd=e=>({status:"dirty",value:e}),ir=e=>({status:"valid",value:e}),xx=e=>e.status==="aborted",_x=e=>e.status==="dirty",$h=e=>e.status==="valid",kh=e=>typeof Promise<"u"&&e instanceof Promise;function Pv(e,t,n,r){if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(e):r?r.value:t.get(e)}function RY(e,t,n,r,i){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?i.call(e,n):i?i.value=n:t.set(e,n),n}var fe;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(fe||(fe={}));var Op,Mp;class Bo{constructor(t,n,r,i){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const iD=(e,t)=>{if($h(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new zr(e.common.issues);return this._error=n,this._error}}};function Re(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(a,s)=>{var c,u;const{message:l}=e;return a.code==="invalid_enum_value"?{message:l??s.defaultError}:typeof s.data>"u"?{message:(c=l??r)!==null&&c!==void 0?c:s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:(u=l??n)!==null&&u!==void 0?u:s.defaultError}},description:i}}class Fe{constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(t){return Cs(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Cs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Pn,ctx:{common:t.parent.common,data:t.data,parsedType:Cs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(kh(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){var r;const i={common:{issues:[],async:(r=n==null?void 0:n.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Cs(t)},o=this._parseSync({data:t,path:i.path,parent:i});return iD(i,o)}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Cs(t)},i=this._parse({data:t,path:r.path,parent:r}),o=await(kh(i)?i:Promise.resolve(i));return iD(r,o)}refine(t,n){const r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,o)=>{const a=t(i),s=()=>o.addIssue({code:H.custom,...r(i)});return typeof Promise<"u"&&a instanceof Promise?a.then(c=>c?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(t,n){return this._refinement((r,i)=>t(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(t){return new Gi({schema:this,typeName:Se.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return Eo.create(this,this._def)}nullable(){return qs.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Vi.create(this,this._def)}promise(){return Fd.create(this,this._def)}or(t){return Lh.create([this,t],this._def)}and(t){return Bh.create(this,t,this._def)}transform(t){return new Gi({...Re(this._def),schema:this,typeName:Se.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new Nh({...Re(this._def),innerType:this,defaultValue:n,typeName:Se.ZodDefault})}brand(){return new BF({typeName:Se.ZodBranded,type:this,...Re(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new Wh({...Re(this._def),innerType:this,catchValue:n,typeName:Se.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return Xm.create(this,t)}readonly(){return Kh.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const YPe=/^c[^\s-]{8,}$/i,GPe=/^[0-9a-z]+$/,JPe=/^[0-9A-HJKMNP-TV-Z]{26}$/,ZPe=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,XPe=/^[a-z0-9_-]{21}$/i,eNe=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,tNe=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,nNe="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let qC;const rNe=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,iNe=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,oNe=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,$Y="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",aNe=new RegExp(`^${$Y}$`);function kY(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`),t}function sNe(e){return new RegExp(`^${kY(e)}$`)}function OY(e){let t=`${$Y}T${kY(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function cNe(e,t){return!!((t==="v4"||!t)&&rNe.test(e)||(t==="v6"||!t)&&iNe.test(e))}class Ki extends Fe{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==ie.string){const o=this._getOrReturnCtx(t);return re(o,{code:H.invalid_type,expected:ie.string,received:o.parsedType}),Ce}const r=new Pn;let i;for(const o of this._def.checks)if(o.kind==="min")t.data.length<o.value&&(i=this._getOrReturnCtx(t,i),re(i,{code:H.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="max")t.data.length>o.value&&(i=this._getOrReturnCtx(t,i),re(i,{code:H.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="length"){const a=t.data.length>o.value,s=t.data.length<o.value;(a||s)&&(i=this._getOrReturnCtx(t,i),a?re(i,{code:H.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):s&&re(i,{code:H.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),r.dirty())}else if(o.kind==="email")tNe.test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"email",code:H.invalid_string,message:o.message}),r.dirty());else if(o.kind==="emoji")qC||(qC=new RegExp(nNe,"u")),qC.test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"emoji",code:H.invalid_string,message:o.message}),r.dirty());else if(o.kind==="uuid")ZPe.test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"uuid",code:H.invalid_string,message:o.message}),r.dirty());else if(o.kind==="nanoid")XPe.test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"nanoid",code:H.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid")YPe.test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"cuid",code:H.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid2")GPe.test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"cuid2",code:H.invalid_string,message:o.message}),r.dirty());else if(o.kind==="ulid")JPe.test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"ulid",code:H.invalid_string,message:o.message}),r.dirty());else if(o.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),re(i,{validation:"url",code:H.invalid_string,message:o.message}),r.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"regex",code:H.invalid_string,message:o.message}),r.dirty())):o.kind==="trim"?t.data=t.data.trim():o.kind==="includes"?t.data.includes(o.value,o.position)||(i=this._getOrReturnCtx(t,i),re(i,{code:H.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),r.dirty()):o.kind==="toLowerCase"?t.data=t.data.toLowerCase():o.kind==="toUpperCase"?t.data=t.data.toUpperCase():o.kind==="startsWith"?t.data.startsWith(o.value)||(i=this._getOrReturnCtx(t,i),re(i,{code:H.invalid_string,validation:{startsWith:o.value},message:o.message}),r.dirty()):o.kind==="endsWith"?t.data.endsWith(o.value)||(i=this._getOrReturnCtx(t,i),re(i,{code:H.invalid_string,validation:{endsWith:o.value},message:o.message}),r.dirty()):o.kind==="datetime"?OY(o).test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{code:H.invalid_string,validation:"datetime",message:o.message}),r.dirty()):o.kind==="date"?aNe.test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{code:H.invalid_string,validation:"date",message:o.message}),r.dirty()):o.kind==="time"?sNe(o).test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{code:H.invalid_string,validation:"time",message:o.message}),r.dirty()):o.kind==="duration"?eNe.test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"duration",code:H.invalid_string,message:o.message}),r.dirty()):o.kind==="ip"?cNe(t.data,o.version)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"ip",code:H.invalid_string,message:o.message}),r.dirty()):o.kind==="base64"?oNe.test(t.data)||(i=this._getOrReturnCtx(t,i),re(i,{validation:"base64",code:H.invalid_string,message:o.message}),r.dirty()):Ne.assertNever(o);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(i=>t.test(i),{validation:n,code:H.invalid_string,...fe.errToObj(r)})}_addCheck(t){return new Ki({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...fe.errToObj(t)})}url(t){return this._addCheck({kind:"url",...fe.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...fe.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...fe.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...fe.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...fe.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...fe.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...fe.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...fe.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...fe.errToObj(t)})}datetime(t){var n,r;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(n=t==null?void 0:t.offset)!==null&&n!==void 0?n:!1,local:(r=t==null?void 0:t.local)!==null&&r!==void 0?r:!1,...fe.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...fe.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...fe.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...fe.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...fe.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...fe.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...fe.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...fe.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...fe.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...fe.errToObj(n)})}nonempty(t){return this.min(1,fe.errToObj(t))}trim(){return new Ki({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Ki({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Ki({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}Ki.create=e=>{var t;return new Ki({checks:[],typeName:Se.ZodString,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...Re(e)})};function uNe(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,i=n>r?n:r,o=parseInt(e.toFixed(i).replace(".","")),a=parseInt(t.toFixed(i).replace(".",""));return o%a/Math.pow(10,i)}class Ns extends Fe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==ie.number){const o=this._getOrReturnCtx(t);return re(o,{code:H.invalid_type,expected:ie.number,received:o.parsedType}),Ce}let r;const i=new Pn;for(const o of this._def.checks)o.kind==="int"?Ne.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),re(r,{code:H.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(r=this._getOrReturnCtx(t,r),re(r,{code:H.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(r=this._getOrReturnCtx(t,r),re(r,{code:H.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?uNe(t.data,o.value)!==0&&(r=this._getOrReturnCtx(t,r),re(r,{code:H.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),re(r,{code:H.not_finite,message:o.message}),i.dirty()):Ne.assertNever(o);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,fe.toString(n))}gt(t,n){return this.setLimit("min",t,!1,fe.toString(n))}lte(t,n){return this.setLimit("max",t,!0,fe.toString(n))}lt(t,n){return this.setLimit("max",t,!1,fe.toString(n))}setLimit(t,n,r,i){return new Ns({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:fe.toString(i)}]})}_addCheck(t){return new Ns({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:fe.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:fe.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:fe.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:fe.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:fe.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:fe.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:fe.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:fe.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:fe.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Ne.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}}Ns.create=e=>new Ns({checks:[],typeName:Se.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...Re(e)});class Ws extends Fe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce&&(t.data=BigInt(t.data)),this._getType(t)!==ie.bigint){const o=this._getOrReturnCtx(t);return re(o,{code:H.invalid_type,expected:ie.bigint,received:o.parsedType}),Ce}let r;const i=new Pn;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(r=this._getOrReturnCtx(t,r),re(r,{code:H.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(r=this._getOrReturnCtx(t,r),re(r,{code:H.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),re(r,{code:H.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):Ne.assertNever(o);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,fe.toString(n))}gt(t,n){return this.setLimit("min",t,!1,fe.toString(n))}lte(t,n){return this.setLimit("max",t,!0,fe.toString(n))}lt(t,n){return this.setLimit("max",t,!1,fe.toString(n))}setLimit(t,n,r,i){return new Ws({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:fe.toString(i)}]})}_addCheck(t){return new Ws({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:fe.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:fe.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:fe.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:fe.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:fe.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}Ws.create=e=>{var t;return new Ws({checks:[],typeName:Se.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...Re(e)})};class Oh extends Fe{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==ie.boolean){const r=this._getOrReturnCtx(t);return re(r,{code:H.invalid_type,expected:ie.boolean,received:r.parsedType}),Ce}return ir(t.data)}}Oh.create=e=>new Oh({typeName:Se.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...Re(e)});class Su extends Fe{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==ie.date){const o=this._getOrReturnCtx(t);return re(o,{code:H.invalid_type,expected:ie.date,received:o.parsedType}),Ce}if(isNaN(t.data.getTime())){const o=this._getOrReturnCtx(t);return re(o,{code:H.invalid_date}),Ce}const r=new Pn;let i;for(const o of this._def.checks)o.kind==="min"?t.data.getTime()<o.value&&(i=this._getOrReturnCtx(t,i),re(i,{code:H.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),r.dirty()):o.kind==="max"?t.data.getTime()>o.value&&(i=this._getOrReturnCtx(t,i),re(i,{code:H.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):Ne.assertNever(o);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Su({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:fe.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:fe.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}}Su.create=e=>new Su({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:Se.ZodDate,...Re(e)});class Nv extends Fe{_parse(t){if(this._getType(t)!==ie.symbol){const r=this._getOrReturnCtx(t);return re(r,{code:H.invalid_type,expected:ie.symbol,received:r.parsedType}),Ce}return ir(t.data)}}Nv.create=e=>new Nv({typeName:Se.ZodSymbol,...Re(e)});class Mh extends Fe{_parse(t){if(this._getType(t)!==ie.undefined){const r=this._getOrReturnCtx(t);return re(r,{code:H.invalid_type,expected:ie.undefined,received:r.parsedType}),Ce}return ir(t.data)}}Mh.create=e=>new Mh({typeName:Se.ZodUndefined,...Re(e)});class Fh extends Fe{_parse(t){if(this._getType(t)!==ie.null){const r=this._getOrReturnCtx(t);return re(r,{code:H.invalid_type,expected:ie.null,received:r.parsedType}),Ce}return ir(t.data)}}Fh.create=e=>new Fh({typeName:Se.ZodNull,...Re(e)});class Md extends Fe{constructor(){super(...arguments),this._any=!0}_parse(t){return ir(t.data)}}Md.create=e=>new Md({typeName:Se.ZodAny,...Re(e)});class Xc extends Fe{constructor(){super(...arguments),this._unknown=!0}_parse(t){return ir(t.data)}}Xc.create=e=>new Xc({typeName:Se.ZodUnknown,...Re(e)});class xa extends Fe{_parse(t){const n=this._getOrReturnCtx(t);return re(n,{code:H.invalid_type,expected:ie.never,received:n.parsedType}),Ce}}xa.create=e=>new xa({typeName:Se.ZodNever,...Re(e)});class Wv extends Fe{_parse(t){if(this._getType(t)!==ie.undefined){const r=this._getOrReturnCtx(t);return re(r,{code:H.invalid_type,expected:ie.void,received:r.parsedType}),Ce}return ir(t.data)}}Wv.create=e=>new Wv({typeName:Se.ZodVoid,...Re(e)});class Vi extends Fe{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),i=this._def;if(n.parsedType!==ie.array)return re(n,{code:H.invalid_type,expected:ie.array,received:n.parsedType}),Ce;if(i.exactLength!==null){const a=n.data.length>i.exactLength.value,s=n.data.length<i.exactLength.value;(a||s)&&(re(n,{code:a?H.too_big:H.too_small,minimum:s?i.exactLength.value:void 0,maximum:a?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}if(i.minLength!==null&&n.data.length<i.minLength.value&&(re(n,{code:H.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&n.data.length>i.maxLength.value&&(re(n,{code:H.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((a,s)=>i.type._parseAsync(new Bo(n,a,n.path,s)))).then(a=>Pn.mergeArray(r,a));const o=[...n.data].map((a,s)=>i.type._parseSync(new Bo(n,a,n.path,s)));return Pn.mergeArray(r,o)}get element(){return this._def.type}min(t,n){return new Vi({...this._def,minLength:{value:t,message:fe.toString(n)}})}max(t,n){return new Vi({...this._def,maxLength:{value:t,message:fe.toString(n)}})}length(t,n){return new Vi({...this._def,exactLength:{value:t,message:fe.toString(n)}})}nonempty(t){return this.min(1,t)}}Vi.create=(e,t)=>new Vi({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Se.ZodArray,...Re(t)});function Gl(e){if(e instanceof gt){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=Eo.create(Gl(r))}return new gt({...e._def,shape:()=>t})}else return e instanceof Vi?new Vi({...e._def,type:Gl(e.element)}):e instanceof Eo?Eo.create(Gl(e.unwrap())):e instanceof qs?qs.create(Gl(e.unwrap())):e instanceof Do?Do.create(e.items.map(t=>Gl(t))):e}class gt extends Fe{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=Ne.objectKeys(t);return this._cached={shape:t,keys:n}}_parse(t){if(this._getType(t)!==ie.object){const u=this._getOrReturnCtx(t);return re(u,{code:H.invalid_type,expected:ie.object,received:u.parsedType}),Ce}const{status:r,ctx:i}=this._processInputParams(t),{shape:o,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof xa&&this._def.unknownKeys==="strip"))for(const u in i.data)a.includes(u)||s.push(u);const c=[];for(const u of a){const l=o[u],d=i.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new Bo(i,d,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof xa){const u=this._def.unknownKeys;if(u==="passthrough")for(const l of s)c.push({key:{status:"valid",value:l},value:{status:"valid",value:i.data[l]}});else if(u==="strict")s.length>0&&(re(i,{code:H.unrecognized_keys,keys:s}),r.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const l of s){const d=i.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new Bo(i,d,i.path,l)),alwaysSet:l in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const u=[];for(const l of c){const d=await l.key,p=await l.value;u.push({key:d,value:p,alwaysSet:l.alwaysSet})}return u}).then(u=>Pn.mergeObjectSync(r,u)):Pn.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(t){return fe.errToObj,new gt({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var i,o,a,s;const c=(a=(o=(i=this._def).errorMap)===null||o===void 0?void 0:o.call(i,n,r).message)!==null&&a!==void 0?a:r.defaultError;return n.code==="unrecognized_keys"?{message:(s=fe.errToObj(t).message)!==null&&s!==void 0?s:c}:{message:c}}}:{}})}strip(){return new gt({...this._def,unknownKeys:"strip"})}passthrough(){return new gt({...this._def,unknownKeys:"passthrough"})}extend(t){return new gt({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new gt({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Se.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new gt({...this._def,catchall:t})}pick(t){const n={};return Ne.objectKeys(t).forEach(r=>{t[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new gt({...this._def,shape:()=>n})}omit(t){const n={};return Ne.objectKeys(this.shape).forEach(r=>{t[r]||(n[r]=this.shape[r])}),new gt({...this._def,shape:()=>n})}deepPartial(){return Gl(this)}partial(t){const n={};return Ne.objectKeys(this.shape).forEach(r=>{const i=this.shape[r];t&&!t[r]?n[r]=i:n[r]=i.optional()}),new gt({...this._def,shape:()=>n})}required(t){const n={};return Ne.objectKeys(this.shape).forEach(r=>{if(t&&!t[r])n[r]=this.shape[r];else{let o=this.shape[r];for(;o instanceof Eo;)o=o._def.innerType;n[r]=o}}),new gt({...this._def,shape:()=>n})}keyof(){return MY(Ne.objectKeys(this.shape))}}gt.create=(e,t)=>new gt({shape:()=>e,unknownKeys:"strip",catchall:xa.create(),typeName:Se.ZodObject,...Re(t)});gt.strictCreate=(e,t)=>new gt({shape:()=>e,unknownKeys:"strict",catchall:xa.create(),typeName:Se.ZodObject,...Re(t)});gt.lazycreate=(e,t)=>new gt({shape:e,unknownKeys:"strip",catchall:xa.create(),typeName:Se.ZodObject,...Re(t)});class Lh extends Fe{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function i(o){for(const s of o)if(s.result.status==="valid")return s.result;for(const s of o)if(s.result.status==="dirty")return n.common.issues.push(...s.ctx.common.issues),s.result;const a=o.map(s=>new zr(s.ctx.common.issues));return re(n,{code:H.invalid_union,unionErrors:a}),Ce}if(n.common.async)return Promise.all(r.map(async o=>{const a={...n,common:{...n.common,issues:[]},parent:null};return{result:await o._parseAsync({data:n.data,path:n.path,parent:a}),ctx:a}})).then(i);{let o;const a=[];for(const c of r){const u={...n,common:{...n.common,issues:[]},parent:null},l=c._parseSync({data:n.data,path:n.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!o&&(o={result:l,ctx:u}),u.common.issues.length&&a.push(u.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;const s=a.map(c=>new zr(c));return re(n,{code:H.invalid_union,unionErrors:s}),Ce}}get options(){return this._def.options}}Lh.create=(e,t)=>new Lh({options:e,typeName:Se.ZodUnion,...Re(t)});const fa=e=>e instanceof jh?fa(e.schema):e instanceof Gi?fa(e.innerType()):e instanceof Uh?[e.value]:e instanceof Ks?e.options:e instanceof Ph?Ne.objectValues(e.enum):e instanceof Nh?fa(e._def.innerType):e instanceof Mh?[void 0]:e instanceof Fh?[null]:e instanceof Eo?[void 0,...fa(e.unwrap())]:e instanceof qs?[null,...fa(e.unwrap())]:e instanceof BF||e instanceof Kh?fa(e.unwrap()):e instanceof Wh?fa(e._def.innerType):[];class fS extends Fe{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==ie.object)return re(n,{code:H.invalid_type,expected:ie.object,received:n.parsedType}),Ce;const r=this.discriminator,i=n.data[r],o=this.optionsMap.get(i);return o?n.common.async?o._parseAsync({data:n.data,path:n.path,parent:n}):o._parseSync({data:n.data,path:n.path,parent:n}):(re(n,{code:H.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Ce)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const i=new Map;for(const o of n){const a=fa(o.shape[t]);if(!a.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const s of a){if(i.has(s))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(s)}`);i.set(s,o)}}return new fS({typeName:Se.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...Re(r)})}}function Tx(e,t){const n=Cs(e),r=Cs(t);if(e===t)return{valid:!0,data:e};if(n===ie.object&&r===ie.object){const i=Ne.objectKeys(t),o=Ne.objectKeys(e).filter(s=>i.indexOf(s)!==-1),a={...e,...t};for(const s of o){const c=Tx(e[s],t[s]);if(!c.valid)return{valid:!1};a[s]=c.data}return{valid:!0,data:a}}else if(n===ie.array&&r===ie.array){if(e.length!==t.length)return{valid:!1};const i=[];for(let o=0;o<e.length;o++){const a=e[o],s=t[o],c=Tx(a,s);if(!c.valid)return{valid:!1};i.push(c.data)}return{valid:!0,data:i}}else return n===ie.date&&r===ie.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class Bh extends Fe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=(o,a)=>{if(xx(o)||xx(a))return Ce;const s=Tx(o.value,a.value);return s.valid?((_x(o)||_x(a))&&n.dirty(),{status:n.value,value:s.data}):(re(r,{code:H.invalid_intersection_types}),Ce)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([o,a])=>i(o,a)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Bh.create=(e,t,n)=>new Bh({left:e,right:t,typeName:Se.ZodIntersection,...Re(n)});class Do extends Fe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ie.array)return re(r,{code:H.invalid_type,expected:ie.array,received:r.parsedType}),Ce;if(r.data.length<this._def.items.length)return re(r,{code:H.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ce;!this._def.rest&&r.data.length>this._def.items.length&&(re(r,{code:H.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const o=[...r.data].map((a,s)=>{const c=this._def.items[s]||this._def.rest;return c?c._parse(new Bo(r,a,r.path,s)):null}).filter(a=>!!a);return r.common.async?Promise.all(o).then(a=>Pn.mergeArray(n,a)):Pn.mergeArray(n,o)}get items(){return this._def.items}rest(t){return new Do({...this._def,rest:t})}}Do.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Do({items:e,typeName:Se.ZodTuple,rest:null,...Re(t)})};class Dh extends Fe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ie.object)return re(r,{code:H.invalid_type,expected:ie.object,received:r.parsedType}),Ce;const i=[],o=this._def.keyType,a=this._def.valueType;for(const s in r.data)i.push({key:o._parse(new Bo(r,s,r.path,s)),value:a._parse(new Bo(r,r.data[s],r.path,s)),alwaysSet:s in r.data});return r.common.async?Pn.mergeObjectAsync(n,i):Pn.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof Fe?new Dh({keyType:t,valueType:n,typeName:Se.ZodRecord,...Re(r)}):new Dh({keyType:Ki.create(),valueType:t,typeName:Se.ZodRecord,...Re(n)})}}class Kv extends Fe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ie.map)return re(r,{code:H.invalid_type,expected:ie.map,received:r.parsedType}),Ce;const i=this._def.keyType,o=this._def.valueType,a=[...r.data.entries()].map(([s,c],u)=>({key:i._parse(new Bo(r,s,r.path,[u,"key"])),value:o._parse(new Bo(r,c,r.path,[u,"value"]))}));if(r.common.async){const s=new Map;return Promise.resolve().then(async()=>{for(const c of a){const u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return Ce;(u.status==="dirty"||l.status==="dirty")&&n.dirty(),s.set(u.value,l.value)}return{status:n.value,value:s}})}else{const s=new Map;for(const c of a){const u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return Ce;(u.status==="dirty"||l.status==="dirty")&&n.dirty(),s.set(u.value,l.value)}return{status:n.value,value:s}}}}Kv.create=(e,t,n)=>new Kv({valueType:t,keyType:e,typeName:Se.ZodMap,...Re(n)});class Cu extends Fe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ie.set)return re(r,{code:H.invalid_type,expected:ie.set,received:r.parsedType}),Ce;const i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(re(r,{code:H.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),n.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&(re(r,{code:H.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const o=this._def.valueType;function a(c){const u=new Set;for(const l of c){if(l.status==="aborted")return Ce;l.status==="dirty"&&n.dirty(),u.add(l.value)}return{status:n.value,value:u}}const s=[...r.data.values()].map((c,u)=>o._parse(new Bo(r,c,r.path,u)));return r.common.async?Promise.all(s).then(c=>a(c)):a(s)}min(t,n){return new Cu({...this._def,minSize:{value:t,message:fe.toString(n)}})}max(t,n){return new Cu({...this._def,maxSize:{value:t,message:fe.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}Cu.create=(e,t)=>new Cu({valueType:e,minSize:null,maxSize:null,typeName:Se.ZodSet,...Re(t)});class dd extends Fe{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==ie.function)return re(n,{code:H.invalid_type,expected:ie.function,received:n.parsedType}),Ce;function r(s,c){return Uv({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,jv(),Od].filter(u=>!!u),issueData:{code:H.invalid_arguments,argumentsError:c}})}function i(s,c){return Uv({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,jv(),Od].filter(u=>!!u),issueData:{code:H.invalid_return_type,returnTypeError:c}})}const o={errorMap:n.common.contextualErrorMap},a=n.data;if(this._def.returns instanceof Fd){const s=this;return ir(async function(...c){const u=new zr([]),l=await s._def.args.parseAsync(c,o).catch(h=>{throw u.addIssue(r(c,h)),u}),d=await Reflect.apply(a,this,l);return await s._def.returns._def.type.parseAsync(d,o).catch(h=>{throw u.addIssue(i(d,h)),u})})}else{const s=this;return ir(function(...c){const u=s._def.args.safeParse(c,o);if(!u.success)throw new zr([r(c,u.error)]);const l=Reflect.apply(a,this,u.data),d=s._def.returns.safeParse(l,o);if(!d.success)throw new zr([i(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new dd({...this._def,args:Do.create(t).rest(Xc.create())})}returns(t){return new dd({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,r){return new dd({args:t||Do.create([]).rest(Xc.create()),returns:n||Xc.create(),typeName:Se.ZodFunction,...Re(r)})}}class jh extends Fe{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}jh.create=(e,t)=>new jh({getter:e,typeName:Se.ZodLazy,...Re(t)});class Uh extends Fe{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return re(n,{received:n.data,code:H.invalid_literal,expected:this._def.value}),Ce}return{status:"valid",value:t.data}}get value(){return this._def.value}}Uh.create=(e,t)=>new Uh({value:e,typeName:Se.ZodLiteral,...Re(t)});function MY(e,t){return new Ks({values:e,typeName:Se.ZodEnum,...Re(t)})}class Ks extends Fe{constructor(){super(...arguments),Op.set(this,void 0)}_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return re(n,{expected:Ne.joinValues(r),received:n.parsedType,code:H.invalid_type}),Ce}if(Pv(this,Op,"f")||RY(this,Op,new Set(this._def.values),"f"),!Pv(this,Op,"f").has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return re(n,{received:n.data,code:H.invalid_enum_value,options:r}),Ce}return ir(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return Ks.create(t,{...this._def,...n})}exclude(t,n=this._def){return Ks.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}Op=new WeakMap;Ks.create=MY;class Ph extends Fe{constructor(){super(...arguments),Mp.set(this,void 0)}_parse(t){const n=Ne.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==ie.string&&r.parsedType!==ie.number){const i=Ne.objectValues(n);return re(r,{expected:Ne.joinValues(i),received:r.parsedType,code:H.invalid_type}),Ce}if(Pv(this,Mp,"f")||RY(this,Mp,new Set(Ne.getValidEnumValues(this._def.values)),"f"),!Pv(this,Mp,"f").has(t.data)){const i=Ne.objectValues(n);return re(r,{received:r.data,code:H.invalid_enum_value,options:i}),Ce}return ir(t.data)}get enum(){return this._def.values}}Mp=new WeakMap;Ph.create=(e,t)=>new Ph({values:e,typeName:Se.ZodNativeEnum,...Re(t)});class Fd extends Fe{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==ie.promise&&n.common.async===!1)return re(n,{code:H.invalid_type,expected:ie.promise,received:n.parsedType}),Ce;const r=n.parsedType===ie.promise?n.data:Promise.resolve(n.data);return ir(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Fd.create=(e,t)=>new Fd({type:e,typeName:Se.ZodPromise,...Re(t)});class Gi extends Fe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Se.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=this._def.effect||null,o={addIssue:a=>{re(r,a),a.fatal?n.abort():n.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){const a=i.transform(r.data,o);if(r.common.async)return Promise.resolve(a).then(async s=>{if(n.value==="aborted")return Ce;const c=await this._def.schema._parseAsync({data:s,path:r.path,parent:r});return c.status==="aborted"?Ce:c.status==="dirty"||n.value==="dirty"?sd(c.value):c});{if(n.value==="aborted")return Ce;const s=this._def.schema._parseSync({data:a,path:r.path,parent:r});return s.status==="aborted"?Ce:s.status==="dirty"||n.value==="dirty"?sd(s.value):s}}if(i.type==="refinement"){const a=s=>{const c=i.refinement(s,o);if(r.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(r.common.async===!1){const s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?Ce:(s.status==="dirty"&&n.dirty(),a(s.value),{status:n.value,value:s.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>s.status==="aborted"?Ce:(s.status==="dirty"&&n.dirty(),a(s.value).then(()=>({status:n.value,value:s.value}))))}if(i.type==="transform")if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!$h(a))return a;const s=i.transform(a.value,o);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:s}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>$h(a)?Promise.resolve(i.transform(a.value,o)).then(s=>({status:n.value,value:s})):a);Ne.assertNever(i)}}Gi.create=(e,t,n)=>new Gi({schema:e,typeName:Se.ZodEffects,effect:t,...Re(n)});Gi.createWithPreprocess=(e,t,n)=>new Gi({schema:t,effect:{type:"preprocess",transform:e},typeName:Se.ZodEffects,...Re(n)});class Eo extends Fe{_parse(t){return this._getType(t)===ie.undefined?ir(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Eo.create=(e,t)=>new Eo({innerType:e,typeName:Se.ZodOptional,...Re(t)});class qs extends Fe{_parse(t){return this._getType(t)===ie.null?ir(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}qs.create=(e,t)=>new qs({innerType:e,typeName:Se.ZodNullable,...Re(t)});class Nh extends Fe{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===ie.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Nh.create=(e,t)=>new Nh({innerType:e,typeName:Se.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Re(t)});class Wh extends Fe{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return kh(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new zr(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new zr(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Wh.create=(e,t)=>new Wh({innerType:e,typeName:Se.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Re(t)});class qv extends Fe{_parse(t){if(this._getType(t)!==ie.nan){const r=this._getOrReturnCtx(t);return re(r,{code:H.invalid_type,expected:ie.nan,received:r.parsedType}),Ce}return{status:"valid",value:t.data}}}qv.create=e=>new qv({typeName:Se.ZodNaN,...Re(e)});const lNe=Symbol("zod_brand");class BF extends Fe{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class Xm extends Fe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?Ce:o.status==="dirty"?(n.dirty(),sd(o.value)):this._def.out._parseAsync({data:o.value,path:r.path,parent:r})})();{const i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?Ce:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(t,n){return new Xm({in:t,out:n,typeName:Se.ZodPipeline})}}class Kh extends Fe{_parse(t){const n=this._def.innerType._parse(t),r=i=>($h(i)&&(i.value=Object.freeze(i.value)),i);return kh(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}}Kh.create=(e,t)=>new Kh({innerType:e,typeName:Se.ZodReadonly,...Re(t)});function FY(e,t={},n){return e?Md.create().superRefine((r,i)=>{var o,a;if(!e(r)){const s=typeof t=="function"?t(r):typeof t=="string"?{message:t}:t,c=(a=(o=s.fatal)!==null&&o!==void 0?o:n)!==null&&a!==void 0?a:!0,u=typeof s=="string"?{message:s}:s;i.addIssue({code:"custom",...u,fatal:c})}}):Md.create()}const dNe={object:gt.lazycreate};var Se;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Se||(Se={}));const fNe=(e,t={message:`Input not instance of ${e.name}`})=>FY(n=>n instanceof e,t),Vc=Ki.create,Vv=Ns.create,pNe=qv.create,hNe=Ws.create,LY=Oh.create,ANe=Su.create,mNe=Nv.create,gNe=Mh.create,vNe=Fh.create,yNe=Md.create,bNe=Xc.create,SNe=xa.create,CNe=Wv.create,BY=Vi.create,zv=gt.create,wNe=gt.strictCreate,xNe=Lh.create,_Ne=fS.create,TNe=Bh.create,INe=Do.create,ENe=Dh.create,RNe=Kv.create,$Ne=Cu.create,kNe=dd.create,ONe=jh.create,MNe=Uh.create,FNe=Ks.create,LNe=Ph.create,BNe=Fd.create,oD=Gi.create,DNe=Eo.create,jNe=qs.create,UNe=Gi.createWithPreprocess,PNe=Xm.create,NNe=()=>Vc().optional(),WNe=()=>Vv().optional(),KNe=()=>LY().optional(),qNe={string:e=>Ki.create({...e,coerce:!0}),number:e=>Ns.create({...e,coerce:!0}),boolean:e=>Oh.create({...e,coerce:!0}),bigint:e=>Ws.create({...e,coerce:!0}),date:e=>Su.create({...e,coerce:!0})},VNe=Ce;var $=Object.freeze({__proto__:null,defaultErrorMap:Od,setErrorMap:QPe,getErrorMap:jv,makeIssue:Uv,EMPTY_PATH:HPe,addIssueToContext:re,ParseStatus:Pn,INVALID:Ce,DIRTY:sd,OK:ir,isAborted:xx,isDirty:_x,isValid:$h,isAsync:kh,get util(){return Ne},get objectUtil(){return wx},ZodParsedType:ie,getParsedType:Cs,ZodType:Fe,datetimeRegex:OY,ZodString:Ki,ZodNumber:Ns,ZodBigInt:Ws,ZodBoolean:Oh,ZodDate:Su,ZodSymbol:Nv,ZodUndefined:Mh,ZodNull:Fh,ZodAny:Md,ZodUnknown:Xc,ZodNever:xa,ZodVoid:Wv,ZodArray:Vi,ZodObject:gt,ZodUnion:Lh,ZodDiscriminatedUnion:fS,ZodIntersection:Bh,ZodTuple:Do,ZodRecord:Dh,ZodMap:Kv,ZodSet:Cu,ZodFunction:dd,ZodLazy:jh,ZodLiteral:Uh,ZodEnum:Ks,ZodNativeEnum:Ph,ZodPromise:Fd,ZodEffects:Gi,ZodTransformer:Gi,ZodOptional:Eo,ZodNullable:qs,ZodDefault:Nh,ZodCatch:Wh,ZodNaN:qv,BRAND:lNe,ZodBranded:BF,ZodPipeline:Xm,ZodReadonly:Kh,custom:FY,Schema:Fe,ZodSchema:Fe,late:dNe,get ZodFirstPartyTypeKind(){return Se},coerce:qNe,any:yNe,array:BY,bigint:hNe,boolean:LY,date:ANe,discriminatedUnion:_Ne,effect:oD,enum:FNe,function:kNe,instanceof:fNe,intersection:TNe,lazy:ONe,literal:MNe,map:RNe,nan:pNe,nativeEnum:LNe,never:SNe,null:vNe,nullable:jNe,number:Vv,object:zv,oboolean:KNe,onumber:WNe,optional:DNe,ostring:NNe,pipeline:PNe,preprocess:UNe,promise:BNe,record:ENe,set:$Ne,strictObject:wNe,string:Vc,symbol:mNe,transformer:oD,tuple:INe,undefined:gNe,union:xNe,unknown:bNe,void:CNe,NEVER:VNe,ZodIssueCode:H,quotelessJson:zPe,ZodError:zr});const mo="meta_title",oa="meta_description",zNe=$.object({[mo]:$.string(),[oa]:$.string()});async function DY(e){var o,a,s,c;const{pageTextContent:t,contentLocale:n,config:r}=e,i=new FUe({region:r.region,credentials:{accessKeyId:r.accessKeyId,secretAccessKey:r.secretAccessKey}});try{const u=new VPe({modelId:"anthropic.claude-3-5-sonnet-20240620-v1:0",system:[{text:QNe(n)}],messages:[{role:"user",content:[{text:`Input:
|
|
27
|
+
${t}`}]}]}),l=await i.send(u);return zNe.parse(JSON.parse(((c=(s=(a=(o=l.output)==null?void 0:o.message)==null?void 0:a.content)==null?void 0:s[0])==null?void 0:c.text)||""))}catch(u){throw console.error("Failed to generate SEO metadata",u),u}}const Ld={min:50,max:60},Bd={min:120,max:165};function QNe(e="en-us"){return`
|
|
4
28
|
You are an expert SEO specialist specializing in mobile-first optimization. Your task is to analyze the provided website content and generate a meta title and meta description optimized for mobile SEO. Follow these steps precisely:
|
|
5
29
|
|
|
6
30
|
1. Language Context:
|
|
@@ -13,12 +37,12 @@ ${t}`}]}]}),u=await i.send(c);return Lr.parse(JSON.parse(((d=(l=(a=(s=u.output)=
|
|
|
13
37
|
-For comparison content, do not focus solely on one of the entities or the conclusion—balance both the topic of the comparison and the outcome to provide clarity on what the page is addressing.
|
|
14
38
|
|
|
15
39
|
3.Meta Title Creation:
|
|
16
|
-
- Write a concise, compelling meta title, it must be near ${
|
|
40
|
+
- Write a concise, compelling meta title, it must be near ${Ld.min} characters. (never exceed this limit)
|
|
17
41
|
- Place the most important keyword(s) at the beginning.
|
|
18
42
|
- Ensure it is accurate, engaging, and click-worthy.
|
|
19
43
|
|
|
20
44
|
4. Meta Description Creation:
|
|
21
|
-
- Write a clear, informative meta description, it must be near ${
|
|
45
|
+
- Write a clear, informative meta description, it must be near ${Bd.min} characters. (never exceed this limit)
|
|
22
46
|
- Prioritize key information in the first sentence.
|
|
23
47
|
- Include primary keywords naturally, summarize the content, and use action-oriented language.
|
|
24
48
|
|
|
@@ -29,10 +53,77 @@ ${t}`}]}]}),u=await i.send(c);return Lr.parse(JSON.parse(((d=(l=(a=(s=u.output)=
|
|
|
29
53
|
- Do not reference or use any existing meta titles or descriptions already in the content. Be creative and generate unique meta information.
|
|
30
54
|
|
|
31
55
|
6. Output Requirements:
|
|
32
|
-
- Return the results in JSON format with only two keys: "${
|
|
56
|
+
- Return the results in JSON format with only two keys: "${mo}" and "${oa}".
|
|
33
57
|
- Do not include any additional text or explanations.
|
|
34
|
-
`}function
|
|
35
|
-
`)}function gt(e){if(K.isWidgetContent(e)){if(e.__TYPE__==="UIDContent")return e.value;if(e.__TYPE__==="StructuredTextContent"){const[t]=e.value;return!t||t.type==="image"||t.type==="embed"?void 0:t.content.text}if(e.__TYPE__==="FieldContent"&&e.type==="Text")return e.value}}function IA(e){return e.length>=300}const kr=p.z.object({id:p.z.string(),label:p.z.string(),repeatable:p.z.boolean(),status:p.z.boolean()});function Er(e,t,n){return U.request(new URL("customtypes",e),{headers:{repository:t},credentials:U.getRequestCredentials(n),okType:p.z.array(kr)})}function $e(e){const{baseUrl:t,repository:n,authStrategy:o}=e;return oe.queryOptions({queryKey:["customTypes"],queryFn:()=>Er(t,n,o)})}function Dr(e,t){e.prefetchQuery($e(t))}function Rr(e,t){return e.fetchQuery($e(t))}function un(e){return oe.useSuspenseQuery($e(e))}function Qr(e){const{id:t,baseUrl:n,repository:o,authStrategy:i}=e,a=un({baseUrl:n,repository:o,authStrategy:i}).data.find(l=>l.id===t);if(!a)throw new Error(`Custom type "${t}" does not exist`);return a}function Mr(e,t){return e.invalidateQueries($e(t))}function qr(e){const{id:t,baseUrl:n,repository:o,authStrategy:i}=e,s=new URL(`customtypes/${t}`,n);return s.searchParams.set("static","true"),U.request(s,{headers:{repository:o},credentials:U.getRequestCredentials(i),okType:Pr})}const Pr=p.z.unknown().transform((e,t)=>{const n=w.StaticCustomType.decode(e);return n._tag==="Right"?n.right:(t.addIssue({code:p.z.ZodIssueCode.custom,message:"Invalid custom type."}),p.z.NEVER)});function jA(e){const{id:t}=e;return oe.queryOptions({queryKey:["customTypes","static",t],queryFn:()=>qr(e)})}function Or(e){return oe.useSuspenseQuery(jA(e))}function Vr(e,t){e.prefetchQuery(jA(t))}const Yr=p.z.object({id:p.z.string().optional(),first_name:p.z.string().optional(),last_name:p.z.string().optional(),email:p.z.string().optional(),uploadedAvatar:p.z.string().optional()}),gn=p.z.object({id:p.z.string(),name:p.z.string(),is_master:p.z.boolean().optional()}).transform(e=>({id:e.id,label:e.name,...e.is_master!==void 0?{isMaster:e.is_master}:{}})),FA=p.z.discriminatedUnion("status",[p.z.object({status:p.z.literal("unclassified")}),p.z.object({status:p.z.literal("published")}),p.z.object({status:p.z.literal("release"),release_id:p.z.string()}),p.z.object({status:p.z.literal("archived")})]),SA=p.z.object({version_id:p.z.string(),tags:p.z.array(p.z.string()),preview_image:p.z.string().optional(),last_modified_date:p.z.coerce.date(),uid:p.z.string().optional()}),bA=FA.and(SA.extend({custom_type_label:p.z.string(),preview_summary:p.z.string().optional(),author:Yr})),KA=FA.and(SA.extend({custom_type_id:p.z.string().optional(),summary:p.z.string().optional(),author_ids:p.z.array(p.z.string()).optional(),highlights:p.z.object({uid:p.z.string().optional()}).optional()}));function UA(e){return bA.safeParse(e).success}function Wt(e){return KA.safeParse(e).success}const TA=p.z.string().nullish().transform(e=>e??"Untitled"),hn=p.z.object({id:p.z.string(),title:TA,custom_type_id:p.z.string(),group_lang_id:p.z.string(),language:gn,versions:p.z.array(bA)}),Wr=p.z.object({total:p.z.number(),cursor:p.z.string().optional(),results:p.z.array(hn)}),Hr=p.z.object({id:p.z.string(),title:TA,custom_type_id:p.z.string(),group_lang_id:p.z.string(),interesting_versions:p.z.array(KA),locale_id:p.z.string().optional()}).transform(e=>{const{interesting_versions:t,...n}=e;return{versions:t,...n}}),_r=p.z.object({results:p.z.array(Hr)});function pn(e){const{baseUrl:t,authStrategy:n,limit:o,cursor:i,statuses:s,authors:a,language:l,groupLangIds:d,documentIds:c,customTypes:u,tags:h,term:g,uids:m,signal:C}=e,y=new URL("documents/search",t),x=Ge.filterValues({statuses:s,authors:a,language:l,groupLangIds:d,customTypes:u,tags:h,term:g,documentIds:c,limit:o,cursor:i,uids:m},I=>!(I===""||Array.isArray(I)&&I.length===0));return U.request(y,{credentials:U.getRequestCredentials(n),okType:Wr,signal:C,method:"POST",body:x})}function wA(e,t,n,o){const i=new URL(e);return i.search=n,U.request(i,{credentials:U.getRequestCredentials(t),okType:_r,...o})}function LA(e){const{repository:t,searchTerm:n,tags:o,authors:i,status:s,localeId:a,customTypesIds:l}=e,d=new URLSearchParams;return d.append("repository",t),n&&d.append("searchTerm",n),o!=null&&o.length&&d.append("tags",o.toString()),i!=null&&i.length&&d.append("authors",i.toString()),s!=null&&s.length&&d.append("status",s.toString()),a&&d.append("localeId",a),l!=null&&l.length&&d.append("customTypesIds",l.toString()),d.toString()}function vA(e){return e.reduce((t,n)=>{if(n.values.every(i=>i===""||i===void 0))return t;const o=n.values.map(i=>[n.name,i??""]);return t.concat(o)},[])}function et(e,t,n){return U.request(new URL(`documents/${n}`,e),{credentials:U.getRequestCredentials(t),okType:hn})}const zr=p.z.custom().transform((e,t)=>{const n=K.Document.decode(e);return n._tag==="Left"?(t.addIssue({code:p.z.ZodIssueCode.custom,message:"Invalid document."}),p.z.NEVER):n.right}),Nr=p.z.unknown().transform((e,t)=>{const n=K.SliceItemContent.decode(e);return n._tag==="Right"?n.right:(t.addIssue({code:p.z.ZodIssueCode.custom,message:"Invalid slice content."}),p.z.NEVER)}),de={all:()=>["documents"],lists:()=>[...de.all(),"list"],list:e=>[...de.lists(),e],infiniteLists:()=>[...de.all(),"list:infinite"],infiniteList:e=>[...de.infiniteLists(),e]};function Gr(e,t){e.setQueriesData({queryKey:de.lists()},n=>n&&Mn(n,t)),e.setQueriesData({queryKey:de.infiniteLists()},n=>n&&{...n,pages:n.pages.map(o=>Mn(o,t))})}function Mn(e,t){const n=e.results.flatMap(o=>{const i=t(o,e);return i?[i]:[]});return{...e,results:n,total:e.total+(n.length-e.results.length)}}async function Zr(e){await e.invalidateQueries({queryKey:de.lists()}),await e.invalidateQueries({queryKey:de.infiniteLists()})}function mn(e){return oe.useSuspenseQuery(kA(e))}function kA(e){return oe.queryOptions({queryKey:de.list(e),queryFn:({queryKey:[,,t]})=>pn(t)})}async function EA(e){const{coreApiBaseUrl:t,documentSearchBaseUrl:n,authStrategy:o,repository:i,searchTerm:s="",customTypes:a,tags:l,authors:d,status:c,locale:u,signal:h,storageVersion:g}=e;if(g&&g.major<=6){const I=c!=null&&c.length?c:["published","unclassified","release"];return{results:(await pn({baseUrl:t,authStrategy:o,tags:l,customTypes:a,language:u,term:s,authors:d,statuses:I,limit:200})).results}}const m=LA({repository:i,searchTerm:s,tags:l,authors:d,status:c,localeId:u,customTypesIds:a});return{results:(await wA(n,o,m,{signal:h})).results}}function DA(e){const{searchTerm:t,customTypes:n,tags:o,authors:i,status:s,locale:a,config:l,storageVersion:d}=e;l.searchDocuments||V("searchDocuments");const{coreApiBaseUrl:c,documentSearchBaseUrl:u,authStrategy:h,repository:g}=l;return oe.queryOptions({queryKey:["searchDocuments",{coreApiBaseUrl:c,documentSearchBaseUrl:u,authStrategy:h,repository:g,searchTerm:t,customTypes:n,tags:o,authors:i,status:s,locale:a,storageVersion:d}],queryFn:({queryKey:[,m],signal:C})=>EA({...m,signal:C})})}const Jr=p.z.object({id:p.z.string(),firstname:p.z.string().optional(),lastname:p.z.string().optional(),email:p.z.string(),uploadedAvatar:p.z.string().optional()}),RA=p.z.array(Jr),Xr=p.z.object({slicemachineEnabled:p.z.boolean()}),QA=["next","nuxt","sveltekit"];function $r(e){return QA.includes(e)}const Ft=p.z.preprocess(e=>typeof e=="string"&&$r(e)?e:"other",p.z.enum([...QA,"other"])),es=p.z.object({simulator_url:p.z.string().url().nullish(),languages:p.z.array(gn).transform(e=>O.sort(e,t=>t.label)),authors:RA.optional().default([]),quotas:Xr.optional().default({slicemachineEnabled:!1}),framework:Ft.optional().default("other"),starterId:p.z.string().optional(),storageVersion:p.z.object({major:p.z.number().int(),minor:p.z.number().int()}),uploadedAvatar:p.z.string().url().optional()}).transform(({simulator_url:e,framework:t,...n})=>{const o=e&&MA(e)?e:void 0;return{...n,framework:t,simulatorUrl:o,isSupportedFramework:t!=="other"}});function St(e,t){return U.request(new URL("repository",e),{credentials:U.getRequestCredentials(t),okType:es})}function MA(e){const t=te.toURL(e);return t?t.pathname.endsWith("/slice-simulator"):!1}const ts=p.z.object({results:p.z.array(p.z.string())});function qA(e,t){return U.request(new URL("repository/tags",e),{credentials:U.getRequestCredentials(t),okType:ts})}const ns=p.z.object({maxNbEnvironments:p.z.number(),integrationFieldsEnabled:p.z.boolean(),personalEnvironmentsEnabled:p.z.boolean(),sliceMachineEnabled:p.z.boolean()}),PA=p.z.object({_id:p.z.string(),name:p.z.string(),onboarding:p.z.object({completedSteps:p.z.array(p.z.string()),isDismissed:p.z.boolean()}),framework:Ft.optional().default("other"),quotas:ns.optional().default({maxNbEnvironments:0,integrationFieldsEnabled:!1,personalEnvironmentsEnabled:!1,sliceMachineEnabled:!1}),storageVersion:p.z.object({major:p.z.number().int(),minor:p.z.number().int()}),authors:RA.optional().default([])});function As(e,t,n){const o=new URL("",e);return o.searchParams.append("repository",t),U.request(o,{headers:{repository:t},credentials:U.getRequestCredentials(n),okType:PA})}const os=p.z.enum(["createPrismicProject","chooseLocale","createProject","setupSliceMachine","createPageType","codePage","createSlice","reviewAndPush","createContent","renderPage"]),OA=p.z.object({completedSteps:p.z.array(p.z.string()),isDismissed:p.z.boolean(),context:p.z.object({framework:Ft,starterId:p.z.string().nullable().optional()})}),VA=p.z.object({completedSteps:p.z.array(p.z.string())}),YA=p.z.object({isDismissed:p.z.boolean()});function is(e,t,n){const o=new URL("onboarding",e);return o.searchParams.append("repository",t),U.request(o,{headers:{repository:t},credentials:U.getRequestCredentials(n),okType:OA})}function rs(e,t,n,o){const i=new URL(`onboarding/${e}/toggle`,t);return i.searchParams.append("repository",n),U.request(i,{method:"PATCH",headers:{repository:n},credentials:U.getRequestCredentials(o),okType:VA})}function ss(e,t,n){const o=new URL("onboarding/toggle",e);return o.searchParams.append("repository",t),U.request(o,{method:"PATCH",headers:{repository:t},credentials:U.getRequestCredentials(n),okType:YA})}const WA=p.z.string(),HA=p.z.enum(["Manager","Writer","Readonly"]),bt=p.z.record(WA,HA),fn=p.z.record(p.z.string(),bt),Kt=p.z.object({id:p.z.string(),name:p.z.string(),customTypes:p.z.array(p.z.string()),rolesPerLocale:bt.optional(),rolesPerLocaleByUser:fn.optional()});p.z.object({name:p.z.string(),customTypes:p.z.array(p.z.string()),rolesPerLocale:bt.optional(),rolesPerLocaleByUser:fn.optional()});const as=p.z.object({results:p.z.array(Kt)});function _A(e){const{baseUrl:t,repository:n,authStrategy:o}=e,i=new URL("team-spaces",t);return i.searchParams.append("repository",n),U.request(i,{method:"GET",credentials:U.getRequestCredentials(o),okType:as})}function ls(e){return oe.queryOptions({queryKey:["teamSpaces",e],queryFn:()=>_A(e),select:t=>t.results})}function cs(){const e=oe.useQueryClient();return()=>e.invalidateQueries({queryKey:["teamSpaces"]})}function ds(e){const{baseUrl:t,repository:n,authStrategy:o,payload:i}=e,s=new URL("team-spaces",t);return s.searchParams.append("repository",n),U.request(s,{method:"POST",body:i,credentials:U.getRequestCredentials(o),okType:Kt})}function us(e){const{baseUrl:t,repository:n,authStrategy:o,payload:i,teamSpaceId:s}=e,a=new URL(`team-spaces/${s}`,t);return a.searchParams.append("repository",n),U.request(a,{method:"PUT",body:i,credentials:U.getRequestCredentials(o),okType:Kt})}function gs(e){const{baseUrl:t,repository:n,authStrategy:o,teamSpaceId:i}=e,s=new URL(`team-spaces/${i}`,t);return s.searchParams.append("repository",n),U.request(s,{method:"DELETE",credentials:U.getRequestCredentials(o),okType:p.z.unknown()})}const zA=p.z.enum(["Owner","Administrator","Writer","Manager","Readonly"]),hs=p.z.record(zA.optional()),ps=zA.or(hs),ms={SuperUser:"SuperUser",Owner:"Owner",Administrator:"Administrator",Manager:"Publisher",Writer:"Writer",Readonly:"Contributor"},NA=p.z.object({shortId:p.z.string(),intercomHash:p.z.string(),email:p.z.string(),firstName:p.z.string(),lastName:p.z.string(),superPower:p.z.boolean(),repositories:p.z.array(p.z.object({domain:p.z.string(),name:p.z.string().optional(),role:ps}))});async function GA(e,t){const n=new URL("profile",e);return await U.request(n,{credentials:U.getRequestCredentials(t),okType:NA})}function Cn(){const e=L();e.userServiceBaseUrl||V("userServiceBaseUrl");const{authStrategy:t,userServiceBaseUrl:n}=e;return R.useRequest(GA,[n,t])}const fs="https://prismic.io/docs/guides/manage-images#supported-media";function tt(){const e=L();e.mediaLibrary||V("mediaLibrary");const{assetsApiBaseUrl:t,authStrategy:n,repository:o}=e,{items:i}=R.useRequest(ZA,[t,o,n]);return{tags:i}}function ZA(e,t,n){return U.request(new URL("tags",e),{credentials:U.getRequestCredentials(n),okType:Cs,headers:{repository:t}})}const JA=1,XA=20,xn=p.z.string().min(JA).max(XA),yn=p.z.object({id:p.z.string(),name:xn,uploader_id:p.z.string().optional(),created_at:p.z.number(),last_modified:p.z.number(),count:p.z.number().optional().default(0)}),Cs=p.z.object({items:p.z.array(yn)});function nt(e){R.updateFetcherData(ZA,t=>{const{items:n}=t,o=e(n);if(o)return{items:o}})}function xs(e){const{assetType:t,keyword:n,mode:o,tagIds:i}=e,s=L();s.mediaLibrary||V("mediaLibrary");const{onAnalyticsEvent:a}=s,l=R.useFetcherData(ie),d=l[l.length-1],c=f.useRef(d);c.current=d,f.useEffect(()=>{if(!a||!n||!c.current||c.current.keyword!==n)return;const u=String(n.split(" ").length),h=String(c.current.total),g=i.join(",");a("Media Library Search",{searchQuery:n,numberOfWords:u,numberOfResults:h,timeToGetResults:c.current.time,assetType:t,mode:o,tags:g})},[n,t,o,a,i])}function ys(e){const{assetType:t,mediaDialogOpen:n}=e,o=L(),i=R.useFetcherData(ie),s=f.useRef(0);f.useEffect(()=>{n&&(s.current=performance.now())},[n]);function a(l){if(!o.onAnalyticsEvent||!o.mediaLibrary)return;const d=i[i.length-1];if(!d)return;const{keyword:c,uploaderId:u,tags:h}=d,g=to(i,c,t,u,h),m=String(c.split(" ").length),C=String(d.total),y=g.findIndex(j=>j.id===l),x=String(y+1),I=[l].join(","),B=(performance.now()-s.current).toFixed(0);o.onAnalyticsEvent("Media Added To Page",{assetType:t,searchQuery:c,numberOfWords:m,numberOfResults:C,searchPosition:x,mediaIds:I,timeToAddMediaToPage:B,tags:h})}return a}const rt=p.z.array(p.z.string()).optional().transform(e=>e==null?void 0:e[0]),Ut=p.z.object({id:p.z.string(),kind:p.z.string(),extension:p.z.string().optional(),filename:p.z.string(),width:p.z.number().optional(),height:p.z.number().optional(),last_modified:p.z.number(),url:p.z.string(),alt:p.z.string().optional(),uploader_id:p.z.string().optional(),size:p.z.number(),notes:p.z.string().optional(),credits:p.z.string().optional(),search_highlight:p.z.object({filename:rt,alt:rt,notes:rt,credits:rt}).optional(),tags:p.z.array(yn)}),$A={"X-Prismic-Source":"Wroom"},Bs=p.z.object({total:p.z.number(),cursor:p.z.string().optional(),items:p.z.array(Ut)}),eo=30;function ie(e,t,n,o,i,s,a,l,d){const c=e?new URL("assets",e):void 0,u=new URLSearchParams(vA([{name:"limit",values:[`${eo}`]},{name:"cursor",values:[d]},{name:"keyword",values:[o]},{name:"assetType",values:[i]},{name:"uploaderId",values:[s]},{name:"tags",values:a.split(",")}])).toString(),h=Bs.transform(m=>({...m,keyword:o,assetType:i,uploaderId:s,tags:a,page:l})),g=performance.now();return U.request(`${(c==null?void 0:c.href)??""}?${u}`,{headers:{repository:t,...$A},credentials:U.getRequestCredentials(n),okType:h}).then(m=>({...m,time:(performance.now()-g).toFixed(0)}))}R.cache.registerFetcherConfig(ie,{revalidationStrategy:{type:"never"}});const G={keyword:"",assetType:"all",uploaderId:void 0,tagIds:[]};function Is(e){const{initialAssetType:t=G.assetType,mode:n}=e,o=L(),[i,s]=f.useState({...G,assetType:t,page:0});o.mediaLibrary||V("mediaLibrary");const{assetsApiBaseUrl:a,authStrategy:l,repository:d}=o,{page:c,cursor:u,keyword:h,assetType:g,uploaderId:m,tagIds:C}=i,y=R.useRequest(ie,Xe({assetsApiBaseUrl:a,authStrategy:l,repository:d,keyword:h,assetType:g,uploaderId:m,tagIds:C,page:c,cursor:u}));xs({assetType:g,keyword:h,tagIds:C,mode:n});const x=bs(h,g,m,C),I=y.total!==x.length;function B(){y.cursor!==void 0&&s(v=>({...v,page:v.page+1,cursor:y.cursor}))}function j(v){s(F=>({...F,page:0,cursor:void 0})),Le((F,T)=>{if(T.page===0)return[...v,...F]})}function S(v){s(F=>({...F,...v,page:0,cursor:void 0}))}function b(){s(v=>({...v,...G,assetType:t==="all"?G.assetType:v.assetType,page:0,cursor:void 0}))}return{keyword:h,assetType:g,uploaderId:m,tagIds:C,setFilters:S,resetFilters:b,media:x,mediaTotal:y.total,limit:eo,hasNextPage:I,fetchNextPage:B,updateMedia:js,unshiftMedia:j,deleteMedia:Fs,deleteSearchData:Ss,revalidateFirstPage:no}}function js(e){Le(t=>t.flatMap(n=>{const o=e.find(i=>i.id===n.id);return o?o.response===void 0?[]:{...n,...o.response}:n}))}function Fs(e){Le(t=>t.filter(n=>!e.includes(n.id)))}function Ss(e){const{keyword:t,assetType:n,uploaderId:o,tagIds:i}=e,s=i==null?void 0:i.join(",");R.updateFetcherData(ie,a=>{if(!(a.keyword===t&&a.assetType===n&&a.uploaderId===o&&a.tags===s))return a})}function to(e,t,n,o,i){const s=e.filter(d=>d.keyword===t&&d.assetType===n&&d.uploaderId===o&&d.tags===i),l=O.sort(s,d=>d.page).flatMap(d=>d.items);return t?O.uniqBy(l,d=>d.id):l}function bs(e,t,n,o){const i=R.useFetcherData(ie);return to(i,e,t,n,o.join(","))}function Le(e){R.updateFetcherData(ie,t=>{const{items:n,total:o}=t,i=e(n,t);if(i)return{...t,total:o+(i.length-n.length),items:i}})}function no(e){const{config:t,keyword:n=G.keyword,assetType:o=G.assetType,tagIds:i=G.tagIds}=e;if(!t.mediaLibrary)throw new Error("media library is not configured");const{assetsApiBaseUrl:s,authStrategy:a,repository:l}=t;R.revalidateData(ie,Xe({assetsApiBaseUrl:s,repository:l,authStrategy:a,keyword:n,assetType:o,tagIds:i,page:0}))}function Ao(e){const{config:t,keyword:n=G.keyword,assetType:o=G.assetType,tagIds:i=G.tagIds}=e;if(!t.mediaLibrary)throw new Error("media library is not configured");R.updateFetcherData(ie,s=>s.page===0?s:void 0),no({config:t,keyword:n,assetType:o,tagIds:i})}function Xe(e){return[e.assetsApiBaseUrl,e.repository,e.authStrategy,e.keyword,e.assetType,e.uploaderId,e.tagIds.join(","),e.page,e.cursor]}function oo(){const e=L();e.mediaLibrary||V("mediaLibrary");const{assetsApiBaseUrl:t,coreApiBaseUrl:n,authStrategy:o,repository:i}=e,{authors:s}=R.useRequest(St,[n,o]),{items:a}=R.useRequest(io,[t,i,o]),{shortId:l}=Cn(),d=new Map(s.map(h=>[h.id,h])),c=[];for(const h of a){if(h.id==="ghost"){c.push({id:h.id,name:"Ghost",uploadedAvatar:"https://images.prismic.io/page-builder-assets/ZuAXWBoQrfVKl5sD_ghost_user.png?auto=format,compress&w=64"});continue}const g=d.get(h.id);if(!g)continue;let m;if(g.uploadedAvatar){const C=new URL(g.uploadedAvatar);C.searchParams.set("w","64"),m=C.toString()}c.push({id:h.id,name:[g.firstname,g.lastname].filter(Boolean).join(" "),firstName:g.firstname,lastName:g.lastname,email:g.email,uploadedAvatar:m})}const u=new Map(c.map(h=>[h.id,h]));return{uploaders:O.sort(c,h=>h.id===l?0:1,h=>h.name),uploadersById:u}}function io(e,t,n){return U.request(new URL("uploaders",e),{credentials:U.getRequestCredentials(n),okType:Us,headers:{repository:t}})}const Ks=p.z.object({id:p.z.string()}),Us=p.z.object({items:p.z.array(Ks)});function ro(){const e=L();e.mediaLibrary||V("mediaLibrary");const{assetsApiBaseUrl:t,authStrategy:n,repository:o}=e;return()=>{R.revalidateData(io,[t,o,n])}}function Ts(e){const{revalidate:t,config:n,keyword:o,assetType:i,uploaderId:s,tagIds:a}=e,{assetsApiBaseUrl:l=void 0,repository:d="",authStrategy:c="token"}=n.mediaLibrary?n:{},[u,h]=f.useState(!1),[g,m]=f.useState(!1),C={assetsApiBaseUrl:l,repository:d,authStrategy:c,keyword:o,assetType:i,uploaderId:s,tagIds:a,page:0},{revalidateData:y}=R.useCacheRevalidation({fetcher:ie,requestParams:Xe(C),validator:(B,j)=>{var v,F;const S=((v=B.items[0])==null?void 0:v.id)??"",b=((F=j.items[0])==null?void 0:F.id)??"";return S!==b||B.total!==(j==null?void 0:j.total)},onCacheInvalidated:()=>m(!0),every:6e4}),x=B=>{y(Xe({...C,...B}))};f.useEffect(()=>{u&&(m(!1),h(!1))},[u]);function I(){h(!0),t()}return{isMediaRevalidationInProgress:u,isMediaCacheInvalid:g,revalidateMedia:I,revalidateWithParams:x}}function ws(e){const{onBeforeUpload:t,onComplete:n}=e,[o,i]=f.useState([]),s=o.some(u=>u.status==="idle"||u.status==="uploading"),a=L();function l(){if(!o.length||o.some(m=>m.status==="uploading")||o.every(m=>m.status==="error"))return;const u=o.find(m=>m.status==="idle");if(!u)return;let h=o;function g(m){h=m(h),i(h),h.every(y=>y.status==="success"||y.status==="error")&&setTimeout(()=>{i([]),n==null||n(h)},1500)}g(m=>m.map(C=>C.id===u.id?{...C,status:"uploading"}:C)),so({file:u.file,config:a}).then(m=>{g(C=>C.map(y=>y.id===u.id?{...y,status:"success",response:m}:y))}).catch(()=>{g(m=>m.map(C=>C.id===u.id?{...C,status:"error"}:C))})}function d(u){const h=u.map(g=>({id:`temp-${crypto.randomUUID()}`,file:g,status:"idle"}));i(h),t(h)}const c=f.useCallback(u=>{const h=[{...u,status:"idle"},...o.filter(g=>g.id!==u.id)];i(h),t(h)},[t,o]);return f.useEffect(l,[a,o,n]),{isUploading:s,uploadingFiles:o,onFilesSelected:d,onRetry:c}}async function so(e){const{file:t,config:n}=e;if(!n.mediaLibrary)throw new Error("Media Library not configured.");const{assetsApiBaseUrl:o,repository:i,authStrategy:s}=n,a=new FormData;return a.append(t.name,t),U.request(new URL("assets",o),{headers:{repository:i,"Content-Type":"multipart/form-data",...$A},method:"POST",body:a,credentials:U.getRequestCredentials(s),okType:Ut})}const ao=f.createContext(void 0);function Ls(e){const{children:t,assetType:n=G.assetType,onSelectedChange:o,actionContainer:i}=e,s=o?"select":"browse",[a,l]=f.useTransition(),[d,c]=f.useTransition(),u=L(),{showAlert:h}=r.useAlert(),g=Cn(),m=ro(),{keyword:C,assetType:y,uploaderId:x,tagIds:I,setFilters:B,resetFilters:j,media:S,fetchNextPage:b,hasNextPage:v,updateMedia:F,unshiftMedia:T,deleteMedia:k,mediaTotal:M,deleteSearchData:_,revalidateFirstPage:ge}=Is({initialAssetType:n,mode:s}),[he,Qe]=f.useState();function Me(){Ao({config:u,keyword:C,assetType:y,uploaderId:x,tagIds:I})}const{isMediaRevalidationInProgress:D,isMediaCacheInvalid:Q,revalidateMedia:z,revalidateWithParams:pe}=Ts({config:u,revalidate:Me,keyword:C,assetType:y,uploaderId:x,tagIds:I});function ot(q){const N=q.keyword===G.keyword,re=q.assetType===n,$=q.uploaderId===G.uploaderId,me=q.tagIds.length===G.tagIds.length&&q.tagIds.every((Ni,Gi)=>Ni===G.tagIds[Gi]);return N&&re&&$&&me}function H(q){const N={keyword:C,assetType:y,tagIds:I,uploaderId:x,...q};ot(N)?pe(q):_(N),c(()=>{B(q),it.clearSelection()})}const{isUploading:qe,onFilesSelected:Oi,uploadingFiles:kn,onRetry:Vi}=ws({onBeforeUpload:q=>{j();const N=q.filter($=>$.status==="idle").map($=>({id:$.id,url:URL.createObjectURL($.file),filename:$.file.name,size:$.file.size,extension:$.file.type,kind:$.file.type,last_modified:$.file.lastModified,tags:[],uploader_id:g.shortId}));T(N);const[re]=N??[];re&&it.toggleSelection({id:re.id,isSingleSelection:!0})},onComplete:q=>{const N=q.flatMap(me=>me.status==="success"?me:(_i(me),{id:me.id,response:void 0}));F(N),ge({config:u,assetType:y,tagIds:I}),m();const re=N[0];!re||!re.response||!it.isSelected(re.id)||it.toggleSelection({id:re.response.id,isSingleSelection:!0})}}),it=je({totalItemCount:M,onChangeSelection:({selectedIds:q,selectedCount:N})=>{if(En(!1),!!o){if(N===1){const[re]=[...q];if(kn.some(me=>me.id===re&&me.status!=="success")){o(new Set);return}}o(new Set(q))}}});function Yi(q){qe||Oi(q)}function Wi(){v&&l(b)}function Hi(q,N){F([{id:q,response:N}])}function _i(q){const N=Ae.overflow(q.file.name,30);h({id:q.id,title:`The specified file "${N}" could not be uploaded.`,subtitle:A.jsxs(r.Text,{color:"inherit",children:["Read more about our"," ",A.jsx(r.Text,{color:"tomato11",href:fs,underline:!0,children:"supported media"}),"."]}),buttons:{action:{text:"Retry upload",icon:"cloudUpload",onClick:()=>Vi(q)}}})}const[zi,En]=f.useState(!1);return A.jsx(ao.Provider,{value:{isFetchingMedia:a,media:S,mediaTotal:M,onScrollToBottom:Wi,actionContainer:i,onFilesUpload:Yi,isUploading:qe,uploadingFiles:kn,isMediaRevalidationInProgress:D,isMediaCacheInvalid:Q,revalidateMedia:z,deleteMedia:k,updateMedia:Hi,keyword:C,isSearchingMedia:d,assetType:y,initialAssetType:n,uploaderId:x,tagManagerOpen:zi,setTagManagerOpen:En,tagIds:I,onFilterChange:H,openMediaSection:he,setOpenMediaSection:Qe},children:t})}function P(){const e=f.useContext(ao);if(!e)throw new Error("useMediaLibrary must be used within a MediaLibraryProvider");return e}function vs(){const e=L(),{initialAssetType:t}=P(),{assetsApiBaseUrl:n=void 0,repository:o="",authStrategy:i="token"}=e.mediaLibrary?e:{},{total:s}=R.useRequest(ie,Xe({assetsApiBaseUrl:n,authStrategy:i,repository:o,assetType:t,keyword:"",tagIds:[],page:0}));return s}function lo(){return vs()===0}function ks(){return lo()?A.jsx(Es,{}):A.jsx(uo,{})}function co(e){const{children:t}=e;return A.jsx(r.Box,{justifyContent:"center",flexDirection:"column",height:"100%",children:t})}function uo(){return A.jsx(co,{children:A.jsxs(r.BlankSlate,{children:[A.jsx(r.BlankSlateIcon,{name:"close",lineColor:"purple10",backgroundColor:"purple3",borderColor:"purple6",borderStyle:"dashed",size:"xlarge"}),A.jsx(r.BlankSlateTitle,{size:"big",children:"Oops!"}),A.jsx(r.BlankSlateDescription,{width:360,children:"No items found matching your search"})]})})}function Es(){const{onFilesUpload:e}=P();return A.jsx(co,{children:A.jsxs(r.Box,{gap:20,flexDirection:"column",alignItems:"center",children:[A.jsx(r.Box,{maxWidth:375,children:A.jsx(r.BlankSlateTitle,{size:"big",children:"Start by uploading your files!"})}),A.jsx(r.Box,{border:!0,borderStyle:"dashed",borderRadius:4,justifyContent:"center",children:A.jsxs(r.BlankSlate,{sx:{marginBlock:80,marginInline:48},children:[A.jsx(r.BlankSlateIcon,{name:"cloudUpload",lineColor:"purple11",backgroundColor:"purple5",size:"large"}),A.jsx(r.BlankSlateTitle,{children:"Drop your files anywhere to upload or ..."}),A.jsx(r.FileUploadButton,{onFilesSelected:e,renderButton:t=>A.jsx(r.Box,{display:"inline-flex",as:"span",children:A.jsx(r.Button,{onClick:t,color:"grey",children:"Upload media"})})}),A.jsx(r.BlankSlateDescription,{children:"Maximum upload size file: 128 MB"})]})})]})})}const ze={warning:{uploadWhileUploading:{title:"Hang tight!",description:"Your current images are still being uploaded. Once they're all set, you'll be free to upload more."}}};function Ds(){const{actionContainer:e,isUploading:t,onFilesUpload:n,assetType:o}=P();return A.jsx(go,{actionContainer:e,children:A.jsxs(r.Box,{width:"100%",gap:16,children:[A.jsx(Rs,{}),A.jsx(r.Tooltip,{title:ze.warning.uploadWhileUploading.title,content:ze.warning.uploadWhileUploading.description,visible:t,stableMount:!0,children:A.jsx(r.FileUploadButton,{disabled:t,onFilesSelected:n,startIcon:"cloudUpload",color:e?"purple":"grey",size:"large",assetType:o,children:"Upload media"})})]})})}function Rs(){const{keyword:e,onFilterChange:t,isFetchingMedia:n}=P(),[o,i]=f.useState(e);return E.useOnChange(e,()=>{e===""&&i("")}),E.useDebounce(o,300,E.useStableCallback(s=>t({keyword:s}))),A.jsx(r.Box,{width:"100%",flexDirection:"column",children:A.jsx(r.FormSearchInput,{value:o,placeholder:"Search",onValueChange:i,maxLength:200,isLoading:n&&e!==o})})}function go(e){const{children:t,actionContainer:n}=e;return n?A.jsx(r.Portal,{container:n,asChild:!0,children:t}):A.jsx(A.Fragment,{children:t})}function Qs(e){const{children:t}=e,{onFilesUpload:n,assetType:o}=P();return A.jsx(r.FileDropZone,{overlay:A.jsx(Ms,{}),onFilesSelected:n,assetType:o,children:t})}function Ms(){const{isUploading:e}=P(),t=e?ze.warning.uploadWhileUploading.title:"Drop files here",n=e?ze.warning.uploadWhileUploading.description:"Drop your files to upload them instantly to the media library.";return A.jsx(r.Box,{justifyContent:"center",flexDirection:"column",height:"100%",children:A.jsxs(r.BlankSlate,{children:[A.jsx(r.BlankSlateIcon,{name:e?"block":"cloudUpload",lineColor:e?"tomato11":"purple10",backgroundColor:e?"tomato2":"purple3",borderColor:e?"tomato6":"purple6",borderStyle:"dashed",size:"xlarge"}),A.jsx(r.BlankSlateTitle,{size:"big",children:t}),A.jsx(r.BlankSlateDescription,{width:360,children:n})]})})}function ho(){return A.jsx(r.DefaultErrorMessage,{title:"Oops! Something went wrong",description:"An error occurred while searching for your image.",errorImageSrc:r.dialogErrorImage,sx:{marginBlock:"auto",marginInline:"auto"}})}function po(e){const{mediaList:t,mediaActions:n,mediaToolbar:o,sidePane:i}=e,s=r.useMediaQuery({min:"medium"}),a=i&&s;return A.jsxs(r.Box,{display:"grid",gridTemplateRows:"auto auto 1fr",gridTemplateColumns:a?"1fr 380px":"1fr",width:"100%",height:"100%",children:[A.jsxs(r.Box,{position:"relative",display:"grid",gap:16,gridColumn:"1",gridRow:"1",padding:{right:16,bottom:16},children:[n,o]}),A.jsx(r.Box,{position:"relative",display:"grid",gridColumn:"1",gridRow:"2 / -1",children:t}),a&&i]})}function qs(){var g;const{onScrollToBottom:e,media:t,isUploading:n,uploadingFiles:o,isSearchingMedia:i,isMediaRevalidationInProgress:s,setOpenMediaSection:a,isFetchingMedia:l}=P(),d=je(),c=f.useRef(null);function u(m){d.toggleSelection({id:m,isSingleSelection:!0}),a("tags")}(n||i||s)&&((g=c.current)==null||g.scrollTo({top:0,behavior:"instant"}));function h(m,C,y){const x=C.shiftKey?t.map(({id:I})=>I):void 0;d.toggleSelection({id:m,isSingleSelection:y==="single",metaKey:C.metaKey,shiftKey:C.shiftKey,ids:x})}return A.jsxs(mo,{onScrollToBottom:e,scrollAreaRef:c,children:[t.map(m=>{var C,y;return A.jsx(r.MediaCard,{"aria-label":"media item",...m,filenameHighlight:(C=m.search_highlight)==null?void 0:C.filename,loading:i,status:(y=o.find(x=>x.id===m.id))==null?void 0:y.status,selected:d.isSelected(m.id),onCardClick:x=>h(m.id,x,"single"),onCheckedChange:(x,I)=>h(m.id,I,"multi"),onAddTagClick:()=>u(m.id)},m.id)}),A.jsx(r.Box,{gridColumn:"1 / -1",justifyContent:"center",children:A.jsx(r.AnimatedElement,{animation:{name:"fade"},children:l&&A.jsx(r.Text,{align:"center",color:"grey11",sx:{marginBlock:8},children:"Loading more items ..."})})})]})}function mo(e){const{children:t,scrollAreaRef:n,onScrollToBottom:o}=e,i=16,s=4,a="250px",l=`calc((100% - ${i*(s-1)}px) / ${s})`;return A.jsx(r.ScrollArea,{"aria-label":"Media list",ref:n,style:{display:"grid",gridTemplateColumns:`repeat(auto-fill, minmax(max(${a}, ${l}), 1fr))`,gridTemplateRows:"1fr 1fr 1fr ",gap:i,padding:2,paddingBottom:16,position:"relative"},onScrollToBottom:o,threshold:500,children:t})}function fo(e){const{children:t,hasSelectedMedia:n}=e;return A.jsx(r.Box,{overflow:"hidden",gridColumn:"2 / -1",gridRow:"1 / -1",children:A.jsx(r.ScrollArea,{style:{display:"grid",height:"100%"},children:A.jsx(r.Box,{flexGrow:1,borderRadius:{topRight:8,topLeft:8},borderStyle:n?"solid":"dashed",border:{top:!0,right:!0,left:!0,bottom:!1},minWidth:0,children:t})})})}function Co(e){const{onFilesUpload:t,isUploading:n,isInitialLoad:o=!1}=e,i=o||n;return A.jsxs(r.Box,{flexDirection:"column",justifyContent:"center",alignItems:"center",padding:16,gap:16,width:"100%",children:[A.jsx(r.BlankSlateIcon,{name:"cloudUpload",lineColor:"purple11",backgroundColor:"purple5",size:"large"}),A.jsx(r.Box,{flexDirection:"column",gap:4,children:A.jsxs(r.Text,{align:"center",children:["Select or"," ",A.jsx(r.FileUploadButton,{disabled:i,onFilesSelected:t,renderButton:s=>A.jsx(r.Tooltip,{title:ze.warning.uploadWhileUploading.title,content:ze.warning.uploadWhileUploading.description,visible:n,children:A.jsx(r.Box,{display:"inline-flex",as:"span",children:A.jsx(r.Button,{disabled:i,onClick:s,invisible:!0,children:"upload"})})})})," ","media."]})}),A.jsx(r.FileUploadButton,{disabled:i,onFilesSelected:t,color:"grey",children:"Upload media"})]})}function xo(e){const{count:t}=e;return A.jsxs(r.Text,{variant:"bold",children:[t," item",t==1?"":"s"]})}function Ps(e){const{actionContainer:t}=e;return A.jsx(po,{sidePane:A.jsx(Ys,{}),mediaActions:A.jsx(Vs,{actionContainer:t}),mediaToolbar:A.jsx(r.Skeleton,{color:"grey5",borderRadius:12,children:A.jsx(xo,{count:888})}),mediaList:A.jsx(Os,{})})}function Os(){return A.jsx(mo,{children:O.range(1,24).map(e=>A.jsx(yo,{},e))})}function Vs(e){const{actionContainer:t}=e;return A.jsx(go,{actionContainer:t,children:A.jsxs(r.Box,{width:"100%",gap:16,children:[A.jsx(r.Box,{width:"100%",flexDirection:"column",children:A.jsx(r.FormSearchInput,{placeholder:"Search",maxLength:200,value:"",disabled:!0,onValueChange:()=>{}})}),A.jsx(r.FileUploadButton,{disabled:!0,onFilesSelected:()=>{},startIcon:"cloudUpload",color:t?"purple":"grey",size:"large",children:"Upload media"})]})})}function Ys(){return A.jsx(fo,{hasSelectedMedia:!1,children:A.jsx(Co,{onFilesUpload:()=>{},isUploading:!1,isInitialLoad:!0})})}function yo(){return A.jsx(r.Card,{variant:"outlined",padding:16,children:A.jsxs(r.CardContent,{gap:0,children:[A.jsx(r.Skeleton,{height:185,width:"100%"}),A.jsx(r.Skeleton,{height:16,width:"100%",sx:{marginTop:12}}),A.jsx(r.Skeleton,{height:10,width:100,sx:{marginTop:8}}),A.jsx(r.Skeleton,{height:1,width:"100%",sx:{marginTop:20,marginBottom:16}}),A.jsxs(r.Box,{flexDirection:"row",gap:8,children:[A.jsx(r.Skeleton,{height:24,width:54}),A.jsx(r.Skeleton,{height:24,width:45}),A.jsx(r.Skeleton,{height:24,width:62})]})]})})}const Bo=f.createContext({showToast:()=>{}});function Ws(e){const{children:t}=e,[n,o]=f.useState({title:"",seconds:5}),[i,s]=f.useState(!1),{title:a,action:l,seconds:d=1,icon:c="check"}=n,u=f.useMemo(()=>({showToast:h=>{o({seconds:d,...h}),s(!0)}}),[d]);return A.jsxs(A.Fragment,{children:[A.jsx(Hs,{}),A.jsx(r.Toast,{anchor:A.jsx(r.Box,{position:"absolute",justifyContent:"center",width:"100%",bottom:72}),open:i,onOpenChange:s,title:a,action:l,seconds:d,icon:c}),A.jsx(Bo.Provider,{value:u,children:t})]})}function Io(){return f.useContext(Bo)}function Hs(){const{revalidateMedia:e,isMediaCacheInvalid:t}=P(),[n,o]=f.useState(t);return E.useOnChange(t,o),A.jsx(r.Toast,{anchor:A.jsx(r.Box,{position:"absolute",justifyContent:"center",width:"100%",bottom:72}),open:n,title:"There have been changes to your media library",action:{title:"Update",onClick:e},cancel:{onClick:()=>o(!1)}})}function Ee(){const{media:e}=P(),t=je();return e.filter(({id:n})=>t.isSelected(n))}function _s(){const[e,t]=f.useState(!1),n=Ee(),o=je(),i=f.useMemo(()=>n.some(({id:a})=>a.startsWith("temp")),[n]),[s]=n;return s?o.selectedCount>1?A.jsxs(r.Box,{gap:8,alignItems:"center",children:[A.jsxs(r.Text,{variant:"emphasized",noWrap:!0,sx:{flexGrow:1},children:[o.selectedCount," media selected"]}),A.jsx(r.Tooltip,{content:"Open all selected media in new tabs",children:A.jsx(r.IconButton,{icon:"openInFull",variant:"solid",size:"small",onClick:()=>n.forEach(a=>window.open(a.url,"_blank"))})}),A.jsx(r.Tooltip,{content:"Remove selected media",children:A.jsx(r.IconButton,{icon:"delete",variant:"solid",color:"tomato",size:"small",hiddenLabel:"Remove media",onClick:()=>t(!0),disabled:i})}),A.jsx(qn,{open:e,onOpenChange:t,media:n})]}):A.jsxs(r.Box,{gap:8,alignItems:"center",children:[A.jsx(r.Text,{variant:"emphasized",noWrap:!0,sx:{flexGrow:1},children:s.filename}),A.jsxs(r.Box,{gap:8,children:[A.jsx(r.Tooltip,{content:"Open media in new tab",children:A.jsx(r.IconButton,{icon:"openInFull",variant:"solid",size:"small",hiddenLabel:"Open media in new tab",onClick:()=>window.open(s.url,"_blank"),disabled:i})}),A.jsx(r.Tooltip,{content:"Copy media URL",children:A.jsx(r.IconButton,{icon:"link",variant:"solid",size:"small",hiddenLabel:"Copy media URL",onClick:()=>navigator.clipboard.writeText(s.url),disabled:i})}),A.jsx(r.Tooltip,{content:"Remove media",children:A.jsx(r.IconButton,{icon:"delete",variant:"solid",color:"tomato",size:"small",hiddenLabel:"Remove media",onClick:()=>t(!0),disabled:i})}),A.jsx(qn,{open:e,onOpenChange:t,media:s})]})]}):null}function qn(e){const{open:t,onOpenChange:n,media:o}=e,i=L(),{showAlert:s}=r.useAlert(),{deleteMedia:a}=P(),l=je(),d=ro(),[c,u]=f.useState(!1),h=Array.isArray(o),g=h?"these items":"this item";function m(){u(!0);const y=l.getSelectionState().selectedIds;Ns({ids:y,config:i}).then(()=>{n(!1),a(y),l.clearSelection(),d()}).catch(()=>{n(!1),s({title:"Error",subtitle:`Something went wrong when removing ${g}.`})}).finally(()=>{u(!1)})}return A.jsxs(r.Dialog,{onOpenChange:n,open:t,size:"small",children:[A.jsx(r.DialogHeader,{icon:"alert",title:`Remove ${g} from your media library?`}),A.jsx(r.DialogDescription,{asChild:!0,children:A.jsx(r.DialogContent,{children:A.jsxs(r.Box,{padding:16,flexDirection:"column",children:[A.jsxs(r.Text,{children:["You are about to delete ",g,": ",!h&&A.jsx("b",{children:o.filename})]}),h&&A.jsx(zs,{media:o})]})})}),A.jsxs(r.DialogActions,{children:[A.jsx(r.DialogCancelButton,{}),A.jsxs(r.DialogActionButton,{onClick:m,color:"tomato",loading:c,children:["Yes, I want to remove ",g]})]})]})}const Et=15;function zs(e){const{media:t}=e,n=t.slice(0,Et),o=t.length>Et,i=o?t.length-Et:0,s=Ae.pluralize(i,"item");return A.jsxs(r.UnorderedList,{density:"compact",sx:{marginTop:8},children:[n.map((a,l)=>A.jsx(r.ListItem,{children:A.jsx("b",{children:a.filename})},l)),o&&A.jsxs(r.ListItem,{children:["And ",A.jsx("b",{children:i})," more ",s,"..."]})]})}function Ns(e){const{ids:t,config:n}=e;if(!n.mediaLibrary)throw new Error("Media Library not configured.");if(t.length===0)throw new Error("No ids provided during media deletion");const{assetsApiBaseUrl:o,repository:i,authStrategy:s}=n;if(t.length===1){const[a]=t;return U.request(new URL(`assets/${a}`,o),{headers:{repository:i},method:"DELETE",credentials:U.getRequestCredentials(s),okType:p.z.unknown()})}return U.request(new URL("assets/bulk-delete",o),{headers:{repository:i},method:"POST",credentials:U.getRequestCredentials(s),okType:p.z.unknown(),body:{ids:t}})}const ye=2e3,Ze="__MAIN_THUMBNAIL__";function Ht(e,t,n){const o=e.name===Ze?void 0:e.name;let i;return t?ae.isDefined(n)?i=[n.width,n.height]:ae.isDefined(e.width)||ae.isDefined(e.height)?i=[e.width??void 0,e.height??void 0]:i=[t.origin.width,t.origin.height]:i=void 0,[o,i?`${i[0]??"auto"}×${i[1]??"auto"}px`:void 0]}function Gs(e){var t,n;return[{...(t=e.config)==null?void 0:t.constraint,name:Ze}].concat(((n=e.config)==null?void 0:n.thumbnails)??[])}function Zs(e,t){var a,l;const{__TYPE__:n,thumbnails:o,...i}=t,s=(l=(a=e.config)==null?void 0:a.thumbnails)==null?void 0:l.map(({name:d})=>o==null?void 0:o[d]);return[i,...s??[]]}function Js(e,t,n,o){const i=o.length===0?void 0:o;return e===Ze||!K.isImageContent(t)?{...t,alt:i}:{...t,thumbnails:{...t.thumbnails,[e]:{...n,alt:i}}}}function Xs(e,t){const{width:n,height:o}=t??{};return n&&o?[n,o]:n?[n,Math.round(e.height*(n/e.width))]:o?[Math.round(e.width*(o/e.height)),o]:[e.width,e.height]}function $s(e,t,n,o,i){if(ia(e)==="svg")return e;const s=new URL(e);if(i){const{x:a,y:l,width:d,height:c}=t,u=[...s.searchParams.entries(),["rect",[a,l,d,c].join(",")],["w",n],["h",o]];s.search=u.map(h=>h.join("=")).join("&")}return s.toString()}function Bn(e,t){const n=new URL(e.split("?")[0]??e);return t!=null&&t.width&&n.searchParams.set("w",t.width.toString()),t!=null&&t.height&&n.searchParams.set("h",t.height.toString()),(t!=null&&t.width||!(t!=null&&t.height))&&n.searchParams.set("dpr",Math.max(1,Math.min(window.devicePixelRatio,3)).toString()),t!=null&&t.width&&(t!=null&&t.height)&&n.searchParams.set("fit","max"),n.searchParams.set("auto","compress,format"),n.toString()}function ea(e){return Bn(e,{width:300})}function jo(e){return Bn(e,{width:800,height:800})}function ta(e){return e!=null&&e.url?jo(e.url):void 0}function na(e,t,n,o){var l,d,c,u,h;if(!n||e===Ze){const g=(l=t.config)==null?void 0:l.thumbnails,m=g&&Object.fromEntries(g.map(C=>[C.name,ct(o,C)]));return{__TYPE__:"ImageContent",...ct(o,(d=t.config)==null?void 0:d.constraint),thumbnails:m}}const i=(u=(c=t.config)==null?void 0:c.thumbnails)==null?void 0:u.find(g=>g.name===e);if(!i)return n;const s=(h=n.thumbnails)==null?void 0:h[e],a=ct(o,i);return a.url===(s==null?void 0:s.url)?n:{...n,thumbnails:Ge.mapValues(n.thumbnails??{},(g,m)=>m===e?a:g)}}function Aa(e){return"kind"in e&&"extension"in e}function ct(e,t){const{width:n,height:o,rect:i}=oa({...e,width:(e==null?void 0:e.width)??ye,height:(e==null?void 0:e.height)??ye},t),s=!!(t!=null&&t.width||t!=null&&t.height);return{provider:"imgix",url:$s(e.url,i,n,o,s),alt:e.alt,...Aa(e)?{credits:e.credits}:{},origin:{id:e.id,url:e.url,width:e.width??ye,height:e.height??ye},width:n,height:o,edit:{background:"transparent",zoom:1,crop:{x:i.x,y:i.y}}}}function oa(e,t){const[n,o]=Xs(e,t),i=Math.max(n/e.width,o/e.height),s=Math.round((e.width-n/i)/2),a=Math.round((e.height-o/i)/2),l=Math.round(n/i),d=Math.round(o/i);return{width:n,height:o,rect:{x:s,y:a,width:l,height:d}}}function ia(e){const{pathname:t}=new URL(e),n=t.lastIndexOf(".");if(n!==-1)return t.substring(n).slice(1).toLowerCase()}function ra(e){if(!e)return"";const{filename:t,extension:n}=e;return!n||!t.endsWith(`.${n}`)?t:t.slice(0,-n.length-1)}function sa(){var s;const e=Ee(),{uploadingFiles:t}=P(),[n]=e;if(!n)return null;if(e.length===2)return A.jsx(Dt,{children:e.map((a,l)=>A.jsx("div",{style:{position:"absolute",transform:l===0?"translateX(25%) rotate(15deg) ":"translateX(-25%) rotate(-15deg) "},children:A.jsx(Pn,{media:a})},a.id))});if(e.length>2)return A.jsx(Dt,{children:e.slice(-4).map((a,l)=>A.jsx("div",{style:{position:"absolute",paddingRight:l*16},children:A.jsx(Pn,{media:a})},a.id))});const o=(s=t.find(a=>a.id===n.id))==null?void 0:s.status,i=n.kind.startsWith("image");return A.jsx(r.Box,{flexDirection:"column",children:A.jsx(r.CheckerBoard,{children:A.jsx(Dt,{uploadStatus:o,hasImage:i,children:i?A.jsx(r.Image,{src:n.url,alt:n.alt,sizing:"contain"}):A.jsx(r.MediaCardPlaceholder,{kind:n.kind,filename:n.filename})})})})}function Dt(e){const{children:t,uploadStatus:n,hasImage:o}=e;return A.jsxs(r.Box,{flexDirection:"column",alignItems:"center",justifyContent:"center",position:"relative",height:200,width:"100%",backgroundColor:o?"transparent":"purple2",children:[t,n&&A.jsx(aa,{uploadStatus:n})]})}function aa(e){const{uploadStatus:t}=e,{value:n,color:o,height:i,transition:s}=la(t);return A.jsx(r.Box,{position:"absolute",backgroundColor:"greyAlpha1",width:"100%",height:"100%",padding:{inline:16},justifyContent:"end",flexDirection:"column",children:A.jsx(r.ProgressBar,{value:n,color:o,height:i,transition:s})})}function la(e){switch(e){case"idle":return{value:0,height:"collapsed",color:"grey4"};case"uploading":return{value:90,transition:"slow",color:"purple9"};case"success":return{value:100,height:"collapsed",color:"purple9"};case"error":return{value:100,color:"tomato11"}}}function Pn(e){const{media:t}=e;return A.jsx(r.Box,{width:111,height:152,children:t.kind==="image"?A.jsx(r.Image,{borderRadius:8,src:Bn(t.url,{width:111,height:152}),alt:t.alt,sizing:"cover"}):A.jsx(r.MediaCardPlaceholder,{kind:t.kind,filename:t.filename})})}function ca(e){const t=e.length,n={},o=[];return e.forEach(s=>{s.tags.forEach(a=>{n[a.id]||(n[a.id]=0,o.push(a)),n[a.id]++})}),o.filter(s=>n[s.id]===t)}function Fo(e){const{tags:t,toggleAssetTag:n,getTagsLabel:o}=e,{setTagManagerOpen:i}=P(),{showToast:s}=Io(),{showAlert:a}=r.useAlert(),[l,d]=f.useState("");async function c(u,h){d("");try{await n(u,h),s({title:"Media tags were updated",seconds:3})}catch{a({title:"Error",subtitle:"Something went wrong when updating media tags"})}}return A.jsxs(r.Box,{flexDirection:"column",children:[A.jsxs(r.Box,{justifyContent:"space-between",children:[A.jsx(r.Text,{color:"grey12",variant:"bold",children:o()}),A.jsx(r.Button,{startIcon:"edit",invisible:!0,color:"dark",onClick:()=>i(!0),children:"Manage tags"})]}),A.jsxs(r.ComboBox,{sx:{marginTop:4,marginBottom:8},children:[A.jsx(da,{searchTerm:l,setSearchTerm:d}),A.jsx(r.ComboBoxContent,{children:A.jsx(r.ErrorBoundary,{renderError:()=>A.jsx(r.Text,{color:"grey9",variant:"small",sx:{marginBlock:8,marginInline:8},children:"Error getting tags"}),children:A.jsx(f.Suspense,{fallback:A.jsx(r.Box,{padding:8,flexDirection:"column",gap:8,children:O.range(1,6).map(u=>A.jsx(r.Skeleton,{height:24,width:85},u))}),children:A.jsx(ua,{searchTerm:l,assignedTags:t,onToggleAssetTag:c})})})})]}),A.jsx(r.Box,{flexDirection:"column",alignItems:"flex-start",gap:8,children:t.map(u=>A.jsx(r.Badge,{title:u.name,size:"medium",color:"purple",selected:!0,onClose:()=>c(u,"remove")},u.id))})]})}function da(e){const{searchTerm:t,setSearchTerm:n}=e,o=f.useRef(null),{openMediaSection:i,setOpenMediaSection:s}=P();return f.useEffect(()=>{var a;i==="tags"&&((a=o.current)==null||a.focus(),s(void 0))},[i,s]),A.jsx(r.ComboBoxInput,{value:t,onValueChange:n,placeholder:"Add or create a new tag",ref:o})}function ua(e){const{searchTerm:t,assignedTags:n,onToggleAssetTag:o}=e,[i]=Ee(),s=L(),{showAlert:a}=r.useAlert(),{tags:l}=tt(),d=f.useMemo(()=>{const g=t.toLowerCase();return l.filter(m=>m.name.toLowerCase().includes(g))},[l,t]),u=xn.safeParse(t).success&&l.every(g=>g.name!==t);async function h(){if(!t||!i)return;let g;try{g=await ga({name:t,config:s}),nt(m=>[g,...m])}catch{a({title:"Error",subtitle:`Something went wrong when creating the tag ${t}`});return}await o(g,"add")}return i?A.jsxs(A.Fragment,{children:[!d.length&&A.jsx(r.Text,{color:"grey9",variant:"small",sx:{marginBlock:8,marginInline:8},children:"No tags found"}),d.map((g,m)=>A.jsx(r.ComboBoxItem,{value:g.id,onCheckedChange:C=>o(g,C?"add":"remove"),checked:n.some(C=>C.id===g.id),children:A.jsx(r.Badge,{title:g.name,color:"purple",size:"medium",sx:{marginInline:8,marginBottom:m===d.length-1?8:4,marginTop:m===0?8:4}})},g.id)),u&&A.jsx(r.ComboBoxItem,{value:"new",onCheckedChange:h,children:A.jsxs(r.Box,{padding:8,flexDirection:"row",alignItems:"center",gap:4,children:[A.jsx(r.Icon,{name:"add",size:"small",color:"grey11"}),A.jsxs(r.Text,{color:"grey12",children:['Create tag "',t,'"']})]})})]}):null}function ga(e){const{name:t,config:n}=e;n.mediaLibrary||V("mediaLibrary");const{assetsApiBaseUrl:o,repository:i,authStrategy:s}=n;return U.request(new URL("tags",o),{headers:{repository:i},body:{name:t},method:"POST",credentials:U.getRequestCredentials(s),okType:yn})}function ha(e){const{selectedMedia:t}=e,n=L(),o=f.useMemo(()=>ca(t),[t]);async function i(a,l){const d=l==="remove",c=t.map(h=>h.id);let u=[];Le(h=>(u=h,h.map(g=>c.includes(g.id)?d?fa(g,a):ma(g,a):g)));try{await pa({tagId:a.id,assetIds:c,operation:d?"remove":"add",config:n});const h=t.length*(d?-1:1);nt(g=>g.map(m=>m.id===a.id?{...m,count:m.count+h}:m))}catch(h){throw Le(()=>u),h}}function s(){const a=o.length;return a>1?`${a} tags in common`:a===1?"1 tag in common":"Common tags"}return A.jsx(Fo,{tags:o,getTagsLabel:s,toggleAssetTag:i})}function pa(e){const{tagId:t,assetIds:n,config:o,operation:i}=e;if(!o.mediaLibrary)throw new Error("Media Library not configured.");const{assetsApiBaseUrl:s,repository:a,authStrategy:l}=o;return U.request(new URL(`tags/${t}/assets`,s),{headers:{repository:a},body:{assetIds:n},method:i==="add"?"POST":"DELETE",credentials:U.getRequestCredentials(l),okType:p.z.unknown()})}function ma(e,t){return e.tags.some(({id:o})=>o===t.id)?e:{...e,tags:[...e.tags,t]}}function fa(e,t){const n=e.tags.filter(o=>o.id!==t.id);return{...e,tags:n}}function Ca(e){const{selectedMedia:t}=e,n=t.tags,o=L(),{updateMedia:i}=P();async function s(l,d){const c=t.tags,u=d==="remove",h=u?c.filter(g=>g.id!==l.id):[...c,l];i(t.id,{tags:h});try{await xa({mediaId:t.id,config:o,tags:h.map(g=>g.id)}),nt(g=>g.map(m=>m.id===l.id?{...m,count:m.count+(u?-1:1)}:m))}catch(g){throw i(t.id,{tags:c}),g}}function a(){const l=n.length;return l>1?`${l} tags`:l===1?"1 tag":"Tags"}return A.jsx(Fo,{tags:n,getTagsLabel:a,toggleAssetTag:s})}function xa(e){const{mediaId:t,config:n,tags:o}=e;if(!n.mediaLibrary)throw new Error("Media Library not configured.");const{assetsApiBaseUrl:i,repository:s,authStrategy:a}=n;return U.request(new URL(`assets/${t}`,i),{headers:{repository:s},body:{tags:o},method:"PATCH",credentials:U.getRequestCredentials(a),okType:Ut})}function ya(){const[e,t]=f.useState("description");if(Ee().length!==1)return A.jsx(Sa,{});const o=e==="description",i=e==="more-info";return A.jsxs(A.Fragment,{children:[A.jsxs(r.Box,{display:"grid",gridTemplateColumns:"1fr 1fr",backgroundColor:"grey2",border:!0,borderStyle:"solid",borderRadius:8,children:[A.jsx(r.Tab,{selected:o,outline:o,transparent:!0,onClick:()=>t("description"),children:"Description"}),A.jsx(r.Tab,{selected:i,outline:i,transparent:!0,onClick:()=>t("more-info"),children:"More info"})]}),A.jsx(Ba,{tab:e})]})}function Ba(e){const{tab:t}=e;switch(t){case"description":return A.jsx(Ia,{});case"more-info":return A.jsx(ja,{})}}function Ia(){const{title:e,alt:t,onBlur:n,isUploading:o,selectedMedia:i}=bo();if(!i)return null;const{extension:s}=i;return A.jsxs(r.Box,{flexDirection:"column",gap:16,children:[A.jsx(r.FormInput,{value:e.value,onValueChange:e.set,label:"Media title",placeholder:"Media title",onBlur:n,disabled:o,suffix:s?`.${s}`:void 0}),A.jsx(r.FormInputField,{label:"Alternative text",children:A.jsx(r.ContentEditable,{content:t.displayValue,contentVersion:t.version,readOnly:o,placeholder:"A short description of the media for accessibility",multiline:!0,decorations:{em:"highlight"},onChange:t.onChange,onBlur:n})}),!o&&A.jsx(Ca,{selectedMedia:i})]})}function ja(){const{credits:e,notes:t,onBlur:n,isUploading:o,selectedMedia:i}=bo();if(!i)return null;const{uploader_id:s}=i,a=Ua(i);return A.jsxs(r.Box,{gap:8,flexDirection:"column",children:[a.map(l=>A.jsxs(r.Box,{gap:8,children:[A.jsxs(r.Text,{color:"grey11",children:[l.label,":"]}),A.jsx(r.Text,{children:l.value})]},l.label)),A.jsxs(r.Box,{gap:8,children:[A.jsx(r.Text,{color:"grey11",children:"Uploaded by:"}),A.jsx(r.ErrorBoundary,{renderError:()=>A.jsx(r.Text,{color:"grey11",children:"Error getting uploader"}),children:A.jsx(f.Suspense,{fallback:A.jsx(So,{}),children:A.jsx(Fa,{uploaderId:s})})})]}),A.jsx(r.FormInputField,{label:"Copyright",children:A.jsx(r.ContentEditable,{content:e.displayValue,contentVersion:e.version,readOnly:o,placeholder:"Media copyrights or credits",multiline:!0,decorations:{em:"highlight"},onChange:e.onChange,onBlur:n})}),A.jsx(r.FormInputField,{label:"Private notes",children:A.jsx(r.ContentEditable,{content:t.displayValue,contentVersion:t.version,readOnly:o,placeholder:"Private notes are never shared publicly",multiline:!0,decorations:{em:"highlight"},onChange:t.onChange,onBlur:n})})]})}function Fa(e){const{uploaderId:t}=e,{uploadersById:n}=oo(),o=n.get(t??"ghost");return t&&!o?A.jsx(So,{}):o?A.jsxs(A.Fragment,{children:[A.jsx(r.Avatar,{size:24,firstName:o.firstName,lastName:o.lastName,imageUrl:o.uploadedAvatar,hasBorder:!1}),A.jsx(r.Text,{children:o.name})]}):null}function So(){return A.jsx(r.Skeleton,{width:128})}function Sa(){const e=Ee(),{uploadingFiles:t}=P(),n=f.useMemo(()=>t.some(o=>e.some(i=>o.id===i.id)&&o.status!=="success"),[e,t]);return A.jsx(A.Fragment,{children:!n&&A.jsx(ha,{selectedMedia:e})})}function bo(){const[e]=Ee(),{updateMedia:t,uploadingFiles:n}=P(),o=L(),{showToast:i}=Io(),s=(e==null?void 0:e.id)??"",a=st(e,"alt"),l=st(e,"notes"),d=st(e,"credits"),c=st(e,"filename",ra),u=n.some(g=>g.id===(e==null?void 0:e.id)&&g.status!=="success");async function h(){if(!e||!c.changed&&!a.changed&&!d.changed&&!l.changed)return;const{extension:g,search_highlight:m}=e,C=g?`${c.value}.${g}`:c.value;t(s,{filename:C,alt:a.value,credits:d.value,notes:l.value,search_highlight:{alt:a.changed||m==null?void 0:m.alt,credits:d.changed||m==null?void 0:m.credits,filename:c.changed||m==null?void 0:m.filename,notes:l.changed||m==null?void 0:m.notes}}),await Ka({id:s,config:o,metadata:{filename:C,alt:a.value,credits:d.value,notes:l.value}}),i({title:"Media metadata has been saved.",seconds:3})}return{selectedMedia:e,onBlur:h,isUploading:u,title:c,alt:a,credits:d,notes:l,extension:e==null?void 0:e.extension}}function st(e,t,n=o=>o==null?void 0:o[t]){var c;const o=n(e)??"",[i,s]=f.useState(o);E.useOnChange(e==null?void 0:e.id,()=>s(o));const a=(c=e==null?void 0:e.search_highlight)==null?void 0:c[t],l=!!a;function d(u){const{from:h,to:g}=u.state.selection;u.commands.selectAll(),u.commands.unsetAllMarks(),u.commands.setTextSelection({from:h,to:g}),s(u.getText())}return{value:i,set:s,displayValue:ba(a??i)??"",onChange:d,version:`${(e==null?void 0:e.id)??""}_${l}`,changed:i!==o}}function ba(e){return e==null?void 0:e.replace(/\n/g,"<br>")}function Ka(e){const{id:t,config:n,metadata:o}=e;if(!n.mediaLibrary)throw new Error("Media Library not configured.");const{assetsApiBaseUrl:i,repository:s,authStrategy:a}=n;return U.request(new URL(`assets/${t}`,i),{headers:{repository:s},body:{...o},method:"PATCH",credentials:U.getRequestCredentials(a),okType:Ut})}function Ua(e){const{width:t,height:n,last_modified:o,size:i,extension:s}=e,a=t&&n,l={label:"Date",value:cn.prettyPrintDate(new Date(o))},d={label:"File size",value:Ae.formatBytes(i)},c=a?{label:"Dimensions",value:`${t}×${n}`}:void 0,u=a?{label:"Ratio",value:((t??0)/(n??0)).toFixed(1)}:void 0,h=s?{label:"Extension",value:s.toUpperCase()}:void 0;return[l,d,c,u,h].filter(ae.isDefined)}function Ta(){const{setTagManagerOpen:e}=P(),[t,n]=f.useState("");return A.jsxs(r.Box,{gap:20,flexDirection:"column",height:"100%",children:[A.jsxs(r.Box,{alignItems:"center",gap:4,children:[A.jsx(r.IconButton,{icon:"close",size:"small",hasPadding:!1,onClick:()=>e(!1)}),A.jsx(r.Text,{variant:"bold",children:"Tags management"})]}),A.jsxs(r.Box,{gap:16,flexDirection:"column",height:"100%",children:[A.jsx(r.FormSearchInput,{value:t,onValueChange:n,placeholder:"Search for tags",endAdornment:!1,autoFocus:!0}),A.jsx(r.ErrorBoundary,{renderError:()=>A.jsx(ka,{}),children:A.jsx(f.Suspense,{fallback:A.jsx(Ra,{}),children:A.jsx(wa,{searchTerm:t})})})]})]})}function wa(e){const{searchTerm:t}=e,{tags:n}=tt(),o=n.filter(i=>i.name.toLowerCase().includes(t.toLowerCase()));return o.length===0?A.jsx(r.Text,{color:"grey9",variant:"small",children:"No tags found"}):A.jsx(r.AnimatedList,{ariaLabel:"Tags list",getItemKey:i=>i.id,gap:16,items:o,children:i=>A.jsx(La,{tag:i})})}function La(e){const{tag:t}=e,[n,o]=f.useState(!1),i=L(),{showAlert:s}=r.useAlert(),{showToast:a}=r.useToast(),{tags:l}=tt();async function d(c){if(!xn.safeParse(c).success){s({title:"Error",subtitle:`Failed to rename tag "${t.name}" to "${c}". Tag name must be at least ${JA} and at maximum ${XA} characters long.`});return}if(l.some(g=>g.name===c)){s({title:"Error",subtitle:`Failed to rename tag "${t.name}" to "${c}". Tag with name "${c}" already exists.`});return}try{await Da({id:t.id,name:c,config:i}),nt(g=>g.map(m=>m.id===t.id?{...m,name:c}:m)),Le(g=>g.map(m=>{if(m.tags.findIndex(y=>y.id===t.id)!==-1){const y=m.tags.map(x=>x.id===t.id?{...x,name:c}:x);return{...m,tags:y}}return m})),a({title:`Tag "${t.name}" renamed to "${c}"`,seconds:3})}catch{s({title:"Error",subtitle:"Something went wrong when renaming the tag."})}}return A.jsxs(A.Fragment,{children:[A.jsxs(r.Box,{justifyContent:"space-between",children:[A.jsx(r.Badge,{title:t.name,color:"purple",size:"medium",onEdit:d}),A.jsx(r.Button,{invisible:!0,color:"tomato",textWeight:"normal",onClick:()=>o(!0),children:"Delete"})]}),A.jsx(va,{open:n,onOpenChange:o,tag:t})]})}function va(e){const{open:t,onOpenChange:n,tag:o}=e,{id:i,name:s,count:a}=o,l=L(),{showAlert:d}=r.useAlert(),[c,u]=f.useState(!1);async function h(){u(!0);try{await Ea({id:i,config:l}),nt(g=>g.filter(m=>m.id!==i)),Le(g=>g.map(m=>{if(m.tags.findIndex(y=>y.id===i)!==-1){const y=m.tags.filter(x=>x.id!==i);return{...m,tags:y}}return m}))}catch{d({title:"Error",subtitle:"Something went wrong when removing the tag."})}finally{u(!1),n(!1)}}return A.jsxs(r.Dialog,{onOpenChange:n,open:t,size:"small",children:[A.jsx(r.DialogHeader,{title:`This tag is being used on ${a} media ${Ae.pluralize(a,"item")}`}),A.jsx(r.DialogDescription,{asChild:!0,children:A.jsx(r.DialogContent,{padding:16,children:A.jsxs(r.Text,{children:["You are about to delete the tag name ",A.jsx("b",{children:s}),"."," ",a>0&&`This tag is being used on ${a} media ${Ae.pluralize(a,"item")} and will be deleted from ${Ae.pluralize(a,"it","them")}.`]})})}),A.jsxs(r.DialogActions,{children:[A.jsx(r.DialogCancelButton,{}),A.jsx(r.DialogActionButton,{onClick:h,color:"tomato",loading:c,children:"Yes, I want to delete"})]})]})}function ka(){const e=f.useContext(R.ErrorBoundaryContext);return A.jsx(r.Box,{flexDirection:"column",children:A.jsxs(r.BlankSlate,{children:[A.jsx(r.BlankSlateIcon,{name:"close",lineColor:"purple10",backgroundColor:"purple3",borderColor:"purple6",borderStyle:"dashed"}),A.jsx(r.BlankSlateTitle,{size:"big",children:"Oops!"}),A.jsx(r.BlankSlateDescription,{width:360,children:"We couldn't load your media tags."}),A.jsx(r.BlankSlateActions,{children:A.jsx(r.Button,{onClick:e==null?void 0:e.reset,size:"medium",children:"Try again"})})]})})}function Ea(e){const{id:t,config:n}=e;n.mediaLibrary||V("mediaLibrary");const{assetsApiBaseUrl:o,repository:i,authStrategy:s}=n;return U.request(new URL(`tags/${t}`,o),{headers:{repository:i},method:"DELETE",credentials:U.getRequestCredentials(s),okType:p.z.unknown()})}function Da(e){const{id:t,name:n,config:o}=e;o.mediaLibrary||V("mediaLibrary");const{assetsApiBaseUrl:i,repository:s,authStrategy:a}=o;return U.request(new URL(`tags/${t}`,i),{headers:{repository:s},method:"PATCH",credentials:U.getRequestCredentials(a),body:{name:n},okType:p.z.unknown()})}function Ra(){return A.jsx(r.Box,{flexDirection:"column",gap:16,children:O.range(1,6).map(e=>A.jsxs(r.Box,{justifyContent:"space-between",children:[A.jsx(r.Skeleton,{height:24,width:85}),A.jsx(r.Skeleton,{height:24,width:45})]},e))})}function Qa(){const e=Ee(),{onFilesUpload:t,isUploading:n,tagManagerOpen:o}=P();return e.length===0&&o===!1?A.jsx(Co,{onFilesUpload:t,isUploading:n}):A.jsx(r.Box,{flexDirection:"column",backgroundColor:"grey1",width:"100%",padding:16,gap:16,borderRadius:{topLeft:8,topRight:8},children:o?A.jsx(Ta,{}):A.jsxs(A.Fragment,{children:[A.jsx(_s,{}),A.jsx(sa,{}),A.jsx(ya,{})]})})}function Ma(){const e=je();return A.jsx(fo,{hasSelectedMedia:e.selectedCount!==0,children:A.jsx(Qa,{})})}const _t={all:{name:"All media",icon:"public"},image:{name:"Images",icon:"image"},video:{name:"Videos",icon:"videocam"},document:{name:"Documents",icon:"insertDriveFile"},audio:{name:"Audio files",icon:"musicNote"}},qa=Object.entries(_t);function Pa(){const{assetType:e,initialAssetType:t,onFilterChange:n}=P(),[o,i]=f.useState(e);E.useOnChange(e,()=>{i(e)});const[s,a]=f.useState(!1);function l(g){a(!1),i(g),n({assetType:g})}const{icon:d,name:c}=_t[o],u=_t[t].name,h=t!=="all";return A.jsxs(r.DropdownMenu,{open:s,onOpenChange:a,children:[A.jsx(r.DropdownMenuTrigger,{disabled:h,children:A.jsx(Oa,{icon:d,isDropdownDisabled:h,buttonName:c,tooltipAssetTypeName:u})}),A.jsx(r.DropdownMenuContent,{minWidth:256,align:"start",childrenFocusScope:!0,children:A.jsx(A.Fragment,{children:qa.filter(([g])=>g!==o).map(([g,{icon:m,name:C}])=>A.jsx(r.DropdownMenuItem,{startIcon:A.jsx(r.Icon,{name:m}),onSelect:()=>l(g),children:C},g))})})]})}const Oa=f.forwardRef(function(t,n){const{icon:o,isDropdownDisabled:i,buttonName:s,tooltipAssetTypeName:a,...l}=t;return A.jsx(r.Tooltip,{content:`You can only pick ${(a==null?void 0:a.toLocaleLowerCase())??"this type of media"}`,visible:i,children:A.jsx(r.Button,{startIcon:o,endIcon:"arrowDropDown",size:"small",color:"grey",disabled:i,ref:n,...l,children:s})})});function Va(e){const{optimisticTagIds:t,setOptimisticTagIds:n}=e,{onFilterChange:o}=P(),{tags:i}=tt(),s=f.useMemo(()=>Xi.groupBy(i,l=>l.id),[i]);function a(l){const d=t.filter(c=>c!==l.id);n(d),o({tagIds:d})}return A.jsx(A.Fragment,{children:t.map(l=>{var c;const d=(c=s.get(l))==null?void 0:c[0];return d?A.jsx(r.Badge,{title:d.name,size:"medium",color:"purple",onClose:()=>a(d),selected:!0},d.id):null})})}function Ya(){const{setTagManagerOpen:e,tagIds:t,onFilterChange:n}=P(),[o,i]=f.useState(""),[s,a]=f.useState(!1),[l,d]=f.useState(t);E.useOnChange(JSON.stringify(t),()=>{d(t)});function c(g){a(g),g||i("")}function u(g){const m=l.includes(g.id)?t.filter(C=>C!==g.id):[...t,g.id];d(m),n({tagIds:m}),a(!1)}function h(){a(!1),e(!0)}return A.jsxs(A.Fragment,{children:[A.jsxs(r.DropdownMenu,{open:s,onOpenChange:c,children:[A.jsx(r.DropdownMenuTrigger,{children:A.jsx(r.Button,{startIcon:"label",endIcon:"arrowDropDown",size:"small",color:"grey",children:"Tags"})}),A.jsx(r.DropdownMenuContent,{minWidth:256,align:"start",border:!1,childrenFocusScope:!0,children:A.jsxs(r.ComboBox,{variant:"attached",children:[A.jsx(r.ComboBoxInput,{value:o,onValueChange:i,placeholder:"Search for a tag",autoFocus:!0}),A.jsx(r.ComboBoxContent,{paddingBlock:4,children:A.jsx(r.ErrorBoundary,{renderError:()=>A.jsx(r.Text,{color:"grey9",variant:"small",sx:{marginBlock:8,marginInline:8},children:"Error getting tags"}),children:A.jsx(f.Suspense,{fallback:A.jsx(r.Box,{padding:8,flexDirection:"column",gap:8,children:O.range(1,6).map(g=>A.jsx(r.Skeleton,{height:24,width:85},g))}),children:A.jsx(Wa,{searchTerm:o,setSearchTerm:i,onTagToggle:u,optimisticTagIds:l})})})}),A.jsx(r.ComboboxAction,{children:A.jsx(r.Button,{invisible:!0,startIcon:"edit",textWeight:"normal",color:"dark",onClick:h,children:"Manage tags"})})]})})]}),l.length>0&&A.jsx(r.ErrorBoundary,{children:A.jsx(f.Suspense,{children:A.jsx(Va,{optimisticTagIds:l,setOptimisticTagIds:d})})})]})}function Wa(e){const{onTagToggle:t,searchTerm:n,optimisticTagIds:o}=e,{tags:i}=tt(),s=f.useMemo(()=>{const a=n.toLowerCase();return i.filter(l=>l.name.toLowerCase().includes(a))},[i,n]);return A.jsxs(A.Fragment,{children:[!s.length&&A.jsx(r.Text,{color:"grey9",variant:"small",sx:{marginBlock:8,marginInline:8},children:"No tags found"}),s.map(a=>{const l=o.includes(a.id);return A.jsx(r.ComboBoxItem,{value:a.id,onCheckedChange:()=>t(a),checked:l,children:A.jsx(r.Badge,{title:a.name,color:"purple",sx:{marginLeft:8,marginBottom:4,marginTop:4},size:"medium"})},a.id)})]})}function Ha(){const{uploaderId:e,onFilterChange:t}=P(),[n,o]=f.useState(""),[i,s]=f.useState(!1),[a,l]=f.useState();E.useOnChange(e,()=>{e||l(void 0)});function d(u){s(u),u||o("")}function c(u){l(u),t({uploaderId:u==null?void 0:u.id}),s(!1)}return A.jsxs(r.DropdownMenu,{open:i,onOpenChange:d,children:[A.jsx(r.DropdownMenuTrigger,{children:A.jsx(r.Button,{startIcon:"people",renderStartIcon:u=>a?A.jsx(r.Avatar,{imageUrl:a==null?void 0:a.uploadedAvatar,firstName:a.firstName,lastName:a.lastName,size:16,hasBorder:!1}):u,endIcon:"arrowDropDown",size:"small",color:"grey",children:(a==null?void 0:a.name)??"All uploaders"})}),A.jsx(r.DropdownMenuContent,{minWidth:256,align:"start",border:!1,childrenFocusScope:!0,children:A.jsxs(r.ComboBox,{variant:"attached",children:[A.jsx(r.ComboBoxInput,{value:n,onValueChange:o,placeholder:"Search for uploaders",autoFocus:!0}),A.jsx(r.ComboBoxContent,{paddingBlock:4,children:A.jsx(r.ErrorBoundary,{renderError:()=>A.jsx(r.Text,{color:"grey9",variant:"small",sx:{marginBlock:8,marginInline:8},children:"Error getting uploaders"}),children:A.jsx(f.Suspense,{fallback:A.jsx(za,{}),children:A.jsx(_a,{searchTerm:n,setSearchTerm:o,onUploaderToggle:c,optimisticUploader:a})})})})]})})]})}function _a(e){const{searchTerm:t,optimisticUploader:n,onUploaderToggle:o}=e,{uploaders:i}=oo(),s=f.useMemo(()=>{const a=t.toLowerCase();return O.sort(i.filter(l=>{var d;return l.name.toLowerCase().includes(a)||((d=l.email)==null?void 0:d.toLowerCase().includes(a))}),l=>(n==null?void 0:n.id)===(l==null?void 0:l.id)?0:1)},[i,n,t]);return s.length?A.jsx(A.Fragment,{children:s.map(a=>{const l=a.id===(n==null?void 0:n.id);return A.jsx(r.ComboBoxItem,{value:a.id,onCheckedChange:()=>l?o():o(a),checked:l,children:A.jsxs(r.Box,{alignItems:"center",padding:{top:8,bottom:8,left:16,right:16},gap:8,children:[A.jsx(r.Avatar,{firstName:a.firstName,lastName:a.lastName,imageUrl:a.uploadedAvatar,hasBorder:!1}),A.jsxs(r.Box,{display:"flex",flexDirection:"column",children:[A.jsx(r.Text,{color:"grey12",variant:"normal",children:a.name}),a.email&&A.jsx(r.Text,{color:"grey10",variant:"small",children:a.email})]})]})},a.id)})}):A.jsx(r.Text,{color:"grey9",variant:"small",sx:{marginBlock:8,marginInline:8},children:"No uploaders found"})}function za(){return A.jsx(r.Box,{padding:8,flexDirection:"column",gap:8,children:O.range(1,4).map(e=>A.jsx(r.Skeleton,{height:48,width:"full"},e))})}function Na(){const{media:e,mediaTotal:t}=P(),n=je();return A.jsxs(r.Box,{alignItems:"center",gap:16,children:[n.isSelectAllEnabled&&A.jsx(r.Checkbox,{onCheckedChange:n.toggleSelectAll,checked:n.selectedCount>0,indeterminate:n.selectedCount!==t,onClick:o=>o.stopPropagation(),disabled:e.length===0}),e.length!==0&&A.jsx(xo,{count:t}),A.jsxs(r.Box,{gap:8,alignItems:"center",children:[A.jsx(r.Text,{children:"Filter:"}),A.jsx(Pa,{}),A.jsx(Ha,{}),A.jsx(Ya,{})]})]})}function Ko(e){const{assetType:t,onSelectedChange:n,actionContainer:o}=e;return A.jsx(r.ErrorBoundary,{renderError:()=>A.jsx(ho,{}),children:A.jsx(f.Suspense,{fallback:A.jsx(Ps,{actionContainer:o}),children:A.jsx(xA,{children:A.jsx(Ls,{assetType:t,actionContainer:o,onSelectedChange:n,children:A.jsx(Qs,{children:A.jsx(Ga,{})})})})})})}function Ga(){const{media:e}=P(),t=lo();return A.jsx(Ws,{children:A.jsx(po,{sidePane:t?void 0:A.jsx(Ma,{}),mediaActions:A.jsx(Ds,{}),mediaToolbar:A.jsx(Na,{}),mediaList:e.length===0?A.jsx(ks,{}):A.jsx(qs,{})})})}function Za(e){const{href:t,tracking:n}=e;return A.jsx(r.Box,{justifyContent:"center",padding:{block:6},children:A.jsxs(r.Text,{href:t,variant:"smallBold",color:"grey11",onClick:()=>void n.track({event:"shared-onboarding:follow-tutorial",source:n.source}),children:["Or watch our in-depth course",A.jsx(r.Icon,{name:"playCircle",color:"grey11",size:"small",sx:{marginLeft:4}})]})})}function Ja(e){const{step:t,stepIndex:n,isOpen:o,onActionClick:i,onClose:s,contentRef:a}=e,[l,d]=f.useState(!1),[c,u]=f.useState(e.isStepComplete);f.useEffect(()=>{o&&u(e.isStepComplete)},[e.isStepComplete,o]);async function h(){if(o)try{d(!0),await i(c)}finally{d(!1)}}return A.jsxs(r.Dialog,{open:o,onOpenChange:s,size:"small",children:[A.jsx(r.DialogHeader,{title:"Onboarding"}),A.jsxs(r.DialogContent,{children:[A.jsx(r.ScrollArea,{children:A.jsxs(r.Box,{ref:a,as:"article",flexDirection:"column",padding:16,gap:16,children:[A.jsx(r.DialogDescription,{asChild:!0,children:A.jsxs("section",{children:[A.jsxs(r.Text,{sx:{marginBottom:4},color:"purple9",variant:"bold",children:["Step ",n+1]}),A.jsx(r.Text,{variant:"h3",children:t.title}),t.content]})}),t.videoUrl&&A.jsx(r.Video,{src:t.videoUrl,sizing:"contain",borderRadius:4,autoPlay:!0,loop:!0})]})}),A.jsxs(r.DialogActions,{children:[A.jsx(r.DialogCancelButton,{size:"medium",children:"Close"}),!t.defaultCompleted&&A.jsx(r.DialogActionButton,{size:"medium",onClick:h,loading:l,color:c?"darkGrey":"purple",children:c?"Undo step":"Complete step"})]})]})]})}function Xa(e){const{steps:t,completedSteps:n,onToggleStep:o,tracking:i,stepOverrides:s}=e,[a,l]=f.useState(!1),[d,c]=f.useState(t[0]),u=f.useRef(null);if(!d)return null;const h=t.findIndex(({id:x})=>x===d.id);function g(x){return n.includes(x.id)}function m(x){c(x),l(!0),i.track({event:"shared-onboarding:step-opened",stepId:x.id,stepTitle:x.title,source:i.source})}async function C(x=!1){var I;if(d&&(await o(d),!x)){(I=u.current)==null||I.animate([{opacity:0},{opacity:1}],{duration:400});const B=y();B?m(B):l(!1)}}function y(){let x=h+1;for(;x<t.length;){const I=t[x];if(I&&!g(I))return I;x++}}return A.jsxs(A.Fragment,{children:[A.jsx(Ja,{contentRef:u,isOpen:a,step:d,stepIndex:h,isStepComplete:g(d),onClose:()=>l(!1),onActionClick:C}),A.jsxs(r.DropdownMenu,{children:[A.jsx(r.DropdownMenuTrigger,{children:A.jsx(r.Button,{size:"large",color:"grey",sx:{width:"100%"},renderStartIcon:$a,children:n.length>0?"Continue":"Start now"})}),A.jsxs(r.DropdownMenuContent,{side:"right",minWidth:256,collisionPadding:8,children:[A.jsx(r.DropdownMenuLabel,{children:A.jsx(r.Text,{variant:"small",color:"grey11",sx:{marginInline:8},children:"Progress"})}),t.map((x,I)=>{const B=g(x);return A.jsx(r.DropdownMenuItem,{onSelect:(s==null?void 0:s[x.id])??(()=>m(x)),description:x.description,completed:B,endAdornment:A.jsx(r.Icon,{name:"chevronRight",size:"small",color:"grey11"}),children:`${I+1} ${x.title}`},x.id)})]})]})]})}function $a(){return A.jsx(r.Icon,{name:"arrowForward",size:"small",color:"grey11"})}function el(e){const{steps:t,completedSteps:n,tutorialLink:o,tracking:i,onToggleStep:s,onClose:a,stepOverrides:l}=e,d=n.length===t.length;return A.jsx(r.Card,{variant:d?"elevated":"animated-light",paddingBlock:16,onClose:a,children:A.jsxs(r.CardContent,{children:[A.jsxs("div",{children:[A.jsx(r.Text,{variant:"bold",children:`Build your first page in ${t.length.toString()} simple steps`}),A.jsx(r.Text,{color:"grey11",variant:"small",children:"Render a live page with content coming from Prismic."})]}),A.jsx(r.ProgressBar,{value:n.length,max:t.length,displayLabel:!0,getValueLabel:(c,u)=>`${c}/${u}`}),A.jsx(Xa,{steps:t,completedSteps:n,onToggleStep:s,tracking:i,stepOverrides:l}),o&&A.jsx(Za,{href:o,tracking:i})]})})}function tl(e){const{framework:t,projectName:n,starterId:o,repositoryName:i}=e,{frameworkNameLabel:s,createProjectCodeSnippet:a}=nl(e),l=[{id:"createPrismicProject",title:"Create your Prismic project",description:"Create and set up your project",defaultCompleted:!0,content:A.jsx(r.Text,{children:"A Prismic project is a space for managing and organizing the content of your website."})},{id:"chooseLocale",title:"Select your main locale",description:"Choose your first locale",defaultCompleted:!!o,content:A.jsx(r.Text,{children:"Locales allow you to create and manage multilingual versions of your content within a single Prismic project."})},{id:"createProject",title:`Create a ${s}project`,description:"Create and set up your project",videoUrl:"https://res.cloudinary.com/dmtf1daqp/video/upload/v1727768069/DEV_TOOLS/ONBOARDING_GUIDE/Pagebuilder_onboarding_step_3_puh6fx.mp4",content:A.jsxs(A.Fragment,{children:[A.jsx(r.Text,{sx:{marginBottom:16},children:"Now that you have a Prismic project to manage the content of your website, let's create the code project that will be querying your content."}),!!a&&A.jsx(Ot,{code:`${a} ${i??"<my-project>"}`,language:"bash"}),A.jsx(r.Text,{variant:"small",sx:{marginTop:16},children:"(example for Next.js below)"})]})},{id:"setupSliceMachine",title:"Set up & run Slice Machine",description:"Prepare the code to fetch content",videoUrl:"https://res.cloudinary.com/dmtf1daqp/video/upload/v1727768069/DEV_TOOLS/ONBOARDING_GUIDE/page_builder_onboarding_step_4_yl8fb8.mp4",content:A.jsxs(A.Fragment,{children:[A.jsx(r.Text,{sx:{marginBottom:16},children:`Slice Machine is the Prismic tool for creating your content models.
|
|
36
|
-
Install it in your ${
|
|
37
|
-
npx @slicemachine/init@latest --repository ${i??"<my-project>"}`,language:"bash",title:"Terminal",showLineNumbers:!1})]})},{id:"createPageType",title:"Create a Page Type",description:"Build the structure of your page",videoUrl:"https://res.cloudinary.com/dmtf1daqp/video/upload/v1721918320/DEV_TOOLS/ONBOARDING_GUIDE/Create_page_type_xdn13j.mp4",content:A.jsx(r.Text,{children:"A page type is a base content structure editors will use to create pages in the Page Builder (Prismic's content creation UI). A page type can be reusable (e.g., for multiple blog posts) or single (e.g., for a one-time page like the homepage)."})},{id:"codePage",title:"Code Your Page Type",description:"Prepare code to fetch content",videoUrl:"https://res.cloudinary.com/dmtf1daqp/video/upload/v1721918320/DEV_TOOLS/ONBOARDING_GUIDE/Step2_code_your_page_jatiur.mp4",content:A.jsx(r.Text,{children:"Prepare your code to query the content from the Prismic API."})},{id:"createSlice",title:"Create a Slice",description:"Build a reusable website section",videoUrl:"https://res.cloudinary.com/dmtf1daqp/video/upload/v1721918322/DEV_TOOLS/ONBOARDING_GUIDE/Step3_add_slice_qzmvxf.mp4",content:A.jsx(r.Text,{children:"Slices are website sections that can be reused on different pages with different content. Each slice has a code component automatically generated by Slice Machine. Start with a template and look at your code to see how it's structured."})},{id:"reviewAndPush",title:"Review and Push changes",description:"Enable editors to create content",videoUrl:"https://res.cloudinary.com/dmtf1daqp/video/upload/v1721918320/DEV_TOOLS/ONBOARDING_GUIDE/DevTools_Squad_push_changes_ovvmul.mp4",content:A.jsx(r.Text,{children:"Your page types and slices currently exist only in your local project. Push them to your repository to make them available for your content editors."})},{id:"createContent",title:"Create Content",description:"Publish a page to the Prismic API",videoUrl:"https://res.cloudinary.com/dmtf1daqp/video/upload/v1732631905/DEV_TOOLS/ONBOARDING_GUIDE/step_9_create_content_y8m3m0.mp4",content:A.jsx(r.Text,{children:"In Prismic, content creation takes place in the Prismic Page Builder UI. Open the Page Builder and start creating your first page."})},{id:"renderPage",title:"Render Your Page",description:"View your page in the browser",videoUrl:"https://res.cloudinary.com/dmtf1daqp/video/upload/v1721918321/DEV_TOOLS/ONBOARDING_GUIDE/Step_6_Render_Page_tnauh9.mp4",content:A.jsxs(r.Text,{children:["Now that your content is published, you can run your project in your terminal and visit the page on your local server (e.g.,"," ",A.jsx(r.Text,{component:"code",children:"localhost:3000/example-page"}),"). Your content should now be visible!"]})}],d={next:"https://prismic.dev/course/next",nuxt:"https://prismic.dev/course/nuxt",sveltekit:"https://prismic.dev/course/sveltekit"};return{steps:l,defaultCompletedStepIds:l.flatMap(c=>c.defaultCompleted?[c.id]:[]),tutorialLink:t?d[t]:void 0}}function nl(e){const{framework:t}=e;if(!t||t==="other")return{frameworkNameLabel:"",createProjectCodeSnippet:""};const n=uA[t];return{frameworkNameLabel:n?`${n} `:"",createProjectCodeSnippet:gA[t]}}const Rt=3e3,On=400;function Al(e){const{onboardingState:t,tracking:n,onToggleStep:o,onToggleGuide:i,fallback:s=null,stepOverrides:a,repositoryName:l,projectName:d}=e,{context:c,isDismissed:u}=t,{steps:h,defaultCompletedStepIds:g,tutorialLink:m}=tl({...c,repositoryName:l,projectName:d}),C=B(t.completedSteps),y=ol(x,On);if(E.useOnChange(u,()=>!u&&y.reset()),c.framework==="other")return A.jsx(A.Fragment,{children:s});function x(){i()}async function I(j){const S=await o(j.id);S.includes(j.id)&&n.track({event:"shared-onboarding:step-completed",stepId:j.id,stepTitle:j.title,source:n.source}),B(S).length===h.length&&(n.track({event:"shared-onboarding:completed",source:n.source}),y.start())}function B(j){const S=h.map(({id:b})=>b);return Array.from(new Set([...j.filter(b=>S.includes(b)),...g]))}return u?null:A.jsx(r.AnimatedElement,{enterDuration:0,exitDuration:On,children:y.status!=="hidden"&&A.jsxs("div",{ref:y.refs.container,style:{position:"relative"},children:[A.jsx(el,{steps:h,completedSteps:C,tutorialLink:m,tracking:n,onToggleStep:I,onClose:y.status!=="animating"?x:void 0,stepOverrides:a}),A.jsx("div",{ref:y.refs.cannon,style:{position:"absolute",bottom:0,left:0}})]})})}function ol(e,t=400){const n=fr.useConfetti({config:{duration:Rt}}),[o,i]=f.useState("visible"),s=f.useRef(!1),a=f.useCallback(()=>{i("animating"),setTimeout(()=>i("hidden"),Rt-t),s.current||(setTimeout(e,Rt),s.current=!0)},[e,t]),l=()=>{n.throwConfetti(),a()},d=f.useCallback(()=>{i("visible"),s.current=!1},[]);return{refs:{container:n.confettiContainerRef,cannon:n.confettiCannonRef},status:o,start:l,reset:d}}function Uo(e){const{type:t,value:n}=e,o=t===le?He.max:_e.max;return A.jsx(r.Box,{alignItems:"center",children:A.jsx(r.Tooltip,{title:il[t],content:al[t],stableMount:!0,children:A.jsx(r.Badge,{title:`${n.length} characters`,size:"medium",color:n.length>o?"tomato":"green",sx:{alignSelf:"center"}})})})}const il={[le]:"Meta title length",[ue]:"Meta description length"},rl=`${He.min}-${He.max}`,sl=`${_e.min}-${_e.max}`,al={[le]:`For optimal mobile SEO, keep your meta title within ${rl} characters to prevent it from being cut off in search results.`,[ue]:`To ensure your meta description isn’t truncated in mobile search results, aim for ${sl} characters. This helps improve visibility and click-through rates.`};function To(e){const{title:t,description:n}=e;return A.jsx(r.Card,{paddingBlock:8,paddingInline:8,variant:"highlighted",children:A.jsxs(r.CardContent,{gap:4,children:[A.jsx(r.Text,{color:"indigo11",variant:"h4",noSelect:!0,children:Ae.overflow(t,He.max)}),A.jsx(r.Text,{color:"green11",noSelect:!0,children:"https://www.yourdomain.com/"}),A.jsx(r.Text,{variant:"small",color:"grey11",noSelect:!0,children:Ae.overflow(n,_e.max)})]})})}const wo=f.createContext({editedUID:{current:!1},onEditUID:()=>{}});function Lo(e){return Object.values(e.json).some(t=>{var n;return((n=t.uid)==null?void 0:n.type)==="UID"})}function ll(e){const{content:t,customType:n}=e;return Lo(n)&&!t.uid}function vo(e){const{documentId:t,documentsWithUid:n,uid:o}=e;return n.filter(i=>t!==i.id&&dl({document:i,uid:o})&&cl({...e,document:i}))}function cl(e){const{customTypeId:t,languageId:n,document:o}=e,i=t===o.custom_type_id,s=n===o.language.id;return i&&s}function dl(e){const{document:t,uid:n}=e,o=t.versions.filter(i=>i.uid===n);return o.length===0?!0:o.some(i=>i.status!=="archived")}const Be=f.createContext(void 0);function ul(e){const{customTypeFormat:t,children:n}=e,o=f.useMemo(()=>({customTypeFormat:t,isInSlice:!1,isInGroup:!1,isInRepeatable:!1}),[t]);return A.jsx(Be.Provider,{value:o,children:n})}function gl(e){const{children:t}=e,n=f.useContext(Be),o=f.useMemo(()=>n&&{...n,isInSlice:!0},[n]);return A.jsx(Be.Provider,{value:o,children:t})}function hl(e){const{children:t}=e,n=f.useContext(Be),o=f.useMemo(()=>n&&{...n,isInGroup:!0},[n]);return A.jsx(Be.Provider,{value:o,children:t})}function pl(e){const{children:t}=e,n=f.useContext(Be),o=f.useMemo(()=>n&&{...n,isInRepeatable:!0},[n]);return A.jsx(Be.Provider,{value:o,children:t})}function ml(){return f.useContext(Be)}function Tt(e,t){return`${e}___${t}`}const ko=f.createContext({ids:[],isSelected:()=>!1,update:()=>{}});function wt(){return f.useContext(ko)}function Z(e){var t;return(t=e.config)!=null&&t.label?e.config.label:e.type!=="Boolean"&&e.type!=="Separator"&&e.type!=="Table"&&e.fieldset?e.fieldset:e.type}const In="...";function fl(e,t,n=In){var o,i;return(t?(o=e.config)==null?void 0:o.placeholder_true:(i=e.config)==null?void 0:i.placeholder_false)||n}function De(e,t=In){var n;return((n=e.config)==null?void 0:n.placeholder)||t}function Cl(e){var l;const{content:t,field:n,id:o,readOnly:i,onContentChange:s}=e,a=(t==null?void 0:t.value)??((l=n.config)==null?void 0:l.default_value)??!1;return A.jsxs(r.Field,{children:[A.jsx(r.FieldIcon,{name:"biToggle"}),A.jsx(r.FieldLabel,{htmlFor:o,children:Z(n)}),A.jsxs(r.FieldControl,{children:[A.jsx(r.Box,{padding:4,alignItems:"center",children:A.jsx(r.Text,{children:fl(n,a)})}),A.jsx(r.Switch,{id:o,sx:{alignSelf:"center",marginLeft:"auto",marginRight:12},checked:a,onCheckedChange:d=>{i||s(xl(d))}})]})]})}function xl(e){return{__TYPE__:"BooleanContent",value:e}}function yl(e){const{id:t,field:n,content:o,onContentChange:i}=e;return A.jsxs(r.Field,{children:[A.jsx(r.FieldIcon,{name:"colorLens"}),A.jsx(r.FieldLabel,{id:t,children:Z(n)}),A.jsx(r.FieldControl,{children:A.jsx(r.Box,{padding:{left:4},alignItems:"center",children:A.jsx(r.ColorInput,{onValueChange:s=>i(Bl(s)),value:o==null?void 0:o.value,"aria-labelledby":t,placeholder:De(n)})})})]})}function Bl(e){return e===void 0?void 0:{__TYPE__:"FieldContent",type:"Color",value:e}}function Il(e){const{id:t,readOnly:n,field:o,content:i,onContentChange:s}=e,a=i!=null&&i.value?cn.dateFromISOString(i.value):void 0;return A.jsxs(r.Field,{children:[A.jsx(r.FieldIcon,{name:"dateRange"}),A.jsx(r.FieldLabel,{id:t,children:Z(o)}),A.jsx(r.FieldControl,{children:A.jsx(r.Box,{padding:{left:4,right:12},width:"100%",flexDirection:"column",justifyContent:"center",children:A.jsx(r.DateInput,{mode:"date","aria-labelledby":t,disabled:n,value:a,onValueChange:l=>s(jl(l))})})})]})}function jl(e){if(e)return{__TYPE__:"FieldContent",type:"Date",value:Fl(e)}}function Fl(e){const t=`${e.getFullYear()}`.padStart(4,"0"),n=`${e.getMonth()+1}`.padStart(2,"0"),o=`${e.getDate()}`.padStart(2,"0");return`${t}-${n}-${o}`}const Fe=f.forwardRef(function(t,n){const{padding:o=Eo,...i}=t;return A.jsx(r.TextInput,{...i,padding:o,ref:n,sx:{...t.sx,alignSelf:"stretch"}})}),Eo={input:{inline:4},adornment:{inline:12}},Sl=({provider:e})=>bl[e.toLowerCase()]??A.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[A.jsx("g",{clipPath:"url(#clip0_6524_22412)",children:A.jsx("path",{d:"M7.99992 1.33333C4.31992 1.33333 1.33325 4.32 1.33325 8C1.33325 11.68 4.31992 14.6667 7.99992 14.6667C11.6799 14.6667 14.6666 11.68 14.6666 8C14.6666 4.32 11.6799 1.33333 7.99992 1.33333ZM2.66659 8C2.66659 7.59333 2.71992 7.19333 2.80659 6.81333L5.99325 10V10.6667C5.99325 11.4 6.59325 12 7.32658 12V13.2867C4.70658 12.9533 2.66659 10.7133 2.66659 8ZM11.9266 11.6C11.7533 11.06 11.2599 10.6667 10.6599 10.6667H9.99325V8.66667C9.99325 8.3 9.69325 8 9.32658 8H5.32658V6.66667H6.65992C7.02658 6.66667 7.32658 6.36667 7.32658 6V4.66667H8.65992C9.39325 4.66667 9.99325 4.06667 9.99325 3.33333V3.06C11.9466 3.84667 13.3333 5.76667 13.3333 8C13.3333 9.38667 12.7933 10.6533 11.9266 11.6Z",fill:"#6F6E77"})}),A.jsx("defs",{children:A.jsx("clipPath",{id:"clip0_6524_22412",children:A.jsx("rect",{width:"16",height:"16",fill:"white"})})})]}),bl={codepen:A.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[A.jsx("g",{clipPath:"url(#clip0_6523_22409)",children:A.jsx("path",{d:"M15.9879 5.44292C15.9843 5.42352 15.981 5.40413 15.9759 5.38517C15.9726 5.37375 15.9688 5.36298 15.9651 5.35177C15.9597 5.33497 15.9541 5.31816 15.9474 5.30179C15.9427 5.29037 15.9373 5.27938 15.9321 5.26839C15.9248 5.25288 15.9173 5.23758 15.9086 5.22271C15.9026 5.21172 15.8957 5.20138 15.889 5.19082C15.8798 5.1766 15.8703 5.1626 15.8599 5.14902C15.8524 5.13889 15.8446 5.1292 15.8365 5.1195C15.8257 5.10657 15.8141 5.09429 15.8024 5.08223C15.7934 5.07318 15.7843 5.06413 15.7748 5.05529C15.7623 5.04387 15.7494 5.0331 15.7358 5.02276C15.7255 5.01479 15.7154 5.0066 15.7046 4.99927C15.7007 4.99647 15.6973 4.99324 15.6932 4.99065L8.38116 0.115543C8.15039 -0.0385144 7.84939 -0.0385144 7.61863 0.115543L0.306176 4.99044C0.302082 4.99302 0.29885 4.99626 0.294756 4.99906C0.283983 5.0066 0.273856 5.01457 0.263514 5.02254C0.250155 5.0331 0.237011 5.04387 0.224515 5.05486C0.215034 5.06348 0.205985 5.07253 0.19715 5.0818C0.185084 5.09386 0.17388 5.10614 0.162892 5.11907C0.154704 5.12877 0.146947 5.13846 0.139406 5.14924C0.129064 5.16281 0.119583 5.1766 0.110318 5.19104C0.103639 5.20159 0.0969593 5.21194 0.0907108 5.22293C0.0820922 5.23779 0.0745509 5.25309 0.0674405 5.26817C0.0622694 5.27916 0.0566673 5.29037 0.0521425 5.30157C0.0454631 5.31795 0.0396456 5.33475 0.0342589 5.35156C0.030596 5.36276 0.0267177 5.37375 0.0237011 5.38388C0.0187455 5.40284 0.0150825 5.42201 0.0116351 5.44162C0.00969592 5.45153 0.00732581 5.46123 0.00603302 5.47136C0.00215465 5.50109 0 5.53082 0 5.56121V10.4372C0 10.4673 0.00215465 10.4975 0.00646395 10.527C0.00797221 10.5378 0.0107733 10.5464 0.0129279 10.5568C0.0163753 10.5762 0.0193919 10.5955 0.0258558 10.6149C0.0288723 10.6257 0.0323198 10.6365 0.0366291 10.6483C0.0420157 10.6656 0.0474023 10.6828 0.0538662 10.6985C0.058391 10.7093 0.0646395 10.7201 0.0689488 10.7309C0.0760591 10.7459 0.0840314 10.761 0.09265 10.7768C0.098683 10.7875 0.105578 10.7983 0.112042 10.8082C0.121307 10.8233 0.131434 10.8362 0.142207 10.8491C0.149748 10.8599 0.157289 10.8685 0.165908 10.8789C0.176897 10.8918 0.187455 10.9047 0.200382 10.9162C0.209217 10.9248 0.21762 10.9355 0.228393 10.942C0.24089 10.9528 0.254249 10.9636 0.267177 10.9748C0.277519 10.9834 0.288723 10.9898 0.297342 10.9982C0.301436 11.0004 0.303806 11.0047 0.308115 11.0067L7.61863 15.8841C7.73412 15.9617 7.86641 16.0005 8 15.9998C8.13359 15.9992 8.26588 15.9611 8.38137 15.8841L15.6938 11.0092C15.6979 11.0067 15.7014 11.0036 15.7052 11.0008C15.716 10.9933 15.7261 10.9853 15.7365 10.9773C15.7498 10.9668 15.763 10.9558 15.7755 10.9446C15.785 10.9362 15.794 10.9269 15.8031 10.9179C15.8149 10.9058 15.8263 10.8935 15.8371 10.8806C15.8453 10.8709 15.8531 10.8612 15.8606 10.8509C15.8709 10.8373 15.8804 10.8233 15.8897 10.8091C15.8964 10.7987 15.903 10.7882 15.9093 10.7776C15.9179 10.7625 15.9254 10.7472 15.9328 10.7317C15.9379 10.7207 15.9433 10.7097 15.9481 10.6985C15.9548 10.6819 15.9604 10.6651 15.9657 10.6483C15.9694 10.6371 15.9733 10.6261 15.9765 10.6149C15.9815 10.596 15.9849 10.5766 15.9886 10.5572C15.9903 10.5473 15.9929 10.5376 15.994 10.5275C15.9978 10.4977 16 10.468 16 10.4376V5.5625C16 5.53212 15.9976 5.50238 15.994 5.47265C15.9922 5.46209 15.989 5.45347 15.9869 5.44292H15.9879ZM7.99978 9.62638L5.56826 8.00005L7.99978 6.37351L10.4315 8.00005L7.99978 9.62638ZM7.31245 5.17919L4.33171 7.17288L1.92561 5.56336L7.31245 1.97221V5.17919ZM3.09515 7.99984L1.37531 9.15021V6.84947L3.09515 7.99984ZM4.33171 8.82765L7.31245 10.8211V14.0281L1.92561 10.4365L4.33171 8.82722V8.82765ZM8.68733 10.8207L11.6681 8.82722L14.0744 10.4365L8.68733 14.0277V10.8207ZM12.9046 8.00027L14.6247 6.84969V9.15064L12.9046 7.99984V8.00027ZM11.6681 7.17288L8.68733 5.1794V1.97221L14.0744 5.56336L11.6681 7.17288Z",fill:"black"})}),A.jsx("defs",{children:A.jsx("clipPath",{id:"clip0_6523_22409",children:A.jsx("rect",{width:"16",height:"16",fill:"white"})})})]}),codesandbox:A.jsxs("svg",{width:"14",height:"16",viewBox:"0 0 14 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[A.jsx("g",{clipPath:"url(#clip0_6523_22406)",children:A.jsx("path",{d:"M6.24312 14.1129V8.35021L1.28724 5.49888V8.78388L3.55732 10.0999V12.5702L6.24312 14.1129ZM7.53036 14.1468L10.2658 12.571V10.0422L12.5506 8.71812V5.47426L7.53036 8.3727V14.1468ZM11.8904 4.36906L9.25164 2.83995L6.93472 4.18436L4.60022 2.8386L1.93795 4.38817L6.90626 7.24665L11.8904 4.36906ZM0 12.0115V4.02675L6.91821 0L13.8378 4.00984V11.9988L6.91805 15.985L0 12.0115Z",fill:"black"})}),A.jsx("defs",{children:A.jsx("clipPath",{id:"clip0_6523_22406",children:A.jsx("rect",{width:"13.8378",height:"16",fill:"white"})})})]}),dailymotion:A.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[A.jsxs("g",{clipPath:"url(#clip0_6523_22345)",children:[A.jsx("path",{d:"M16 0H0V16H16V0Z",fill:"white"}),A.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.73038 10.3003C8.40789 10.6268 8.00377 10.7901 7.51804 10.7901C7.04025 10.7901 6.64411 10.6308 6.32956 10.3122C6.01503 9.99367 5.85776 9.58351 5.85776 9.08176C5.85776 8.60389 6.01901 8.20766 6.3415 7.89306C6.66401 7.57847 7.06016 7.42118 7.52998 7.42118C7.84849 7.42118 8.13715 7.49484 8.39594 7.64219C8.65474 7.78953 8.8558 7.99063 8.99913 8.2455C9.14246 8.50034 9.21412 8.77908 9.21412 9.08176C9.21412 9.56757 9.05287 9.97376 8.73038 10.3003ZM9.10662 3.58632V6.35792C8.82791 6.07918 8.53131 5.87808 8.21678 5.75463C7.90223 5.63118 7.54988 5.56946 7.1597 5.56946C6.53062 5.56946 5.96527 5.72476 5.4636 6.03538C4.96193 6.34597 4.57176 6.77007 4.29305 7.30768C4.01435 7.84528 3.875 8.44062 3.875 9.09369C3.875 9.76269 4.01236 10.366 4.28708 10.9036C4.5618 11.4412 4.95197 11.8653 5.45763 12.1759C5.96328 12.4865 6.54258 12.6418 7.19553 12.6418C8.14312 12.6418 8.80403 12.3312 9.17831 11.71H9.20218V12.5595H11.0894V3.15625L9.10662 3.58632Z",fill:"#232323"})]}),A.jsx("defs",{children:A.jsx("clipPath",{id:"clip0_6523_22345",children:A.jsx("rect",{width:"16",height:"16",fill:"white"})})})]}),flickr:A.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[A.jsx("rect",{width:"16",height:"16",fill:"white"}),A.jsxs("g",{clipPath:"url(#clip0_6523_22379)",children:[A.jsx("path",{d:"M8.43286 7.78387C8.43286 9.321 9.67925 10.5674 11.2166 10.5674C12.7538 10.5674 13.9999 9.321 13.9999 7.78387C13.9999 6.24675 12.7538 5.00061 11.2166 5.00061C9.67925 5.00061 8.43286 6.24675 8.43286 7.78387Z",fill:"#FF0084"}),A.jsx("path",{d:"M2 7.78408C2 9.32121 3.24614 10.5676 4.78352 10.5676C6.32089 10.5676 7.56703 9.32121 7.56703 7.78408C7.56703 6.24695 6.32089 5.00081 4.78352 5.00081C3.24614 5.00081 2 6.24695 2 7.78408Z",fill:"#0063DC"})]}),A.jsx("defs",{children:A.jsx("clipPath",{id:"clip0_6523_22379",children:A.jsx("rect",{width:"12",height:"5.568",fill:"white",transform:"translate(2 5)"})})})]}),giphy:A.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[A.jsx("rect",{width:"16",height:"16",fill:"#121212"}),A.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4 3.38889V12.2778H5.11111V3.38889H4Z",fill:"#00FF99"}),A.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.6663 5.61111V12.2778H11.7774V5.61111H10.6663Z",fill:"#9933FF"}),A.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.75 3H4V4.11111H8.83333V3H7.75Z",fill:"#FFF35C"}),A.jsx("path",{d:"M9.00041 4.11111H7.33374H8.83374V3.77778L9.00041 4.11111Z",fill:"#999999"}),A.jsx("path",{d:"M8.83374 4.11111H7.33374L8.44485 3L8.83374 3.77778V4.11111Z",fill:"#999237"}),A.jsx("path",{d:"M10.6663 7.44444V5.77778L11.7774 6.33333L10.6663 7.44444Z",fill:"#5C1F99"}),A.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.6667 11.8889H4V13H11.7778V11.8889H10.6667Z",fill:"#00CCFF"}),A.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.6668 5.22222V4.11111H9.55569V3H8.44458V3.90739V5.0185V6.33333H9.55569H10.6668H11.7779V5.22222H10.6668Z",fill:"#FF6666"})]}),instagram:A.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",children:[A.jsxs("g",{clipPath:"url(#clip0_6523_22356)",children:[A.jsx("mask",{id:"mask0_6523_22356",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"16",height:"16",children:A.jsx("path",{d:"M4.70325 0.0949238C3.85627 0.1349 3.27778 0.270564 2.77227 0.468642C2.24897 0.672648 1.80537 0.946046 1.36408 1.38914C0.922279 1.83249 0.650958 2.27688 0.448504 2.8007C0.252489 3.3075 0.119662 3.88627 0.0822604 4.73377C0.045126 5.58283 0.0366102 5.85363 0.0407495 8.01522C0.0448729 10.1765 0.0544124 10.4479 0.0949012 11.2972C0.135388 12.1439 0.270546 12.7222 0.468623 13.2279C0.672886 13.7512 0.946004 14.1946 1.38935 14.6361C1.83245 15.0777 2.27708 15.3487 2.80115 15.5515C3.30744 15.7472 3.88644 15.8806 4.73369 15.9177C5.58273 15.9551 5.85379 15.9634 8.01483 15.9592C10.1769 15.9551 10.448 15.9456 11.297 15.9053C12.144 15.8648 12.722 15.7292 13.228 15.5316C13.7513 15.3268 14.1949 15.0542 14.6362 14.6109C15.0775 14.1678 15.3488 13.7231 15.5512 13.199C15.7473 12.6927 15.8806 12.1137 15.9175 11.267C15.9546 10.4174 15.9634 10.1461 15.9593 7.98478C15.9551 5.8232 15.9453 5.55239 15.9051 4.7036C15.8649 3.85609 15.7292 3.27811 15.5314 2.77208C15.3269 2.24877 15.054 1.80567 14.6109 1.36387C14.1678 0.922574 13.7232 0.650729 13.1991 0.448785C12.6926 0.252768 12.1138 0.119166 11.2666 0.0825425C10.4175 0.0448876 10.1465 0.0366393 7.98465 0.0407642C5.82336 0.0448892 5.5523 0.0541772 4.70325 0.0949238ZM4.79611 14.485C4.02004 14.4512 3.59863 14.3222 3.31776 14.2142C2.94585 14.0703 2.68046 13.8977 2.40114 13.6205C2.12234 13.3422 1.94928 13.0776 1.80408 12.7064C1.69497 12.4255 1.5637 12.0046 1.52734 11.2286C1.48788 10.3896 1.47886 10.1378 1.47498 8.01237C1.47086 5.88742 1.47859 5.63569 1.51522 4.79593C1.54848 4.02038 1.67822 3.59843 1.78602 3.31782C1.92993 2.94539 2.10196 2.68051 2.37973 2.4012C2.65801 2.12187 2.92263 1.94933 3.29402 1.80412C3.57463 1.69451 3.99555 1.56426 4.77134 1.52738C5.61084 1.48766 5.8623 1.47915 7.98723 1.47502C10.1127 1.47089 10.3644 1.47838 11.2042 1.51526C11.9797 1.54904 12.4016 1.67749 12.682 1.78607C13.0541 1.92998 13.3195 2.1015 13.5986 2.37979C13.8777 2.65808 14.0507 2.92218 14.1959 3.29435C14.3055 3.57418 14.4358 3.99562 14.4724 4.77117C14.5124 5.61068 14.5214 5.8624 14.5253 7.98736C14.5294 10.1128 14.5217 10.3646 14.4848 11.2038C14.451 11.9799 14.3223 12.4016 14.214 12.6827C14.0701 13.0543 13.898 13.3197 13.62 13.5991C13.342 13.8773 13.0774 14.0509 12.7057 14.1961C12.4256 14.3055 12.0042 14.436 11.2289 14.4729C10.3894 14.5123 10.1379 14.5214 8.01225 14.5252C5.88732 14.5294 5.63586 14.5214 4.79611 14.485ZM11.2854 3.74493C11.2864 4.27211 11.7151 4.69896 12.2422 4.69792C12.7697 4.69689 13.1965 4.2685 13.1957 3.74132C13.1947 3.21414 12.7661 2.78704 12.2386 2.78807C11.7112 2.7891 11.2844 3.21775 11.2854 3.74493ZM3.91277 8.00773C3.91714 10.2653 5.75063 12.0913 8.0076 12.0869C10.2648 12.0825 12.0919 10.2495 12.0875 7.99201C12.0831 5.73526 10.2494 3.90819 7.99188 3.91257C5.73489 3.91696 3.90837 5.75073 3.91277 8.00773ZM5.34648 8.0049C5.3439 6.53969 6.52978 5.34942 7.99471 5.34683C9.45991 5.344 10.6504 6.52937 10.6533 7.99484C10.6561 9.46031 9.47022 10.6503 8.00477 10.6532C6.53984 10.656 5.34932 9.47037 5.34648 8.0049Z",fill:"white"})}),A.jsxs("g",{mask:"url(#mask0_6523_22356)",children:[A.jsx("mask",{id:"mask1_6523_22356",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"-1",y:"-1",width:"18",height:"18",children:A.jsx("path",{d:"M16.5905 -0.583628H-0.603516V16.6106H16.5905V-0.583628Z",fill:"white"})}),A.jsxs("g",{mask:"url(#mask1_6523_22356)",children:[A.jsx("mask",{id:"mask2_6523_22356",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"-1",y:"-1",width:"18",height:"18",children:A.jsx("path",{d:"M16.6701 -0.663237H-0.683105V16.6902H16.6701V-0.663237Z",fill:"white"})}),A.jsxs("g",{mask:"url(#mask2_6523_22356)",children:[A.jsx("mask",{id:"mask3_6523_22356",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"-1",y:"-1",width:"18",height:"18",children:A.jsx("path",{d:"M16.6701 -0.663237H-0.683105V16.6902H16.6701V-0.663237Z",fill:"white"})}),A.jsx("g",{mask:"url(#mask3_6523_22356)",children:A.jsx("rect",{x:"-0.688721",y:"-0.665792",width:"17.3622",height:"17.3622",fill:"url(#pattern0)"})})]})]})]})]}),A.jsxs("defs",{children:[A.jsx("pattern",{id:"pattern0",patternContentUnits:"objectBoundingBox",width:"1",height:"1",children:A.jsx("use",{xlinkHref:"#image0_6523_22356",transform:"scale(0.000439947)"})}),A.jsx("clipPath",{id:"clip0_6523_22356",children:A.jsx("rect",{width:"16",height:"16",fill:"white"})}),A.jsx("image",{id:"image0_6523_22356",width:"2273",height:"2275",xlinkHref:"data:image/jpeg;base64,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Hbvsfww7d9j+GHbvsfww7d9j+GHbvsfww7d9j+GHbvsfww7d9j+GHbvsfww7d9j+GHbvsfww7d9j+GHbvsfww7d9j+GHbvsfww7d9j+GHbvsfww7d9j+GHbvsfww7d9j+GHbvsfww7d9j+GHbvsfww7d9j+GHbvsfww7d9j+GHbvsfww7d9j+GHbvsfww7d9j+GHbvsfww7d9j+GHbvsfww7d9j+GHbvsfww7d9j+GHbvsfww7d9j+GHbvsfww7d9j+GHbvsfww7d9j+GHbvsfww7d9j+GHbvsfww7d9j+GHbvsfww7d9j+GHbvsfww7d9j+GHbvsfww7d9j+GHbvsfw5h277H8MO3fY/hh277H8MO3fY/hh277H8MO3fY/hh277H8MO3fY/hh277H8MO3fY/hh277H8MO3fY/hh277H8MO3fY/hh277H8MO3fY/hh277H8MO3fY/hh277H8MO3fY/hh277H8MO3fY/hh277H8MO3fY/hh277H8MO3fY/hh277H8MO3fY/hh277H8MO3fY/hh277H8MO3fY/hh277H8MO3fY/hh277H8MO3fY/hh277H8MO3fY/hh277H8MO3fY/hh277H8MO3fY/hh277H8MO3fY/hh277H8MO3XY/hh26jfww7dRv4Yduo38MO3Ub+GHbqN/DDt1G/hh26jfww7dRv4Yduo38MO3Ub+GHbqN/DDt1G/hh26jfww7dRv4Yduo38MO3Ub+GHbqN/DDt1G/hh26jfww7dRv4Yduo38MO3Ub+GHbqN/DDt1G/hh26jfww7dRv4Yduo38MO3Ub+GHbqN/DDt1G/hh26j+GHbqP4Yduo38MO3Ub+GHbqP4Yduo/hh26j+GHbmP4YduY/hh25j+GHbmP4YduY/hh25j+GHbmP4YduY/hh25j+GHbmP4YduY/hh25j+GHbmP4YduY/hh25j+GHbmP4YduY/hh25j+GHbmNh25jYduY2HbmNh25jYduY2HbmNh24jYduI2HbiNh24jYduI2HbiNh24jYduI2HbiNh24jYduI2HbiNh24jYduI2HbiNh24jYduI2HbiNh24jYduI2HbiNh0+Nh0+Jh0+Jh0+Jh0+Jh0+Jh0+Jh0+Jh0+Jh0+Jh0+Jh0+Jh0+Jh0+Jh0+Jh0+Jh0+Jh0+Jh0+Jh0+Jh06Jh06Jh06Jh06Jh06Jh06Jh06Jh06Jh06Jh06Jh06Jh06Jh06Jh06Jh06Jh06Jh06Jh06Jh06Jh06Jh06Jh06Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jhz+j7fweHn/AFd+fp9v6v8Ape79DDf1JLc930/LnmGfj9H0+v7/APAf6c32/wAQ/wCR+n/5f9383/iNaca041pxrTjWnGtONaca041pxrTjWnGtONaca041pxrTjWnGtONaca041pxrTjWnGtONaca041pxrTjWnGtONaca041pxrTjWnGtONaca041pxrTjWnGtONaca041pxrTjWnGtONaca0415xrzjXnGvONeca8415xrzjXnGvONeca8415xrzjXnGvONeca8415xrzjXnGvONeYa8w15hrzDXmGvMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMNeYa8w15hrzDXnGvONeca8415xrzjXnGvONeca041pxrTjWnGtONaca041pxrTjWnGtONacas41ZxqzjVnGrONWcas41ZxqzjVnGrONScak41JxqTjUUGooNRQaig1FBqKDTUGmoNNQaag01BpqDTUGmoNNQaag0lBpKDSUGkoNJQaSg0lBpKDSUGioNFQaKg0VBoqDRVGiqNFUaKo0FRoKjQVGgqNBUaCo0FRoKjQVGgqPXqj16o9eqPXqj16o9eqPXqj16o9eqPXqj1yo9cqPXKj1yo9cqPXLD1yw9csPXLD1yw9csPWrD1qw9asPWrD1qw9asPWrD1qw9asPWrD1qw9YsPWLD1iw9YsPWLD1iw9YsPWLD1iw9YsPWLD1iw9YsPWLD1iw9YsPWLD1iw9YsPWLD1iw9YsPWLD1aw9WsPVrD1aw9WsPVrD1aw9WsPVrD1aw9WsPVrB34/8Ay/z/AH/53yHY/wDU/E/0v+P7/wCz/9k="})]})]}),pinterest:A.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[A.jsxs("g",{clipPath:"url(#clip0_6570_25513)",children:[A.jsx("rect",{width:"15.996",height:"16",rx:"2",fill:"#CC2127"}),A.jsx("path",{d:"M7.999 2C4.68555 2 2 4.68555 2 7.999C2 10.5406 3.58174 12.7102 5.81336 13.5861C5.76137 13.1121 5.71338 12.3843 5.83336 11.8644C5.94134 11.3964 6.53724 8.88285 6.53724 8.88285C6.53724 8.88285 6.35727 8.52291 6.35727 7.993C6.35727 7.15914 6.84119 6.53524 7.44309 6.53524C7.95501 6.53524 8.20297 6.91918 8.20297 7.3811C8.20297 7.89502 7.87502 8.66489 7.70705 9.37877C7.56507 9.97667 8.007 10.4626 8.5949 10.4626C9.66072 10.4626 10.4806 9.33878 10.4806 7.71505C10.4806 6.27929 9.44876 5.27345 7.975 5.27345C6.26729 5.27345 5.26546 6.55324 5.26546 7.87702C5.26546 8.39293 5.46342 8.94484 5.71138 9.24679C5.75937 9.30678 5.76737 9.35877 5.75337 9.41876C5.70738 9.60873 5.6074 10.0167 5.5874 10.0987C5.56141 10.2086 5.50142 10.2326 5.38743 10.1786C4.63756 9.83069 4.16964 8.73488 4.16964 7.85502C4.16964 5.96334 5.54541 4.22563 8.13298 4.22563C10.2146 4.22563 11.8304 5.70938 11.8304 7.69105C11.8304 9.75871 10.5266 11.4224 8.71688 11.4224C8.10898 11.4224 7.53708 11.1065 7.34111 10.7345C7.34111 10.7345 7.04116 11.8804 6.96717 12.1603C6.83119 12.6822 6.46526 13.3341 6.2213 13.732C6.7832 13.906 7.3791 14 7.997 14C11.3104 14 13.996 11.3144 13.996 8.001C13.998 4.68555 11.3124 2 7.999 2Z",fill:"white"})]}),A.jsx("defs",{children:A.jsx("clipPath",{id:"clip0_6570_25513",children:A.jsx("rect",{width:"16",height:"16",fill:"white"})})})]}),spotify:A.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[A.jsx("g",{clipPath:"url(#clip0_6523_22402)",children:A.jsx("path",{d:"M12.6609 7.10585C10.121 5.59751 5.93158 5.45882 3.50697 6.1947C3.11759 6.31287 2.70584 6.09298 2.5879 5.70373C2.46988 5.31411 2.68945 4.90265 3.07911 4.78429C5.86241 3.93945 10.4892 4.1026 13.4132 5.83828C13.7634 6.04622 13.8782 6.49851 13.6707 6.84813C13.4629 7.19833 13.0103 7.31376 12.6609 7.10585ZM12.5777 9.33993C12.3995 9.62908 12.0215 9.71979 11.7327 9.54223C9.61522 8.24063 6.38637 7.86357 3.88123 8.624C3.55636 8.72218 3.21323 8.53899 3.11455 8.21475C3.01666 7.88989 3.19992 7.54738 3.5242 7.44859C6.38597 6.58018 9.9436 7.00081 12.3756 8.49536C12.6644 8.67322 12.7553 9.05146 12.5777 9.33993ZM11.6136 11.4855C11.472 11.7177 11.1697 11.7904 10.9383 11.6489C9.08801 10.518 6.75909 10.2627 4.01637 10.8891C3.75207 10.9497 3.48866 10.7841 3.42838 10.5198C3.36785 10.2556 3.53284 9.99217 3.79772 9.93186C6.79916 9.2457 9.37381 9.54101 11.4506 10.8101C11.6822 10.9515 11.7551 11.254 11.6136 11.4855ZM8.00002 0.120623C3.64839 0.120623 0.120605 3.64834 0.120605 7.99989C0.120605 12.352 3.64839 15.8794 8.00002 15.8794C12.3517 15.8794 15.8794 12.352 15.8794 7.99989C15.8794 3.64834 12.3517 0.120623 8.00002 0.120623Z",fill:"#1ED760"})}),A.jsx("defs",{children:A.jsx("clipPath",{id:"clip0_6523_22402",children:A.jsx("rect",{width:"16",height:"16",fill:"white"})})})]}),twitter:A.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:A.jsx("path",{d:"M14.3193 4.31285C14.329 4.45301 14.329 4.59317 14.329 4.73462C14.329 9.04475 11.0516 14.0156 5.05865 14.0156V14.0131C3.28832 14.0156 1.55478 13.508 0.0644531 12.5507C0.321873 12.5817 0.580582 12.5972 0.839937 12.5979C2.30703 12.5992 3.7322 12.1063 4.88639 11.1988C3.4922 11.1724 2.26961 10.2623 1.84252 8.93366C2.3309 9.02796 2.83413 9.00858 3.31349 8.87746C1.79349 8.57001 0.699937 7.23299 0.699937 5.68023C0.699937 5.66602 0.699937 5.65246 0.699937 5.63889C1.15284 5.89144 1.65994 6.0316 2.17865 6.0471C0.747034 5.08923 0.305743 3.18251 1.17026 1.69176C2.82445 3.7296 5.2651 4.96844 7.8851 5.09956C7.62252 3.96664 7.98123 2.77947 8.82768 1.98307C10.1399 0.748096 12.2038 0.811395 13.4374 2.12452C14.167 1.98048 14.8664 1.71243 15.5064 1.33264C15.2632 2.0877 14.7541 2.72909 14.0741 3.13665C14.7199 3.06044 15.3509 2.88734 15.9451 2.62316C15.5077 3.2794 14.9567 3.85103 14.3193 4.31285Z",fill:"#1D9BF0"})}),vimeo:A.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[A.jsxs("g",{clipPath:"url(#clip0_6523_22340)",children:[A.jsx("path",{d:"M16 14.4C16 15.28 15.28 16 14.4 16H1.6C0.72 16 0 15.28 0 14.4V1.6C0 0.72 0.72 0 1.6 0H14.4C15.28 0 16 0.72 16 1.6V14.4Z",fill:"#1AB7EA"}),A.jsx("path",{d:"M13.9945 5.3084C13.9391 6.42815 13.1229 7.97447 11.5458 9.93402C9.91331 11.9736 8.52987 13 7.40928 13C6.70372 13 6.12267 12.3735 5.63846 11.1338C5.32027 9.98735 4.98824 8.85427 4.67005 7.70786C4.31036 6.46814 3.92299 5.84161 3.50796 5.84161C3.42495 5.84161 3.10676 6.02824 2.56721 6.38816L2 5.68165C2.59488 5.1751 3.17593 4.68187 3.75698 4.17532C4.54554 3.52214 5.14042 3.17555 5.54162 3.13556C6.46853 3.05557 7.04958 3.66877 7.27093 4.97514C7.50612 6.40149 7.67213 7.28129 7.75514 7.62788C8.01799 8.80095 8.32235 9.40081 8.64054 9.40081C8.88956 9.40081 9.26309 9.01423 9.77497 8.2544C10.273 7.49457 10.5497 6.90804 10.5774 6.50813C10.6465 5.85494 10.3837 5.52169 9.77497 5.52169C9.48444 5.52169 9.19392 5.58834 8.88956 5.70831C9.48444 3.84206 10.605 2.94893 12.2652 3.00225C13.4826 3.02891 14.0637 3.80207 13.9945 5.3084Z",fill:"white"})]}),A.jsx("defs",{children:A.jsx("clipPath",{id:"clip0_6523_22340",children:A.jsx("rect",{width:"16",height:"16",fill:"white"})})})]}),youtube:A.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[A.jsx("path",{d:"M15.6656 3.75817C15.4816 3.06609 14.9395 2.5211 14.2511 2.33614C13.0034 2 8 2 8 2C8 2 2.99666 2 1.7489 2.33614C1.06051 2.5211 0.518324 3.06609 0.334339 3.75817C0 5.01251 0 7.62963 0 7.62963C0 7.62963 0 10.2467 0.334339 11.5012C0.518324 12.1932 1.06051 12.7381 1.7489 12.9232C2.99666 13.2593 8 13.2593 8 13.2593C8 13.2593 13.0034 13.2593 14.2511 12.9232C14.9395 12.7381 15.4816 12.1932 15.6656 11.5012C16 10.2467 16 7.62963 16 7.62963C16 7.62963 16 5.01251 15.6656 3.75817Z",fill:"#ED1D24"}),A.jsx("path",{d:"M6.36353 10.0058L10.5453 7.62974L6.36353 5.25349V10.0058Z",fill:"white"})]})};function Do(e){const{debouncedUrl:t,content:n,onContentChange:o,selected:i}=e,s=f.useRef(null),[a,l]=f.useState(!1);E.useOnChange(t,()=>{var c;a&&(l(!1),(c=s.current)==null||c.reset())});function d(){l(!0),o(void 0)}return te.toURL(t)?t===(n==null?void 0:n.embed_url)?A.jsx(zt,{content:n,selected:i}):A.jsx(r.ErrorBoundary,{ref:s,renderError:Kl,onError:d,children:A.jsx(f.Suspense,{fallback:n&&A.jsx(zt,{content:n,selected:i}),children:A.jsx(Ul,{url:t,selected:i,onContentChange:o})})}):null}function Kl(){return A.jsxs(r.Box,{backgroundColor:"grey2",borderRadius:6,padding:16,gap:4,children:[A.jsx(r.Icon,{name:"alert",size:"small",color:"grey11"}),A.jsx(r.Text,{variant:"smallBold",color:"grey11",children:"There is no embed data available."})]})}function zt(e){const{content:t,selected:n}=e,{thumbnail:o,provider:i,author:s,url:a,subtitle:l}=vl(t);return A.jsxs(r.PreviewCard,{selected:n,children:[A.jsx(r.PreviewImage,{src:o.url,aspectRatio:o.aspectRatio}),A.jsxs(r.PreviewContent,{children:[A.jsxs(r.Box,{display:"flex",alignItems:"center",gap:4,children:[A.jsx(Sl,{provider:i}),A.jsx(r.Text,{variant:"smallBold",color:"grey12",noWrap:!0,children:i}),s&&A.jsx(r.Text,{variant:"small",color:"grey11",noWrap:!0,children:s})]}),A.jsx(r.Text,{variant:"smallBold",href:a,children:l})]})]})}function Ul(e){const{url:t,onContentChange:n,selected:o}=e,i=Tl({url:t,onContentChange:n});return A.jsx(zt,{content:i,selected:o})}function Tl(e){const{url:t,onContentChange:n}=e,{embedApiEndpoint:o}=L(),i=R.useRequest(wl,[t,o]),s=E.useStableCallback(n);return f.useEffect(()=>{const a=r.handleEditorFlushSyncError(()=>s(i));return()=>{clearTimeout(a)}},[i,s]),i}function wl(e,t){const n=new URL(t);return n.searchParams.set("url",e),U.request(n,{okType:Ll(e)})}function Ll(e){return p.z.object({type:p.z.string(),version:p.z.string().or(p.z.number()).nullish(),title:p.z.string().nullish(),author_name:p.z.string().nullish(),author_url:p.z.string().nullish(),provider_name:p.z.string().nullish(),provider_url:p.z.string().nullish(),cache_age:p.z.string().or(p.z.number()).nullish(),thumbnail_url:p.z.string().nullish(),thumbnail_width:p.z.number().nullish(),thumbnail_height:p.z.number().nullish(),html:p.z.string().nullish()}).passthrough().transform(t=>{const n={embed_url:e};return{...n,__TYPE__:"EmbedContent",type:t.type,version:t.version,title:t.title,author_name:t.author_name,author_url:t.author_url,provider_name:t.provider_name,provider_url:t.provider_url,cache_age:t.cache_age,thumbnail_url:t.thumbnail_url,thumbnail_width:t.thumbnail_width,thumbnail_height:t.thumbnail_height,html:t.html,all:{...n,...t}}})}function vl(e){let t="";switch(e.type){case"video":t=e.title??"";break;case"photo":t=`View this post${e.provider_name?` on ${e.provider_name}`:""}`;break;default:t=`Open${e.provider_name?` on ${e.provider_name}`:""}`}return{url:e.embed_url,thumbnail:{url:e.thumbnail_url??"",aspectRatio:e.type==="video"?"16:9":"1:1"},provider:e.provider_name??"",author:e.author_name??"",subtitle:t}}function kl(e){const{id:t,readOnly:n,field:o,content:i,onContentChange:s}=e,a=E.useDebounceState({initialState:(i==null?void 0:i.embed_url)??"",startTransition:f.startTransition});function l(d){a.set(d),te.toURL(d)||s(void 0)}return A.jsxs(r.Field,{footer:te.toURL(a.value)&&A.jsx(r.FieldFooter,{children:A.jsx(Do,{debouncedUrl:a.debouncedValue,content:i,onContentChange:s})}),children:[A.jsx(r.FieldIcon,{name:"cloud"}),A.jsx(r.FieldLabel,{htmlFor:t,children:Z(o)}),A.jsx(r.FieldControl,{children:A.jsx(Fe,{id:t,readOnly:n,placeholder:De(o),value:a.value,onValueChange:l,variant:te.toURL(a.value)?"link":"normal",endAdornment:A.jsx(r.Button,{startIcon:"close",color:"grey",size:"small",disabled:!a,onClick:()=>l("")})})})]})}function Ro(e){return!(e.lat>85||e.lat<-85||e.lng>180||e.lng<-180)}function Qt(e){const t=/^.*@(-?\d+.\d+),(-?\d+.\d+).*$/,n=e.match(t);if(!n)return;const o=parseFloat(n[1]??""),i=parseFloat(n[2]??"");if(isNaN(o)||isNaN(i))return;const s={lat:o,lng:i};if(Ro(s))return s}function Vn(e){return e?`${e.lat}, ${e.lng}`:""}function Yn(e){const t=/\(?([\d|.|-]*)[\s+]*,[\s]*([\d|.|-]*)\)?/,n=e.match(t);if(!n)return Qt(e);const o=parseFloat(n[1]??""),i=parseFloat(n[2]??"");if(isNaN(o)||isNaN(i))return Qt(e);const s={lat:o,lng:i};return Ro(s)?s:Qt(e)}function El(e){const{field:t,id:n,readOnly:o,...i}=e,{onValueChange:s,displayedValue:a,onBlur:l,clearValue:d,isValidCoordinates:c}=Dl(i);return A.jsxs(r.Field,{children:[A.jsx(r.FieldIcon,{name:"place"}),A.jsx(r.FieldLabel,{htmlFor:n,children:Z(t)}),A.jsx(r.FieldControl,{children:A.jsx(Fe,{id:n,onValueChange:s,placeholder:In,readOnly:o,value:a,onBlur:l,variant:c?"link":"normal",endAdornment:A.jsx(r.Button,{startIcon:"close",color:"grey",size:"small",disabled:!a,onClick:d})})})]})}function Dl(e){const{content:t,onContentChange:n}=e,o=Vn(t==null?void 0:t.position),[i,s]=f.useState(o);function a(){const c=Yn(i);if(!c)return s(""),n(void 0);const{lat:u,lng:h}=c;s(Vn({lat:u,lng:h})),n({__TYPE__:"GeoPointContent",position:{lat:u,lng:h}})}function l(){s(""),n(void 0)}const d=!!Yn(i);return{displayedValue:i,isValidCoordinates:d,onValueChange:s,onBlur:a,clearValue:l}}function Qo(e){const{fieldLabel:t,imageLabel:n=[]}=e;return A.jsxs(r.CardHeaderTitle,{children:[A.jsx(r.Text,{variant:"bold",noWrap:!0,children:Ae.overflow(t,30)}),n.length!==0&&A.jsx(r.Text,{color:"grey11",noSelect:!0,children:` • ${n.join(" • ")}`})]})}function Mo(e){const{fieldLabel:t,isUpdating:n,readOnly:o,onMediaDialogOpenChange:i}=e;return A.jsxs(A.Fragment,{children:[A.jsx(r.CardHeader,{sx:{flexWrap:"wrap"},children:A.jsx(Qo,{fieldLabel:t})}),A.jsx(r.CardContent,{children:A.jsx(r.Card,{color:"grey2",variant:"dashed",paddingBlock:12,radius:4,sx:{width:"100%"},children:A.jsx(r.CardContent,{children:A.jsxs(r.BlankSlate,{variant:"horizontal",children:[A.jsx(r.BlankSlateIcon,{name:"cloudUpload",lineColor:"purple9",backgroundColor:"purple4",size:"small"}),A.jsx(r.BlankSlateTitle,{children:n?"Preparing your image...":"You haven't selected an image"}),!o&&A.jsx(r.BlankSlateActions,{children:A.jsx(r.Button,{disabled:n,onClick:()=>i(!0),size:"medium",children:"Select image"})})]})})})})]})}const Rl=p.object({id:p.string(),width:p.number(),height:p.number(),urls:p.object({full:p.string(),small:p.string().transform(ea)}),alt_description:p.string().optional(),description:p.string().nullable()}),Ql=p.object({results:p.array(Rl)}).transform(e=>e.results);function qo(e,t){const n=new URL("search/photos",e);return n.searchParams.set("page","1"),n.searchParams.set("per_page","28"),n.searchParams.set("query",t),U.request(n,{okType:Ql})}R.cache.registerFetcherConfig(qo,{cacheCapacity:5,revalidationStrategy:{type:"never"}});function Ml(e,t){const n=f.useRef(),o=L(),i=R.useRequest(qo,[e,t]);return E.useDebounce(t,1e3,()=>{var s;n.current&&t!==n.current&&((s=o.onAnalyticsEvent)==null||s.call(o,"Unsplash Image Searched")),n.current=t}),i}function ql(e){const{onSelectedChange:t}=e,[n,o]=f.useTransition(),i=E.useDebounceState({initialState:"",ms:300,startTransition:o});return A.jsxs(r.Box,{flexDirection:"column",gap:16,width:"100%",position:"relative",children:[A.jsx(r.FormSearchInput,{value:i.value,placeholder:"Search on Unsplash.com",onValueChange:i.set}),A.jsx(r.ErrorBoundary,{renderError:()=>A.jsx(ho,{}),children:A.jsx(f.Suspense,{fallback:A.jsx(Ol,{}),children:A.jsx(Pl,{term:i.debouncedValue,loading:n,onSelectedChange:t})})})]})}function Pl(e){const{term:t,onSelectedChange:n,loading:o}=e,{media:i,toggleSelected:s,selectedImageId:a}=Vl({term:t,onSelectedChange:n});return A.jsxs(A.Fragment,{children:[i.length>0&&A.jsx(Po,{children:i==null?void 0:i.map(l=>{const c=new URL(l.urls.full).searchParams.get("fm")??"jpg";return A.jsx(r.MediaCard,{url:l.urls.small,filename:l.description??"Unsplash Image",selected:a===l.id,onCardClick:()=>s(l),onCheckedChange:()=>s(l),extension:c,kind:"image",width:l.width,height:l.height,loading:o},l.id)})}),i.length===0&&A.jsx(uo,{})]})}function Po(e){const{children:t}=e;return A.jsx(r.ScrollArea,{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(min(100%, 250px), 1fr))",gap:16,padding:2,paddingBottom:16,position:"relative",width:"100%"},children:t})}function Ol(){return A.jsx(Po,{children:O.range(1,24).map(e=>A.jsx(yo,{},e))})}function Vl(e){var c;const{term:t,onSelectedChange:n}=e,{unsplashApiBaseUrl:o}=L(),i=Ml(o,t||"citrus fruit"),s=(c=i==null?void 0:i[0])==null?void 0:c.id,[a,l]=f.useState();f.useEffect(()=>{n==null||n([]),l(void 0)},[s,n]);function d(u){if(u.id===a)return l(void 0),n==null?void 0:n([]);l(u.id),n==null||n([{...u,url:u.urls.full,alt:u.alt_description}])}return{media:i,toggleSelected:d,selectedImageId:a}}function jn(e){const{open:t,onOpenChange:n,onMediaSelected:o,assetType:i}=e,s=L(),a=s.mediaLibrary,[l,d]=f.useState(()=>a?"media":"unsplash"),[c,u]=f.useState(new Set),[h,g]=f.useState([]),m=c.size+h.length,C=R.useFetcherData(ie);f.useEffect(()=>{!t||!a||Ao({config:s,assetType:i})},[t,s,i,a]);function y(b){if(b!=="media"&&b!=="unsplash")throw new Error(`Invalid option ${b}.`);d(b)}function x(b){b||u(new Set),n(b)}const I=ys({assetType:i,mediaDialogOpen:t});function B(){var b;switch(l){case"unsplash":{const v=h[0];if(!v)return;o(v),(b=s.onAnalyticsEvent)==null||b.call(s,"Unsplash Image Added");break}case"media":{const T=C.flatMap(k=>k.items).filter(k=>c.has(k.id))[0];if(!T)return;o(T),I(T.id);break}}}function j(){if(m===0)return"Select a media item to add to the page";if(m>1)return"Only one media item can be added to the page"}const{containerRef:S}=r.useAlert();return A.jsxs(r.Dialog,{open:t,onOpenChange:x,size:{width:"min(calc(100% - 48px), 2000px)",height:"calc(100% - 30px)"},position:"center",onPointerDownOutside:b=>{S&&E.refContainsTarget(S,b.target)&&b.preventDefault()},children:[A.jsx(r.DialogHeader,{icon:"image",title:"Media library"}),A.jsx(r.DialogDescription,{hidden:!0,children:"Select a media item to add to the page"}),A.jsxs(r.DialogOptions,{value:l,onValueChange:y,padding:"small",width:"auto",children:[a&&A.jsx(r.DialogOptionsItem,{value:"media",icon:"photo"}),A.jsx(r.DialogOptionsItem,{value:"unsplash",icon:"unsplash"})]}),A.jsx(r.DialogContent,{children:A.jsx(r.Box,{flexDirection:"column",flexGrow:1,overflow:"hidden",children:A.jsxs(r.Box,{overflow:"hidden",backgroundColor:"grey2",padding:{top:16,inline:16},flexGrow:1,children:[l==="media"&&A.jsx(Ko,{assetType:i,onSelectedChange:u}),l==="unsplash"&&A.jsx(ql,{onSelectedChange:g})]})})}),A.jsxs(r.DialogActions,{children:[A.jsx(r.DialogCancelButton,{}),A.jsx(r.DialogActionButton,{onClick:B,disabled:m!==1,tooltipLabel:j(),children:"Add to page"})]})]})}const Oo=f.forwardRef(function(t,n){const{isMediaDialogOpen:o,selected:i,children:s,onMediaSelected:a,onMediaDialogOpenChange:l}=t;function d(c){a(c),l(!1)}return A.jsxs(r.Card,{ref:n,color:i?"indigo2":"grey2",variant:i?"selected":"dashed",paddingBlock:12,radius:4,children:[s,A.jsx(jn,{open:o,onOpenChange:l,onMediaSelected:d,assetType:"image"})]})});function Vo(e){const{uploadImage:t,children:n,isUploading:o,disabled:i}=e;if(i)return A.jsx(A.Fragment,{children:n});function s(a){if(o)return;const l=a[0];l&&t(l)}return A.jsx(r.FileDropZone,{assetType:"image",maxFiles:1,onFilesSelected:s,overlay:A.jsx(Yl,{isUploading:o}),children:n})}function Yl(e){const{isUploading:t}=e,n=t?"You can't upload while the upload is ongoing":"Drop image to instantly upload";return A.jsx(r.Box,{justifyContent:"center",flexDirection:"column",height:"100%",padding:8,children:A.jsxs(r.BlankSlate,{children:[A.jsx(r.BlankSlateIcon,{name:t?"block":"cloudUpload",lineColor:t?"tomato11":"purple10",backgroundColor:t?"tomato2":"purple3",borderColor:t?"tomato6":"purple6",borderStyle:"dashed",size:"small"}),A.jsx(r.BlankSlateTitle,{size:"regular",children:n})]})})}function Yo(e){const{contentView:t,croppedImage:n}=e,{width:o,height:i,x:s,y:a,zoom:l}=n,d=Hl({origin:t.origin,croppedImage:n});return{...t,width:o,height:i,url:d,edit:{...t.edit,zoom:l,crop:{x:s,y:a}}}}function Wl(e){var c,u,h;const{field:t,content:n,thumbnail:o,croppedImage:i}=e;if(o===Ze)return Wo({content:n,croppedImage:i});const s=K.isImageContent(n),a=(u=(c=t==null?void 0:t.config)==null?void 0:c.thumbnails)==null?void 0:u.find(g=>g.name===o),l=s?(h=n.thumbnails)==null?void 0:h[o]:void 0;if(!a||!l)return n;const d=Yo({contentView:l,croppedImage:i});return d.url===l.url?n:{...n,thumbnails:s?{...n.thumbnails,[o]:d}:void 0}}function Wo(e){const{content:t,croppedImage:n}=e,o=Yo({contentView:t,croppedImage:n});return o.url===t.url?t:{...t,...o}}function Hl(e){const{origin:t,croppedImage:n}=e,{x:o,y:i,width:s,height:a,cropHeight:l,cropWidth:d}=n,c=new URL(t.url),u=t.height!==a||t.width!==s;if(o!==0||i!==0||l!==t.height||d!==t.width){const g=[o,i,d,l].map(Math.round).join(",");c.searchParams.set("rect",g),c.searchParams.set("w",s.toString()),c.searchParams.set("h",a.toString())}return u&&(c.searchParams.set("w",s.toString()),c.searchParams.set("h",a.toString())),c.toString()}function _l(e){const{edit:{crop:{x:t,y:n},zoom:o},width:i,height:s,origin:{width:a,height:l}}=e;let d,c;const u=a/l,h=i/s;return h>=u?(d=a/o,c=d/h):(c=l/o,d=c*h),{x:t,y:n,width:i,height:s,zoom:o,cropWidth:d,cropHeight:c}}function zl(e){const{selectedImage:t,imageCrop:n,setImageCrop:o}=e,{width:i,height:s,zoom:a,cropHeight:l,cropWidth:d}=n,c=t.contentView,u={x:n.x,y:n.y,width:d,height:l},[h,g]=f.useState(),m=(c==null?void 0:c.origin.url)??"",C=!(t!=null&&t.thumbnail.height&&(t!=null&&t.thumbnail.width));function y(S,b){const v=parseInt(b);isNaN(v)||v<=0||!C||o({...n,[S]:v})}function x(S){o({...n,cropWidth:S.width,cropHeight:S.height,x:S.x,y:S.y})}function I(S){o({...n,zoom:S})}function B(){g(at),o({...n,...at})}function j(){c&&(g(at),o({...n,...at,zoom:1,cropWidth:c.width,cropHeight:c.height}))}return A.jsxs(r.Box,{padding:{inline:24,block:16},flexDirection:"column",gap:16,height:"100%",overflowY:"auto",alignItems:"center",children:[A.jsxs(r.Box,{gap:8,height:32,alignItems:"flex-start",width:"100%",children:[A.jsx(r.Tooltip,{content:"Center",children:A.jsx(r.Button,{color:"grey",size:"medium",startIcon:"centerFocusWeak",onClick:B})}),A.jsx(r.Tooltip,{content:"Cover",children:A.jsx(r.Button,{color:"grey",size:"medium",startIcon:"zoomOutMap",onClick:j})}),A.jsx(r.Separator,{orientation:"vertical"}),A.jsx(r.FormInput,{prefix:"W",prefixTooltip:"Width",placeholder:"width",type:"number",size:"medium",value:String(i),onValueChange:S=>y("width",S),sx:{width:100},disabled:!C}),A.jsx(r.FormInput,{prefix:"H",prefixTooltip:"Height",placeholder:"height",type:"number",size:"medium",value:String(s),onValueChange:S=>y("height",S),sx:{width:100},disabled:!C})]}),A.jsx(r.Cropper,{image:m,aspect:i/s,crop:h??{x:0,y:0},onCropChange:g,zoom:a,onZoomChange:I,onCropAreaChange:(S,b)=>x(b),initialCroppedAreaPixels:u}),A.jsx(r.Box,{width:"100%",maxWidth:320,children:A.jsx(r.Slider,{min:1,max:3,step:.01,value:[a],onValueChange:([S])=>I(S??1)})})]})}const at={x:0,y:0};function Nl(e){const{trigger:t,initialImages:n,renderTooltip:o}=e,{open:i,onOpenChange:s,ready:a,option:l,selectedImage:d,croppedImage:c,setCroppedImage:u,setReady:h,setOption:g}=Gl(e);return A.jsxs(r.Dialog,{trigger:t,onAnimationEnd:()=>h(!0),open:i,onOpenChange:s,renderTooltip:o,children:[A.jsx(r.DialogHeader,{icon:"photo",title:"Image editor"}),A.jsx(r.DialogDescription,{hidden:!0,children:"Crop your image to the desired size."}),A.jsx(r.DialogOptions,{value:String(l),onValueChange:m=>g(Number(m)),children:n.map((m,C)=>A.jsx(r.DialogOptionsItem,{value:String(C),icon:"photo",title:m.labels[0]??"Main",subtitle:m.labels[1]??""},m.thumbnail.name))}),d&&A.jsx(r.DialogContent,{children:a&&c&&A.jsx(zl,{selectedImage:d,imageCrop:c,setImageCrop:u},d.thumbnail.name)})]})}function Gl(e){const{initialImages:t,initialOption:n,onClose:o}=e,[i,s]=f.useState(x),[a,l]=f.useState(!1),[d,c]=f.useState(!1),[u,h]=f.useState(n);function g(I){I?(h(n),s(x())):(c(!1),o({option:u,croppedImages:i})),l(I)}const m=t[u],C=i[(m==null?void 0:m.thumbnail.name)??""];function y(I){if(!m)return;const B=m.thumbnail.name;s({...i,[B]:I})}function x(){return t.reduce((I,B)=>(B.contentView&&(I[B.thumbnail.name]=_l(B.contentView)),I),{})}return{open:a,ready:d,option:u,selectedImage:m,croppedImage:C,setCroppedImage:y,setReady:c,setOption:h,onClose:o,onOpenChange:g}}function Zl(e){const{readOnly:t,altText:n,selected:o,onValueChange:i}=e,s=f.useId();return A.jsxs(r.Field,{selected:o,children:[A.jsx(r.FieldLabel,{htmlFor:s,children:"Alt text"}),A.jsx(r.FieldControl,{children:A.jsx(r.Box,{flexGrow:1,height:40,children:A.jsx(Fe,{id:s,placeholder:"Short description for the visually impaired",readOnly:t,value:n,padding:{input:{inline:12}},onValueChange:i})})})]})}function Jl(e){const{fieldLabel:t,imageLabel:n,initialImages:o,page:i,displaySeparator:s=!0,isSVGContentView:a,visibility:l,onClear:d,onCropperDialogClose:c,onMediaDialogOpenChange:u}=e;return A.jsxs(r.Box,{display:"flex",flexDirection:"column",gap:12,children:[A.jsxs(r.Box,{display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:4,children:[A.jsx(Qo,{fieldLabel:t,imageLabel:n}),A.jsxs(r.CardHeaderActions,{sx:{visibility:l},children:[A.jsx(Nl,{trigger:A.jsx(r.Button,{startIcon:"crop",disabled:a,hiddenLabel:"Crop & Resize"}),renderTooltip:h=>A.jsx(r.Tooltip,{content:"Crop & Resize",children:h}),initialImages:o,initialOption:i,onClose:c}),A.jsx(r.Tooltip,{content:"Replace",children:A.jsx(r.Button,{startIcon:"imageSearch",hiddenLabel:"Replace",onClick:()=>u(!0)})}),A.jsx(r.Tooltip,{content:"Clear",children:A.jsx(r.Button,{onClick:d,startIcon:"delete",hiddenLabel:"Clear"})})]})]}),s&&A.jsx(r.Separator,{style:"dashed",decorative:!0})]})}function ve(e){const{description:t,largeIconName:n="public",loading:o,error:i,onEdit:s,onUnlink:a}=e,l=i?A.jsx(nc,{}):A.jsx(tc,{...e,largeIconName:n,loading:o});return A.jsx(r.Card,{sx:{width:420},children:A.jsxs(r.CardContent,{gap:12,children:[A.jsxs(r.Box,{display:"grid",gridTemplateColumns:"max-content 1fr min-content",gridTemplateRows:"1fr",gap:8,children:[l,A.jsxs(r.ButtonGroup,{size:"medium",color:"grey",sx:{justifySelf:"end"},children:[s&&A.jsx(r.Button,{startIcon:"edit",onClick:s}),a&&A.jsx(r.Button,{startIcon:"linkOff",onClick:a})]})]}),!i&&A.jsx(ec,{description:t,loading:o})]})})}function Xl(e){const{url:t,title:n,loading:o}=e;return o?A.jsx(Ho,{height:16,width:80}):n?A.jsx(r.Text,{variant:"smallBold",href:t==null?void 0:t.toString(),children:n}):null}function $l(e){const{subTitle:t,loading:n}=e;return n?A.jsx(r.Box,{padding:{block:2},children:A.jsx(Ho,{height:12,width:60})}):t?A.jsx(r.Text,{variant:"small",color:"grey11",noWrap:!0,children:t}):null}function ec(e){const{description:t,loading:n}=e;return!t||n?null:A.jsx(r.Text,{variant:"small",color:"grey11",children:t})}function tc(e){const{largeIconName:t,title:n,url:o,loading:i,subTitle:s}=e;return A.jsxs(A.Fragment,{children:[A.jsx(r.ConjoinedIcons,{largeIconName:t,smallIconName:"link"}),A.jsxs(r.Box,{flexDirection:"column",minWidth:0,children:[A.jsx(Xl,{title:n,url:o,loading:i}),A.jsx($l,{subTitle:s,loading:i})]})]})}function nc(){return A.jsxs(r.Box,{alignItems:"center",gap:8,children:[A.jsx(r.BackgroundIcon,{name:"alert",color:"tomato",size:"small"}),A.jsx(r.Text,{color:"tomato11",children:"Failed to load linked document data"})]})}function Ho(e){const{width:t,height:n}=e;return A.jsx(r.Skeleton,{color:"grey5",borderRadius:6,width:t,height:n})}function Wn(){const e=L();e.searchDocuments||V("searchDocuments");const{coreApiBaseUrl:t,authStrategy:n}=e,o=R.useRequest(St,[t,n]);return new Set(o.languages.map(i=>({id:i.id,label:i.label})))}function Ac(){const e=L();e.searchDocuments||V("searchDocuments");const{coreApiBaseUrl:t,authStrategy:n}=e,o=R.useRequest(qA,[t,n]);return new Set(o.results.map(i=>({id:i,label:i})))}function _o(){const e=L();e.searchDocuments||V("searchDocuments");const{customTypesApiBaseUrl:t,repository:n,authStrategy:o}=e,i=un({baseUrl:t,repository:n,authStrategy:o});return new Set(i.data)}function oc(e){const{documentTypeId:t,documentUrl:n,title:o,statusColor:i,description:s,tags:a,tagsFilter:l,previewImageUrl:d,highlighted:c,highlightedUID:u,searchTerm:h,onSelect:g}=e;function m(C){return C.nativeEvent instanceof MouseEvent&&(C.metaKey||C.ctrlKey)?window.open(n,"_blank"):g()}return A.jsxs(r.Card,{paddingBlock:16,onSelect:m,variant:c?"highlighted":void 0,color:c?"purple2":void 0,sx:{marginBlock:c?4:0,marginInline:4,flexShrink:0},children:[A.jsx(r.CardContent,{children:A.jsxs(r.Box,{justifyContent:"space-between",gap:6,children:[A.jsxs(r.Box,{flexDirection:"column",gap:4,alignItems:"flex-start",flexGrow:1,children:[A.jsx(ic,{documentTypeId:t}),A.jsx(sc,{title:o,statusColor:i,searchTerm:h}),u&&h&&A.jsx(dc,{uid:u,searchTerm:h}),A.jsx(ac,{description:s})]}),A.jsx(lc,{previewImageUrl:d})]})}),a.length>0&&A.jsx(cc,{tags:a,tagsFilter:l})]})}function ic(e){const{documentTypeId:t}=e;return A.jsx(r.ErrorBoundary,{renderError:()=>A.jsx(r.Badge,{maxWidth:150,size:"medium",title:"Type: error",icon:"description"}),children:A.jsx(f.Suspense,{fallback:A.jsx(r.Skeleton,{width:150,height:24}),children:A.jsx(rc,{documentTypeId:t})})})}function rc(e){const{documentTypeId:t}=e,o=[..._o()].find(i=>i.id===t);return A.jsx(r.Badge,{size:"medium",title:`Type: ${(o==null?void 0:o.label)??"Unknown"}`,icon:"description"})}function sc(e){const{title:t,statusColor:n,searchTerm:o}=e;return A.jsxs(r.Box,{gap:8,alignItems:"center",children:[A.jsx(r.Dot,{color:n}),A.jsx(zo,{text:t,highlight:o})]})}function ac(e){const{description:t}=e,n=t==null?void 0:t.substring(0,150);return n?A.jsx(r.Text,{variant:"small",color:"grey11",children:`${n}${n!==t?"...":""}`}):A.jsx(r.Text,{variant:"smallItalic",color:"grey11",children:"No description available"})}function lc(e){const{previewImageUrl:t}=e;return A.jsx(r.Box,{width:142,height:90,backgroundColor:"grey2",border:!0,borderRadius:6,flexDirection:"column",alignItems:"center",justifyContent:"center",gap:4,flexShrink:0,padding:8,children:t?A.jsx(r.Image,{src:t,sizing:"cover"}):A.jsxs(A.Fragment,{children:[A.jsx(r.Icon,{name:"hideImage",size:"large",color:"grey11"}),A.jsx(r.Text,{color:"grey11",variant:"small",children:"No preview available"})]})})}function cc(e){const{tags:t}=e;return A.jsxs(r.CardFooter,{children:[A.jsxs(r.Box,{gap:4,alignItems:"center",children:[A.jsx(r.Icon,{name:"label",size:"small",color:"grey11"}),A.jsx(r.Text,{variant:"small",color:"grey11",children:"Tags:"})]}),A.jsx(r.TextOverflow,{children:t.map(n=>A.jsx(r.Badge,{size:"medium",title:n,sx:{marginRight:8}},n))})]})}function dc(e){const{uid:t,searchTerm:n}=e;return A.jsxs(r.Box,{alignItems:"flex-start",children:[A.jsx(r.Icon,{name:"tag",color:"green11",sx:{width:12,height:12}}),A.jsx(zo,{variant:"uid",highlight:n,text:t})]})}function zo(e){const{text:t,highlight:n,variant:o="title"}=e,i=uc[o],s=n?t.split(new RegExp(`(${Ae.escapeStringRegexp(n)})`,"gi")):[t];return A.jsx(r.Text,{variant:i.textVariants.text,color:i.colors.text,hyphens:!0,overflowWrap:"anywhere",children:s.map((a,l)=>a.toLowerCase()===(n==null?void 0:n.toLowerCase())?A.jsx(r.Text,{variant:i.textVariants.highlight,hyphens:!0,overflowWrap:"anywhere",highlight:!0,highlightColor:i.colors.highlight,highlightBorderRadius:2,color:i.colors.highlightText,children:a},l):a)})}const uc={title:{colors:{text:void 0,highlight:void 0,highlightText:"purple11"},textVariants:{text:"bold",highlight:"bold"}},uid:{colors:{text:"green11",highlight:"green3",highlightText:"green11"},textVariants:{text:"extraSmall",highlight:"extraSmall"}}};function gc(e){const{searchTerm:t,tagsFilter:n,typesFilter:o,localesFilter:i}=e,s=L();s.searchDocuments||V("searchDocuments");const{storageVersion:a}=R.useRequest(St,[s.coreApiBaseUrl,s.authStrategy]);s.searchDocuments||V("searchDocuments");const{status:l}=s,{data:d}=oe.useSuspenseQuery({...DA({searchTerm:t,tags:[...ee.map(n,c=>c.id)],customTypes:[...ee.map(o,c=>c.id)],locale:[...ee.map(i,c=>c.id)][0]??"",status:Vt[l],storageVersion:a,config:s}),select:c=>hc(c.results,Vt[l]),staleTime:300});return{documents:d.results}}function hc(e,t){return{results:e.flatMap(o=>{const s=o.versions.filter(a=>t.includes(a.status));return s.length===0?[]:{...o,versions:s}})}}function pc(e,t){const n=L(),o=E.useDebounceState({initialState:""}),[i,s]=f.useState(new Set),[a,l]=f.useState(new Set);function d(){return!n.searchDocuments||!n.localeId?new Set:new Set([{id:n.localeId,label:n.localeId}])}const[c,u]=f.useState(d),h=ee.union(a,ht(e)),g=ee.union(i,ht(t));return{searchTerm:o,filteredTags:i,setFilteredTags:s,filteredCustomTypes:a,setFilteredCustomTypes:l,filteredLocales:c,setFilteredLocales:u,typesFilter:h,tagsFilter:g}}function ht(e){return e?ee.map(e,t=>({id:t,label:t})):new Set}function mc(e){const{filteredLocales:t,setFilteredLocales:n,filteredTags:o,setFilteredTags:i,filteredCustomTypes:s,setFilteredCustomTypes:a,fixedTags:l,fixedCustomTypes:d}=e;return A.jsxs(A.Fragment,{children:[A.jsx(Cc,{selectedValues:t,onSelectedValuesChange:n}),A.jsx(Nt,{selectedValues:o,fixedSelectedValues:ht(l),onSelectedValuesChange:i,label:"Tags",icon:"label",fetchFilters:Ac}),A.jsx(Nt,{selectedValues:s,fixedSelectedValues:ht(d),onSelectedValuesChange:a,label:"Type",icon:"description",fetchFilters:_o})]})}function Nt(e){const[t,n]=f.useState(!1),o=f.useRef(null);return A.jsx(r.ErrorBoundary,{ref:o,renderError:()=>{var i;return A.jsx(r.FilterField,{mode:"error",onErrorRetry:(i=o.current)==null?void 0:i.reset,open:t,setOpen:n,values:new Set,...e})},children:A.jsx(f.Suspense,{fallback:A.jsx(r.FilterField,{mode:"loading",open:t,setOpen:n,values:new Set,...e}),children:A.jsx(fc,{open:t,setOpen:n,...e})})})}function fc(e){const{open:t,setOpen:n,onSelectedValuesChange:o,fixedSelectedValues:i,selectedValues:s,label:a,icon:l,fetchFilters:d,multiple:c}=e,u=d();return A.jsx(r.FilterField,{open:t,setOpen:n,label:a,icon:l,selectedValues:s,values:new Set(u),fixedSelectedValues:i,onSelectedValuesChange:o,multiple:c})}function Cc(e){const{selectedValues:t,onSelectedValuesChange:n}=e,[o,i]=f.useState(ee.first(t));function s(l){n(l),i(ee.first(l))}const a=ee.find(Wn(),l=>{var d;return l.id===((d=ee.first(t))==null?void 0:d.id)});return(a==null?void 0:a.label)!==(o==null?void 0:o.label)&&i(a),A.jsx(Nt,{selectedValues:new Set(o?[o]:[]),onSelectedValuesChange:s,label:"Locale",icon:"public",fetchFilters:Wn,multiple:!1})}function No(e){const{onSelectDocument:t,fixedCustomTypes:n,fixedTags:o,linkedDocumentId:i,...s}=e,a=L(),{searchTerm:l,filteredTags:d,setFilteredTags:c,filteredCustomTypes:u,setFilteredCustomTypes:h,filteredLocales:g,setFilteredLocales:m,typesFilter:C,tagsFilter:y}=pc(n,o);return A.jsxs(r.Dialog,{size:{height:727,width:656},hasClose:!1,...s,children:[A.jsx(r.DialogTitle,{hidden:!0,children:"Link to a page"}),A.jsx(r.DialogDescription,{hidden:!0,children:"Search and select a page to link to"}),A.jsx(r.DialogContent,{children:A.jsxs(r.Box,{flexDirection:"column",height:"100%",children:[A.jsxs(r.Box,{padding:{top:16,inline:16,bottom:8},flexDirection:"column",gap:12,children:[A.jsx(r.FormInput,{value:l.value,onValueChange:l.set,placeholder:"Search a page",icon:"search"}),a.searchDocuments&&A.jsx(mc,{filteredTags:d,setFilteredTags:c,filteredCustomTypes:u,setFilteredCustomTypes:h,filteredLocales:g,setFilteredLocales:m,fixedTags:o,fixedCustomTypes:n})]}),a.searchDocuments?A.jsx(xc,{searchTerm:l.debouncedValue,tagsFilter:y,typesFilter:C,localesFilter:g,onSelectDocument:t,linkedDocumentId:i}):A.jsx(Zo,{title:"Oops!",message:"Slice Machine does not yet support mock data for linked documents in the simulator."})]})})]})}function xc(e){const{searchTerm:t,tagsFilter:n,typesFilter:o,localesFilter:i,linkedDocumentId:s,onSelectDocument:a}=e;return A.jsxs(r.ScrollArea,{style:{flexGrow:1,paddingBottom:r.theme.space[16],paddingInline:r.theme.space[12],display:"flex",flexDirection:"column"},children:[s&&A.jsxs(A.Fragment,{children:[A.jsx(_n,{children:"Linked page"}),A.jsx(r.ErrorBoundary,{renderError:()=>A.jsx(Hn,{description:"An error occurred while fetching the linked page."}),children:A.jsx(f.Suspense,{fallback:Sc,children:A.jsx(Ic,{linkedDocumentId:s,tagsFilter:n,onSelectDocument:a})})})]}),A.jsx(_n,{children:"Link to a page"}),A.jsx(r.ErrorBoundary,{renderError:()=>A.jsx(Hn,{description:"An error occurred while fetching pages."}),children:A.jsx(f.Suspense,{fallback:Bc,children:A.jsx(yc,{searchTerm:t,tagsFilter:n,localesFilter:i,typesFilter:o,linkedDocumentId:s,onSelectDocument:a})})})]})}function yc(e){const{searchTerm:t,tagsFilter:n,localesFilter:o,typesFilter:i,linkedDocumentId:s,onSelectDocument:a}=e,{documents:l}=gc({searchTerm:t,tagsFilter:n,localesFilter:o,typesFilter:i}),d=l.filter(c=>c.id!==s);return d.length===0?A.jsx(Zo,{title:l.length===1?"No other pages found!":void 0}):A.jsx(r.Box,{flexDirection:"column",gap:12,children:d.map(c=>{const u=c==null?void 0:c.versions[0];return u?A.jsx(Go,{document:c,version:u,tagsFilter:n,searchTerm:t,onSelectDocument:a},`${c.id}-${u.status}`):null})})}const Bc=A.jsx(r.Box,{flexDirection:"column",gap:12,children:O.range(1,3).map(e=>A.jsx(r.Skeleton,{height:124,sx:{marginInline:4},zIndex:-1},e))});function Hn(e){const{description:t}=e;return A.jsx(r.Box,{flexDirection:"column",alignItems:"center",justifyContent:"center",children:A.jsx(r.DefaultErrorMessage,{title:"Request failed",description:t,errorImageSrc:r.dialogErrorImage})})}function Ic(e){const{linkedDocumentId:t,tagsFilter:n,onSelectDocument:o}=e,i=bc(t),s=jc(i);return A.jsx(Go,{document:i,version:s,tagsFilter:n,onSelectDocument:o,highlighted:!0})}function jc(e){return f.useMemo(()=>Fc(e),[e])}function Fc(e){return O.sort(e.versions,t=>t.status==="unclassified"||t.status==="published"?-1:0,t=>t.status==="release"?-1:0,t=>-t.last_modified_date.getTime())[0]}const Sc=A.jsx(r.Skeleton,{height:124,sx:{marginBlock:4,marginInline:4},zIndex:-1});function bc(e){const t=L();t.searchDocuments||V("searchDocuments");const{coreApiBaseUrl:n,authStrategy:o}=t;return R.useRequest(et,[n,o,e])}function Go(e){var g;const{document:t,version:n,tagsFilter:o,highlighted:i,onSelectDocument:s,searchTerm:a}=e,l=L();if(!t||!n)return null;const d=dn({documentId:t.id,versionId:n.status==="archived"?n.version_id:void 0,releaseId:n.status==="release"?n.release_id:void 0,status:n.status,baseUrl:l.baseUrl}),c=Kc({tags:n.tags,tagsFilter:o}),u=Wt(n)&&n.summary||UA(n)&&n.preview_summary||"",h=Wt(n)?(g=n.highlights)==null?void 0:g.uid:void 0;return A.jsx(oc,{documentTypeId:t.custom_type_id,documentUrl:d,description:u,tags:c,title:t.title,previewImageUrl:n.preview_image,onSelect:()=>s(t.id),statusColor:fA[n.status].color,highlighted:i,highlightedUID:h,searchTerm:a})}function _n(e){const{children:t}=e;return A.jsx(r.Box,{position:"sticky",top:0,backgroundColor:"white",padding:{block:6,inline:4},children:A.jsx(r.Text,{variant:"smallBold",color:"grey11",children:t})})}function Zo(e){const{title:t="No pages found!",message:n="Consider using different keywords or tweaking your filters to find what you need."}=e;return A.jsx(r.Box,{justifyContent:"center",flexDirection:"column",height:"100%",children:A.jsxs(r.BlankSlate,{children:[A.jsx(r.BlankSlateIcon,{name:"close",lineColor:"tomato11",backgroundColor:"tomato4",size:48}),A.jsx(r.BlankSlateTitle,{size:"big",children:t}),A.jsx(r.BlankSlateDescription,{width:360,children:n})]})})}function Kc(e){const{tags:t,tagsFilter:n}=e,o=[...n].map(s=>s.label).reverse();return O.sort(t,s=>-o.indexOf(s))}function Jo(e){const{hasLink:t,onUnlink:n,selectEnabled:o,selectedType:i,value:s,onOpenLinkModal:a,onValueChange:l,openInNewTab:d=!0,condensedButtons:c=!1,showNewTabButton:u=!1,displayTextEnabled:h,variants:g,variant:m,onVariantChange:C}=e;return A.jsxs(A.Fragment,{children:[!h&&u&&d&&A.jsx(r.Badge,{title:"Open in a new tab",color:"indigo",size:"small",icon:"openInNew",onClick:a}),!t&&o&&A.jsxs(r.Select,{value:i==="any"?void 0:i,color:"grey",size:"small",boldTriggerText:!0,position:"popper",sideOffset:4,startIcon:We({selectType:i}),disabled:!o,onValueChange:l,placeholder:c?"":Pe("any"),onlyStartIcon:c&&i!==void 0,renderTrigger:({button:y})=>A.jsx(r.Tooltip,{content:Pe(i),visible:c,children:y}),children:[A.jsx(r.SelectItem,{value:"web",icon:"public",children:Pe("web")}),A.jsx(r.SelectItem,{value:"document",icon:"description",children:Pe("document")}),A.jsx(r.SelectItem,{value:"media",icon:"image",children:Pe("media")})]},i===void 0?"unlinked":"linked"),!t&&!o&&A.jsx(r.Button,{startIcon:We({selectType:i}),color:"grey",textColor:"link",textWeight:"normal",size:"small",onClick:a,children:Pe(i)}),t&&!h&&A.jsx(r.Button,{startIcon:"close",color:"grey",size:"small",onClick:n,"aria-label":"Close"}),t&&h&&A.jsxs(r.ButtonGroup,{density:"compact",children:[A.jsx(r.Button,{startIcon:We({selectType:i}),renderEndIcon:()=>d&&i==="web"?A.jsx(r.Icon,{name:"openInNew",size:"extraSmall",color:"indigo11"}):null,color:"grey",textColor:"link",textWeight:"normal",size:"small",disabled:!t,onClick:a,children:s.length>30?`${s.slice(0,30)}...`:s}),A.jsx(r.Button,{startIcon:"close",color:"grey",size:"small",onClick:n})]}),g.length>1&&A.jsx(r.Select,{value:m,color:"grey",size:"small",boldTriggerText:!0,position:"popper",sideOffset:4,startIcon:"colorLens",onValueChange:C,children:g.map((y,x)=>A.jsx(r.SelectItem,{value:y,children:y},`${y}-${x}`))})]})}function Pe(e){if(!e||e==="any")return"Choose link type";switch(e){case"document":return"Link to Prismic page";case"web":return"Link to web page";case"media":return"Link to media"}}function Xo(e){const{onEdit:t,onUnlink:n,url:o,title:i,subTitle:s}=e,[a,l]=f.useState(null);return A.jsx(r.Card,{paddingBlock:16,ref:l,children:A.jsxs(r.CardContent,{children:[A.jsx(Tc,{url:o,title:i,subTitle:s,onEdit:t,onUnlink:n,container:a}),o&&A.jsx(r.CheckerBoard,{children:A.jsx(Uc,{children:A.jsx(r.Image,{src:o,alt:i,sizing:"contain"})})})]})})}function Uc(e){const{children:t}=e;return A.jsx(r.Box,{flexDirection:"column",alignItems:"center",justifyContent:"center",position:"relative",height:327,children:t})}function Tc(e){const{url:t,title:n,subTitle:o,onEdit:i,onUnlink:s,container:a}=e;return A.jsxs(r.Box,{flexDirection:"row",justifyContent:"space-between",gap:8,children:[A.jsxs(r.Box,{gap:8,minWidth:0,children:[A.jsx(r.ConjoinedIcons,{largeIconName:"image",smallIconName:"link"}),A.jsxs(r.Box,{flexDirection:"column",minWidth:0,children:[A.jsx(r.Text,{noWrap:!0,variant:"smallBold",href:t,inline:!0,children:n}),A.jsx(r.Text,{variant:"small",color:"grey11",children:o})]})]}),A.jsxs(r.ButtonGroup,{size:"medium",color:"grey",children:[i&&A.jsx(r.Tooltip,{content:"Edit link",side:"top",container:a,children:A.jsx(r.Button,{startIcon:"edit",onClick:i})}),s&&A.jsx(r.Tooltip,{content:"Remove link",side:"top",container:a,children:A.jsx(r.Button,{startIcon:"linkOff",onClick:s})})]})]})}function wc(e){var he,Qe,Me;const{field:t,content:n,onContentChange:o}=e,i=B(),s=((he=t.config)==null?void 0:he.allowText)??!1,a=s&&(n==null?void 0:n.value.text)||void 0,l=((Qe=t.config)==null?void 0:Qe.variants)??[],c=(n==null?void 0:n.value.variant)&&l.includes(n==null?void 0:n.value.variant)?n==null?void 0:n.value.variant:l[0],[u,h]=f.useState(I),g=K.FilledExternalLinkContent.is(n==null?void 0:n.value)&&(n==null?void 0:n.value.target)||void 0,[m,C]=f.useState(!1),y=f.useRef(null);E.useOnChange(i,_);const x=u?Lc[u]:void 0;function I(){var D,Q;return!((D=t.config)!=null&&D.select)||n!=null&&n.value.__TYPE__?n==null?void 0:n.value.__TYPE__:zn[(Q=t.config)==null?void 0:Q.select]}function B(){return n?K.FilledDocumentLinkContent.is(n.value)?n.value.id:K.FilledExternalLinkContent.is(n.value)?n.value.url:K.FilledFileLinkContent.is(n.value)||K.FilledImageLinkContent.is(n.value)?n.value.name:"":""}function j(D){var pe;const{displayText:Q,variant:z}=D;if(!Q&&!z)return o(void 0);switch((pe=t.config)==null?void 0:pe.select){case"web":return o({__TYPE__:"LinkContent",key:Oe(n),value:{__TYPE__:"ExternalLink",kind:"web",...Q&&{text:Q},...z&&{variant:z}}});case"document":return o({__TYPE__:"LinkContent",key:Oe(n),value:{__TYPE__:"DocumentLink",kind:"document",...Q&&{text:Q},...z&&{variant:z}}});case"media":return o({__TYPE__:"LinkContent",key:Oe(n),value:{__TYPE__:"MediaLink",kind:"media",...Q&&{text:Q},...z&&{variant:z}}});default:return o({__TYPE__:"LinkContent",key:Oe(n),value:{__TYPE__:"AnyLink",kind:"any",...Q&&{text:Q},...z&&{variant:z}}})}}function S(D,Q){if(!D)return j({displayText:a,variant:c});const{newTab:z=!1}=Q??{},pe=z?"_blank":void 0;switch(u){case"ExternalLink":return o({__TYPE__:"LinkContent",key:Oe(n),value:{__TYPE__:"ExternalLink",url:D,target:pe,...a&&{text:a},...c&&{variant:c}}});case"DocumentLink":return o({__TYPE__:"LinkContent",key:Oe(n),value:{__TYPE__:"DocumentLink",id:D,...a&&{text:a},...c&&{variant:c}}});default:return o(void 0)}}function b(D){return n?o({__TYPE__:n.__TYPE__,key:n.key,value:{...n.value,text:D}}):j({displayText:D})}function v(D){return n?o({__TYPE__:n.__TYPE__,key:n.key,value:{...n.value,variant:D}}):j({variant:D})}const F=kc();function T(D){h(D?zn[D]:void 0),S(""),D&&D!=="any"&&F(D)}function k(D){S(D)}function M(){C(!0)}function _(){var D;m&&(C(!1),(D=y.current)==null||D.reset())}function ge(D){const Q=$o({media:D});switch(Q.value.__TYPE__){case"ImageLink":return o({__TYPE__:Q.__TYPE__,key:Q.key,value:{...Q.value,...a&&{text:a},...c&&{variant:c}}});case"FileLink":return o({__TYPE__:Q.__TYPE__,key:Q.key,value:{...Q.value,...a&&{text:a},...c&&{variant:c}}})}}return{contentType:u,selectType:x,fieldValue:i,onDisplayTextChange:b,onValueChange:S,onTypeChange:T,placeholder:De(t),isTypeSelectEnabled:!((Me=t.config)!=null&&Me.select),onDocumentSelected:k,onError:M,errorBoundaryRef:y,isTargetNewTab:g==="_blank",onMediaSelected:ge,displayTextEnabled:s,displayText:a??"",variants:l,variant:c,onVariantChange:v}}function Oe(e){return e?e.key:crypto.randomUUID()}const Lc={AnyLink:"any",DocumentLink:"document",ExternalLink:"web",FileLink:"media",ImageLink:"media",MediaLink:"media"},zn={any:"AnyLink",document:"DocumentLink",web:"ExternalLink",media:"FileLink"};function vc(e){const t=L();t.searchDocuments||V("searchDocuments");const{coreApiBaseUrl:n,authStrategy:o}=t;return R.useRequest(et,[n,o,e]).title}R.cache.registerFetcherConfig(et,{concurrency:50});function $o(e){var i,s,a,l,d,c;const{media:t}=e,n="kind"in t;return n&&t.kind==="image"?{__TYPE__:"LinkContent",key:crypto.randomUUID(),value:{__TYPE__:"ImageLink",id:t.id,name:t.filename,url:t.url,kind:"image",size:t.size.toString(),height:((i=t.height)==null?void 0:i.toString())??`${ye}`,width:((s=t.width)==null?void 0:s.toString())??`${ye}`,date:((a=t.last_modified)==null?void 0:a.toString())??""}}:n?{__TYPE__:"LinkContent",key:crypto.randomUUID(),value:{__TYPE__:"FileLink",id:t.id,name:t.filename,kind:"file",url:t.url,size:t.size.toString(),date:((l=t.last_modified)==null?void 0:l.toString())??""}}:{__TYPE__:"LinkContent",key:crypto.randomUUID(),value:{__TYPE__:"ImageLink",id:t.id,name:(t==null?void 0:t.alt)??t.url,kind:"image",url:t.url,size:"0",height:((d=t.height)==null?void 0:d.toString())??`${ye}`,width:((c=t.width)==null?void 0:c.toString())??`${ye}`}}}const kc=()=>{const e=ml(),{onAnalyticsEvent:t}=L();function n(o){e&&t&&t("Generic Link Added",{type:o,isInSlice:String(e.isInSlice),isInGroup:String(e.isInGroup),isInRepeatable:String(e.isInRepeatable),customTypeFormat:e.customTypeFormat??"custom"})}return n};function Ec(e){const{open:t,onOpenChange:n,showNewTabButton:o}=e,{url:i,setUrl:s,openInNewTab:a,setOpenInNewTab:l,disabled:d,onUpdate:c}=Dc(e);return A.jsxs(r.Dialog,{open:t,onOpenChange:n,size:"small",noDescription:!0,children:[A.jsx(r.DialogHeader,{title:"Set Link URL"}),A.jsxs(r.DialogContent,{padding:16,children:[A.jsx(r.FormInput,{value:i,onValueChange:s,placeholder:"Paste URL",icon:"public"}),o&&A.jsx(r.InlineLabel,{value:"Open in a new tab",children:A.jsx(r.Checkbox,{checked:a,onCheckedChange:l})})]}),A.jsxs(r.DialogActions,{children:[A.jsx(r.DialogCancelButton,{}),A.jsx(r.DialogActionButton,{onClick:c,disabled:d,children:"Update"})]})]})}function Dc(e){const{url:t,openInNewTab:n,onUpdate:o,open:i}=e,[s,a]=f.useState(t),[l,d]=f.useState(n);E.useOnChange(i,()=>{i&&(a(t),d(n))});const c=!s||s===t&&l===n;function u(){o(s,{newTab:l})}return{url:s,setUrl:a,openInNewTab:l,disabled:c,setOpenInNewTab:d,onUpdate:u}}function Fn(e){var Q,z,pe,ot;const{content:t,field:n,id:o,onContentChange:i,appearance:s="normal",backgroundColor:a="grey1"}=e,l=E.useDebounceState({initialState:!1}),[d,c]=f.useState(),{contentType:u,fieldValue:h,errorBoundaryRef:g,onDocumentSelected:m,onError:C,onMediaSelected:y,onValueChange:x,selectType:I,onTypeChange:B,isTypeSelectEnabled:j,displayTextEnabled:S,...b}=wc({content:t,field:n,onContentChange:i}),v=u==="DocumentLink"&&h!=="",T=u==="ExternalLink"&&te.toURL(h),k=!!((Q=n.config)!=null&&Q.allowTargetBlank);function M(){switch(u){case"DocumentLink":return c("document");case"ExternalLink":return c("web");case"FileLink":case"ImageLink":case"MediaLink":return c("media");default:return c(void 0)}}const _={...b,id:o,onFocus:()=>l.set(!0),onBlur:()=>l.set(!1),onOpenLinkModal:M,onUnlink:()=>{j?B(void 0):x("")},onSelectValueChange:H=>{B(H),c(H)},value:h,allowTargetBlank:k,selectType:I,onValueChange:x,isTypeSelectEnabled:j,displayTextEnabled:S,onKeyDown(H){S||(H.key==="Enter"||H.key===" ")&&(M(),H.preventDefault())},onClick:()=>{S||M()},appearance:s},{searchDocuments:ge}=L();function he(H){if(H)return;const qe=t&&t.value.__TYPE__!=="AnyLink";!H&&!qe&&j&&B(void 0),c(void 0)}function Qe(H,qe){x(H,qe),c(void 0)}function Me(H){y(H),c(void 0)}function D(H){m(H),c(void 0)}return A.jsxs(A.Fragment,{children:[A.jsxs(r.Popover,{align:"start",sideOffset:-3,focusOnEnter:!1,open:l.debouncedValue,anchor:A.jsxs(r.Field,{variant:Rc(s),color:a,children:[v?A.jsx(qc,{documentId:h,displayTextEnabled:S}):A.jsx(r.FieldIcon,{name:We({selectType:I,displayTextEnabled:S})}),s!=="compact"&&A.jsx(r.FieldLabel,{htmlFor:o,children:Z(n)}),A.jsx(r.FieldControl,{children:v&&ge?A.jsx(Oc,{errorBoundaryRef:g,onError:C,fallback:A.jsx(Gt,{..._,value:"..."}),renderError:()=>Qc(_),children:A.jsx(Mc,{..._,documentId:h})}):A.jsx(Gt,{..._})})]}),children:[T&&A.jsx(ve,{url:T,title:te.getUrlTitle(T)??"",subTitle:T.toString()}),t&&K.FilledImageLinkContent.is(t.value)&&A.jsx(Xo,{url:t.value.url,title:t.value.name,subTitle:`${t.value.width} x ${t.value.height} pixels`})]}),A.jsx(Ec,{open:d==="web",onOpenChange:he,onUpdate:Qe,url:h,openInNewTab:b.isTargetNewTab,showNewTabButton:!!((z=n.config)!=null&&z.allowTargetBlank)}),A.jsx(jn,{open:d==="media",onOpenChange:he,onMediaSelected:Me,assetType:"all"}),A.jsx(No,{open:d==="document",onOpenChange:he,onSelectDocument:D,fixedCustomTypes:new Set((pe=n.config)==null?void 0:pe.customtypes),fixedTags:new Set((ot=n.config)==null?void 0:ot.tags),linkedDocumentId:t&&K.FilledDocumentLinkContent.is(t.value)?t.value.id:void 0})]})}function Rc(e){switch(e){case"compact":return"compact";case"normal":return"normal";default:return}}function Qc(e){return A.jsx(Gt,{...e})}function Gt(e){const{id:t,value:n,onOpenLinkModal:o,onBlur:i,isTypeSelectEnabled:s,selectType:a,onSelectValueChange:l,onUnlink:d,isTargetNewTab:c,allowTargetBlank:u,displayTextEnabled:h,displayText:g,onFocus:m,onClick:C,onKeyDown:y,appearance:x,placeholder:I,variants:B,variant:j,onVariantChange:S,onDisplayTextChange:b,onValueChange:v}=e;return A.jsx(r.Box,{padding:{block:4},width:"100%",children:A.jsx(Fe,{id:t,textOverflow:"ellipsis",variant:h?"normal":"link",readOnly:!h,placeholder:h?"Add your display text":I,padding:ei(x),value:h?g:n,cursor:ti({value:n,displayTextEnabled:h,isTypeSelectEnabled:s}),onBlur:i,onFocus:m,onClick:C,onKeyDown:y,onValueChange:h?b:v,endAdornment:A.jsx(Jo,{hasLink:!!(n&&a),onUnlink:d,selectEnabled:s,selectedType:a,value:n,onOpenLinkModal:o,onValueChange:l,openInNewTab:c,condensedButtons:x==="condensedButtons",showNewTabButton:u&&a==="web",displayTextEnabled:h,variants:B,variant:j,onVariantChange:S})})})}function Mc(e){const{id:t,documentId:n,onOpenLinkModal:o,isTypeSelectEnabled:i,selectType:s,displayTextEnabled:a,onSelectValueChange:l,onUnlink:d,onFocus:c,onClick:u,onKeyDown:h,appearance:g,variants:m,variant:C,displayText:y,onVariantChange:x,onDisplayTextChange:I}=e,B=vc(n),j=ni(n);return A.jsx(Fe,{id:t,textOverflow:"ellipsis",padding:ei(g),placeholder:a?"Add your display text":void 0,readOnly:!a,value:a?y:B,variant:a?"normal":"link",cursor:ti({value:B,displayTextEnabled:a,isTypeSelectEnabled:i}),onFocus:c,onClick:u,onKeyDown:h,onValueChange:a?I:void 0,endAdornment:A.jsxs(r.Box,{gap:4,children:[j&&A.jsx(r.Badge,{title:"Broken Link",color:"tomato"}),A.jsx(Jo,{hasLink:!0,onUnlink:d,selectEnabled:i,selectedType:s,value:B,onOpenLinkModal:o,condensedButtons:g==="condensedButtons",onValueChange:l,displayTextEnabled:a,variants:m,variant:C,onVariantChange:x})]})})}function qc(e){const{documentId:t,displayTextEnabled:n}=e;return A.jsx(r.ErrorBoundary,{renderError:()=>A.jsx(r.FieldIcon,{name:"warning"}),children:A.jsx(f.Suspense,{fallback:A.jsx(r.FieldIcon,{name:We({selectType:"document",displayTextEnabled:n})}),children:A.jsx(Pc,{documentId:t,displayTextEnabled:n})})})}function Pc(e){const{displayTextEnabled:t,documentId:n}=e;return ni(n)?A.jsx(r.FieldIcon,{name:"linkOff"}):A.jsx(r.FieldIcon,{name:We({selectType:"document",displayTextEnabled:t})})}function ei(e){switch(e){case"compact":return{input:{inline:4}};default:return}}function Oc(e){const{errorBoundaryRef:t,onError:n,children:o,fallback:i,renderError:s}=e;return A.jsx(r.ErrorBoundary,{ref:t,onError:n,renderError:s,children:A.jsx(f.Suspense,{fallback:i,children:o})})}function We(e){const{selectType:t,displayTextEnabled:n}=e;if(n)return"notes";switch(t){case"document":return"description";case"web":return"public";case"media":return"image";default:return"link"}}function ti(e){const{value:t,displayTextEnabled:n,isTypeSelectEnabled:o}=e;return n?"text":o&&!t?"default":"pointer"}function Vc(e){const{onContentChange:t,...n}=e;function o(i){const s=K.FilledLinkContent.is(i)?i:void 0;t(s)}return A.jsx(Fn,{...n,onContentChange:o})}function ni(e){const t=L();t.uidField||V("uidField");const{coreApiBaseUrl:n,authStrategy:o}=t,{data:i}=mn({baseUrl:n,authStrategy:o,documentIds:[e],statuses:["archived","unclassified","published"]});if(i.results.length===0||i.results.length>1)return!1;const s=i.results[0];return s==null?void 0:s.versions.every(a=>a.status==="archived")}function Yc(e){const{onDelete:t,isDeleteEnabled:n,onMoveUp:o,onMoveDown:i,isMoveUpEnabled:s,isMoveDownEnabled:a}=e;return A.jsxs(r.DropdownMenu,{children:[A.jsx(r.DropdownMenuTrigger,{children:A.jsx(r.IconButton,{hiddenLabel:"Link actions",icon:"moreVert",size:"small",variant:"solid"})}),A.jsxs(r.DropdownMenuContent,{children:[A.jsx(r.DropdownMenuLabel,{children:A.jsx(r.Text,{variant:"small",color:"grey11",children:"Item options"})}),A.jsx(r.DropdownMenuItem,{onSelect:o,startIcon:A.jsx(r.Icon,{name:"arrowUpward"}),disabled:!s,children:"Move up"}),A.jsx(r.DropdownMenuItem,{onSelect:i,startIcon:A.jsx(r.Icon,{name:"arrowDownward"}),disabled:!a,children:"Move down"}),A.jsx(r.DropdownMenuItem,{color:"tomato",onSelect:t,startIcon:A.jsx(r.Icon,{name:"delete",color:"tomato9"}),disabled:!n,children:"Delete"})]})]})}function Wc(e){const{field:t,content:n,onContentChange:o}=e,{config:i}=t,s=f.useMemo(()=>Mt({config:i}),[i]),a=n!=null&&n.value.length?n.value:[s];function l(g){const m=O.insertAtIndex(a,g,Mt({config:i}));o(Je(m))}function d(g,m){var x;const C=[...a],y=Mt({config:i,key:(x=C[m])==null?void 0:x.key});C[m]=g??y,o(Je(C))}function c(g){o(Je(g))}function u(g){const m=O.removeIndex(a,g);o(Je(m))}function h(g,m){const C=O.move(a,m,m+Hc(g));o(Je(C))}return{links:a,updateLink:d,updateLinks:c,addLink:l,deleteLink:u,moveLink:h}}function Hc(e){switch(e){case"up":return-1;case"down":return 1}}function Mt(e){const{config:t,key:n=crypto.randomUUID()}=e,o=_c(t==null?void 0:t.select);return t!=null&&t.allowText&&(o.text=""),{__TYPE__:"LinkContent",key:n,value:o}}function _c(e){switch(e){case"web":return{__TYPE__:"ExternalLink",kind:"web"};case"document":return{__TYPE__:"DocumentLink",kind:"document"};case"media":return{__TYPE__:"MediaLink",kind:"media"};default:return{__TYPE__:"AnyLink",kind:"any"}}}function Je(e){return{__TYPE__:"RepeatableContent",type:"Link",value:e}}function zc(e){const{id:t,field:n}=e,o=Wc(e),[i,s]=f.useState(!1),{links:a}=o;return A.jsx(pl,{children:A.jsxs(r.FieldSet,{id:t,legend:Nc(n.config),variant:"compact",selected:i,children:[A.jsx(Gc,{field:n,items:a,onItemDelete:o.deleteLink,onItemChange:o.updateLink,onItemMove:o.moveLink,onItemAdd:o.addLink,onItemReorder:o.updateLinks,onDragStatusChange:s}),A.jsx(r.Button,{startIcon:"add",color:"grey",onClick:()=>o.addLink(a.length),sx:{marginInline:4,marginBlock:4},children:"Add"})]})})}function Nc(e){return e!=null&&e.label?`Multiple • ${e.label}`:"Multiple"}function Gc(e){const{field:t,items:n,onItemChange:o,onItemDelete:i,onItemMove:s}=e,a=n.length>1,l=Zc(e);return A.jsx(r.AnimatedList,{items:n,getItemKey:d=>d.key,ariaLabel:"Link list",dnd:l,children:(d,c)=>A.jsxs(r.Draggable,{disabled:!a,children:[A.jsx(Fn,{appearance:"compact",content:d,field:t,onContentChange:u=>o(u,c),backgroundColor:"transparent"}),A.jsx(Yc,{onDelete:()=>i(c),isDeleteEnabled:n.length>1,onMoveUp:()=>s("up",c),isMoveUpEnabled:c>0,onMoveDown:()=>s("down",c),isMoveDownEnabled:c<n.length-1})]})})}function Zc(e){const{onDragStatusChange:t,onItemReorder:n,onItemAdd:o}=e,{scrollOffsetTop:i}=L(),s=E.useStableCallback(o);return{renderDropIndicator:l=>A.jsx(Jc,{...l,onItemAdd:s}),scrollOffsetTop:i,onDragChange:t,onReorder:n}}function Jc(e){const{isDropTarget:t,itemIndex:n,position:o,itemCount:i,onItemAdd:s}=e;return n===0&&o==="before"?A.jsx(Nn,{isDropTarget:t,position:"before"}):n===i-1&&o==="after"?A.jsx(Nn,{isDropTarget:t,position:"after"}):A.jsx(Xc,{index:n,isDropTarget:t,onItemAdd:s})}function Xc(e){const{index:t,onItemAdd:n,isDropTarget:o}=e,[i,s]=f.useState(0);function a(){n(t+1),s(l=>l+1)}return A.jsx(r.HairlineButton,{icon:"add",size:"small",variant:"rightDashed",tooltip:{content:"Add item below"},onClick:a,dropMode:o,sx:{marginInline:4}},i)}function Nn(e){const{isDropTarget:t,position:n}=e;return A.jsx(r.AnimatedElement,{enterDuration:150,animation:{name:"expand-vertical"},children:t&&A.jsx(r.Box,{children:A.jsx(r.Line,{color:"purple",thickness:2,sx:{width:"100%",marginBottom:n==="before"?4:void 0,marginTop:n==="after"?4:void 0}},"line")})})}function $c(e){const{linkTo:t,onLinkToChange:n}=e,o=ed(t);return A.jsx(Vc,{content:o,onContentChange:i=>n(td(i)),field:{type:"Link",config:{label:"Link",allowTargetBlank:!0,allowText:!1}},appearance:"condensedButtons"})}function ed(e){const[t]=f.useState(()=>crypto.randomUUID());if(e)return{__TYPE__:"LinkContent",key:t,value:e}}function td(e){return e==null?void 0:e.value}function Ai(e){var j,S;const{allContentViews:t,content:n,contentView:o,fieldLabel:i,imageLabel:s,initialImages:a,isUpdating:l,page:d=0,readOnly:c,thumbnailName:u,onClear:h,onContentChange:g,onCropperDialogClose:m,onPageChange:C,onMediaDialogOpenChange:y}=e,x=((S=(j=n==null?void 0:n.url)==null?void 0:j.split("?")[0])==null?void 0:S.slice(-4))===".svg",I=n!=null&&n.url&&!c?"visible":"hidden",B=!K.isImageContent(n);return A.jsxs(r.Box,{display:"flex",gap:12,padding:{inline:12},children:[A.jsx(r.Box,{children:A.jsx(r.Carousel,{getItemSource:ta,items:t,onPageChange:C,page:d,buttonSize:"small",renderPrevTooltip:b=>A.jsx(r.Tooltip,{content:"Previous",children:b}),renderNextTooltip:b=>A.jsx(r.Tooltip,{content:"Next",children:b}),style:B?{width:181,height:142}:{width:123,height:93},children:b=>(b==null?void 0:b.url)&&A.jsx(r.CarouselItem,{"aria-label":"Image Field Item",src:jo(b.url),alt:b.alt??void 0,isUpdating:l,disableAnimation:B},`${u}_${b.url}`)})}),A.jsxs(r.Box,{width:"100%",display:"flex",flexDirection:"column",gap:B?16:12,children:[A.jsx(Jl,{fieldLabel:i,imageLabel:s,initialImages:a,page:d,displaySeparator:!B,isSVGContentView:x,visibility:I,onClear:h,onCropperDialogClose:m,onMediaDialogOpenChange:y}),A.jsx(Zl,{readOnly:c||!o,altText:(o==null?void 0:o.alt)??"",onValueChange:b=>{o&&g(Js(u,n,o,b))}}),B&&A.jsx($c,{linkTo:n.linkTo,onLinkToChange:b=>{g({...n,linkTo:b})}})]})]})}function oi(e){const{onMediaSelected:t}=e,n=L(),{showAlert:o}=r.useAlert(),{mutate:i,isPending:s}=oe.useMutation({mutationFn:a=>so({file:a,config:n}),onSuccess:a=>{t(a)},onError:()=>{o({title:"Error uploading image",subtitle:"Please try again"})}});return{uploadImage:i,isUploadingImage:s}}function nd(e){const{content:t,onContentChange:n,field:o}=e,[i,s]=f.useState(0),[a,l]=f.useTransition(),d=Gs(o),c=d[i],u=t?Zs(o,t):void 0,h=u==null?void 0:u[i];function g(B){if(!c)return;const j=na(c.name,o,t,B);j!==t&&l(()=>n(j))}function m(B){l(()=>s(B))}function C({option:B,croppedImages:j}){if(s(B),!t)return;const S=Object.entries(j).reduce((b,[v,F])=>Wl({field:o,content:b,thumbnail:v,croppedImage:F}),t);S!==t&&l(()=>n(S))}function y(){s==null||s(0),n(void 0)}const{uploadImage:x,isUploadingImage:I}=oi({onMediaSelected:g});return{onCropperDialogClose:C,onPageChange:m,onMediaSelected:g,isUpdating:a,page:i,thumbnail:c,allThumbnails:d,allContentViews:u,contentView:h,onClear:y,uploadImage:x,isUploadingImage:I}}function Ad(e){const{content:t,field:n,readOnly:o,onContentChange:i}=e,s=t&&t.origin.url.length>0,{onCropperDialogClose:a,onPageChange:l,isUpdating:d,page:c,onMediaSelected:u,thumbnail:h,allThumbnails:g,allContentViews:m,contentView:C,onClear:y,uploadImage:x,isUploadingImage:I}=nd({field:n,content:t,onContentChange:i}),[B,j]=f.useState(!1),S=Z(n),b=g.map((k,M)=>{const _=m==null?void 0:m[M];return{thumbnail:k,contentView:_,labels:Ht(k,t,_)}}),v=h&&s?Ht(h,t,C).filter(ae.isDefined):[],F=h&&t&&s&&m,T=I||d;return A.jsx(Oo,{isMediaDialogOpen:B,onMediaSelected:u,onMediaDialogOpenChange:j,children:A.jsx(f.Suspense,{fallback:A.jsx("div",{style:{height:95}}),children:F?A.jsx(Ai,{allContentViews:m,content:t,contentView:C,fieldLabel:S,imageLabel:v,initialImages:b,isUpdating:T,page:c,readOnly:o,thumbnailName:h.name,onClear:y,onContentChange:i,onCropperDialogClose:a,onMediaDialogOpenChange:j,onPageChange:l}):A.jsx(Vo,{uploadImage:x,isUploading:I,disabled:o||B,children:A.jsx(Mo,{fieldLabel:S,isUpdating:T,readOnly:o,onMediaDialogOpenChange:j})})})})}function od(e){var x,I;const{searchTerm:t,catalogId:n}=e,o=L();o.integrationFields||V("integrationFields");const{integrationFieldsApiBaseUrl:i,repository:s,authStrategy:a}=o,[l,d]=f.useState(1),[c,u]=f.useState([]),[h,g]=f.useState(""),m=R.useRequest(id,[i,a,s,n,t,t===h?l:1]);t!==h?(g(t),d(1),u(m.items)):m.items.length>0&&((x=O.last(c))==null?void 0:x.id)!==((I=O.last(m.items))==null?void 0:I.id)&&u(B=>B.concat(m.items));const C=l<m.totalPages;function y(){C&&d(B=>B+1)}return{items:c,response:m,fetchNextPage:y,hasNextPage:C}}function id(e,t,n,o,i,s=1,a=30){const l=new URL(`if/search/${o}`,e);return l.searchParams.set("searchTerm",i),l.searchParams.set("limit",a.toString()),l.searchParams.set("page",s.toString()),U.request(l,{headers:{repository:n},credentials:U.getRequestCredentials(t),okType:rd})}const ii=p.z.object({id:p.z.string(),title:p.z.string(),imageURL:p.z.string().optional(),description:p.z.string().optional()}),rd=p.z.object({items:p.z.array(ii),totalPages:p.z.number(),page:p.z.number()});function ri(e){const{itemId:t,catalogId:n}=e,o=L();o.integrationFields||V("integrationFields");const{integrationFieldsApiBaseUrl:i,repository:s,authStrategy:a}=o,d=R.useRequest(sd,[i,a,s,n,t]).items[0];if(!d)throw new Error("Item not found");return{item:d}}function sd(e,t,n,o,i){const s=new URL(`if/read/${o}`,e);return s.searchParams.set("ids",[i].toString()),U.request(s,{headers:{repository:n},credentials:U.getRequestCredentials(t),okType:ad})}const ad=p.z.object({items:p.z.array(ii)});function Sn(e){const{item:t,onClick:n,catalogId:o}=e;return A.jsxs(r.PreviewCard,{variant:"large",onClick:n,children:[A.jsx(ld,{src:t.imageURL??"",alt:t.title}),A.jsxs(r.PreviewContent,{children:[A.jsx(r.Badge,{title:`Catalog: ${o}`,icon:"multipleStop",size:"medium"}),A.jsx(r.Text,{variant:"bold",color:"grey12",sx:{marginTop:4},children:t.title}),A.jsx(r.Text,{variant:"small",color:"grey11",children:t.description??t.id})]})]})}const lt=76;function ld(e){const{src:t,alt:n}=e;return t?A.jsx(r.PreviewImage,{src:t,alt:n,width:lt,height:lt,framed:!0}):A.jsxs(r.Box,{borderRadius:6,backgroundColor:"grey2",height:lt,width:lt,flexDirection:"column",alignItems:"center",justifyContent:"center",border:!0,padding:{inline:4,block:8},children:[A.jsx(r.Icon,{name:"hideImage",size:"large",color:"grey11"}),A.jsx(r.Text,{color:"grey11",variant:"small",noSelect:!0,align:"center",children:"No preview image"})]})}function Ve(){return A.jsxs(r.PreviewCard,{variant:"large",children:[A.jsx(r.Skeleton,{height:76,width:76}),A.jsxs(r.PreviewContent,{children:[A.jsx(r.Skeleton,{height:24,width:168}),A.jsx(r.Skeleton,{height:24,width:240,sx:{marginTop:4}}),A.jsx(r.Skeleton,{height:16,width:144})]})]})}function cd(e){const{open:t,onOpenChange:n,catalogId:o,onSelectItem:i}=e,s=E.useDebounceState({initialState:""}),a=L();return A.jsx(r.Dialog,{open:t,onOpenChange:n,hasClose:!1,size:{width:612,height:724},noDescription:!0,children:A.jsx(r.DialogContent,{children:A.jsxs(r.Box,{flexDirection:"column",height:"100%",children:[A.jsxs(r.Box,{padding:{top:16,inline:16},flexDirection:"column",gap:8,children:[A.jsx(r.FormSearchInput,{value:s.value,onValueChange:s.set,placeholder:"Search in your catalog"}),A.jsx(r.DialogTitle,{asChild:!0,children:A.jsx(r.Text,{variant:"smallBold",color:"grey11",children:"Select an item"})})]}),a.integrationFields?A.jsx(r.ErrorBoundary,{renderError:()=>A.jsx(Zt,{message:"There was an error while fetching your catalog items."}),children:A.jsx(f.Suspense,{fallback:A.jsxs(r.Box,{flexDirection:"column",gap:12,padding:{top:10,inline:16,bottom:16},children:[A.jsx(Ve,{}),A.jsx(Ve,{}),A.jsx(Ve,{}),A.jsx(Ve,{}),A.jsx(Ve,{})]}),children:A.jsx(dd,{searchTerm:s.debouncedValue,catalogId:o,onItemClick:i})})}):A.jsx(Zt,{message:"Slice Machine does not yet support mock data for integration field in the simulator."})]})})})}function dd(e){const{catalogId:t,searchTerm:n,onItemClick:o}=e,[i,s]=f.useTransition(),{items:a,hasNextPage:l,fetchNextPage:d}=od({catalogId:t,searchTerm:n});return A.jsx(A.Fragment,{children:A.jsxs(r.ScrollArea,{onScrollToBottom:()=>l&&s(d),style:{flexGrow:1,paddingTop:r.theme.space[10],paddingBottom:r.theme.space[16],paddingInline:r.theme.space[16],display:"flex",flexDirection:"column",gap:r.theme.space[12]},threshold:252,children:[a.length===0?A.jsx(Zt,{}):a.map(c=>A.jsx(Sn,{item:c,catalogId:t,onClick:()=>o(c)},c.id)),A.jsx(r.AnimatedElement,{animation:{name:"fade"},children:i&&A.jsx(r.Text,{color:"grey11",align:"center",sx:{marginBlock:8},children:"Loading more results ..."})})]})})}function Zt(e){const{message:t="We can't find any items matching your search"}=e,n="Oops!";return A.jsx(r.Box,{justifyContent:"center",flexDirection:"column",height:"100%",children:A.jsxs(r.BlankSlate,{children:[A.jsx(r.BlankSlateIcon,{name:"close",lineColor:"purple10",backgroundColor:"purple3",borderColor:"purple6",borderStyle:"dashed",size:"xlarge"}),A.jsx(r.BlankSlateTitle,{size:"big",children:n}),A.jsx(r.BlankSlateDescription,{width:360,children:t})]})})}function ud(e){const{itemId:t,item:n}=e,o=L();return t&&n&&n.id===t?A.jsx(Ye,{...e,value:n.title}):t&&o.integrationFields?A.jsx(r.ErrorBoundary,{renderError:()=>A.jsx(Ye,{...e,value:t}),children:A.jsx(f.Suspense,{fallback:A.jsx(Ye,{...e,value:t}),children:A.jsx(pd,{...e,itemId:t})},t)},t):t&&!o.integrationFields?A.jsx(Ye,{...e,value:t}):A.jsx(Ye,{...e,value:""})}function gd(e){const{catalogId:t,itemId:n,item:o}=e,i=L();return n&&o&&o.id===n?A.jsx(r.FieldFooter,{children:A.jsx(Sn,{catalogId:t,item:o})}):n&&i.integrationFields?A.jsx(r.ErrorBoundary,{renderError:()=>null,children:A.jsx(r.FieldFooter,{children:A.jsx(f.Suspense,{fallback:A.jsx(Ve,{}),children:A.jsx(hd,{catalogId:t,itemId:n})},n)})},n):null}function hd(e){const{itemId:t,catalogId:n}=e,{item:o}=ri({catalogId:n,itemId:t});return A.jsx(Sn,{catalogId:n,item:o})}function Ye(e){const{id:t,field:n,readOnly:o,value:i,onFocus:s,onClearItem:a}=e;return A.jsx(Fe,{id:t,placeholder:De(n),readOnly:!0,variant:"link",value:i,...!o&&{cursor:"pointer",onFocus:s},endAdornment:A.jsx(r.Button,{startIcon:"close",color:"grey",size:"small",disabled:!i,onClick:a})})}function pd(e){const{itemId:t,catalogId:n}=e,{item:o}=ri({catalogId:n,itemId:t});return A.jsx(Ye,{...e,value:o.title})}function md(e){var m;const{id:t,field:n,content:o,readOnly:i,onContentChange:s}=e,[a,l]=f.useState(!1),[d,c]=f.useState(),u=(m=n.config)==null?void 0:m.catalog;if(!u)return null;function h(C){s({value:C.id,__TYPE__:"IntegrationFieldsContent"}),c(C),l(!1)}function g(){s(void 0),c(void 0)}return A.jsxs(A.Fragment,{children:[A.jsxs(r.Field,{footer:A.jsx(gd,{catalogId:u,item:d,itemId:o==null?void 0:o.value}),children:[A.jsx(r.FieldIcon,{name:"multipleStop"}),A.jsx(r.FieldLabel,{htmlFor:t,children:Z(n)}),A.jsx(r.FieldControl,{children:A.jsx(ud,{id:t,field:n,readOnly:i,catalogId:u,item:d,itemId:o==null?void 0:o.value,onFocus:()=>l(!0),onClearItem:g})})]}),A.jsx(cd,{open:a,onOpenChange:l,catalogId:u,onSelectItem:h})]})}function si(e){const{content:t,field:n,id:o,onContentChange:i,readOnly:s,endAdornment:a,placeholder:l}=e;return A.jsxs(r.Field,{children:[A.jsx(r.FieldIcon,{name:"notes"}),A.jsx(r.FieldLabel,{htmlFor:o,children:Z(n)}),A.jsxs(r.FieldControl,{children:[A.jsx(r.TextArea,{id:o,placeholder:l||De(n),readOnly:s,paddingLeft:4,paddingRight:12,sx:{flexGrow:1},value:(t==null?void 0:t.value)??"",onChange:d=>{i(fd(d))}}),a]})]})}function fd(e){return e.length===0?void 0:{__TYPE__:"FieldContent",type:"Text",value:e}}function Cd(e){var l;const{content:t,id:n,field:o,onContentChange:i,readOnly:s}=e,a={id:n,readOnly:s,onContentChange:i};return(l=o.config)!=null&&l.repeat?A.jsx(zc,{...a,field:o,content:hA(t)}):A.jsx(Fn,{...a,field:o,content:pA(t)})}const xd=({content:e,field:t,id:n,onContentChange:o,readOnly:i})=>{var l,d;const s=Number(e==null?void 0:e.value),a=Number.isFinite(s)?s:void 0;return A.jsxs(r.Field,{children:[A.jsx(r.FieldIcon,{name:"pin"}),A.jsx(r.FieldLabel,{htmlFor:n,children:Z(t)}),A.jsx(r.FieldControl,{children:A.jsx(r.NumberInput,{id:n,value:a,min:(l=t.config)==null?void 0:l.min,max:(d=t.config)==null?void 0:d.max,padding:Eo,placeholder:De(t),readOnly:i,onValueChange:c=>o(yd(c))})})]})};function yd(e){return e===void 0?void 0:{__TYPE__:"FieldContent",type:"Number",value:String(e)}}function Bd(e){return e.type==="table"}const Te={...w.RichTextNodeType,table:"table"};function Id(e){return!!(e&&e.has(Te.table))}var Re=(e=>(e.Document="document",e.Mark="mark",e.Node="node",e))(Re||{}),Ke=(e=>(e.Text="text",e.Embed="embed",e.Image="image",e.Table="table",e))(Ke||{});class jd{constructor(t,n,o){W(this,"extType","document");this.name=t,this.component=n,this.converter=o}}class At{constructor(t,n,o,i,s,a=!1){W(this,"extType","node");W(this,"nodeType","text");this.richTextNodeTypes=t,this.name=n,this.component=o,this.converter=i,this.placeholder=s,this.lockedFormat=a}}function ai(e){return e instanceof At}class Fd{constructor(t,n,o,i){W(this,"extType","node");W(this,"nodeType","embed");this.richTextNodeTypes=t,this.name=n,this.component=o,this.converter=i}}class Sd{constructor(t,n,o,i){W(this,"extType","node");W(this,"nodeType","image");this.richTextNodeTypes=t,this.name=n,this.component=o,this.converter=i}}class bd extends At{constructor(t,n,o,i,s){super(t,"heading",n,i,s),this.levels=o}}class bn extends At{constructor(t,n,o,i){super(t,n,o,i)}}class Kd{constructor(t,n,o,i){W(this,"extType","node");W(this,"nodeType","table");this.richTextNodeTypes=t,this.name=n,this.component=o,this.converter=i}}function Ud(e){return e instanceof bn}const Ie={isHardBreak(e){return e.type.name===aA.name},children:{reduce(e,t,n){let o=n;return e.forEach((i,s,a)=>{o=t(o,i,a)}),o},map(e,t){return this.reduce(e,(n,o)=>[...n,t(o)],[])},exists(e,t){return this.reduce(e,(n,o)=>n||t(o),!1)},filter(e,t){return this.reduce(e,(n,o)=>[...n,...t(o)?[o]:[]],[])}},marks:{reduce(e,t,n){let o=n;return e.marks.forEach((i,s)=>{o=t(o,i,s)}),o},map(e,t){return this.reduce(e,(n,o)=>[...n,t(o)],[])},filter(e,t){return this.reduce(e,(n,o)=>[...n,...t(o)?[o]:[]],[])}}};function Td(e){if(!e||!(e!=null&&e.single)&&!(e!=null&&e.multi))return Gn();const t=wd(e);if(!t.size)return Gn();const n=Ld(t),o=vd(n,e);return{nodeTypes:t,extensions:o}}function wd(e){const n=(e.single||e.multi||"").split(/\s*,\s*/).map(o=>{if(o==="table")return o;const i=w.RichTextNodeTypeCodec.decode(o);return i._tag==="Right"?i.right:void 0}).filter(ae.isDefined);return new Set(n)}function Ld(e){return Di(e).filter(n=>ee.some(e,o=>n.richTextNodeTypes.includes(o)))}function vd(e,t){var o;const n=new Set(e);return ee.some(n,Ud)&&n.add(J),ee.some(n,ai)||n.add(J),(o=t==null?void 0:t.labels)!=null&&o.length&&n.add(wn),[...n]}function Gn(){return{extensions:Di(),nodeTypes:new Set(Ge.keys(w.RichTextNodeTypeCodec.keys))}}class kd{constructor(t,n,o){W(this,"extType",Re.Mark);W(this,"richTextNodeTypes",[w.RichTextNodeType.strong]);this.name=t,this.component=n,this.converter=o}}const li="bold",ci=rr.extend({name:li}),Ed={fromPrismic(e){return function(){var t;return(t=e.marks[ci.name])==null?void 0:t.create()}},toPrismic(){}},Dd=new kd(li,ci,Ed),Kn=Dd,di=nr.extend({name:"listItem",content:"paragraph*",addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name)}}}),Rd={fromPrismic(e){return function(t){var o;const n=J.converter.fromPrismic(e)(t);if(n)return(o=e.nodes[di.name])==null?void 0:o.create({},n)}},toPrismic(e,t){return Ie.children.reduce(e,(n,o)=>{const i=J.converter.toPrismic(o),s=(()=>i instanceof Array?i.map(a=>({...a,type:t})):i?[{...i,type:t}]:[])();return[...n,...s]},[])}},Ne={component:di,converter:Rd,placeholder:"List"};function Qd(e,t){return e.copy(e.content.append(t.content))}function Md(e){return e.reduce((t,n)=>{const o=(t[n.type]||[]).concat(n);return{...t,[n.type]:o}},{})}function Zn(e){return e.sort((t,n)=>t.start-n.start)}function qd(e){const t=Md(e),n=Object.entries(t).map(([o,i])=>Zn(i).reduce((a,l)=>{if(!a.length)return[l];const d=a.length-1,c=a[d];return c?c.end<l.start?[...a,l]:c.end>=l.end?a:[...a.slice(0,d),{...c,end:l.end}]:a},[])).flat();return Zn(n)}const pt=aA.extend({name:"hard_break"}),mt=`
|
|
38
|
-
`,ui={fromPrismic(e){return function(t){var n;if(t===mt)return(n=e.nodes[pt.name])==null?void 0:n.create({})}},toPrismic(e){if(e.type.name===pt.name)return mt}},qt={isEmptyLine(e){return e.length===0},isFirst(e){return e===0}};function Pd(e,t){return function(n){const o=ui.fromPrismic(e)(mt);if(!o)return[n(t)];const i=t.split(mt);return i.length===1?t.length?[n(t)]:[o]:i.reduce((s,a,l)=>qt.isFirst(l)?qt.isEmptyLine(a)?s:[...s,n(a)]:qt.isEmptyLine(a)?[...s,o]:[...s,o,n(a)],[])}}const Od={name:pt.name,component:pt,converter:ui,splitTextToNodes:Pd},ft=Od,gi={fromPrismic(e){return t=>{switch(t.type){case"hyperlink":return Ti.converter.fromPrismic(e)(t);case"em":return Tn.converter.fromPrismic(e)(t);case"strong":return Kn.converter.fromPrismic(e)(t);case"label":return wn.converter.fromPrismic(e)(t);case"list-item":return}}},toPrismic(e,t,n){const o=Ei.find(i=>e.type.name===i.name);if(!o)throw new Error(`Invalid mark extension '${e.type.name}'.`);switch(o.name){case"bold":return{type:"strong",start:t,end:n};case"em":return{type:o.name,start:t,end:n};case"hyperlink":return{type:o.name,start:t,end:n,data:o.converter.toPrismic(e)};case"label":return{type:o.name,start:t,end:n,data:o.converter.toPrismic(e)}}}},Vd={strong:"bold",label:"label",em:"em",hyperlink:"hyperlink","list-item":void 0},Jn=ir.extend({name:"text"}),Yd={fromPrismic(e){return function(t,n,o=!1){const i={type:t,text:n.content.text,spans:n.content.spans||[]};return or.serialize([i],Wd(e,o)).flat()}},toPrismic(e,t,n){const o=Ie.children.reduce(e,(i,s)=>{const a=(()=>s.type.name===ft.name?ft.converter.toPrismic(s):s.textContent)(),l=a?i.text+a:i.text,d=i.text.length,c=l.length,u=(()=>s.marks.length?Ie.marks.map(s,g=>gi.toPrismic(g,d,c)):void 0)();return{...i,text:l,spans:u?[...i.spans,...u]:i.spans}},{text:"",spans:[]});return{type:t,content:{text:o.text,spans:[...qd(o.spans)].sort((i,s)=>i.type.localeCompare(s.type))},...n}}};function Wd(e,t=!1){return(n,o,i,s)=>{if(n==="span"&&i&&i.length)return t?[e.text(i)]:ft.splitTextToNodes(e,i)(d=>e.text(d));const a=gi.fromPrismic(e)(o);return a?Hd(a,s):s.flat()}}function Hd(e,t){return t.flat().map(o=>{const s=[...o.marks,e].sort((a,l)=>a.type.name.localeCompare(l.type.name));return o.mark(s)})}const _d={name:Jn.name,component:Jn,converter:Yd},ke=_d,Un="document";function zd(e){return tr.extend({name:Un,content:e?"block+":"block"})}function Nd(e){return{fromPrismic(t,n,o){var s;const i=o.value.reduce((a,l)=>{const{extension:d,block:c}=Xd(e,l,t,n),u=Zd({extension:d,block:c,schema:t}),h=a.slice(0,a.length-1),g=O.last(a),m=Jd({node:u,previousNode:g});return m.updatedNode?[...m.merged?h:a,m.updatedNode]:a},[]);return(s=t.nodes[Un])==null?void 0:s.create({},i)},toPrismic(t){return{__TYPE__:"StructuredTextContent",value:[...Ie.children.reduce(t,(o,i)=>{const s=Object.values(e).find(l=>i.type.name===l.name),a=s==null?void 0:s.converter.toPrismic(i);return a||console.warn(`Cannot convert node of type '${i.type.name}'.`),a?[...o,...a instanceof Array?a:[a]]:o},[])]}}}}const Gd=new jd(Un,zd,Nd),Jt=Gd;function Zd(e){const{extension:t,block:n,schema:o}=e;if(t)switch(t.nodeType){case Ke.Embed:return K.EmbedBlock.is(n)?t.converter.fromPrismic(o)(n):void 0;case Ke.Text:return K.TextBlock.is(n)?t.converter.fromPrismic(o)(n):void 0;case Ke.Image:return K.ImageBlock.is(n)?t.converter.fromPrismic(o)(n):void 0;case Ke.Table:return Bd(n)?t.converter.fromPrismic(o)(n):void 0}}function Jd(e){const{node:t,previousNode:n}=e;return!t||!n?{merged:!1,updatedNode:t}:t.type.name===n.type.name&&(t.type.name===xt.name||t.type.name===Bt.name)?{merged:!0,updatedNode:Qd(n,t)}:{merged:!1,updatedNode:t}}function Xd(e,t,n,o){var l;const i=e.find(d=>d.richTextNodeTypes.includes(t.type)&&o.has(t.type));if(i)return{extension:i,block:t};if(!K.TextBlock.is(t))return{extension:void 0,block:t};const s=e.find(d=>ai(d)&&d.name in n.nodes),a=(l=t.content.spans)==null?void 0:l.filter(d=>{const c=Vd[d.type];return c&&c in n.marks});return{extension:s,block:{...t,content:{text:t.content.text,spans:a}}}}const dt="ltr",Ue="rtl",Ce="dir",Xn=w.RichTextNodeType.rtl,$d=X.Extension.create({name:"textDirection",addOptions(){return{supportedExtensionNames:[]}},addGlobalAttributes(){return[{types:this.options.supportedExtensionNames,attributes:{[Ce]:{default:dt,parseHTML:e=>e.getAttribute(Ce),renderHTML:e=>({[Ce]:Xt(e[Ce])})}}}]},addCommands(){return{setDirection:e=>({commands:t})=>{switch(e){case dt:return t.setLeftToRight();case Ue:return t.setRightToLeft()}},toggleDirection:e=>({commands:t})=>{const n=e===Ue?dt:Ue;return t.setDirection(n)},setRightToLeft:()=>({commands:e})=>this.options.supportedExtensionNames.every(t=>e.updateAttributes(t,{[Ce]:Ue})),setLeftToRight:()=>({commands:e})=>this.options.supportedExtensionNames.every(t=>e.resetAttributes(t,Ce))}},addKeyboardShortcuts(){return{"Mod-Shift-r":()=>this.editor.commands.setRightToLeft(),"Mod-Shift-l":()=>this.editor.commands.setLeftToRight()}}}),xe={parseNodeAttrsDirection(e){return Xt(e[Ce])},fromPrismic(e){return{[Ce]:Xt(e.direction)}},toPrismic(e){return{direction:this.parseNodeAttrsDirection(e.attrs)}}};function Xt(e){return e===Ue?Ue:dt}const Ct=Ar.extend({name:"paragraph",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:e}){return["p",X.mergeAttributes(this.options.HTMLAttributes,e),0]}}),eu={fromPrismic(e){return function(t){var o;const n=ke.converter.fromPrismic(e)(Ct.name,t);return(o=e.nodes[Ct.name])==null?void 0:o.create(xe.fromPrismic(t),n)}},toPrismic(e){return ke.converter.toPrismic(e,w.RichTextNodeType.paragraph,xe.toPrismic(e))}},tu=new At([w.RichTextNodeType.paragraph],Ct.name,Ct,eu,"Type '/' for commands"),J=tu,nu=e=>hr.configure({includeChildren:!0,placeholder:t=>Au(t,e),showOnlyCurrent:!1,showOnlyWhenEditable:!1});function Au(e,t){const{editor:n,hasAnchor:o,pos:i,node:s}=e,{placeholderByNodeType:a,unfocusedPlaceholder:l,nodeExtensions:d}=t,c=!Ie.children.exists(n.state.doc,B=>B===s),u=n.isEditable;if(l&&!n.isFocused&&n.isEmpty&&i===0)return l;const h=s.type.name!==J.name,g=n.isFocused&&o||h||c,m=d.filter(B=>B!==J).length>1;function C(B){return B===J.placeholder?u&&g&&m:u&&g}function y(){if(c)return Ne.placeholder;const B=a[s.type.name];return typeof B=="string"?B:B==null?void 0:B(s.attrs)}const x=y();return C(x)&&x||""}const hi=["ArrowDown","ArrowUp","End","Home"],pi=["Enter"],ou=["Escape",...hi,...pi],iu=X.Extension.create({name:"slash-commands",addOptions(){return{nodeTypes:[]}},addProseMirrorPlugins(){const e=ut(Ri,this.options.nodeTypes);return e.length>1?[pr.Suggestion({allowSpaces:!0,char:"/",editor:this.editor,startOfLine:!0,allow:({state:t})=>{const n=t.selection.$from;return n.parent.type.name===J.name&&n.depth===1},command:({editor:t,props:n,range:o})=>{n.runCommands(t,{deleteRange:o})},items:({query:t})=>{const n=t.toLocaleLowerCase().trim();return e.filter(o=>{var i,s;return((i=o.shortText)==null?void 0:i.toLocaleLowerCase().includes(n))||((s=o.text)==null?void 0:s.toLocaleLowerCase().includes(n))})},render:()=>{let t;return{onStart:n=>{t=new ne.ReactRenderer(ru,{editor:n.editor,props:n}),document.body.appendChild(t.element)},onUpdate:n=>{t==null||t.updateProps(n)},onKeyDown:({event:n})=>{var o;return!!(ou.includes(n.key)&&((o=t==null?void 0:t.ref)!=null&&o.handleKeyDown(n)))},onExit:()=>{t==null||t.destroy(),t==null||t.element.remove()}}}})]:[]}}),ru=f.forwardRef(function(t,n){const{command:o,decorationNode:i,editor:s,items:a}=t,[l,d]=f.useState(!0),{context:c,floating:u,reference:h,x:g,y:m}=ce.useFloating({middleware:[ce.offset(0),ce.flip(),ce.shift({limiter:ce.limitShift()})],onOpenChange:d,open:l,placement:"top-start",strategy:"fixed",whileElementsMounted:ce.autoUpdate});f.useLayoutEffect(()=>{h(i)},[h,i]),f.useEffect(()=>{let F;const T=()=>{F=window.setTimeout(()=>{d(!0)})},k=()=>{d(!1)};return s.on("focus",T).on("blur",k),()=>{s.off("focus",T).off("blur",k),clearTimeout(F)}},[s]);const[C,y]=f.useState(0),x=f.useRef([]);E.useOnChange(a,()=>{y(0),x.current=[]});const{getFloatingProps:I,getItemProps:B,getReferenceProps:j}=ce.useInteractions([ce.useDismiss(c,{outsidePointerDown:!1}),ce.useListNavigation(c,{activeIndex:C,listRef:x,onNavigate:F=>{y(T=>F??T)},openOnArrowKeyDown:!1,virtual:!0}),ce.useRole(c,{role:"menu"})]),b=j().onKeyDown;f.useImperativeHandle(n,()=>({handleKeyDown:F=>{if(l){if(hi.includes(F.key)&&b(F),pi.includes(F.key)){const T=a[C];T!==void 0&&o(T)}return!0}else return!1}}),[C,o,a,b,l]);const v=g!==null&&m!==null;return l?A.jsxs(r.Box,{...I(),minWidth:256,backgroundColor:"grey1",border:!0,borderStyle:"solid",borderRadius:6,flexDirection:"column",ref:u,top:0,left:0,position:"fixed",transform:v?`translate3d(${Math.round(g)}px, ${Math.round(m)}px, 0)`:"translate3d(0, -200%, 0)",overflow:"hidden",children:[a.map((F,T)=>{const k=B({onClick:()=>{o(F)},onPointerDown:M=>{M.preventDefault()}});return f.createElement($n,{...k,key:F.nodeType,ref:M=>{x.current[T]=M},active:T===C,isFirstItem:T===0,isLastItem:T===a.length-1,shortcut:`/${F.shortText??""}`},F.text)}),a.length===0&&A.jsx($n,{...B({onPointerDown:F=>{F.preventDefault()}}),disabled:!0,ref:F=>{x.current[0]=F},children:"No results"})]}):null}),$n=f.forwardRef(function(t,n){const{children:o,disabled:i=!1,shortcut:s,active:a=!1,isFirstItem:l=!1,isLastItem:d=!1,...c}=t;return A.jsx("div",{...c,role:"button",style:{cursor:i?"default":"pointer"},ref:n,children:A.jsxs(r.Box,{alignItems:"center",height:32,flexDirection:"row",gap:8,padding:8,backgroundColor:a?"grey4":"inherit",justifyContent:"space-between",opacity:i?.5:1,children:[A.jsx(r.Text,{color:"grey12",component:"span",children:o}),s&&A.jsx(r.Text,{color:"inherit",component:"span",variant:"small",children:s})]})})});function su(e,t){var d,c;const n=t.map(u=>u.richTextNodeTypes).flat(),i={placeholderByNodeType:au(t),unfocusedPlaceholder:(d=e.config)==null?void 0:d.placeholder,nodeExtensions:t},s=n.includes(Te.orderedList)||n.includes(Te.list),a=!n.includes(Te.table);return[Jt.component(((c=e.config)==null?void 0:c.single)===void 0),ke.component,ft.component,a?nu(i):void 0,s?Ne.component:void 0,iu.configure({nodeTypes:n})].filter(ae.isDefined)}function au(e){return e.reduce((t,n)=>(n.nodeType===Ke.Text&&(t[n.name]=n.placeholder),t),{})}const $t=sr.extend({name:"bulletList",parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:e}){return["ul",X.mergeAttributes(this.options.HTMLAttributes,e),0]}}).configure({itemTypeName:"listItem"}),lu={fromPrismic(e){return function(t){var o;const n=Ne.converter.fromPrismic(e)(t);if(n)return(o=e.nodes[$t.name])==null?void 0:o.create(xe.fromPrismic(t),n)}},toPrismic(e){return Ie.children.map(e,t=>Ne.converter.toPrismic(t,w.RichTextNodeType.list).filter(ae.isDefined)).flat()}},cu=new bn([w.RichTextNodeType.list],$t.name,$t,lu),xt=cu,yt=ar.extend({name:"preformatted",addAttributes(){return{language:{default:null,parseHTML:e=>{var s;const{languageClassPrefix:t}=this.options,i=[...((s=e.firstElementChild)==null?void 0:s.classList)||[]].filter(a=>a.startsWith(t)).map(a=>a.replace(t,""))[0];return i||null},renderHTML:e=>e.language?{class:this.options.languageClassPrefix+e.language}:null}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({HTMLAttributes:e}){return["pre",X.mergeAttributes(this.options.HTMLAttributes),["code",e,0]]}}).configure({exitOnTripleEnter:!1}),du={fromPrismic(e){return function(t){var o;const n=ke.converter.fromPrismic(e)(yt.name,t,!0);return(o=e.nodes[yt.name])==null?void 0:o.create(xe.fromPrismic(t),n)}},toPrismic(e){return ke.converter.toPrismic(e,w.RichTextNodeType.preformatted,xe.toPrismic(e))}},uu=new At([w.RichTextNodeType.preformatted],yt.name,yt,du,"",!0),mi=uu;function fi(e){const{editor:t,getPos:n,node:o}=e,[i,s]=f.useState(!1);return f.useEffect(()=>{function a(){const{from:d,to:c}=t.state.selection,u=n(),h=n()+o.nodeSize,g=d<=u&&c>=h;s(g)}function l(){s(!1)}return t.on("blur",l),t.on("selectionUpdate",a),()=>{t.off("blur",l),t.off("selectionUpdate",a)}},[t,n,o.nodeSize]),{selected:i}}function gu(e,t,n){const{node:o}=e,i=o.attrs.content,s=E.useStableCallback(e.updateAttributes),a=E.useDebounceState({initialState:(i==null?void 0:i.embed_url)??"",startTransition:f.startTransition});function l(u){s({content:u})}function d(u){a.set(u),te.toURL(u)||l(void 0)}const{onKeyDown:c}=hu(e,a.value,t,n);return{inputRef:t,containerRef:n,onKeyDown:c,url:a.value,urlChanged:d,onContentChange:l,debouncedUrl:a.debouncedValue,content:e.node.attrs.content}}function hu(e,t,n,o){const{editor:i,getPos:s,node:a}=e,[l,d]=f.useState(!0);f.useEffect(()=>{!l||!e.editor.isFocused||r.handleEditorFlushSyncError(()=>{var u;return(u=n.current)==null?void 0:u.focus()})},[n,l,e.editor.isFocused]);function c(u){const h=s(),g=s()+a.nodeSize;u.code==="Enter"&&(d(!1),i.chain().insertContentAt(g,{type:"paragraph"}).focus(g+1).run()),u.code==="Backspace"&&t===""&&i.chain().deleteRange({from:h,to:g}).focus(g+1).run(),u.code==="ArrowUp"&&(d(!1),i.chain().focus(h-1).run()),u.code==="ArrowDown"&&(d(!1),i.chain().focus(g+1).run())}return{containerRef:o,inputRef:n,onKeyDown:c}}function pu(e){const t=f.useRef(null),n=f.useRef(null),{onKeyDown:o,url:i,urlChanged:s,onContentChange:a,debouncedUrl:l,content:d}=gu(e,t,n),{selected:c}=fi(e);return A.jsx(ne.NodeViewWrapper,{className:"custom-embed",children:A.jsxs("div",{contentEditable:"false",suppressContentEditableWarning:!0,children:[A.jsxs(r.Box,{flexGrow:1,alignItems:"center",children:[A.jsx(r.Icon,{size:"small",name:"cloud",color:"grey11"}),A.jsx(r.Box,{flexGrow:1,height:40,ref:n,children:A.jsx(Fe,{id:"id",ref:t,value:i,variant:te.toURL(i)?"link":"normal",placeholder:"Paste your link here",onValueChange:s,onKeyDown:o})})]}),te.toURL(i)&&A.jsx(Do,{selected:c,debouncedUrl:l,onContentChange:a,content:d})]})})}const en=X.Node.create({name:"embed",group:"block",atom:!0,content:"block*",marks:"",addAttributes(){return{content:{default:void 0}}},addCommands(){return{setEmbed:()=>({tr:e,dispatch:t})=>{const n=this.type.create();return t&&e.replaceSelectionWith(n),!0}}},parseHTML(){return[{tag:"embed"}]},renderHTML(){return["embed"]},addNodeView(){return ne.ReactNodeViewRenderer(pu)}}),mu={fromPrismic(e){return function(t){var n;return(n=e.nodes[en.name])==null?void 0:n.create({content:t.data})}},toPrismic(e){return e.attrs.content===void 0?{type:"embed",data:{type:"embed",embed_url:"",__TYPE__:"EmbedContent",all:[]}}:{type:"embed",data:{...e.attrs.content}}}},Ci=new Fd([w.RichTextNodeType.embed],en.name,en,mu),tn="heading";function Lt(e){switch(e){case 1:return w.RichTextNodeType.heading1;case 2:return w.RichTextNodeType.heading2;case 3:return w.RichTextNodeType.heading3;case 4:return w.RichTextNodeType.heading4;case 5:return w.RichTextNodeType.heading5;case 6:return w.RichTextNodeType.heading6}}function eA(e){return{fullName:Lt(e),level:e}}const xi=[1,2,3,4,5,6];function yi(e,t=xi){const n=new RegExp(`^heading([${t.join(",")}]){1}$`),o=e.match(n);if(!o||!o[1])return;const i=parseInt(o[1]);return{fullName:Lt(i),level:i}}function Bi(e,t){const n=e.level;if(t.includes(n))return{fullName:Lt(n),level:n}}const fu=e=>{const t=e[0]??1;return{fromPrismic(n){return function(o){var a;const i=ke.converter.fromPrismic(n)(tn,o),s=yi(o.type,e)||eA(t);return(a=n.nodes[tn])==null?void 0:a.create({level:s.level,...xe.fromPrismic(o)},i)}},toPrismic(n){const{fullName:o}=Bi(n.attrs,e)||eA(t);return ke.converter.toPrismic(n,o,xe.toPrismic(n))}}};function Cu(e){return e?e.size?Array.from(e.values()).reduce((n,o)=>{const i=yi(o);return i?[...n,i.level]:n},[]).sort((n,o)=>n-o):[]:xi}function xu(e){return lr.extend({name:"heading"}).configure({levels:e})}const be={name:tn,build:e=>{const t=Cu(e);if(!t)return;const n=t.map(o=>Lt(o));return new bd(n,xu(t),t,fu(t),o=>{const i=Bi(o,t);return i&&`Heading ${i.level}`})}};function yu(e){const{content:t,thumbnail:n,imageViewProps:{getPos:o,updateAttributes:i,editor:s,node:a}}=e,[l,d]=f.useTransition();function c(y){d(()=>i({content:y}))}function u(y){const x=ct(y),I=o()+a.nodeSize;c({...t,...x}),s.chain().focus(I+1).run()}function h({croppedImages:y}){if(!t)return;const x=y[n.name];if(!x)return;const I=Wo({content:t,croppedImage:x});I!==t&&c(I)}function g(){const y=o(),x=o()+a.nodeSize;s.chain().deleteRange({from:y,to:x}).focus(x).run()}const{uploadImage:m,isUploadingImage:C}=oi({onMediaSelected:u});return{onMediaSelected:u,onCropperDialogClose:h,isUpdating:l,updateContent:c,onClear:g,uploadImage:m,isUploadingImage:C}}function Bu(e){const{node:t}=e,n=t.attrs.content,{selected:o}=fi(e),i=f.useRef(null),s={width:void 0,height:void 0,name:Ze},{onMediaSelected:a,onCropperDialogClose:l,isUpdating:d,updateContent:c,onClear:u,uploadImage:h,isUploadingImage:g}=yu({content:n,thumbnail:s,imageViewProps:e}),[m,C]=f.useState(!1),y="Feature image",x=(n==null?void 0:n.width)===0&&(n==null?void 0:n.height)===0,I=n&&!x?[`${n.width}×${n.height}px`]:[],B={thumbnail:s,contentView:n,labels:Ht(s,n,n)};f.useLayoutEffect(()=>{var b;const S=(b=i==null?void 0:i.current)==null?void 0:b.closest(`.${Ii}`);cr.isHTMLElement(S)&&S.style.removeProperty("min-height")},[]);const j=g||d;return A.jsx(ne.NodeViewWrapper,{children:A.jsx(Oo,{ref:i,isMediaDialogOpen:m,selected:o,onMediaSelected:a,onMediaDialogOpenChange:C,children:A.jsx(f.Suspense,{fallback:Fu,children:n!=null&&n.url?A.jsx(Ai,{allContentViews:[n],content:n,contentView:n,fieldLabel:y,imageLabel:I,initialImages:[B],isUpdating:j,readOnly:!1,thumbnailName:s.name,onClear:u,onContentChange:c,onCropperDialogClose:l,onMediaDialogOpenChange:C}):A.jsx(Vo,{uploadImage:h,isUploading:g,disabled:m,children:A.jsx(Mo,{fieldLabel:y,isUpdating:j,readOnly:!1,onMediaDialogOpenChange:C})})})})})}const Ii="imageViewNodeWrapper",ji=144,Iu=94;function ju(e){return(e?Iu:ji)+12+12+1+1}const Fu=A.jsx("div",{style:{height:ji}}),nn=X.Node.create({name:"image",group:"block",atom:!0,addAttributes(){return{content:{default:void 0}}},addCommands(){return{setImage:()=>e=>{const{dispatch:t,tr:n}=e,o=this.type.create();return t&&n.replaceSelectionWith(o),!0}}},parseHTML(){return[{tag:"image"}]},renderHTML({HTMLAttributes:e}){return["image",e]},addNodeView(){return function(t){const n=t.node.attrs.content===void 0;return ne.ReactNodeViewRenderer(Bu,{attrs:{style:`min-height: ${ju(n)}px`,class:Ii}})(t)}}}),Su={fromPrismic(e){return function(t){var n;return(n=e.nodes[nn.name])==null?void 0:n.create({content:t.data})}},toPrismic(e){if(e.attrs.content!==void 0)return{type:"image",data:{...e.attrs.content}}}},Fi=new Sd([w.RichTextNodeType.image],nn.name,nn,Su);class bu{constructor(t,n,o){W(this,"extType",Re.Mark);W(this,"richTextNodeTypes",[w.RichTextNodeType.em]);this.name=t,this.component=n,this.converter=o}}const Si="em",bi=dr.extend({name:Si}),Ku={fromPrismic(e){return function(){var t;return(t=e.marks[bi.name])==null?void 0:t.create()}},toPrismic(){}},Uu=new bu(Si,bi,Ku),Tn=Uu;class Tu{constructor(t,n,o){W(this,"extType",Re.Mark);W(this,"richTextNodeTypes",[]);this.name=t,this.component=n,this.converter=o}}const Ki="label",An=X.Mark.create({name:Ki,priority:1e3,keepOnSplit:!1,inclusive:!1,addOptions(){return{htmlAttributes:{style:"background-color: hsl(251, 89%, 96%); border: 1px dashed rgba(68, 53, 146, 0.4); border-radius: 0px 2px 2px 2px"}}},addAttributes(){return{label:{default:""}}},addCommands(){return{setLabel:e=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMark(this.name,e).run(),unsetLabel:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},renderHTML({HTMLAttributes:e}){return["span",X.mergeAttributes(this.options.htmlAttributes,e),0]}}),wu={fromPrismic(e){return function(t){var i;const n=t.data,o={type:An.name,label:n};return(i=e.marks[An.name])==null?void 0:i.create(o)}},toPrismic(e){return e.attrs.label}},wn=new Tu(Ki,An,wu);class Lu{constructor(t,n,o){W(this,"extType",Re.Mark);W(this,"richTextNodeTypes",[w.RichTextNodeType.hyperlink]);this.name=t,this.component=n,this.converter=o}}const Ui="hyperlink",fe=X.Mark.create({name:Ui,priority:1e3,keepOnSplit:!1,inclusive:!1,addOptions(){return{openOnClick:!1,linkOnPaste:!0,autolink:!0,protocols:[],htmlAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null,id:""},validate:void 0}},addAttributes(){return{href:{default:""},id:{default:""},target:{default:"_blank"},rel:{default:"noopener noreferrer nofollow"},class:{default:null},media:{default:null}}},parseHTML(){return[{tag:'a[href]:not([href *= "javascript:" i])'}]},renderHTML({HTMLAttributes:e}){return["a",X.mergeAttributes(this.options.htmlAttributes,e),0]},addCommands(){return{setWebLink:e=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMark(this.name,e).setMeta("preventAutolink",!0).run(),setDocumentLink:e=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMark(this.name,e).setMeta("preventAutolink",!0).run(),setMediaLink:e=>({chain:t})=>{const n=on($o({media:e.media}).value);return t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMark(this.name,{media:n}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}}}),vu={fromPrismic(e){return function(t){var o,i,s,a;const n=t.data;if(n.__TYPE__==="DocumentLink"){const l={type:fe.name,id:n.id};return(o=e.marks[fe.name])==null?void 0:o.create(l)}if(n.__TYPE__==="ImageLink"){const l={type:fe.name,media:on(n)};return(i=e.marks[fe.name])==null?void 0:i.create(l)}if(n.__TYPE__==="FileLink"){const l={type:fe.name,media:on(n)};return(s=e.marks[fe.name])==null?void 0:s.create(l)}if(n.__TYPE__==="ExternalLink"){const l={type:fe.name,url:n.url,href:n.url,target:n.target};return(a=e.marks[fe.name])==null?void 0:a.create(l)}}},toPrismic(e){return e.attrs.media?wi(e.attrs.media):e.attrs.id?{__TYPE__:"DocumentLink",id:e.attrs.id}:{__TYPE__:"ExternalLink",url:e.attrs.href,target:e.attrs.target}}},Ti=new Lu(Ui,fe,vu);function on(e){return JSON.stringify(e)}function wi(e){return JSON.parse(e)}const rn=ur.extend({name:"orderedList",addAttributes(){return{start:{default:1,parseHTML:e=>e.hasAttribute("start")?parseInt(e.getAttribute("start")||"",10):1}}},renderHTML({HTMLAttributes:e}){const{start:t,...n}=e;return t===1?["ol",X.mergeAttributes(this.options.HTMLAttributes,n),0]:["ol",X.mergeAttributes(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleOrderedList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}}}).configure({itemTypeName:"listItem"}),ku={fromPrismic(e){return function(t){var o;const n=Ne.converter.fromPrismic(e)(t);if(n)return(o=e.nodes[rn.name])==null?void 0:o.create(xe.fromPrismic(t),n)}},toPrismic(e){return Ie.children.map(e,t=>Ne.converter.toPrismic(t,w.RichTextNodeType.orderedList).filter(ae.isDefined)).flat()}},Eu=new bn([w.RichTextNodeType.orderedList],rn.name,rn,ku),Bt=Eu;function Du({editor:e}){const t=e.isActive("table")&&e.isActive("innerTable");return A.jsxs(ne.NodeViewWrapper,{className:r.tableFieldStyles.tableWithControls,children:[A.jsx(ne.NodeViewContent,{className:r.tableFieldStyles.tableContent}),A.jsx("button",{type:"button",className:r.tableFieldStyles.addTableRowButton,onClick:e.commands.addRowEnd,"aria-disabled":!t,"aria-label":"Add row",title:"Add row",children:A.jsx(r.Icon,{name:"add",size:"small"})}),A.jsx("button",{type:"button",className:r.tableFieldStyles.addTableColumnButton,onClick:e.commands.addColumnEnd,"aria-disabled":!t,"aria-label":"Add column",title:"Add column",children:A.jsx(r.Icon,{name:"add",size:"small"})})]})}function vt(e,t){const n=e.nodes[t];if(!n)throw new Error(`Unwanted state: ${t} not found in schema.`);return n}function Li(e){return t=>{switch(t.type){case"hyperlink":case"paragraph":case"strong":case"em":return J.converter.fromPrismic(e)(t)||[];default:return[]}}}const tA={fromPrismic(e){return function(t){return vt(e,lA.TableCell.name).create({colspan:1,rowspan:1,colwidth:null},t.content.value.flatMap(Li(e)))}},toPrismic(e){const t=[];return e.content.forEach(n=>{const o=J.converter.toPrismic(n);K.TextBlock.is(o)&&t.push(o)}),{type:"tableCell",content:{__TYPE__:"StructuredTextContent",value:t}}}},nA={fromPrismic(e){return function(t){return vt(e,cA.TableHeader.name).create({colspan:1,rowspan:1,colwidth:null},t.content.value.flatMap(Li(e)))}},toPrismic(e){const t=[];return e.content.forEach(n=>{const o=J.converter.toPrismic(n);K.TextBlock.is(o)&&t.push(o)}),{type:"tableHeader",content:{__TYPE__:"StructuredTextContent",value:t}}}},AA={fromPrismic(e){return function(t){return vt(e,dA.TableRow.name).create({},t.content.map(o=>{switch(o.type){case"tableHeader":return nA.fromPrismic(e)(o);case"tableCell":return tA.fromPrismic(e)(o)}}))}},toPrismic(e){const t=[];return e.content.forEach(n=>{switch(n.type.name){case"tableHeader":{t.push(nA.toPrismic(n));break}case"tableCell":{t.push(tA.toPrismic(n));break}}}),{type:"tableRow",content:t}}},sn=gr.Table.extend({name:"innerTable",group:"table",addNodeView(){return({node:e})=>new Se.TableView(e,120)},addCommands(){var e;return{...(e=this.parent)==null?void 0:e.call(this),addRowEnd:()=>({dispatch:t,state:n})=>{if(!Se.isInTable(n))return!1;if(t){const o=Se.selectedRect(n),i=o.map.height;t(Se.addRow(n.tr,o,i))}return!0},addColumnEnd:()=>({dispatch:t,state:n})=>{if(!Se.isInTable(n))return!1;if(t){const o=Se.selectedRect(n),i=o.map.width;t(Se.addColumn(n.tr,o,i))}return!0}}}}),Ru={fromPrismic(e){return function(t){const o=vt(e,sn.name).create({},t.content.map(AA.fromPrismic(e))),i=e.nodes[vi.name];return i?i.create({},o):o}},toPrismic(e){var n;const t=((n=e.content.firstChild)==null?void 0:n.type.name)===sn.name?e.content.firstChild:e;return{type:"table",content:Ie.children.map(t,o=>AA.toPrismic(o))}}},vi=ne.Node.create({name:"table",group:"block",content:"innerTable",selectable:!1,parseHTML(){return[{tag:"div"}]},renderHTML({HTMLAttributes:e}){return["div",e,0]},addNodeView(){return ne.ReactNodeViewRenderer(Du)}}),Qu=new Kd([Te.table],Te.table,[vi,sn,dA.TableRow,cA.TableHeader,lA.TableCell],Ru),ki=[Kn,Tn,Ti],Ei=[...ki,wn];function Di(e){return Id(e)?[...ki,J,Qu].filter(ae.isDefined):[J,xt,Bt,be.build(e),mi,Ci,Fi,...Ei].filter(ae.isDefined)}const Ri=[{nodeType:w.RichTextNodeType.paragraph,icon:"textFields",isActive:e=>e.isActive(J.name)&&!e.isActive(xt.name)&&!e.isActive(Bt.name),runCommands:Y((e,t)=>e.clearNodes().setDirection(se(t))),shortText:"par",text:"Paragraph"},{nodeType:w.RichTextNodeType.heading1,icon:"looks1",isActive:e=>e.isActive(be.name,{level:1}),runCommands:Y((e,t)=>e.setHeading({level:1}).setDirection(se(t))),shortText:"h1",text:"Heading 1"},{nodeType:w.RichTextNodeType.heading2,icon:"looks2",isActive:e=>e.isActive(be.name,{level:2}),runCommands:Y((e,t)=>e.setHeading({level:2}).setDirection(se(t))),shortText:"h2",text:"Heading 2"},{nodeType:w.RichTextNodeType.heading3,icon:"looks3",isActive:e=>e.isActive(be.name,{level:3}),runCommands:Y((e,t)=>e.setHeading({level:3}).setDirection(se(t))),shortText:"h3",text:"Heading 3"},{nodeType:w.RichTextNodeType.heading4,icon:"looks4",isActive:e=>e.isActive(be.name,{level:4}),runCommands:Y((e,t)=>e.setHeading({level:4}).setDirection(se(t))),shortText:"h4",text:"Heading 4"},{nodeType:w.RichTextNodeType.heading5,icon:"looks5",isActive:e=>e.isActive(be.name,{level:5}),runCommands:Y((e,t)=>e.setHeading({level:5}).setDirection(se(t))),shortText:"h5",text:"Heading 5"},{nodeType:w.RichTextNodeType.heading6,icon:"looks6",isActive:e=>e.isActive(be.name,{level:6}),runCommands:Y((e,t)=>e.setHeading({level:6}).setDirection(se(t))),shortText:"h6",text:"Heading 6"},{nodeType:w.RichTextNodeType.list,icon:"formatListBulleted",isActive:e=>e.isActive(xt.name),runCommands:Y((e,t)=>e.toggleBulletList().setDirection(se(t))),shortText:"bull",text:"Bulleted list"},{nodeType:w.RichTextNodeType.orderedList,icon:"formatListNumbered",isActive:e=>e.isActive(Bt.name),runCommands:Y((e,t)=>e.toggleOrderedList().setDirection(se(t))),shortText:"num",text:"Numbered list"},{nodeType:w.RichTextNodeType.preformatted,icon:"dataObject",isActive:e=>e.isActive(mi.name),runCommands:Y((e,t)=>e.setCodeBlock().setDirection(se(t))),shortText:"code",text:"Code"},{nodeType:w.RichTextNodeType.embed,icon:"cloud",isActive:e=>e.isActive(Ci.name),runCommands:Y(e=>e.setEmbed()),shortText:"emb",text:"Embed"},{nodeType:w.RichTextNodeType.image,icon:"image",isActive:e=>e.isActive(Fi.name),runCommands:Y(e=>e.setImage()),shortText:"img",text:"Image"}],Mu=[{nodeType:w.RichTextNodeType.strong,icon:"formatBold",isActive:e=>e.isActive(Kn.name),runCommands:Y(e=>e.toggleBold())},{nodeType:w.RichTextNodeType.em,icon:"formatItalic",isActive:e=>e.isActive(Tn.name),runCommands:Y(e=>e.toggleItalic())}],qu=[{nodeType:w.RichTextNodeType.rtl,icon:"formatTextDirectionRToL",isActive:e=>e.isActive({[Ce]:Ue}),runCommands:Y((e,t)=>e.toggleDirection(se(t)))}];function Y(e){return(t,n={})=>{let o=n.can===!0?t.can().chain():t.chain().focus();return n.deleteRange!==void 0&&(o=o.deleteRange(n.deleteRange)),n.can?Pu(t,o,e):e(o,t).run()}}function se(e){const t=e.state.selection.$from.parent.attrs;return xe.parseNodeAttrsDirection(t)}function ut(e,t){return e.filter(n=>t.includes(n.nodeType))}function Pu(e,t,n){try{return n(t,e).run()}catch{return!1}}function Ou(e){const{items:t,editor:n}=e;return t.length===0?null:A.jsxs(A.Fragment,{children:[t.map(o=>A.jsx(r.ToolbarToggleButton,{disabled:!o.runCommands(n,{can:!0}),onPressedChange:()=>{o.runCommands(n)},pressed:o.isActive(n),startIcon:o.icon},o.nodeType)),A.jsx(r.ToolbarSeparator,{})]})}function Vu(e){const{labels:t,editor:n}=e,o=n.getAttributes("label").label;return A.jsxs(A.Fragment,{children:[A.jsxs(r.DropdownMenu,{children:[A.jsx(r.DropdownMenuTrigger,{disabled:t.length===0,children:A.jsx(r.Button,{endIcon:"arrowDropDown",size:"small",color:"grey",children:oA(o??"Labels")})}),A.jsx(r.DropdownMenuContent,{align:"start",asPortal:!1,maxHeight:256,avoidCollisions:!1,children:t.map((i,s)=>{const a=o===i;return A.jsx(r.DropdownMenuItem,{onSelect:()=>a?n.commands.unsetLabel():Yu(n,i),endIcon:a&&A.jsx(r.Icon,{name:"check",size:"extraSmall"}),children:oA(i)},`${i}-${s}`)})})]}),A.jsx(r.ToolbarSeparator,{})]})}function Yu(e,t){Y(o=>o.setLabel({label:t}))(e)}function oA(e){return Ae.overflow(e,20)}function Wu(e){const{editor:t}=e,n=t.getAttributes("label");if(!n.label)return null;const o=n.label;return A.jsx(r.Box,{backgroundColor:"purple9",padding:{block:2,inline:4},alignItems:"center",borderRadius:{topLeft:2,topRight:2,bottomRight:2},maxWidth:125,children:A.jsx(r.Text,{color:"white",variant:"small",noWrap:!0,children:o})})}function Hu(e){const{disabled:t,showWebLinkModal:n,showDocumentsLinkModal:o,showMediaLinkModal:i}=_u(e);return A.jsxs(A.Fragment,{children:[A.jsxs(r.ToolbarButtonGroup,{density:"compact",children:[A.jsx(r.ToolbarButton,{disabled:t,startIcon:"link",onClick:n},w.RichTextNodeType.hyperlink),A.jsxs(r.DropdownMenu,{children:[A.jsx(r.DropdownMenuTrigger,{children:A.jsx(r.ToolbarButton,{startIcon:"arrowDropDown"})}),A.jsxs(r.DropdownMenuContent,{align:"end",asPortal:!1,children:[A.jsx(r.DropdownMenuItem,{startIcon:A.jsx(r.Icon,{name:"public"}),onSelect:n,children:"Link to web page"}),A.jsx(r.DropdownMenuItem,{startIcon:A.jsx(r.Icon,{name:"description"}),onSelect:o,children:"Link to document"}),A.jsx(r.DropdownMenuItem,{startIcon:A.jsx(r.Icon,{name:"image"}),onSelect:i,children:"Link to media"})]})]})]}),A.jsx(r.ToolbarSeparator,{})]})}function _u(e){const{editor:t,setModal:n}=e;function o(){n("webLink")}function i(){n("documentLink")}function s(){n("mediaLink")}return{disabled:!Y(l=>l.setWebLink({href:""}))(t,{can:!0}),showWebLinkModal:o,showDocumentsLinkModal:i,showMediaLinkModal:s}}function zu(e){const{docId:t,onEdit:n,onUnlink:o}=e,i=Nu(t),s=L();if(!i)return null;const a=i.versions[0],l=dn({status:a==null?void 0:a.status,releaseId:(a==null?void 0:a.status)==="release"?a.release_id:void 0,documentId:i.id,versionId:a==null?void 0:a.version_id,baseUrl:s.baseUrl}),d=(a==null?void 0:a.preview_summary)??"",c=(a==null?void 0:a.custom_type_label)??"";return A.jsx(ve,{url:l,title:i.title,subTitle:c,description:d,onEdit:n,onUnlink:o,largeIconName:"description"})}function Nu(e){const t=L();t.searchDocuments||V("searchDocuments");const{coreApiBaseUrl:n,authStrategy:o}=t;return R.useRequest(et,[n,o,e])}function Gu(e){const{editor:t}=e,{searchDocuments:n}=L(),o=t.getAttributes(w.RichTextNodeType.hyperlink);if(o.id&&n){const i=o.id;return A.jsx(Zu,{docId:i,...e})}if(o.href){const i=o.href;return A.jsx(Ju,{url:i,...e})}if(o.media){const i=wi(o.media);return A.jsx(Xu,{media:i,...e})}return null}function Zu(e){const{editor:t,onEditDocumentLink:n,docId:o}=e;return A.jsx(r.ErrorBoundary,{renderError:()=>A.jsx(ve,{title:"Failed to Load Linked Document Data",error:!0,onEdit:n,onUnlink:()=>we(t)}),children:A.jsx(f.Suspense,{fallback:A.jsx(ve,{loading:!0,onEdit:n,onUnlink:()=>we(t)}),children:A.jsx(zu,{docId:o,onEdit:n,onUnlink:()=>we(t)})})})}function Ju(e){const{url:t,editor:n,onEditWebLink:o}=e,i=te.toURL(t);return i?A.jsx(ve,{url:t,title:te.getUrlTitle(i),subTitle:t,onEdit:o,onUnlink:()=>we(n)}):A.jsx(ve,{url:t,subTitle:t,onEdit:o,onUnlink:()=>we(n)})}function Xu(e){const{media:t,editor:n,onEditMediaLink:o}=e;return K.FilledImageLinkContent.is(t)?A.jsx(Xo,{url:t.url,title:t.name,subTitle:`${t.width} x ${t.height} pixels`,onEdit:o,onUnlink:()=>we(n)}):K.FilledFileLinkContent.is(t)?A.jsx(ve,{url:t.url,title:t.name,subTitle:$u({filename:t.name}),largeIconName:"insertDriveFile",onEdit:o,onUnlink:()=>we(n)}):null}function we(e){Y(n=>n.unsetLink())(e)}function $u(e){const{filename:t}=e,n=t.split(".").pop();return n?n.toLowerCase():""}function eg(e){const{open:t}=e,{onOpenChange:n,onSelectDocument:o}=tg(e);return A.jsx(No,{open:t,onOpenChange:n,onSelectDocument:o})}function tg(e){const{editor:t,setOpen:n}=e;function o(s){Y(l=>l.extendMarkRange(w.RichTextNodeType.hyperlink).setDocumentLink({id:s}))(t),n(!1)}function i(s){n(s)}return{onSelectDocument:o,onOpenChange:i}}function ng(e){const{open:t}=e,{onOpenChange:n,onMediaSelected:o}=Ag(e);return A.jsx(jn,{open:t,onOpenChange:n,onMediaSelected:o,assetType:"all"})}function Ag(e){const{editor:t,setOpen:n}=e;function o(i){Y(a=>a.extendMarkRange(w.RichTextNodeType.hyperlink).setMediaLink({media:i}))(t),n(!1)}return{onMediaSelected:o,onOpenChange:n}}function og(e){const{open:t,setOpen:n}=e,{url:o,setUrl:i,openInNewTab:s,setOpenInNewTab:a,disabled:l,onUpdate:d}=ig(e);return A.jsxs(r.Dialog,{open:t,onOpenChange:n,size:"small",noDescription:!0,children:[A.jsx(r.DialogHeader,{title:"Set Link URL"}),A.jsxs(r.DialogContent,{padding:16,children:[A.jsx(r.FormInput,{value:o,onValueChange:i,placeholder:"Paste URL",icon:"public"}),o&&A.jsx(r.InlineLabel,{value:"Open in new tab",children:A.jsx(r.Checkbox,{checked:s,onCheckedChange:a})})]}),A.jsxs(r.DialogActions,{children:[A.jsx(r.DialogCancelButton,{}),A.jsx(r.DialogActionButton,{onClick:d,disabled:l,children:"Update"})]})]})}function ig(e){const{editor:t,open:n,setOpen:o}=e,i=rg(t),[s,a]=f.useState(i.url),[l,d]=f.useState(i.openInNewTab);E.useOnChange(n,()=>{n&&(a(i.url),d(i.openInNewTab))});const c=!s||s===i.url&&l===i.openInNewTab;function u(){const h=l?"_blank":"_self";Y(g=>g.extendMarkRange(w.RichTextNodeType.hyperlink).setWebLink({href:s,target:h}))(t),o(!1)}return{url:s,setUrl:a,openInNewTab:l,disabled:c,setOpenInNewTab:d,onUpdate:u}}function rg(e){const t=e.getAttributes(w.RichTextNodeType.hyperlink);return{url:t.href??"",openInNewTab:t.target==="_blank"}}function sg(e){const{items:t,editor:n}=e;return t.length===0?null:A.jsxs(A.Fragment,{children:[A.jsx(r.ToolbarToggleButtonGroup,{onValueChange:o=>{t.forEach(i=>{(i.isActive(n)&&!o.includes(i.nodeType)||!i.isActive(n)&&o.includes(i.nodeType))&&i.runCommands(n)})},type:"multiple",value:t.filter(o=>o.isActive(n)).map(o=>o.nodeType),children:t.map(o=>A.jsx(r.ToolbarToggleButtonGroupItem,{disabled:!o.runCommands(n,{can:!0}),startIcon:o.icon,value:o.nodeType},o.nodeType))},"mark"),A.jsx(r.ToolbarSeparator,{})]})}function ag(e){var o;const{items:t,editor:n}=e;return t.length===0?null:A.jsxs(A.Fragment,{children:[A.jsxs(r.DropdownMenu,{children:[A.jsx(r.DropdownMenuTrigger,{disabled:t.length===1,children:A.jsx(r.Button,{endIcon:"arrowDropDown",size:"small",color:"grey",children:((o=t.find(i=>i.isActive(n)))==null?void 0:o.text)??""})}),A.jsx(r.DropdownMenuContent,{align:"start",asPortal:!1,maxHeight:256,avoidCollisions:!1,children:t.map(i=>A.jsx(r.DropdownMenuItem,{onSelect:()=>{i.runCommands(n)},children:i.text},i.nodeType))})]}),A.jsx(r.ToolbarSeparator,{})]})}function Pt(e){return{duration:100,hideOnClick:!0,offset:e,placement:"top-start",appendTo:document.querySelector("body > div")??"parent"}}function lg(e){const{editor:t,nodeTypes:n,labels:o,hideDisabledOptions:i=!1}=e,[s,a]=f.useState(),l=n.includes(w.RichTextNodeType.hyperlink),d=!s,{shouldShowBubbleMenu:c,shouldshowPopover:u}=dg({editor:t}),[h,g]=f.useState(!0);f.useEffect(()=>{g(!1)},[]);function m(x){a(x?"webLink":void 0)}function C(x){a(x?"documentLink":void 0)}function y(x){a(x?"mediaLink":void 0)}return h?null:A.jsxs(A.Fragment,{children:[A.jsx(ne.BubbleMenu,{editor:t,tippyOptions:Pt([-48,0]),shouldShow:c,children:d&&A.jsx(cg,{editor:t,nodeTypes:n,labels:o,setModal:a,hideDisabledOptions:i})}),A.jsx(ne.BubbleMenu,{editor:t,tippyOptions:Pt([-48,0]),shouldShow:x=>u(x,"hyperlink"),children:d&&A.jsx(Gu,{editor:t,onEditWebLink:()=>a("webLink"),onEditDocumentLink:()=>a("documentLink"),onEditMediaLink:()=>a("mediaLink")})}),A.jsx(ne.BubbleMenu,{editor:t,tippyOptions:Pt([0,0]),shouldShow:x=>u(x,"label"),children:A.jsx(Wu,{editor:t})}),l&&A.jsxs(A.Fragment,{children:[A.jsx(og,{open:s==="webLink",setOpen:m,editor:t}),A.jsx(eg,{open:s==="documentLink",setOpen:C,editor:t}),A.jsx(ng,{open:s==="mediaLink",setOpen:y,editor:t})]})]})}function cg(e){const{editor:t,nodeTypes:n,labels:o,setModal:i,hideDisabledOptions:s}=e,a=n.includes("hyperlink"),l=o.length>0,d=ut(Ri,n),c=ut(Mu,n),u=ut(qu,n),h=s&&d.length===1?0:d.length,g=h+c.length+u.length+Number(a);return g===0?null:A.jsxs(r.Toolbar,{children:[h>0&&A.jsx(ag,{items:d,editor:t}),l&&A.jsx(Vu,{labels:o,editor:t}),A.jsx(sg,{items:c,editor:t}),a&&A.jsx(Hu,{editor:t,setModal:i}),A.jsx(Ou,{items:u,editor:t}),g>1&&A.jsx(r.ToolbarButton,{onClick:()=>{t.chain().focus().clearNodes().unsetAllMarks().run()},startIcon:"formatClear"},"clear")]})}function dg(e){const{editor:t}=e;function n(i){const{view:s,state:a,from:l,to:d}=i;if(!s.hasFocus())return!1;const{doc:c,selection:u}=a;return!(t.isActive(w.RichTextNodeType.preformatted)||u.empty||c.textBetween(l,d).length===0)}function o(i,s){const{view:a,state:l,from:d,to:c}=i,u=a.state.doc.nodeAt(d),{doc:h,selection:g}=l;return!g.empty||h.textBetween(d,c).length>0?!1:!!(u!=null&&u.marks.some(C=>C.type.name===s))}return{shouldShowBubbleMenu:n,shouldshowPopover:o}}function Qi(e){const{content:t,field:n,id:o,readOnly:i}=e,s=ug(n),a=t&&Jt.converter(s.nodeExtensions).fromPrismic(s.schema,s.nodeTypes,t),l=E.useStableCallback(e.onContentChange),d=r.useEditor({content:a==null?void 0:a.toJSON(),editable:!i,editorProps:{attributes:{class:`${r.contentEditableClass} ${r.contentEditableMultilinePlaceholderClass}`,id:o,tabIndex:"0"}},extensions:s.allComponents,injectCSS:!1,onUpdate({editor:c}){if(c.isEmpty)return l(void 0);const u=Jt.converter(s.nodeExtensions).toPrismic(c.state.doc);l(u)}},[s,i]);return A.jsxs(r.Field,{children:[A.jsx(r.FieldLabel,{htmlFor:o,children:Z(n)}),A.jsxs(r.FieldControl,{children:[d.isEditable&&A.jsx(lg,{editor:d,nodeTypes:s.names,labels:s.labels,hideDisabledOptions:!0}),A.jsx(ne.EditorContent,{editor:d,style:{flexGrow:1}})]})]})}function ug(e){var n,o;const t=`${((n=e.config)==null?void 0:n.multi)??""}-${((o=e.config)==null?void 0:o.single)??""}`;return f.useMemo(()=>{var C;const{extensions:i,nodeTypes:s}=Td(e.config),a=i.filter(gg),l=i.flatMap(y=>y.richTextNodeTypes);s.has(Xn)&&l.push(Xn);const d=i.flatMap(y=>y.component),c=i.filter(hg).map(y=>y.name),u=[...d,...su(e,a),$d.configure({supportedExtensionNames:c}),er,$i.History],h=u.map(y=>y.name),g=X.getSchema(u),m=pg((C=e.config)==null?void 0:C.labels);return{allComponents:u,extensionNames:h,nodeTypes:s,nodeExtensions:a,names:l,schema:g,labels:m}},[t])}function gg(e){return e.extType===Re.Node}function hg(e){return!(e.extType!==Re.Node||e.nodeType!==Ke.Text||e.lockedFormat)}function pg(e){return Array.from(e??[])}function mg(e){const{content:t,field:n,id:o,readOnly:i,onContentChange:s}=e,{placeholder:a,options:l}=n.config??{},d=!!(l!=null&&l.includes("")),c=xg(n),u=fg({content:t,placeholder:a,defaultValue:c,canHaveEmptyValue:d}),h=a&&c===void 0||a===void 0&&!d;return A.jsxs(r.Field,{children:[A.jsx(r.FieldIcon,{name:"arrowDropDownCircle"}),A.jsx(r.FieldLabel,{htmlFor:o,children:Z(n)}),A.jsx(r.FieldControl,{children:A.jsxs(r.Select,{id:o,size:"large",color:"grey",value:u,disabled:i,renderTrigger:()=>A.jsx(r.SelectGhostTrigger,{id:o}),onValueChange:g=>{s(Cg({value:g,placeholder:a}))},children:[h&&A.jsx(r.SelectItem,{value:a||It,children:a||""}),l==null?void 0:l.map(g=>A.jsx(r.SelectItem,{value:g||It,children:g},g))]})})]})}function fg(e){const{content:t,placeholder:n,defaultValue:o,canHaveEmptyValue:i}=e;let{value:s}=t??{};return s===""&&i?It:(s===""&&(s=void 0),s??o??n??"")}function Cg(e){const{placeholder:t}=e;let{value:n}=e;if(n!==t)return n===It&&(n=""),{__TYPE__:"FieldContent",type:"Select",value:n}}function xg(e){var t,n;return((t=e.config)==null?void 0:t.default_value)===void 0||(n=e.config.options)==null?void 0:n[0]}const It=" ";function yg(e){const{field:t,content:n,onContentChange:o,...i}=e;function s(a){if(!a)return o(void 0);e.onContentChange(Fg(a))}return A.jsx(Qi,{...i,field:Sg(t),content:Ig(n),onContentChange:s})}const Bg={__TYPE__:"StructuredTextContent",value:[{type:"paragraph",content:{text:""}}]},iA=Array.from({length:3},()=>({type:"tableRow",content:Array.from({length:2},()=>({type:"tableCell",content:Bg}))}));function Ig(e){return{__TYPE__:"StructuredTextContent",value:[{type:"table",content:jg(e)}]}}function jg(e){const t=K.TableContent.decode(e);return t._tag==="Left"||!t.right.content.some(o=>o.content.some(i=>i.content.value.some(({type:s})=>s)))?iA:t.right.content}function Fg(e){return{__TYPE__:"TableContent",content:e.value.flatMap(t=>t.type==="table"?t.content:[])}}function Sg(e){var t;return{...w.TableCell,config:{...w.TableCell.config,label:(t=e.config)==null?void 0:t.label,allowTargetBlank:!0,multi:[w.TableCell.config.multi,Te.table].join(",")}}}function bg(e){const{id:t,readOnly:n,field:o,content:i,onContentChange:s}=e,a=i!=null&&i.value?cn.dateFromISOString(i.value):void 0;return A.jsxs(r.Field,{children:[A.jsx(r.FieldIcon,{name:"event"}),A.jsx(r.FieldLabel,{id:t,children:Z(o)}),A.jsx(r.FieldControl,{children:A.jsx(r.Box,{padding:{left:4,right:12},width:"100%",flexDirection:"column",justifyContent:"center",children:A.jsx(r.DateInput,{mode:"date-time","aria-labelledby":t,disabled:n,value:a,onValueChange:l=>s(Kg(l))})})})]})}function Kg(e){if(e)return{__TYPE__:"FieldContent",type:"Timestamp",value:Ug(e)}}function Ug(e){const t=`${e.getUTCFullYear()}`.padStart(4,"0"),n=`${e.getUTCMonth()+1}`.padStart(2,"0"),o=`${e.getUTCDate()}`.padStart(2,"0"),i=`${e.getUTCHours()}`.padStart(2,"0"),s=`${e.getUTCMinutes()}`.padStart(2,"0");return`${t}-${n}-${o}T${i}:${s}:00+00:00`}function kt(e){const{id:t,readOnly:n,content:o,nestableWidget:i}=e,s=E.useStableCallback(e.onContentChange);return f.useMemo(()=>{const a={id:t,readOnly:n,onContentChange:s};return i.type==="Boolean"?A.jsx(Cl,{...a,field:i,content:K.isBooleanContent(o)?o:void 0}):i.type==="Date"?A.jsx(Il,{...a,field:i,content:K.isDateContent(o)?o:void 0}):i.type==="Timestamp"?A.jsx(bg,{...a,field:i,content:K.isTimestampContent(o)?o:void 0}):i.type==="Image"?A.jsx(Ad,{...a,field:i,content:K.isImageContent(o)?o:void 0}):i.type==="Link"?A.jsx(Cd,{...a,field:i,content:o}):i.type==="Number"?A.jsx(xd,{...a,field:i,content:K.isNumberContent(o)?o:void 0}):i.type==="StructuredText"?A.jsx(Qi,{...a,field:i,content:K.isRichTextContent(o)?o:void 0}):i.type==="Select"?A.jsx(mg,{...a,field:i,content:K.isSelectContent(o)?o:void 0}):i.type==="Text"?A.jsx(si,{...a,field:i,content:K.isTextContent(o)?o:void 0}):i.type==="Embed"?A.jsx(kl,{...a,field:i,content:K.isEmbedContent(o)?o:void 0}):i.type==="Color"?A.jsx(yl,{...a,field:i,content:K.isColorContent(o)?o:void 0}):i.type==="GeoPoint"?A.jsx(El,{...a,field:i,content:K.isGeoPointContent(o)?o:void 0}):i.type==="IntegrationFields"?A.jsx(md,{...a,field:i,content:K.isIntegrationFieldContent(o)?o:void 0}):i.type==="Table"?A.jsx(yg,{...a,field:i,content:K.isTableContent(o)?o:void 0}):null},[o,t,i,s,n])}function Tg(e){const{content:t,id:n,nonRepeatableZone:o,onContentChange:i,readOnly:s}=e,a=f.useMemo(()=>Object.entries(o),[o]);return A.jsx(A.Fragment,{children:a.map(([l,d])=>{const c=t[l];return A.jsx(kt,{id:`${n}.${l}`,readOnly:s,nestableWidget:d,content:K.isNestableContent(c)?c:void 0,onContentChange:u=>{i(wg(t,l,u))}},l)})})}function wg(e,t,n){return n?{...e,[t]:n}:Ge.removeKey(e,t)}function Ln(e){var s,a;const{group:t,content:n,onContentChange:o,...i}=e;return A.jsx(hl,{children:A.jsx(vn,{...i,title:an(t),addItemButtonTitle:`Add item in "${an(t)}"`,repeatable:((s=t.config)==null?void 0:s.repeat)!==!1,repeatableZone:((a=t.config)==null?void 0:a.fields)??{},content:n==null?void 0:n.value,onContentChange:l=>{o({__TYPE__:"GroupContentType",value:l})}})})}function an(e){var t;return((t=e.config)==null?void 0:t.label)??e.fieldset??e.type}function Mi(e){const{id:t,readOnly:n,content:o,widget:i}=e,s=E.useStableCallback(e.onContentChange);return f.useMemo(()=>{const a={id:t,readOnly:n,onContentChange:s};return i.type==="Group"?A.jsx(Ln,{...a,group:i,content:K.isGroupContent(o)?o:void 0}):A.jsx(kt,{...a,nestableWidget:i,content:K.isNestableContent(o)?o:void 0})},[o,t,i,s,n])}function vn(e){const{id:t,title:n,addItemButtonTitle:o,content:i,onContentChange:s,readOnly:a,repeatable:l=!0,repeatableZone:d}=e,c=Object.entries(d);let u=i??[kg];!l&&u.length>1&&(u=u.slice(0,1));const{scrollOffsetTop:h}=L(),g=f.useRef(new WeakMap);Lg(g.current,u);function m(B){return g.current.get(B)??"!bugged!"}function C(B){const j=ln();s(O.insertAtIndex(u,B,j))}function y(B){const{index:j,offset:S}=B;s(O.move(u,j,j+S))}function x(B){s(O.removeIndex(u,B))}function I(B,j,S,b){const v=Dg(B,[S,b]),F=Eg(u,[j,v]);vg(g.current,B,v),s(F)}return Object.keys(d).length===0?null:A.jsx(r.Group,{title:n??"Repeatable zone",addItemButtonTitle:o??"Add item in repeatable zone",items:u,maxItems:l?void 0:1,getItemKey:m,onAddItem:C,dnd:{scrollOffsetTop:h,onReorder:s,renderDragPreview:({index:B})=>A.jsx(Rg,{title:n??"Repeatable zone",index:B}),renderDropIndicator:Qg},children:(B,j)=>{const S=new Map(B.value),b=m(B);return A.jsx(r.LazyRender,{keepLoaded:!0,loadWhenSearching:!0,children:A.jsx(r.GroupItem,{index:j,title:`${j+1} • Item`,onMove:y,onDelete:x,children:c.map(([v,F])=>A.jsx(Mi,{id:`${t}[${b}].${v}`,content:S.get(v),widget:F,onContentChange:T=>I(B,j,v,T),readOnly:a},v))})})}})}function Lg(e,t){t.forEach(n=>{e.has(n)||e.set(n,mr.uniqueNumber())})}function vg(e,t,n){const o=e.get(t);o!==void 0&&e.set(n,o)}const kg={__TYPE__:"GroupItemContent",value:[]};function Eg(e,t){const[n,o]=t;return o?e.map((i,s)=>s===n?o:i):e.filter((i,s)=>s!==n)}function Dg(e,t){const[n,o]=t;if(!o){const s=e.value.filter(([a])=>a!==n);return ln(s)}const i=Array.from(new Map(e.value).set(n,o));return ln(i)}function ln(e=[]){return{__TYPE__:"GroupItemContent",value:e}}function Rg(e){const{title:t,index:n}=e;return A.jsxs(r.Box,{padding:{block:8,inline:12},backgroundColor:"grey3",border:!0,borderRadius:6,alignItems:"center",justifyContent:"space-between",width:"100%",children:[A.jsxs("div",{children:[A.jsx(r.Text,{variant:"smallBold",color:"grey11",children:t??"Repeatable zone"}),A.jsxs(r.Text,{variant:"small",color:"grey11",children:[n+1," • Item"]})]}),A.jsx(r.Icon,{name:"dragIndicator",size:"small",color:"grey8"})]})}function Qg(e){const{isDropTarget:t,itemIndex:n,position:o}=e,i=t?A.jsx(r.Line,{color:"purple",thickness:2,sx:{position:"absolute",left:0,right:0,bottom:n===0&&o==="before"?0:void 0}},"line"):void 0;return A.jsx(r.AnimatedElement,{enterDuration:150,children:i})}function Mg(e){const{compositeSlice:t,content:n,onContentChange:o,sliceKey:i,id:s,readOnly:a,header:l}=e,d=wt();function c(){i&&d.update({id:i,requestedFrom:"sliceFieldSet"})}return A.jsxs(r.FieldSet,{id:i&&Tt("sliceFieldSet",i),selected:i?d.isSelected(i):!1,onFocus:c,legend:qg(t),header:l,children:[A.jsx(Tg,{id:s,readOnly:a,nonRepeatableZone:t["non-repeat"]??{},content:n.nonRepeat,onContentChange:u=>{o({...n,nonRepeat:u})}}),A.jsx(vn,{id:s,readOnly:a,repeatableZone:t.repeat??{},content:n.repeat,onContentChange:u=>{o({...n,repeat:u})}})]})}function qg(e){var t;return((t=e.config)==null?void 0:t.label)??e.fieldset??e.type}const qi={__TYPE__:"ImageContent",edit:{background:"",crop:{x:0,y:0},zoom:0},height:0,width:0,origin:{height:0,width:0,id:"",url:""},url:""};function Pg(e){const{field:t}=e;if(t.type==="Image")return qi}function Og(e){const{content:t,legacySlice:n,sliceKey:o,id:i,readOnly:s,onContentChange:a,header:l}=e,d=wt();function c(){o&&d.update({id:o,requestedFrom:"sliceFieldSet"})}const u=n.type==="Group"?an(n):Z(n);return A.jsx(r.FieldSet,{id:o&&Tt("sliceFieldSet",o),selected:o?d.isSelected(o):!1,onFocus:c,legend:u,header:l,children:n.type==="Group"?A.jsx(Ln,{id:i,readOnly:s,onContentChange:a,group:n,content:K.isGroupContent(t)?t:void 0}):A.jsx(kt,{id:i,readOnly:s,nestableWidget:n,content:K.isNestableContent(t)?t:void 0,onContentChange:h=>{const g=Pg({field:n});!h&&g&&a(g),h&&a(h)}})})}function Vg(e){const{content:t,id:n,slicePrimaryZone:o,onContentChange:i,readOnly:s}=e,a=f.useMemo(()=>Object.entries(o),[o]);return A.jsx(A.Fragment,{children:a.map(([l,d])=>{const c=t[l];return A.jsx(Mi,{id:`${n}.${l}`,readOnly:s,widget:d,content:K.isSlicePrimaryContent(c)?c:void 0,onContentChange:u=>{i(Yg(t,l,u))}},l)})})}function Yg(e,t,n){return n?{...e,[t]:n}:Ge.removeKey(e,t)}function Pi(e){const{config:t,content:n,sliceKey:o,readOnly:i=!1,sharedSlice:s,onContentChange:a,...l}=e,d=Wg(s,n.variation),c=f.useId(),h={id:l.id??c,readOnly:i},g=wt();function m(){o&&g.update({id:o,requestedFrom:"sliceFieldSet"})}return d===void 0?null:A.jsx(jt.Provider,{value:t,children:A.jsx(gl,{children:A.jsxs(r.FieldSet,{id:o&&Tt("sliceFieldSet",o),selected:o?g.isSelected(o):!1,onFocus:m,legend:Hg(s,d),children:[A.jsx(r.LazyRender,{heightEstimate:400,gap:16,keepLoaded:!0,loadWhenSearching:!0,children:A.jsx(Vg,{...h,slicePrimaryZone:d.primary??{},content:n.primary,onContentChange:C=>{a({...n,primary:C})}})}),A.jsx(vn,{...h,repeatableZone:d.items??{},content:n.items,onContentChange:C=>{a({...n,items:C})}})]})})})}function Wg(e,t){return f.useMemo(()=>e.variations.find(n=>n.id===t),[e,t])}function Hg(e,t){return[e.name,t.name].join(" • ")}function rA(e){var d,c;const{sliceZone:t,onChange:n,slices:o,sliceContent:i}=e,s=(c=(d=t.config)==null?void 0:d.labels)==null?void 0:c[i.name];if(!s)return null;const a=s.find(u=>u.name===i.maybeLabel);function l(u){const h=o.value.map(g=>g.key===i.key?{...g,maybeLabel:u}:g);n({...o,value:h})}return A.jsxs(A.Fragment,{children:[A.jsx(r.Text,{component:"span",variant:"smallBold",children:"•"}),A.jsxs(r.DropdownMenu,{children:[A.jsx(r.DropdownMenuTrigger,{children:A.jsx(r.Button,{color:"grey",size:"small",endIcon:"arrowDropDown",invisible:!0,children:(a==null?void 0:a.display)??"Slice variation"})}),A.jsxs(r.DropdownMenuContent,{align:"start",maxHeight:256,children:[A.jsx(r.DropdownMenuItem,{onSelect:()=>l(void 0),endIcon:i.maybeLabel===void 0?A.jsx(r.Icon,{name:"check"}):void 0,children:"..."}),s==null?void 0:s.map(u=>A.jsx(r.DropdownMenuItem,{onSelect:()=>l(u.name),endIcon:u.name===i.maybeLabel?A.jsx(r.Icon,{name:"check"}):void 0,children:u.display??"[Missing display value]"},u.name))]})]})]})}function _g(e){const{content:t,id:n,onContentChange:o,readOnly:i,sliceZone:s}=e,a=L();return A.jsx(A.Fragment,{children:t==null?void 0:t.value.map((l,d)=>{var g,m;const c=(m=(g=s.config)==null?void 0:g.choices)==null?void 0:m[l.name];if(c===void 0)return null;const u=l.widget,h={id:`${n}[${l.key}]`,key:l.key,sliceKey:l.key,onContentChange:C=>{const y={...l,widget:C},x=zg(t,[d,y]);o(x)},readOnly:i};return c.type==="SharedSlice"?K.isSharedSliceContent(u)?A.jsx(Pi,{...h,config:a,sharedSlice:c,content:u}):null:c.type==="Slice"?K.isCompositeSliceContent(u)?A.jsx(Mg,{...h,compositeSlice:c,content:u,header:A.jsx(rA,{sliceContent:l,sliceZone:s,slices:t,onChange:o})}):null:K.isSimpleSliceContent(u)?A.jsx(Og,{...h,legacySlice:c,content:u,header:A.jsx(rA,{sliceContent:l,sliceZone:s,slices:t,onChange:o})}):null})})}function zg(e,[t,n]){return{__TYPE__:"SliceContentType",value:e.value.map((o,i)=>i===t?n:o)}}function Ng(e){const{content:t,metadataFieldType:n,documentId:o,documentContent:i,documentCustomType:s,documentLocale:a,...l}=e,{showAlert:d}=r.useAlert(),[c,u]=f.useState(!1),h=L(),g=f.useMemo(()=>BA(i,s),[i,s]),m=IA(g);async function C(){if(!h.aiSeoMetadataEnabled)return;const{awsBedrockRegion:y,awsBedrockAccessKeyId:x,awsBedrockSecretAccessKey:I,trackMetadataGeneration:B}=h;u(!0);try{const j=await yA({pageTextContent:g,contentLocale:a,config:{region:y,accessKeyId:x,secretAccessKey:I}});e.onContentChange({__TYPE__:"FieldContent",type:"Text",value:j[n]}),B({documentId:o,locale:a,suggestion:j[n],type:n})}catch{d({id:n,title:"Error",subtitle:`Failed to generate SEO metadata for ${sA[n]}`})}u(!1)}return A.jsx(si,{...l,content:t,placeholder:`${sA[n]}..`,endAdornment:A.jsxs(A.Fragment,{children:[A.jsx(Uo,{type:n,value:(t==null?void 0:t.value)||""}),A.jsx(r.Tooltip,{content:m?"Generate SEO metadata from your page content.":"Your page content is too short to generate SEO metadata.",children:A.jsx(r.Button,{disabled:!m,onClick:C,size:"small",color:"grey",startIcon:"autoFixHigh",loading:c,sx:{alignSelf:"center",marginInline:8},children:"Generate"})})]})})}const sA={[le]:"Meta title",[ue]:"Meta description"};function Gg(e){const{id:t,field:n,content:o,onContentChange:i}=e,s=E.useDebounceState({state:(o==null?void 0:o.value)??"",synchronize:!0}),{onEditUID:a}=f.useContext(wo);function l(c){a();const u=Ae.slugify(c);i(Xg(u)),s.set(u)}function d(c){l(c.clipboardData.getData("Text").trim()),c.preventDefault()}return A.jsxs(r.Field,{children:[A.jsx(r.FieldIcon,{name:"tag"}),A.jsx(r.FieldLabel,{htmlFor:t,children:Z(n)}),A.jsx(r.FieldControl,{children:A.jsx(Fe,{id:t,variant:"success",placeholder:De(n,"Enter a unique identifier"),value:s.value,onPaste:d,onValueChange:l,endAdornment:A.jsx(r.AnimatedElement,{enterDuration:150,children:A.jsx(Zg,{uid:s.debouncedValue})})})})]})}function Zg(e){const{uid:t}=e,n=L();return t?n.uidField?A.jsx(r.ErrorBoundary,{children:A.jsx(f.Suspense,{children:A.jsx(Jg,{uid:t})})}):null:A.jsx(r.Badge,{color:"tomato",title:"Required",size:"medium"})}function Jg(e){const t=$g(e),n=L();if(!t.documentId)return null;const o=dn({status:t.status,releaseId:t.releaseId,documentId:t.documentId,versionId:t.versionId,baseUrl:n.baseUrl});return A.jsx("a",{href:o.href,target:"_blank",rel:"noreferrer",children:A.jsx(r.Badge,{color:"tomato",size:"medium",title:A.jsxs(r.Text,{color:"tomato11",variant:"small",children:["Value already used in"," ",A.jsx(r.Text,{color:"tomato11",variant:"small",underline:!0,children:"another document"})]})})})}function Xg(e){return e===""?void 0:{__TYPE__:"UIDContent",value:e}}function $g(e){var g,m,C,y;const{uid:t}=e,n=L();n.uidField||V("uidField");const{coreApiBaseUrl:o,authStrategy:i,customTypeId:s,localeId:a,documentId:l}=n,{data:d}=mn({baseUrl:o,authStrategy:i,uids:[t]}),c=d.results,h=vo({customTypeId:s,languageId:a,documentsWithUid:c,documentId:l,uid:t})[0];return h?{documentId:h.id,versionId:(g=h.versions[0])==null?void 0:g.version_id,status:(m=h.versions[0])==null?void 0:m.status,releaseId:((C=h.versions[0])==null?void 0:C.status)==="release"?(y=h.versions[0])==null?void 0:y.release_id:void 0}:{}}function eh(e){const{id:t,readOnly:n,staticZone:o,content:i,onContentChange:s,documentId:a,documentContent:l,documentCustomType:d,documentLocale:c}=e,u=L(),h=f.useMemo(()=>Object.entries(o),[o]),g=f.useRef(i);if(f.useEffect(()=>{g.current=i},[i]),h.length===0)return null;const m=nh(h),C=gt(i[le])||"Meta title..",y=gt(i[ue])||"Meta description..";return A.jsxs(r.FieldSet,{legend:"Page data",children:[m&&A.jsx(To,{title:C,description:y}),h.map(([x,I])=>{const B={id:`${t}.${x}`,onContentChange:S=>{const{[x]:b,...v}=g.current;s({...v,...S!==void 0&&{[x]:S}})},readOnly:n},j=i[x];return I.type==="UID"?f.createElement(Gg,{...B,content:K.isUIDContent(j)?j:void 0,key:x,field:I}):I.type==="Group"?f.createElement(Ln,{...B,content:K.isGroupContent(j)?j:void 0,group:I,key:x}):u.aiSeoMetadataEnabled&&th(x)&&I.type==="Text"?f.createElement(Ng,{...B,content:K.isTextContent(j)?j:void 0,field:I,key:x,metadataFieldType:x,documentId:a,documentContent:l,documentCustomType:d,documentLocale:c}):f.createElement(kt,{...B,content:K.isNestableContent(j)?j:void 0,key:x,nestableWidget:I})})]})}function th(e){return e===le||e===ue}const nh=e=>{var t,n;return((t=e[0])==null?void 0:t[0])===le&&((n=e[1])==null?void 0:n[0])===ue};function Ah(e){const{id:t,readOnly:n,section:o,content:i,onContentChange:s,documentId:a,documentContent:l,documentCustomType:d,documentLocale:c}=e,[u,h]=ih(o),[g,m]=rh(i);return A.jsxs("div",{style:{display:"flex",flexDirection:"column",position:"relative",zIndex:0},children:[A.jsx(eh,{id:t,readOnly:n,staticZone:u,documentId:a,content:g,onContentChange:C=>s({...m,...C}),documentContent:l,documentCustomType:d,documentLocale:c}),h.map(([C,y])=>{const x=m[C];return A.jsx(_g,{id:`${t}.${C}`,readOnly:n,sliceZone:y,content:x,onContentChange:I=>s({...g,...m,[C]:I})},C)})]})}function oh(e){return e.type==="Choice"||e.type==="Slices"}function ih(e){return Object.entries(e).reduce(([t,n],[o,i])=>(oh(i)?n.push([o,i]):Object.assign(t,{[o]:i}),[t,n]),[{},[]])}function rh(e){return Object.entries(e).reduce(([t,n],[o,i])=>{const s={[o]:i};return Object.assign(K.isSlicesContent(i)?n:t,s),[t,n]},[{},{}])}function sh(e){const{config:t,readOnly:n=!1,customType:o,sectionName:i,documentId:s,content:a,locale:l,onContentChange:d}=e,c=f.useId();if(Ge.isEmpty(o.json))return null;const u=ah(o,i),[h,g]=lh(u,a);return A.jsx(jt.Provider,{value:t,children:A.jsx(ul,{customTypeFormat:o.format,children:A.jsx(Ah,{id:c,readOnly:n,section:u,documentId:s,content:h,onContentChange:m=>d({...g,...m}),documentContent:a,documentCustomType:o,documentLocale:l})})})}function ah(e,t){const n=e.json[t];if(n===void 0)throw new Error(`Cannot find a section with name '${t}'.`);return n}function lh(e,t){return Object.entries(t).reduce(([n,o],[i,s])=>{const a=e[i]!==void 0,l={[i]:s};return[{...n,...a?l:{}},{...o,...a?{}:l}]},[{},{}])}exports.BasicRole=HA;exports.DeferredCodeBlock=Ot;exports.DocumentEditor=sh;exports.EditorConfigContext=jt;exports.EditorErrorBoundary=Sr;exports.LocaleId=WA;exports.MediaLibrary=Ko;exports.MetadataBadge=Uo;exports.MetadataPreview=To;exports.OnboardingGuide=Al;exports.OnboardingStepId=os;exports.RolesPerLocale=bt;exports.RolesPerLocaleByUser=fn;exports.SelectionManagerProvider=xA;exports.SharedSliceEditor=Pi;exports.SliceSelectionContext=ko;exports.TeamSpace=Kt;exports.UIDContext=wo;exports.createSearchParams=vA;exports.createTeamSpace=ds;exports.defaultGroupContentWithOneItem=mA;exports.defaultImageContentWidget=qi;exports.deleteTeamSpace=gs;exports.documentKeys=de;exports.documentMetaSchema=hn;exports.documentSchema=zr;exports.documentStatus=fA;exports.extractTextFromField=gt;exports.fetchCustomTypes=Rr;exports.frameworkCreateProjectCodeSnippet=gA;exports.frameworkLabels=uA;exports.generateSEOMetadata=yA;exports.getConflictingUidDocuments=vo;exports.getCustomTypesOptions=$e;exports.getDocumentById=et;exports.getDocumentList=pn;exports.getDocumentListOptions=kA;exports.getOnboarding=is;exports.getPageTextContent=BA;exports.getProfile=GA;exports.getRepository=St;exports.getRepositoryTags=qA;exports.getRepositoryV2=As;exports.getSliceSelectionDOMId=Tt;exports.getTeamSpaces=_A;exports.getTeamSpacesOptions=ls;exports.hasUIDField=Lo;exports.invalidateCustomTypes=Mr;exports.invalidateDocumentListData=Zr;exports.isDocumentSearchVersion=Wt;exports.isDocumentVersion=UA;exports.isMissingUID=ll;exports.isPageContentRelevantForAISeo=IA;exports.isValidSimulatorURL=MA;exports.languageSchema=gn;exports.makeSearchFullTextDocumentsQueryString=LA;exports.metaDescriptionConfig=_e;exports.metaDescriptionProperty=ue;exports.metaTitleConfig=He;exports.metaTitleProperty=le;exports.onboardingStateSchema=OA;exports.onboardingToggleResultSchema=YA;exports.onboardingToggleStepResultSchema=VA;exports.prefetchCustomTypes=Dr;exports.prefetchStaticCustomType=Vr;exports.prepareDocumentForSave=Br;exports.profileResponse=NA;exports.repositoryFramework=Ft;exports.repositorySchemaV2=PA;exports.roleMap=ms;exports.searchDocumentStatus=Vt;exports.searchDocuments=EA;exports.searchDocumentsQueryOptions=DA;exports.searchFullTextDocuments=wA;exports.sliceItemContentSchema=Nr;exports.suppressErrors=Ur;exports.throwConfigError=V;exports.toggleOnboarding=ss;exports.toggleOnboardingStep=rs;exports.updateDocumentListData=Gr;exports.updateTeamSpace=us;exports.useCustomType=Qr;exports.useCustomTypes=un;exports.useDocumentList=mn;exports.useInvalidateTeamSpaces=cs;exports.useProfile=Cn;exports.useSelectionManager=je;exports.useSliceSelection=wt;exports.useStaticCustomType=Or;
|
|
58
|
+
`}function jY(e,t){const n=[];return ue.traverseDocument({document:e,customType:t})({transformWidget:({content:i,model:o,apiId:a})=>{var s;if(!(a===mo||a===oa)&&(ue.isRichTextContent(i)&&(o==null?void 0:o.type)==="StructuredText"||ue.isTextContent(i)&&(o==null?void 0:o.type)==="Text"||ue.isUIDContent(i)&&(o==null?void 0:o.type)==="UID")){const c=Qv(i);c&&n.push({label:((s=o.config)==null?void 0:s.label)||"",value:c})}}}),n.map(i=>JSON.stringify(i)).join(`
|
|
59
|
+
`)}function Qv(e){if(ue.isWidgetContent(e)){if(e.__TYPE__==="UIDContent")return e.value;if(e.__TYPE__==="StructuredTextContent"){const[t]=e.value;return!t||t.type==="image"||t.type==="embed"?void 0:t.content.text}if(e.__TYPE__==="FieldContent"&&e.type==="Text")return e.value}}function UY(e){return e.length>=300}const HNe=$.object({id:$.string(),label:$.string(),repeatable:$.boolean(),status:$.boolean()});function YNe(e,t,n){return le.request(new URL("customtypes",e),{headers:{repository:t},credentials:le.getRequestCredentials(n),okType:$.array(HNe)})}function eg(e){const{baseUrl:t,repository:n,authStrategy:r}=e;return Ti.queryOptions({queryKey:["customTypes"],queryFn:()=>YNe(t,n,r)})}function GNe(e,t){e.prefetchQuery(eg(t))}function JNe(e,t){return e.fetchQuery(eg(t))}function DF(e){return Ti.useSuspenseQuery(eg(e))}function ZNe(e){const{id:t,baseUrl:n,repository:r,authStrategy:i}=e,a=DF({baseUrl:n,repository:r,authStrategy:i}).data.find(s=>s.id===t);if(!a)throw new Error(`Custom type "${t}" does not exist`);return a}function XNe(e,t){return e.invalidateQueries(eg(t))}function e3e(e){const{id:t,baseUrl:n,repository:r,authStrategy:i}=e,o=new URL(`customtypes/${t}`,n);return o.searchParams.set("static","true"),le.request(o,{headers:{repository:r},credentials:le.getRequestCredentials(i),okType:t3e})}const t3e=$.unknown().transform((e,t)=>{const n=de.StaticCustomType.decode(e);return n._tag==="Right"?n.right:(t.addIssue({code:$.ZodIssueCode.custom,message:"Invalid custom type."}),$.NEVER)});function PY(e){const{id:t}=e;return Ti.queryOptions({queryKey:["customTypes","static",t],queryFn:()=>e3e(e)})}function n3e(e){return Ti.useSuspenseQuery(PY(e))}function r3e(e,t){e.prefetchQuery(PY(t))}const i3e=$.object({id:$.string().optional(),first_name:$.string().optional(),last_name:$.string().optional(),email:$.string().optional(),uploadedAvatar:$.string().optional()}),jF=$.object({id:$.string(),name:$.string(),is_master:$.boolean().optional()}).transform(e=>({id:e.id,label:e.name,...e.is_master!==void 0?{isMaster:e.is_master}:{}})),NY=$.discriminatedUnion("status",[$.object({status:$.literal("unclassified")}),$.object({status:$.literal("published")}),$.object({status:$.literal("release"),release_id:$.string()}),$.object({status:$.literal("archived")})]),WY=$.object({version_id:$.string(),tags:$.array($.string()),preview_image:$.string().optional(),last_modified_date:$.coerce.date(),uid:$.string().optional()}),KY=NY.and(WY.extend({custom_type_label:$.string(),preview_summary:$.string().optional(),author:i3e})),qY=NY.and(WY.extend({custom_type_id:$.string().optional(),summary:$.string().optional(),author_ids:$.array($.string()).optional(),highlights:$.object({uid:$.string().optional()}).optional()}));function VY(e){return KY.safeParse(e).success}function Ix(e){return qY.safeParse(e).success}const zY=$.string().nullish().transform(e=>e??"Untitled"),UF=$.object({id:$.string(),title:zY,custom_type_id:$.string(),group_lang_id:$.string(),language:jF,versions:$.array(KY)}),o3e=$.object({total:$.number(),cursor:$.string().optional(),results:$.array(UF)}),a3e=$.object({id:$.string(),title:zY,custom_type_id:$.string(),group_lang_id:$.string(),interesting_versions:$.array(qY),locale_id:$.string().optional()}).transform(e=>{const{interesting_versions:t,...n}=e;return{versions:t,...n}}),s3e=$.object({results:$.array(a3e)});function PF(e){const{baseUrl:t,authStrategy:n,limit:r,cursor:i,statuses:o,authors:a,language:s,groupLangIds:c,documentIds:u,customTypes:l,tags:d,term:p,uids:h,signal:A}=e,g=new URL("documents/search",t),v=Yd.filterValues({statuses:o,authors:a,language:s,groupLangIds:c,customTypes:l,tags:d,term:p,documentIds:u,limit:r,cursor:i,uids:h},b=>!(b===""||Array.isArray(b)&&b.length===0));return le.request(g,{credentials:le.getRequestCredentials(n),okType:o3e,signal:A,method:"POST",body:v})}function QY(e,t,n,r){const i=new URL(e);return i.search=n,le.request(i,{credentials:le.getRequestCredentials(t),okType:s3e,...r})}function HY(e){const{repository:t,searchTerm:n,tags:r,authors:i,status:o,localeId:a,customTypesIds:s}=e,c=new URLSearchParams;return c.append("repository",t),n&&c.append("searchTerm",n),r!=null&&r.length&&c.append("tags",r.toString()),i!=null&&i.length&&c.append("authors",i.toString()),o!=null&&o.length&&c.append("status",o.toString()),a&&c.append("localeId",a),s!=null&&s.length&&c.append("customTypesIds",s.toString()),c.toString()}function YY(e){return e.reduce((t,n)=>{if(n.values.every(i=>i===""||i===void 0))return t;const r=n.values.map(i=>[n.name,i??""]);return t.concat(r)},[])}function tg(e,t,n){return le.request(new URL(`documents/${n}`,e),{credentials:le.getRequestCredentials(t),okType:UF})}const c3e=$.custom().transform((e,t)=>{const n=ue.Document.decode(e);return n._tag==="Left"?(t.addIssue({code:$.ZodIssueCode.custom,message:"Invalid document."}),$.NEVER):n.right}),u3e=$.unknown().transform((e,t)=>{const n=ue.SliceItemContent.decode(e);return n._tag==="Right"?n.right:(t.addIssue({code:$.ZodIssueCode.custom,message:"Invalid slice content."}),$.NEVER)}),To={all:()=>["documents"],lists:()=>[...To.all(),"list"],list:e=>[...To.lists(),e],infiniteLists:()=>[...To.all(),"list:infinite"],infiniteList:e=>[...To.infiniteLists(),e]};function l3e(e,t){e.setQueriesData({queryKey:To.lists()},n=>n&&aD(n,t)),e.setQueriesData({queryKey:To.infiniteLists()},n=>n&&{...n,pages:n.pages.map(r=>aD(r,t))})}function aD(e,t){const n=e.results.flatMap(r=>{const i=t(r,e);return i?[i]:[]});return{...e,results:n,total:e.total+(n.length-e.results.length)}}async function d3e(e){await e.invalidateQueries({queryKey:To.lists()}),await e.invalidateQueries({queryKey:To.infiniteLists()})}function NF(e){return Ti.useSuspenseQuery(GY(e))}function GY(e){return Ti.queryOptions({queryKey:To.list(e),queryFn:({queryKey:[,,t]})=>PF(t)})}async function JY(e){const{coreApiBaseUrl:t,documentSearchBaseUrl:n,authStrategy:r,repository:i,searchTerm:o="",customTypes:a,tags:s,authors:c,status:u,locale:l,signal:d,storageVersion:p}=e;if(p&&p.major<=6){const b=u!=null&&u.length?u:["published","unclassified","release"];return{results:(await PF({baseUrl:t,authStrategy:r,tags:s,customTypes:a,language:l,term:o,authors:c,statuses:b,limit:200})).results}}const h=HY({repository:i,searchTerm:o,tags:s,authors:c,status:u,localeId:l,customTypesIds:a});return{results:(await QY(n,r,h,{signal:d})).results}}function ZY(e){const{searchTerm:t,customTypes:n,tags:r,authors:i,status:o,locale:a,config:s,storageVersion:c}=e;s.searchDocuments||bt("searchDocuments");const{coreApiBaseUrl:u,documentSearchBaseUrl:l,authStrategy:d,repository:p}=s;return Ti.queryOptions({queryKey:["searchDocuments",{coreApiBaseUrl:u,documentSearchBaseUrl:l,authStrategy:d,repository:p,searchTerm:t,customTypes:n,tags:r,authors:i,status:o,locale:a,storageVersion:c}],queryFn:({queryKey:[,h],signal:A})=>JY({...h,signal:A})})}const f3e=$.object({id:$.string(),firstname:$.string().optional(),lastname:$.string().optional(),email:$.string(),uploadedAvatar:$.string().optional()}),XY=$.array(f3e),p3e=$.object({slicemachineEnabled:$.boolean()}),eG=["next","nuxt","sveltekit"];function h3e(e){return eG.includes(e)}const pS=$.preprocess(e=>typeof e=="string"&&h3e(e)?e:"other",$.enum([...eG,"other"])),A3e=$.object({simulator_url:$.string().url().nullish(),languages:$.array(jF).transform(e=>yt.sort(e,t=>t.label)),authors:XY.optional().default([]),quotas:p3e.optional().default({slicemachineEnabled:!1}),framework:pS.optional().default("other"),starterId:$.string().optional(),storageVersion:$.object({major:$.number().int(),minor:$.number().int()}),uploadedAvatar:$.string().url().optional()}).transform(({simulator_url:e,framework:t,...n})=>{const r=e&&tG(e)?e:void 0;return{...n,framework:t,simulatorUrl:r,isSupportedFramework:t!=="other"}});function hS(e,t){return le.request(new URL("repository",e),{credentials:le.getRequestCredentials(t),okType:A3e})}function tG(e){const t=Vr.toURL(e);return t?t.pathname.endsWith("/slice-simulator"):!1}const m3e=$.object({results:$.array($.string())});function nG(e,t){return le.request(new URL("repository/tags",e),{credentials:le.getRequestCredentials(t),okType:m3e})}const g3e=$.object({maxNbEnvironments:$.number(),integrationFieldsEnabled:$.boolean(),personalEnvironmentsEnabled:$.boolean(),sliceMachineEnabled:$.boolean()}),rG=$.object({_id:$.string(),name:$.string(),onboarding:$.object({completedSteps:$.array($.string()),isDismissed:$.boolean()}),framework:pS.optional().default("other"),quotas:g3e.optional().default({maxNbEnvironments:0,integrationFieldsEnabled:!1,personalEnvironmentsEnabled:!1,sliceMachineEnabled:!1}),storageVersion:$.object({major:$.number().int(),minor:$.number().int()}),authors:XY.optional().default([])});function v3e(e,t,n){const r=new URL("",e);return r.searchParams.append("repository",t),le.request(r,{headers:{repository:t},credentials:le.getRequestCredentials(n),okType:rG})}const y3e=$.enum(["createPrismicProject","chooseLocale","createProject","setupSliceMachine","createPageType","codePage","createSlice","reviewAndPush","createContent","renderPage"]),iG=$.object({completedSteps:$.array($.string()),isDismissed:$.boolean(),context:$.object({framework:pS,starterId:$.string().nullable().optional()})}),oG=$.object({completedSteps:$.array($.string())}),aG=$.object({isDismissed:$.boolean()});function b3e(e,t,n){const r=new URL("onboarding",e);return r.searchParams.append("repository",t),le.request(r,{headers:{repository:t},credentials:le.getRequestCredentials(n),okType:iG})}function S3e(e,t,n,r){const i=new URL(`onboarding/${e}/toggle`,t);return i.searchParams.append("repository",n),le.request(i,{method:"PATCH",headers:{repository:n},credentials:le.getRequestCredentials(r),okType:oG})}function C3e(e,t,n){const r=new URL("onboarding/toggle",e);return r.searchParams.append("repository",t),le.request(r,{method:"PATCH",headers:{repository:t},credentials:le.getRequestCredentials(n),okType:aG})}const sG=$.string(),cG=$.enum(["Manager","Writer","Readonly"]),AS=$.record(sG,cG),WF=$.record($.string(),AS),mS=$.object({id:$.string(),name:$.string(),customTypes:$.array($.string()),rolesPerLocale:AS.optional(),rolesPerLocaleByUser:WF.optional()});$.object({name:$.string(),customTypes:$.array($.string()),rolesPerLocale:AS.optional(),rolesPerLocaleByUser:WF.optional()});const w3e=$.object({results:$.array(mS)});function uG(e){const{baseUrl:t,repository:n,authStrategy:r}=e,i=new URL("team-spaces",t);return i.searchParams.append("repository",n),le.request(i,{method:"GET",credentials:le.getRequestCredentials(r),okType:w3e})}function x3e(e){return Ti.queryOptions({queryKey:["teamSpaces",e],queryFn:()=>uG(e),select:t=>t.results})}function _3e(){const e=Ti.useQueryClient();return()=>e.invalidateQueries({queryKey:["teamSpaces"]})}function T3e(e){const{baseUrl:t,repository:n,authStrategy:r,payload:i}=e,o=new URL("team-spaces",t);return o.searchParams.append("repository",n),le.request(o,{method:"POST",body:i,credentials:le.getRequestCredentials(r),okType:mS})}function I3e(e){const{baseUrl:t,repository:n,authStrategy:r,payload:i,teamSpaceId:o}=e,a=new URL(`team-spaces/${o}`,t);return a.searchParams.append("repository",n),le.request(a,{method:"PUT",body:i,credentials:le.getRequestCredentials(r),okType:mS})}function E3e(e){const{baseUrl:t,repository:n,authStrategy:r,teamSpaceId:i}=e,o=new URL(`team-spaces/${i}`,t);return o.searchParams.append("repository",n),le.request(o,{method:"DELETE",credentials:le.getRequestCredentials(r),okType:$.unknown()})}const lG=$.enum(["Owner","Administrator","Writer","Manager","Readonly"]),R3e=$.record(lG.optional()),$3e=lG.or(R3e),k3e={SuperUser:"SuperUser",Owner:"Owner",Administrator:"Administrator",Manager:"Publisher",Writer:"Writer",Readonly:"Contributor"},dG=$.object({shortId:$.string(),intercomHash:$.string(),email:$.string(),firstName:$.string(),lastName:$.string(),superPower:$.boolean(),repositories:$.array($.object({domain:$.string(),name:$.string().optional(),role:$3e}))});async function fG(e,t){const n=new URL("profile",e);return await le.request(n,{credentials:le.getRequestCredentials(t),okType:dG})}function KF(){const e=ye();e.userServiceBaseUrl||bt("userServiceBaseUrl");const{authStrategy:t,userServiceBaseUrl:n}=e;return Ye.useRequest(fG,[n,t])}const O3e="https://prismic.io/docs/guides/manage-images#supported-media";function ng(){const e=ye();e.mediaLibrary||bt("mediaLibrary");const{assetsApiBaseUrl:t,authStrategy:n,repository:r}=e,{items:i}=Ye.useRequest(pG,[t,r,n]);return{tags:i}}function pG(e,t,n){return le.request(new URL("tags",e),{credentials:le.getRequestCredentials(n),okType:M3e,headers:{repository:t}})}const hG=1,AG=20,qF=$.string().min(hG).max(AG),VF=$.object({id:$.string(),name:qF,uploader_id:$.string().optional(),created_at:$.number(),last_modified:$.number(),count:$.number().optional().default(0)}),M3e=$.object({items:$.array(VF)});function rg(e){Ye.updateFetcherData(pG,t=>{const{items:n}=t,r=e(n);if(r)return{items:r}})}function F3e(e){const{assetType:t,keyword:n,mode:r,tagIds:i}=e,o=ye();o.mediaLibrary||bt("mediaLibrary");const{onAnalyticsEvent:a}=o,s=Ye.useFetcherData(ji),c=s[s.length-1],u=E.useRef(c);u.current=c,E.useEffect(()=>{if(!a||!n||!u.current||u.current.keyword!==n)return;const l=String(n.split(" ").length),d=String(u.current.total),p=i.join(",");a("Media Library Search",{searchQuery:n,numberOfWords:l,numberOfResults:d,timeToGetResults:u.current.time,assetType:t,mode:r,tags:p})},[n,t,r,a,i])}function L3e(e){const{assetType:t,mediaDialogOpen:n}=e,r=ye(),i=Ye.useFetcherData(ji),o=E.useRef(0);E.useEffect(()=>{n&&(o.current=performance.now())},[n]);function a(s){if(!r.onAnalyticsEvent||!r.mediaLibrary)return;const c=i[i.length-1];if(!c)return;const{keyword:u,uploaderId:l,tags:d}=c,p=vG(i,u,t,l,d),h=String(u.split(" ").length),A=String(c.total),g=p.findIndex(S=>S.id===s),v=String(g+1),b=[s].join(","),w=(performance.now()-o.current).toFixed(0);r.onAnalyticsEvent("Media Added To Page",{assetType:t,searchQuery:u,numberOfWords:h,numberOfResults:A,searchPosition:v,mediaIds:b,timeToAddMediaToPage:w,tags:d})}return a}const Ig=$.array($.string()).optional().transform(e=>e==null?void 0:e[0]),gS=$.object({id:$.string(),kind:$.string(),extension:$.string().optional(),filename:$.string(),width:$.number().optional(),height:$.number().optional(),last_modified:$.number(),url:$.string(),alt:$.string().optional(),uploader_id:$.string().optional(),size:$.number(),notes:$.string().optional(),credits:$.string().optional(),search_highlight:$.object({filename:Ig,alt:Ig,notes:Ig,credits:Ig}).optional(),tags:$.array(VF)}),mG={"X-Prismic-Source":"Wroom"},B3e=$.object({total:$.number(),cursor:$.string().optional(),items:$.array(gS)}),gG=30;function ji(e,t,n,r,i,o,a,s,c){const u=e?new URL("assets",e):void 0,l=new URLSearchParams(YY([{name:"limit",values:[`${gG}`]},{name:"cursor",values:[c]},{name:"keyword",values:[r]},{name:"assetType",values:[i]},{name:"uploaderId",values:[o]},{name:"tags",values:a.split(",")}])).toString(),d=B3e.transform(h=>({...h,keyword:r,assetType:i,uploaderId:o,tags:a,page:s})),p=performance.now();return le.request(`${(u==null?void 0:u.href)??""}?${l}`,{headers:{repository:t,...mG},credentials:le.getRequestCredentials(n),okType:d}).then(h=>({...h,time:(performance.now()-p).toFixed(0)}))}Ye.cache.registerFetcherConfig(ji,{revalidationStrategy:{type:"never"}});const Xn={keyword:"",assetType:"all",uploaderId:void 0,tagIds:[]};function D3e(e){const{initialAssetType:t=Xn.assetType,mode:n}=e,r=ye(),[i,o]=E.useState({...Xn,assetType:t,page:0});r.mediaLibrary||bt("mediaLibrary");const{assetsApiBaseUrl:a,authStrategy:s,repository:c}=r,{page:u,cursor:l,keyword:d,assetType:p,uploaderId:h,tagIds:A}=i,g=Ye.useRequest(ji,qh({assetsApiBaseUrl:a,authStrategy:s,repository:c,keyword:d,assetType:p,uploaderId:h,tagIds:A,page:u,cursor:l}));F3e({assetType:p,keyword:d,tagIds:A,mode:n});const v=N3e(d,p,h,A),b=g.total!==v.length;function w(){g.cursor!==void 0&&o(x=>({...x,page:x.page+1,cursor:g.cursor}))}function S(x){o(T=>({...T,page:0,cursor:void 0})),wu((T,I)=>{if(I.page===0)return[...x,...T]})}function y(x){o(T=>({...T,...x,page:0,cursor:void 0}))}function C(){o(x=>({...x,...Xn,assetType:t==="all"?Xn.assetType:x.assetType,page:0,cursor:void 0}))}return{keyword:d,assetType:p,uploaderId:h,tagIds:A,setFilters:y,resetFilters:C,media:v,mediaTotal:g.total,limit:gG,hasNextPage:b,fetchNextPage:w,updateMedia:j3e,unshiftMedia:S,deleteMedia:U3e,deleteSearchData:P3e,revalidateFirstPage:yG}}function j3e(e){wu(t=>t.flatMap(n=>{const r=e.find(i=>i.id===n.id);return r?r.response===void 0?[]:{...n,...r.response}:n}))}function U3e(e){wu(t=>t.filter(n=>!e.includes(n.id)))}function P3e(e){const{keyword:t,assetType:n,uploaderId:r,tagIds:i}=e,o=i==null?void 0:i.join(",");Ye.updateFetcherData(ji,a=>{if(!(a.keyword===t&&a.assetType===n&&a.uploaderId===r&&a.tags===o))return a})}function vG(e,t,n,r,i){const o=e.filter(c=>c.keyword===t&&c.assetType===n&&c.uploaderId===r&&c.tags===i),s=yt.sort(o,c=>c.page).flatMap(c=>c.items);return t?yt.uniqBy(s,c=>c.id):s}function N3e(e,t,n,r){const i=Ye.useFetcherData(ji);return vG(i,e,t,n,r.join(","))}function wu(e){Ye.updateFetcherData(ji,t=>{const{items:n,total:r}=t,i=e(n,t);if(i)return{...t,total:r+(i.length-n.length),items:i}})}function yG(e){const{config:t,keyword:n=Xn.keyword,assetType:r=Xn.assetType,tagIds:i=Xn.tagIds}=e;if(!t.mediaLibrary)throw new Error("media library is not configured");const{assetsApiBaseUrl:o,authStrategy:a,repository:s}=t;Ye.revalidateData(ji,qh({assetsApiBaseUrl:o,repository:s,authStrategy:a,keyword:n,assetType:r,tagIds:i,page:0}))}function bG(e){const{config:t,keyword:n=Xn.keyword,assetType:r=Xn.assetType,tagIds:i=Xn.tagIds}=e;if(!t.mediaLibrary)throw new Error("media library is not configured");Ye.updateFetcherData(ji,o=>o.page===0?o:void 0),yG({config:t,keyword:n,assetType:r,tagIds:i})}function qh(e){return[e.assetsApiBaseUrl,e.repository,e.authStrategy,e.keyword,e.assetType,e.uploaderId,e.tagIds.join(","),e.page,e.cursor]}function SG(){const e=ye();e.mediaLibrary||bt("mediaLibrary");const{assetsApiBaseUrl:t,coreApiBaseUrl:n,authStrategy:r,repository:i}=e,{authors:o}=Ye.useRequest(hS,[n,r]),{items:a}=Ye.useRequest(CG,[t,i,r]),{shortId:s}=KF(),c=new Map(o.map(d=>[d.id,d])),u=[];for(const d of a){if(d.id==="ghost"){u.push({id:d.id,name:"Ghost",uploadedAvatar:"https://images.prismic.io/page-builder-assets/ZuAXWBoQrfVKl5sD_ghost_user.png?auto=format,compress&w=64"});continue}const p=c.get(d.id);if(!p)continue;let h;if(p.uploadedAvatar){const A=new URL(p.uploadedAvatar);A.searchParams.set("w","64"),h=A.toString()}u.push({id:d.id,name:[p.firstname,p.lastname].filter(Boolean).join(" "),firstName:p.firstname,lastName:p.lastname,email:p.email,uploadedAvatar:h})}const l=new Map(u.map(d=>[d.id,d]));return{uploaders:yt.sort(u,d=>d.id===s?0:1,d=>d.name),uploadersById:l}}function CG(e,t,n){return le.request(new URL("uploaders",e),{credentials:le.getRequestCredentials(n),okType:K3e,headers:{repository:t}})}const W3e=$.object({id:$.string()}),K3e=$.object({items:$.array(W3e)});function wG(){const e=ye();e.mediaLibrary||bt("mediaLibrary");const{assetsApiBaseUrl:t,authStrategy:n,repository:r}=e;return()=>{Ye.revalidateData(CG,[t,r,n])}}function q3e(e){const{revalidate:t,config:n,keyword:r,assetType:i,uploaderId:o,tagIds:a}=e,{assetsApiBaseUrl:s=void 0,repository:c="",authStrategy:u="token"}=n.mediaLibrary?n:{},[l,d]=E.useState(!1),[p,h]=E.useState(!1),A={assetsApiBaseUrl:s,repository:c,authStrategy:u,keyword:r,assetType:i,uploaderId:o,tagIds:a,page:0},{revalidateData:g}=Ye.useCacheRevalidation({fetcher:ji,requestParams:qh(A),validator:(w,S)=>{var x,T;const y=((x=w.items[0])==null?void 0:x.id)??"",C=((T=S.items[0])==null?void 0:T.id)??"";return y!==C||w.total!==(S==null?void 0:S.total)},onCacheInvalidated:()=>h(!0),every:6e4}),v=w=>{g(qh({...A,...w}))};E.useEffect(()=>{l&&(h(!1),d(!1))},[l]);function b(){d(!0),t()}return{isMediaRevalidationInProgress:l,isMediaCacheInvalid:p,revalidateMedia:b,revalidateWithParams:v}}function V3e(e){const{onBeforeUpload:t,onComplete:n}=e,[r,i]=E.useState([]),o=r.some(l=>l.status==="idle"||l.status==="uploading"),a=ye();function s(){if(!r.length||r.some(h=>h.status==="uploading")||r.every(h=>h.status==="error"))return;const l=r.find(h=>h.status==="idle");if(!l)return;let d=r;function p(h){d=h(d),i(d),d.every(g=>g.status==="success"||g.status==="error")&&setTimeout(()=>{i([]),n==null||n(d)},1500)}p(h=>h.map(A=>A.id===l.id?{...A,status:"uploading"}:A)),xG({file:l.file,config:a}).then(h=>{p(A=>A.map(g=>g.id===l.id?{...g,status:"success",response:h}:g))}).catch(()=>{p(h=>h.map(A=>A.id===l.id?{...A,status:"error"}:A))})}function c(l){const d=l.map(p=>({id:`temp-${crypto.randomUUID()}`,file:p,status:"idle"}));i(d),t(d)}const u=E.useCallback(l=>{const d=[{...l,status:"idle"},...r.filter(p=>p.id!==l.id)];i(d),t(d)},[t,r]);return E.useEffect(s,[a,r,n]),{isUploading:o,uploadingFiles:r,onFilesSelected:c,onRetry:u}}async function xG(e){const{file:t,config:n}=e;if(!n.mediaLibrary)throw new Error("Media Library not configured.");const{assetsApiBaseUrl:r,repository:i,authStrategy:o}=n,a=new FormData;return a.append(t.name,t),le.request(new URL("assets",r),{headers:{repository:i,"Content-Type":"multipart/form-data",...mG},method:"POST",body:a,credentials:le.getRequestCredentials(o),okType:gS})}const _G=E.createContext(void 0);function z3e(e){const{children:t,assetType:n=Xn.assetType,onSelectedChange:r,actionContainer:i}=e,o=r?"select":"browse",[a,s]=E.useTransition(),[c,u]=E.useTransition(),l=ye(),{showAlert:d}=m.useAlert(),p=KF(),h=wG(),{keyword:A,assetType:g,uploaderId:v,tagIds:b,setFilters:w,resetFilters:S,media:y,fetchNextPage:C,hasNextPage:x,updateMedia:T,unshiftMedia:I,deleteMedia:R,mediaTotal:O,deleteSearchData:k,revalidateFirstPage:P}=D3e({initialAssetType:n,mode:o}),[q,Y]=E.useState();function te(){bG({config:l,keyword:A,assetType:g,uploaderId:v,tagIds:b})}const{isMediaRevalidationInProgress:G,isMediaCacheInvalid:ee,revalidateMedia:ne,revalidateWithParams:F}=q3e({config:l,revalidate:te,keyword:A,assetType:g,uploaderId:v,tagIds:b});function M(ze){const mt=ze.keyword===Xn.keyword,Xt=ze.assetType===n,Ot=ze.uploaderId===Xn.uploaderId,fn=ze.tagIds.length===Xn.tagIds.length&&ze.tagIds.every((fs,ps)=>fs===Xn.tagIds[ps]);return mt&&Xt&&Ot&&fn}function N(ze){const mt={keyword:A,assetType:g,tagIds:b,uploaderId:v,...ze};M(mt)?F(ze):k(mt),u(()=>{w(ze),he.clearSelection()})}const{isUploading:se,onFilesSelected:Oe,uploadingFiles:_e,onRetry:j}=V3e({onBeforeUpload:ze=>{S();const mt=ze.filter(Ot=>Ot.status==="idle").map(Ot=>({id:Ot.id,url:URL.createObjectURL(Ot.file),filename:Ot.file.name,size:Ot.file.size,extension:Ot.file.type,kind:Ot.file.type,last_modified:Ot.file.lastModified,tags:[],uploader_id:p.shortId}));I(mt);const[Xt]=mt??[];Xt&&he.toggleSelection({id:Xt.id,isSingleSelection:!0})},onComplete:ze=>{const mt=ze.flatMap(fn=>fn.status==="success"?fn:(pi(fn),{id:fn.id,response:void 0}));T(mt),P({config:l,assetType:g,tagIds:b}),h();const Xt=mt[0];!Xt||!Xt.response||!he.isSelected(Xt.id)||he.toggleSelection({id:Xt.response.id,isSingleSelection:!0})}}),he=_c({totalItemCount:O,onChangeSelection:({selectedIds:ze,selectedCount:mt})=>{if(aa(!1),!!r){if(mt===1){const[Xt]=[...ze];if(_e.some(fn=>fn.id===Xt&&fn.status!=="success")){r(new Set);return}}r(new Set(ze))}}});function kt(ze){se||Oe(ze)}function Qt(){x&&s(C)}function fi(ze,mt){T([{id:ze,response:mt}])}function pi(ze){const mt=bi.overflow(ze.file.name,30);d({id:ze.id,title:`The specified file "${mt}" could not be uploaded.`,subtitle:f.jsxs(m.Text,{color:"inherit",children:["Read more about our"," ",f.jsx(m.Text,{color:"tomato11",href:O3e,underline:!0,children:"supported media"}),"."]}),buttons:{action:{text:"Retry upload",icon:"cloudUpload",onClick:()=>j(ze)}}})}const[vo,aa]=E.useState(!1);return f.jsx(_G.Provider,{value:{isFetchingMedia:a,media:y,mediaTotal:O,onScrollToBottom:Qt,actionContainer:i,onFilesUpload:kt,isUploading:se,uploadingFiles:_e,isMediaRevalidationInProgress:G,isMediaCacheInvalid:ee,revalidateMedia:ne,deleteMedia:R,updateMedia:fi,keyword:A,isSearchingMedia:c,assetType:g,initialAssetType:n,uploaderId:v,tagManagerOpen:vo,setTagManagerOpen:aa,tagIds:b,onFilterChange:N,openMediaSection:q,setOpenMediaSection:Y},children:t})}function At(){const e=E.useContext(_G);if(!e)throw new Error("useMediaLibrary must be used within a MediaLibraryProvider");return e}function Q3e(){const e=ye(),{initialAssetType:t}=At(),{assetsApiBaseUrl:n=void 0,repository:r="",authStrategy:i="token"}=e.mediaLibrary?e:{},{total:o}=Ye.useRequest(ji,qh({assetsApiBaseUrl:n,authStrategy:i,repository:r,assetType:t,keyword:"",tagIds:[],page:0}));return o}function TG(){return Q3e()===0}function H3e(){return TG()?f.jsx(Y3e,{}):f.jsx(EG,{})}function IG(e){const{children:t}=e;return f.jsx(m.Box,{justifyContent:"center",flexDirection:"column",height:"100%",children:t})}function EG(){return f.jsx(IG,{children:f.jsxs(m.BlankSlate,{children:[f.jsx(m.BlankSlateIcon,{name:"close",lineColor:"purple10",backgroundColor:"purple3",borderColor:"purple6",borderStyle:"dashed",size:"xlarge"}),f.jsx(m.BlankSlateTitle,{size:"big",children:"Oops!"}),f.jsx(m.BlankSlateDescription,{width:360,children:"No items found matching your search"})]})})}function Y3e(){const{onFilesUpload:e}=At();return f.jsx(IG,{children:f.jsxs(m.Box,{gap:20,flexDirection:"column",alignItems:"center",children:[f.jsx(m.Box,{maxWidth:375,children:f.jsx(m.BlankSlateTitle,{size:"big",children:"Start by uploading your files!"})}),f.jsx(m.Box,{border:!0,borderStyle:"dashed",borderRadius:4,justifyContent:"center",children:f.jsxs(m.BlankSlate,{sx:{marginBlock:80,marginInline:48},children:[f.jsx(m.BlankSlateIcon,{name:"cloudUpload",lineColor:"purple11",backgroundColor:"purple5",size:"large"}),f.jsx(m.BlankSlateTitle,{children:"Drop your files anywhere to upload or ..."}),f.jsx(m.FileUploadButton,{onFilesSelected:e,renderButton:t=>f.jsx(m.Box,{display:"inline-flex",as:"span",children:f.jsx(m.Button,{onClick:t,color:"grey",children:"Upload media"})})}),f.jsx(m.BlankSlateDescription,{children:"Maximum upload size file: 128 MB"})]})})]})})}const Dd={warning:{uploadWhileUploading:{title:"Hang tight!",description:"Your current images are still being uploaded. Once they're all set, you'll be free to upload more."}}};function G3e(){const{actionContainer:e,isUploading:t,onFilesUpload:n,assetType:r}=At();return f.jsx(RG,{actionContainer:e,children:f.jsxs(m.Box,{width:"100%",gap:16,children:[f.jsx(J3e,{}),f.jsx(m.Tooltip,{title:Dd.warning.uploadWhileUploading.title,content:Dd.warning.uploadWhileUploading.description,visible:t,stableMount:!0,children:f.jsx(m.FileUploadButton,{disabled:t,onFilesSelected:n,startIcon:"cloudUpload",color:e?"purple":"grey",size:"large",assetType:r,children:"Upload media"})})]})})}function J3e(){const{keyword:e,onFilterChange:t,isFetchingMedia:n}=At(),[r,i]=E.useState(e);return We.useOnChange(e,()=>{e===""&&i("")}),We.useDebounce(r,300,We.useStableCallback(o=>t({keyword:o}))),f.jsx(m.Box,{width:"100%",flexDirection:"column",children:f.jsx(m.FormSearchInput,{value:r,placeholder:"Search",onValueChange:i,maxLength:200,isLoading:n&&e!==r})})}function RG(e){const{children:t,actionContainer:n}=e;return n?f.jsx(m.Portal,{container:n,asChild:!0,children:t}):f.jsx(f.Fragment,{children:t})}function Z3e(e){const{children:t}=e,{onFilesUpload:n,assetType:r}=At();return f.jsx(m.FileDropZone,{overlay:f.jsx(X3e,{}),onFilesSelected:n,assetType:r,children:t})}function X3e(){const{isUploading:e}=At(),t=e?Dd.warning.uploadWhileUploading.title:"Drop files here",n=e?Dd.warning.uploadWhileUploading.description:"Drop your files to upload them instantly to the media library.";return f.jsx(m.Box,{justifyContent:"center",flexDirection:"column",height:"100%",children:f.jsxs(m.BlankSlate,{children:[f.jsx(m.BlankSlateIcon,{name:e?"block":"cloudUpload",lineColor:e?"tomato11":"purple10",backgroundColor:e?"tomato2":"purple3",borderColor:e?"tomato6":"purple6",borderStyle:"dashed",size:"xlarge"}),f.jsx(m.BlankSlateTitle,{size:"big",children:t}),f.jsx(m.BlankSlateDescription,{width:360,children:n})]})})}function $G(){return f.jsx(m.DefaultErrorMessage,{title:"Oops! Something went wrong",description:"An error occurred while searching for your image.",errorImageSrc:m.dialogErrorImage,sx:{marginBlock:"auto",marginInline:"auto"}})}function kG(e){const{mediaList:t,mediaActions:n,mediaToolbar:r,sidePane:i}=e,o=m.useMediaQuery({min:"medium"}),a=i&&o;return f.jsxs(m.Box,{display:"grid",gridTemplateRows:"auto auto 1fr",gridTemplateColumns:a?"1fr 380px":"1fr",width:"100%",height:"100%",children:[f.jsxs(m.Box,{position:"relative",display:"grid",gap:16,gridColumn:"1",gridRow:"1",padding:{right:16,bottom:16},children:[n,r]}),f.jsx(m.Box,{position:"relative",display:"grid",gridColumn:"1",gridRow:"2 / -1",children:t}),a&&i]})}function e6e(){var p;const{onScrollToBottom:e,media:t,isUploading:n,uploadingFiles:r,isSearchingMedia:i,isMediaRevalidationInProgress:o,setOpenMediaSection:a,isFetchingMedia:s}=At(),c=_c(),u=E.useRef(null);function l(h){c.toggleSelection({id:h,isSingleSelection:!0}),a("tags")}(n||i||o)&&((p=u.current)==null||p.scrollTo({top:0,behavior:"instant"}));function d(h,A,g){const v=A.shiftKey?t.map(({id:b})=>b):void 0;c.toggleSelection({id:h,isSingleSelection:g==="single",metaKey:A.metaKey,shiftKey:A.shiftKey,ids:v})}return f.jsxs(OG,{onScrollToBottom:e,scrollAreaRef:u,children:[t.map(h=>{var A,g;return f.jsx(m.MediaCard,{"aria-label":"media item",...h,filenameHighlight:(A=h.search_highlight)==null?void 0:A.filename,loading:i,status:(g=r.find(v=>v.id===h.id))==null?void 0:g.status,selected:c.isSelected(h.id),onCardClick:v=>d(h.id,v,"single"),onCheckedChange:(v,b)=>d(h.id,b,"multi"),onAddTagClick:()=>l(h.id)},h.id)}),f.jsx(m.Box,{gridColumn:"1 / -1",justifyContent:"center",children:f.jsx(m.AnimatedElement,{animation:{name:"fade"},children:s&&f.jsx(m.Text,{align:"center",color:"grey11",sx:{marginBlock:8},children:"Loading more items ..."})})})]})}function OG(e){const{children:t,scrollAreaRef:n,onScrollToBottom:r}=e,i=16,o=4,a="250px",s=`calc((100% - ${i*(o-1)}px) / ${o})`;return f.jsx(m.ScrollArea,{"aria-label":"Media list",ref:n,style:{display:"grid",gridTemplateColumns:`repeat(auto-fill, minmax(max(${a}, ${s}), 1fr))`,gridTemplateRows:"1fr 1fr 1fr ",gap:i,padding:2,paddingBottom:16,position:"relative"},onScrollToBottom:r,threshold:500,children:t})}function MG(e){const{children:t,hasSelectedMedia:n}=e;return f.jsx(m.Box,{overflow:"hidden",gridColumn:"2 / -1",gridRow:"1 / -1",children:f.jsx(m.ScrollArea,{style:{display:"grid",height:"100%"},children:f.jsx(m.Box,{flexGrow:1,borderRadius:{topRight:8,topLeft:8},borderStyle:n?"solid":"dashed",border:{top:!0,right:!0,left:!0,bottom:!1},minWidth:0,children:t})})})}function FG(e){const{onFilesUpload:t,isUploading:n,isInitialLoad:r=!1}=e,i=r||n;return f.jsxs(m.Box,{flexDirection:"column",justifyContent:"center",alignItems:"center",padding:16,gap:16,width:"100%",children:[f.jsx(m.BlankSlateIcon,{name:"cloudUpload",lineColor:"purple11",backgroundColor:"purple5",size:"large"}),f.jsx(m.Box,{flexDirection:"column",gap:4,children:f.jsxs(m.Text,{align:"center",children:["Select or"," ",f.jsx(m.FileUploadButton,{disabled:i,onFilesSelected:t,renderButton:o=>f.jsx(m.Tooltip,{title:Dd.warning.uploadWhileUploading.title,content:Dd.warning.uploadWhileUploading.description,visible:n,children:f.jsx(m.Box,{display:"inline-flex",as:"span",children:f.jsx(m.Button,{disabled:i,onClick:o,invisible:!0,children:"upload"})})})})," ","media."]})}),f.jsx(m.FileUploadButton,{disabled:i,onFilesSelected:t,color:"grey",children:"Upload media"})]})}function LG(e){const{count:t}=e;return f.jsxs(m.Text,{variant:"bold",children:[t," item",t==1?"":"s"]})}function t6e(e){const{actionContainer:t}=e;return f.jsx(kG,{sidePane:f.jsx(i6e,{}),mediaActions:f.jsx(r6e,{actionContainer:t}),mediaToolbar:f.jsx(m.Skeleton,{color:"grey5",borderRadius:12,children:f.jsx(LG,{count:888})}),mediaList:f.jsx(n6e,{})})}function n6e(){return f.jsx(OG,{children:yt.range(1,24).map(e=>f.jsx(BG,{},e))})}function r6e(e){const{actionContainer:t}=e;return f.jsx(RG,{actionContainer:t,children:f.jsxs(m.Box,{width:"100%",gap:16,children:[f.jsx(m.Box,{width:"100%",flexDirection:"column",children:f.jsx(m.FormSearchInput,{placeholder:"Search",maxLength:200,value:"",disabled:!0,onValueChange:()=>{}})}),f.jsx(m.FileUploadButton,{disabled:!0,onFilesSelected:()=>{},startIcon:"cloudUpload",color:t?"purple":"grey",size:"large",children:"Upload media"})]})})}function i6e(){return f.jsx(MG,{hasSelectedMedia:!1,children:f.jsx(FG,{onFilesUpload:()=>{},isUploading:!1,isInitialLoad:!0})})}function BG(){return f.jsx(m.Card,{variant:"outlined",padding:16,children:f.jsxs(m.CardContent,{gap:0,children:[f.jsx(m.Skeleton,{height:185,width:"100%"}),f.jsx(m.Skeleton,{height:16,width:"100%",sx:{marginTop:12}}),f.jsx(m.Skeleton,{height:10,width:100,sx:{marginTop:8}}),f.jsx(m.Skeleton,{height:1,width:"100%",sx:{marginTop:20,marginBottom:16}}),f.jsxs(m.Box,{flexDirection:"row",gap:8,children:[f.jsx(m.Skeleton,{height:24,width:54}),f.jsx(m.Skeleton,{height:24,width:45}),f.jsx(m.Skeleton,{height:24,width:62})]})]})})}const DG=E.createContext({showToast:()=>{}});function o6e(e){const{children:t}=e,[n,r]=E.useState({title:"",seconds:5}),[i,o]=E.useState(!1),{title:a,action:s,seconds:c=1,icon:u="check"}=n,l=E.useMemo(()=>({showToast:d=>{r({seconds:c,...d}),o(!0)}}),[c]);return f.jsxs(f.Fragment,{children:[f.jsx(a6e,{}),f.jsx(m.Toast,{anchor:f.jsx(m.Box,{position:"absolute",justifyContent:"center",width:"100%",bottom:72}),open:i,onOpenChange:o,title:a,action:s,seconds:c,icon:u}),f.jsx(DG.Provider,{value:l,children:t})]})}function jG(){return E.useContext(DG)}function a6e(){const{revalidateMedia:e,isMediaCacheInvalid:t}=At(),[n,r]=E.useState(t);return We.useOnChange(t,r),f.jsx(m.Toast,{anchor:f.jsx(m.Box,{position:"absolute",justifyContent:"center",width:"100%",bottom:72}),open:n,title:"There have been changes to your media library",action:{title:"Update",onClick:e},cancel:{onClick:()=>r(!1)}})}function kl(){const{media:e}=At(),t=_c();return e.filter(({id:n})=>t.isSelected(n))}function s6e(){const[e,t]=E.useState(!1),n=kl(),r=_c(),i=E.useMemo(()=>n.some(({id:a})=>a.startsWith("temp")),[n]),[o]=n;return o?r.selectedCount>1?f.jsxs(m.Box,{gap:8,alignItems:"center",children:[f.jsxs(m.Text,{variant:"emphasized",noWrap:!0,sx:{flexGrow:1},children:[r.selectedCount," media selected"]}),f.jsx(m.Tooltip,{content:"Open all selected media in new tabs",children:f.jsx(m.IconButton,{icon:"openInFull",variant:"solid",size:"small",onClick:()=>n.forEach(a=>window.open(a.url,"_blank"))})}),f.jsx(m.Tooltip,{content:"Remove selected media",children:f.jsx(m.IconButton,{icon:"delete",variant:"solid",color:"tomato",size:"small",hiddenLabel:"Remove media",onClick:()=>t(!0),disabled:i})}),f.jsx(sD,{open:e,onOpenChange:t,media:n})]}):f.jsxs(m.Box,{gap:8,alignItems:"center",children:[f.jsx(m.Text,{variant:"emphasized",noWrap:!0,sx:{flexGrow:1},children:o.filename}),f.jsxs(m.Box,{gap:8,children:[f.jsx(m.Tooltip,{content:"Open media in new tab",children:f.jsx(m.IconButton,{icon:"openInFull",variant:"solid",size:"small",hiddenLabel:"Open media in new tab",onClick:()=>window.open(o.url,"_blank"),disabled:i})}),f.jsx(m.Tooltip,{content:"Copy media URL",children:f.jsx(m.IconButton,{icon:"link",variant:"solid",size:"small",hiddenLabel:"Copy media URL",onClick:()=>navigator.clipboard.writeText(o.url),disabled:i})}),f.jsx(m.Tooltip,{content:"Remove media",children:f.jsx(m.IconButton,{icon:"delete",variant:"solid",color:"tomato",size:"small",hiddenLabel:"Remove media",onClick:()=>t(!0),disabled:i})}),f.jsx(sD,{open:e,onOpenChange:t,media:o})]})]}):null}function sD(e){const{open:t,onOpenChange:n,media:r}=e,i=ye(),{showAlert:o}=m.useAlert(),{deleteMedia:a}=At(),s=_c(),c=wG(),[u,l]=E.useState(!1),d=Array.isArray(r),p=d?"these items":"this item";function h(){l(!0);const g=s.getSelectionState().selectedIds;u6e({ids:g,config:i}).then(()=>{n(!1),a(g),s.clearSelection(),c()}).catch(()=>{n(!1),o({title:"Error",subtitle:`Something went wrong when removing ${p}.`})}).finally(()=>{l(!1)})}return f.jsxs(m.Dialog,{onOpenChange:n,open:t,size:"small",children:[f.jsx(m.DialogHeader,{icon:"alert",title:`Remove ${p} from your media library?`}),f.jsx(m.DialogDescription,{asChild:!0,children:f.jsx(m.DialogContent,{children:f.jsxs(m.Box,{padding:16,flexDirection:"column",children:[f.jsxs(m.Text,{children:["You are about to delete ",p,": ",!d&&f.jsx("b",{children:r.filename})]}),d&&f.jsx(c6e,{media:r})]})})}),f.jsxs(m.DialogActions,{children:[f.jsx(m.DialogCancelButton,{}),f.jsxs(m.DialogActionButton,{onClick:h,color:"tomato",loading:u,children:["Yes, I want to remove ",p]})]})]})}const VC=15;function c6e(e){const{media:t}=e,n=t.slice(0,VC),r=t.length>VC,i=r?t.length-VC:0,o=bi.pluralize(i,"item");return f.jsxs(m.UnorderedList,{density:"compact",sx:{marginTop:8},children:[n.map((a,s)=>f.jsx(m.ListItem,{children:f.jsx("b",{children:a.filename})},s)),r&&f.jsxs(m.ListItem,{children:["And ",f.jsx("b",{children:i})," more ",o,"..."]})]})}function u6e(e){const{ids:t,config:n}=e;if(!n.mediaLibrary)throw new Error("Media Library not configured.");if(t.length===0)throw new Error("No ids provided during media deletion");const{assetsApiBaseUrl:r,repository:i,authStrategy:o}=n;if(t.length===1){const[a]=t;return le.request(new URL(`assets/${a}`,r),{headers:{repository:i},method:"DELETE",credentials:le.getRequestCredentials(o),okType:$.unknown()})}return le.request(new URL("assets/bulk-delete",r),{headers:{repository:i},method:"POST",credentials:le.getRequestCredentials(o),okType:$.unknown(),body:{ids:t}})}const _s=2e3,Cp="__MAIN_THUMBNAIL__";function Ex(e,t,n){const r=e.name===Cp?void 0:e.name;let i;return t?qi.isDefined(n)?i=[n.width,n.height]:qi.isDefined(e.width)||qi.isDefined(e.height)?i=[e.width??void 0,e.height??void 0]:i=[t.origin.width,t.origin.height]:i=void 0,[r,i?`${i[0]??"auto"}×${i[1]??"auto"}px`:void 0]}function l6e(e){var t,n;return[{...(t=e.config)==null?void 0:t.constraint,name:Cp}].concat(((n=e.config)==null?void 0:n.thumbnails)??[])}function d6e(e,t){var a,s;const{__TYPE__:n,thumbnails:r,...i}=t,o=(s=(a=e.config)==null?void 0:a.thumbnails)==null?void 0:s.map(({name:c})=>r==null?void 0:r[c]);return[i,...o??[]]}function f6e(e,t,n,r){const i=r.length===0?void 0:r;return e===Cp||!ue.isImageContent(t)?{...t,alt:i}:{...t,thumbnails:{...t.thumbnails,[e]:{...n,alt:i}}}}function p6e(e,t){const{width:n,height:r}=t??{};return n&&r?[n,r]:n?[n,Math.round(e.height*(n/e.width))]:r?[Math.round(e.width*(r/e.height)),r]:[e.width,e.height]}function h6e(e,t,n,r,i){if(b6e(e)==="svg")return e;const o=new URL(e);if(i){const{x:a,y:s,width:c,height:u}=t,l=[...o.searchParams.entries(),["rect",[a,s,c,u].join(",")],["w",n],["h",r]];o.search=l.map(d=>d.join("=")).join("&")}return o.toString()}function zF(e,t){const n=new URL(e.split("?")[0]??e);return t!=null&&t.width&&n.searchParams.set("w",t.width.toString()),t!=null&&t.height&&n.searchParams.set("h",t.height.toString()),(t!=null&&t.width||!(t!=null&&t.height))&&n.searchParams.set("dpr",Math.max(1,Math.min(window.devicePixelRatio,3)).toString()),t!=null&&t.width&&(t!=null&&t.height)&&n.searchParams.set("fit","max"),n.searchParams.set("auto","compress,format"),n.toString()}function A6e(e){return zF(e,{width:300})}function UG(e){return zF(e,{width:800,height:800})}function m6e(e){return e!=null&&e.url?UG(e.url):void 0}function g6e(e,t,n,r){var s,c,u,l,d;if(!n||e===Cp){const p=(s=t.config)==null?void 0:s.thumbnails,h=p&&Object.fromEntries(p.map(A=>[A.name,Hg(r,A)]));return{__TYPE__:"ImageContent",...Hg(r,(c=t.config)==null?void 0:c.constraint),thumbnails:h}}const i=(l=(u=t.config)==null?void 0:u.thumbnails)==null?void 0:l.find(p=>p.name===e);if(!i)return n;const o=(d=n.thumbnails)==null?void 0:d[e],a=Hg(r,i);return a.url===(o==null?void 0:o.url)?n:{...n,thumbnails:Yd.mapValues(n.thumbnails??{},(p,h)=>h===e?a:p)}}function v6e(e){return"kind"in e&&"extension"in e}function Hg(e,t){const{width:n,height:r,rect:i}=y6e({...e,width:(e==null?void 0:e.width)??_s,height:(e==null?void 0:e.height)??_s},t),o=!!(t!=null&&t.width||t!=null&&t.height);return{provider:"imgix",url:h6e(e.url,i,n,r,o),alt:e.alt,...v6e(e)?{credits:e.credits}:{},origin:{id:e.id,url:e.url,width:e.width??_s,height:e.height??_s},width:n,height:r,edit:{background:"transparent",zoom:1,crop:{x:i.x,y:i.y}}}}function y6e(e,t){const[n,r]=p6e(e,t),i=Math.max(n/e.width,r/e.height),o=Math.round((e.width-n/i)/2),a=Math.round((e.height-r/i)/2),s=Math.round(n/i),c=Math.round(r/i);return{width:n,height:r,rect:{x:o,y:a,width:s,height:c}}}function b6e(e){const{pathname:t}=new URL(e),n=t.lastIndexOf(".");if(n!==-1)return t.substring(n).slice(1).toLowerCase()}function S6e(e){if(!e)return"";const{filename:t,extension:n}=e;return!n||!t.endsWith(`.${n}`)?t:t.slice(0,-n.length-1)}function C6e(){var o;const e=kl(),{uploadingFiles:t}=At(),[n]=e;if(!n)return null;if(e.length===2)return f.jsx(zC,{children:e.map((a,s)=>f.jsx("div",{style:{position:"absolute",transform:s===0?"translateX(25%) rotate(15deg) ":"translateX(-25%) rotate(-15deg) "},children:f.jsx(cD,{media:a})},a.id))});if(e.length>2)return f.jsx(zC,{children:e.slice(-4).map((a,s)=>f.jsx("div",{style:{position:"absolute",paddingRight:s*16},children:f.jsx(cD,{media:a})},a.id))});const r=(o=t.find(a=>a.id===n.id))==null?void 0:o.status,i=n.kind.startsWith("image");return f.jsx(m.Box,{flexDirection:"column",children:f.jsx(m.CheckerBoard,{children:f.jsx(zC,{uploadStatus:r,hasImage:i,children:i?f.jsx(m.Image,{src:n.url,alt:n.alt,sizing:"contain"}):f.jsx(m.MediaCardPlaceholder,{kind:n.kind,filename:n.filename})})})})}function zC(e){const{children:t,uploadStatus:n,hasImage:r}=e;return f.jsxs(m.Box,{flexDirection:"column",alignItems:"center",justifyContent:"center",position:"relative",height:200,width:"100%",backgroundColor:r?"transparent":"purple2",children:[t,n&&f.jsx(w6e,{uploadStatus:n})]})}function w6e(e){const{uploadStatus:t}=e,{value:n,color:r,height:i,transition:o}=x6e(t);return f.jsx(m.Box,{position:"absolute",backgroundColor:"greyAlpha1",width:"100%",height:"100%",padding:{inline:16},justifyContent:"end",flexDirection:"column",children:f.jsx(m.ProgressBar,{value:n,color:r,height:i,transition:o})})}function x6e(e){switch(e){case"idle":return{value:0,height:"collapsed",color:"grey4"};case"uploading":return{value:90,transition:"slow",color:"purple9"};case"success":return{value:100,height:"collapsed",color:"purple9"};case"error":return{value:100,color:"tomato11"}}}function cD(e){const{media:t}=e;return f.jsx(m.Box,{width:111,height:152,children:t.kind==="image"?f.jsx(m.Image,{borderRadius:8,src:zF(t.url,{width:111,height:152}),alt:t.alt,sizing:"cover"}):f.jsx(m.MediaCardPlaceholder,{kind:t.kind,filename:t.filename})})}function _6e(e){const t=e.length,n={},r=[];return e.forEach(o=>{o.tags.forEach(a=>{n[a.id]||(n[a.id]=0,r.push(a)),n[a.id]++})}),r.filter(o=>n[o.id]===t)}function PG(e){const{tags:t,toggleAssetTag:n,getTagsLabel:r}=e,{setTagManagerOpen:i}=At(),{showToast:o}=jG(),{showAlert:a}=m.useAlert(),[s,c]=E.useState("");async function u(l,d){c("");try{await n(l,d),o({title:"Media tags were updated",seconds:3})}catch{a({title:"Error",subtitle:"Something went wrong when updating media tags"})}}return f.jsxs(m.Box,{flexDirection:"column",children:[f.jsxs(m.Box,{justifyContent:"space-between",children:[f.jsx(m.Text,{color:"grey12",variant:"bold",children:r()}),f.jsx(m.Button,{startIcon:"edit",invisible:!0,color:"dark",onClick:()=>i(!0),children:"Manage tags"})]}),f.jsxs(m.ComboBox,{sx:{marginTop:4,marginBottom:8},children:[f.jsx(T6e,{searchTerm:s,setSearchTerm:c}),f.jsx(m.ComboBoxContent,{children:f.jsx(m.ErrorBoundary,{renderError:()=>f.jsx(m.Text,{color:"grey9",variant:"small",sx:{marginBlock:8,marginInline:8},children:"Error getting tags"}),children:f.jsx(E.Suspense,{fallback:f.jsx(m.Box,{padding:8,flexDirection:"column",gap:8,children:yt.range(1,6).map(l=>f.jsx(m.Skeleton,{height:24,width:85},l))}),children:f.jsx(I6e,{searchTerm:s,assignedTags:t,onToggleAssetTag:u})})})})]}),f.jsx(m.Box,{flexDirection:"column",alignItems:"flex-start",gap:8,children:t.map(l=>f.jsx(m.Badge,{title:l.name,size:"medium",color:"purple",selected:!0,onClose:()=>u(l,"remove")},l.id))})]})}function T6e(e){const{searchTerm:t,setSearchTerm:n}=e,r=E.useRef(null),{openMediaSection:i,setOpenMediaSection:o}=At();return E.useEffect(()=>{var a;i==="tags"&&((a=r.current)==null||a.focus(),o(void 0))},[i,o]),f.jsx(m.ComboBoxInput,{value:t,onValueChange:n,placeholder:"Add or create a new tag",ref:r})}function I6e(e){const{searchTerm:t,assignedTags:n,onToggleAssetTag:r}=e,[i]=kl(),o=ye(),{showAlert:a}=m.useAlert(),{tags:s}=ng(),c=E.useMemo(()=>{const p=t.toLowerCase();return s.filter(h=>h.name.toLowerCase().includes(p))},[s,t]),l=qF.safeParse(t).success&&s.every(p=>p.name!==t);async function d(){if(!t||!i)return;let p;try{p=await E6e({name:t,config:o}),rg(h=>[p,...h])}catch{a({title:"Error",subtitle:`Something went wrong when creating the tag ${t}`});return}await r(p,"add")}return i?f.jsxs(f.Fragment,{children:[!c.length&&f.jsx(m.Text,{color:"grey9",variant:"small",sx:{marginBlock:8,marginInline:8},children:"No tags found"}),c.map((p,h)=>f.jsx(m.ComboBoxItem,{value:p.id,onCheckedChange:A=>r(p,A?"add":"remove"),checked:n.some(A=>A.id===p.id),children:f.jsx(m.Badge,{title:p.name,color:"purple",size:"medium",sx:{marginInline:8,marginBottom:h===c.length-1?8:4,marginTop:h===0?8:4}})},p.id)),l&&f.jsx(m.ComboBoxItem,{value:"new",onCheckedChange:d,children:f.jsxs(m.Box,{padding:8,flexDirection:"row",alignItems:"center",gap:4,children:[f.jsx(m.Icon,{name:"add",size:"small",color:"grey11"}),f.jsxs(m.Text,{color:"grey12",children:['Create tag "',t,'"']})]})})]}):null}function E6e(e){const{name:t,config:n}=e;n.mediaLibrary||bt("mediaLibrary");const{assetsApiBaseUrl:r,repository:i,authStrategy:o}=n;return le.request(new URL("tags",r),{headers:{repository:i},body:{name:t},method:"POST",credentials:le.getRequestCredentials(o),okType:VF})}function R6e(e){const{selectedMedia:t}=e,n=ye(),r=E.useMemo(()=>_6e(t),[t]);async function i(a,s){const c=s==="remove",u=t.map(d=>d.id);let l=[];wu(d=>(l=d,d.map(p=>u.includes(p.id)?c?O6e(p,a):k6e(p,a):p)));try{await $6e({tagId:a.id,assetIds:u,operation:c?"remove":"add",config:n});const d=t.length*(c?-1:1);rg(p=>p.map(h=>h.id===a.id?{...h,count:h.count+d}:h))}catch(d){throw wu(()=>l),d}}function o(){const a=r.length;return a>1?`${a} tags in common`:a===1?"1 tag in common":"Common tags"}return f.jsx(PG,{tags:r,getTagsLabel:o,toggleAssetTag:i})}function $6e(e){const{tagId:t,assetIds:n,config:r,operation:i}=e;if(!r.mediaLibrary)throw new Error("Media Library not configured.");const{assetsApiBaseUrl:o,repository:a,authStrategy:s}=r;return le.request(new URL(`tags/${t}/assets`,o),{headers:{repository:a},body:{assetIds:n},method:i==="add"?"POST":"DELETE",credentials:le.getRequestCredentials(s),okType:$.unknown()})}function k6e(e,t){return e.tags.some(({id:r})=>r===t.id)?e:{...e,tags:[...e.tags,t]}}function O6e(e,t){const n=e.tags.filter(r=>r.id!==t.id);return{...e,tags:n}}function M6e(e){const{selectedMedia:t}=e,n=t.tags,r=ye(),{updateMedia:i}=At();async function o(s,c){const u=t.tags,l=c==="remove",d=l?u.filter(p=>p.id!==s.id):[...u,s];i(t.id,{tags:d});try{await F6e({mediaId:t.id,config:r,tags:d.map(p=>p.id)}),rg(p=>p.map(h=>h.id===s.id?{...h,count:h.count+(l?-1:1)}:h))}catch(p){throw i(t.id,{tags:u}),p}}function a(){const s=n.length;return s>1?`${s} tags`:s===1?"1 tag":"Tags"}return f.jsx(PG,{tags:n,getTagsLabel:a,toggleAssetTag:o})}function F6e(e){const{mediaId:t,config:n,tags:r}=e;if(!n.mediaLibrary)throw new Error("Media Library not configured.");const{assetsApiBaseUrl:i,repository:o,authStrategy:a}=n;return le.request(new URL(`assets/${t}`,i),{headers:{repository:o},body:{tags:r},method:"PATCH",credentials:le.getRequestCredentials(a),okType:gS})}function L6e(){const[e,t]=E.useState("description");if(kl().length!==1)return f.jsx(P6e,{});const r=e==="description",i=e==="more-info";return f.jsxs(f.Fragment,{children:[f.jsxs(m.Box,{display:"grid",gridTemplateColumns:"1fr 1fr",backgroundColor:"grey2",border:!0,borderStyle:"solid",borderRadius:8,children:[f.jsx(m.Tab,{selected:r,outline:r,transparent:!0,onClick:()=>t("description"),children:"Description"}),f.jsx(m.Tab,{selected:i,outline:i,transparent:!0,onClick:()=>t("more-info"),children:"More info"})]}),f.jsx(B6e,{tab:e})]})}function B6e(e){const{tab:t}=e;switch(t){case"description":return f.jsx(D6e,{});case"more-info":return f.jsx(j6e,{})}}function D6e(){const{title:e,alt:t,onBlur:n,isUploading:r,selectedMedia:i}=WG();if(!i)return null;const{extension:o}=i;return f.jsxs(m.Box,{flexDirection:"column",gap:16,children:[f.jsx(m.FormInput,{value:e.value,onValueChange:e.set,label:"Media title",placeholder:"Media title",onBlur:n,disabled:r,suffix:o?`.${o}`:void 0}),f.jsx(m.FormInputField,{label:"Alternative text",children:f.jsx(m.ContentEditable,{content:t.displayValue,contentVersion:t.version,readOnly:r,placeholder:"A short description of the media for accessibility",multiline:!0,decorations:{em:"highlight"},onChange:t.onChange,onBlur:n})}),!r&&f.jsx(M6e,{selectedMedia:i})]})}function j6e(){const{credits:e,notes:t,onBlur:n,isUploading:r,selectedMedia:i}=WG();if(!i)return null;const{uploader_id:o}=i,a=K6e(i);return f.jsxs(m.Box,{gap:8,flexDirection:"column",children:[a.map(s=>f.jsxs(m.Box,{gap:8,children:[f.jsxs(m.Text,{color:"grey11",children:[s.label,":"]}),f.jsx(m.Text,{children:s.value})]},s.label)),f.jsxs(m.Box,{gap:8,children:[f.jsx(m.Text,{color:"grey11",children:"Uploaded by:"}),f.jsx(m.ErrorBoundary,{renderError:()=>f.jsx(m.Text,{color:"grey11",children:"Error getting uploader"}),children:f.jsx(E.Suspense,{fallback:f.jsx(NG,{}),children:f.jsx(U6e,{uploaderId:o})})})]}),f.jsx(m.FormInputField,{label:"Copyright",children:f.jsx(m.ContentEditable,{content:e.displayValue,contentVersion:e.version,readOnly:r,placeholder:"Media copyrights or credits",multiline:!0,decorations:{em:"highlight"},onChange:e.onChange,onBlur:n})}),f.jsx(m.FormInputField,{label:"Private notes",children:f.jsx(m.ContentEditable,{content:t.displayValue,contentVersion:t.version,readOnly:r,placeholder:"Private notes are never shared publicly",multiline:!0,decorations:{em:"highlight"},onChange:t.onChange,onBlur:n})})]})}function U6e(e){const{uploaderId:t}=e,{uploadersById:n}=SG(),r=n.get(t??"ghost");return t&&!r?f.jsx(NG,{}):r?f.jsxs(f.Fragment,{children:[f.jsx(m.Avatar,{size:24,firstName:r.firstName,lastName:r.lastName,imageUrl:r.uploadedAvatar,hasBorder:!1}),f.jsx(m.Text,{children:r.name})]}):null}function NG(){return f.jsx(m.Skeleton,{width:128})}function P6e(){const e=kl(),{uploadingFiles:t}=At(),n=E.useMemo(()=>t.some(r=>e.some(i=>r.id===i.id)&&r.status!=="success"),[e,t]);return f.jsx(f.Fragment,{children:!n&&f.jsx(R6e,{selectedMedia:e})})}function WG(){const[e]=kl(),{updateMedia:t,uploadingFiles:n}=At(),r=ye(),{showToast:i}=jG(),o=(e==null?void 0:e.id)??"",a=Eg(e,"alt"),s=Eg(e,"notes"),c=Eg(e,"credits"),u=Eg(e,"filename",S6e),l=n.some(p=>p.id===(e==null?void 0:e.id)&&p.status!=="success");async function d(){if(!e||!u.changed&&!a.changed&&!c.changed&&!s.changed)return;const{extension:p,search_highlight:h}=e,A=p?`${u.value}.${p}`:u.value;t(o,{filename:A,alt:a.value,credits:c.value,notes:s.value,search_highlight:{alt:a.changed||h==null?void 0:h.alt,credits:c.changed||h==null?void 0:h.credits,filename:u.changed||h==null?void 0:h.filename,notes:s.changed||h==null?void 0:h.notes}}),await W6e({id:o,config:r,metadata:{filename:A,alt:a.value,credits:c.value,notes:s.value}}),i({title:"Media metadata has been saved.",seconds:3})}return{selectedMedia:e,onBlur:d,isUploading:l,title:u,alt:a,credits:c,notes:s,extension:e==null?void 0:e.extension}}function Eg(e,t,n=r=>r==null?void 0:r[t]){var u;const r=n(e)??"",[i,o]=E.useState(r);We.useOnChange(e==null?void 0:e.id,()=>o(r));const a=(u=e==null?void 0:e.search_highlight)==null?void 0:u[t],s=!!a;function c(l){const{from:d,to:p}=l.state.selection;l.commands.selectAll(),l.commands.unsetAllMarks(),l.commands.setTextSelection({from:d,to:p}),o(l.getText())}return{value:i,set:o,displayValue:N6e(a??i)??"",onChange:c,version:`${(e==null?void 0:e.id)??""}_${s}`,changed:i!==r}}function N6e(e){return e==null?void 0:e.replace(/\n/g,"<br>")}function W6e(e){const{id:t,config:n,metadata:r}=e;if(!n.mediaLibrary)throw new Error("Media Library not configured.");const{assetsApiBaseUrl:i,repository:o,authStrategy:a}=n;return le.request(new URL(`assets/${t}`,i),{headers:{repository:o},body:{...r},method:"PATCH",credentials:le.getRequestCredentials(a),okType:gS})}function K6e(e){const{width:t,height:n,last_modified:r,size:i,extension:o}=e,a=t&&n,s={label:"Date",value:O_.prettyPrintDate(new Date(r))},c={label:"File size",value:bi.formatBytes(i)},u=a?{label:"Dimensions",value:`${t}×${n}`}:void 0,l=a?{label:"Ratio",value:((t??0)/(n??0)).toFixed(1)}:void 0,d=o?{label:"Extension",value:o.toUpperCase()}:void 0;return[s,c,u,l,d].filter(qi.isDefined)}function q6e(){const{setTagManagerOpen:e}=At(),[t,n]=E.useState("");return f.jsxs(m.Box,{gap:20,flexDirection:"column",height:"100%",children:[f.jsxs(m.Box,{alignItems:"center",gap:4,children:[f.jsx(m.IconButton,{icon:"close",size:"small",hasPadding:!1,onClick:()=>e(!1)}),f.jsx(m.Text,{variant:"bold",children:"Tags management"})]}),f.jsxs(m.Box,{gap:16,flexDirection:"column",height:"100%",children:[f.jsx(m.FormSearchInput,{value:t,onValueChange:n,placeholder:"Search for tags",endAdornment:!1,autoFocus:!0}),f.jsx(m.ErrorBoundary,{renderError:()=>f.jsx(H6e,{}),children:f.jsx(E.Suspense,{fallback:f.jsx(J6e,{}),children:f.jsx(V6e,{searchTerm:t})})})]})]})}function V6e(e){const{searchTerm:t}=e,{tags:n}=ng(),r=n.filter(i=>i.name.toLowerCase().includes(t.toLowerCase()));return r.length===0?f.jsx(m.Text,{color:"grey9",variant:"small",children:"No tags found"}):f.jsx(m.AnimatedList,{ariaLabel:"Tags list",getItemKey:i=>i.id,gap:16,items:r,children:i=>f.jsx(z6e,{tag:i})})}function z6e(e){const{tag:t}=e,[n,r]=E.useState(!1),i=ye(),{showAlert:o}=m.useAlert(),{showToast:a}=m.useToast(),{tags:s}=ng();async function c(u){if(!qF.safeParse(u).success){o({title:"Error",subtitle:`Failed to rename tag "${t.name}" to "${u}". Tag name must be at least ${hG} and at maximum ${AG} characters long.`});return}if(s.some(p=>p.name===u)){o({title:"Error",subtitle:`Failed to rename tag "${t.name}" to "${u}". Tag with name "${u}" already exists.`});return}try{await G6e({id:t.id,name:u,config:i}),rg(p=>p.map(h=>h.id===t.id?{...h,name:u}:h)),wu(p=>p.map(h=>{if(h.tags.findIndex(g=>g.id===t.id)!==-1){const g=h.tags.map(v=>v.id===t.id?{...v,name:u}:v);return{...h,tags:g}}return h})),a({title:`Tag "${t.name}" renamed to "${u}"`,seconds:3})}catch{o({title:"Error",subtitle:"Something went wrong when renaming the tag."})}}return f.jsxs(f.Fragment,{children:[f.jsxs(m.Box,{justifyContent:"space-between",children:[f.jsx(m.Badge,{title:t.name,color:"purple",size:"medium",onEdit:c}),f.jsx(m.Button,{invisible:!0,color:"tomato",textWeight:"normal",onClick:()=>r(!0),children:"Delete"})]}),f.jsx(Q6e,{open:n,onOpenChange:r,tag:t})]})}function Q6e(e){const{open:t,onOpenChange:n,tag:r}=e,{id:i,name:o,count:a}=r,s=ye(),{showAlert:c}=m.useAlert(),[u,l]=E.useState(!1);async function d(){l(!0);try{await Y6e({id:i,config:s}),rg(p=>p.filter(h=>h.id!==i)),wu(p=>p.map(h=>{if(h.tags.findIndex(g=>g.id===i)!==-1){const g=h.tags.filter(v=>v.id!==i);return{...h,tags:g}}return h}))}catch{c({title:"Error",subtitle:"Something went wrong when removing the tag."})}finally{l(!1),n(!1)}}return f.jsxs(m.Dialog,{onOpenChange:n,open:t,size:"small",children:[f.jsx(m.DialogHeader,{title:`This tag is being used on ${a} media ${bi.pluralize(a,"item")}`}),f.jsx(m.DialogDescription,{asChild:!0,children:f.jsx(m.DialogContent,{padding:16,children:f.jsxs(m.Text,{children:["You are about to delete the tag name ",f.jsx("b",{children:o}),"."," ",a>0&&`This tag is being used on ${a} media ${bi.pluralize(a,"item")} and will be deleted from ${bi.pluralize(a,"it","them")}.`]})})}),f.jsxs(m.DialogActions,{children:[f.jsx(m.DialogCancelButton,{}),f.jsx(m.DialogActionButton,{onClick:d,color:"tomato",loading:u,children:"Yes, I want to delete"})]})]})}function H6e(){const e=E.useContext(Ye.ErrorBoundaryContext);return f.jsx(m.Box,{flexDirection:"column",children:f.jsxs(m.BlankSlate,{children:[f.jsx(m.BlankSlateIcon,{name:"close",lineColor:"purple10",backgroundColor:"purple3",borderColor:"purple6",borderStyle:"dashed"}),f.jsx(m.BlankSlateTitle,{size:"big",children:"Oops!"}),f.jsx(m.BlankSlateDescription,{width:360,children:"We couldn't load your media tags."}),f.jsx(m.BlankSlateActions,{children:f.jsx(m.Button,{onClick:e==null?void 0:e.reset,size:"medium",children:"Try again"})})]})})}function Y6e(e){const{id:t,config:n}=e;n.mediaLibrary||bt("mediaLibrary");const{assetsApiBaseUrl:r,repository:i,authStrategy:o}=n;return le.request(new URL(`tags/${t}`,r),{headers:{repository:i},method:"DELETE",credentials:le.getRequestCredentials(o),okType:$.unknown()})}function G6e(e){const{id:t,name:n,config:r}=e;r.mediaLibrary||bt("mediaLibrary");const{assetsApiBaseUrl:i,repository:o,authStrategy:a}=r;return le.request(new URL(`tags/${t}`,i),{headers:{repository:o},method:"PATCH",credentials:le.getRequestCredentials(a),body:{name:n},okType:$.unknown()})}function J6e(){return f.jsx(m.Box,{flexDirection:"column",gap:16,children:yt.range(1,6).map(e=>f.jsxs(m.Box,{justifyContent:"space-between",children:[f.jsx(m.Skeleton,{height:24,width:85}),f.jsx(m.Skeleton,{height:24,width:45})]},e))})}function Z6e(){const e=kl(),{onFilesUpload:t,isUploading:n,tagManagerOpen:r}=At();return e.length===0&&r===!1?f.jsx(FG,{onFilesUpload:t,isUploading:n}):f.jsx(m.Box,{flexDirection:"column",backgroundColor:"grey1",width:"100%",padding:16,gap:16,borderRadius:{topLeft:8,topRight:8},children:r?f.jsx(q6e,{}):f.jsxs(f.Fragment,{children:[f.jsx(s6e,{}),f.jsx(C6e,{}),f.jsx(L6e,{})]})})}function X6e(){const e=_c();return f.jsx(MG,{hasSelectedMedia:e.selectedCount!==0,children:f.jsx(Z6e,{})})}const Rx={all:{name:"All media",icon:"public"},image:{name:"Images",icon:"image"},video:{name:"Videos",icon:"videocam"},document:{name:"Documents",icon:"insertDriveFile"},audio:{name:"Audio files",icon:"musicNote"}},eWe=Object.entries(Rx);function tWe(){const{assetType:e,initialAssetType:t,onFilterChange:n}=At(),[r,i]=E.useState(e);We.useOnChange(e,()=>{i(e)});const[o,a]=E.useState(!1);function s(p){a(!1),i(p),n({assetType:p})}const{icon:c,name:u}=Rx[r],l=Rx[t].name,d=t!=="all";return f.jsxs(m.DropdownMenu,{open:o,onOpenChange:a,children:[f.jsx(m.DropdownMenuTrigger,{disabled:d,children:f.jsx(nWe,{icon:c,isDropdownDisabled:d,buttonName:u,tooltipAssetTypeName:l})}),f.jsx(m.DropdownMenuContent,{minWidth:256,align:"start",childrenFocusScope:!0,children:f.jsx(f.Fragment,{children:eWe.filter(([p])=>p!==r).map(([p,{icon:h,name:A}])=>f.jsx(m.DropdownMenuItem,{startIcon:f.jsx(m.Icon,{name:h}),onSelect:()=>s(p),children:A},p))})})]})}const nWe=E.forwardRef(function(t,n){const{icon:r,isDropdownDisabled:i,buttonName:o,tooltipAssetTypeName:a,...s}=t;return f.jsx(m.Tooltip,{content:`You can only pick ${(a==null?void 0:a.toLocaleLowerCase())??"this type of media"}`,visible:i,children:f.jsx(m.Button,{startIcon:r,endIcon:"arrowDropDown",size:"small",color:"grey",disabled:i,ref:n,...s,children:o})})});function rWe(e){const{optimisticTagIds:t,setOptimisticTagIds:n}=e,{onFilterChange:r}=At(),{tags:i}=ng(),o=E.useMemo(()=>dte.groupBy(i,s=>s.id),[i]);function a(s){const c=t.filter(u=>u!==s.id);n(c),r({tagIds:c})}return f.jsx(f.Fragment,{children:t.map(s=>{var u;const c=(u=o.get(s))==null?void 0:u[0];return c?f.jsx(m.Badge,{title:c.name,size:"medium",color:"purple",onClose:()=>a(c),selected:!0},c.id):null})})}function iWe(){const{setTagManagerOpen:e,tagIds:t,onFilterChange:n}=At(),[r,i]=E.useState(""),[o,a]=E.useState(!1),[s,c]=E.useState(t);We.useOnChange(JSON.stringify(t),()=>{c(t)});function u(p){a(p),p||i("")}function l(p){const h=s.includes(p.id)?t.filter(A=>A!==p.id):[...t,p.id];c(h),n({tagIds:h}),a(!1)}function d(){a(!1),e(!0)}return f.jsxs(f.Fragment,{children:[f.jsxs(m.DropdownMenu,{open:o,onOpenChange:u,children:[f.jsx(m.DropdownMenuTrigger,{children:f.jsx(m.Button,{startIcon:"label",endIcon:"arrowDropDown",size:"small",color:"grey",children:"Tags"})}),f.jsx(m.DropdownMenuContent,{minWidth:256,align:"start",border:!1,childrenFocusScope:!0,children:f.jsxs(m.ComboBox,{variant:"attached",children:[f.jsx(m.ComboBoxInput,{value:r,onValueChange:i,placeholder:"Search for a tag",autoFocus:!0}),f.jsx(m.ComboBoxContent,{paddingBlock:4,children:f.jsx(m.ErrorBoundary,{renderError:()=>f.jsx(m.Text,{color:"grey9",variant:"small",sx:{marginBlock:8,marginInline:8},children:"Error getting tags"}),children:f.jsx(E.Suspense,{fallback:f.jsx(m.Box,{padding:8,flexDirection:"column",gap:8,children:yt.range(1,6).map(p=>f.jsx(m.Skeleton,{height:24,width:85},p))}),children:f.jsx(oWe,{searchTerm:r,setSearchTerm:i,onTagToggle:l,optimisticTagIds:s})})})}),f.jsx(m.ComboboxAction,{children:f.jsx(m.Button,{invisible:!0,startIcon:"edit",textWeight:"normal",color:"dark",onClick:d,children:"Manage tags"})})]})})]}),s.length>0&&f.jsx(m.ErrorBoundary,{children:f.jsx(E.Suspense,{children:f.jsx(rWe,{optimisticTagIds:s,setOptimisticTagIds:c})})})]})}function oWe(e){const{onTagToggle:t,searchTerm:n,optimisticTagIds:r}=e,{tags:i}=ng(),o=E.useMemo(()=>{const a=n.toLowerCase();return i.filter(s=>s.name.toLowerCase().includes(a))},[i,n]);return f.jsxs(f.Fragment,{children:[!o.length&&f.jsx(m.Text,{color:"grey9",variant:"small",sx:{marginBlock:8,marginInline:8},children:"No tags found"}),o.map(a=>{const s=r.includes(a.id);return f.jsx(m.ComboBoxItem,{value:a.id,onCheckedChange:()=>t(a),checked:s,children:f.jsx(m.Badge,{title:a.name,color:"purple",sx:{marginLeft:8,marginBottom:4,marginTop:4},size:"medium"})},a.id)})]})}function aWe(){const{uploaderId:e,onFilterChange:t}=At(),[n,r]=E.useState(""),[i,o]=E.useState(!1),[a,s]=E.useState();We.useOnChange(e,()=>{e||s(void 0)});function c(l){o(l),l||r("")}function u(l){s(l),t({uploaderId:l==null?void 0:l.id}),o(!1)}return f.jsxs(m.DropdownMenu,{open:i,onOpenChange:c,children:[f.jsx(m.DropdownMenuTrigger,{children:f.jsx(m.Button,{startIcon:"people",renderStartIcon:l=>a?f.jsx(m.Avatar,{imageUrl:a==null?void 0:a.uploadedAvatar,firstName:a.firstName,lastName:a.lastName,size:16,hasBorder:!1}):l,endIcon:"arrowDropDown",size:"small",color:"grey",children:(a==null?void 0:a.name)??"All uploaders"})}),f.jsx(m.DropdownMenuContent,{minWidth:256,align:"start",border:!1,childrenFocusScope:!0,children:f.jsxs(m.ComboBox,{variant:"attached",children:[f.jsx(m.ComboBoxInput,{value:n,onValueChange:r,placeholder:"Search for uploaders",autoFocus:!0}),f.jsx(m.ComboBoxContent,{paddingBlock:4,children:f.jsx(m.ErrorBoundary,{renderError:()=>f.jsx(m.Text,{color:"grey9",variant:"small",sx:{marginBlock:8,marginInline:8},children:"Error getting uploaders"}),children:f.jsx(E.Suspense,{fallback:f.jsx(cWe,{}),children:f.jsx(sWe,{searchTerm:n,setSearchTerm:r,onUploaderToggle:u,optimisticUploader:a})})})})]})})]})}function sWe(e){const{searchTerm:t,optimisticUploader:n,onUploaderToggle:r}=e,{uploaders:i}=SG(),o=E.useMemo(()=>{const a=t.toLowerCase();return yt.sort(i.filter(s=>{var c;return s.name.toLowerCase().includes(a)||((c=s.email)==null?void 0:c.toLowerCase().includes(a))}),s=>(n==null?void 0:n.id)===(s==null?void 0:s.id)?0:1)},[i,n,t]);return o.length?f.jsx(f.Fragment,{children:o.map(a=>{const s=a.id===(n==null?void 0:n.id);return f.jsx(m.ComboBoxItem,{value:a.id,onCheckedChange:()=>s?r():r(a),checked:s,children:f.jsxs(m.Box,{alignItems:"center",padding:{top:8,bottom:8,left:16,right:16},gap:8,children:[f.jsx(m.Avatar,{firstName:a.firstName,lastName:a.lastName,imageUrl:a.uploadedAvatar,hasBorder:!1}),f.jsxs(m.Box,{display:"flex",flexDirection:"column",children:[f.jsx(m.Text,{color:"grey12",variant:"normal",children:a.name}),a.email&&f.jsx(m.Text,{color:"grey10",variant:"small",children:a.email})]})]})},a.id)})}):f.jsx(m.Text,{color:"grey9",variant:"small",sx:{marginBlock:8,marginInline:8},children:"No uploaders found"})}function cWe(){return f.jsx(m.Box,{padding:8,flexDirection:"column",gap:8,children:yt.range(1,4).map(e=>f.jsx(m.Skeleton,{height:48,width:"full"},e))})}function uWe(){const{media:e,mediaTotal:t}=At(),n=_c();return f.jsxs(m.Box,{alignItems:"center",gap:16,children:[n.isSelectAllEnabled&&f.jsx(m.Checkbox,{onCheckedChange:n.toggleSelectAll,checked:n.selectedCount>0,indeterminate:n.selectedCount!==t,onClick:r=>r.stopPropagation(),disabled:e.length===0}),e.length!==0&&f.jsx(LG,{count:t}),f.jsxs(m.Box,{gap:8,alignItems:"center",children:[f.jsx(m.Text,{children:"Filter:"}),f.jsx(tWe,{}),f.jsx(aWe,{}),f.jsx(iWe,{})]})]})}function KG(e){const{assetType:t,onSelectedChange:n,actionContainer:r}=e;return f.jsx(m.ErrorBoundary,{renderError:()=>f.jsx($G,{}),children:f.jsx(E.Suspense,{fallback:f.jsx(t6e,{actionContainer:r}),children:f.jsx(TH,{children:f.jsx(z3e,{assetType:t,actionContainer:r,onSelectedChange:n,children:f.jsx(Z3e,{children:f.jsx(lWe,{})})})})})})}function lWe(){const{media:e}=At(),t=TG();return f.jsx(o6e,{children:f.jsx(kG,{sidePane:t?void 0:f.jsx(X6e,{}),mediaActions:f.jsx(G3e,{}),mediaToolbar:f.jsx(uWe,{}),mediaList:e.length===0?f.jsx(H3e,{}):f.jsx(e6e,{})})})}function dWe(e){const{href:t,tracking:n}=e;return f.jsx(m.Box,{justifyContent:"center",padding:{block:6},children:f.jsxs(m.Text,{href:t,variant:"smallBold",color:"grey11",onClick:()=>void n.track({event:"shared-onboarding:follow-tutorial",source:n.source}),children:["Or watch our in-depth course",f.jsx(m.Icon,{name:"playCircle",color:"grey11",size:"small",sx:{marginLeft:4}})]})})}function fWe(e){const{step:t,stepIndex:n,isOpen:r,onActionClick:i,onClose:o,contentRef:a}=e,[s,c]=E.useState(!1),[u,l]=E.useState(e.isStepComplete);E.useEffect(()=>{r&&l(e.isStepComplete)},[e.isStepComplete,r]);async function d(){if(r)try{c(!0),await i(u)}finally{c(!1)}}return f.jsxs(m.Dialog,{open:r,onOpenChange:o,size:"small",children:[f.jsx(m.DialogHeader,{title:"Onboarding"}),f.jsxs(m.DialogContent,{children:[f.jsx(m.ScrollArea,{children:f.jsxs(m.Box,{ref:a,as:"article",flexDirection:"column",padding:16,gap:16,children:[f.jsx(m.DialogDescription,{asChild:!0,children:f.jsxs("section",{children:[f.jsxs(m.Text,{sx:{marginBottom:4},color:"purple9",variant:"bold",children:["Step ",n+1]}),f.jsx(m.Text,{variant:"h3",children:t.title}),t.content]})}),t.videoUrl&&f.jsx(m.Video,{src:t.videoUrl,sizing:"contain",borderRadius:4,autoPlay:!0,loop:!0})]})}),f.jsxs(m.DialogActions,{children:[f.jsx(m.DialogCancelButton,{size:"medium",children:"Close"}),!t.defaultCompleted&&f.jsx(m.DialogActionButton,{size:"medium",onClick:d,loading:s,color:u?"darkGrey":"purple",children:u?"Undo step":"Complete step"})]})]})]})}function pWe(e){const{steps:t,completedSteps:n,onToggleStep:r,tracking:i,stepOverrides:o}=e,[a,s]=E.useState(!1),[c,u]=E.useState(t[0]),l=E.useRef(null);if(!c)return null;const d=t.findIndex(({id:v})=>v===c.id);function p(v){return n.includes(v.id)}function h(v){u(v),s(!0),i.track({event:"shared-onboarding:step-opened",stepId:v.id,stepTitle:v.title,source:i.source})}async function A(v=!1){var b;if(c&&(await r(c),!v)){(b=l.current)==null||b.animate([{opacity:0},{opacity:1}],{duration:400});const w=g();w?h(w):s(!1)}}function g(){let v=d+1;for(;v<t.length;){const b=t[v];if(b&&!p(b))return b;v++}}return f.jsxs(f.Fragment,{children:[f.jsx(fWe,{contentRef:l,isOpen:a,step:c,stepIndex:d,isStepComplete:p(c),onClose:()=>s(!1),onActionClick:A}),f.jsxs(m.DropdownMenu,{children:[f.jsx(m.DropdownMenuTrigger,{children:f.jsx(m.Button,{size:"large",color:"grey",sx:{width:"100%"},renderStartIcon:hWe,children:n.length>0?"Continue":"Start now"})}),f.jsxs(m.DropdownMenuContent,{side:"right",minWidth:256,collisionPadding:8,children:[f.jsx(m.DropdownMenuLabel,{children:f.jsx(m.Text,{variant:"small",color:"grey11",sx:{marginInline:8},children:"Progress"})}),t.map((v,b)=>{const w=p(v);return f.jsx(m.DropdownMenuItem,{onSelect:(o==null?void 0:o[v.id])??(()=>h(v)),description:v.description,completed:w,endAdornment:f.jsx(m.Icon,{name:"chevronRight",size:"small",color:"grey11"}),children:`${b+1} ${v.title}`},v.id)})]})]})]})}function hWe(){return f.jsx(m.Icon,{name:"arrowForward",size:"small",color:"grey11"})}function AWe(e){const{steps:t,completedSteps:n,tutorialLink:r,tracking:i,onToggleStep:o,onClose:a,stepOverrides:s}=e,c=n.length===t.length;return f.jsx(m.Card,{variant:c?"elevated":"animated-light",paddingBlock:16,onClose:a,children:f.jsxs(m.CardContent,{children:[f.jsxs("div",{children:[f.jsx(m.Text,{variant:"bold",children:`Build your first page in ${t.length.toString()} simple steps`}),f.jsx(m.Text,{color:"grey11",variant:"small",children:"Render a live page with content coming from Prismic."})]}),f.jsx(m.ProgressBar,{value:n.length,max:t.length,displayLabel:!0,getValueLabel:(u,l)=>`${u}/${l}`}),f.jsx(pWe,{steps:t,completedSteps:n,onToggleStep:o,tracking:i,stepOverrides:s}),r&&f.jsx(dWe,{href:r,tracking:i})]})})}function mWe(e){const{framework:t,projectName:n,starterId:r,repositoryName:i}=e,{frameworkNameLabel:o,createProjectCodeSnippet:a}=gWe(e),s=[{id:"createPrismicProject",title:"Create your Prismic project",description:"Create and set up your project",defaultCompleted:!0,content:f.jsx(m.Text,{children:"A Prismic project is a space for managing and organizing the content of your website."})},{id:"chooseLocale",title:"Select your main locale",description:"Choose your first locale",defaultCompleted:!!r,content:f.jsx(m.Text,{children:"Locales allow you to create and manage multilingual versions of your content within a single Prismic project."})},{id:"createProject",title:`Create a ${o}project`,description:"Create and set up your project",videoUrl:"https://res.cloudinary.com/dmtf1daqp/video/upload/v1727768069/DEV_TOOLS/ONBOARDING_GUIDE/Pagebuilder_onboarding_step_3_puh6fx.mp4",content:f.jsxs(f.Fragment,{children:[f.jsx(m.Text,{sx:{marginBottom:16},children:"Now that you have a Prismic project to manage the content of your website, let's create the code project that will be querying your content."}),!!a&&f.jsx(Dw,{code:`${a} ${i??"<my-project>"}`,language:"bash"}),f.jsx(m.Text,{variant:"small",sx:{marginTop:16},children:"(example for Next.js below)"})]})},{id:"setupSliceMachine",title:"Set up & run Slice Machine",description:"Prepare the code to fetch content",videoUrl:"https://res.cloudinary.com/dmtf1daqp/video/upload/v1727768069/DEV_TOOLS/ONBOARDING_GUIDE/page_builder_onboarding_step_4_yl8fb8.mp4",content:f.jsxs(f.Fragment,{children:[f.jsx(m.Text,{sx:{marginBottom:16},children:`Slice Machine is the Prismic tool for creating your content models.
|
|
60
|
+
Install it in your ${o}project by running these commands:`}),f.jsx(Dw,{code:`cd ${n??"<your project name>"}
|
|
61
|
+
npx @slicemachine/init@latest --repository ${i??"<my-project>"}`,language:"bash",title:"Terminal",showLineNumbers:!1})]})},{id:"createPageType",title:"Create a Page Type",description:"Build the structure of your page",videoUrl:"https://res.cloudinary.com/dmtf1daqp/video/upload/v1721918320/DEV_TOOLS/ONBOARDING_GUIDE/Create_page_type_xdn13j.mp4",content:f.jsx(m.Text,{children:"A page type is a base content structure editors will use to create pages in the Page Builder (Prismic's content creation UI). A page type can be reusable (e.g., for multiple blog posts) or single (e.g., for a one-time page like the homepage)."})},{id:"codePage",title:"Code Your Page Type",description:"Prepare code to fetch content",videoUrl:"https://res.cloudinary.com/dmtf1daqp/video/upload/v1721918320/DEV_TOOLS/ONBOARDING_GUIDE/Step2_code_your_page_jatiur.mp4",content:f.jsx(m.Text,{children:"Prepare your code to query the content from the Prismic API."})},{id:"createSlice",title:"Create a Slice",description:"Build a reusable website section",videoUrl:"https://res.cloudinary.com/dmtf1daqp/video/upload/v1721918322/DEV_TOOLS/ONBOARDING_GUIDE/Step3_add_slice_qzmvxf.mp4",content:f.jsx(m.Text,{children:"Slices are website sections that can be reused on different pages with different content. Each slice has a code component automatically generated by Slice Machine. Start with a template and look at your code to see how it's structured."})},{id:"reviewAndPush",title:"Review and Push changes",description:"Enable editors to create content",videoUrl:"https://res.cloudinary.com/dmtf1daqp/video/upload/v1721918320/DEV_TOOLS/ONBOARDING_GUIDE/DevTools_Squad_push_changes_ovvmul.mp4",content:f.jsx(m.Text,{children:"Your page types and slices currently exist only in your local project. Push them to your repository to make them available for your content editors."})},{id:"createContent",title:"Create Content",description:"Publish a page to the Prismic API",videoUrl:"https://res.cloudinary.com/dmtf1daqp/video/upload/v1732631905/DEV_TOOLS/ONBOARDING_GUIDE/step_9_create_content_y8m3m0.mp4",content:f.jsx(m.Text,{children:"In Prismic, content creation takes place in the Prismic Page Builder UI. Open the Page Builder and start creating your first page."})},{id:"renderPage",title:"Render Your Page",description:"View your page in the browser",videoUrl:"https://res.cloudinary.com/dmtf1daqp/video/upload/v1721918321/DEV_TOOLS/ONBOARDING_GUIDE/Step_6_Render_Page_tnauh9.mp4",content:f.jsxs(m.Text,{children:["Now that your content is published, you can run your project in your terminal and visit the page on your local server (e.g.,"," ",f.jsx(m.Text,{component:"code",children:"localhost:3000/example-page"}),"). Your content should now be visible!"]})}],c={next:"https://prismic.dev/course/next",nuxt:"https://prismic.dev/course/nuxt",sveltekit:"https://prismic.dev/course/sveltekit"};return{steps:s,defaultCompletedStepIds:s.flatMap(u=>u.defaultCompleted?[u.id]:[]),tutorialLink:t?c[t]:void 0}}function gWe(e){const{framework:t}=e;if(!t||t==="other")return{frameworkNameLabel:"",createProjectCodeSnippet:""};const n=$U[t];return{frameworkNameLabel:n?`${n} `:"",createProjectCodeSnippet:kU[t]}}const QC=3e3,uD=400;function vWe(e){const{onboardingState:t,tracking:n,onToggleStep:r,onToggleGuide:i,fallback:o=null,stepOverrides:a,repositoryName:s,projectName:c}=e,{context:u,isDismissed:l}=t,{steps:d,defaultCompletedStepIds:p,tutorialLink:h}=mWe({...u,repositoryName:s,projectName:c}),A=w(t.completedSteps),g=yWe(v,uD);if(We.useOnChange(l,()=>!l&&g.reset()),u.framework==="other")return f.jsx(f.Fragment,{children:o});function v(){i()}async function b(S){const y=await r(S.id);y.includes(S.id)&&n.track({event:"shared-onboarding:step-completed",stepId:S.id,stepTitle:S.title,source:n.source}),w(y).length===d.length&&(n.track({event:"shared-onboarding:completed",source:n.source}),g.start())}function w(S){const y=d.map(({id:C})=>C);return Array.from(new Set([...S.filter(C=>y.includes(C)),...p]))}return l?null:f.jsx(m.AnimatedElement,{enterDuration:0,exitDuration:uD,children:g.status!=="hidden"&&f.jsxs("div",{ref:g.refs.container,style:{position:"relative"},children:[f.jsx(AWe,{steps:d,completedSteps:A,tutorialLink:h,tracking:n,onToggleStep:b,onClose:g.status!=="animating"?v:void 0,stepOverrides:a}),f.jsx("div",{ref:g.refs.cannon,style:{position:"absolute",bottom:0,left:0}})]})})}function yWe(e,t=400){const n=hte.useConfetti({config:{duration:QC}}),[r,i]=E.useState("visible"),o=E.useRef(!1),a=E.useCallback(()=>{i("animating"),setTimeout(()=>i("hidden"),QC-t),o.current||(setTimeout(e,QC),o.current=!0)},[e,t]),s=()=>{n.throwConfetti(),a()},c=E.useCallback(()=>{i("visible"),o.current=!1},[]);return{refs:{container:n.confettiContainerRef,cannon:n.confettiCannonRef},status:r,start:s,reset:c}}function qG(e){const{type:t,value:n}=e,r=t===mo?Ld.max:Bd.max;return f.jsx(m.Box,{alignItems:"center",children:f.jsx(m.Tooltip,{title:bWe[t],content:wWe[t],stableMount:!0,children:f.jsx(m.Badge,{title:`${n.length} characters`,size:"medium",color:n.length>r?"tomato":"green",sx:{alignSelf:"center"}})})})}const bWe={[mo]:"Meta title length",[oa]:"Meta description length"},SWe=`${Ld.min}-${Ld.max}`,CWe=`${Bd.min}-${Bd.max}`,wWe={[mo]:`For optimal mobile SEO, keep your meta title within ${SWe} characters to prevent it from being cut off in search results.`,[oa]:`To ensure your meta description isn’t truncated in mobile search results, aim for ${CWe} characters. This helps improve visibility and click-through rates.`};function VG(e){const{title:t,description:n}=e;return f.jsx(m.Card,{paddingBlock:8,paddingInline:8,variant:"highlighted",children:f.jsxs(m.CardContent,{gap:4,children:[f.jsx(m.Text,{color:"indigo11",variant:"h4",noSelect:!0,children:bi.overflow(t,Ld.max)}),f.jsx(m.Text,{color:"green11",noSelect:!0,children:"https://www.yourdomain.com/"}),f.jsx(m.Text,{variant:"small",color:"grey11",noSelect:!0,children:bi.overflow(n,Bd.max)})]})})}const zG=E.createContext({editedUID:{current:!1},onEditUID:()=>{}});function QG(e){return Object.values(e.json).some(t=>{var n;return((n=t.uid)==null?void 0:n.type)==="UID"})}function xWe(e){const{content:t,customType:n}=e;return QG(n)&&!t.uid}function HG(e){const{documentId:t,documentsWithUid:n,uid:r}=e;return n.filter(i=>t!==i.id&&TWe({document:i,uid:r})&&_We({...e,document:i}))}function _We(e){const{customTypeId:t,languageId:n,document:r}=e,i=t===r.custom_type_id,o=n===r.language.id;return i&&o}function TWe(e){const{document:t,uid:n}=e,r=t.versions.filter(i=>i.uid===n);return r.length===0?!0:r.some(i=>i.status!=="archived")}const Vs=E.createContext(void 0);function IWe(e){const{customTypeFormat:t,children:n}=e,r=E.useMemo(()=>({customTypeFormat:t,isInSlice:!1,isInGroup:!1,isInRepeatable:!1}),[t]);return f.jsx(Vs.Provider,{value:r,children:n})}function EWe(e){const{children:t}=e,n=E.useContext(Vs),r=E.useMemo(()=>n&&{...n,isInSlice:!0},[n]);return f.jsx(Vs.Provider,{value:r,children:t})}function RWe(e){const{children:t}=e,n=E.useContext(Vs),r=E.useMemo(()=>n&&{...n,isInGroup:!0},[n]);return f.jsx(Vs.Provider,{value:r,children:t})}function $We(e){const{children:t}=e,n=E.useContext(Vs),r=E.useMemo(()=>n&&{...n,isInRepeatable:!0},[n]);return f.jsx(Vs.Provider,{value:r,children:t})}function kWe(){return E.useContext(Vs)}function vS(e,t){return`${e}___${t}`}const YG=E.createContext({ids:[],isSelected:()=>!1,update:()=>{}});function yS(){return E.useContext(YG)}function pr(e){var t;return(t=e.config)!=null&&t.label?e.config.label:e.type!=="Boolean"&&e.type!=="Separator"&&e.type!=="Table"&&e.fieldset?e.fieldset:e.type}const QF="...";function OWe(e,t,n=QF){var r,i;return(t?(r=e.config)==null?void 0:r.placeholder_true:(i=e.config)==null?void 0:i.placeholder_false)||n}function Ol(e,t=QF){var n;return((n=e.config)==null?void 0:n.placeholder)||t}function MWe(e){var s;const{content:t,field:n,id:r,readOnly:i,onContentChange:o}=e,a=(t==null?void 0:t.value)??((s=n.config)==null?void 0:s.default_value)??!1;return f.jsxs(m.Field,{children:[f.jsx(m.FieldIcon,{name:"biToggle"}),f.jsx(m.FieldLabel,{htmlFor:r,children:pr(n)}),f.jsxs(m.FieldControl,{children:[f.jsx(m.Box,{padding:4,alignItems:"center",children:f.jsx(m.Text,{children:OWe(n,a)})}),f.jsx(m.Switch,{id:r,sx:{alignSelf:"center",marginLeft:"auto",marginRight:12},checked:a,onCheckedChange:c=>{i||o(FWe(c))}})]})]})}function FWe(e){return{__TYPE__:"BooleanContent",value:e}}function LWe(e){const{id:t,field:n,content:r,onContentChange:i}=e;return f.jsxs(m.Field,{children:[f.jsx(m.FieldIcon,{name:"colorLens"}),f.jsx(m.FieldLabel,{id:t,children:pr(n)}),f.jsx(m.FieldControl,{children:f.jsx(m.Box,{padding:{left:4},alignItems:"center",children:f.jsx(m.ColorInput,{onValueChange:o=>i(BWe(o)),value:r==null?void 0:r.value,"aria-labelledby":t,placeholder:Ol(n)})})})]})}function BWe(e){return e===void 0?void 0:{__TYPE__:"FieldContent",type:"Color",value:e}}function DWe(e){const{id:t,readOnly:n,field:r,content:i,onContentChange:o}=e,a=i!=null&&i.value?O_.dateFromISOString(i.value):void 0;return f.jsxs(m.Field,{children:[f.jsx(m.FieldIcon,{name:"dateRange"}),f.jsx(m.FieldLabel,{id:t,children:pr(r)}),f.jsx(m.FieldControl,{children:f.jsx(m.Box,{padding:{left:4,right:12},width:"100%",flexDirection:"column",justifyContent:"center",children:f.jsx(m.DateInput,{mode:"date","aria-labelledby":t,disabled:n,value:a,onValueChange:s=>o(jWe(s))})})})]})}function jWe(e){if(e)return{__TYPE__:"FieldContent",type:"Date",value:UWe(e)}}function UWe(e){const t=`${e.getFullYear()}`.padStart(4,"0"),n=`${e.getMonth()+1}`.padStart(2,"0"),r=`${e.getDate()}`.padStart(2,"0");return`${t}-${n}-${r}`}const Ic=E.forwardRef(function(t,n){const{padding:r=GG,...i}=t;return f.jsx(m.TextInput,{...i,padding:r,ref:n,sx:{...t.sx,alignSelf:"stretch"}})}),GG={input:{inline:4},adornment:{inline:12}},PWe=({provider:e})=>NWe[e.toLowerCase()]??f.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[f.jsx("g",{clipPath:"url(#clip0_6524_22412)",children:f.jsx("path",{d:"M7.99992 1.33333C4.31992 1.33333 1.33325 4.32 1.33325 8C1.33325 11.68 4.31992 14.6667 7.99992 14.6667C11.6799 14.6667 14.6666 11.68 14.6666 8C14.6666 4.32 11.6799 1.33333 7.99992 1.33333ZM2.66659 8C2.66659 7.59333 2.71992 7.19333 2.80659 6.81333L5.99325 10V10.6667C5.99325 11.4 6.59325 12 7.32658 12V13.2867C4.70658 12.9533 2.66659 10.7133 2.66659 8ZM11.9266 11.6C11.7533 11.06 11.2599 10.6667 10.6599 10.6667H9.99325V8.66667C9.99325 8.3 9.69325 8 9.32658 8H5.32658V6.66667H6.65992C7.02658 6.66667 7.32658 6.36667 7.32658 6V4.66667H8.65992C9.39325 4.66667 9.99325 4.06667 9.99325 3.33333V3.06C11.9466 3.84667 13.3333 5.76667 13.3333 8C13.3333 9.38667 12.7933 10.6533 11.9266 11.6Z",fill:"#6F6E77"})}),f.jsx("defs",{children:f.jsx("clipPath",{id:"clip0_6524_22412",children:f.jsx("rect",{width:"16",height:"16",fill:"white"})})})]}),NWe={codepen:f.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[f.jsx("g",{clipPath:"url(#clip0_6523_22409)",children:f.jsx("path",{d:"M15.9879 5.44292C15.9843 5.42352 15.981 5.40413 15.9759 5.38517C15.9726 5.37375 15.9688 5.36298 15.9651 5.35177C15.9597 5.33497 15.9541 5.31816 15.9474 5.30179C15.9427 5.29037 15.9373 5.27938 15.9321 5.26839C15.9248 5.25288 15.9173 5.23758 15.9086 5.22271C15.9026 5.21172 15.8957 5.20138 15.889 5.19082C15.8798 5.1766 15.8703 5.1626 15.8599 5.14902C15.8524 5.13889 15.8446 5.1292 15.8365 5.1195C15.8257 5.10657 15.8141 5.09429 15.8024 5.08223C15.7934 5.07318 15.7843 5.06413 15.7748 5.05529C15.7623 5.04387 15.7494 5.0331 15.7358 5.02276C15.7255 5.01479 15.7154 5.0066 15.7046 4.99927C15.7007 4.99647 15.6973 4.99324 15.6932 4.99065L8.38116 0.115543C8.15039 -0.0385144 7.84939 -0.0385144 7.61863 0.115543L0.306176 4.99044C0.302082 4.99302 0.29885 4.99626 0.294756 4.99906C0.283983 5.0066 0.273856 5.01457 0.263514 5.02254C0.250155 5.0331 0.237011 5.04387 0.224515 5.05486C0.215034 5.06348 0.205985 5.07253 0.19715 5.0818C0.185084 5.09386 0.17388 5.10614 0.162892 5.11907C0.154704 5.12877 0.146947 5.13846 0.139406 5.14924C0.129064 5.16281 0.119583 5.1766 0.110318 5.19104C0.103639 5.20159 0.0969593 5.21194 0.0907108 5.22293C0.0820922 5.23779 0.0745509 5.25309 0.0674405 5.26817C0.0622694 5.27916 0.0566673 5.29037 0.0521425 5.30157C0.0454631 5.31795 0.0396456 5.33475 0.0342589 5.35156C0.030596 5.36276 0.0267177 5.37375 0.0237011 5.38388C0.0187455 5.40284 0.0150825 5.42201 0.0116351 5.44162C0.00969592 5.45153 0.00732581 5.46123 0.00603302 5.47136C0.00215465 5.50109 0 5.53082 0 5.56121V10.4372C0 10.4673 0.00215465 10.4975 0.00646395 10.527C0.00797221 10.5378 0.0107733 10.5464 0.0129279 10.5568C0.0163753 10.5762 0.0193919 10.5955 0.0258558 10.6149C0.0288723 10.6257 0.0323198 10.6365 0.0366291 10.6483C0.0420157 10.6656 0.0474023 10.6828 0.0538662 10.6985C0.058391 10.7093 0.0646395 10.7201 0.0689488 10.7309C0.0760591 10.7459 0.0840314 10.761 0.09265 10.7768C0.098683 10.7875 0.105578 10.7983 0.112042 10.8082C0.121307 10.8233 0.131434 10.8362 0.142207 10.8491C0.149748 10.8599 0.157289 10.8685 0.165908 10.8789C0.176897 10.8918 0.187455 10.9047 0.200382 10.9162C0.209217 10.9248 0.21762 10.9355 0.228393 10.942C0.24089 10.9528 0.254249 10.9636 0.267177 10.9748C0.277519 10.9834 0.288723 10.9898 0.297342 10.9982C0.301436 11.0004 0.303806 11.0047 0.308115 11.0067L7.61863 15.8841C7.73412 15.9617 7.86641 16.0005 8 15.9998C8.13359 15.9992 8.26588 15.9611 8.38137 15.8841L15.6938 11.0092C15.6979 11.0067 15.7014 11.0036 15.7052 11.0008C15.716 10.9933 15.7261 10.9853 15.7365 10.9773C15.7498 10.9668 15.763 10.9558 15.7755 10.9446C15.785 10.9362 15.794 10.9269 15.8031 10.9179C15.8149 10.9058 15.8263 10.8935 15.8371 10.8806C15.8453 10.8709 15.8531 10.8612 15.8606 10.8509C15.8709 10.8373 15.8804 10.8233 15.8897 10.8091C15.8964 10.7987 15.903 10.7882 15.9093 10.7776C15.9179 10.7625 15.9254 10.7472 15.9328 10.7317C15.9379 10.7207 15.9433 10.7097 15.9481 10.6985C15.9548 10.6819 15.9604 10.6651 15.9657 10.6483C15.9694 10.6371 15.9733 10.6261 15.9765 10.6149C15.9815 10.596 15.9849 10.5766 15.9886 10.5572C15.9903 10.5473 15.9929 10.5376 15.994 10.5275C15.9978 10.4977 16 10.468 16 10.4376V5.5625C16 5.53212 15.9976 5.50238 15.994 5.47265C15.9922 5.46209 15.989 5.45347 15.9869 5.44292H15.9879ZM7.99978 9.62638L5.56826 8.00005L7.99978 6.37351L10.4315 8.00005L7.99978 9.62638ZM7.31245 5.17919L4.33171 7.17288L1.92561 5.56336L7.31245 1.97221V5.17919ZM3.09515 7.99984L1.37531 9.15021V6.84947L3.09515 7.99984ZM4.33171 8.82765L7.31245 10.8211V14.0281L1.92561 10.4365L4.33171 8.82722V8.82765ZM8.68733 10.8207L11.6681 8.82722L14.0744 10.4365L8.68733 14.0277V10.8207ZM12.9046 8.00027L14.6247 6.84969V9.15064L12.9046 7.99984V8.00027ZM11.6681 7.17288L8.68733 5.1794V1.97221L14.0744 5.56336L11.6681 7.17288Z",fill:"black"})}),f.jsx("defs",{children:f.jsx("clipPath",{id:"clip0_6523_22409",children:f.jsx("rect",{width:"16",height:"16",fill:"white"})})})]}),codesandbox:f.jsxs("svg",{width:"14",height:"16",viewBox:"0 0 14 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[f.jsx("g",{clipPath:"url(#clip0_6523_22406)",children:f.jsx("path",{d:"M6.24312 14.1129V8.35021L1.28724 5.49888V8.78388L3.55732 10.0999V12.5702L6.24312 14.1129ZM7.53036 14.1468L10.2658 12.571V10.0422L12.5506 8.71812V5.47426L7.53036 8.3727V14.1468ZM11.8904 4.36906L9.25164 2.83995L6.93472 4.18436L4.60022 2.8386L1.93795 4.38817L6.90626 7.24665L11.8904 4.36906ZM0 12.0115V4.02675L6.91821 0L13.8378 4.00984V11.9988L6.91805 15.985L0 12.0115Z",fill:"black"})}),f.jsx("defs",{children:f.jsx("clipPath",{id:"clip0_6523_22406",children:f.jsx("rect",{width:"13.8378",height:"16",fill:"white"})})})]}),dailymotion:f.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[f.jsxs("g",{clipPath:"url(#clip0_6523_22345)",children:[f.jsx("path",{d:"M16 0H0V16H16V0Z",fill:"white"}),f.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.73038 10.3003C8.40789 10.6268 8.00377 10.7901 7.51804 10.7901C7.04025 10.7901 6.64411 10.6308 6.32956 10.3122C6.01503 9.99367 5.85776 9.58351 5.85776 9.08176C5.85776 8.60389 6.01901 8.20766 6.3415 7.89306C6.66401 7.57847 7.06016 7.42118 7.52998 7.42118C7.84849 7.42118 8.13715 7.49484 8.39594 7.64219C8.65474 7.78953 8.8558 7.99063 8.99913 8.2455C9.14246 8.50034 9.21412 8.77908 9.21412 9.08176C9.21412 9.56757 9.05287 9.97376 8.73038 10.3003ZM9.10662 3.58632V6.35792C8.82791 6.07918 8.53131 5.87808 8.21678 5.75463C7.90223 5.63118 7.54988 5.56946 7.1597 5.56946C6.53062 5.56946 5.96527 5.72476 5.4636 6.03538C4.96193 6.34597 4.57176 6.77007 4.29305 7.30768C4.01435 7.84528 3.875 8.44062 3.875 9.09369C3.875 9.76269 4.01236 10.366 4.28708 10.9036C4.5618 11.4412 4.95197 11.8653 5.45763 12.1759C5.96328 12.4865 6.54258 12.6418 7.19553 12.6418C8.14312 12.6418 8.80403 12.3312 9.17831 11.71H9.20218V12.5595H11.0894V3.15625L9.10662 3.58632Z",fill:"#232323"})]}),f.jsx("defs",{children:f.jsx("clipPath",{id:"clip0_6523_22345",children:f.jsx("rect",{width:"16",height:"16",fill:"white"})})})]}),flickr:f.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[f.jsx("rect",{width:"16",height:"16",fill:"white"}),f.jsxs("g",{clipPath:"url(#clip0_6523_22379)",children:[f.jsx("path",{d:"M8.43286 7.78387C8.43286 9.321 9.67925 10.5674 11.2166 10.5674C12.7538 10.5674 13.9999 9.321 13.9999 7.78387C13.9999 6.24675 12.7538 5.00061 11.2166 5.00061C9.67925 5.00061 8.43286 6.24675 8.43286 7.78387Z",fill:"#FF0084"}),f.jsx("path",{d:"M2 7.78408C2 9.32121 3.24614 10.5676 4.78352 10.5676C6.32089 10.5676 7.56703 9.32121 7.56703 7.78408C7.56703 6.24695 6.32089 5.00081 4.78352 5.00081C3.24614 5.00081 2 6.24695 2 7.78408Z",fill:"#0063DC"})]}),f.jsx("defs",{children:f.jsx("clipPath",{id:"clip0_6523_22379",children:f.jsx("rect",{width:"12",height:"5.568",fill:"white",transform:"translate(2 5)"})})})]}),giphy:f.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[f.jsx("rect",{width:"16",height:"16",fill:"#121212"}),f.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4 3.38889V12.2778H5.11111V3.38889H4Z",fill:"#00FF99"}),f.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.6663 5.61111V12.2778H11.7774V5.61111H10.6663Z",fill:"#9933FF"}),f.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.75 3H4V4.11111H8.83333V3H7.75Z",fill:"#FFF35C"}),f.jsx("path",{d:"M9.00041 4.11111H7.33374H8.83374V3.77778L9.00041 4.11111Z",fill:"#999999"}),f.jsx("path",{d:"M8.83374 4.11111H7.33374L8.44485 3L8.83374 3.77778V4.11111Z",fill:"#999237"}),f.jsx("path",{d:"M10.6663 7.44444V5.77778L11.7774 6.33333L10.6663 7.44444Z",fill:"#5C1F99"}),f.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.6667 11.8889H4V13H11.7778V11.8889H10.6667Z",fill:"#00CCFF"}),f.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.6668 5.22222V4.11111H9.55569V3H8.44458V3.90739V5.0185V6.33333H9.55569H10.6668H11.7779V5.22222H10.6668Z",fill:"#FF6666"})]}),instagram:f.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",children:[f.jsxs("g",{clipPath:"url(#clip0_6523_22356)",children:[f.jsx("mask",{id:"mask0_6523_22356",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"16",height:"16",children:f.jsx("path",{d:"M4.70325 0.0949238C3.85627 0.1349 3.27778 0.270564 2.77227 0.468642C2.24897 0.672648 1.80537 0.946046 1.36408 1.38914C0.922279 1.83249 0.650958 2.27688 0.448504 2.8007C0.252489 3.3075 0.119662 3.88627 0.0822604 4.73377C0.045126 5.58283 0.0366102 5.85363 0.0407495 8.01522C0.0448729 10.1765 0.0544124 10.4479 0.0949012 11.2972C0.135388 12.1439 0.270546 12.7222 0.468623 13.2279C0.672886 13.7512 0.946004 14.1946 1.38935 14.6361C1.83245 15.0777 2.27708 15.3487 2.80115 15.5515C3.30744 15.7472 3.88644 15.8806 4.73369 15.9177C5.58273 15.9551 5.85379 15.9634 8.01483 15.9592C10.1769 15.9551 10.448 15.9456 11.297 15.9053C12.144 15.8648 12.722 15.7292 13.228 15.5316C13.7513 15.3268 14.1949 15.0542 14.6362 14.6109C15.0775 14.1678 15.3488 13.7231 15.5512 13.199C15.7473 12.6927 15.8806 12.1137 15.9175 11.267C15.9546 10.4174 15.9634 10.1461 15.9593 7.98478C15.9551 5.8232 15.9453 5.55239 15.9051 4.7036C15.8649 3.85609 15.7292 3.27811 15.5314 2.77208C15.3269 2.24877 15.054 1.80567 14.6109 1.36387C14.1678 0.922574 13.7232 0.650729 13.1991 0.448785C12.6926 0.252768 12.1138 0.119166 11.2666 0.0825425C10.4175 0.0448876 10.1465 0.0366393 7.98465 0.0407642C5.82336 0.0448892 5.5523 0.0541772 4.70325 0.0949238ZM4.79611 14.485C4.02004 14.4512 3.59863 14.3222 3.31776 14.2142C2.94585 14.0703 2.68046 13.8977 2.40114 13.6205C2.12234 13.3422 1.94928 13.0776 1.80408 12.7064C1.69497 12.4255 1.5637 12.0046 1.52734 11.2286C1.48788 10.3896 1.47886 10.1378 1.47498 8.01237C1.47086 5.88742 1.47859 5.63569 1.51522 4.79593C1.54848 4.02038 1.67822 3.59843 1.78602 3.31782C1.92993 2.94539 2.10196 2.68051 2.37973 2.4012C2.65801 2.12187 2.92263 1.94933 3.29402 1.80412C3.57463 1.69451 3.99555 1.56426 4.77134 1.52738C5.61084 1.48766 5.8623 1.47915 7.98723 1.47502C10.1127 1.47089 10.3644 1.47838 11.2042 1.51526C11.9797 1.54904 12.4016 1.67749 12.682 1.78607C13.0541 1.92998 13.3195 2.1015 13.5986 2.37979C13.8777 2.65808 14.0507 2.92218 14.1959 3.29435C14.3055 3.57418 14.4358 3.99562 14.4724 4.77117C14.5124 5.61068 14.5214 5.8624 14.5253 7.98736C14.5294 10.1128 14.5217 10.3646 14.4848 11.2038C14.451 11.9799 14.3223 12.4016 14.214 12.6827C14.0701 13.0543 13.898 13.3197 13.62 13.5991C13.342 13.8773 13.0774 14.0509 12.7057 14.1961C12.4256 14.3055 12.0042 14.436 11.2289 14.4729C10.3894 14.5123 10.1379 14.5214 8.01225 14.5252C5.88732 14.5294 5.63586 14.5214 4.79611 14.485ZM11.2854 3.74493C11.2864 4.27211 11.7151 4.69896 12.2422 4.69792C12.7697 4.69689 13.1965 4.2685 13.1957 3.74132C13.1947 3.21414 12.7661 2.78704 12.2386 2.78807C11.7112 2.7891 11.2844 3.21775 11.2854 3.74493ZM3.91277 8.00773C3.91714 10.2653 5.75063 12.0913 8.0076 12.0869C10.2648 12.0825 12.0919 10.2495 12.0875 7.99201C12.0831 5.73526 10.2494 3.90819 7.99188 3.91257C5.73489 3.91696 3.90837 5.75073 3.91277 8.00773ZM5.34648 8.0049C5.3439 6.53969 6.52978 5.34942 7.99471 5.34683C9.45991 5.344 10.6504 6.52937 10.6533 7.99484C10.6561 9.46031 9.47022 10.6503 8.00477 10.6532C6.53984 10.656 5.34932 9.47037 5.34648 8.0049Z",fill:"white"})}),f.jsxs("g",{mask:"url(#mask0_6523_22356)",children:[f.jsx("mask",{id:"mask1_6523_22356",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"-1",y:"-1",width:"18",height:"18",children:f.jsx("path",{d:"M16.5905 -0.583628H-0.603516V16.6106H16.5905V-0.583628Z",fill:"white"})}),f.jsxs("g",{mask:"url(#mask1_6523_22356)",children:[f.jsx("mask",{id:"mask2_6523_22356",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"-1",y:"-1",width:"18",height:"18",children:f.jsx("path",{d:"M16.6701 -0.663237H-0.683105V16.6902H16.6701V-0.663237Z",fill:"white"})}),f.jsxs("g",{mask:"url(#mask2_6523_22356)",children:[f.jsx("mask",{id:"mask3_6523_22356",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"-1",y:"-1",width:"18",height:"18",children:f.jsx("path",{d:"M16.6701 -0.663237H-0.683105V16.6902H16.6701V-0.663237Z",fill:"white"})}),f.jsx("g",{mask:"url(#mask3_6523_22356)",children:f.jsx("rect",{x:"-0.688721",y:"-0.665792",width:"17.3622",height:"17.3622",fill:"url(#pattern0)"})})]})]})]})]}),f.jsxs("defs",{children:[f.jsx("pattern",{id:"pattern0",patternContentUnits:"objectBoundingBox",width:"1",height:"1",children:f.jsx("use",{xlinkHref:"#image0_6523_22356",transform:"scale(0.000439947)"})}),f.jsx("clipPath",{id:"clip0_6523_22356",children:f.jsx("rect",{width:"16",height:"16",fill:"white"})}),f.jsx("image",{id:"image0_6523_22356",width:"2273",height:"2275",xlinkHref:"data:image/jpeg;base64,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Hbvsfww7d9j+GHbvsfww7d9j+GHbvsfww7d9j+GHbvsfww7d9j+GHbvsfww7d9j+GHbvsfww7d9j+GHbvsfww7d9j+GHbvsfww7d9j+GHbvsfww7d9j+GHbvsfww7d9j+GHbvsfww7d9j+GHbvsfww7d9j+GHbvsfww7d9j+GHbvsfww7d9j+GHbvsfww7d9j+GHbvsfww7d9j+GHbvsfww7d9j+GHbvsfww7d9j+GHbvsfww7d9j+GHbvsfww7d9j+GHbvsfww7d9j+GHbvsfww7d9j+GHbvsfww7d9j+GHbvsfww7d9j+GHbvsfww7d9j+GHbvsfww7d9j+GHbvsfw5h277H8MO3fY/hh277H8MO3fY/hh277H8MO3fY/hh277H8MO3fY/hh277H8MO3fY/hh277H8MO3fY/hh277H8MO3fY/hh277H8MO3fY/hh277H8MO3fY/hh277H8MO3fY/hh277H8MO3fY/hh277H8MO3fY/hh277H8MO3fY/hh277H8MO3fY/hh277H8MO3fY/hh277H8MO3fY/hh277H8MO3fY/hh277H8MO3fY/hh277H8MO3fY/hh277H8MO3fY/hh277H8MO3fY/hh277H8MO3fY/hh277H8MO3XY/hh26jfww7dRv4Yduo38MO3Ub+GHbqN/DDt1G/hh26jfww7dRv4Yduo38MO3Ub+GHbqN/DDt1G/hh26jfww7dRv4Yduo38MO3Ub+GHbqN/DDt1G/hh26jfww7dRv4Yduo38MO3Ub+GHbqN/DDt1G/hh26jfww7dRv4Yduo38MO3Ub+GHbqN/DDt1G/hh26j+GHbqP4Yduo38MO3Ub+GHbqP4Yduo/hh26j+GHbmP4YduY/hh25j+GHbmP4YduY/hh25j+GHbmP4YduY/hh25j+GHbmP4YduY/hh25j+GHbmP4YduY/hh25j+GHbmP4YduY/hh25j+GHbmNh25jYduY2HbmNh25jYduY2HbmNh24jYduI2HbiNh24jYduI2HbiNh24jYduI2HbiNh24jYduI2HbiNh24jYduI2HbiNh24jYduI2HbiNh24jYduI2HbiNh0+Nh0+Jh0+Jh0+Jh0+Jh0+Jh0+Jh0+Jh0+Jh0+Jh0+Jh0+Jh0+Jh0+Jh0+Jh0+Jh0+Jh0+Jh0+Jh0+Jh06Jh06Jh06Jh06Jh06Jh06Jh06Jh06Jh06Jh06Jh06Jh06Jh06Jh06Jh06Jh06Jh06Jh06Jh06Jh06Jh06Jh06Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jh02Jhz+j7fweHn/AFd+fp9v6v8Ape79DDf1JLc930/LnmGfj9H0+v7/APAf6c32/wAQ/wCR+n/5f9383/iNaca041pxrTjWnGtONaca041pxrTjWnGtONaca041pxrTjWnGtONaca041pxrTjWnGtONaca041pxrTjWnGtONaca041pxrTjWnGtONaca041pxrTjWnGtONaca041pxrTjWnGtONaca0415xrzjXnGvONeca8415xrzjXnGvONeca8415xrzjXnGvONeca8415xrzjXnGvONeYa8w15hrzDXmGvMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMPBMNeYa8w15hrzDXnGvONeca8415xrzjXnGvONeca041pxrTjWnGtONaca041pxrTjWnGtONacas41ZxqzjVnGrONWcas41ZxqzjVnGrONScak41JxqTjUUGooNRQaig1FBqKDTUGmoNNQaag01BpqDTUGmoNNQaag0lBpKDSUGkoNJQaSg0lBpKDSUGioNFQaKg0VBoqDRVGiqNFUaKo0FRoKjQVGgqNBUaCo0FRoKjQVGgqPXqj16o9eqPXqj16o9eqPXqj16o9eqPXqj1yo9cqPXKj1yo9cqPXLD1yw9csPXLD1yw9csPWrD1qw9asPWrD1qw9asPWrD1qw9asPWrD1qw9YsPWLD1iw9YsPWLD1iw9YsPWLD1iw9YsPWLD1iw9YsPWLD1iw9YsPWLD1iw9YsPWLD1iw9YsPWLD1aw9WsPVrD1aw9WsPVrD1aw9WsPVrD1aw9WsPVrB34/8Ay/z/AH/53yHY/wDU/E/0v+P7/wCz/9k="})]})]}),pinterest:f.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[f.jsxs("g",{clipPath:"url(#clip0_6570_25513)",children:[f.jsx("rect",{width:"15.996",height:"16",rx:"2",fill:"#CC2127"}),f.jsx("path",{d:"M7.999 2C4.68555 2 2 4.68555 2 7.999C2 10.5406 3.58174 12.7102 5.81336 13.5861C5.76137 13.1121 5.71338 12.3843 5.83336 11.8644C5.94134 11.3964 6.53724 8.88285 6.53724 8.88285C6.53724 8.88285 6.35727 8.52291 6.35727 7.993C6.35727 7.15914 6.84119 6.53524 7.44309 6.53524C7.95501 6.53524 8.20297 6.91918 8.20297 7.3811C8.20297 7.89502 7.87502 8.66489 7.70705 9.37877C7.56507 9.97667 8.007 10.4626 8.5949 10.4626C9.66072 10.4626 10.4806 9.33878 10.4806 7.71505C10.4806 6.27929 9.44876 5.27345 7.975 5.27345C6.26729 5.27345 5.26546 6.55324 5.26546 7.87702C5.26546 8.39293 5.46342 8.94484 5.71138 9.24679C5.75937 9.30678 5.76737 9.35877 5.75337 9.41876C5.70738 9.60873 5.6074 10.0167 5.5874 10.0987C5.56141 10.2086 5.50142 10.2326 5.38743 10.1786C4.63756 9.83069 4.16964 8.73488 4.16964 7.85502C4.16964 5.96334 5.54541 4.22563 8.13298 4.22563C10.2146 4.22563 11.8304 5.70938 11.8304 7.69105C11.8304 9.75871 10.5266 11.4224 8.71688 11.4224C8.10898 11.4224 7.53708 11.1065 7.34111 10.7345C7.34111 10.7345 7.04116 11.8804 6.96717 12.1603C6.83119 12.6822 6.46526 13.3341 6.2213 13.732C6.7832 13.906 7.3791 14 7.997 14C11.3104 14 13.996 11.3144 13.996 8.001C13.998 4.68555 11.3124 2 7.999 2Z",fill:"white"})]}),f.jsx("defs",{children:f.jsx("clipPath",{id:"clip0_6570_25513",children:f.jsx("rect",{width:"16",height:"16",fill:"white"})})})]}),spotify:f.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[f.jsx("g",{clipPath:"url(#clip0_6523_22402)",children:f.jsx("path",{d:"M12.6609 7.10585C10.121 5.59751 5.93158 5.45882 3.50697 6.1947C3.11759 6.31287 2.70584 6.09298 2.5879 5.70373C2.46988 5.31411 2.68945 4.90265 3.07911 4.78429C5.86241 3.93945 10.4892 4.1026 13.4132 5.83828C13.7634 6.04622 13.8782 6.49851 13.6707 6.84813C13.4629 7.19833 13.0103 7.31376 12.6609 7.10585ZM12.5777 9.33993C12.3995 9.62908 12.0215 9.71979 11.7327 9.54223C9.61522 8.24063 6.38637 7.86357 3.88123 8.624C3.55636 8.72218 3.21323 8.53899 3.11455 8.21475C3.01666 7.88989 3.19992 7.54738 3.5242 7.44859C6.38597 6.58018 9.9436 7.00081 12.3756 8.49536C12.6644 8.67322 12.7553 9.05146 12.5777 9.33993ZM11.6136 11.4855C11.472 11.7177 11.1697 11.7904 10.9383 11.6489C9.08801 10.518 6.75909 10.2627 4.01637 10.8891C3.75207 10.9497 3.48866 10.7841 3.42838 10.5198C3.36785 10.2556 3.53284 9.99217 3.79772 9.93186C6.79916 9.2457 9.37381 9.54101 11.4506 10.8101C11.6822 10.9515 11.7551 11.254 11.6136 11.4855ZM8.00002 0.120623C3.64839 0.120623 0.120605 3.64834 0.120605 7.99989C0.120605 12.352 3.64839 15.8794 8.00002 15.8794C12.3517 15.8794 15.8794 12.352 15.8794 7.99989C15.8794 3.64834 12.3517 0.120623 8.00002 0.120623Z",fill:"#1ED760"})}),f.jsx("defs",{children:f.jsx("clipPath",{id:"clip0_6523_22402",children:f.jsx("rect",{width:"16",height:"16",fill:"white"})})})]}),twitter:f.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:f.jsx("path",{d:"M14.3193 4.31285C14.329 4.45301 14.329 4.59317 14.329 4.73462C14.329 9.04475 11.0516 14.0156 5.05865 14.0156V14.0131C3.28832 14.0156 1.55478 13.508 0.0644531 12.5507C0.321873 12.5817 0.580582 12.5972 0.839937 12.5979C2.30703 12.5992 3.7322 12.1063 4.88639 11.1988C3.4922 11.1724 2.26961 10.2623 1.84252 8.93366C2.3309 9.02796 2.83413 9.00858 3.31349 8.87746C1.79349 8.57001 0.699937 7.23299 0.699937 5.68023C0.699937 5.66602 0.699937 5.65246 0.699937 5.63889C1.15284 5.89144 1.65994 6.0316 2.17865 6.0471C0.747034 5.08923 0.305743 3.18251 1.17026 1.69176C2.82445 3.7296 5.2651 4.96844 7.8851 5.09956C7.62252 3.96664 7.98123 2.77947 8.82768 1.98307C10.1399 0.748096 12.2038 0.811395 13.4374 2.12452C14.167 1.98048 14.8664 1.71243 15.5064 1.33264C15.2632 2.0877 14.7541 2.72909 14.0741 3.13665C14.7199 3.06044 15.3509 2.88734 15.9451 2.62316C15.5077 3.2794 14.9567 3.85103 14.3193 4.31285Z",fill:"#1D9BF0"})}),vimeo:f.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[f.jsxs("g",{clipPath:"url(#clip0_6523_22340)",children:[f.jsx("path",{d:"M16 14.4C16 15.28 15.28 16 14.4 16H1.6C0.72 16 0 15.28 0 14.4V1.6C0 0.72 0.72 0 1.6 0H14.4C15.28 0 16 0.72 16 1.6V14.4Z",fill:"#1AB7EA"}),f.jsx("path",{d:"M13.9945 5.3084C13.9391 6.42815 13.1229 7.97447 11.5458 9.93402C9.91331 11.9736 8.52987 13 7.40928 13C6.70372 13 6.12267 12.3735 5.63846 11.1338C5.32027 9.98735 4.98824 8.85427 4.67005 7.70786C4.31036 6.46814 3.92299 5.84161 3.50796 5.84161C3.42495 5.84161 3.10676 6.02824 2.56721 6.38816L2 5.68165C2.59488 5.1751 3.17593 4.68187 3.75698 4.17532C4.54554 3.52214 5.14042 3.17555 5.54162 3.13556C6.46853 3.05557 7.04958 3.66877 7.27093 4.97514C7.50612 6.40149 7.67213 7.28129 7.75514 7.62788C8.01799 8.80095 8.32235 9.40081 8.64054 9.40081C8.88956 9.40081 9.26309 9.01423 9.77497 8.2544C10.273 7.49457 10.5497 6.90804 10.5774 6.50813C10.6465 5.85494 10.3837 5.52169 9.77497 5.52169C9.48444 5.52169 9.19392 5.58834 8.88956 5.70831C9.48444 3.84206 10.605 2.94893 12.2652 3.00225C13.4826 3.02891 14.0637 3.80207 13.9945 5.3084Z",fill:"white"})]}),f.jsx("defs",{children:f.jsx("clipPath",{id:"clip0_6523_22340",children:f.jsx("rect",{width:"16",height:"16",fill:"white"})})})]}),youtube:f.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[f.jsx("path",{d:"M15.6656 3.75817C15.4816 3.06609 14.9395 2.5211 14.2511 2.33614C13.0034 2 8 2 8 2C8 2 2.99666 2 1.7489 2.33614C1.06051 2.5211 0.518324 3.06609 0.334339 3.75817C0 5.01251 0 7.62963 0 7.62963C0 7.62963 0 10.2467 0.334339 11.5012C0.518324 12.1932 1.06051 12.7381 1.7489 12.9232C2.99666 13.2593 8 13.2593 8 13.2593C8 13.2593 13.0034 13.2593 14.2511 12.9232C14.9395 12.7381 15.4816 12.1932 15.6656 11.5012C16 10.2467 16 7.62963 16 7.62963C16 7.62963 16 5.01251 15.6656 3.75817Z",fill:"#ED1D24"}),f.jsx("path",{d:"M6.36353 10.0058L10.5453 7.62974L6.36353 5.25349V10.0058Z",fill:"white"})]})};function JG(e){const{debouncedUrl:t,content:n,onContentChange:r,selected:i}=e,o=E.useRef(null),[a,s]=E.useState(!1);We.useOnChange(t,()=>{var u;a&&(s(!1),(u=o.current)==null||u.reset())});function c(){s(!0),r(void 0)}return Vr.toURL(t)?t===(n==null?void 0:n.embed_url)?f.jsx($x,{content:n,selected:i}):f.jsx(m.ErrorBoundary,{ref:o,renderError:WWe,onError:c,children:f.jsx(E.Suspense,{fallback:n&&f.jsx($x,{content:n,selected:i}),children:f.jsx(KWe,{url:t,selected:i,onContentChange:r})})}):null}function WWe(){return f.jsxs(m.Box,{backgroundColor:"grey2",borderRadius:6,padding:16,gap:4,children:[f.jsx(m.Icon,{name:"alert",size:"small",color:"grey11"}),f.jsx(m.Text,{variant:"smallBold",color:"grey11",children:"There is no embed data available."})]})}function $x(e){const{content:t,selected:n}=e,{thumbnail:r,provider:i,author:o,url:a,subtitle:s}=QWe(t);return f.jsxs(m.PreviewCard,{selected:n,children:[f.jsx(m.PreviewImage,{src:r.url,aspectRatio:r.aspectRatio}),f.jsxs(m.PreviewContent,{children:[f.jsxs(m.Box,{display:"flex",alignItems:"center",gap:4,children:[f.jsx(PWe,{provider:i}),f.jsx(m.Text,{variant:"smallBold",color:"grey12",noWrap:!0,children:i}),o&&f.jsx(m.Text,{variant:"small",color:"grey11",noWrap:!0,children:o})]}),f.jsx(m.Text,{variant:"smallBold",href:a,children:s})]})]})}function KWe(e){const{url:t,onContentChange:n,selected:r}=e,i=qWe({url:t,onContentChange:n});return f.jsx($x,{content:i,selected:r})}function qWe(e){const{url:t,onContentChange:n}=e,{embedApiEndpoint:r}=ye(),i=Ye.useRequest(VWe,[t,r]),o=We.useStableCallback(n);return E.useEffect(()=>{const a=m.handleEditorFlushSyncError(()=>o(i));return()=>{clearTimeout(a)}},[i,o]),i}function VWe(e,t){const n=new URL(t);return n.searchParams.set("url",e),le.request(n,{okType:zWe(e)})}function zWe(e){return $.object({type:$.string(),version:$.string().or($.number()).nullish(),title:$.string().nullish(),author_name:$.string().nullish(),author_url:$.string().nullish(),provider_name:$.string().nullish(),provider_url:$.string().nullish(),cache_age:$.string().or($.number()).nullish(),thumbnail_url:$.string().nullish(),thumbnail_width:$.number().nullish(),thumbnail_height:$.number().nullish(),html:$.string().nullish()}).passthrough().transform(t=>{const n={embed_url:e};return{...n,__TYPE__:"EmbedContent",type:t.type,version:t.version,title:t.title,author_name:t.author_name,author_url:t.author_url,provider_name:t.provider_name,provider_url:t.provider_url,cache_age:t.cache_age,thumbnail_url:t.thumbnail_url,thumbnail_width:t.thumbnail_width,thumbnail_height:t.thumbnail_height,html:t.html,all:{...n,...t}}})}function QWe(e){let t="";switch(e.type){case"video":t=e.title??"";break;case"photo":t=`View this post${e.provider_name?` on ${e.provider_name}`:""}`;break;default:t=`Open${e.provider_name?` on ${e.provider_name}`:""}`}return{url:e.embed_url,thumbnail:{url:e.thumbnail_url??"",aspectRatio:e.type==="video"?"16:9":"1:1"},provider:e.provider_name??"",author:e.author_name??"",subtitle:t}}function HWe(e){const{id:t,readOnly:n,field:r,content:i,onContentChange:o}=e,a=We.useDebounceState({initialState:(i==null?void 0:i.embed_url)??"",startTransition:E.startTransition});function s(c){a.set(c),Vr.toURL(c)||o(void 0)}return f.jsxs(m.Field,{footer:Vr.toURL(a.value)&&f.jsx(m.FieldFooter,{children:f.jsx(JG,{debouncedUrl:a.debouncedValue,content:i,onContentChange:o})}),children:[f.jsx(m.FieldIcon,{name:"cloud"}),f.jsx(m.FieldLabel,{htmlFor:t,children:pr(r)}),f.jsx(m.FieldControl,{children:f.jsx(Ic,{id:t,readOnly:n,placeholder:Ol(r),value:a.value,onValueChange:s,variant:Vr.toURL(a.value)?"link":"normal",endAdornment:f.jsx(m.Button,{startIcon:"close",color:"grey",size:"small",disabled:!a,onClick:()=>s("")})})})]})}function ZG(e){return!(e.lat>85||e.lat<-85||e.lng>180||e.lng<-180)}function HC(e){const t=/^.*@(-?\d+.\d+),(-?\d+.\d+).*$/,n=e.match(t);if(!n)return;const r=parseFloat(n[1]??""),i=parseFloat(n[2]??"");if(isNaN(r)||isNaN(i))return;const o={lat:r,lng:i};if(ZG(o))return o}function lD(e){return e?`${e.lat}, ${e.lng}`:""}function dD(e){const t=/\(?([\d|.|-]*)[\s+]*,[\s]*([\d|.|-]*)\)?/,n=e.match(t);if(!n)return HC(e);const r=parseFloat(n[1]??""),i=parseFloat(n[2]??"");if(isNaN(r)||isNaN(i))return HC(e);const o={lat:r,lng:i};return ZG(o)?o:HC(e)}function YWe(e){const{field:t,id:n,readOnly:r,...i}=e,{onValueChange:o,displayedValue:a,onBlur:s,clearValue:c,isValidCoordinates:u}=GWe(i);return f.jsxs(m.Field,{children:[f.jsx(m.FieldIcon,{name:"place"}),f.jsx(m.FieldLabel,{htmlFor:n,children:pr(t)}),f.jsx(m.FieldControl,{children:f.jsx(Ic,{id:n,onValueChange:o,placeholder:QF,readOnly:r,value:a,onBlur:s,variant:u?"link":"normal",endAdornment:f.jsx(m.Button,{startIcon:"close",color:"grey",size:"small",disabled:!a,onClick:c})})})]})}function GWe(e){const{content:t,onContentChange:n}=e,r=lD(t==null?void 0:t.position),[i,o]=E.useState(r);function a(){const u=dD(i);if(!u)return o(""),n(void 0);const{lat:l,lng:d}=u;o(lD({lat:l,lng:d})),n({__TYPE__:"GeoPointContent",position:{lat:l,lng:d}})}function s(){o(""),n(void 0)}const c=!!dD(i);return{displayedValue:i,isValidCoordinates:c,onValueChange:o,onBlur:a,clearValue:s}}function XG(e){const{fieldLabel:t,imageLabel:n=[]}=e;return f.jsxs(m.CardHeaderTitle,{children:[f.jsx(m.Text,{variant:"bold",noWrap:!0,children:bi.overflow(t,30)}),n.length!==0&&f.jsx(m.Text,{color:"grey11",noSelect:!0,children:` • ${n.join(" • ")}`})]})}function eJ(e){const{fieldLabel:t,isUpdating:n,readOnly:r,onMediaDialogOpenChange:i}=e;return f.jsxs(f.Fragment,{children:[f.jsx(m.CardHeader,{sx:{flexWrap:"wrap"},children:f.jsx(XG,{fieldLabel:t})}),f.jsx(m.CardContent,{children:f.jsx(m.Card,{color:"grey2",variant:"dashed",paddingBlock:12,radius:4,sx:{width:"100%"},children:f.jsx(m.CardContent,{children:f.jsxs(m.BlankSlate,{variant:"horizontal",children:[f.jsx(m.BlankSlateIcon,{name:"cloudUpload",lineColor:"purple9",backgroundColor:"purple4",size:"small"}),f.jsx(m.BlankSlateTitle,{children:n?"Preparing your image...":"You haven't selected an image"}),!r&&f.jsx(m.BlankSlateActions,{children:f.jsx(m.Button,{disabled:n,onClick:()=>i(!0),size:"medium",children:"Select image"})})]})})})})]})}const JWe=zv({id:Vc(),width:Vv(),height:Vv(),urls:zv({full:Vc(),small:Vc().transform(A6e)}),alt_description:Vc().optional(),description:Vc().nullable()}),ZWe=zv({results:BY(JWe)}).transform(e=>e.results);function tJ(e,t){const n=new URL("search/photos",e);return n.searchParams.set("page","1"),n.searchParams.set("per_page","28"),n.searchParams.set("query",t),le.request(n,{okType:ZWe})}Ye.cache.registerFetcherConfig(tJ,{cacheCapacity:5,revalidationStrategy:{type:"never"}});function XWe(e,t){const n=E.useRef(),r=ye(),i=Ye.useRequest(tJ,[e,t]);return We.useDebounce(t,1e3,()=>{var o;n.current&&t!==n.current&&((o=r.onAnalyticsEvent)==null||o.call(r,"Unsplash Image Searched")),n.current=t}),i}function e5e(e){const{onSelectedChange:t}=e,[n,r]=E.useTransition(),i=We.useDebounceState({initialState:"",ms:300,startTransition:r});return f.jsxs(m.Box,{flexDirection:"column",gap:16,width:"100%",position:"relative",children:[f.jsx(m.FormSearchInput,{value:i.value,placeholder:"Search on Unsplash.com",onValueChange:i.set}),f.jsx(m.ErrorBoundary,{renderError:()=>f.jsx($G,{}),children:f.jsx(E.Suspense,{fallback:f.jsx(n5e,{}),children:f.jsx(t5e,{term:i.debouncedValue,loading:n,onSelectedChange:t})})})]})}function t5e(e){const{term:t,onSelectedChange:n,loading:r}=e,{media:i,toggleSelected:o,selectedImageId:a}=r5e({term:t,onSelectedChange:n});return f.jsxs(f.Fragment,{children:[i.length>0&&f.jsx(nJ,{children:i==null?void 0:i.map(s=>{const u=new URL(s.urls.full).searchParams.get("fm")??"jpg";return f.jsx(m.MediaCard,{url:s.urls.small,filename:s.description??"Unsplash Image",selected:a===s.id,onCardClick:()=>o(s),onCheckedChange:()=>o(s),extension:u,kind:"image",width:s.width,height:s.height,loading:r},s.id)})}),i.length===0&&f.jsx(EG,{})]})}function nJ(e){const{children:t}=e;return f.jsx(m.ScrollArea,{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(min(100%, 250px), 1fr))",gap:16,padding:2,paddingBottom:16,position:"relative",width:"100%"},children:t})}function n5e(){return f.jsx(nJ,{children:yt.range(1,24).map(e=>f.jsx(BG,{},e))})}function r5e(e){var u;const{term:t,onSelectedChange:n}=e,{unsplashApiBaseUrl:r}=ye(),i=XWe(r,t||"citrus fruit"),o=(u=i==null?void 0:i[0])==null?void 0:u.id,[a,s]=E.useState();E.useEffect(()=>{n==null||n([]),s(void 0)},[o,n]);function c(l){if(l.id===a)return s(void 0),n==null?void 0:n([]);s(l.id),n==null||n([{...l,url:l.urls.full,alt:l.alt_description}])}return{media:i,toggleSelected:c,selectedImageId:a}}function HF(e){const{open:t,onOpenChange:n,onMediaSelected:r,assetType:i}=e,o=ye(),a=o.mediaLibrary,[s,c]=E.useState(()=>a?"media":"unsplash"),[u,l]=E.useState(new Set),[d,p]=E.useState([]),h=u.size+d.length,A=Ye.useFetcherData(ji);E.useEffect(()=>{!t||!a||bG({config:o,assetType:i})},[t,o,i,a]);function g(C){if(C!=="media"&&C!=="unsplash")throw new Error(`Invalid option ${C}.`);c(C)}function v(C){C||l(new Set),n(C)}const b=L3e({assetType:i,mediaDialogOpen:t});function w(){var C;switch(s){case"unsplash":{const x=d[0];if(!x)return;r(x),(C=o.onAnalyticsEvent)==null||C.call(o,"Unsplash Image Added");break}case"media":{const I=A.flatMap(R=>R.items).filter(R=>u.has(R.id))[0];if(!I)return;r(I),b(I.id);break}}}function S(){if(h===0)return"Select a media item to add to the page";if(h>1)return"Only one media item can be added to the page"}const{containerRef:y}=m.useAlert();return f.jsxs(m.Dialog,{open:t,onOpenChange:v,size:{width:"min(calc(100% - 48px), 2000px)",height:"calc(100% - 30px)"},position:"center",onPointerDownOutside:C=>{y&&We.refContainsTarget(y,C.target)&&C.preventDefault()},children:[f.jsx(m.DialogHeader,{icon:"image",title:"Media library"}),f.jsx(m.DialogDescription,{hidden:!0,children:"Select a media item to add to the page"}),f.jsxs(m.DialogOptions,{value:s,onValueChange:g,padding:"small",width:"auto",children:[a&&f.jsx(m.DialogOptionsItem,{value:"media",icon:"photo"}),f.jsx(m.DialogOptionsItem,{value:"unsplash",icon:"unsplash"})]}),f.jsx(m.DialogContent,{children:f.jsx(m.Box,{flexDirection:"column",flexGrow:1,overflow:"hidden",children:f.jsxs(m.Box,{overflow:"hidden",backgroundColor:"grey2",padding:{top:16,inline:16},flexGrow:1,children:[s==="media"&&f.jsx(KG,{assetType:i,onSelectedChange:l}),s==="unsplash"&&f.jsx(e5e,{onSelectedChange:p})]})})}),f.jsxs(m.DialogActions,{children:[f.jsx(m.DialogCancelButton,{}),f.jsx(m.DialogActionButton,{onClick:w,disabled:h!==1,tooltipLabel:S(),children:"Add to page"})]})]})}const rJ=E.forwardRef(function(t,n){const{isMediaDialogOpen:r,selected:i,children:o,onMediaSelected:a,onMediaDialogOpenChange:s}=t;function c(u){a(u),s(!1)}return f.jsxs(m.Card,{ref:n,color:i?"indigo2":"grey2",variant:i?"selected":"dashed",paddingBlock:12,radius:4,children:[o,f.jsx(HF,{open:r,onOpenChange:s,onMediaSelected:c,assetType:"image"})]})});function iJ(e){const{uploadImage:t,children:n,isUploading:r,disabled:i}=e;if(i)return f.jsx(f.Fragment,{children:n});function o(a){if(r)return;const s=a[0];s&&t(s)}return f.jsx(m.FileDropZone,{assetType:"image",maxFiles:1,onFilesSelected:o,overlay:f.jsx(i5e,{isUploading:r}),children:n})}function i5e(e){const{isUploading:t}=e,n=t?"You can't upload while the upload is ongoing":"Drop image to instantly upload";return f.jsx(m.Box,{justifyContent:"center",flexDirection:"column",height:"100%",padding:8,children:f.jsxs(m.BlankSlate,{children:[f.jsx(m.BlankSlateIcon,{name:t?"block":"cloudUpload",lineColor:t?"tomato11":"purple10",backgroundColor:t?"tomato2":"purple3",borderColor:t?"tomato6":"purple6",borderStyle:"dashed",size:"small"}),f.jsx(m.BlankSlateTitle,{size:"regular",children:n})]})})}function oJ(e){const{contentView:t,croppedImage:n}=e,{width:r,height:i,x:o,y:a,zoom:s}=n,c=a5e({origin:t.origin,croppedImage:n});return{...t,width:r,height:i,url:c,edit:{...t.edit,zoom:s,crop:{x:o,y:a}}}}function o5e(e){var u,l,d;const{field:t,content:n,thumbnail:r,croppedImage:i}=e;if(r===Cp)return aJ({content:n,croppedImage:i});const o=ue.isImageContent(n),a=(l=(u=t==null?void 0:t.config)==null?void 0:u.thumbnails)==null?void 0:l.find(p=>p.name===r),s=o?(d=n.thumbnails)==null?void 0:d[r]:void 0;if(!a||!s)return n;const c=oJ({contentView:s,croppedImage:i});return c.url===s.url?n:{...n,thumbnails:o?{...n.thumbnails,[r]:c}:void 0}}function aJ(e){const{content:t,croppedImage:n}=e,r=oJ({contentView:t,croppedImage:n});return r.url===t.url?t:{...t,...r}}function a5e(e){const{origin:t,croppedImage:n}=e,{x:r,y:i,width:o,height:a,cropHeight:s,cropWidth:c}=n,u=new URL(t.url),l=t.height!==a||t.width!==o;if(r!==0||i!==0||s!==t.height||c!==t.width){const p=[r,i,c,s].map(Math.round).join(",");u.searchParams.set("rect",p),u.searchParams.set("w",o.toString()),u.searchParams.set("h",a.toString())}return l&&(u.searchParams.set("w",o.toString()),u.searchParams.set("h",a.toString())),u.toString()}function s5e(e){const{edit:{crop:{x:t,y:n},zoom:r},width:i,height:o,origin:{width:a,height:s}}=e;let c,u;const l=a/s,d=i/o;return d>=l?(c=a/r,u=c/d):(u=s/r,c=u*d),{x:t,y:n,width:i,height:o,zoom:r,cropWidth:c,cropHeight:u}}function c5e(e){const{selectedImage:t,imageCrop:n,setImageCrop:r}=e,{width:i,height:o,zoom:a,cropHeight:s,cropWidth:c}=n,u=t.contentView,l={x:n.x,y:n.y,width:c,height:s},[d,p]=E.useState(),h=(u==null?void 0:u.origin.url)??"",A=!(t!=null&&t.thumbnail.height&&(t!=null&&t.thumbnail.width));function g(y,C){const x=parseInt(C);isNaN(x)||x<=0||!A||r({...n,[y]:x})}function v(y){r({...n,cropWidth:y.width,cropHeight:y.height,x:y.x,y:y.y})}function b(y){r({...n,zoom:y})}function w(){p(Rg),r({...n,...Rg})}function S(){u&&(p(Rg),r({...n,...Rg,zoom:1,cropWidth:u.width,cropHeight:u.height}))}return f.jsxs(m.Box,{padding:{inline:24,block:16},flexDirection:"column",gap:16,height:"100%",overflowY:"auto",alignItems:"center",children:[f.jsxs(m.Box,{gap:8,height:32,alignItems:"flex-start",width:"100%",children:[f.jsx(m.Tooltip,{content:"Center",children:f.jsx(m.Button,{color:"grey",size:"medium",startIcon:"centerFocusWeak",onClick:w})}),f.jsx(m.Tooltip,{content:"Cover",children:f.jsx(m.Button,{color:"grey",size:"medium",startIcon:"zoomOutMap",onClick:S})}),f.jsx(m.Separator,{orientation:"vertical"}),f.jsx(m.FormInput,{prefix:"W",prefixTooltip:"Width",placeholder:"width",type:"number",size:"medium",value:String(i),onValueChange:y=>g("width",y),sx:{width:100},disabled:!A}),f.jsx(m.FormInput,{prefix:"H",prefixTooltip:"Height",placeholder:"height",type:"number",size:"medium",value:String(o),onValueChange:y=>g("height",y),sx:{width:100},disabled:!A})]}),f.jsx(m.Cropper,{image:h,aspect:i/o,crop:d??{x:0,y:0},onCropChange:p,zoom:a,onZoomChange:b,onCropAreaChange:(y,C)=>v(C),initialCroppedAreaPixels:l}),f.jsx(m.Box,{width:"100%",maxWidth:320,children:f.jsx(m.Slider,{min:1,max:3,step:.01,value:[a],onValueChange:([y])=>b(y??1)})})]})}const Rg={x:0,y:0};function u5e(e){const{trigger:t,initialImages:n,renderTooltip:r}=e,{open:i,onOpenChange:o,ready:a,option:s,selectedImage:c,croppedImage:u,setCroppedImage:l,setReady:d,setOption:p}=l5e(e);return f.jsxs(m.Dialog,{trigger:t,onAnimationEnd:()=>d(!0),open:i,onOpenChange:o,renderTooltip:r,children:[f.jsx(m.DialogHeader,{icon:"photo",title:"Image editor"}),f.jsx(m.DialogDescription,{hidden:!0,children:"Crop your image to the desired size."}),f.jsx(m.DialogOptions,{value:String(s),onValueChange:h=>p(Number(h)),children:n.map((h,A)=>f.jsx(m.DialogOptionsItem,{value:String(A),icon:"photo",title:h.labels[0]??"Main",subtitle:h.labels[1]??""},h.thumbnail.name))}),c&&f.jsx(m.DialogContent,{children:a&&u&&f.jsx(c5e,{selectedImage:c,imageCrop:u,setImageCrop:l},c.thumbnail.name)})]})}function l5e(e){const{initialImages:t,initialOption:n,onClose:r}=e,[i,o]=E.useState(v),[a,s]=E.useState(!1),[c,u]=E.useState(!1),[l,d]=E.useState(n);function p(b){b?(d(n),o(v())):(u(!1),r({option:l,croppedImages:i})),s(b)}const h=t[l],A=i[(h==null?void 0:h.thumbnail.name)??""];function g(b){if(!h)return;const w=h.thumbnail.name;o({...i,[w]:b})}function v(){return t.reduce((b,w)=>(w.contentView&&(b[w.thumbnail.name]=s5e(w.contentView)),b),{})}return{open:a,ready:c,option:l,selectedImage:h,croppedImage:A,setCroppedImage:g,setReady:u,setOption:d,onClose:r,onOpenChange:p}}function d5e(e){const{readOnly:t,altText:n,selected:r,onValueChange:i}=e,o=E.useId();return f.jsxs(m.Field,{selected:r,children:[f.jsx(m.FieldLabel,{htmlFor:o,children:"Alt text"}),f.jsx(m.FieldControl,{children:f.jsx(m.Box,{flexGrow:1,height:40,children:f.jsx(Ic,{id:o,placeholder:"Short description for the visually impaired",readOnly:t,value:n,padding:{input:{inline:12}},onValueChange:i})})})]})}function f5e(e){const{fieldLabel:t,imageLabel:n,initialImages:r,page:i,displaySeparator:o=!0,isSVGContentView:a,visibility:s,onClear:c,onCropperDialogClose:u,onMediaDialogOpenChange:l}=e;return f.jsxs(m.Box,{display:"flex",flexDirection:"column",gap:12,children:[f.jsxs(m.Box,{display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:4,children:[f.jsx(XG,{fieldLabel:t,imageLabel:n}),f.jsxs(m.CardHeaderActions,{sx:{visibility:s},children:[f.jsx(u5e,{trigger:f.jsx(m.Button,{startIcon:"crop",disabled:a,hiddenLabel:"Crop & Resize"}),renderTooltip:d=>f.jsx(m.Tooltip,{content:"Crop & Resize",children:d}),initialImages:r,initialOption:i,onClose:u}),f.jsx(m.Tooltip,{content:"Replace",children:f.jsx(m.Button,{startIcon:"imageSearch",hiddenLabel:"Replace",onClick:()=>l(!0)})}),f.jsx(m.Tooltip,{content:"Clear",children:f.jsx(m.Button,{onClick:c,startIcon:"delete",hiddenLabel:"Clear"})})]})]}),o&&f.jsx(m.Separator,{style:"dashed",decorative:!0})]})}function xu(e){const{description:t,largeIconName:n="public",loading:r,error:i,onEdit:o,onUnlink:a}=e,s=i?f.jsx(g5e,{}):f.jsx(m5e,{...e,largeIconName:n,loading:r});return f.jsx(m.Card,{sx:{width:420},children:f.jsxs(m.CardContent,{gap:12,children:[f.jsxs(m.Box,{display:"grid",gridTemplateColumns:"max-content 1fr min-content",gridTemplateRows:"1fr",gap:8,children:[s,f.jsxs(m.ButtonGroup,{size:"medium",color:"grey",sx:{justifySelf:"end"},children:[o&&f.jsx(m.Button,{startIcon:"edit",onClick:o}),a&&f.jsx(m.Button,{startIcon:"linkOff",onClick:a})]})]}),!i&&f.jsx(A5e,{description:t,loading:r})]})})}function p5e(e){const{url:t,title:n,loading:r}=e;return r?f.jsx(sJ,{height:16,width:80}):n?f.jsx(m.Text,{variant:"smallBold",href:t==null?void 0:t.toString(),children:n}):null}function h5e(e){const{subTitle:t,loading:n}=e;return n?f.jsx(m.Box,{padding:{block:2},children:f.jsx(sJ,{height:12,width:60})}):t?f.jsx(m.Text,{variant:"small",color:"grey11",noWrap:!0,children:t}):null}function A5e(e){const{description:t,loading:n}=e;return!t||n?null:f.jsx(m.Text,{variant:"small",color:"grey11",children:t})}function m5e(e){const{largeIconName:t,title:n,url:r,loading:i,subTitle:o}=e;return f.jsxs(f.Fragment,{children:[f.jsx(m.ConjoinedIcons,{largeIconName:t,smallIconName:"link"}),f.jsxs(m.Box,{flexDirection:"column",minWidth:0,children:[f.jsx(p5e,{title:n,url:r,loading:i}),f.jsx(h5e,{subTitle:o,loading:i})]})]})}function g5e(){return f.jsxs(m.Box,{alignItems:"center",gap:8,children:[f.jsx(m.BackgroundIcon,{name:"alert",color:"tomato",size:"small"}),f.jsx(m.Text,{color:"tomato11",children:"Failed to load linked document data"})]})}function sJ(e){const{width:t,height:n}=e;return f.jsx(m.Skeleton,{color:"grey5",borderRadius:6,width:t,height:n})}function fD(){const e=ye();e.searchDocuments||bt("searchDocuments");const{coreApiBaseUrl:t,authStrategy:n}=e,r=Ye.useRequest(hS,[t,n]);return new Set(r.languages.map(i=>({id:i.id,label:i.label})))}function v5e(){const e=ye();e.searchDocuments||bt("searchDocuments");const{coreApiBaseUrl:t,authStrategy:n}=e,r=Ye.useRequest(nG,[t,n]);return new Set(r.results.map(i=>({id:i,label:i})))}function cJ(){const e=ye();e.searchDocuments||bt("searchDocuments");const{customTypesApiBaseUrl:t,repository:n,authStrategy:r}=e,i=DF({baseUrl:t,repository:n,authStrategy:r});return new Set(i.data)}function y5e(e){const{documentTypeId:t,documentUrl:n,title:r,statusColor:i,description:o,tags:a,tagsFilter:s,previewImageUrl:c,highlighted:u,highlightedUID:l,searchTerm:d,onSelect:p}=e;function h(A){return A.nativeEvent instanceof MouseEvent&&(A.metaKey||A.ctrlKey)?window.open(n,"_blank"):p()}return f.jsxs(m.Card,{paddingBlock:16,onSelect:h,variant:u?"highlighted":void 0,color:u?"purple2":void 0,sx:{marginBlock:u?4:0,marginInline:4,flexShrink:0},children:[f.jsx(m.CardContent,{children:f.jsxs(m.Box,{justifyContent:"space-between",gap:6,children:[f.jsxs(m.Box,{flexDirection:"column",gap:4,alignItems:"flex-start",flexGrow:1,children:[f.jsx(b5e,{documentTypeId:t}),f.jsx(C5e,{title:r,statusColor:i,searchTerm:d}),l&&d&&f.jsx(T5e,{uid:l,searchTerm:d}),f.jsx(w5e,{description:o})]}),f.jsx(x5e,{previewImageUrl:c})]})}),a.length>0&&f.jsx(_5e,{tags:a,tagsFilter:s})]})}function b5e(e){const{documentTypeId:t}=e;return f.jsx(m.ErrorBoundary,{renderError:()=>f.jsx(m.Badge,{maxWidth:150,size:"medium",title:"Type: error",icon:"description"}),children:f.jsx(E.Suspense,{fallback:f.jsx(m.Skeleton,{width:150,height:24}),children:f.jsx(S5e,{documentTypeId:t})})})}function S5e(e){const{documentTypeId:t}=e,r=[...cJ()].find(i=>i.id===t);return f.jsx(m.Badge,{size:"medium",title:`Type: ${(r==null?void 0:r.label)??"Unknown"}`,icon:"description"})}function C5e(e){const{title:t,statusColor:n,searchTerm:r}=e;return f.jsxs(m.Box,{gap:8,alignItems:"center",children:[f.jsx(m.Dot,{color:n}),f.jsx(uJ,{text:t,highlight:r})]})}function w5e(e){const{description:t}=e,n=t==null?void 0:t.substring(0,150);return n?f.jsx(m.Text,{variant:"small",color:"grey11",children:`${n}${n!==t?"...":""}`}):f.jsx(m.Text,{variant:"smallItalic",color:"grey11",children:"No description available"})}function x5e(e){const{previewImageUrl:t}=e;return f.jsx(m.Box,{width:142,height:90,backgroundColor:"grey2",border:!0,borderRadius:6,flexDirection:"column",alignItems:"center",justifyContent:"center",gap:4,flexShrink:0,padding:8,children:t?f.jsx(m.Image,{src:t,sizing:"cover"}):f.jsxs(f.Fragment,{children:[f.jsx(m.Icon,{name:"hideImage",size:"large",color:"grey11"}),f.jsx(m.Text,{color:"grey11",variant:"small",children:"No preview available"})]})})}function _5e(e){const{tags:t}=e;return f.jsxs(m.CardFooter,{children:[f.jsxs(m.Box,{gap:4,alignItems:"center",children:[f.jsx(m.Icon,{name:"label",size:"small",color:"grey11"}),f.jsx(m.Text,{variant:"small",color:"grey11",children:"Tags:"})]}),f.jsx(m.TextOverflow,{children:t.map(n=>f.jsx(m.Badge,{size:"medium",title:n,sx:{marginRight:8}},n))})]})}function T5e(e){const{uid:t,searchTerm:n}=e;return f.jsxs(m.Box,{alignItems:"flex-start",children:[f.jsx(m.Icon,{name:"tag",color:"green11",sx:{width:12,height:12}}),f.jsx(uJ,{variant:"uid",highlight:n,text:t})]})}function uJ(e){const{text:t,highlight:n,variant:r="title"}=e,i=I5e[r],o=n?t.split(new RegExp(`(${bi.escapeStringRegexp(n)})`,"gi")):[t];return f.jsx(m.Text,{variant:i.textVariants.text,color:i.colors.text,hyphens:!0,overflowWrap:"anywhere",children:o.map((a,s)=>a.toLowerCase()===(n==null?void 0:n.toLowerCase())?f.jsx(m.Text,{variant:i.textVariants.highlight,hyphens:!0,overflowWrap:"anywhere",highlight:!0,highlightColor:i.colors.highlight,highlightBorderRadius:2,color:i.colors.highlightText,children:a},s):a)})}const I5e={title:{colors:{text:void 0,highlight:void 0,highlightText:"purple11"},textVariants:{text:"bold",highlight:"bold"}},uid:{colors:{text:"green11",highlight:"green3",highlightText:"green11"},textVariants:{text:"extraSmall",highlight:"extraSmall"}}};function E5e(e){const{searchTerm:t,tagsFilter:n,typesFilter:r,localesFilter:i}=e,o=ye();o.searchDocuments||bt("searchDocuments");const{storageVersion:a}=Ye.useRequest(hS,[o.coreApiBaseUrl,o.authStrategy]);o.searchDocuments||bt("searchDocuments");const{status:s}=o,{data:c}=Ti.useSuspenseQuery({...ZY({searchTerm:t,tags:[...Kr.map(n,u=>u.id)],customTypes:[...Kr.map(r,u=>u.id)],locale:[...Kr.map(i,u=>u.id)][0]??"",status:ox[s],storageVersion:a,config:o}),select:u=>R5e(u.results,ox[s]),staleTime:300});return{documents:c.results}}function R5e(e,t){return{results:e.flatMap(r=>{const o=r.versions.filter(a=>t.includes(a.status));return o.length===0?[]:{...r,versions:o}})}}function $5e(e,t){const n=ye(),r=We.useDebounceState({initialState:""}),[i,o]=E.useState(new Set),[a,s]=E.useState(new Set);function c(){return!n.searchDocuments||!n.localeId?new Set:new Set([{id:n.localeId,label:n.localeId}])}const[u,l]=E.useState(c),d=Kr.union(a,Hv(e)),p=Kr.union(i,Hv(t));return{searchTerm:r,filteredTags:i,setFilteredTags:o,filteredCustomTypes:a,setFilteredCustomTypes:s,filteredLocales:u,setFilteredLocales:l,typesFilter:d,tagsFilter:p}}function Hv(e){return e?Kr.map(e,t=>({id:t,label:t})):new Set}function k5e(e){const{filteredLocales:t,setFilteredLocales:n,filteredTags:r,setFilteredTags:i,filteredCustomTypes:o,setFilteredCustomTypes:a,fixedTags:s,fixedCustomTypes:c}=e;return f.jsxs(f.Fragment,{children:[f.jsx(M5e,{selectedValues:t,onSelectedValuesChange:n}),f.jsx(kx,{selectedValues:r,fixedSelectedValues:Hv(s),onSelectedValuesChange:i,label:"Tags",icon:"label",fetchFilters:v5e}),f.jsx(kx,{selectedValues:o,fixedSelectedValues:Hv(c),onSelectedValuesChange:a,label:"Type",icon:"description",fetchFilters:cJ})]})}function kx(e){const[t,n]=E.useState(!1),r=E.useRef(null);return f.jsx(m.ErrorBoundary,{ref:r,renderError:()=>{var i;return f.jsx(m.FilterField,{mode:"error",onErrorRetry:(i=r.current)==null?void 0:i.reset,open:t,setOpen:n,values:new Set,...e})},children:f.jsx(E.Suspense,{fallback:f.jsx(m.FilterField,{mode:"loading",open:t,setOpen:n,values:new Set,...e}),children:f.jsx(O5e,{open:t,setOpen:n,...e})})})}function O5e(e){const{open:t,setOpen:n,onSelectedValuesChange:r,fixedSelectedValues:i,selectedValues:o,label:a,icon:s,fetchFilters:c,multiple:u}=e,l=c();return f.jsx(m.FilterField,{open:t,setOpen:n,label:a,icon:s,selectedValues:o,values:new Set(l),fixedSelectedValues:i,onSelectedValuesChange:r,multiple:u})}function M5e(e){const{selectedValues:t,onSelectedValuesChange:n}=e,[r,i]=E.useState(Kr.first(t));function o(s){n(s),i(Kr.first(s))}const a=Kr.find(fD(),s=>{var c;return s.id===((c=Kr.first(t))==null?void 0:c.id)});return(a==null?void 0:a.label)!==(r==null?void 0:r.label)&&i(a),f.jsx(kx,{selectedValues:new Set(r?[r]:[]),onSelectedValuesChange:o,label:"Locale",icon:"public",fetchFilters:fD,multiple:!1})}function lJ(e){const{onSelectDocument:t,fixedCustomTypes:n,fixedTags:r,linkedDocumentId:i,...o}=e,a=ye(),{searchTerm:s,filteredTags:c,setFilteredTags:u,filteredCustomTypes:l,setFilteredCustomTypes:d,filteredLocales:p,setFilteredLocales:h,typesFilter:A,tagsFilter:g}=$5e(n,r);return f.jsxs(m.Dialog,{size:{height:727,width:656},hasClose:!1,...o,children:[f.jsx(m.DialogTitle,{hidden:!0,children:"Link to a page"}),f.jsx(m.DialogDescription,{hidden:!0,children:"Search and select a page to link to"}),f.jsx(m.DialogContent,{children:f.jsxs(m.Box,{flexDirection:"column",height:"100%",children:[f.jsxs(m.Box,{padding:{top:16,inline:16,bottom:8},flexDirection:"column",gap:12,children:[f.jsx(m.FormInput,{value:s.value,onValueChange:s.set,placeholder:"Search a page",icon:"search"}),a.searchDocuments&&f.jsx(k5e,{filteredTags:c,setFilteredTags:u,filteredCustomTypes:l,setFilteredCustomTypes:d,filteredLocales:p,setFilteredLocales:h,fixedTags:r,fixedCustomTypes:n})]}),a.searchDocuments?f.jsx(F5e,{searchTerm:s.debouncedValue,tagsFilter:g,typesFilter:A,localesFilter:p,onSelectDocument:t,linkedDocumentId:i}):f.jsx(fJ,{title:"Oops!",message:"Slice Machine does not yet support mock data for linked documents in the simulator."})]})})]})}function F5e(e){const{searchTerm:t,tagsFilter:n,typesFilter:r,localesFilter:i,linkedDocumentId:o,onSelectDocument:a}=e;return f.jsxs(m.ScrollArea,{style:{flexGrow:1,paddingBottom:m.theme.space[16],paddingInline:m.theme.space[12],display:"flex",flexDirection:"column"},children:[o&&f.jsxs(f.Fragment,{children:[f.jsx(hD,{children:"Linked page"}),f.jsx(m.ErrorBoundary,{renderError:()=>f.jsx(pD,{description:"An error occurred while fetching the linked page."}),children:f.jsx(E.Suspense,{fallback:P5e,children:f.jsx(D5e,{linkedDocumentId:o,tagsFilter:n,onSelectDocument:a})})})]}),f.jsx(hD,{children:"Link to a page"}),f.jsx(m.ErrorBoundary,{renderError:()=>f.jsx(pD,{description:"An error occurred while fetching pages."}),children:f.jsx(E.Suspense,{fallback:B5e,children:f.jsx(L5e,{searchTerm:t,tagsFilter:n,localesFilter:i,typesFilter:r,linkedDocumentId:o,onSelectDocument:a})})})]})}function L5e(e){const{searchTerm:t,tagsFilter:n,localesFilter:r,typesFilter:i,linkedDocumentId:o,onSelectDocument:a}=e,{documents:s}=E5e({searchTerm:t,tagsFilter:n,localesFilter:r,typesFilter:i}),c=s.filter(u=>u.id!==o);return c.length===0?f.jsx(fJ,{title:s.length===1?"No other pages found!":void 0}):f.jsx(m.Box,{flexDirection:"column",gap:12,children:c.map(u=>{const l=u==null?void 0:u.versions[0];return l?f.jsx(dJ,{document:u,version:l,tagsFilter:n,searchTerm:t,onSelectDocument:a},`${u.id}-${l.status}`):null})})}const B5e=f.jsx(m.Box,{flexDirection:"column",gap:12,children:yt.range(1,3).map(e=>f.jsx(m.Skeleton,{height:124,sx:{marginInline:4},zIndex:-1},e))});function pD(e){const{description:t}=e;return f.jsx(m.Box,{flexDirection:"column",alignItems:"center",justifyContent:"center",children:f.jsx(m.DefaultErrorMessage,{title:"Request failed",description:t,errorImageSrc:m.dialogErrorImage})})}function D5e(e){const{linkedDocumentId:t,tagsFilter:n,onSelectDocument:r}=e,i=N5e(t),o=j5e(i);return f.jsx(dJ,{document:i,version:o,tagsFilter:n,onSelectDocument:r,highlighted:!0})}function j5e(e){return E.useMemo(()=>U5e(e),[e])}function U5e(e){return yt.sort(e.versions,t=>t.status==="unclassified"||t.status==="published"?-1:0,t=>t.status==="release"?-1:0,t=>-t.last_modified_date.getTime())[0]}const P5e=f.jsx(m.Skeleton,{height:124,sx:{marginBlock:4,marginInline:4},zIndex:-1});function N5e(e){const t=ye();t.searchDocuments||bt("searchDocuments");const{coreApiBaseUrl:n,authStrategy:r}=t;return Ye.useRequest(tg,[n,r,e])}function dJ(e){var p;const{document:t,version:n,tagsFilter:r,highlighted:i,onSelectDocument:o,searchTerm:a}=e,s=ye();if(!t||!n)return null;const c=AF({documentId:t.id,versionId:n.status==="archived"?n.version_id:void 0,releaseId:n.status==="release"?n.release_id:void 0,status:n.status,baseUrl:s.baseUrl}),u=W5e({tags:n.tags,tagsFilter:r}),l=Ix(n)&&n.summary||VY(n)&&n.preview_summary||"",d=Ix(n)?(p=n.highlights)==null?void 0:p.uid:void 0;return f.jsx(y5e,{documentTypeId:t.custom_type_id,documentUrl:c,description:l,tags:u,title:t.title,previewImageUrl:n.preview_image,onSelect:()=>o(t.id),statusColor:xH[n.status].color,highlighted:i,highlightedUID:d,searchTerm:a})}function hD(e){const{children:t}=e;return f.jsx(m.Box,{position:"sticky",top:0,backgroundColor:"white",padding:{block:6,inline:4},children:f.jsx(m.Text,{variant:"smallBold",color:"grey11",children:t})})}function fJ(e){const{title:t="No pages found!",message:n="Consider using different keywords or tweaking your filters to find what you need."}=e;return f.jsx(m.Box,{justifyContent:"center",flexDirection:"column",height:"100%",children:f.jsxs(m.BlankSlate,{children:[f.jsx(m.BlankSlateIcon,{name:"close",lineColor:"tomato11",backgroundColor:"tomato4",size:48}),f.jsx(m.BlankSlateTitle,{size:"big",children:t}),f.jsx(m.BlankSlateDescription,{width:360,children:n})]})})}function W5e(e){const{tags:t,tagsFilter:n}=e,r=[...n].map(o=>o.label).reverse();return yt.sort(t,o=>-r.indexOf(o))}function pJ(e){const{hasLink:t,onUnlink:n,selectEnabled:r,selectedType:i,value:o,onOpenLinkModal:a,onValueChange:s,openInNewTab:c=!0,condensedButtons:u=!1,showNewTabButton:l=!1,displayTextEnabled:d,variants:p,variant:h,onVariantChange:A}=e;return f.jsxs(f.Fragment,{children:[!d&&l&&c&&f.jsx(m.Badge,{title:"Open in a new tab",color:"indigo",size:"small",icon:"openInNew",onClick:a}),!t&&r&&f.jsxs(m.Select,{value:i==="any"?void 0:i,color:"grey",size:"small",boldTriggerText:!0,position:"popper",sideOffset:4,startIcon:fd({selectType:i}),disabled:!r,onValueChange:s,placeholder:u?"":Vl("any"),onlyStartIcon:u&&i!==void 0,renderTrigger:({button:g})=>f.jsx(m.Tooltip,{content:Vl(i),visible:u,children:g}),children:[f.jsx(m.SelectItem,{value:"web",icon:"public",children:Vl("web")}),f.jsx(m.SelectItem,{value:"document",icon:"description",children:Vl("document")}),f.jsx(m.SelectItem,{value:"media",icon:"image",children:Vl("media")})]},i===void 0?"unlinked":"linked"),!t&&!r&&f.jsx(m.Button,{startIcon:fd({selectType:i}),color:"grey",textColor:"link",textWeight:"normal",size:"small",onClick:a,children:Vl(i)}),t&&!d&&f.jsx(m.Button,{startIcon:"close",color:"grey",size:"small",onClick:n,"aria-label":"Close"}),t&&d&&f.jsxs(m.ButtonGroup,{density:"compact",children:[f.jsx(m.Button,{startIcon:fd({selectType:i}),renderEndIcon:()=>c&&i==="web"?f.jsx(m.Icon,{name:"openInNew",size:"extraSmall",color:"indigo11"}):null,color:"grey",textColor:"link",textWeight:"normal",size:"small",disabled:!t,onClick:a,children:o.length>30?`${o.slice(0,30)}...`:o}),f.jsx(m.Button,{startIcon:"close",color:"grey",size:"small",onClick:n})]}),p.length>1&&f.jsx(m.Select,{value:h,color:"grey",size:"small",boldTriggerText:!0,position:"popper",sideOffset:4,startIcon:"colorLens",onValueChange:A,children:p.map((g,v)=>f.jsx(m.SelectItem,{value:g,children:g},`${g}-${v}`))})]})}function Vl(e){if(!e||e==="any")return"Choose link type";switch(e){case"document":return"Link to Prismic page";case"web":return"Link to web page";case"media":return"Link to media"}}function hJ(e){const{onEdit:t,onUnlink:n,url:r,title:i,subTitle:o}=e,[a,s]=E.useState(null);return f.jsx(m.Card,{paddingBlock:16,ref:s,children:f.jsxs(m.CardContent,{children:[f.jsx(q5e,{url:r,title:i,subTitle:o,onEdit:t,onUnlink:n,container:a}),r&&f.jsx(m.CheckerBoard,{children:f.jsx(K5e,{children:f.jsx(m.Image,{src:r,alt:i,sizing:"contain"})})})]})})}function K5e(e){const{children:t}=e;return f.jsx(m.Box,{flexDirection:"column",alignItems:"center",justifyContent:"center",position:"relative",height:327,children:t})}function q5e(e){const{url:t,title:n,subTitle:r,onEdit:i,onUnlink:o,container:a}=e;return f.jsxs(m.Box,{flexDirection:"row",justifyContent:"space-between",gap:8,children:[f.jsxs(m.Box,{gap:8,minWidth:0,children:[f.jsx(m.ConjoinedIcons,{largeIconName:"image",smallIconName:"link"}),f.jsxs(m.Box,{flexDirection:"column",minWidth:0,children:[f.jsx(m.Text,{noWrap:!0,variant:"smallBold",href:t,inline:!0,children:n}),f.jsx(m.Text,{variant:"small",color:"grey11",children:r})]})]}),f.jsxs(m.ButtonGroup,{size:"medium",color:"grey",children:[i&&f.jsx(m.Tooltip,{content:"Edit link",side:"top",container:a,children:f.jsx(m.Button,{startIcon:"edit",onClick:i})}),o&&f.jsx(m.Tooltip,{content:"Remove link",side:"top",container:a,children:f.jsx(m.Button,{startIcon:"linkOff",onClick:o})})]})]})}function V5e(e){var q,Y,te;const{field:t,content:n,onContentChange:r}=e,i=w(),o=((q=t.config)==null?void 0:q.allowText)??!1,a=o&&(n==null?void 0:n.value.text)||void 0,s=((Y=t.config)==null?void 0:Y.variants)??[],u=(n==null?void 0:n.value.variant)&&s.includes(n==null?void 0:n.value.variant)?n==null?void 0:n.value.variant:s[0],[l,d]=E.useState(b),p=ue.FilledExternalLinkContent.is(n==null?void 0:n.value)&&(n==null?void 0:n.value.target)||void 0,[h,A]=E.useState(!1),g=E.useRef(null);We.useOnChange(i,k);const v=l?z5e[l]:void 0;function b(){var G,ee;return!((G=t.config)!=null&&G.select)||n!=null&&n.value.__TYPE__?n==null?void 0:n.value.__TYPE__:AD[(ee=t.config)==null?void 0:ee.select]}function w(){return n?ue.FilledDocumentLinkContent.is(n.value)?n.value.id:ue.FilledExternalLinkContent.is(n.value)?n.value.url:ue.FilledFileLinkContent.is(n.value)||ue.FilledImageLinkContent.is(n.value)?n.value.name:"":""}function S(G){var F;const{displayText:ee,variant:ne}=G;if(!ee&&!ne)return r(void 0);switch((F=t.config)==null?void 0:F.select){case"web":return r({__TYPE__:"LinkContent",key:zl(n),value:{__TYPE__:"ExternalLink",kind:"web",...ee&&{text:ee},...ne&&{variant:ne}}});case"document":return r({__TYPE__:"LinkContent",key:zl(n),value:{__TYPE__:"DocumentLink",kind:"document",...ee&&{text:ee},...ne&&{variant:ne}}});case"media":return r({__TYPE__:"LinkContent",key:zl(n),value:{__TYPE__:"MediaLink",kind:"media",...ee&&{text:ee},...ne&&{variant:ne}}});default:return r({__TYPE__:"LinkContent",key:zl(n),value:{__TYPE__:"AnyLink",kind:"any",...ee&&{text:ee},...ne&&{variant:ne}}})}}function y(G,ee){if(!G)return S({displayText:a,variant:u});const{newTab:ne=!1}=ee??{},F=ne?"_blank":void 0;switch(l){case"ExternalLink":return r({__TYPE__:"LinkContent",key:zl(n),value:{__TYPE__:"ExternalLink",url:G,target:F,...a&&{text:a},...u&&{variant:u}}});case"DocumentLink":return r({__TYPE__:"LinkContent",key:zl(n),value:{__TYPE__:"DocumentLink",id:G,...a&&{text:a},...u&&{variant:u}}});default:return r(void 0)}}function C(G){return n?r({__TYPE__:n.__TYPE__,key:n.key,value:{...n.value,text:G}}):S({displayText:G})}function x(G){return n?r({__TYPE__:n.__TYPE__,key:n.key,value:{...n.value,variant:G}}):S({variant:G})}const T=H5e();function I(G){d(G?AD[G]:void 0),y(""),G&&G!=="any"&&T(G)}function R(G){y(G)}function O(){A(!0)}function k(){var G;h&&(A(!1),(G=g.current)==null||G.reset())}function P(G){const ee=AJ({media:G});switch(ee.value.__TYPE__){case"ImageLink":return r({__TYPE__:ee.__TYPE__,key:ee.key,value:{...ee.value,...a&&{text:a},...u&&{variant:u}}});case"FileLink":return r({__TYPE__:ee.__TYPE__,key:ee.key,value:{...ee.value,...a&&{text:a},...u&&{variant:u}}})}}return{contentType:l,selectType:v,fieldValue:i,onDisplayTextChange:C,onValueChange:y,onTypeChange:I,placeholder:Ol(t),isTypeSelectEnabled:!((te=t.config)!=null&&te.select),onDocumentSelected:R,onError:O,errorBoundaryRef:g,isTargetNewTab:p==="_blank",onMediaSelected:P,displayTextEnabled:o,displayText:a??"",variants:s,variant:u,onVariantChange:x}}function zl(e){return e?e.key:crypto.randomUUID()}const z5e={AnyLink:"any",DocumentLink:"document",ExternalLink:"web",FileLink:"media",ImageLink:"media",MediaLink:"media"},AD={any:"AnyLink",document:"DocumentLink",web:"ExternalLink",media:"FileLink"};function Q5e(e){const t=ye();t.searchDocuments||bt("searchDocuments");const{coreApiBaseUrl:n,authStrategy:r}=t;return Ye.useRequest(tg,[n,r,e]).title}Ye.cache.registerFetcherConfig(tg,{concurrency:50});function AJ(e){var i,o,a,s,c,u;const{media:t}=e,n="kind"in t;return n&&t.kind==="image"?{__TYPE__:"LinkContent",key:crypto.randomUUID(),value:{__TYPE__:"ImageLink",id:t.id,name:t.filename,url:t.url,kind:"image",size:t.size.toString(),height:((i=t.height)==null?void 0:i.toString())??`${_s}`,width:((o=t.width)==null?void 0:o.toString())??`${_s}`,date:((a=t.last_modified)==null?void 0:a.toString())??""}}:n?{__TYPE__:"LinkContent",key:crypto.randomUUID(),value:{__TYPE__:"FileLink",id:t.id,name:t.filename,kind:"file",url:t.url,size:t.size.toString(),date:((s=t.last_modified)==null?void 0:s.toString())??""}}:{__TYPE__:"LinkContent",key:crypto.randomUUID(),value:{__TYPE__:"ImageLink",id:t.id,name:(t==null?void 0:t.alt)??t.url,kind:"image",url:t.url,size:"0",height:((c=t.height)==null?void 0:c.toString())??`${_s}`,width:((u=t.width)==null?void 0:u.toString())??`${_s}`}}}const H5e=()=>{const e=kWe(),{onAnalyticsEvent:t}=ye();function n(r){e&&t&&t("Generic Link Added",{type:r,isInSlice:String(e.isInSlice),isInGroup:String(e.isInGroup),isInRepeatable:String(e.isInRepeatable),customTypeFormat:e.customTypeFormat??"custom"})}return n};function Y5e(e){const{open:t,onOpenChange:n,showNewTabButton:r}=e,{url:i,setUrl:o,openInNewTab:a,setOpenInNewTab:s,disabled:c,onUpdate:u}=G5e(e);return f.jsxs(m.Dialog,{open:t,onOpenChange:n,size:"small",noDescription:!0,children:[f.jsx(m.DialogHeader,{title:"Set Link URL"}),f.jsxs(m.DialogContent,{padding:16,children:[f.jsx(m.FormInput,{value:i,onValueChange:o,placeholder:"Paste URL",icon:"public"}),r&&f.jsx(m.InlineLabel,{value:"Open in a new tab",children:f.jsx(m.Checkbox,{checked:a,onCheckedChange:s})})]}),f.jsxs(m.DialogActions,{children:[f.jsx(m.DialogCancelButton,{}),f.jsx(m.DialogActionButton,{onClick:u,disabled:c,children:"Update"})]})]})}function G5e(e){const{url:t,openInNewTab:n,onUpdate:r,open:i}=e,[o,a]=E.useState(t),[s,c]=E.useState(n);We.useOnChange(i,()=>{i&&(a(t),c(n))});const u=!o||o===t&&s===n;function l(){r(o,{newTab:s})}return{url:o,setUrl:a,openInNewTab:s,disabled:u,setOpenInNewTab:c,onUpdate:l}}function YF(e){var ee,ne,F,M;const{content:t,field:n,id:r,onContentChange:i,appearance:o="normal",backgroundColor:a="grey1"}=e,s=We.useDebounceState({initialState:!1}),[c,u]=E.useState(),{contentType:l,fieldValue:d,errorBoundaryRef:p,onDocumentSelected:h,onError:A,onMediaSelected:g,onValueChange:v,selectType:b,onTypeChange:w,isTypeSelectEnabled:S,displayTextEnabled:y,...C}=V5e({content:t,field:n,onContentChange:i}),x=l==="DocumentLink"&&d!=="",I=l==="ExternalLink"&&Vr.toURL(d),R=!!((ee=n.config)!=null&&ee.allowTargetBlank);function O(){switch(l){case"DocumentLink":return u("document");case"ExternalLink":return u("web");case"FileLink":case"ImageLink":case"MediaLink":return u("media");default:return u(void 0)}}const k={...C,id:r,onFocus:()=>s.set(!0),onBlur:()=>s.set(!1),onOpenLinkModal:O,onUnlink:()=>{S?w(void 0):v("")},onSelectValueChange:N=>{w(N),u(N)},value:d,allowTargetBlank:R,selectType:b,onValueChange:v,isTypeSelectEnabled:S,displayTextEnabled:y,onKeyDown(N){y||(N.key==="Enter"||N.key===" ")&&(O(),N.preventDefault())},onClick:()=>{y||O()},appearance:o},{searchDocuments:P}=ye();function q(N){if(N)return;const se=t&&t.value.__TYPE__!=="AnyLink";!N&&!se&&S&&w(void 0),u(void 0)}function Y(N,se){v(N,se),u(void 0)}function te(N){g(N),u(void 0)}function G(N){h(N),u(void 0)}return f.jsxs(f.Fragment,{children:[f.jsxs(m.Popover,{align:"start",sideOffset:-3,focusOnEnter:!1,open:s.debouncedValue,anchor:f.jsxs(m.Field,{variant:J5e(o),color:a,children:[x?f.jsx(e4e,{documentId:d,displayTextEnabled:y}):f.jsx(m.FieldIcon,{name:fd({selectType:b,displayTextEnabled:y})}),o!=="compact"&&f.jsx(m.FieldLabel,{htmlFor:r,children:pr(n)}),f.jsx(m.FieldControl,{children:x&&P?f.jsx(n4e,{errorBoundaryRef:p,onError:A,fallback:f.jsx(Ox,{...k,value:"..."}),renderError:()=>Z5e(k),children:f.jsx(X5e,{...k,documentId:d})}):f.jsx(Ox,{...k})})]}),children:[I&&f.jsx(xu,{url:I,title:Vr.getUrlTitle(I)??"",subTitle:I.toString()}),t&&ue.FilledImageLinkContent.is(t.value)&&f.jsx(hJ,{url:t.value.url,title:t.value.name,subTitle:`${t.value.width} x ${t.value.height} pixels`})]}),f.jsx(Y5e,{open:c==="web",onOpenChange:q,onUpdate:Y,url:d,openInNewTab:C.isTargetNewTab,showNewTabButton:!!((ne=n.config)!=null&&ne.allowTargetBlank)}),f.jsx(HF,{open:c==="media",onOpenChange:q,onMediaSelected:te,assetType:"all"}),f.jsx(lJ,{open:c==="document",onOpenChange:q,onSelectDocument:G,fixedCustomTypes:new Set((F=n.config)==null?void 0:F.customtypes),fixedTags:new Set((M=n.config)==null?void 0:M.tags),linkedDocumentId:t&&ue.FilledDocumentLinkContent.is(t.value)?t.value.id:void 0})]})}function J5e(e){switch(e){case"compact":return"compact";case"normal":return"normal";default:return}}function Z5e(e){return f.jsx(Ox,{...e})}function Ox(e){const{id:t,value:n,onOpenLinkModal:r,onBlur:i,isTypeSelectEnabled:o,selectType:a,onSelectValueChange:s,onUnlink:c,isTargetNewTab:u,allowTargetBlank:l,displayTextEnabled:d,displayText:p,onFocus:h,onClick:A,onKeyDown:g,appearance:v,placeholder:b,variants:w,variant:S,onVariantChange:y,onDisplayTextChange:C,onValueChange:x}=e;return f.jsx(m.Box,{padding:{block:4},width:"100%",children:f.jsx(Ic,{id:t,textOverflow:"ellipsis",variant:d?"normal":"link",readOnly:!d,placeholder:d?"Add your display text":b,padding:mJ(v),value:d?p:n,cursor:gJ({value:n,displayTextEnabled:d,isTypeSelectEnabled:o}),onBlur:i,onFocus:h,onClick:A,onKeyDown:g,onValueChange:d?C:x,endAdornment:f.jsx(pJ,{hasLink:!!(n&&a),onUnlink:c,selectEnabled:o,selectedType:a,value:n,onOpenLinkModal:r,onValueChange:s,openInNewTab:u,condensedButtons:v==="condensedButtons",showNewTabButton:l&&a==="web",displayTextEnabled:d,variants:w,variant:S,onVariantChange:y})})})}function X5e(e){const{id:t,documentId:n,onOpenLinkModal:r,isTypeSelectEnabled:i,selectType:o,displayTextEnabled:a,onSelectValueChange:s,onUnlink:c,onFocus:u,onClick:l,onKeyDown:d,appearance:p,variants:h,variant:A,displayText:g,onVariantChange:v,onDisplayTextChange:b}=e,w=Q5e(n),S=vJ(n);return f.jsx(Ic,{id:t,textOverflow:"ellipsis",padding:mJ(p),placeholder:a?"Add your display text":void 0,readOnly:!a,value:a?g:w,variant:a?"normal":"link",cursor:gJ({value:w,displayTextEnabled:a,isTypeSelectEnabled:i}),onFocus:u,onClick:l,onKeyDown:d,onValueChange:a?b:void 0,endAdornment:f.jsxs(m.Box,{gap:4,children:[S&&f.jsx(m.Badge,{title:"Broken Link",color:"tomato"}),f.jsx(pJ,{hasLink:!0,onUnlink:c,selectEnabled:i,selectedType:o,value:w,onOpenLinkModal:r,condensedButtons:p==="condensedButtons",onValueChange:s,displayTextEnabled:a,variants:h,variant:A,onVariantChange:v})]})})}function e4e(e){const{documentId:t,displayTextEnabled:n}=e;return f.jsx(m.ErrorBoundary,{renderError:()=>f.jsx(m.FieldIcon,{name:"warning"}),children:f.jsx(E.Suspense,{fallback:f.jsx(m.FieldIcon,{name:fd({selectType:"document",displayTextEnabled:n})}),children:f.jsx(t4e,{documentId:t,displayTextEnabled:n})})})}function t4e(e){const{displayTextEnabled:t,documentId:n}=e;return vJ(n)?f.jsx(m.FieldIcon,{name:"linkOff"}):f.jsx(m.FieldIcon,{name:fd({selectType:"document",displayTextEnabled:t})})}function mJ(e){switch(e){case"compact":return{input:{inline:4}};default:return}}function n4e(e){const{errorBoundaryRef:t,onError:n,children:r,fallback:i,renderError:o}=e;return f.jsx(m.ErrorBoundary,{ref:t,onError:n,renderError:o,children:f.jsx(E.Suspense,{fallback:i,children:r})})}function fd(e){const{selectType:t,displayTextEnabled:n}=e;if(n)return"notes";switch(t){case"document":return"description";case"web":return"public";case"media":return"image";default:return"link"}}function gJ(e){const{value:t,displayTextEnabled:n,isTypeSelectEnabled:r}=e;return n?"text":r&&!t?"default":"pointer"}function r4e(e){const{onContentChange:t,...n}=e;function r(i){const o=ue.FilledLinkContent.is(i)?i:void 0;t(o)}return f.jsx(YF,{...n,onContentChange:r})}function vJ(e){const t=ye();t.uidField||bt("uidField");const{coreApiBaseUrl:n,authStrategy:r}=t,{data:i}=NF({baseUrl:n,authStrategy:r,documentIds:[e],statuses:["archived","unclassified","published"]});if(i.results.length===0||i.results.length>1)return!1;const o=i.results[0];return o==null?void 0:o.versions.every(a=>a.status==="archived")}function i4e(e){const{onDelete:t,isDeleteEnabled:n,onMoveUp:r,onMoveDown:i,isMoveUpEnabled:o,isMoveDownEnabled:a}=e;return f.jsxs(m.DropdownMenu,{children:[f.jsx(m.DropdownMenuTrigger,{children:f.jsx(m.IconButton,{hiddenLabel:"Link actions",icon:"moreVert",size:"small",variant:"solid"})}),f.jsxs(m.DropdownMenuContent,{children:[f.jsx(m.DropdownMenuLabel,{children:f.jsx(m.Text,{variant:"small",color:"grey11",children:"Item options"})}),f.jsx(m.DropdownMenuItem,{onSelect:r,startIcon:f.jsx(m.Icon,{name:"arrowUpward"}),disabled:!o,children:"Move up"}),f.jsx(m.DropdownMenuItem,{onSelect:i,startIcon:f.jsx(m.Icon,{name:"arrowDownward"}),disabled:!a,children:"Move down"}),f.jsx(m.DropdownMenuItem,{color:"tomato",onSelect:t,startIcon:f.jsx(m.Icon,{name:"delete",color:"tomato9"}),disabled:!n,children:"Delete"})]})]})}function o4e(e){const{field:t,content:n,onContentChange:r}=e,{config:i}=t,o=E.useMemo(()=>YC({config:i}),[i]),a=n!=null&&n.value.length?n.value:[o];function s(p){const h=yt.insertAtIndex(a,p,YC({config:i}));r(Ep(h))}function c(p,h){var v;const A=[...a],g=YC({config:i,key:(v=A[h])==null?void 0:v.key});A[h]=p??g,r(Ep(A))}function u(p){r(Ep(p))}function l(p){const h=yt.removeIndex(a,p);r(Ep(h))}function d(p,h){const A=yt.move(a,h,h+a4e(p));r(Ep(A))}return{links:a,updateLink:c,updateLinks:u,addLink:s,deleteLink:l,moveLink:d}}function a4e(e){switch(e){case"up":return-1;case"down":return 1}}function YC(e){const{config:t,key:n=crypto.randomUUID()}=e,r=s4e(t==null?void 0:t.select);return t!=null&&t.allowText&&(r.text=""),{__TYPE__:"LinkContent",key:n,value:r}}function s4e(e){switch(e){case"web":return{__TYPE__:"ExternalLink",kind:"web"};case"document":return{__TYPE__:"DocumentLink",kind:"document"};case"media":return{__TYPE__:"MediaLink",kind:"media"};default:return{__TYPE__:"AnyLink",kind:"any"}}}function Ep(e){return{__TYPE__:"RepeatableContent",type:"Link",value:e}}function c4e(e){const{id:t,field:n}=e,r=o4e(e),[i,o]=E.useState(!1),{links:a}=r;return f.jsx($We,{children:f.jsxs(m.FieldSet,{id:t,legend:u4e(n.config),variant:"compact",selected:i,children:[f.jsx(l4e,{field:n,items:a,onItemDelete:r.deleteLink,onItemChange:r.updateLink,onItemMove:r.moveLink,onItemAdd:r.addLink,onItemReorder:r.updateLinks,onDragStatusChange:o}),f.jsx(m.Button,{startIcon:"add",color:"grey",onClick:()=>r.addLink(a.length),sx:{marginInline:4,marginBlock:4},children:"Add"})]})})}function u4e(e){return e!=null&&e.label?`Multiple • ${e.label}`:"Multiple"}function l4e(e){const{field:t,items:n,onItemChange:r,onItemDelete:i,onItemMove:o}=e,a=n.length>1,s=d4e(e);return f.jsx(m.AnimatedList,{items:n,getItemKey:c=>c.key,ariaLabel:"Link list",dnd:s,children:(c,u)=>f.jsxs(m.Draggable,{disabled:!a,children:[f.jsx(YF,{appearance:"compact",content:c,field:t,onContentChange:l=>r(l,u),backgroundColor:"transparent"}),f.jsx(i4e,{onDelete:()=>i(u),isDeleteEnabled:n.length>1,onMoveUp:()=>o("up",u),isMoveUpEnabled:u>0,onMoveDown:()=>o("down",u),isMoveDownEnabled:u<n.length-1})]})})}function d4e(e){const{onDragStatusChange:t,onItemReorder:n,onItemAdd:r}=e,{scrollOffsetTop:i}=ye(),o=We.useStableCallback(r);return{renderDropIndicator:s=>f.jsx(f4e,{...s,onItemAdd:o}),scrollOffsetTop:i,onDragChange:t,onReorder:n}}function f4e(e){const{isDropTarget:t,itemIndex:n,position:r,itemCount:i,onItemAdd:o}=e;return n===0&&r==="before"?f.jsx(mD,{isDropTarget:t,position:"before"}):n===i-1&&r==="after"?f.jsx(mD,{isDropTarget:t,position:"after"}):f.jsx(p4e,{index:n,isDropTarget:t,onItemAdd:o})}function p4e(e){const{index:t,onItemAdd:n,isDropTarget:r}=e,[i,o]=E.useState(0);function a(){n(t+1),o(s=>s+1)}return f.jsx(m.HairlineButton,{icon:"add",size:"small",variant:"rightDashed",tooltip:{content:"Add item below"},onClick:a,dropMode:r,sx:{marginInline:4}},i)}function mD(e){const{isDropTarget:t,position:n}=e;return f.jsx(m.AnimatedElement,{enterDuration:150,animation:{name:"expand-vertical"},children:t&&f.jsx(m.Box,{children:f.jsx(m.Line,{color:"purple",thickness:2,sx:{width:"100%",marginBottom:n==="before"?4:void 0,marginTop:n==="after"?4:void 0}},"line")})})}function h4e(e){const{linkTo:t,onLinkToChange:n}=e,r=A4e(t);return f.jsx(r4e,{content:r,onContentChange:i=>n(m4e(i)),field:{type:"Link",config:{label:"Link",allowTargetBlank:!0,allowText:!1}},appearance:"condensedButtons"})}function A4e(e){const[t]=E.useState(()=>crypto.randomUUID());if(e)return{__TYPE__:"LinkContent",key:t,value:e}}function m4e(e){return e==null?void 0:e.value}function yJ(e){var S,y;const{allContentViews:t,content:n,contentView:r,fieldLabel:i,imageLabel:o,initialImages:a,isUpdating:s,page:c=0,readOnly:u,thumbnailName:l,onClear:d,onContentChange:p,onCropperDialogClose:h,onPageChange:A,onMediaDialogOpenChange:g}=e,v=((y=(S=n==null?void 0:n.url)==null?void 0:S.split("?")[0])==null?void 0:y.slice(-4))===".svg",b=n!=null&&n.url&&!u?"visible":"hidden",w=!ue.isImageContent(n);return f.jsxs(m.Box,{display:"flex",gap:12,padding:{inline:12},children:[f.jsx(m.Box,{children:f.jsx(m.Carousel,{getItemSource:m6e,items:t,onPageChange:A,page:c,buttonSize:"small",renderPrevTooltip:C=>f.jsx(m.Tooltip,{content:"Previous",children:C}),renderNextTooltip:C=>f.jsx(m.Tooltip,{content:"Next",children:C}),style:w?{width:181,height:142}:{width:123,height:93},children:C=>(C==null?void 0:C.url)&&f.jsx(m.CarouselItem,{"aria-label":"Image Field Item",src:UG(C.url),alt:C.alt??void 0,isUpdating:s,disableAnimation:w},`${l}_${C.url}`)})}),f.jsxs(m.Box,{width:"100%",display:"flex",flexDirection:"column",gap:w?16:12,children:[f.jsx(f5e,{fieldLabel:i,imageLabel:o,initialImages:a,page:c,displaySeparator:!w,isSVGContentView:v,visibility:b,onClear:d,onCropperDialogClose:h,onMediaDialogOpenChange:g}),f.jsx(d5e,{readOnly:u||!r,altText:(r==null?void 0:r.alt)??"",onValueChange:C=>{r&&p(f6e(l,n,r,C))}}),w&&f.jsx(h4e,{linkTo:n.linkTo,onLinkToChange:C=>{p({...n,linkTo:C})}})]})]})}function bJ(e){const{onMediaSelected:t}=e,n=ye(),{showAlert:r}=m.useAlert(),{mutate:i,isPending:o}=Ti.useMutation({mutationFn:a=>xG({file:a,config:n}),onSuccess:a=>{t(a)},onError:()=>{r({title:"Error uploading image",subtitle:"Please try again"})}});return{uploadImage:i,isUploadingImage:o}}function g4e(e){const{content:t,onContentChange:n,field:r}=e,[i,o]=E.useState(0),[a,s]=E.useTransition(),c=l6e(r),u=c[i],l=t?d6e(r,t):void 0,d=l==null?void 0:l[i];function p(w){if(!u)return;const S=g6e(u.name,r,t,w);S!==t&&s(()=>n(S))}function h(w){s(()=>o(w))}function A({option:w,croppedImages:S}){if(o(w),!t)return;const y=Object.entries(S).reduce((C,[x,T])=>o5e({field:r,content:C,thumbnail:x,croppedImage:T}),t);y!==t&&s(()=>n(y))}function g(){o==null||o(0),n(void 0)}const{uploadImage:v,isUploadingImage:b}=bJ({onMediaSelected:p});return{onCropperDialogClose:A,onPageChange:h,onMediaSelected:p,isUpdating:a,page:i,thumbnail:u,allThumbnails:c,allContentViews:l,contentView:d,onClear:g,uploadImage:v,isUploadingImage:b}}function v4e(e){const{content:t,field:n,readOnly:r,onContentChange:i}=e,o=t&&t.origin.url.length>0,{onCropperDialogClose:a,onPageChange:s,isUpdating:c,page:u,onMediaSelected:l,thumbnail:d,allThumbnails:p,allContentViews:h,contentView:A,onClear:g,uploadImage:v,isUploadingImage:b}=g4e({field:n,content:t,onContentChange:i}),[w,S]=E.useState(!1),y=pr(n),C=p.map((R,O)=>{const k=h==null?void 0:h[O];return{thumbnail:R,contentView:k,labels:Ex(R,t,k)}}),x=d&&o?Ex(d,t,A).filter(qi.isDefined):[],T=d&&t&&o&&h,I=b||c;return f.jsx(rJ,{isMediaDialogOpen:w,onMediaSelected:l,onMediaDialogOpenChange:S,children:f.jsx(E.Suspense,{fallback:f.jsx("div",{style:{height:95}}),children:T?f.jsx(yJ,{allContentViews:h,content:t,contentView:A,fieldLabel:y,imageLabel:x,initialImages:C,isUpdating:I,page:u,readOnly:r,thumbnailName:d.name,onClear:g,onContentChange:i,onCropperDialogClose:a,onMediaDialogOpenChange:S,onPageChange:s}):f.jsx(iJ,{uploadImage:v,isUploading:b,disabled:r||w,children:f.jsx(eJ,{fieldLabel:y,isUpdating:I,readOnly:r,onMediaDialogOpenChange:S})})})})}function y4e(e){var v,b;const{searchTerm:t,catalogId:n}=e,r=ye();r.integrationFields||bt("integrationFields");const{integrationFieldsApiBaseUrl:i,repository:o,authStrategy:a}=r,[s,c]=E.useState(1),[u,l]=E.useState([]),[d,p]=E.useState(""),h=Ye.useRequest(b4e,[i,a,o,n,t,t===d?s:1]);t!==d?(p(t),c(1),l(h.items)):h.items.length>0&&((v=yt.last(u))==null?void 0:v.id)!==((b=yt.last(h.items))==null?void 0:b.id)&&l(w=>w.concat(h.items));const A=s<h.totalPages;function g(){A&&c(w=>w+1)}return{items:u,response:h,fetchNextPage:g,hasNextPage:A}}function b4e(e,t,n,r,i,o=1,a=30){const s=new URL(`if/search/${r}`,e);return s.searchParams.set("searchTerm",i),s.searchParams.set("limit",a.toString()),s.searchParams.set("page",o.toString()),le.request(s,{headers:{repository:n},credentials:le.getRequestCredentials(t),okType:S4e})}const SJ=$.object({id:$.string(),title:$.string(),imageURL:$.string().optional(),description:$.string().optional()}),S4e=$.object({items:$.array(SJ),totalPages:$.number(),page:$.number()});function CJ(e){const{itemId:t,catalogId:n}=e,r=ye();r.integrationFields||bt("integrationFields");const{integrationFieldsApiBaseUrl:i,repository:o,authStrategy:a}=r,c=Ye.useRequest(C4e,[i,a,o,n,t]).items[0];if(!c)throw new Error("Item not found");return{item:c}}function C4e(e,t,n,r,i){const o=new URL(`if/read/${r}`,e);return o.searchParams.set("ids",[i].toString()),le.request(o,{headers:{repository:n},credentials:le.getRequestCredentials(t),okType:w4e})}const w4e=$.object({items:$.array(SJ)});function GF(e){const{item:t,onClick:n,catalogId:r}=e;return f.jsxs(m.PreviewCard,{variant:"large",onClick:n,children:[f.jsx(x4e,{src:t.imageURL??"",alt:t.title}),f.jsxs(m.PreviewContent,{children:[f.jsx(m.Badge,{title:`Catalog: ${r}`,icon:"multipleStop",size:"medium"}),f.jsx(m.Text,{variant:"bold",color:"grey12",sx:{marginTop:4},children:t.title}),f.jsx(m.Text,{variant:"small",color:"grey11",children:t.description??t.id})]})]})}const $g=76;function x4e(e){const{src:t,alt:n}=e;return t?f.jsx(m.PreviewImage,{src:t,alt:n,width:$g,height:$g,framed:!0}):f.jsxs(m.Box,{borderRadius:6,backgroundColor:"grey2",height:$g,width:$g,flexDirection:"column",alignItems:"center",justifyContent:"center",border:!0,padding:{inline:4,block:8},children:[f.jsx(m.Icon,{name:"hideImage",size:"large",color:"grey11"}),f.jsx(m.Text,{color:"grey11",variant:"small",noSelect:!0,align:"center",children:"No preview image"})]})}function Jl(){return f.jsxs(m.PreviewCard,{variant:"large",children:[f.jsx(m.Skeleton,{height:76,width:76}),f.jsxs(m.PreviewContent,{children:[f.jsx(m.Skeleton,{height:24,width:168}),f.jsx(m.Skeleton,{height:24,width:240,sx:{marginTop:4}}),f.jsx(m.Skeleton,{height:16,width:144})]})]})}function _4e(e){const{open:t,onOpenChange:n,catalogId:r,onSelectItem:i}=e,o=We.useDebounceState({initialState:""}),a=ye();return f.jsx(m.Dialog,{open:t,onOpenChange:n,hasClose:!1,size:{width:612,height:724},noDescription:!0,children:f.jsx(m.DialogContent,{children:f.jsxs(m.Box,{flexDirection:"column",height:"100%",children:[f.jsxs(m.Box,{padding:{top:16,inline:16},flexDirection:"column",gap:8,children:[f.jsx(m.FormSearchInput,{value:o.value,onValueChange:o.set,placeholder:"Search in your catalog"}),f.jsx(m.DialogTitle,{asChild:!0,children:f.jsx(m.Text,{variant:"smallBold",color:"grey11",children:"Select an item"})})]}),a.integrationFields?f.jsx(m.ErrorBoundary,{renderError:()=>f.jsx(Mx,{message:"There was an error while fetching your catalog items."}),children:f.jsx(E.Suspense,{fallback:f.jsxs(m.Box,{flexDirection:"column",gap:12,padding:{top:10,inline:16,bottom:16},children:[f.jsx(Jl,{}),f.jsx(Jl,{}),f.jsx(Jl,{}),f.jsx(Jl,{}),f.jsx(Jl,{})]}),children:f.jsx(T4e,{searchTerm:o.debouncedValue,catalogId:r,onItemClick:i})})}):f.jsx(Mx,{message:"Slice Machine does not yet support mock data for integration field in the simulator."})]})})})}function T4e(e){const{catalogId:t,searchTerm:n,onItemClick:r}=e,[i,o]=E.useTransition(),{items:a,hasNextPage:s,fetchNextPage:c}=y4e({catalogId:t,searchTerm:n});return f.jsx(f.Fragment,{children:f.jsxs(m.ScrollArea,{onScrollToBottom:()=>s&&o(c),style:{flexGrow:1,paddingTop:m.theme.space[10],paddingBottom:m.theme.space[16],paddingInline:m.theme.space[16],display:"flex",flexDirection:"column",gap:m.theme.space[12]},threshold:252,children:[a.length===0?f.jsx(Mx,{}):a.map(u=>f.jsx(GF,{item:u,catalogId:t,onClick:()=>r(u)},u.id)),f.jsx(m.AnimatedElement,{animation:{name:"fade"},children:i&&f.jsx(m.Text,{color:"grey11",align:"center",sx:{marginBlock:8},children:"Loading more results ..."})})]})})}function Mx(e){const{message:t="We can't find any items matching your search"}=e,n="Oops!";return f.jsx(m.Box,{justifyContent:"center",flexDirection:"column",height:"100%",children:f.jsxs(m.BlankSlate,{children:[f.jsx(m.BlankSlateIcon,{name:"close",lineColor:"purple10",backgroundColor:"purple3",borderColor:"purple6",borderStyle:"dashed",size:"xlarge"}),f.jsx(m.BlankSlateTitle,{size:"big",children:n}),f.jsx(m.BlankSlateDescription,{width:360,children:t})]})})}function I4e(e){const{itemId:t,item:n}=e,r=ye();return t&&n&&n.id===t?f.jsx(Zl,{...e,value:n.title}):t&&r.integrationFields?f.jsx(m.ErrorBoundary,{renderError:()=>f.jsx(Zl,{...e,value:t}),children:f.jsx(E.Suspense,{fallback:f.jsx(Zl,{...e,value:t}),children:f.jsx($4e,{...e,itemId:t})},t)},t):t&&!r.integrationFields?f.jsx(Zl,{...e,value:t}):f.jsx(Zl,{...e,value:""})}function E4e(e){const{catalogId:t,itemId:n,item:r}=e,i=ye();return n&&r&&r.id===n?f.jsx(m.FieldFooter,{children:f.jsx(GF,{catalogId:t,item:r})}):n&&i.integrationFields?f.jsx(m.ErrorBoundary,{renderError:()=>null,children:f.jsx(m.FieldFooter,{children:f.jsx(E.Suspense,{fallback:f.jsx(Jl,{}),children:f.jsx(R4e,{catalogId:t,itemId:n})},n)})},n):null}function R4e(e){const{itemId:t,catalogId:n}=e,{item:r}=CJ({catalogId:n,itemId:t});return f.jsx(GF,{catalogId:n,item:r})}function Zl(e){const{id:t,field:n,readOnly:r,value:i,onFocus:o,onClearItem:a}=e;return f.jsx(Ic,{id:t,placeholder:Ol(n),readOnly:!0,variant:"link",value:i,...!r&&{cursor:"pointer",onFocus:o},endAdornment:f.jsx(m.Button,{startIcon:"close",color:"grey",size:"small",disabled:!i,onClick:a})})}function $4e(e){const{itemId:t,catalogId:n}=e,{item:r}=CJ({catalogId:n,itemId:t});return f.jsx(Zl,{...e,value:r.title})}function k4e(e){var h;const{id:t,field:n,content:r,readOnly:i,onContentChange:o}=e,[a,s]=E.useState(!1),[c,u]=E.useState(),l=(h=n.config)==null?void 0:h.catalog;if(!l)return null;function d(A){o({value:A.id,__TYPE__:"IntegrationFieldsContent"}),u(A),s(!1)}function p(){o(void 0),u(void 0)}return f.jsxs(f.Fragment,{children:[f.jsxs(m.Field,{footer:f.jsx(E4e,{catalogId:l,item:c,itemId:r==null?void 0:r.value}),children:[f.jsx(m.FieldIcon,{name:"multipleStop"}),f.jsx(m.FieldLabel,{htmlFor:t,children:pr(n)}),f.jsx(m.FieldControl,{children:f.jsx(I4e,{id:t,field:n,readOnly:i,catalogId:l,item:c,itemId:r==null?void 0:r.value,onFocus:()=>s(!0),onClearItem:p})})]}),f.jsx(_4e,{open:a,onOpenChange:s,catalogId:l,onSelectItem:d})]})}function wJ(e){const{content:t,field:n,id:r,onContentChange:i,readOnly:o,endAdornment:a,placeholder:s}=e;return f.jsxs(m.Field,{children:[f.jsx(m.FieldIcon,{name:"notes"}),f.jsx(m.FieldLabel,{htmlFor:r,children:pr(n)}),f.jsxs(m.FieldControl,{children:[f.jsx(m.TextArea,{id:r,placeholder:s||Ol(n),readOnly:o,paddingLeft:4,paddingRight:12,sx:{flexGrow:1},value:(t==null?void 0:t.value)??"",onChange:c=>{i(O4e(c))}}),a]})]})}function O4e(e){return e.length===0?void 0:{__TYPE__:"FieldContent",type:"Text",value:e}}function M4e(e){var s;const{content:t,id:n,field:r,onContentChange:i,readOnly:o}=e,a={id:n,readOnly:o,onContentChange:i};return(s=r.config)!=null&&s.repeat?f.jsx(c4e,{...a,field:r,content:SH(t)}):f.jsx(YF,{...a,field:r,content:CH(t)})}const F4e=({content:e,field:t,id:n,onContentChange:r,readOnly:i})=>{var s,c;const o=Number(e==null?void 0:e.value),a=Number.isFinite(o)?o:void 0;return f.jsxs(m.Field,{children:[f.jsx(m.FieldIcon,{name:"pin"}),f.jsx(m.FieldLabel,{htmlFor:n,children:pr(t)}),f.jsx(m.FieldControl,{children:f.jsx(m.NumberInput,{id:n,value:a,min:(s=t.config)==null?void 0:s.min,max:(c=t.config)==null?void 0:c.max,padding:GG,placeholder:Ol(t),readOnly:i,onValueChange:u=>r(L4e(u))})})]})};function L4e(e){return e===void 0?void 0:{__TYPE__:"FieldContent",type:"Number",value:String(e)}}function An(e){this.content=e}An.prototype={constructor:An,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),o=r.content.slice();return i==-1?o.push(n||e,t):(o[i+1]=t,n&&(o[i]=n)),new An(o)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new An(n)},addToStart:function(e,t){return new An([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new An(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),o=r.find(e);return i.splice(o==-1?i.length:o,0,t,n),new An(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=An.from(e),e.size?new An(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=An.from(e),e.size?new An(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=An.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}};An.from=function(e){if(e instanceof An)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new An(t)};function xJ(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),o=t.child(r);if(i==o){n+=i.nodeSize;continue}if(!i.sameMarkup(o))return n;if(i.isText&&i.text!=o.text){for(let a=0;i.text[a]==o.text[a];a++)n++;return n}if(i.content.size||o.content.size){let a=xJ(i.content,o.content,n+1);if(a!=null)return a}n+=i.nodeSize}}function _J(e,t,n,r){for(let i=e.childCount,o=t.childCount;;){if(i==0||o==0)return i==o?null:{a:n,b:r};let a=e.child(--i),s=t.child(--o),c=a.nodeSize;if(a==s){n-=c,r-=c;continue}if(!a.sameMarkup(s))return{a:n,b:r};if(a.isText&&a.text!=s.text){let u=0,l=Math.min(a.text.length,s.text.length);for(;u<l&&a.text[a.text.length-u-1]==s.text[s.text.length-u-1];)u++,n--,r--;return{a:n,b:r}}if(a.content.size||s.content.size){let u=_J(a.content,s.content,n-1,r-1);if(u)return u}n-=c,r-=c}}class U{constructor(t,n){if(this.content=t,this.size=n||0,n==null)for(let r=0;r<t.length;r++)this.size+=t[r].nodeSize}nodesBetween(t,n,r,i=0,o){for(let a=0,s=0;s<n;a++){let c=this.content[a],u=s+c.nodeSize;if(u>t&&r(c,i+s,o||null,a)!==!1&&c.content.size){let l=s+1;c.nodesBetween(Math.max(0,t-l),Math.min(c.content.size,n-l),r,i+l)}s=u}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,n,r,i){let o="",a=!0;return this.nodesBetween(t,n,(s,c)=>{let u=s.isText?s.text.slice(Math.max(t,c)-c,n-c):s.isLeaf?i?typeof i=="function"?i(s):i:s.type.spec.leafText?s.type.spec.leafText(s):"":"";s.isBlock&&(s.isLeaf&&u||s.isTextblock)&&r&&(a?a=!1:o+=r),o+=u},0),o}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),o=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),o=1);o<t.content.length;o++)i.push(t.content[o]);return new U(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let o=0,a=0;a<n;o++){let s=this.content[o],c=a+s.nodeSize;c>t&&((a<t||c>n)&&(s.isText?s=s.cut(Math.max(0,t-a),Math.min(s.text.length,n-a)):s=s.cut(Math.max(0,t-a-1),Math.min(s.content.size,n-a-1))),r.push(s),i+=s.nodeSize),a=c}return new U(r,i)}cutByIndex(t,n){return t==n?U.empty:t==0&&n==this.content.length?this:new U(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),o=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new U(i,o)}addToStart(t){return new U([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new U(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(t.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(t){let n=this.content[t];if(!n)throw new RangeError("Index "+t+" out of range for "+this);return n}maybeChild(t){return this.content[t]||null}forEach(t){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];t(i,r,n),r+=i.nodeSize}}findDiffStart(t,n=0){return xJ(this,t,n)}findDiffEnd(t,n=this.size,r=t.size){return _J(this,t,n,r)}findIndex(t,n=-1){if(t==0)return kg(0,t);if(t==this.size)return kg(this.content.length,t);if(t>this.size||t<0)throw new RangeError(`Position ${t} outside of fragment (${this})`);for(let r=0,i=0;;r++){let o=this.child(r),a=i+o.nodeSize;if(a>=t)return a==t||n>0?kg(r+1,a):kg(r,i);i=a}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(t=>t.toJSON()):null}static fromJSON(t,n){if(!n)return U.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new U(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return U.empty;let n,r=0;for(let i=0;i<t.length;i++){let o=t[i];r+=o.nodeSize,i&&o.isText&&t[i-1].sameMarkup(o)?(n||(n=t.slice(0,i)),n[n.length-1]=o.withText(n[n.length-1].text+o.text)):n&&n.push(o)}return new U(n||t,r)}static from(t){if(!t)return U.empty;if(t instanceof U)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new U([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}U.empty=new U([],0);const GC={index:0,offset:0};function kg(e,t){return GC.index=e,GC.offset=t,GC}function Yv(e,t){if(e===t)return!0;if(!(e&&typeof e=="object")||!(t&&typeof t=="object"))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!Yv(e[r],t[r]))return!1}else{for(let r in e)if(!(r in t)||!Yv(e[r],t[r]))return!1;for(let r in t)if(!(r in e))return!1}return!0}let ft=class Fx{constructor(t,n){this.type=t,this.attrs=n}addToSet(t){let n,r=!1;for(let i=0;i<t.length;i++){let o=t[i];if(this.eq(o))return t;if(this.type.excludes(o.type))n||(n=t.slice(0,i));else{if(o.type.excludes(this.type))return t;!r&&o.type.rank>this.type.rank&&(n||(n=t.slice(0,i)),n.push(this),r=!0),n&&n.push(o)}}return n||(n=t.slice()),r||n.push(this),n}removeFromSet(t){for(let n=0;n<t.length;n++)if(this.eq(t[n]))return t.slice(0,n).concat(t.slice(n+1));return t}isInSet(t){for(let n=0;n<t.length;n++)if(this.eq(t[n]))return!0;return!1}eq(t){return this==t||this.type==t.type&&Yv(this.attrs,t.attrs)}toJSON(){let t={type:this.type.name};for(let n in this.attrs){t.attrs=this.attrs;break}return t}static fromJSON(t,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=t.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let i=r.create(n.attrs);return r.checkAttrs(i.attrs),i}static sameSet(t,n){if(t==n)return!0;if(t.length!=n.length)return!1;for(let r=0;r<t.length;r++)if(!t[r].eq(n[r]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return Fx.none;if(t instanceof Fx)return[t];let n=t.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};ft.none=[];class _u extends Error{}class W{constructor(t,n,r){this.content=t,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=IJ(this.content,t+this.openStart,n);return r&&new W(r,this.openStart,this.openEnd)}removeBetween(t,n){return new W(TJ(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t}static fromJSON(t,n){if(!n)return W.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new W(U.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let o=t.firstChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=t.lastChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.lastChild)i++;return new W(t,r,i)}}W.empty=new W(U.empty,0,0);function TJ(e,t,n){let{index:r,offset:i}=e.findIndex(t),o=e.maybeChild(r),{index:a,offset:s}=e.findIndex(n);if(i==t||o.isText){if(s!=n&&!e.child(a).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(n))}if(r!=a)throw new RangeError("Removing non-flat range");return e.replaceChild(r,o.copy(TJ(o.content,t-i-1,n-i-1)))}function IJ(e,t,n,r){let{index:i,offset:o}=e.findIndex(t),a=e.maybeChild(i);if(o==t||a.isText)return r&&!r.canReplace(i,i,n)?null:e.cut(0,t).append(n).append(e.cut(t));let s=IJ(a.content,t-o-1,n);return s&&e.replaceChild(i,a.copy(s))}function B4e(e,t,n){if(n.openStart>e.depth)throw new _u("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new _u("Inconsistent open depths");return EJ(e,t,n,0)}function EJ(e,t,n,r){let i=e.index(r),o=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let a=EJ(e,t,n,r+1);return o.copy(o.content.replaceChild(i,a))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let a=e.parent,s=a.content;return tu(a,s.cut(0,e.parentOffset).append(n.content).append(s.cut(t.parentOffset)))}else{let{start:a,end:s}=D4e(n,e);return tu(o,$J(e,a,s,t,r))}else return tu(o,Gv(e,t,r))}function RJ(e,t){if(!t.type.compatibleContent(e.type))throw new _u("Cannot join "+t.type.name+" onto "+e.type.name)}function Lx(e,t,n){let r=e.node(n);return RJ(r,t.node(n)),r}function eu(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function th(e,t,n,r){let i=(t||e).node(n),o=0,a=t?t.index(n):i.childCount;e&&(o=e.index(n),e.depth>n?o++:e.textOffset&&(eu(e.nodeAfter,r),o++));for(let s=o;s<a;s++)eu(i.child(s),r);t&&t.depth==n&&t.textOffset&&eu(t.nodeBefore,r)}function tu(e,t){return e.type.checkContent(t),e.copy(t)}function $J(e,t,n,r,i){let o=e.depth>i&&Lx(e,t,i+1),a=r.depth>i&&Lx(n,r,i+1),s=[];return th(null,e,i,s),o&&a&&t.index(i)==n.index(i)?(RJ(o,a),eu(tu(o,$J(e,t,n,r,i+1)),s)):(o&&eu(tu(o,Gv(e,t,i+1)),s),th(t,n,i,s),a&&eu(tu(a,Gv(n,r,i+1)),s)),th(r,null,i,s),new U(s)}function Gv(e,t,n){let r=[];if(th(null,e,n,r),e.depth>n){let i=Lx(e,t,n+1);eu(tu(i,Gv(e,t,n+1)),r)}return th(t,null,n,r),new U(r)}function D4e(e,t){let n=t.depth-e.openStart,i=t.node(n).copy(e.content);for(let o=n-1;o>=0;o--)i=t.node(o).copy(U.from(i));return{start:i.resolveNoCache(e.openStart+n),end:i.resolveNoCache(i.content.size-e.openEnd-n)}}class Vh{constructor(t,n,r){this.pos=t,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(t){return t==null?this.depth:t<0?this.depth+t:t}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(t){return this.path[this.resolveDepth(t)*3]}index(t){return this.path[this.resolveDepth(t)*3+1]}indexAfter(t){return t=this.resolveDepth(t),this.index(t)+(t==this.depth&&!this.textOffset?0:1)}start(t){return t=this.resolveDepth(t),t==0?0:this.path[t*3-1]+1}end(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size}before(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]}after(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]+this.path[t*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let t=this.parent,n=this.index(this.depth);if(n==t.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=t.child(n);return r?t.child(n).cut(r):i}get nodeBefore(){let t=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(t).cut(0,n):t==0?null:this.parent.child(t-1)}posAtIndex(t,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let o=0;o<t;o++)i+=r.child(o).nodeSize;return i}marks(){let t=this.parent,n=this.index();if(t.content.size==0)return ft.none;if(this.textOffset)return t.child(n).marks;let r=t.maybeChild(n-1),i=t.maybeChild(n);if(!r){let s=r;r=i,i=s}let o=r.marks;for(var a=0;a<o.length;a++)o[a].type.spec.inclusive===!1&&(!i||!o[a].isInSet(i.marks))&&(o=o[a--].removeFromSet(o));return o}marksAcross(t){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=t.parent.maybeChild(t.index());for(var o=0;o<r.length;o++)r[o].type.spec.inclusive===!1&&(!i||!r[o].isInSet(i.marks))&&(r=r[o--].removeFromSet(r));return r}sharedDepth(t){for(let n=this.depth;n>0;n--)if(this.start(n)<=t&&this.end(n)>=t)return n;return 0}blockRange(t=this,n){if(t.pos<this.pos)return t.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==t.pos?1:0);r>=0;r--)if(t.pos<=this.end(r)&&(!n||n(this.node(r))))return new Jv(this,t,r);return null}sameParent(t){return this.pos-this.parentOffset==t.pos-t.parentOffset}max(t){return t.pos>this.pos?t:this}min(t){return t.pos<this.pos?t:this}toString(){let t="";for(let n=1;n<=this.depth;n++)t+=(t?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return t+":"+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,o=n;for(let a=t;;){let{index:s,offset:c}=a.content.findIndex(o),u=o-c;if(r.push(a,s,i+c),!u||(a=a.child(s),a.isText))break;o=u-1,i+=c+1}return new Vh(n,r,o)}static resolveCached(t,n){let r=gD.get(t);if(r)for(let o=0;o<r.elts.length;o++){let a=r.elts[o];if(a.pos==n)return a}else gD.set(t,r=new j4e);let i=r.elts[r.i]=Vh.resolve(t,n);return r.i=(r.i+1)%U4e,i}}class j4e{constructor(){this.elts=[],this.i=0}}const U4e=12,gD=new WeakMap;class Jv{constructor(t,n,r){this.$from=t,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const P4e=Object.create(null);let nu=class Bx{constructor(t,n,r,i=ft.none){this.type=t,this.attrs=n,this.marks=i,this.content=r||U.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(t){return this.content.child(t)}maybeChild(t){return this.content.maybeChild(t)}forEach(t){this.content.forEach(t)}nodesBetween(t,n,r,i=0){this.content.nodesBetween(t,n,r,i,this)}descendants(t){this.nodesBetween(0,this.content.size,t)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(t,n,r,i){return this.content.textBetween(t,n,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(t){return this==t||this.sameMarkup(t)&&this.content.eq(t.content)}sameMarkup(t){return this.hasMarkup(t.type,t.attrs,t.marks)}hasMarkup(t,n,r){return this.type==t&&Yv(this.attrs,n||t.defaultAttrs||P4e)&&ft.sameSet(this.marks,r||ft.none)}copy(t=null){return t==this.content?this:new Bx(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new Bx(this.type,this.attrs,this.content,t)}cut(t,n=this.content.size){return t==0&&n==this.content.size?this:this.copy(this.content.cut(t,n))}slice(t,n=this.content.size,r=!1){if(t==n)return W.empty;let i=this.resolve(t),o=this.resolve(n),a=r?0:i.sharedDepth(n),s=i.start(a),u=i.node(a).content.cut(i.pos-s,o.pos-s);return new W(u,i.depth-a,o.depth-a)}replace(t,n,r){return B4e(this.resolve(t),this.resolve(n),r)}nodeAt(t){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(t);if(n=n.maybeChild(r),!n)return null;if(i==t||n.isText)return n;t-=i+1}}childAfter(t){let{index:n,offset:r}=this.content.findIndex(t);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(t){if(t==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(t);if(r<t)return{node:this.content.child(n),index:n,offset:r};let i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}resolve(t){return Vh.resolveCached(this,t)}resolveNoCache(t){return Vh.resolve(this,t)}rangeHasMark(t,n,r){let i=!1;return n>t&&this.nodesBetween(t,n,o=>(r.isInSet(o.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),kJ(this.marks,t)}contentMatchAt(t){let n=this.type.contentMatch.matchFragment(this.content,0,t);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(t,n,r=U.empty,i=0,o=r.childCount){let a=this.contentMatchAt(t).matchFragment(r,i,o),s=a&&a.matchFragment(this.content,n);if(!s||!s.validEnd)return!1;for(let c=i;c<o;c++)if(!this.type.allowsMarks(r.child(c).marks))return!1;return!0}canReplaceWith(t,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let o=this.contentMatchAt(t).matchType(r),a=o&&o.matchFragment(this.content,n);return a?a.validEnd:!1}canAppend(t){return t.content.size?this.canReplace(this.childCount,this.childCount,t.content):this.type.compatibleContent(t.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let t=ft.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),t=r.addToSet(t)}if(!ft.sameSet(t,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let t={type:this.type.name};for(let n in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map(n=>n.toJSON())),t}static fromJSON(t,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(t.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return t.text(n.text,r)}let i=U.fromJSON(t,n.content),o=t.nodeType(n.type).create(n.attrs,i,r);return o.type.checkAttrs(o.attrs),o}};nu.prototype.text=void 0;class Zv extends nu{constructor(t,n,r,i){if(super(t,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):kJ(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(t,n){return this.text.slice(t,n)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new Zv(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new Zv(this.type,this.attrs,t,this.marks)}cut(t=0,n=this.text.length){return t==0&&n==this.text.length?this:this.withText(this.text.slice(t,n))}eq(t){return this.sameMarkup(t)&&this.text==t.text}toJSON(){let t=super.toJSON();return t.text=this.text,t}}function kJ(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class Tu{constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new N4e(t,n);if(r.next==null)return Tu.empty;let i=OJ(r);r.next&&r.err("Unexpected trailing text");let o=H4e(Q4e(i));return Y4e(o,r),o}matchType(t){for(let n=0;n<this.next.length;n++)if(this.next[n].type==t)return this.next[n].next;return null}matchFragment(t,n=0,r=t.childCount){let i=this;for(let o=n;i&&o<r;o++)i=i.matchType(t.child(o).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let t=0;t<this.next.length;t++){let{type:n}=this.next[t];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(t){for(let n=0;n<this.next.length;n++)for(let r=0;r<t.next.length;r++)if(this.next[n].type==t.next[r].type)return!0;return!1}fillBefore(t,n=!1,r=0){let i=[this];function o(a,s){let c=a.matchFragment(t,r);if(c&&(!n||c.validEnd))return U.from(s.map(u=>u.createAndFill()));for(let u=0;u<a.next.length;u++){let{type:l,next:d}=a.next[u];if(!(l.isText||l.hasRequiredAttrs())&&i.indexOf(d)==-1){i.push(d);let p=o(d,s.concat(l));if(p)return p}}return null}return o(this,[])}findWrapping(t){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==t)return this.wrapCache[r+1];let n=this.computeWrapping(t);return this.wrapCache.push(t,n),n}computeWrapping(t){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),o=i.match;if(o.matchType(t)){let a=[];for(let s=i;s.type;s=s.via)a.push(s.type);return a.reverse()}for(let a=0;a<o.next.length;a++){let{type:s,next:c}=o.next[a];!s.isLeaf&&!s.hasRequiredAttrs()&&!(s.name in n)&&(!i.type||c.validEnd)&&(r.push({match:s.contentMatch,type:s,via:i}),n[s.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(t){if(t>=this.next.length)throw new RangeError(`There's no ${t}th edge in this content match`);return this.next[t]}toString(){let t=[];function n(r){t.push(r);for(let i=0;i<r.next.length;i++)t.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),t.map((r,i)=>{let o=i+(r.validEnd?"*":" ")+" ";for(let a=0;a<r.next.length;a++)o+=(a?", ":"")+r.next[a].type.name+"->"+t.indexOf(r.next[a].next);return o}).join(`
|
|
62
|
+
`)}}Tu.empty=new Tu(!0);class N4e{constructor(t,n){this.string=t,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=t.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(t){return this.next==t&&(this.pos++||!0)}err(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")}}function OJ(e){let t=[];do t.push(W4e(e));while(e.eat("|"));return t.length==1?t[0]:{type:"choice",exprs:t}}function W4e(e){let t=[];do t.push(K4e(e));while(e.next&&e.next!=")"&&e.next!="|");return t.length==1?t[0]:{type:"seq",exprs:t}}function K4e(e){let t=z4e(e);for(;;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else if(e.eat("{"))t=q4e(e,t);else break;return t}function vD(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function q4e(e,t){let n=vD(e),r=n;return e.eat(",")&&(e.next!="}"?r=vD(e):r=-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}function V4e(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let o in n){let a=n[o];a.isInGroup(t)&&i.push(a)}return i.length==0&&e.err("No node type or group '"+t+"' found"),i}function z4e(e){if(e.eat("(")){let t=OJ(e);return e.eat(")")||e.err("Missing closing paren"),t}else if(/\W/.test(e.next))e.err("Unexpected token '"+e.next+"'");else{let t=V4e(e,e.next).map(n=>(e.inline==null?e.inline=n.isInline:e.inline!=n.isInline&&e.err("Mixing inline and block content"),{type:"name",value:n}));return e.pos++,t.length==1?t[0]:{type:"choice",exprs:t}}}function Q4e(e){let t=[[]];return i(o(e,0),n()),t;function n(){return t.push([])-1}function r(a,s,c){let u={term:c,to:s};return t[a].push(u),u}function i(a,s){a.forEach(c=>c.to=s)}function o(a,s){if(a.type=="choice")return a.exprs.reduce((c,u)=>c.concat(o(u,s)),[]);if(a.type=="seq")for(let c=0;;c++){let u=o(a.exprs[c],s);if(c==a.exprs.length-1)return u;i(u,s=n())}else if(a.type=="star"){let c=n();return r(s,c),i(o(a.expr,c),c),[r(c)]}else if(a.type=="plus"){let c=n();return i(o(a.expr,s),c),i(o(a.expr,c),c),[r(c)]}else{if(a.type=="opt")return[r(s)].concat(o(a.expr,s));if(a.type=="range"){let c=s;for(let u=0;u<a.min;u++){let l=n();i(o(a.expr,c),l),c=l}if(a.max==-1)i(o(a.expr,c),c);else for(let u=a.min;u<a.max;u++){let l=n();r(c,l),i(o(a.expr,c),l),c=l}return[r(c)]}else{if(a.type=="name")return[r(s,void 0,a.value)];throw new Error("Unknown expr type")}}}}function MJ(e,t){return t-e}function yD(e,t){let n=[];return r(t),n.sort(MJ);function r(i){let o=e[i];if(o.length==1&&!o[0].term)return r(o[0].to);n.push(i);for(let a=0;a<o.length;a++){let{term:s,to:c}=o[a];!s&&n.indexOf(c)==-1&&r(c)}}}function H4e(e){let t=Object.create(null);return n(yD(e,0));function n(r){let i=[];r.forEach(a=>{e[a].forEach(({term:s,to:c})=>{if(!s)return;let u;for(let l=0;l<i.length;l++)i[l][0]==s&&(u=i[l][1]);yD(e,c).forEach(l=>{u||i.push([s,u=[]]),u.indexOf(l)==-1&&u.push(l)})})});let o=t[r.join(",")]=new Tu(r.indexOf(e.length-1)>-1);for(let a=0;a<i.length;a++){let s=i[a][1].sort(MJ);o.next.push({type:i[a][0],next:t[s.join(",")]||n(s)})}return o}}function Y4e(e,t){for(let n=0,r=[e];n<r.length;n++){let i=r[n],o=!i.validEnd,a=[];for(let s=0;s<i.next.length;s++){let{type:c,next:u}=i.next[s];a.push(c.name),o&&!(c.isText||c.hasRequiredAttrs())&&(o=!1),r.indexOf(u)==-1&&r.push(u)}o&&t.err("Only non-generatable nodes ("+a.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function FJ(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function LJ(e,t){let n=Object.create(null);for(let r in e){let i=t&&t[r];if(i===void 0){let o=e[r];if(o.hasDefault)i=o.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function BJ(e,t,n,r){for(let i in t)if(!(i in e))throw new RangeError(`Unsupported attribute ${i} for ${n} of type ${i}`);for(let i in e){let o=e[i];o.validate&&o.validate(t[i])}}function DJ(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new J4e(e,r,t[r]);return n}let bD=class jJ{constructor(t,n,r){this.name=t,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=DJ(t,r.attrs),this.defaultAttrs=FJ(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||t=="text"),this.isText=t=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Tu.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(t){return this.groups.indexOf(t)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let t in this.attrs)if(this.attrs[t].isRequired)return!0;return!1}compatibleContent(t){return this==t||this.contentMatch.compatible(t.contentMatch)}computeAttrs(t){return!t&&this.defaultAttrs?this.defaultAttrs:LJ(this.attrs,t)}create(t=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new nu(this,this.computeAttrs(t),U.from(n),ft.setFrom(r))}createChecked(t=null,n,r){return n=U.from(n),this.checkContent(n),new nu(this,this.computeAttrs(t),n,ft.setFrom(r))}createAndFill(t=null,n,r){if(t=this.computeAttrs(t),n=U.from(n),n.size){let a=this.contentMatch.fillBefore(n);if(!a)return null;n=a.append(n)}let i=this.contentMatch.matchFragment(n),o=i&&i.fillBefore(U.empty,!0);return o?new nu(this,t,n.append(o),ft.setFrom(r)):null}validContent(t){let n=this.contentMatch.matchFragment(t);if(!n||!n.validEnd)return!1;for(let r=0;r<t.childCount;r++)if(!this.allowsMarks(t.child(r).marks))return!1;return!0}checkContent(t){if(!this.validContent(t))throw new RangeError(`Invalid content for node ${this.name}: ${t.toString().slice(0,50)}`)}checkAttrs(t){BJ(this.attrs,t,"node",this.name)}allowsMarkType(t){return this.markSet==null||this.markSet.indexOf(t)>-1}allowsMarks(t){if(this.markSet==null)return!0;for(let n=0;n<t.length;n++)if(!this.allowsMarkType(t[n].type))return!1;return!0}allowedMarks(t){if(this.markSet==null)return t;let n;for(let r=0;r<t.length;r++)this.allowsMarkType(t[r].type)?n&&n.push(t[r]):n||(n=t.slice(0,r));return n?n.length?n:ft.none:t}static compile(t,n){let r=Object.create(null);t.forEach((o,a)=>r[o]=new jJ(o,n,a));let i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let o in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function G4e(e,t,n){let r=n.split("|");return i=>{let o=i===null?"null":typeof i;if(r.indexOf(o)<0)throw new RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${o}`)}}class J4e{constructor(t,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?G4e(t,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class bS{constructor(t,n,r,i){this.name=t,this.rank=n,this.schema=r,this.spec=i,this.attrs=DJ(t,i.attrs),this.excluded=null;let o=FJ(this.attrs);this.instance=o?new ft(this,o):null}create(t=null){return!t&&this.instance?this.instance:new ft(this,LJ(this.attrs,t))}static compile(t,n){let r=Object.create(null),i=0;return t.forEach((o,a)=>r[o]=new bS(o,i++,n,a)),r}removeFromSet(t){for(var n=0;n<t.length;n++)t[n].type==this&&(t=t.slice(0,n).concat(t.slice(n+1)),n--);return t}isInSet(t){for(let n=0;n<t.length;n++)if(t[n].type==this)return t[n]}checkAttrs(t){BJ(this.attrs,t,"mark",this.name)}excludes(t){return this.excluded.indexOf(t)>-1}}class UJ{constructor(t){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in t)n[i]=t[i];n.nodes=An.from(t.nodes),n.marks=An.from(t.marks||{}),this.nodes=bD.compile(this.spec.nodes,this),this.marks=bS.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let o=this.nodes[i],a=o.spec.content||"",s=o.spec.marks;if(o.contentMatch=r[a]||(r[a]=Tu.parse(a,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!o.isInline||!o.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=o}o.markSet=s=="_"?null:s?SD(this,s.split(" ")):s==""||!o.inlineContent?[]:null}for(let i in this.marks){let o=this.marks[i],a=o.spec.excludes;o.excluded=a==null?[o]:a==""?[]:SD(this,a.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(t,n=null,r,i){if(typeof t=="string")t=this.nodeType(t);else if(t instanceof bD){if(t.schema!=this)throw new RangeError("Node type from different schema used ("+t.name+")")}else throw new RangeError("Invalid node type: "+t);return t.createChecked(n,r,i)}text(t,n){let r=this.nodes.text;return new Zv(r,r.defaultAttrs,t,ft.setFrom(n))}mark(t,n){return typeof t=="string"&&(t=this.marks[t]),t.create(n)}nodeFromJSON(t){return nu.fromJSON(this,t)}markFromJSON(t){return ft.fromJSON(this,t)}nodeType(t){let n=this.nodes[t];if(!n)throw new RangeError("Unknown node type: "+t);return n}}function SD(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],o=e.marks[i],a=o;if(o)n.push(o);else for(let s in e.marks){let c=e.marks[s];(i=="_"||c.spec.group&&c.spec.group.split(" ").indexOf(i)>-1)&&n.push(a=c)}if(!a)throw new SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}function Z4e(e){return e.tag!=null}function X4e(e){return e.style!=null}class ru{constructor(t,n){this.schema=t,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(Z4e(i))this.tags.push(i);else if(X4e(i)){let o=/[^=]*/.exec(i.style)[0];r.indexOf(o)<0&&r.push(o),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let o=t.nodes[i.node];return o.contentMatch.matchType(o)})}parse(t,n={}){let r=new wD(this,n,!1);return r.addAll(t,ft.none,n.from,n.to),r.finish()}parseSlice(t,n={}){let r=new wD(this,n,!0);return r.addAll(t,ft.none,n.from,n.to),W.maxOpen(r.finish())}matchTag(t,n,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let o=this.tags[i];if(nKe(t,o.tag)&&(o.namespace===void 0||t.namespaceURI==o.namespace)&&(!o.context||n.matchesContext(o.context))){if(o.getAttrs){let a=o.getAttrs(t);if(a===!1)continue;o.attrs=a||void 0}return o}}}matchStyle(t,n,r,i){for(let o=i?this.styles.indexOf(i)+1:0;o<this.styles.length;o++){let a=this.styles[o],s=a.style;if(!(s.indexOf(t)!=0||a.context&&!r.matchesContext(a.context)||s.length>t.length&&(s.charCodeAt(t.length)!=61||s.slice(t.length+1)!=n))){if(a.getAttrs){let c=a.getAttrs(n);if(c===!1)continue;a.attrs=c||void 0}return a}}}static schemaRules(t){let n=[];function r(i){let o=i.priority==null?50:i.priority,a=0;for(;a<n.length;a++){let s=n[a];if((s.priority==null?50:s.priority)<o)break}n.splice(a,0,i)}for(let i in t.marks){let o=t.marks[i].spec.parseDOM;o&&o.forEach(a=>{r(a=xD(a)),a.mark||a.ignore||a.clearMark||(a.mark=i)})}for(let i in t.nodes){let o=t.nodes[i].spec.parseDOM;o&&o.forEach(a=>{r(a=xD(a)),a.node||a.ignore||a.mark||(a.node=i)})}return n}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new ru(t,ru.schemaRules(t)))}}const PJ={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},eKe={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},NJ={ol:!0,ul:!0},zh=1,Dx=2,nh=4;function CD(e,t,n){return t!=null?(t?zh:0)|(t==="full"?Dx:0):e&&e.whitespace=="pre"?zh|Dx:n&~nh}class Og{constructor(t,n,r,i,o,a){this.type=t,this.attrs=n,this.marks=r,this.solid=i,this.options=a,this.content=[],this.activeMarks=ft.none,this.match=o||(a&nh?null:t.contentMatch)}findWrapping(t){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(U.from(t));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(t.type))?(this.match=r,i):null}}return this.match.findWrapping(t.type)}finish(t){if(!(this.options&zh)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let o=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-i[0].length))}}let n=U.from(this.content);return!t&&this.match&&(n=n.append(this.match.fillBefore(U.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!PJ.hasOwnProperty(t.parentNode.nodeName.toLowerCase())}}class wD{constructor(t,n,r){this.parser=t,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=n.topNode,o,a=CD(null,n.preserveWhitespace,0)|(r?nh:0);i?o=new Og(i.type,i.attrs,ft.none,!0,n.topMatch||i.type.contentMatch,a):r?o=new Og(null,null,ft.none,!0,null,a):o=new Og(t.schema.topNodeType,null,ft.none,!0,null,a),this.nodes=[o],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(t,n){t.nodeType==3?this.addTextNode(t,n):t.nodeType==1&&this.addElement(t,n)}addTextNode(t,n){let r=t.nodeValue,i=this.top,o=i.options&Dx?"full":this.localPreserveWS||(i.options&zh)>0;if(o==="full"||i.inlineContext(t)||/[^ \t\r\n\u000c]/.test(r)){if(o)o!=="full"?r=r.replace(/\r?\n|\r/g," "):r=r.replace(/\r\n?/g,`
|
|
63
|
+
`);else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let a=i.content[i.content.length-1],s=t.previousSibling;(!a||s&&s.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(r=r.slice(1))}r&&this.insertNode(this.parser.schema.text(r),n),this.findInText(t)}else this.findInside(t)}addElement(t,n,r){let i=this.localPreserveWS,o=this.top;(t.tagName=="PRE"||/pre/.test(t.style&&t.style.whiteSpace))&&(this.localPreserveWS=!0);let a=t.nodeName.toLowerCase(),s;NJ.hasOwnProperty(a)&&this.parser.normalizeLists&&tKe(t);let c=this.options.ruleFromNode&&this.options.ruleFromNode(t)||(s=this.parser.matchTag(t,this,r));e:if(c?c.ignore:eKe.hasOwnProperty(a))this.findInside(t),this.ignoreFallback(t,n);else if(!c||c.skip||c.closeParent){c&&c.closeParent?this.open=Math.max(0,this.open-1):c&&c.skip.nodeType&&(t=c.skip);let u,l=this.needsBlock;if(PJ.hasOwnProperty(a))o.content.length&&o.content[0].isInline&&this.open&&(this.open--,o=this.top),u=!0,o.type||(this.needsBlock=!0);else if(!t.firstChild){this.leafFallback(t,n);break e}let d=c&&c.skip?n:this.readStyles(t,n);d&&this.addAll(t,d),u&&this.sync(o),this.needsBlock=l}else{let u=this.readStyles(t,n);u&&this.addElementByRule(t,c,u,c.consuming===!1?s:void 0)}this.localPreserveWS=i}leafFallback(t,n){t.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(t.ownerDocument.createTextNode(`
|
|
64
|
+
`),n)}ignoreFallback(t,n){t.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n)}readStyles(t,n){let r=t.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let o=this.parser.matchedStyles[i],a=r.getPropertyValue(o);if(a)for(let s=void 0;;){let c=this.parser.matchStyle(o,a,this,s);if(!c)break;if(c.ignore)return null;if(c.clearMark?n=n.filter(u=>!c.clearMark(u)):n=n.concat(this.parser.schema.marks[c.mark].create(c.attrs)),c.consuming===!1)s=c;else break}}return n}addElementByRule(t,n,r,i){let o,a;if(n.node)if(a=this.parser.schema.nodes[n.node],a.isLeaf)this.insertNode(a.create(n.attrs),r)||this.leafFallback(t,r);else{let c=this.enter(a,n.attrs||null,r,n.preserveWhitespace);c&&(o=!0,r=c)}else{let c=this.parser.schema.marks[n.mark];r=r.concat(c.create(n.attrs))}let s=this.top;if(a&&a.isLeaf)this.findInside(t);else if(i)this.addElement(t,r,i);else if(n.getContent)this.findInside(t),n.getContent(t,this.parser.schema).forEach(c=>this.insertNode(c,r));else{let c=t;typeof n.contentElement=="string"?c=t.querySelector(n.contentElement):typeof n.contentElement=="function"?c=n.contentElement(t):n.contentElement&&(c=n.contentElement),this.findAround(t,c,!0),this.addAll(c,r),this.findAround(t,c,!1)}o&&this.sync(s)&&this.open--}addAll(t,n,r,i){let o=r||0;for(let a=r?t.childNodes[r]:t.firstChild,s=i==null?null:t.childNodes[i];a!=s;a=a.nextSibling,++o)this.findAtPoint(t,o),this.addDOM(a,n);this.findAtPoint(t,o)}findPlace(t,n){let r,i;for(let o=this.open;o>=0;o--){let a=this.nodes[o],s=a.findWrapping(t);if(s&&(!r||r.length>s.length)&&(r=s,i=a,!s.length)||a.solid)break}if(!r)return null;this.sync(i);for(let o=0;o<r.length;o++)n=this.enterInner(r[o],null,n,!1);return n}insertNode(t,n){if(t.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(n=this.enterInner(i,null,n))}let r=this.findPlace(t,n);if(r){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(t.type));let o=ft.none;for(let a of r.concat(t.marks))(i.type?i.type.allowsMarkType(a.type):_D(a.type,t.type))&&(o=a.addToSet(o));return i.content.push(t.mark(o)),!0}return!1}enter(t,n,r,i){let o=this.findPlace(t.create(n),r);return o&&(o=this.enterInner(t,n,r,!0,i)),o}enterInner(t,n,r,i=!1,o){this.closeExtra();let a=this.top;a.match=a.match&&a.match.matchType(t);let s=CD(t,o,a.options);a.options&nh&&a.content.length==0&&(s|=nh);let c=ft.none;return r=r.filter(u=>(a.type?a.type.allowsMarkType(u.type):_D(u.type,t))?(c=u.addToSet(c),!1):!0),this.nodes.push(new Og(t,n,c,i,null,s)),this.open++,r}closeExtra(t=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(t));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(t){for(let n=this.open;n>=0;n--){if(this.nodes[n]==t)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=zh)}return!1}get currentPos(){this.closeExtra();let t=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)t+=r[i].nodeSize;n&&t++}return t}findAtPoint(t,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==t&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&t.nodeType==1&&t.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(t,n,r){if(t!=n&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&t.nodeType==1&&t.contains(this.find[i].node)&&n.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==t&&(this.find[n].pos=this.currentPos-(t.nodeValue.length-this.find[n].offset))}matchesContext(t){if(t.indexOf("|")>-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);let n=t.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),o=-(r?r.depth+1:0)+(i?0:1),a=(s,c)=>{for(;s>=0;s--){let u=n[s];if(u==""){if(s==n.length-1||s==0)continue;for(;c>=o;c--)if(a(s-1,c))return!0;return!1}else{let l=c>0||c==0&&i?this.nodes[c].type:r&&c>=o?r.node(c-o).type:null;if(!l||l.name!=u&&!l.isInGroup(u))return!1;c--}}return!0};return a(n.length-1,this.open)}textblockFromContext(){let t=this.options.context;if(t)for(let n=t.depth;n>=0;n--){let r=t.node(n).contentMatchAt(t.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function tKe(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let r=t.nodeType==1?t.nodeName.toLowerCase():null;r&&NJ.hasOwnProperty(r)&&n?(n.appendChild(t),t=n):r=="li"?n=t:r&&(n=null)}}function nKe(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function xD(e){let t={};for(let n in e)t[n]=e[n];return t}function _D(e,t){let n=t.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(e))continue;let o=[],a=s=>{o.push(s);for(let c=0;c<s.edgeCount;c++){let{type:u,next:l}=s.edge(c);if(u==t||o.indexOf(l)<0&&a(l))return!0}};if(a(i.contentMatch))return!0}}class ig{constructor(t,n){this.nodes=t,this.marks=n}serializeFragment(t,n={},r){r||(r=JC(n).createDocumentFragment());let i=r,o=[];return t.forEach(a=>{if(o.length||a.marks.length){let s=0,c=0;for(;s<o.length&&c<a.marks.length;){let u=a.marks[c];if(!this.marks[u.type.name]){c++;continue}if(!u.eq(o[s][0])||u.type.spec.spanning===!1)break;s++,c++}for(;s<o.length;)i=o.pop()[1];for(;c<a.marks.length;){let u=a.marks[c++],l=this.serializeMark(u,a.isInline,n);l&&(o.push([u,i]),i.appendChild(l.dom),i=l.contentDOM||l.dom)}}i.appendChild(this.serializeNodeInner(a,n))}),r}serializeNodeInner(t,n){let{dom:r,contentDOM:i}=Yg(JC(n),this.nodes[t.type.name](t),null,t.attrs);if(i){if(t.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(t.content,n,i)}return r}serializeNode(t,n={}){let r=this.serializeNodeInner(t,n);for(let i=t.marks.length-1;i>=0;i--){let o=this.serializeMark(t.marks[i],t.isInline,n);o&&((o.contentDOM||o.dom).appendChild(r),r=o.dom)}return r}serializeMark(t,n,r={}){let i=this.marks[t.type.name];return i&&Yg(JC(r),i(t,n),null,t.attrs)}static renderSpec(t,n,r=null,i){return Yg(t,n,r,i)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new ig(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(t){let n=TD(t.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(t){return TD(t.marks)}}function TD(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function JC(e){return e.document||window.document}const ID=new WeakMap;function rKe(e){let t=ID.get(e);return t===void 0&&ID.set(e,t=iKe(e)),t}function iKe(e){let t=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")t||(t=[]),t.push(r);else for(let i=0;i<r.length;i++)n(r[i]);else for(let i in r)n(r[i])}return n(e),t}function Yg(e,t,n,r){if(typeof t=="string")return{dom:e.createTextNode(t)};if(t.nodeType!=null)return{dom:t};if(t.dom&&t.dom.nodeType!=null)return t;let i=t[0],o;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(o=rKe(r))&&o.indexOf(t)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let a=i.indexOf(" ");a>0&&(n=i.slice(0,a),i=i.slice(a+1));let s,c=n?e.createElementNS(n,i):e.createElement(i),u=t[1],l=1;if(u&&typeof u=="object"&&u.nodeType==null&&!Array.isArray(u)){l=2;for(let d in u)if(u[d]!=null){let p=d.indexOf(" ");p>0?c.setAttributeNS(d.slice(0,p),d.slice(p+1),u[d]):c.setAttribute(d,u[d])}}for(let d=l;d<t.length;d++){let p=t[d];if(p===0){if(d<t.length-1||d>l)throw new RangeError("Content hole must be the only child of its parent node");return{dom:c,contentDOM:c}}else{let{dom:h,contentDOM:A}=Yg(e,p,n,r);if(c.appendChild(h),A){if(s)throw new RangeError("Multiple content holes");s=A}}}return{dom:c,contentDOM:s}}const WJ=65535,KJ=Math.pow(2,16);function oKe(e,t){return e+t*KJ}function ED(e){return e&WJ}function aKe(e){return(e-(e&WJ))/KJ}const qJ=1,VJ=2,Gg=4,zJ=8;let jx=class{constructor(t,n,r){this.pos=t,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&zJ)>0}get deletedBefore(){return(this.delInfo&(qJ|Gg))>0}get deletedAfter(){return(this.delInfo&(VJ|Gg))>0}get deletedAcross(){return(this.delInfo&Gg)>0}},jd=class Xl{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&Xl.empty)return Xl.empty}recover(t){let n=0,r=ED(t);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+aKe(t)}mapResult(t,n=1){return this._map(t,n,!1)}map(t,n=1){return this._map(t,n,!0)}_map(t,n,r){let i=0,o=this.inverted?2:1,a=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let c=this.ranges[s]-(this.inverted?i:0);if(c>t)break;let u=this.ranges[s+o],l=this.ranges[s+a],d=c+u;if(t<=d){let p=u?t==c?-1:t==d?1:n:n,h=c+i+(p<0?0:l);if(r)return h;let A=t==(n<0?c:d)?null:oKe(s/3,t-c),g=t==c?VJ:t==d?qJ:Gg;return(n<0?t!=c:t!=d)&&(g|=zJ),new jx(h,g,A)}i+=l-u}return r?t+i:new jx(t+i,0,null)}touches(t,n){let r=0,i=ED(n),o=this.inverted?2:1,a=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let c=this.ranges[s]-(this.inverted?r:0);if(c>t)break;let u=this.ranges[s+o],l=c+u;if(t<=l&&s==i*3)return!0;r+=this.ranges[s+a]-u}return!1}forEach(t){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,o=0;i<this.ranges.length;i+=3){let a=this.ranges[i],s=a-(this.inverted?o:0),c=a+(this.inverted?0:o),u=this.ranges[i+n],l=this.ranges[i+r];t(s,s+u,c,c+l),o+=l-u}}invert(){return new Xl(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(t){return t==0?Xl.empty:new Xl(t<0?[0,-t,0]:[0,0,t])}};jd.empty=new jd([]);let sKe=class Jg{constructor(t=[],n,r=0,i=t.length){this.maps=t,this.mirror=n,this.from=r,this.to=i}slice(t=0,n=this.maps.length){return new Jg(this.maps,this.mirror,t,n)}copy(){return new Jg(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(t,n){this.to=this.maps.push(t),n!=null&&this.setMirror(this.maps.length-1,n)}appendMapping(t){for(let n=0,r=this.maps.length;n<t.maps.length;n++){let i=t.getMirror(n);this.appendMap(t.maps[n],i!=null&&i<n?r+i:void 0)}}getMirror(t){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==t)return this.mirror[n+(n%2?-1:1)]}}setMirror(t,n){this.mirror||(this.mirror=[]),this.mirror.push(t,n)}appendMappingInverted(t){for(let n=t.maps.length-1,r=this.maps.length+t.maps.length;n>=0;n--){let i=t.getMirror(n);this.appendMap(t.maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let t=new Jg;return t.appendMappingInverted(this),t}map(t,n=1){if(this.mirror)return this._map(t,n,!0);for(let r=this.from;r<this.to;r++)t=this.maps[r].map(t,n);return t}mapResult(t,n=1){return this._map(t,n,!1)}_map(t,n,r){let i=0;for(let o=this.from;o<this.to;o++){let a=this.maps[o],s=a.mapResult(t,n);if(s.recover!=null){let c=this.getMirror(o);if(c!=null&&c>o&&c<this.to){o=c,t=this.maps[c].recover(s.recover);continue}}i|=s.delInfo,t=s.pos}return r?t:new jx(t,i,null)}};const ZC=Object.create(null);let Mr=class{getMap(){return jd.empty}merge(t){return null}static fromJSON(t,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=ZC[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(t,n)}static jsonID(t,n){if(t in ZC)throw new RangeError("Duplicate use of step JSON ID "+t);return ZC[t]=n,n.prototype.jsonID=t,n}},mr=class Fp{constructor(t,n){this.doc=t,this.failed=n}static ok(t){return new Fp(t,null)}static fail(t){return new Fp(null,t)}static fromReplace(t,n,r,i){try{return Fp.ok(t.replace(n,r,i))}catch(o){if(o instanceof _u)return Fp.fail(o.message);throw o}}};function JF(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let o=e.child(i);o.content.size&&(o=o.copy(JF(o.content,t,o))),o.isInline&&(o=t(o,n,i)),r.push(o)}return U.fromArray(r)}let QJ=class Lp extends Mr{constructor(t,n,r){super(),this.from=t,this.to=n,this.mark=r}apply(t){let n=t.slice(this.from,this.to),r=t.resolve(this.from),i=r.node(r.sharedDepth(this.to)),o=new W(JF(n.content,(a,s)=>!a.isAtom||!s.type.allowsMarkType(this.mark.type)?a:a.mark(this.mark.addToSet(a.marks)),i),n.openStart,n.openEnd);return mr.fromReplace(t,this.from,this.to,o)}invert(){return new HJ(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Lp(n.pos,r.pos,this.mark)}merge(t){return t instanceof Lp&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new Lp(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Lp(n.from,n.to,t.markFromJSON(n.mark))}};Mr.jsonID("addMark",QJ);let HJ=class Bp extends Mr{constructor(t,n,r){super(),this.from=t,this.to=n,this.mark=r}apply(t){let n=t.slice(this.from,this.to),r=new W(JF(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),t),n.openStart,n.openEnd);return mr.fromReplace(t,this.from,this.to,r)}invert(){return new QJ(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Bp(n.pos,r.pos,this.mark)}merge(t){return t instanceof Bp&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new Bp(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Bp(n.from,n.to,t.markFromJSON(n.mark))}};Mr.jsonID("removeMark",HJ);let YJ=class Dp extends Mr{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.nodeAt(this.pos);if(!n)return mr.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return mr.fromReplace(t,this.pos,this.pos+1,new W(U.from(r),0,n.isLeaf?0:1))}invert(t){let n=t.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new Dp(this.pos,n.marks[i]);return new Dp(this.pos,this.mark)}}return new GJ(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new Dp(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Dp(n.pos,t.markFromJSON(n.mark))}};Mr.jsonID("addNodeMark",YJ);let GJ=class Ux extends Mr{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.nodeAt(this.pos);if(!n)return mr.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return mr.fromReplace(t,this.pos,this.pos+1,new W(U.from(r),0,n.isLeaf?0:1))}invert(t){let n=t.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new YJ(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new Ux(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Ux(n.pos,t.markFromJSON(n.mark))}};Mr.jsonID("removeNodeMark",GJ);let JJ=class Pc extends Mr{constructor(t,n,r,i=!1){super(),this.from=t,this.to=n,this.slice=r,this.structure=i}apply(t){return this.structure&&Px(t,this.from,this.to)?mr.fail("Structure replace would overwrite content"):mr.fromReplace(t,this.from,this.to,this.slice)}getMap(){return new jd([this.from,this.to-this.from,this.slice.size])}invert(t){return new Pc(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new Pc(n.pos,Math.max(n.pos,r.pos),this.slice)}merge(t){if(!(t instanceof Pc)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let n=this.slice.size+t.slice.size==0?W.empty:new W(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new Pc(this.from,this.to+(t.to-t.from),n,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let n=this.slice.size+t.slice.size==0?W.empty:new W(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new Pc(t.from,this.to,n,this.structure)}else return null}toJSON(){let t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Pc(n.from,n.to,W.fromJSON(t,n.slice),!!n.structure)}};Mr.jsonID("replace",JJ);let wp=class Zg extends Mr{constructor(t,n,r,i,o,a,s=!1){super(),this.from=t,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=o,this.insert=a,this.structure=s}apply(t){if(this.structure&&(Px(t,this.from,this.gapFrom)||Px(t,this.gapTo,this.to)))return mr.fail("Structure gap-replace would overwrite content");let n=t.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return mr.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?mr.fromReplace(t,this.from,this.to,r):mr.fail("Content does not fit in gap")}getMap(){return new jd([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new Zg(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=t.map(this.gapFrom,-1),o=t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||o>r.pos?null:new Zg(n.pos,r.pos,i,o,this.slice,this.insert,this.structure)}toJSON(){let t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Zg(n.from,n.to,n.gapFrom,n.gapTo,W.fromJSON(t,n.slice),n.insert,!!n.structure)}};Mr.jsonID("replaceAround",wp);function Px(e,t,n){let r=e.resolve(t),i=n-t,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let a=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!a||a.isLeaf)return!0;a=a.firstChild,i--}}return!1}function cKe(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function uKe(e){let n=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let r=e.depth;;--r){let i=e.$from.node(r),o=e.$from.index(r),a=e.$to.indexAfter(r);if(r<e.depth&&i.canReplace(o,a,n))return r;if(r==0||i.type.spec.isolating||!cKe(i,o,a))break}return null}function lKe(e,t,n=null,r=e){let i=dKe(e,t),o=i&&fKe(r,t);return o?i.map(RD).concat({type:t,attrs:n}).concat(o.map(RD)):null}function RD(e){return{type:e,attrs:null}}function dKe(e,t){let{parent:n,startIndex:r,endIndex:i}=e,o=n.contentMatchAt(r).findWrapping(t);if(!o)return null;let a=o.length?o[0]:t;return n.canReplaceWith(r,i,a)?o:null}function fKe(e,t){let{parent:n,startIndex:r,endIndex:i}=e,o=n.child(r),a=t.contentMatch.findWrapping(o.type);if(!a)return null;let c=(a.length?a[a.length-1]:t).contentMatch;for(let u=r;c&&u<i;u++)c=c.matchType(n.child(u).type);return!c||!c.validEnd?null:a}function pKe(e,t,n=1,r){let i=e.resolve(t),o=i.depth-n,a=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!a.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let u=i.depth-1,l=n-2;u>o;u--,l--){let d=i.node(u),p=i.index(u);if(d.type.spec.isolating)return!1;let h=d.content.cutByIndex(p,d.childCount),A=r&&r[l+1];A&&(h=h.replaceChild(0,A.type.create(A.attrs)));let g=r&&r[l]||d;if(!d.canReplace(p+1,d.childCount)||!g.type.validContent(h))return!1}let s=i.indexAfter(o),c=r&&r[0];return i.node(o).canReplaceWith(s,s,c?c.type:i.node(o+1).type)}function hKe(e,t){let n=e.resolve(t),r=n.index();return AKe(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function AKe(e,t){return!!(e&&t&&!e.isLeaf&&e.canAppend(t))}function mKe(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let i=n.content;for(let o=0;o<n.openStart;o++)i=i.firstChild.content;for(let o=1;o<=(n.openStart==0&&n.size?2:1);o++)for(let a=r.depth;a>=0;a--){let s=a==r.depth?0:r.pos<=(r.start(a+1)+r.end(a+1))/2?-1:1,c=r.index(a)+(s>0?1:0),u=r.node(a),l=!1;if(o==1)l=u.canReplace(c,c,i);else{let d=u.contentMatchAt(c).findWrapping(i.firstChild.type);l=d&&u.canReplaceWith(c,c,d[0])}if(l)return s==0?r.pos:s<0?r.before(a+1):r.after(a+1)}return null}let gKe=class Xg extends Mr{constructor(t,n,r){super(),this.pos=t,this.attr=n,this.value=r}apply(t){let n=t.nodeAt(this.pos);if(!n)return mr.fail("No node at attribute step's position");let r=Object.create(null);for(let o in n.attrs)r[o]=n.attrs[o];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return mr.fromReplace(t,this.pos,this.pos+1,new W(U.from(i),0,n.isLeaf?0:1))}getMap(){return jd.empty}invert(t){return new Xg(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new Xg(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Xg(n.pos,n.attr,n.value)}};Mr.jsonID("attr",gKe);let Qh=class extends Error{};Qh=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n};Qh.prototype=Object.create(Error.prototype);Qh.prototype.constructor=Qh;Qh.prototype.name="TransformError";const XC=Object.create(null);class Ee{constructor(t,n,r){this.$anchor=t,this.$head=n,this.ranges=r||[new ZJ(t.min(n),t.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let t=this.ranges;for(let n=0;n<t.length;n++)if(t[n].$from.pos!=t[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(t,n=W.empty){let r=n.content.lastChild,i=null;for(let s=0;s<n.openEnd;s++)i=r,r=r.lastChild;let o=t.steps.length,a=this.ranges;for(let s=0;s<a.length;s++){let{$from:c,$to:u}=a[s],l=t.mapping.slice(o);t.replaceRange(l.map(c.pos),l.map(u.pos),s?W.empty:n),s==0&&OD(t,o,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(t,n){let r=t.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){let{$from:a,$to:s}=i[o],c=t.mapping.slice(r),u=c.map(a.pos),l=c.map(s.pos);o?t.deleteRange(u,l):(t.replaceRangeWith(u,l,n),OD(t,r,n.isInline?-1:1))}}static findFrom(t,n,r=!1){let i=t.parent.inlineContent?new Te(t):ed(t.node(0),t.parent,t.pos,t.index(),n,r);if(i)return i;for(let o=t.depth-1;o>=0;o--){let a=n<0?ed(t.node(0),t.node(o),t.before(o+1),t.index(o),n,r):ed(t.node(0),t.node(o),t.after(o+1),t.index(o)+1,n,r);if(a)return a}return null}static near(t,n=1){return this.findFrom(t,n)||this.findFrom(t,-n)||new Si(t.node(0))}static atStart(t){return ed(t,t,0,0,1)||new Si(t)}static atEnd(t){return ed(t,t,t.content.size,t.childCount,-1)||new Si(t)}static fromJSON(t,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=XC[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(t,n)}static jsonID(t,n){if(t in XC)throw new RangeError("Duplicate use of selection JSON ID "+t);return XC[t]=n,n.prototype.jsonID=t,n}getBookmark(){return Te.between(this.$anchor,this.$head).getBookmark()}}Ee.prototype.visible=!0;class ZJ{constructor(t,n){this.$from=t,this.$to=n}}let $D=!1;function kD(e){!$D&&!e.parent.inlineContent&&($D=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class Te extends Ee{constructor(t,n=t){kD(t),kD(n),super(t,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,n){let r=t.resolve(n.map(this.head));if(!r.parent.inlineContent)return Ee.near(r);let i=t.resolve(n.map(this.anchor));return new Te(i.parent.inlineContent?i:r,r)}replace(t,n=W.empty){if(super.replace(t,n),n==W.empty){let r=this.$from.marksAcross(this.$to);r&&t.ensureMarks(r)}}eq(t){return t instanceof Te&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new SS(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(t,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new Te(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){let i=t.resolve(n);return new this(i,r==n?i:t.resolve(r))}static between(t,n,r){let i=t.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let o=Ee.findFrom(n,r,!0)||Ee.findFrom(n,-r,!0);if(o)n=o.$head;else return Ee.near(n,r)}return t.parent.inlineContent||(i==0?t=n:(t=(Ee.findFrom(t,-r,!0)||Ee.findFrom(t,r,!0)).$anchor,t.pos<n.pos!=i<0&&(t=n))),new Te(t,n)}}Ee.jsonID("text",Te);class SS{constructor(t,n){this.anchor=t,this.head=n}map(t){return new SS(t.map(this.anchor),t.map(this.head))}resolve(t){return Te.between(t.resolve(this.anchor),t.resolve(this.head))}}class ve extends Ee{constructor(t){let n=t.nodeAfter,r=t.node(0).resolve(t.pos+n.nodeSize);super(t,r),this.node=n}map(t,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),o=t.resolve(i);return r?Ee.near(o):new ve(o)}content(){return new W(U.from(this.node),0,0)}eq(t){return t instanceof ve&&t.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new ZF(this.anchor)}static fromJSON(t,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new ve(t.resolve(n.anchor))}static create(t,n){return new ve(t.resolve(n))}static isSelectable(t){return!t.isText&&t.type.spec.selectable!==!1}}ve.prototype.visible=!1;Ee.jsonID("node",ve);class ZF{constructor(t){this.anchor=t}map(t){let{deleted:n,pos:r}=t.mapResult(this.anchor);return n?new SS(r,r):new ZF(r)}resolve(t){let n=t.resolve(this.anchor),r=n.nodeAfter;return r&&ve.isSelectable(r)?new ve(n):Ee.near(n)}}class Si extends Ee{constructor(t){super(t.resolve(0),t.resolve(t.content.size))}replace(t,n=W.empty){if(n==W.empty){t.delete(0,t.doc.content.size);let r=Ee.atStart(t.doc);r.eq(t.selection)||t.setSelection(r)}else super.replace(t,n)}toJSON(){return{type:"all"}}static fromJSON(t){return new Si(t)}map(t){return new Si(t)}eq(t){return t instanceof Si}getBookmark(){return vKe}}Ee.jsonID("all",Si);const vKe={map(){return this},resolve(e){return new Si(e)}};function ed(e,t,n,r,i,o=!1){if(t.inlineContent)return Te.create(e,n);for(let a=r-(i>0?0:1);i>0?a<t.childCount:a>=0;a+=i){let s=t.child(a);if(s.isAtom){if(!o&&ve.isSelectable(s))return ve.create(e,n-(i<0?s.nodeSize:0))}else{let c=ed(e,s,n+i,i<0?s.childCount:0,i,o);if(c)return c}n+=s.nodeSize*i}return null}function OD(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof JJ||i instanceof wp))return;let o=e.mapping.maps[r],a;o.forEach((s,c,u,l)=>{a==null&&(a=l)}),e.setSelection(Ee.near(e.doc.resolve(a),n))}function MD(e,t){return!t||!e?e:e.bind(t)}class Mg{constructor(t,n,r){this.name=t,this.init=MD(n.init,r),this.apply=MD(n.apply,r)}}new Mg("doc",{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new Mg("selection",{init(e,t){return e.selection||Ee.atStart(t.doc)},apply(e){return e.selection}}),new Mg("storedMarks",{init(e){return e.storedMarks||null},apply(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new Mg("scrollToSelection",{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}});function XJ(e,t,n){for(let r in e){let i=e[r];i instanceof Function?i=i.bind(t):r=="handleDOMEvents"&&(i=XJ(i,t,{})),n[r]=i}return n}class kn{constructor(t){this.spec=t,this.props={},t.props&&XJ(t.props,this,this.props),this.key=t.key?t.key.key:eZ("plugin")}getState(t){return t[this.key]}}const ew=Object.create(null);function eZ(e){return e in ew?e+"$"+ ++ew[e]:(ew[e]=0,e+"$")}class Vn{constructor(t="key"){this.key=eZ(t)}get(t){return t.config.pluginsByKey[this.key]}getState(t){return t[this.key]}}const Ml=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},tZ=function(e,t,n,r){return n&&(FD(e,t,n,r,-1)||FD(e,t,n,r,1))},yKe=/^(img|br|input|textarea|hr)$/i;function FD(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:Xv(e))){let o=e.parentNode;if(!o||o.nodeType!=1||XF(e)||yKe.test(e.nodeName)||e.contentEditable=="false")return!1;t=Ml(e)+(i<0?0:1),e=o}else if(e.nodeType==1){if(e=e.childNodes[t+(i<0?-1:0)],e.contentEditable=="false")return!1;t=i<0?Xv(e):0}else return!1}}function Xv(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function bKe(e,t,n){for(let r=t==0,i=t==Xv(e);r||i;){if(e==n)return!0;let o=Ml(e);if(e=e.parentNode,!e)return!1;r=r&&o==0,i=i&&o==Xv(e)}}function XF(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}const nZ=function(e){return e.focusNode&&tZ(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function rZ(e,t){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}const jo=typeof navigator<"u"?navigator:null,LD=typeof document<"u"?document:null,Ec=jo&&jo.userAgent||"",Nx=/Edge\/(\d+)/.exec(Ec),iZ=/MSIE \d/.exec(Ec),Wx=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ec),og=!!(iZ||Wx||Nx),oZ=iZ?document.documentMode:Wx?+Wx[1]:Nx?+Nx[1]:0,CS=!og&&/gecko\/(\d+)/i.test(Ec);CS&&+(/Firefox\/(\d+)/.exec(Ec)||[0,0])[1];const Kx=!og&&/Chrome\/(\d+)/.exec(Ec),Rc=!!Kx,aZ=Kx?+Kx[1]:0,Fl=!og&&!!jo&&/Apple Computer/.test(jo.vendor),eL=Fl&&(/Mobile\/\w+/.test(Ec)||!!jo&&jo.maxTouchPoints>2),gi=eL||(jo?/Mac/.test(jo.platform):!1),SKe=jo?/Win/.test(jo.platform):!1,ag=/Android \d/.test(Ec),tL=!!LD&&"webkitFontSmoothing"in LD.documentElement.style,CKe=tL?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function wKe(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let i=e.docView.nearestDesc(n.focusNode),o=i&&i.size==0,a=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(a<0)return null;let s=r.resolve(a),c,u;if(nZ(n)){for(c=a;i&&!i.node;)i=i.parent;let d=i.node;if(i&&d.isAtom&&ve.isSelectable(d)&&i.parent&&!(d.isInline&&bKe(n.focusNode,n.focusOffset,i.dom))){let p=i.posBefore;u=new ve(a==p?s:r.resolve(p))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=a,p=a;for(let h=0;h<n.rangeCount;h++){let A=n.getRangeAt(h);d=Math.min(d,e.docView.posFromDOM(A.startContainer,A.startOffset,1)),p=Math.max(p,e.docView.posFromDOM(A.endContainer,A.endOffset,-1))}if(d<0)return null;[c,a]=p==e.state.selection.anchor?[p,d]:[d,p],s=r.resolve(a)}else c=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(c<0)return null}let l=r.resolve(c);if(!u){let d=t=="pointer"||e.state.selection.head<s.pos&&!o?1:-1;u=cZ(e,l,s,d)}return u}function sZ(e){return e.editable?e.hasFocus():IKe(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function nL(e,t=!1){let n=e.state.selection;if(TKe(e,n),!!sZ(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&Rc){let r=e.domSelectionRange(),i=e.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&tZ(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){e.input.mouseDown.delayedSelectionSync=!0,e.domObserver.setCurSelection();return}}if(e.domObserver.disconnectSelection(),e.cursorWrapper)_Ke(e);else{let{anchor:r,head:i}=n,o,a;BD&&!(n instanceof Te)&&(n.$from.parent.inlineContent||(o=DD(e,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(a=DD(e,n.to))),e.docView.setSelection(r,i,e,t),BD&&(o&&jD(o),a&&jD(a)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&xKe(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}const BD=Fl||Rc&&aZ<63;function DD(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),i=r<n.childNodes.length?n.childNodes[r]:null,o=r?n.childNodes[r-1]:null;if(Fl&&i&&i.contentEditable=="false")return tw(i);if((!i||i.contentEditable=="false")&&(!o||o.contentEditable=="false")){if(i)return tw(i);if(o)return tw(o)}}function tw(e){return e.contentEditable="true",Fl&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function jD(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function xKe(e){let t=e.dom.ownerDocument;t.removeEventListener("selectionchange",e.input.hideSelectionGuard);let n=e.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;t.addEventListener("selectionchange",e.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(t.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout(()=>{(!sZ(e)||e.state.selection.visible)&&e.dom.classList.remove("ProseMirror-hideselection")},20))})}function _Ke(e){let t=e.domSelection(),n=document.createRange();if(!t)return;let r=e.cursorWrapper.dom,i=r.nodeName=="IMG";i?n.setStart(r.parentNode,Ml(r)+1):n.setStart(r,0),n.collapse(!0),t.removeAllRanges(),t.addRange(n),!i&&!e.state.selection.visible&&og&&oZ<=11&&(r.disabled=!0,r.disabled=!1)}function TKe(e,t){if(t instanceof ve){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(UD(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else UD(e)}function UD(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function cZ(e,t,n,r){return e.someProp("createSelectionBetween",i=>i(e,t,n))||Te.between(t,n,r)}function IKe(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(t.anchorNode.nodeType==3?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(t.focusNode.nodeType==3?t.focusNode.parentNode:t.focusNode))}catch{return!1}}function qx(e,t){let{$anchor:n,$head:r}=e.selection,i=t>0?n.max(r):n.min(r),o=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return o&&Ee.findFrom(o,t)}function vs(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function PD(e,t,n){let r=e.state.selection;if(r instanceof Te)if(n.indexOf("s")>-1){let{$head:i}=r,o=i.textOffset?null:t<0?i.nodeBefore:i.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let a=e.state.doc.resolve(i.pos+o.nodeSize*(t<0?-1:1));return vs(e,new Te(r.$anchor,a))}else if(r.empty){if(e.endOfTextblock(t>0?"forward":"backward")){let i=qx(e.state,t);return i&&i instanceof ve?vs(e,i):!1}else if(!(gi&&n.indexOf("m")>-1)){let i=r.$head,o=i.textOffset?null:t<0?i.nodeBefore:i.nodeAfter,a;if(!o||o.isText)return!1;let s=t<0?i.pos-o.nodeSize:i.pos;return o.isAtom||(a=e.docView.descAt(s))&&!a.contentDOM?ve.isSelectable(o)?vs(e,new ve(t<0?e.state.doc.resolve(i.pos-o.nodeSize):i)):tL?vs(e,new Te(e.state.doc.resolve(t<0?s:s+o.nodeSize))):!1:!1}}else return!1;else{if(r instanceof ve&&r.node.isInline)return vs(e,new Te(t>0?r.$to:r.$from));{let i=qx(e.state,t);return i?vs(e,i):!1}}}function ey(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function rh(e,t){let n=e.pmViewDesc;return n&&n.size==0&&(t<0||e.nextSibling||e.nodeName!="BR")}function Ql(e,t){return t<0?EKe(e):RKe(e)}function EKe(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i,o,a=!1;for(CS&&n.nodeType==1&&r<ey(n)&&rh(n.childNodes[r],-1)&&(a=!0);;)if(r>0){if(n.nodeType!=1)break;{let s=n.childNodes[r-1];if(rh(s,-1))i=n,o=--r;else if(s.nodeType==3)n=s,r=n.nodeValue.length;else break}}else{if(uZ(n))break;{let s=n.previousSibling;for(;s&&rh(s,-1);)i=n.parentNode,o=Ml(s),s=s.previousSibling;if(s)n=s,r=ey(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}}a?Vx(e,n,r):i&&Vx(e,i,o)}function RKe(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i=ey(n),o,a;for(;;)if(r<i){if(n.nodeType!=1)break;let s=n.childNodes[r];if(rh(s,1))o=n,a=++r;else break}else{if(uZ(n))break;{let s=n.nextSibling;for(;s&&rh(s,1);)o=s.parentNode,a=Ml(s)+1,s=s.nextSibling;if(s)n=s,r=0,i=ey(n);else{if(n=n.parentNode,n==e.dom)break;r=i=0}}}o&&Vx(e,o,a)}function uZ(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function $Ke(e,t){for(;e&&t==e.childNodes.length&&!XF(e);)t=Ml(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;e=n,t=0}}function kKe(e,t){for(;e&&!t&&!XF(e);)t=Ml(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;e=n,t=e.childNodes.length}}function Vx(e,t,n){if(t.nodeType!=3){let o,a;(a=$Ke(t,n))?(t=a,n=0):(o=kKe(t,n))&&(t=o,n=o.nodeValue.length)}let r=e.domSelection();if(!r)return;if(nZ(r)){let o=document.createRange();o.setEnd(t,n),o.setStart(t,n),r.removeAllRanges(),r.addRange(o)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:i}=e;setTimeout(()=>{e.state==i&&nL(e)},50)}function ND(e,t){let n=e.state.doc.resolve(t);if(!(Rc||SKe)&&n.parent.inlineContent){let i=e.coordsAtPos(t);if(t>n.start()){let o=e.coordsAtPos(t-1),a=(o.top+o.bottom)/2;if(a>i.top&&a<i.bottom&&Math.abs(o.left-i.left)>1)return o.left<i.left?"ltr":"rtl"}if(t<n.end()){let o=e.coordsAtPos(t+1),a=(o.top+o.bottom)/2;if(a>i.top&&a<i.bottom&&Math.abs(o.left-i.left)>1)return o.left>i.left?"ltr":"rtl"}}return getComputedStyle(e.dom).direction=="rtl"?"rtl":"ltr"}function WD(e,t,n){let r=e.state.selection;if(r instanceof Te&&!r.empty||n.indexOf("s")>-1||gi&&n.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let a=qx(e.state,t);if(a&&a instanceof ve)return vs(e,a)}if(!i.parent.inlineContent){let a=t<0?i:o,s=r instanceof Si?Ee.near(a,t):Ee.findFrom(a,t);return s?vs(e,s):!1}return!1}function KD(e,t){if(!(e.state.selection instanceof Te))return!0;let{$head:n,$anchor:r,empty:i}=e.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let o=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(o&&!o.isText){let a=e.state.tr;return t<0?a.delete(n.pos-o.nodeSize,n.pos):a.delete(n.pos,n.pos+o.nodeSize),e.dispatch(a),!0}return!1}function qD(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function OKe(e){if(!Fl||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&t.nodeType==1&&n==0&&t.firstChild&&t.firstChild.contentEditable=="false"){let r=t.firstChild;qD(e,r,"true"),setTimeout(()=>qD(e,r,"false"),20)}return!1}function MKe(e){let t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}function FKe(e,t){let n=t.keyCode,r=MKe(t);if(n==8||gi&&n==72&&r=="c")return KD(e,-1)||Ql(e,-1);if(n==46&&!t.shiftKey||gi&&n==68&&r=="c")return KD(e,1)||Ql(e,1);if(n==13||n==27)return!0;if(n==37||gi&&n==66&&r=="c"){let i=n==37?ND(e,e.state.selection.from)=="ltr"?-1:1:-1;return PD(e,i,r)||Ql(e,i)}else if(n==39||gi&&n==70&&r=="c"){let i=n==39?ND(e,e.state.selection.from)=="ltr"?1:-1:1;return PD(e,i,r)||Ql(e,i)}else{if(n==38||gi&&n==80&&r=="c")return WD(e,-1,r)||Ql(e,-1);if(n==40||gi&&n==78&&r=="c")return OKe(e)||WD(e,1,r)||Ql(e,1);if(r==(gi?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function lZ(e,t){e.someProp("transformCopied",h=>{t=h(t,e)});let n=[],{content:r,openStart:i,openEnd:o}=t;for(;i>1&&o>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,o--;let h=r.firstChild;n.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let a=e.someProp("clipboardSerializer")||ig.fromSchema(e.state.schema),s=mZ(),c=s.createElement("div");c.appendChild(a.serializeFragment(r,{document:s}));let u=c.firstChild,l,d=0;for(;u&&u.nodeType==1&&(l=AZ[u.nodeName.toLowerCase()]);){for(let h=l.length-1;h>=0;h--){let A=s.createElement(l[h]);for(;c.firstChild;)A.appendChild(c.firstChild);c.appendChild(A),d++}u=c.firstChild}u&&u.nodeType==1&&u.setAttribute("data-pm-slice",`${i} ${o}${d?` -${d}`:""} ${JSON.stringify(n)}`);let p=e.someProp("clipboardTextSerializer",h=>h(t,e))||t.content.textBetween(0,t.content.size,`
|
|
65
|
+
|
|
66
|
+
`);return{dom:c,text:p,slice:t}}function dZ(e,t,n,r,i){let o=i.parent.type.spec.code,a,s;if(!n&&!t)return null;let c=t&&(r||o||!n);if(c){if(e.someProp("transformPastedText",p=>{t=p(t,o||r,e)}),o)return t?new W(U.from(e.state.schema.text(t.replace(/\r\n?/g,`
|
|
67
|
+
`))),0,0):W.empty;let d=e.someProp("clipboardTextParser",p=>p(t,i,r,e));if(d)s=d;else{let p=i.marks(),{schema:h}=e.state,A=ig.fromSchema(h);a=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(g=>{let v=a.appendChild(document.createElement("p"));g&&v.appendChild(A.serializeNode(h.text(g,p)))})}}else e.someProp("transformPastedHTML",d=>{n=d(n,e)}),a=jKe(n),tL&&UKe(a);let u=a&&a.querySelector("[data-pm-slice]"),l=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(l&&l[3])for(let d=+l[3];d>0;d--){let p=a.firstChild;for(;p&&p.nodeType!=1;)p=p.nextSibling;if(!p)break;a=p}if(s||(s=(e.someProp("clipboardParser")||e.someProp("domParser")||ru.fromSchema(e.state.schema)).parseSlice(a,{preserveWhitespace:!!(c||l),context:i,ruleFromNode(p){return p.nodeName=="BR"&&!p.nextSibling&&p.parentNode&&!LKe.test(p.parentNode.nodeName)?{ignore:!0}:null}})),l)s=PKe(VD(s,+l[1],+l[2]),l[4]);else if(s=W.maxOpen(BKe(s.content,i),!0),s.openStart||s.openEnd){let d=0,p=0;for(let h=s.content.firstChild;d<s.openStart&&!h.type.spec.isolating;d++,h=h.firstChild);for(let h=s.content.lastChild;p<s.openEnd&&!h.type.spec.isolating;p++,h=h.lastChild);s=VD(s,d,p)}return e.someProp("transformPasted",d=>{s=d(s,e)}),s}const LKe=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function BKe(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let i=t.node(n).contentMatchAt(t.index(n)),o,a=[];if(e.forEach(s=>{if(!a)return;let c=i.findWrapping(s.type),u;if(!c)return a=null;if(u=a.length&&o.length&&pZ(c,o,s,a[a.length-1],0))a[a.length-1]=u;else{a.length&&(a[a.length-1]=hZ(a[a.length-1],o.length));let l=fZ(s,c);a.push(l),i=i.matchType(l.type),o=c}}),a)return U.from(a)}return e}function fZ(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,U.from(e));return e}function pZ(e,t,n,r,i){if(i<e.length&&i<t.length&&e[i]==t[i]){let o=pZ(e,t,n,r.lastChild,i+1);if(o)return r.copy(r.content.replaceChild(r.childCount-1,o));if(r.contentMatchAt(r.childCount).matchType(i==e.length-1?n.type:e[i+1]))return r.copy(r.content.append(U.from(fZ(n,e,i+1))))}}function hZ(e,t){if(t==0)return e;let n=e.content.replaceChild(e.childCount-1,hZ(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(U.empty,!0);return e.copy(n.append(r))}function zx(e,t,n,r,i,o){let a=t<0?e.firstChild:e.lastChild,s=a.content;return e.childCount>1&&(o=0),i<r-1&&(s=zx(s,t,n,r,i+1,o)),i>=n&&(s=t<0?a.contentMatchAt(0).fillBefore(s,o<=i).append(s):s.append(a.contentMatchAt(a.childCount).fillBefore(U.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,a.copy(s))}function VD(e,t,n){return t<e.openStart&&(e=new W(zx(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new W(zx(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}const AZ={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let zD=null;function mZ(){return zD||(zD=document.implementation.createHTMLDocument("title"))}let nw=null;function DKe(e){let t=window.trustedTypes;return t?(nw||(nw=t.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),nw.createHTML(e)):e}function jKe(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n=mZ().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(e),i;if((i=r&&AZ[r[1].toLowerCase()])&&(e=i.map(o=>"<"+o+">").join("")+e+i.map(o=>"</"+o+">").reverse().join("")),n.innerHTML=DKe(e),i)for(let o=0;o<i.length;o++)n=n.querySelector(i[o])||n;return n}function UKe(e){let t=e.querySelectorAll(Rc?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<t.length;n++){let r=t[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),r)}}function PKe(e,t){if(!e.size)return e;let n=e.content.firstChild.type.schema,r;try{r=JSON.parse(t)}catch{return e}let{content:i,openStart:o,openEnd:a}=e;for(let s=r.length-2;s>=0;s-=2){let c=n.nodes[r[s]];if(!c||c.hasRequiredAttrs())break;i=U.from(c.create(r[s+1],i)),o++,a++}return new W(i,o,a)}const go={},Gr={};function Ts(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}Gr.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=n.keyCode==16||n.shiftKey,!vZ(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!(ag&&Rc&&n.keyCode==13)))if(n.keyCode!=229&&e.domObserver.forceFlush(),eL&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();e.input.lastIOSEnter=r,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==r&&(e.someProp("handleKeyDown",i=>i(e,rZ(13,"Enter"))),e.input.lastIOSEnter=0)},200)}else e.someProp("handleKeyDown",r=>r(e,n))||FKe(e,n)?n.preventDefault():Ts(e,"key")};Gr.keyup=(e,t)=>{t.keyCode==16&&(e.input.shiftKey=!1)};Gr.keypress=(e,t)=>{let n=t;if(vZ(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||gi&&n.metaKey)return;if(e.someProp("handleKeyPress",i=>i(e,n))){n.preventDefault();return}let r=e.state.selection;if(!(r instanceof Te)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode);!/[\r\n]/.test(i)&&!e.someProp("handleTextInput",o=>o(e,r.$from.pos,r.$to.pos,i))&&e.dispatch(e.state.tr.insertText(i).scrollIntoView()),n.preventDefault()}};function wS(e){return{left:e.clientX,top:e.clientY}}function NKe(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}function rL(e,t,n,r,i){if(r==-1)return!1;let o=e.state.doc.resolve(r);for(let a=o.depth+1;a>0;a--)if(e.someProp(t,s=>a>o.depth?s(e,n,o.nodeAfter,o.before(a),i,!0):s(e,n,o.node(a),o.before(a),i,!1)))return!0;return!1}function pd(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);n=="pointer"&&r.setMeta("pointer",!0),e.dispatch(r)}function WKe(e,t){if(t==-1)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return r&&r.isAtom&&ve.isSelectable(r)?(pd(e,new ve(n),"pointer"),!0):!1}function KKe(e,t){if(t==-1)return!1;let n=e.state.selection,r,i;n instanceof ve&&(r=n.node);let o=e.state.doc.resolve(t);for(let a=o.depth+1;a>0;a--){let s=a>o.depth?o.nodeAfter:o.node(a);if(ve.isSelectable(s)){r&&n.$from.depth>0&&a>=n.$from.depth&&o.before(n.$from.depth+1)==n.$from.pos?i=o.before(n.$from.depth):i=o.before(a);break}}return i!=null?(pd(e,ve.create(e.state.doc,i),"pointer"),!0):!1}function qKe(e,t,n,r,i){return rL(e,"handleClickOn",t,n,r)||e.someProp("handleClick",o=>o(e,t,r))||(i?KKe(e,n):WKe(e,n))}function VKe(e,t,n,r){return rL(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",i=>i(e,t,r))}function zKe(e,t,n,r){return rL(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",i=>i(e,t,r))||QKe(e,n,r)}function QKe(e,t,n){if(n.button!=0)return!1;let r=e.state.doc;if(t==-1)return r.inlineContent?(pd(e,Te.create(r,0,r.content.size),"pointer"),!0):!1;let i=r.resolve(t);for(let o=i.depth+1;o>0;o--){let a=o>i.depth?i.nodeAfter:i.node(o),s=i.before(o);if(a.inlineContent)pd(e,Te.create(r,s+1,s+1+a.content.size),"pointer");else if(ve.isSelectable(a))pd(e,ve.create(r,s),"pointer");else continue;return!0}}function iL(e){return ty(e)}const gZ=gi?"metaKey":"ctrlKey";go.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=iL(e),i=Date.now(),o="singleClick";i-e.input.lastClick.time<500&&NKe(n,e.input.lastClick)&&!n[gZ]&&(e.input.lastClick.type=="singleClick"?o="doubleClick":e.input.lastClick.type=="doubleClick"&&(o="tripleClick")),e.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:o};let a=e.posAtCoords(wS(n));a&&(o=="singleClick"?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new HKe(e,a,n,!!r)):(o=="doubleClick"?VKe:zKe)(e,a.pos,a.inside,n)?n.preventDefault():Ts(e,"pointer"))};class HKe{constructor(t,n,r,i){this.view=t,this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=t.state.doc,this.selectNode=!!r[gZ],this.allowDefault=r.shiftKey;let o,a;if(n.inside>-1)o=t.state.doc.nodeAt(n.inside),a=n.inside;else{let l=t.state.doc.resolve(n.pos);o=l.parent,a=l.depth?l.before():0}const s=i?null:r.target,c=s?t.docView.nearestDesc(s,!0):null;this.target=c&&c.dom.nodeType==1?c.dom:null;let{selection:u}=t.state;(r.button==0&&o.type.spec.draggable&&o.type.spec.selectable!==!1||u instanceof ve&&u.from<=a&&u.to>a)&&(this.mightDrag={node:o,pos:a,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&CS&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this)),Ts(t,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>nL(this.view)),this.view.input.mouseDown=null}up(t){if(this.done(),!this.view.dom.contains(t.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(wS(t))),this.updateAllowDefault(t),this.allowDefault||!n?Ts(this.view,"pointer"):qKe(this.view,n.pos,n.inside,t,this.selectNode)?t.preventDefault():t.button==0&&(this.flushed||Fl&&this.mightDrag&&!this.mightDrag.node.isAtom||Rc&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(pd(this.view,Ee.near(this.view.state.doc.resolve(n.pos)),"pointer"),t.preventDefault()):Ts(this.view,"pointer")}move(t){this.updateAllowDefault(t),Ts(this.view,"pointer"),t.buttons==0&&this.done()}updateAllowDefault(t){!this.allowDefault&&(Math.abs(this.event.x-t.clientX)>4||Math.abs(this.event.y-t.clientY)>4)&&(this.allowDefault=!0)}}go.touchstart=e=>{e.input.lastTouch=Date.now(),iL(e),Ts(e,"pointer")};go.touchmove=e=>{e.input.lastTouch=Date.now(),Ts(e,"pointer")};go.contextmenu=e=>iL(e);function vZ(e,t){return e.composing?!0:Fl&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500?(e.input.compositionEndedAt=-2e8,!0):!1}const YKe=ag?5e3:-1;Gr.compositionstart=Gr.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof Te&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))e.markCursor=e.state.storedMarks||n.marks(),ty(e,!0),e.markCursor=null;else if(ty(e,!t.selection.empty),CS&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=e.domSelectionRange();for(let i=r.focusNode,o=r.focusOffset;i&&i.nodeType==1&&o!=0;){let a=o<0?i.lastChild:i.childNodes[o-1];if(!a)break;if(a.nodeType==3){let s=e.domSelection();s&&s.collapse(a,a.nodeValue.length);break}else i=a,o=-1}}e.input.composing=!0}yZ(e,YKe)};Gr.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,yZ(e,20))};function yZ(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>ty(e),t))}function GKe(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=JKe());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function JKe(){let e=document.createEvent("Event");return e.initEvent("event",!0,!0),e.timeStamp}function ty(e,t=!1){if(!(ag&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),GKe(e),t||e.docView&&e.docView.dirty){let n=wKe(e);return n&&!n.eq(e.state.selection)?e.dispatch(e.state.tr.setSelection(n)):(e.markCursor||t)&&!e.state.selection.empty?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}function ZKe(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}const Hh=og&&oZ<15||eL&&CKe<604;go.copy=Gr.cut=(e,t)=>{let n=t,r=e.state.selection,i=n.type=="cut";if(r.empty)return;let o=Hh?null:n.clipboardData,a=r.content(),{dom:s,text:c}=lZ(e,a);o?(n.preventDefault(),o.clearData(),o.setData("text/html",s.innerHTML),o.setData("text/plain",c)):ZKe(e,s),i&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function XKe(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function e8e(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=e.input.shiftKey&&e.input.lastKeyCode!=45;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Qx(e,r.value,null,i,t):Qx(e,r.textContent,r.innerHTML,i,t)},50)}function Qx(e,t,n,r,i){let o=dZ(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",c=>c(e,i,o||W.empty)))return!0;if(!o)return!1;let a=XKe(o),s=a?e.state.tr.replaceSelectionWith(a,r):e.state.tr.replaceSelection(o);return e.dispatch(s.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function bZ(e){let t=e.getData("text/plain")||e.getData("Text");if(t)return t;let n=e.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Gr.paste=(e,t)=>{let n=t;if(e.composing&&!ag)return;let r=Hh?null:n.clipboardData,i=e.input.shiftKey&&e.input.lastKeyCode!=45;r&&Qx(e,bZ(r),r.getData("text/html"),i,n)?n.preventDefault():e8e(e,n)};class t8e{constructor(t,n,r){this.slice=t,this.move=n,this.node=r}}const SZ=gi?"altKey":"ctrlKey";go.dragstart=(e,t)=>{let n=t,r=e.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=e.state.selection,o=i.empty?null:e.posAtCoords(wS(n)),a;if(!(o&&o.pos>=i.from&&o.pos<=(i instanceof ve?i.to-1:i.to))){if(r&&r.mightDrag)a=ve.create(e.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let d=e.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=e.docView&&(a=ve.create(e.state.doc,d.posBefore))}}let s=(a||e.state.selection).content(),{dom:c,text:u,slice:l}=lZ(e,s);(!n.dataTransfer.files.length||!Rc||aZ>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Hh?"Text":"text/html",c.innerHTML),n.dataTransfer.effectAllowed="copyMove",Hh||n.dataTransfer.setData("text/plain",u),e.dragging=new t8e(l,!n[SZ],a)};go.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)};Gr.dragover=Gr.dragenter=(e,t)=>t.preventDefault();Gr.drop=(e,t)=>{let n=t,r=e.dragging;if(e.dragging=null,!n.dataTransfer)return;let i=e.posAtCoords(wS(n));if(!i)return;let o=e.state.doc.resolve(i.pos),a=r&&r.slice;a?e.someProp("transformPasted",A=>{a=A(a,e)}):a=dZ(e,bZ(n.dataTransfer),Hh?null:n.dataTransfer.getData("text/html"),!1,o);let s=!!(r&&!n[SZ]);if(e.someProp("handleDrop",A=>A(e,n,a||W.empty,s))){n.preventDefault();return}if(!a)return;n.preventDefault();let c=a?mKe(e.state.doc,o.pos,a):o.pos;c==null&&(c=o.pos);let u=e.state.tr;if(s){let{node:A}=r;A?A.replace(u):u.deleteSelection()}let l=u.mapping.map(c),d=a.openStart==0&&a.openEnd==0&&a.content.childCount==1,p=u.doc;if(d?u.replaceRangeWith(l,l,a.content.firstChild):u.replaceRange(l,l,a),u.doc.eq(p))return;let h=u.doc.resolve(l);if(d&&ve.isSelectable(a.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(a.content.firstChild))u.setSelection(new ve(h));else{let A=u.mapping.map(c);u.mapping.maps[u.mapping.maps.length-1].forEach((g,v,b,w)=>A=w),u.setSelection(cZ(e,h,u.doc.resolve(A)))}e.focus(),e.dispatch(u.setMeta("uiEvent","drop"))};go.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&nL(e)},20))};go.blur=(e,t)=>{let n=t;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)};go.beforeinput=(e,t)=>{if(Rc&&ag&&t.inputType=="deleteContentBackward"){e.domObserver.flushSoon();let{domChangeCount:r}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=r||(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",o=>o(e,rZ(8,"Backspace")))))return;let{$cursor:i}=e.state.selection;i&&i.pos>0&&e.dispatch(e.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let e in Gr)go[e]=Gr[e];function Yh(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}class ny{constructor(t,n){this.toDOM=t,this.spec=n||iu,this.side=this.spec.side||0}map(t,n,r,i){let{pos:o,deleted:a}=t.mapResult(n.from+i,this.side<0?-1:1);return a?null:new gr(o-r,o-r,this)}valid(){return!0}eq(t){return this==t||t instanceof ny&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&Yh(this.spec,t.spec))}destroy(t){this.spec.destroy&&this.spec.destroy(t)}}class Os{constructor(t,n){this.attrs=t,this.spec=n||iu}map(t,n,r,i){let o=t.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,a=t.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return o>=a?null:new gr(o,a,this)}valid(t,n){return n.from<n.to}eq(t){return this==t||t instanceof Os&&Yh(this.attrs,t.attrs)&&Yh(this.spec,t.spec)}static is(t){return t.type instanceof Os}destroy(){}}let n8e=class CZ{constructor(t,n){this.attrs=t,this.spec=n||iu}map(t,n,r,i){let o=t.mapResult(n.from+i,1);if(o.deleted)return null;let a=t.mapResult(n.to+i,-1);return a.deleted||a.pos<=o.pos?null:new gr(o.pos-r,a.pos-r,this)}valid(t,n){let{index:r,offset:i}=t.content.findIndex(n.from),o;return i==n.from&&!(o=t.child(r)).isText&&i+o.nodeSize==n.to}eq(t){return this==t||t instanceof CZ&&Yh(this.attrs,t.attrs)&&Yh(this.spec,t.spec)}destroy(){}};class gr{constructor(t,n,r){this.from=t,this.to=n,this.type=r}copy(t,n){return new gr(t,n,this.type)}eq(t,n=0){return this.type.eq(t.type)&&this.from+n==t.from&&this.to+n==t.to}map(t,n,r){return this.type.map(t,this,n,r)}static widget(t,n,r){return new gr(t,t,new ny(n,r))}static inline(t,n,r,i){return new gr(t,n,new Os(r,i))}static node(t,n,r,i){return new gr(t,n,new n8e(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof Os}get widget(){return this.type instanceof ny}}const td=[],iu={};class _t{constructor(t,n){this.local=t.length?t:td,this.children=n.length?n:td}static create(t,n){return n.length?ry(n,t,0,iu):Jn}find(t,n,r){let i=[];return this.findInner(t??0,n??1e9,i,0,r),i}findInner(t,n,r,i,o){for(let a=0;a<this.local.length;a++){let s=this.local[a];s.from<=n&&s.to>=t&&(!o||o(s.spec))&&r.push(s.copy(s.from+i,s.to+i))}for(let a=0;a<this.children.length;a+=3)if(this.children[a]<n&&this.children[a+1]>t){let s=this.children[a]+1;this.children[a+2].findInner(t-s,n-s,r,i+s,o)}}map(t,n,r){return this==Jn||t.maps.length==0?this:this.mapInner(t,n,0,0,r||iu)}mapInner(t,n,r,i,o){let a;for(let s=0;s<this.local.length;s++){let c=this.local[s].map(t,r,i);c&&c.type.valid(n,c)?(a||(a=[])).push(c):o.onRemove&&o.onRemove(this.local[s].spec)}return this.children.length?r8e(this.children,a||[],t,n,r,i,o):a?new _t(a.sort(ou),td):Jn}add(t,n){return n.length?this==Jn?_t.create(t,n):this.addInner(t,n,0):this}addInner(t,n,r){let i,o=0;t.forEach((s,c)=>{let u=c+r,l;if(l=xZ(n,s,u)){for(i||(i=this.children.slice());o<i.length&&i[o]<c;)o+=3;i[o]==c?i[o+2]=i[o+2].addInner(s,l,u+1):i.splice(o,0,c,c+s.nodeSize,ry(l,s,u+1,iu)),o+=3}});let a=wZ(o?_Z(n):n,-r);for(let s=0;s<a.length;s++)a[s].type.valid(t,a[s])||a.splice(s--,1);return new _t(a.length?this.local.concat(a).sort(ou):this.local,i||this.children)}remove(t){return t.length==0||this==Jn?this:this.removeInner(t,0)}removeInner(t,n){let r=this.children,i=this.local;for(let o=0;o<r.length;o+=3){let a,s=r[o]+n,c=r[o+1]+n;for(let l=0,d;l<t.length;l++)(d=t[l])&&d.from>s&&d.to<c&&(t[l]=null,(a||(a=[])).push(d));if(!a)continue;r==this.children&&(r=this.children.slice());let u=r[o+2].removeInner(a,s+1);u!=Jn?r[o+2]=u:(r.splice(o,3),o-=3)}if(i.length){for(let o=0,a;o<t.length;o++)if(a=t[o])for(let s=0;s<i.length;s++)i[s].eq(a,n)&&(i==this.local&&(i=this.local.slice()),i.splice(s--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new _t(i,r):Jn}forChild(t,n){if(this==Jn)return this;if(n.isLeaf)return _t.empty;let r,i;for(let s=0;s<this.children.length;s+=3)if(this.children[s]>=t){this.children[s]==t&&(r=this.children[s+2]);break}let o=t+1,a=o+n.content.size;for(let s=0;s<this.local.length;s++){let c=this.local[s];if(c.from<a&&c.to>o&&c.type instanceof Os){let u=Math.max(o,c.from)-o,l=Math.min(a,c.to)-o;u<l&&(i||(i=[])).push(c.copy(u,l))}}if(i){let s=new _t(i.sort(ou),td);return r?new zc([s,r]):s}return r||Jn}eq(t){if(this==t)return!0;if(!(t instanceof _t)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(t.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=t.children[n]||this.children[n+1]!=t.children[n+1]||!this.children[n+2].eq(t.children[n+2]))return!1;return!0}locals(t){return oL(this.localsInner(t))}localsInner(t){if(this==Jn)return td;if(t.inlineContent||!this.local.some(Os.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Os||n.push(this.local[r]);return n}forEachSet(t){t(this)}}_t.empty=new _t([],[]);_t.removeOverlap=oL;const Jn=_t.empty;class zc{constructor(t){this.members=t}map(t,n){const r=this.members.map(i=>i.map(t,n,iu));return zc.from(r)}forChild(t,n){if(n.isLeaf)return _t.empty;let r=[];for(let i=0;i<this.members.length;i++){let o=this.members[i].forChild(t,n);o!=Jn&&(o instanceof zc?r=r.concat(o.members):r.push(o))}return zc.from(r)}eq(t){if(!(t instanceof zc)||t.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(t.members[n]))return!1;return!0}locals(t){let n,r=!0;for(let i=0;i<this.members.length;i++){let o=this.members[i].localsInner(t);if(o.length)if(!n)n=o;else{r&&(n=n.slice(),r=!1);for(let a=0;a<o.length;a++)n.push(o[a])}}return n?oL(r?n:n.sort(ou)):td}static from(t){switch(t.length){case 0:return Jn;case 1:return t[0];default:return new zc(t.every(n=>n instanceof _t)?t:t.reduce((n,r)=>n.concat(r instanceof _t?r:r.members),[]))}}forEachSet(t){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(t)}}function r8e(e,t,n,r,i,o,a){let s=e.slice();for(let u=0,l=o;u<n.maps.length;u++){let d=0;n.maps[u].forEach((p,h,A,g)=>{let v=g-A-(h-p);for(let b=0;b<s.length;b+=3){let w=s[b+1];if(w<0||p>w+l-d)continue;let S=s[b]+l-d;h>=S?s[b+1]=p<=S?-2:-1:p>=l&&v&&(s[b]+=v,s[b+1]+=v)}d+=v}),l=n.maps[u].map(l,-1)}let c=!1;for(let u=0;u<s.length;u+=3)if(s[u+1]<0){if(s[u+1]==-2){c=!0,s[u+1]=-1;continue}let l=n.map(e[u]+o),d=l-i;if(d<0||d>=r.content.size){c=!0;continue}let p=n.map(e[u+1]+o,-1),h=p-i,{index:A,offset:g}=r.content.findIndex(d),v=r.maybeChild(A);if(v&&g==d&&g+v.nodeSize==h){let b=s[u+2].mapInner(n,v,l+1,e[u]+o+1,a);b!=Jn?(s[u]=d,s[u+1]=h,s[u+2]=b):(s[u+1]=-2,c=!0)}else c=!0}if(c){let u=i8e(s,e,t,n,i,o,a),l=ry(u,r,0,a);t=l.local;for(let d=0;d<s.length;d+=3)s[d+1]<0&&(s.splice(d,3),d-=3);for(let d=0,p=0;d<l.children.length;d+=3){let h=l.children[d];for(;p<s.length&&s[p]<h;)p+=3;s.splice(p,0,l.children[d],l.children[d+1],l.children[d+2])}}return new _t(t.sort(ou),s)}function wZ(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let i=e[r];n.push(new gr(i.from+t,i.to+t,i.type))}return n}function i8e(e,t,n,r,i,o,a){function s(c,u){for(let l=0;l<c.local.length;l++){let d=c.local[l].map(r,i,u);d?n.push(d):a.onRemove&&a.onRemove(c.local[l].spec)}for(let l=0;l<c.children.length;l+=3)s(c.children[l+2],c.children[l]+u+1)}for(let c=0;c<e.length;c+=3)e[c+1]==-1&&s(e[c+2],t[c]+o+1);return n}function xZ(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,i=null;for(let o=0,a;o<e.length;o++)(a=e[o])&&a.from>n&&a.to<r&&((i||(i=[])).push(a),e[o]=null);return i}function _Z(e){let t=[];for(let n=0;n<e.length;n++)e[n]!=null&&t.push(e[n]);return t}function ry(e,t,n,r){let i=[],o=!1;t.forEach((s,c)=>{let u=xZ(e,s,c+n);if(u){o=!0;let l=ry(u,s,n+c+1,r);l!=Jn&&i.push(c,c+s.nodeSize,l)}});let a=wZ(o?_Z(e):e,-n).sort(ou);for(let s=0;s<a.length;s++)a[s].type.valid(t,a[s])||(r.onRemove&&r.onRemove(a[s].spec),a.splice(s--,1));return a.length||i.length?new _t(a,i):Jn}function ou(e,t){return e.from-t.from||e.to-t.to}function oL(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let i=n+1;i<t.length;i++){let o=t[i];if(o.from==r.from){o.to!=r.to&&(t==e&&(t=e.slice()),t[i]=o.copy(o.from,r.to),QD(t,i+1,o.copy(r.to,o.to)));continue}else{o.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,o.from),QD(t,i,r.copy(o.from,r.to)));break}}}return t}function QD(e,t,n){for(;t<e.length&&ou(n,e[t])>0;)t++;e.splice(t,0,n)}var zs={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},iy={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},o8e=typeof navigator<"u"&&/Mac/.test(navigator.platform),a8e=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var gn=0;gn<10;gn++)zs[48+gn]=zs[96+gn]=String(gn);for(var gn=1;gn<=24;gn++)zs[gn+111]="F"+gn;for(var gn=65;gn<=90;gn++)zs[gn]=String.fromCharCode(gn+32),iy[gn]=String.fromCharCode(gn);for(var rw in zs)iy.hasOwnProperty(rw)||(iy[rw]=zs[rw]);function s8e(e){var t=o8e&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||a8e&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",n=!t&&e.key||(e.shiftKey?iy:zs)[e.keyCode]||e.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const c8e=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function u8e(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n=="Space"&&(n=" ");let r,i,o,a;for(let s=0;s<t.length-1;s++){let c=t[s];if(/^(cmd|meta|m)$/i.test(c))a=!0;else if(/^a(lt)?$/i.test(c))r=!0;else if(/^(c|ctrl|control)$/i.test(c))i=!0;else if(/^s(hift)?$/i.test(c))o=!0;else if(/^mod$/i.test(c))c8e?a=!0:i=!0;else throw new Error("Unrecognized modifier name: "+c)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),a&&(n="Meta-"+n),o&&(n="Shift-"+n),n}function l8e(e){let t=Object.create(null);for(let n in e)t[u8e(n)]=e[n];return t}function iw(e,t,n=!0){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),n&&t.shiftKey&&(e="Shift-"+e),e}function d8e(e){return new kn({props:{handleKeyDown:TZ(e)}})}function TZ(e){let t=l8e(e);return function(n,r){let i=s8e(r),o,a=t[iw(i,r)];if(a&&a(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let s=t[iw(i,r,!1)];if(s&&s(n.state,n.dispatch,n))return!0}if((r.shiftKey||r.altKey||r.metaKey||i.charCodeAt(0)>127)&&(o=zs[r.keyCode])&&o!=i){let s=t[iw(o,r)];if(s&&s(n.state,n.dispatch,n))return!0}}return!1}}const IZ=65535,EZ=Math.pow(2,16);function f8e(e,t){return e+t*EZ}function HD(e){return e&IZ}function p8e(e){return(e-(e&IZ))/EZ}const RZ=1,$Z=2,ev=4,kZ=8;let YD=class{constructor(t,n,r){this.pos=t,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&kZ)>0}get deletedBefore(){return(this.delInfo&(RZ|ev))>0}get deletedAfter(){return(this.delInfo&($Z|ev))>0}get deletedAcross(){return(this.delInfo&ev)>0}},Iu=class nd{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&nd.empty)return nd.empty}recover(t){let n=0,r=HD(t);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+p8e(t)}mapResult(t,n=1){return this._map(t,n,!1)}map(t,n=1){return this._map(t,n,!0)}_map(t,n,r){let i=0,o=this.inverted?2:1,a=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let c=this.ranges[s]-(this.inverted?i:0);if(c>t)break;let u=this.ranges[s+o],l=this.ranges[s+a],d=c+u;if(t<=d){let p=u?t==c?-1:t==d?1:n:n,h=c+i+(p<0?0:l);if(r)return h;let A=t==(n<0?c:d)?null:f8e(s/3,t-c),g=t==c?$Z:t==d?RZ:ev;return(n<0?t!=c:t!=d)&&(g|=kZ),new YD(h,g,A)}i+=l-u}return r?t+i:new YD(t+i,0,null)}touches(t,n){let r=0,i=HD(n),o=this.inverted?2:1,a=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let c=this.ranges[s]-(this.inverted?r:0);if(c>t)break;let u=this.ranges[s+o],l=c+u;if(t<=l&&s==i*3)return!0;r+=this.ranges[s+a]-u}return!1}forEach(t){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,o=0;i<this.ranges.length;i+=3){let a=this.ranges[i],s=a-(this.inverted?o:0),c=a+(this.inverted?0:o),u=this.ranges[i+n],l=this.ranges[i+r];t(s,s+u,c,c+l),o+=l-u}}invert(){return new nd(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(t){return t==0?nd.empty:new nd(t<0?[0,-t,0]:[0,0,t])}};Iu.empty=new Iu([]);const ow=Object.create(null);let zn=class{getMap(){return Iu.empty}merge(t){return null}static fromJSON(t,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=ow[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(t,n)}static jsonID(t,n){if(t in ow)throw new RangeError("Duplicate use of step JSON ID "+t);return ow[t]=n,n.prototype.jsonID=t,n}},tr=class jp{constructor(t,n){this.doc=t,this.failed=n}static ok(t){return new jp(t,null)}static fail(t){return new jp(null,t)}static fromReplace(t,n,r,i){try{return jp.ok(t.replace(n,r,i))}catch(o){if(o instanceof _u)return jp.fail(o.message);throw o}}};function aL(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let o=e.child(i);o.content.size&&(o=o.copy(aL(o.content,t,o))),o.isInline&&(o=t(o,n,i)),r.push(o)}return U.fromArray(r)}let OZ=class Up extends zn{constructor(t,n,r){super(),this.from=t,this.to=n,this.mark=r}apply(t){let n=t.slice(this.from,this.to),r=t.resolve(this.from),i=r.node(r.sharedDepth(this.to)),o=new W(aL(n.content,(a,s)=>!a.isAtom||!s.type.allowsMarkType(this.mark.type)?a:a.mark(this.mark.addToSet(a.marks)),i),n.openStart,n.openEnd);return tr.fromReplace(t,this.from,this.to,o)}invert(){return new MZ(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Up(n.pos,r.pos,this.mark)}merge(t){return t instanceof Up&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new Up(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Up(n.from,n.to,t.markFromJSON(n.mark))}};zn.jsonID("addMark",OZ);let MZ=class Pp extends zn{constructor(t,n,r){super(),this.from=t,this.to=n,this.mark=r}apply(t){let n=t.slice(this.from,this.to),r=new W(aL(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),t),n.openStart,n.openEnd);return tr.fromReplace(t,this.from,this.to,r)}invert(){return new OZ(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Pp(n.pos,r.pos,this.mark)}merge(t){return t instanceof Pp&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new Pp(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Pp(n.from,n.to,t.markFromJSON(n.mark))}};zn.jsonID("removeMark",MZ);let FZ=class Np extends zn{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.nodeAt(this.pos);if(!n)return tr.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return tr.fromReplace(t,this.pos,this.pos+1,new W(U.from(r),0,n.isLeaf?0:1))}invert(t){let n=t.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new Np(this.pos,n.marks[i]);return new Np(this.pos,this.mark)}}return new LZ(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new Np(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Np(n.pos,t.markFromJSON(n.mark))}};zn.jsonID("addNodeMark",FZ);let LZ=class Hx extends zn{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.nodeAt(this.pos);if(!n)return tr.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return tr.fromReplace(t,this.pos,this.pos+1,new W(U.from(r),0,n.isLeaf?0:1))}invert(t){let n=t.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new FZ(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new Hx(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Hx(n.pos,t.markFromJSON(n.mark))}};zn.jsonID("removeNodeMark",LZ);let BZ=class Nc extends zn{constructor(t,n,r,i=!1){super(),this.from=t,this.to=n,this.slice=r,this.structure=i}apply(t){return this.structure&&Yx(t,this.from,this.to)?tr.fail("Structure replace would overwrite content"):tr.fromReplace(t,this.from,this.to,this.slice)}getMap(){return new Iu([this.from,this.to-this.from,this.slice.size])}invert(t){return new Nc(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new Nc(n.pos,Math.max(n.pos,r.pos),this.slice)}merge(t){if(!(t instanceof Nc)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let n=this.slice.size+t.slice.size==0?W.empty:new W(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new Nc(this.from,this.to+(t.to-t.from),n,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let n=this.slice.size+t.slice.size==0?W.empty:new W(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new Nc(t.from,this.to,n,this.structure)}else return null}toJSON(){let t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Nc(n.from,n.to,W.fromJSON(t,n.slice),!!n.structure)}};zn.jsonID("replace",BZ);let DZ=class tv extends zn{constructor(t,n,r,i,o,a,s=!1){super(),this.from=t,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=o,this.insert=a,this.structure=s}apply(t){if(this.structure&&(Yx(t,this.from,this.gapFrom)||Yx(t,this.gapTo,this.to)))return tr.fail("Structure gap-replace would overwrite content");let n=t.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return tr.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?tr.fromReplace(t,this.from,this.to,r):tr.fail("Content does not fit in gap")}getMap(){return new Iu([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new tv(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:t.map(this.gapFrom,-1),o=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||o>r.pos?null:new tv(n.pos,r.pos,i,o,this.slice,this.insert,this.structure)}toJSON(){let t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new tv(n.from,n.to,n.gapFrom,n.gapTo,W.fromJSON(t,n.slice),n.insert,!!n.structure)}};zn.jsonID("replaceAround",DZ);function Yx(e,t,n){let r=e.resolve(t),i=n-t,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let a=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!a||a.isLeaf)return!0;a=a.firstChild,i--}}return!1}function h8e(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function A8e(e){let n=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let r=e.depth;;--r){let i=e.$from.node(r),o=e.$from.index(r),a=e.$to.indexAfter(r);if(r<e.depth&&i.canReplace(o,a,n))return r;if(r==0||i.type.spec.isolating||!h8e(i,o,a))break}return null}function m8e(e,t,n=null,r=e){let i=g8e(e,t),o=i&&v8e(r,t);return o?i.map(GD).concat({type:t,attrs:n}).concat(o.map(GD)):null}function GD(e){return{type:e,attrs:null}}function g8e(e,t){let{parent:n,startIndex:r,endIndex:i}=e,o=n.contentMatchAt(r).findWrapping(t);if(!o)return null;let a=o.length?o[0]:t;return n.canReplaceWith(r,i,a)?o:null}function v8e(e,t){let{parent:n,startIndex:r,endIndex:i}=e,o=n.child(r),a=t.contentMatch.findWrapping(o.type);if(!a)return null;let c=(a.length?a[a.length-1]:t).contentMatch;for(let u=r;c&&u<i;u++)c=c.matchType(n.child(u).type);return!c||!c.validEnd?null:a}function nv(e,t,n=1,r){let i=e.resolve(t),o=i.depth-n,a=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!a.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let u=i.depth-1,l=n-2;u>o;u--,l--){let d=i.node(u),p=i.index(u);if(d.type.spec.isolating)return!1;let h=d.content.cutByIndex(p,d.childCount),A=r&&r[l+1];A&&(h=h.replaceChild(0,A.type.create(A.attrs)));let g=r&&r[l]||d;if(!d.canReplace(p+1,d.childCount)||!g.type.validContent(h))return!1}let s=i.indexAfter(o),c=r&&r[0];return i.node(o).canReplaceWith(s,s,c?c.type:i.node(o+1).type)}function sL(e,t){let n=e.resolve(t),r=n.index();return jZ(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function y8e(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let i=0;i<t.childCount;i++){let o=t.child(i),a=o.type==r?e.type.schema.nodes.text:o.type;if(n=n.matchType(a),!n||!e.type.allowsMarks(o.marks))return!1}return n.validEnd}function jZ(e,t){return!!(e&&t&&!e.isLeaf&&y8e(e,t))}function UZ(e,t,n=-1){let r=e.resolve(t);for(let i=r.depth;;i--){let o,a,s=r.index(i);if(i==r.depth?(o=r.nodeBefore,a=r.nodeAfter):n>0?(o=r.node(i+1),s++,a=r.node(i).maybeChild(s)):(o=r.node(i).maybeChild(s-1),a=r.node(i+1)),o&&!o.isTextblock&&jZ(o,a)&&r.node(i).canReplace(s,s+1))return t;if(i==0)break;t=n<0?r.before(i):r.after(i)}}let b8e=class rv extends zn{constructor(t,n,r){super(),this.pos=t,this.attr=n,this.value=r}apply(t){let n=t.nodeAt(this.pos);if(!n)return tr.fail("No node at attribute step's position");let r=Object.create(null);for(let o in n.attrs)r[o]=n.attrs[o];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return tr.fromReplace(t,this.pos,this.pos+1,new W(U.from(i),0,n.isLeaf?0:1))}getMap(){return Iu.empty}invert(t){return new rv(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new rv(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new rv(n.pos,n.attr,n.value)}};zn.jsonID("attr",b8e);let S8e=class Gx extends zn{constructor(t,n){super(),this.attr=t,this.value=n}apply(t){let n=Object.create(null);for(let i in t.attrs)n[i]=t.attrs[i];n[this.attr]=this.value;let r=t.type.create(n,t.content,t.marks);return tr.ok(r)}getMap(){return Iu.empty}invert(t){return new Gx(this.attr,t.attrs[this.attr])}map(t){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Gx(n.attr,n.value)}};zn.jsonID("docAttr",S8e);let Gh=class extends Error{};Gh=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n};Gh.prototype=Object.create(Error.prototype);Gh.prototype.constructor=Gh;Gh.prototype.name="TransformError";const PZ=65535,NZ=Math.pow(2,16);function C8e(e,t){return e+t*NZ}function JD(e){return e&PZ}function w8e(e){return(e-(e&PZ))/NZ}const WZ=1,KZ=2,iv=4,qZ=8;let ZD=class{constructor(t,n,r){this.pos=t,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&qZ)>0}get deletedBefore(){return(this.delInfo&(WZ|iv))>0}get deletedAfter(){return(this.delInfo&(KZ|iv))>0}get deletedAcross(){return(this.delInfo&iv)>0}},Eu=class rd{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&rd.empty)return rd.empty}recover(t){let n=0,r=JD(t);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+w8e(t)}mapResult(t,n=1){return this._map(t,n,!1)}map(t,n=1){return this._map(t,n,!0)}_map(t,n,r){let i=0,o=this.inverted?2:1,a=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let c=this.ranges[s]-(this.inverted?i:0);if(c>t)break;let u=this.ranges[s+o],l=this.ranges[s+a],d=c+u;if(t<=d){let p=u?t==c?-1:t==d?1:n:n,h=c+i+(p<0?0:l);if(r)return h;let A=t==(n<0?c:d)?null:C8e(s/3,t-c),g=t==c?KZ:t==d?WZ:iv;return(n<0?t!=c:t!=d)&&(g|=qZ),new ZD(h,g,A)}i+=l-u}return r?t+i:new ZD(t+i,0,null)}touches(t,n){let r=0,i=JD(n),o=this.inverted?2:1,a=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let c=this.ranges[s]-(this.inverted?r:0);if(c>t)break;let u=this.ranges[s+o],l=c+u;if(t<=l&&s==i*3)return!0;r+=this.ranges[s+a]-u}return!1}forEach(t){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,o=0;i<this.ranges.length;i+=3){let a=this.ranges[i],s=a-(this.inverted?o:0),c=a+(this.inverted?0:o),u=this.ranges[i+n],l=this.ranges[i+r];t(s,s+u,c,c+l),o+=l-u}}invert(){return new rd(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(t){return t==0?rd.empty:new rd(t<0?[0,-t,0]:[0,0,t])}};Eu.empty=new Eu([]);const aw=Object.create(null);let Qn=class{getMap(){return Eu.empty}merge(t){return null}static fromJSON(t,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=aw[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(t,n)}static jsonID(t,n){if(t in aw)throw new RangeError("Duplicate use of step JSON ID "+t);return aw[t]=n,n.prototype.jsonID=t,n}},nr=class Wp{constructor(t,n){this.doc=t,this.failed=n}static ok(t){return new Wp(t,null)}static fail(t){return new Wp(null,t)}static fromReplace(t,n,r,i){try{return Wp.ok(t.replace(n,r,i))}catch(o){if(o instanceof _u)return Wp.fail(o.message);throw o}}};function cL(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let o=e.child(i);o.content.size&&(o=o.copy(cL(o.content,t,o))),o.isInline&&(o=t(o,n,i)),r.push(o)}return U.fromArray(r)}let VZ=class Kp extends Qn{constructor(t,n,r){super(),this.from=t,this.to=n,this.mark=r}apply(t){let n=t.slice(this.from,this.to),r=t.resolve(this.from),i=r.node(r.sharedDepth(this.to)),o=new W(cL(n.content,(a,s)=>!a.isAtom||!s.type.allowsMarkType(this.mark.type)?a:a.mark(this.mark.addToSet(a.marks)),i),n.openStart,n.openEnd);return nr.fromReplace(t,this.from,this.to,o)}invert(){return new zZ(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Kp(n.pos,r.pos,this.mark)}merge(t){return t instanceof Kp&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new Kp(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Kp(n.from,n.to,t.markFromJSON(n.mark))}};Qn.jsonID("addMark",VZ);let zZ=class qp extends Qn{constructor(t,n,r){super(),this.from=t,this.to=n,this.mark=r}apply(t){let n=t.slice(this.from,this.to),r=new W(cL(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),t),n.openStart,n.openEnd);return nr.fromReplace(t,this.from,this.to,r)}invert(){return new VZ(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new qp(n.pos,r.pos,this.mark)}merge(t){return t instanceof qp&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new qp(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new qp(n.from,n.to,t.markFromJSON(n.mark))}};Qn.jsonID("removeMark",zZ);let QZ=class Vp extends Qn{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.nodeAt(this.pos);if(!n)return nr.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return nr.fromReplace(t,this.pos,this.pos+1,new W(U.from(r),0,n.isLeaf?0:1))}invert(t){let n=t.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new Vp(this.pos,n.marks[i]);return new Vp(this.pos,this.mark)}}return new HZ(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new Vp(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Vp(n.pos,t.markFromJSON(n.mark))}};Qn.jsonID("addNodeMark",QZ);let HZ=class Jx extends Qn{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.nodeAt(this.pos);if(!n)return nr.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return nr.fromReplace(t,this.pos,this.pos+1,new W(U.from(r),0,n.isLeaf?0:1))}invert(t){let n=t.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new QZ(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new Jx(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Jx(n.pos,t.markFromJSON(n.mark))}};Qn.jsonID("removeNodeMark",HZ);let xS=class Wc extends Qn{constructor(t,n,r,i=!1){super(),this.from=t,this.to=n,this.slice=r,this.structure=i}apply(t){return this.structure&&Zx(t,this.from,this.to)?nr.fail("Structure replace would overwrite content"):nr.fromReplace(t,this.from,this.to,this.slice)}getMap(){return new Eu([this.from,this.to-this.from,this.slice.size])}invert(t){return new Wc(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new Wc(n.pos,Math.max(n.pos,r.pos),this.slice)}merge(t){if(!(t instanceof Wc)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let n=this.slice.size+t.slice.size==0?W.empty:new W(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new Wc(this.from,this.to+(t.to-t.from),n,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let n=this.slice.size+t.slice.size==0?W.empty:new W(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new Wc(t.from,this.to,n,this.structure)}else return null}toJSON(){let t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Wc(n.from,n.to,W.fromJSON(t,n.slice),!!n.structure)}};Qn.jsonID("replace",xS);let oy=class ov extends Qn{constructor(t,n,r,i,o,a,s=!1){super(),this.from=t,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=o,this.insert=a,this.structure=s}apply(t){if(this.structure&&(Zx(t,this.from,this.gapFrom)||Zx(t,this.gapTo,this.to)))return nr.fail("Structure gap-replace would overwrite content");let n=t.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return nr.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?nr.fromReplace(t,this.from,this.to,r):nr.fail("Content does not fit in gap")}getMap(){return new Eu([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new ov(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:t.map(this.gapFrom,-1),o=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||o>r.pos?null:new ov(n.pos,r.pos,i,o,this.slice,this.insert,this.structure)}toJSON(){let t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new ov(n.from,n.to,n.gapFrom,n.gapTo,W.fromJSON(t,n.slice),n.insert,!!n.structure)}};Qn.jsonID("replaceAround",oy);function Zx(e,t,n){let r=e.resolve(t),i=n-t,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let a=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!a||a.isLeaf)return!0;a=a.firstChild,i--}}return!1}function x8e(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function _S(e){let n=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let r=e.depth;;--r){let i=e.$from.node(r),o=e.$from.index(r),a=e.$to.indexAfter(r);if(r<e.depth&&i.canReplace(o,a,n))return r;if(r==0||i.type.spec.isolating||!x8e(i,o,a))break}return null}function _8e(e,t,n=null,r=e){let i=T8e(e,t),o=i&&I8e(r,t);return o?i.map(XD).concat({type:t,attrs:n}).concat(o.map(XD)):null}function XD(e){return{type:e,attrs:null}}function T8e(e,t){let{parent:n,startIndex:r,endIndex:i}=e,o=n.contentMatchAt(r).findWrapping(t);if(!o)return null;let a=o.length?o[0]:t;return n.canReplaceWith(r,i,a)?o:null}function I8e(e,t){let{parent:n,startIndex:r,endIndex:i}=e,o=n.child(r),a=t.contentMatch.findWrapping(o.type);if(!a)return null;let c=(a.length?a[a.length-1]:t).contentMatch;for(let u=r;c&&u<i;u++)c=c.matchType(n.child(u).type);return!c||!c.validEnd?null:a}function E8e(e,t,n=1,r){let i=e.resolve(t),o=i.depth-n,a=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!a.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let u=i.depth-1,l=n-2;u>o;u--,l--){let d=i.node(u),p=i.index(u);if(d.type.spec.isolating)return!1;let h=d.content.cutByIndex(p,d.childCount),A=r&&r[l+1];A&&(h=h.replaceChild(0,A.type.create(A.attrs)));let g=r&&r[l]||d;if(!d.canReplace(p+1,d.childCount)||!g.type.validContent(h))return!1}let s=i.indexAfter(o),c=r&&r[0];return i.node(o).canReplaceWith(s,s,c?c.type:i.node(o+1).type)}function TS(e,t){let n=e.resolve(t),r=n.index();return YZ(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function R8e(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let i=0;i<t.childCount;i++){let o=t.child(i),a=o.type==r?e.type.schema.nodes.text:o.type;if(n=n.matchType(a),!n||!e.type.allowsMarks(o.marks))return!1}return n.validEnd}function YZ(e,t){return!!(e&&t&&!e.isLeaf&&R8e(e,t))}function GZ(e,t,n=-1){let r=e.resolve(t);for(let i=r.depth;;i--){let o,a,s=r.index(i);if(i==r.depth?(o=r.nodeBefore,a=r.nodeAfter):n>0?(o=r.node(i+1),s++,a=r.node(i).maybeChild(s)):(o=r.node(i).maybeChild(s-1),a=r.node(i+1)),o&&!o.isTextblock&&YZ(o,a)&&r.node(i).canReplace(s,s+1))return t;if(i==0)break;t=n<0?r.before(i):r.after(i)}}function uL(e,t,n=t,r=W.empty){if(t==n&&!r.size)return null;let i=e.resolve(t),o=e.resolve(n);return $8e(i,o,r)?new xS(t,n,r):new k8e(i,o,r).fit()}function $8e(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}let k8e=class{constructor(t,n,r){this.$from=t,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=U.empty;for(let i=0;i<=t.depth;i++){let o=t.node(i);this.frontier.push({type:o.type,match:o.contentMatchAt(t.indexAfter(i))})}for(let i=t.depth;i>0;i--)this.placed=U.from(t.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let u=this.findFittable();u?this.placeNodes(u):this.openMore()||this.dropNode()}let t=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(t<0?this.$to:r.doc.resolve(t));if(!i)return null;let o=this.placed,a=r.depth,s=i.depth;for(;a&&s&&o.childCount==1;)o=o.firstChild.content,a--,s--;let c=new W(o,a,s);return t>-1?new oy(r.pos,t,this.$to.pos,this.$to.end(),c,n):c.size||r.pos!=this.$to.pos?new xS(r.pos,i.pos,c):null}findFittable(){let t=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<t;r++){let o=n.firstChild;if(n.childCount>1&&(i=0),o.type.spec.isolating&&i<=r){t=r;break}n=o.content}for(let n=1;n<=2;n++)for(let r=n==1?t:this.unplaced.openStart;r>=0;r--){let i,o=null;r?(o=sw(this.unplaced.content,r-1).firstChild,i=o.content):i=this.unplaced.content;let a=i.firstChild;for(let s=this.depth;s>=0;s--){let{type:c,match:u}=this.frontier[s],l,d=null;if(n==1&&(a?u.matchType(a.type)||(d=u.fillBefore(U.from(a),!1)):o&&c.compatibleContent(o.type)))return{sliceDepth:r,frontierDepth:s,parent:o,inject:d};if(n==2&&a&&(l=u.findWrapping(a.type)))return{sliceDepth:r,frontierDepth:s,parent:o,wrap:l};if(o&&u.matchType(o.type))break}}}openMore(){let{content:t,openStart:n,openEnd:r}=this.unplaced,i=sw(t,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new W(t,n+1,Math.max(r,i.size+n>=t.size-r?n+1:0)),!0)}dropNode(){let{content:t,openStart:n,openEnd:r}=this.unplaced,i=sw(t,n);if(i.childCount<=1&&n>0){let o=t.size-n<=n+i.size;this.unplaced=new W(zp(t,n-1,1),n-1,o?n-1:r)}else this.unplaced=new W(zp(t,n,1),n,r)}placeNodes({sliceDepth:t,frontierDepth:n,parent:r,inject:i,wrap:o}){for(;this.depth>n;)this.closeFrontierNode();if(o)for(let g=0;g<o.length;g++)this.openFrontierNode(o[g]);let a=this.unplaced,s=r?r.content:a.content,c=a.openStart-t,u=0,l=[],{match:d,type:p}=this.frontier[n];if(i){for(let g=0;g<i.childCount;g++)l.push(i.child(g));d=d.matchFragment(i)}let h=s.size+t-(a.content.size-a.openEnd);for(;u<s.childCount;){let g=s.child(u),v=d.matchType(g.type);if(!v)break;u++,(u>1||c==0||g.content.size)&&(d=v,l.push(JZ(g.mark(p.allowedMarks(g.marks)),u==1?c:0,u==s.childCount?h:-1)))}let A=u==s.childCount;A||(h=-1),this.placed=Qp(this.placed,n,U.from(l)),this.frontier[n].match=d,A&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,v=s;g<h;g++){let b=v.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),v=b.content}this.unplaced=A?t==0?W.empty:new W(zp(a.content,t-1,1),t-1,h<0?a.openEnd:t-1):new W(zp(a.content,t,u),a.openStart,a.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let t=this.frontier[this.depth],n;if(!t.type.isTextblock||!cw(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(t){e:for(let n=Math.min(this.depth,t.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],o=n<t.depth&&t.end(n+1)==t.pos+(t.depth-(n+1)),a=cw(t,n,i,r,o);if(a){for(let s=n-1;s>=0;s--){let{match:c,type:u}=this.frontier[s],l=cw(t,s,u,c,!0);if(!l||l.childCount)continue e}return{depth:n,fit:a,move:o?t.doc.resolve(t.after(n+1)):t}}}}close(t){let n=this.findCloseLevel(t);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=Qp(this.placed,n.depth,n.fit)),t=n.move;for(let r=n.depth+1;r<=t.depth;r++){let i=t.node(r),o=i.type.contentMatch.fillBefore(i.content,!0,t.index(r));this.openFrontierNode(i.type,i.attrs,o)}return t}openFrontierNode(t,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(t),this.placed=Qp(this.placed,this.depth,U.from(t.create(n,r))),this.frontier.push({type:t,match:t.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(U.empty,!0);n.childCount&&(this.placed=Qp(this.placed,this.frontier.length,n))}};function zp(e,t,n){return t==0?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(zp(e.firstChild.content,t-1,n)))}function Qp(e,t,n){return t==0?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(Qp(e.lastChild.content,t-1,n)))}function sw(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function JZ(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,JZ(r.firstChild,t-1,r.childCount==1?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(U.empty,!0)))),e.copy(r)}function cw(e,t,n,r,i){let o=e.node(t),a=i?e.indexAfter(t):e.index(t);if(a==o.childCount&&!n.compatibleContent(o.type))return null;let s=r.fillBefore(o.content,!0,a);return s&&!O8e(n,o.content,a)?s:null}function O8e(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}let M8e=class av extends Qn{constructor(t,n,r){super(),this.pos=t,this.attr=n,this.value=r}apply(t){let n=t.nodeAt(this.pos);if(!n)return nr.fail("No node at attribute step's position");let r=Object.create(null);for(let o in n.attrs)r[o]=n.attrs[o];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return nr.fromReplace(t,this.pos,this.pos+1,new W(U.from(i),0,n.isLeaf?0:1))}getMap(){return Eu.empty}invert(t){return new av(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new av(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new av(n.pos,n.attr,n.value)}};Qn.jsonID("attr",M8e);let F8e=class Xx extends Qn{constructor(t,n){super(),this.attr=t,this.value=n}apply(t){let n=Object.create(null);for(let i in t.attrs)n[i]=t.attrs[i];n[this.attr]=this.value;let r=t.type.create(n,t.content,t.marks);return nr.ok(r)}getMap(){return Eu.empty}invert(t){return new Xx(this.attr,t.attrs[this.attr])}map(t){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Xx(n.attr,n.value)}};Qn.jsonID("docAttr",F8e);let Jh=class extends Error{};Jh=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n};Jh.prototype=Object.create(Error.prototype);Jh.prototype.constructor=Jh;Jh.prototype.name="TransformError";const L8e=(e,t)=>e.selection.empty?!1:(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function ZZ(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}const B8e=(e,t,n)=>{let r=ZZ(e,n);if(!r)return!1;let i=lL(r);if(!i){let a=r.blockRange(),s=a&&_S(a);return s==null?!1:(t&&t(e.tr.lift(a,s).scrollIntoView()),!0)}let o=i.nodeBefore;if(nX(e,i,t,-1))return!0;if(r.parent.content.size==0&&(Ud(o,"end")||ve.isSelectable(o)))for(let a=r.depth;;a--){let s=uL(e.doc,r.before(a),r.after(a),W.empty);if(s&&s.slice.size<s.to-s.from){if(t){let c=e.tr.step(s);c.setSelection(Ud(o,"end")?Ee.findFrom(c.doc.resolve(c.mapping.map(i.pos,-1)),-1):ve.create(c.doc,i.pos-o.nodeSize)),t(c.scrollIntoView())}return!0}if(a==1||r.node(a-1).childCount>1)break}return o.isAtom&&i.depth==r.depth-1?(t&&t(e.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0):!1},D8e=(e,t,n)=>{let r=ZZ(e,n);if(!r)return!1;let i=lL(r);return i?XZ(e,i,t):!1},j8e=(e,t,n)=>{let r=eX(e,n);if(!r)return!1;let i=dL(r);return i?XZ(e,i,t):!1};function XZ(e,t,n){let r=t.nodeBefore,i=r,o=t.pos-1;for(;!i.isTextblock;o--){if(i.type.spec.isolating)return!1;let l=i.lastChild;if(!l)return!1;i=l}let a=t.nodeAfter,s=a,c=t.pos+1;for(;!s.isTextblock;c++){if(s.type.spec.isolating)return!1;let l=s.firstChild;if(!l)return!1;s=l}let u=uL(e.doc,o,c,W.empty);if(!u||u.from!=o||u instanceof xS&&u.slice.size>=c-o)return!1;if(n){let l=e.tr.step(u);l.setSelection(Te.create(l.doc,o)),n(l.scrollIntoView())}return!0}function Ud(e,t,n=!1){for(let r=e;r;r=t=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const U8e=(e,t,n)=>{let{$head:r,empty:i}=e.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):r.parentOffset>0)return!1;o=lL(r)}let a=o&&o.nodeBefore;return!a||!ve.isSelectable(a)?!1:(t&&t(e.tr.setSelection(ve.create(e.doc,o.pos-a.nodeSize)).scrollIntoView()),!0)};function lL(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function eX(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)?null:n}const P8e=(e,t,n)=>{let r=eX(e,n);if(!r)return!1;let i=dL(r);if(!i)return!1;let o=i.nodeAfter;if(nX(e,i,t,1))return!0;if(r.parent.content.size==0&&(Ud(o,"start")||ve.isSelectable(o))){let a=uL(e.doc,r.before(),r.after(),W.empty);if(a&&a.slice.size<a.to-a.from){if(t){let s=e.tr.step(a);s.setSelection(Ud(o,"start")?Ee.findFrom(s.doc.resolve(s.mapping.map(i.pos)),1):ve.create(s.doc,s.mapping.map(i.pos))),t(s.scrollIntoView())}return!0}}return o.isAtom&&i.depth==r.depth-1?(t&&t(e.tr.delete(i.pos,i.pos+o.nodeSize).scrollIntoView()),!0):!1},N8e=(e,t,n)=>{let{$head:r,empty:i}=e.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):r.parentOffset<r.parent.content.size)return!1;o=dL(r)}let a=o&&o.nodeAfter;return!a||!ve.isSelectable(a)?!1:(t&&t(e.tr.setSelection(ve.create(e.doc,o.pos)).scrollIntoView()),!0)};function dL(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}const W8e=(e,t)=>{let n=e.selection,r=n instanceof ve,i;if(r){if(n.node.isTextblock||!TS(e.doc,n.from))return!1;i=n.from}else if(i=GZ(e.doc,n.from,-1),i==null)return!1;if(t){let o=e.tr.join(i);r&&o.setSelection(ve.create(o.doc,i-e.doc.resolve(i).nodeBefore.nodeSize)),t(o.scrollIntoView())}return!0},K8e=(e,t)=>{let n=e.selection,r;if(n instanceof ve){if(n.node.isTextblock||!TS(e.doc,n.to))return!1;r=n.to}else if(r=GZ(e.doc,n.to,1),r==null)return!1;return t&&t(e.tr.join(r).scrollIntoView()),!0},q8e=(e,t)=>{let{$from:n,$to:r}=e.selection,i=n.blockRange(r),o=i&&_S(i);return o==null?!1:(t&&t(e.tr.lift(i,o).scrollIntoView()),!0)},V8e=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(t&&t(e.tr.insertText(`
|
|
68
|
+
`).scrollIntoView()),!0)};function tX(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const z8e=(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),o=n.indexAfter(-1),a=tX(i.contentMatchAt(o));if(!a||!i.canReplaceWith(o,o,a))return!1;if(t){let s=n.after(),c=e.tr.replaceWith(s,s,a.createAndFill());c.setSelection(Ee.near(c.doc.resolve(s),1)),t(c.scrollIntoView())}return!0},Q8e=(e,t)=>{let n=e.selection,{$from:r,$to:i}=n;if(n instanceof Si||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=tX(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(t){let a=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,s=e.tr.insert(a,o.createAndFill());s.setSelection(Te.create(s.doc,a+1)),t(s.scrollIntoView())}return!0},H8e=(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let o=n.before();if(E8e(e.doc,o))return t&&t(e.tr.split(o).scrollIntoView()),!0}let r=n.blockRange(),i=r&&_S(r);return i==null?!1:(t&&t(e.tr.lift(r,i).scrollIntoView()),!0)},Y8e=(e,t)=>{let{$from:n,to:r}=e.selection,i,o=n.sharedDepth(r);return o==0?!1:(i=n.before(o),t&&t(e.tr.setSelection(ve.create(e.doc,i))),!0)};function G8e(e,t,n){let r=t.nodeBefore,i=t.nodeAfter,o=t.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&t.parent.canReplace(o-1,o)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),!0):!t.parent.canReplace(o,o+1)||!(i.isTextblock||TS(e.doc,t.pos))?!1:(n&&n(e.tr.join(t.pos).scrollIntoView()),!0)}function nX(e,t,n,r){let i=t.nodeBefore,o=t.nodeAfter,a,s,c=i.type.spec.isolating||o.type.spec.isolating;if(!c&&G8e(e,t,n))return!0;let u=!c&&t.parent.canReplace(t.index(),t.index()+1);if(u&&(a=(s=i.contentMatchAt(i.childCount)).findWrapping(o.type))&&s.matchType(a[0]||o.type).validEnd){if(n){let h=t.pos+o.nodeSize,A=U.empty;for(let b=a.length-1;b>=0;b--)A=U.from(a[b].create(null,A));A=U.from(i.copy(A));let g=e.tr.step(new oy(t.pos-1,h,t.pos,h,new W(A,1,0),a.length,!0)),v=g.doc.resolve(h+2*a.length);v.nodeAfter&&v.nodeAfter.type==i.type&&TS(g.doc,v.pos)&&g.join(v.pos),n(g.scrollIntoView())}return!0}let l=o.type.spec.isolating||r>0&&c?null:Ee.findFrom(t,1),d=l&&l.$from.blockRange(l.$to),p=d&&_S(d);if(p!=null&&p>=t.depth)return n&&n(e.tr.lift(d,p).scrollIntoView()),!0;if(u&&Ud(o,"start",!0)&&Ud(i,"end")){let h=i,A=[];for(;A.push(h),!h.isTextblock;)h=h.lastChild;let g=o,v=1;for(;!g.isTextblock;g=g.firstChild)v++;if(h.canReplace(h.childCount,h.childCount,g.content)){if(n){let b=U.empty;for(let S=A.length-1;S>=0;S--)b=U.from(A[S].copy(b));let w=e.tr.step(new oy(t.pos-A.length,t.pos+o.nodeSize,t.pos+v,t.pos+o.nodeSize-v,new W(b,A.length,0),0,!0));n(w.scrollIntoView())}return!0}}return!1}function rX(e){return function(t,n){let r=t.selection,i=e<0?r.$from:r.$to,o=i.depth;for(;i.node(o).isInline;){if(!o)return!1;o--}return i.node(o).isTextblock?(n&&n(t.tr.setSelection(Te.create(t.doc,e<0?i.start(o):i.end(o)))),!0):!1}}const J8e=rX(-1),Z8e=rX(1);function X8e(e,t=null){return function(n,r){let{$from:i,$to:o}=n.selection,a=i.blockRange(o),s=a&&_8e(a,e,t);return s?(r&&r(n.tr.wrap(a,s).scrollIntoView()),!0):!1}}function ej(e,t=null){return function(n,r){let i=!1;for(let o=0;o<n.selection.ranges.length&&!i;o++){let{$from:{pos:a},$to:{pos:s}}=n.selection.ranges[o];n.doc.nodesBetween(a,s,(c,u)=>{if(i)return!1;if(!(!c.isTextblock||c.hasMarkup(e,t)))if(c.type==e)i=!0;else{let l=n.doc.resolve(u),d=l.index();i=l.parent.canReplaceWith(d,d+1,e)}})}if(!i)return!1;if(r){let o=n.tr;for(let a=0;a<n.selection.ranges.length;a++){let{$from:{pos:s},$to:{pos:c}}=n.selection.ranges[a];o.setBlockType(s,c,e,t)}r(o.scrollIntoView())}return!0}}typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function e9e(e,t=null){return function(n,r){let{$from:i,$to:o}=n.selection,a=i.blockRange(o),s=!1,c=a;if(!a)return!1;if(a.depth>=2&&i.node(a.depth-1).type.compatibleContent(e)&&a.startIndex==0){if(i.index(a.depth-1)==0)return!1;let l=n.doc.resolve(a.start-2);c=new Jv(l,l,a.depth),a.endIndex<a.parent.childCount&&(a=new Jv(i,n.doc.resolve(o.end(a.depth)),a.depth)),s=!0}let u=lKe(c,e,t,a);return u?(r&&r(t9e(n.tr,a,u,s,e).scrollIntoView()),!0):!1}}function t9e(e,t,n,r,i){let o=U.empty;for(let l=n.length-1;l>=0;l--)o=U.from(n[l].type.create(n[l].attrs,o));e.step(new wp(t.start-(r?2:0),t.end,t.start,t.end,new W(o,0,0),n.length,!0));let a=0;for(let l=0;l<n.length;l++)n[l].type==i&&(a=l+1);let s=n.length-a,c=t.start+n.length-(r?2:0),u=t.parent;for(let l=t.startIndex,d=t.endIndex,p=!0;l<d;l++,p=!1)!p&&pKe(e.doc,c,s)&&(e.split(c,s),c+=2*s),c+=u.child(l).nodeSize;return e}function n9e(e){return function(t,n){let{$from:r,$to:i}=t.selection,o=r.blockRange(i,a=>a.childCount>0&&a.firstChild.type==e);return o?n?r.node(o.depth-1).type==e?r9e(t,n,e,o):i9e(t,n,o):!0:!1}}function r9e(e,t,n,r){let i=e.tr,o=r.end,a=r.$to.end(r.depth);o<a&&(i.step(new wp(o-1,a,o,a,new W(U.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Jv(i.doc.resolve(r.$from.pos),i.doc.resolve(a),r.depth));const s=uKe(r);if(s==null)return!1;i.lift(r,s);let c=i.mapping.map(o,-1)-1;return hKe(i.doc,c)&&i.join(c),t(i.scrollIntoView()),!0}function i9e(e,t,n){let r=e.tr,i=n.parent;for(let h=n.end,A=n.endIndex-1,g=n.startIndex;A>g;A--)h-=i.child(A).nodeSize,r.delete(h-1,h+1);let o=r.doc.resolve(n.start),a=o.nodeAfter;if(r.mapping.map(n.end)!=n.start+o.nodeAfter.nodeSize)return!1;let s=n.startIndex==0,c=n.endIndex==i.childCount,u=o.node(-1),l=o.index(-1);if(!u.canReplace(l+(s?0:1),l+1,a.content.append(c?U.empty:U.from(i))))return!1;let d=o.pos,p=d+a.nodeSize;return r.step(new wp(d-(s?1:0),p+(c?1:0),d+1,p-1,new W((s?U.empty:U.from(i.copy(U.empty))).append(c?U.empty:U.from(i.copy(U.empty))),s?0:1,c?0:1),s?0:1)),t(r.scrollIntoView()),!0}function o9e(e){return function(t,n){let{$from:r,$to:i}=t.selection,o=r.blockRange(i,u=>u.childCount>0&&u.firstChild.type==e);if(!o)return!1;let a=o.startIndex;if(a==0)return!1;let s=o.parent,c=s.child(a-1);if(c.type!=e)return!1;if(n){let u=c.lastChild&&c.lastChild.type==s.type,l=U.from(u?e.create():null),d=new W(U.from(e.create(null,U.from(s.type.create(null,l)))),u?3:1,0),p=o.start,h=o.end;n(t.tr.step(new wp(p-(u?3:1),h,p,h,d,1,!0)).scrollIntoView())}return!0}}function IS(e){const{state:t,transaction:n}=e;let{selection:r}=n,{doc:i}=n,{storedMarks:o}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return o},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,o=n.storedMarks,n}}}class fL{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:n,state:r}=this,{view:i}=n,{tr:o}=r,a=this.buildProps(o);return Object.fromEntries(Object.entries(t).map(([s,c])=>[s,(...l)=>{const d=c(...l)(a);return!o.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(o),d}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,n=!0){const{rawCommands:r,editor:i,state:o}=this,{view:a}=i,s=[],c=!!t,u=t||o.tr,l=()=>(!c&&n&&!u.getMeta("preventDispatch")&&!this.hasCustomState&&a.dispatch(u),s.every(p=>p===!0)),d={...Object.fromEntries(Object.entries(r).map(([p,h])=>[p,(...g)=>{const v=this.buildProps(u,n),b=h(...g)(v);return s.push(b),d}])),run:l};return d}createCan(t){const{rawCommands:n,state:r}=this,i=!1,o=t||r.tr,a=this.buildProps(o,i);return{...Object.fromEntries(Object.entries(n).map(([c,u])=>[c,(...l)=>u(...l)({...a,dispatch:void 0})])),chain:()=>this.createChain(o,i)}}buildProps(t,n=!0){const{rawCommands:r,editor:i,state:o}=this,{view:a}=i,s={tr:t,editor:i,view:a,state:IS({state:o,transaction:t}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(t,n),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(r).map(([c,u])=>[c,(...l)=>u(...l)(s)]))}};return s}}function ce(e,t,n){return e.config[t]===void 0&&e.parent?ce(e.parent,t,n):typeof e.config[t]=="function"?e.config[t].bind({...n,parent:e.parent?ce(e.parent,t,n):null}):e.config[t]}function ES(e){const t=e.filter(i=>i.type==="extension"),n=e.filter(i=>i.type==="node"),r=e.filter(i=>i.type==="mark");return{baseExtensions:t,nodeExtensions:n,markExtensions:r}}function iX(e){const t=[],{nodeExtensions:n,markExtensions:r}=ES(e),i=[...n,...r],o={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return e.forEach(a=>{const s={name:a.name,options:a.options,storage:a.storage,extensions:i},c=ce(a,"addGlobalAttributes",s);if(!c)return;c().forEach(l=>{l.types.forEach(d=>{Object.entries(l.attributes).forEach(([p,h])=>{t.push({type:d,name:p,attribute:{...o,...h}})})})})}),i.forEach(a=>{const s={name:a.name,options:a.options,storage:a.storage},c=ce(a,"addAttributes",s);if(!c)return;const u=c();Object.entries(u).forEach(([l,d])=>{const p={...o,...d};typeof(p==null?void 0:p.default)=="function"&&(p.default=p.default()),p!=null&&p.isRequired&&(p==null?void 0:p.default)===void 0&&delete p.default,t.push({type:a.name,name:l,attribute:p})})}),t}function Ht(e,t){if(typeof e=="string"){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}function Rt(...e){return e.filter(t=>!!t).reduce((t,n)=>{const r={...t};return Object.entries(n).forEach(([i,o])=>{if(!r[i]){r[i]=o;return}if(i==="class"){const s=o?String(o).split(" "):[],c=r[i]?r[i].split(" "):[],u=s.filter(l=>!c.includes(l));r[i]=[...c,...u].join(" ")}else if(i==="style"){const s=o?o.split(";").map(l=>l.trim()).filter(Boolean):[],c=r[i]?r[i].split(";").map(l=>l.trim()).filter(Boolean):[],u=new Map;c.forEach(l=>{const[d,p]=l.split(":").map(h=>h.trim());u.set(d,p)}),s.forEach(l=>{const[d,p]=l.split(":").map(h=>h.trim());u.set(d,p)}),r[i]=Array.from(u.entries()).map(([l,d])=>`${l}: ${d}`).join("; ")}else r[i]=o}),r},{})}function ay(e,t){return t.filter(n=>n.type===e.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(e.attrs)||{}:{[n.name]:e.attrs[n.name]}).reduce((n,r)=>Rt(n,r),{})}function a9e(e){return typeof e=="function"}function Le(e,t=void 0,...n){return a9e(e)?t?e.bind(t)(...n):e(...n):e}function s9e(e={}){return Object.keys(e).length===0&&e.constructor===Object}function c9e(e){return typeof e!="string"?e:e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):e==="true"?!0:e==="false"?!1:e}function tj(e,t){return"style"in e?e:{...e,getAttrs:n=>{const r=e.getAttrs?e.getAttrs(n):e.attrs;if(r===!1)return!1;const i=t.reduce((o,a)=>{const s=a.attribute.parseHTML?a.attribute.parseHTML(n):c9e(n.getAttribute(a.name));return s==null?o:{...o,[a.name]:s}},{});return{...r,...i}}}}function nj(e){return Object.fromEntries(Object.entries(e).filter(([t,n])=>t==="attrs"&&s9e(n)?!1:n!=null))}function oX(e,t){var n;const r=iX(e),{nodeExtensions:i,markExtensions:o}=ES(e),a=(n=i.find(u=>ce(u,"topNode")))===null||n===void 0?void 0:n.name,s=Object.fromEntries(i.map(u=>{const l=r.filter(b=>b.type===u.name),d={name:u.name,options:u.options,storage:u.storage,editor:t},p=e.reduce((b,w)=>{const S=ce(w,"extendNodeSchema",d);return{...b,...S?S(u):{}}},{}),h=nj({...p,content:Le(ce(u,"content",d)),marks:Le(ce(u,"marks",d)),group:Le(ce(u,"group",d)),inline:Le(ce(u,"inline",d)),atom:Le(ce(u,"atom",d)),selectable:Le(ce(u,"selectable",d)),draggable:Le(ce(u,"draggable",d)),code:Le(ce(u,"code",d)),whitespace:Le(ce(u,"whitespace",d)),linebreakReplacement:Le(ce(u,"linebreakReplacement",d)),defining:Le(ce(u,"defining",d)),isolating:Le(ce(u,"isolating",d)),attrs:Object.fromEntries(l.map(b=>{var w;return[b.name,{default:(w=b==null?void 0:b.attribute)===null||w===void 0?void 0:w.default}]}))}),A=Le(ce(u,"parseHTML",d));A&&(h.parseDOM=A.map(b=>tj(b,l)));const g=ce(u,"renderHTML",d);g&&(h.toDOM=b=>g({node:b,HTMLAttributes:ay(b,l)}));const v=ce(u,"renderText",d);return v&&(h.toText=v),[u.name,h]})),c=Object.fromEntries(o.map(u=>{const l=r.filter(v=>v.type===u.name),d={name:u.name,options:u.options,storage:u.storage,editor:t},p=e.reduce((v,b)=>{const w=ce(b,"extendMarkSchema",d);return{...v,...w?w(u):{}}},{}),h=nj({...p,inclusive:Le(ce(u,"inclusive",d)),excludes:Le(ce(u,"excludes",d)),group:Le(ce(u,"group",d)),spanning:Le(ce(u,"spanning",d)),code:Le(ce(u,"code",d)),attrs:Object.fromEntries(l.map(v=>{var b;return[v.name,{default:(b=v==null?void 0:v.attribute)===null||b===void 0?void 0:b.default}]}))}),A=Le(ce(u,"parseHTML",d));A&&(h.parseDOM=A.map(v=>tj(v,l)));const g=ce(u,"renderHTML",d);return g&&(h.toDOM=v=>g({mark:v,HTMLAttributes:ay(v,l)})),[u.name,h]}));return new UJ({topNode:a,nodes:s,marks:c})}function uw(e,t){return t.nodes[e]||t.marks[e]||null}function rj(e,t){return Array.isArray(t)?t.some(n=>(typeof n=="string"?n:n.name)===e.name):t}function aX(e,t){const n=ig.fromSchema(t).serializeFragment(e),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}const u9e=(e,t=500)=>{let n="";const r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(i,o,a,s)=>{var c,u;const l=((u=(c=i.type.spec).toText)===null||u===void 0?void 0:u.call(c,{node:i,pos:o,parent:a,index:s}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?l:l.slice(0,Math.max(0,r-o))}),n};function pL(e){return Object.prototype.toString.call(e)==="[object RegExp]"}class hL{constructor(t){this.find=t.find,this.handler=t.handler}}const l9e=(e,t)=>{if(pL(t))return t.exec(e);const n=t(e);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=e,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function Fg(e){var t;const{editor:n,from:r,to:i,text:o,rules:a,plugin:s}=e,{view:c}=n;if(c.composing)return!1;const u=c.state.doc.resolve(r);if(u.parent.type.spec.code||!((t=u.nodeBefore||u.nodeAfter)===null||t===void 0)&&t.marks.find(p=>p.type.spec.code))return!1;let l=!1;const d=u9e(u)+o;return a.forEach(p=>{if(l)return;const h=l9e(d,p.find);if(!h)return;const A=c.state.tr,g=IS({state:c.state,transaction:A}),v={from:r-(h[0].length-o.length),to:i},{commands:b,chain:w,can:S}=new fL({editor:n,state:g});p.handler({state:g,range:v,match:h,commands:b,chain:w,can:S})===null||!A.steps.length||(A.setMeta(s,{transform:A,from:r,to:i,text:o}),c.dispatch(A),l=!0)}),l}function d9e(e){const{editor:t,rules:n}=e,r=new kn({state:{init(){return null},apply(i,o,a){const s=i.getMeta(r);if(s)return s;const c=i.getMeta("applyInputRules");return!!c&&setTimeout(()=>{let{text:l}=c;typeof l=="string"?l=l:l=aX(U.from(l),a.schema);const{from:d}=c,p=d+l.length;Fg({editor:t,from:d,to:p,text:l,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:o}},props:{handleTextInput(i,o,a,s){return Fg({editor:t,from:o,to:a,text:s,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:o}=i.state.selection;o&&Fg({editor:t,from:o.pos,to:o.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(i,o){if(o.key!=="Enter")return!1;const{$cursor:a}=i.state.selection;return a?Fg({editor:t,from:a.pos,to:a.pos,text:`
|
|
69
|
+
`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function f9e(e){return Object.prototype.toString.call(e).slice(8,-1)}function Lg(e){return f9e(e)!=="Object"?!1:e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}function RS(e,t){const n={...e};return Lg(e)&&Lg(t)&&Object.keys(t).forEach(r=>{Lg(t[r])&&Lg(e[r])?n[r]=RS(e[r],t[r]):n[r]=t[r]}),n}let sg=class e_{constructor(t={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=Le(ce(this,"addOptions",{name:this.name}))),this.storage=Le(ce(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new e_(t)}configure(t={}){const n=this.extend({...this.config,addOptions:()=>RS(this.options,t)});return n.name=this.name,n.parent=this.parent,n}extend(t={}){const n=new e_(t);return n.parent=this,this.child=n,n.name=t.name?t.name:n.parent.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=Le(ce(n,"addOptions",{name:n.name})),n.storage=Le(ce(n,"addStorage",{name:n.name,options:n.options})),n}static handleExit({editor:t,mark:n}){const{tr:r}=t.state,i=t.state.selection.$from;if(i.pos===i.end()){const a=i.marks();if(!!!a.find(u=>(u==null?void 0:u.type.name)===n.name))return!1;const c=a.find(u=>(u==null?void 0:u.type.name)===n.name);return c&&r.removeStoredMark(c),r.insertText(" ",i.pos),t.view.dispatch(r),!0}return!1}};function p9e(e){return typeof e=="number"}class h9e{constructor(t){this.find=t.find,this.handler=t.handler}}const A9e=(e,t,n)=>{if(pL(t))return[...e.matchAll(t)];const r=t(e,n);return r?r.map(i=>{const o=[i.text];return o.index=i.index,o.input=e,o.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),o.push(i.replaceWith)),o}):[]};function m9e(e){const{editor:t,state:n,from:r,to:i,rule:o,pasteEvent:a,dropEvent:s}=e,{commands:c,chain:u,can:l}=new fL({editor:t,state:n}),d=[];return n.doc.nodesBetween(r,i,(h,A)=>{if(!h.isTextblock||h.type.spec.code)return;const g=Math.max(r,A),v=Math.min(i,A+h.content.size),b=h.textBetween(g-A,v-A,void 0,"");A9e(b,o.find,a).forEach(S=>{if(S.index===void 0)return;const y=g+S.index+1,C=y+S[0].length,x={from:n.tr.mapping.map(y),to:n.tr.mapping.map(C)},T=o.handler({state:n,range:x,match:S,commands:c,chain:u,can:l,pasteEvent:a,dropEvent:s});d.push(T)})}),d.every(h=>h!==null)}let Bg=null;const g9e=e=>{var t;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(t=n.clipboardData)===null||t===void 0||t.setData("text/html",e),n};function v9e(e){const{editor:t,rules:n}=e;let r=null,i=!1,o=!1,a=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,s;try{s=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{s=null}const c=({state:l,from:d,to:p,rule:h,pasteEvt:A})=>{const g=l.tr,v=IS({state:l,transaction:g});if(!(!m9e({editor:t,state:v,from:Math.max(d-1,0),to:p.b-1,rule:h,pasteEvent:A,dropEvent:s})||!g.steps.length)){try{s=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{s=null}return a=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,g}};return n.map(l=>new kn({view(d){const p=A=>{var g;r=!((g=d.dom.parentElement)===null||g===void 0)&&g.contains(A.target)?d.dom.parentElement:null,r&&(Bg=t)},h=()=>{Bg&&(Bg=null)};return window.addEventListener("dragstart",p),window.addEventListener("dragend",h),{destroy(){window.removeEventListener("dragstart",p),window.removeEventListener("dragend",h)}}},props:{handleDOMEvents:{drop:(d,p)=>{if(o=r===d.dom.parentElement,s=p,!o){const h=Bg;h&&setTimeout(()=>{const A=h.state.selection;A&&h.commands.deleteRange({from:A.from,to:A.to})},10)}return!1},paste:(d,p)=>{var h;const A=(h=p.clipboardData)===null||h===void 0?void 0:h.getData("text/html");return a=p,i=!!(A!=null&&A.includes("data-pm-slice")),!1}}},appendTransaction:(d,p,h)=>{const A=d[0],g=A.getMeta("uiEvent")==="paste"&&!i,v=A.getMeta("uiEvent")==="drop"&&!o,b=A.getMeta("applyPasteRules"),w=!!b;if(!g&&!v&&!w)return;if(w){let{text:C}=b;typeof C=="string"?C=C:C=aX(U.from(C),h.schema);const{from:x}=b,T=x+C.length,I=g9e(C);return c({rule:l,state:h,from:x,to:{b:T},pasteEvt:I})}const S=p.doc.content.findDiffStart(h.doc.content),y=p.doc.content.findDiffEnd(h.doc.content);if(!(!p9e(S)||!y||S===y.b))return c({rule:l,state:h,from:S,to:y,pasteEvt:a})}}))}function y9e(e){const t=e.filter((n,r)=>e.indexOf(n)!==r);return Array.from(new Set(t))}class cd{constructor(t,n){this.splittableMarks=[],this.editor=n,this.extensions=cd.resolve(t),this.schema=oX(this.extensions,n),this.setupExtensions()}static resolve(t){const n=cd.sort(cd.flatten(t)),r=y9e(n.map(i=>i.name));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(i=>`'${i}'`).join(", ")}]. This can lead to issues.`),n}static flatten(t){return t.map(n=>{const r={name:n.name,options:n.options,storage:n.storage},i=ce(n,"addExtensions",r);return i?[n,...this.flatten(i())]:n}).flat(10)}static sort(t){return t.sort((r,i)=>{const o=ce(r,"priority")||100,a=ce(i,"priority")||100;return o>a?-1:o<a?1:0})}get commands(){return this.extensions.reduce((t,n)=>{const r={name:n.name,options:n.options,storage:n.storage,editor:this.editor,type:uw(n.name,this.schema)},i=ce(n,"addCommands",r);return i?{...t,...i()}:t},{})}get plugins(){const{editor:t}=this,n=cd.sort([...this.extensions].reverse()),r=[],i=[],o=n.map(a=>{const s={name:a.name,options:a.options,storage:a.storage,editor:t,type:uw(a.name,this.schema)},c=[],u=ce(a,"addKeyboardShortcuts",s);let l={};if(a.type==="mark"&&ce(a,"exitable",s)&&(l.ArrowRight=()=>sg.handleExit({editor:t,mark:a})),u){const g=Object.fromEntries(Object.entries(u()).map(([v,b])=>[v,()=>b({editor:t})]));l={...l,...g}}const d=d8e(l);c.push(d);const p=ce(a,"addInputRules",s);rj(a,t.options.enableInputRules)&&p&&r.push(...p());const h=ce(a,"addPasteRules",s);rj(a,t.options.enablePasteRules)&&h&&i.push(...h());const A=ce(a,"addProseMirrorPlugins",s);if(A){const g=A();c.push(...g)}return c}).flat();return[d9e({editor:t,rules:r}),...v9e({editor:t,rules:i}),...o]}get attributes(){return iX(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:n}=ES(this.extensions);return Object.fromEntries(n.filter(r=>!!ce(r,"addNodeView")).map(r=>{const i=this.attributes.filter(c=>c.type===r.name),o={name:r.name,options:r.options,storage:r.storage,editor:t,type:Ht(r.name,this.schema)},a=ce(r,"addNodeView",o);if(!a)return[];const s=(c,u,l,d,p)=>{const h=ay(c,i);return a()({node:c,view:u,getPos:l,decorations:d,innerDecorations:p,editor:t,extension:r,HTMLAttributes:h})};return[r.name,s]}))}setupExtensions(){this.extensions.forEach(t=>{var n;this.editor.extensionStorage[t.name]=t.storage;const r={name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:uw(t.name,this.schema)};t.type==="mark"&&(!((n=Le(ce(t,"keepOnSplit",r)))!==null&&n!==void 0)||n)&&this.splittableMarks.push(t.name);const i=ce(t,"onBeforeCreate",r),o=ce(t,"onCreate",r),a=ce(t,"onUpdate",r),s=ce(t,"onSelectionUpdate",r),c=ce(t,"onTransaction",r),u=ce(t,"onFocus",r),l=ce(t,"onBlur",r),d=ce(t,"onDestroy",r);i&&this.editor.on("beforeCreate",i),o&&this.editor.on("create",o),a&&this.editor.on("update",a),s&&this.editor.on("selectionUpdate",s),c&&this.editor.on("transaction",c),u&&this.editor.on("focus",u),l&&this.editor.on("blur",l),d&&this.editor.on("destroy",d)})}}class Cn{constructor(t={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=Le(ce(this,"addOptions",{name:this.name}))),this.storage=Le(ce(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new Cn(t)}configure(t={}){const n=this.extend({...this.config,addOptions:()=>RS(this.options,t)});return n.name=this.name,n.parent=this.parent,n}extend(t={}){const n=new Cn({...this.config,...t});return n.parent=this,this.child=n,n.name=t.name?t.name:n.parent.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=Le(ce(n,"addOptions",{name:n.name})),n.storage=Le(ce(n,"addStorage",{name:n.name,options:n.options})),n}}function b9e(e,t,n){const{from:r,to:i}=t,{blockSeparator:o=`
|
|
70
|
+
|
|
71
|
+
`,textSerializers:a={}}=n||{};let s="";return e.nodesBetween(r,i,(c,u,l,d)=>{var p;c.isBlock&&u>r&&(s+=o);const h=a==null?void 0:a[c.type.name];if(h)return l&&(s+=h({node:c,pos:u,parent:l,index:d,range:t})),!1;c.isText&&(s+=(p=c==null?void 0:c.text)===null||p===void 0?void 0:p.slice(Math.max(r,u)-u,i-u))}),s}function S9e(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,t])=>t.spec.toText).map(([t,n])=>[t,n.spec.toText]))}Cn.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new kn({key:new Vn("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:i}=t,{ranges:o}=i,a=Math.min(...o.map(l=>l.$from.pos)),s=Math.max(...o.map(l=>l.$to.pos)),c=S9e(n);return b9e(r,{from:a,to:s},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:c})}}})]}});const C9e=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),(n=window==null?void 0:window.getSelection())===null||n===void 0||n.removeAllRanges())}),!0),w9e=(e=!1)=>({commands:t})=>t.setContent("",e),x9e=()=>({state:e,tr:t,dispatch:n})=>{const{selection:r}=t,{ranges:i}=r;return n&&i.forEach(({$from:o,$to:a})=>{e.doc.nodesBetween(o.pos,a.pos,(s,c)=>{if(s.type.isText)return;const{doc:u,mapping:l}=t,d=u.resolve(l.map(c)),p=u.resolve(l.map(c+s.nodeSize)),h=d.blockRange(p);if(!h)return;const A=A8e(h);if(s.type.isTextblock){const{defaultType:g}=d.parent.contentMatchAt(d.index());t.setNodeMarkup(h.start,g)}(A||A===0)&&t.lift(h,A)})}),!0},_9e=e=>t=>e(t),T9e=()=>({state:e,dispatch:t})=>Q8e(e,t),I9e=(e,t)=>({editor:n,tr:r})=>{const{state:i}=n,o=i.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);const a=r.mapping.map(t);return r.insert(a,o.content),r.setSelection(new Te(r.doc.resolve(a-1))),!0},E9e=()=>({tr:e,dispatch:t})=>{const{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;const i=e.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===r.type){if(t){const s=i.before(o),c=i.after(o);e.delete(s,c).scrollIntoView()}return!0}return!1},R9e=e=>({tr:t,state:n,dispatch:r})=>{const i=Ht(e,n.schema),o=t.selection.$anchor;for(let a=o.depth;a>0;a-=1)if(o.node(a).type===i){if(r){const c=o.before(a),u=o.after(a);t.delete(c,u).scrollIntoView()}return!0}return!1},$9e=e=>({tr:t,dispatch:n})=>{const{from:r,to:i}=e;return n&&t.delete(r,i),!0},k9e=()=>({state:e,dispatch:t})=>L8e(e,t),O9e=()=>({commands:e})=>e.keyboardShortcut("Enter"),M9e=()=>({state:e,dispatch:t})=>z8e(e,t);function sy(e,t,n={strict:!0}){const r=Object.keys(t);return r.length?r.every(i=>n.strict?t[i]===e[i]:pL(t[i])?t[i].test(e[i]):t[i]===e[i]):!0}function sX(e,t,n={}){return e.find(r=>r.type===t&&sy(Object.fromEntries(Object.keys(n).map(i=>[i,r.attrs[i]])),n))}function ij(e,t,n={}){return!!sX(e,t,n)}function AL(e,t,n){var r;if(!e||!t)return;let i=e.parent.childAfter(e.parentOffset);if((!i.node||!i.node.marks.some(l=>l.type===t))&&(i=e.parent.childBefore(e.parentOffset)),!i.node||!i.node.marks.some(l=>l.type===t)||(n=n||((r=i.node.marks[0])===null||r===void 0?void 0:r.attrs),!sX([...i.node.marks],t,n)))return;let a=i.index,s=e.start()+i.offset,c=a+1,u=s+i.node.nodeSize;for(;a>0&&ij([...e.parent.child(a-1).marks],t,n);)a-=1,s-=e.parent.child(a).nodeSize;for(;c<e.parent.childCount&&ij([...e.parent.child(c).marks],t,n);)u+=e.parent.child(c).nodeSize,c+=1;return{from:s,to:u}}function $c(e,t){if(typeof e=="string"){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}const F9e=(e,t={})=>({tr:n,state:r,dispatch:i})=>{const o=$c(e,r.schema),{doc:a,selection:s}=n,{$from:c,from:u,to:l}=s;if(i){const d=AL(c,o,t);if(d&&d.from<=u&&d.to>=l){const p=Te.create(a,d.from,d.to);n.setSelection(p)}}return!0},L9e=e=>t=>{const n=typeof e=="function"?e(t):e;for(let r=0;r<n.length;r+=1)if(n[r](t))return!0;return!1};function mL(e){return e instanceof Te}function va(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function B9e(e,t=null){if(!t)return null;const n=Ee.atStart(e),r=Ee.atEnd(e);if(t==="start"||t===!0)return n;if(t==="end")return r;const i=n.from,o=r.to;return t==="all"?Te.create(e,va(0,i,o),va(e.content.size,i,o)):Te.create(e,va(t,i,o),va(t,i,o))}function cX(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function $S(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}const D9e=(e=null,t={})=>({editor:n,view:r,tr:i,dispatch:o})=>{t={scrollIntoView:!0,...t};const a=()=>{($S()||cX())&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),t!=null&&t.scrollIntoView&&n.commands.scrollIntoView())})};if(r.hasFocus()&&e===null||e===!1)return!0;if(o&&e===null&&!mL(n.state.selection))return a(),!0;const s=B9e(i.doc,e)||n.state.selection,c=n.state.selection.eq(s);return o&&(c||i.setSelection(s),c&&i.storedMarks&&i.setStoredMarks(i.storedMarks),a()),!0},j9e=(e,t)=>n=>e.every((r,i)=>t(r,{...n,index:i})),U9e=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),uX=e=>{const t=e.childNodes;for(let n=t.length-1;n>=0;n-=1){const r=t[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):r.nodeType===1&&uX(r)}return e};function Dg(e){const t=`<body>${e}</body>`,n=new window.DOMParser().parseFromString(t,"text/html").body;return uX(n)}function cy(e,t,n){if(e instanceof nu||e instanceof U)return e;n={slice:!0,parseOptions:{},...n};const r=typeof e=="object"&&e!==null,i=typeof e=="string";if(r)try{if(Array.isArray(e)&&e.length>0)return U.fromArray(e.map(s=>t.nodeFromJSON(s)));const a=t.nodeFromJSON(e);return n.errorOnInvalidContent&&a.check(),a}catch(o){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:o});return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",o),cy("",t,n)}if(i){if(n.errorOnInvalidContent){let a=!1,s="";const c=new UJ({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:u=>(a=!0,s=typeof u=="string"?u:u.outerHTML,null)}]}})});if(n.slice?ru.fromSchema(c).parseSlice(Dg(e),n.parseOptions):ru.fromSchema(c).parse(Dg(e),n.parseOptions),n.errorOnInvalidContent&&a)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${s}`)})}const o=ru.fromSchema(t);return n.slice?o.parseSlice(Dg(e),n.parseOptions).content:o.parse(Dg(e),n.parseOptions)}return cy("",t,n)}function P9e(e,t,n){const r=e.steps.length-1;if(r<t)return;const i=e.steps[r];if(!(i instanceof BZ||i instanceof DZ))return;const o=e.mapping.maps[r];let a=0;o.forEach((s,c,u,l)=>{a===0&&(a=l)}),e.setSelection(Ee.near(e.doc.resolve(a),n))}const N9e=e=>!("type"in e),W9e=(e,t,n)=>({tr:r,dispatch:i,editor:o})=>{var a;if(i){n={parseOptions:o.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let s;try{s=cy(t,o.schema,{parseOptions:{preserveWhitespace:"full",...n.parseOptions},errorOnInvalidContent:(a=n.errorOnInvalidContent)!==null&&a!==void 0?a:o.options.enableContentCheck})}catch(A){return o.emit("contentError",{editor:o,error:A,disableCollaboration:()=>{o.storage.collaboration&&(o.storage.collaboration.isDisabled=!0)}}),!1}let{from:c,to:u}=typeof e=="number"?{from:e,to:e}:{from:e.from,to:e.to},l=!0,d=!0;if((N9e(s)?s:[s]).forEach(A=>{A.check(),l=l?A.isText&&A.marks.length===0:!1,d=d?A.isBlock:!1}),c===u&&d){const{parent:A}=r.doc.resolve(c);A.isTextblock&&!A.type.spec.code&&!A.childCount&&(c-=1,u+=1)}let h;if(l){if(Array.isArray(t))h=t.map(A=>A.text||"").join("");else if(t instanceof U){let A="";t.forEach(g=>{g.text&&(A+=g.text)}),h=A}else typeof t=="object"&&t&&t.text?h=t.text:h=t;r.insertText(h,c,u)}else h=s,r.replaceWith(c,u,h);n.updateSelection&&P9e(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:c,text:h}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:c,text:h})}return!0},K9e=()=>({state:e,dispatch:t})=>W8e(e,t),q9e=()=>({state:e,dispatch:t})=>K8e(e,t),V9e=()=>({state:e,dispatch:t})=>B8e(e,t),z9e=()=>({state:e,dispatch:t})=>P8e(e,t),Q9e=()=>({state:e,dispatch:t,tr:n})=>{try{const r=UZ(e.doc,e.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},H9e=()=>({state:e,dispatch:t,tr:n})=>{try{const r=UZ(e.doc,e.selection.$from.pos,1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},Y9e=()=>({state:e,dispatch:t})=>D8e(e,t),G9e=()=>({state:e,dispatch:t})=>j8e(e,t);function lX(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function J9e(e){const t=e.split(/-(?!$)/);let n=t[t.length-1];n==="Space"&&(n=" ");let r,i,o,a;for(let s=0;s<t.length-1;s+=1){const c=t[s];if(/^(cmd|meta|m)$/i.test(c))a=!0;else if(/^a(lt)?$/i.test(c))r=!0;else if(/^(c|ctrl|control)$/i.test(c))i=!0;else if(/^s(hift)?$/i.test(c))o=!0;else if(/^mod$/i.test(c))$S()||lX()?a=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${c}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),a&&(n=`Meta-${n}`),o&&(n=`Shift-${n}`),n}const Z9e=e=>({editor:t,view:n,tr:r,dispatch:i})=>{const o=J9e(e).split(/-(?!$)/),a=o.find(u=>!["Alt","Ctrl","Meta","Shift"].includes(u)),s=new KeyboardEvent("keydown",{key:a==="Space"?" ":a,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0}),c=t.captureTransaction(()=>{n.someProp("handleKeyDown",u=>u(n,s))});return c==null||c.steps.forEach(u=>{const l=u.map(r.mapping);l&&i&&r.maybeStep(l)}),!0};function Pd(e,t,n={}){const{from:r,to:i,empty:o}=e.selection,a=t?Ht(t,e.schema):null,s=[];e.doc.nodesBetween(r,i,(d,p)=>{if(d.isText)return;const h=Math.max(r,p),A=Math.min(i,p+d.nodeSize);s.push({node:d,from:h,to:A})});const c=i-r,u=s.filter(d=>a?a.name===d.node.type.name:!0).filter(d=>sy(d.node.attrs,n,{strict:!1}));return o?!!u.length:u.reduce((d,p)=>d+p.to-p.from,0)>=c}const X9e=(e,t={})=>({state:n,dispatch:r})=>{const i=Ht(e,n.schema);return Pd(n,i,t)?q8e(n,r):!1},e7e=()=>({state:e,dispatch:t})=>H8e(e,t),t7e=e=>({state:t,dispatch:n})=>{const r=Ht(e,t.schema);return n9e(r)(t,n)},n7e=()=>({state:e,dispatch:t})=>V8e(e,t);function dX(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function oj(e,t){const n=typeof t=="string"?[t]:t;return Object.keys(e).reduce((r,i)=>(n.includes(i)||(r[i]=e[i]),r),{})}const r7e=(e,t)=>({tr:n,state:r,dispatch:i})=>{let o=null,a=null;const s=dX(typeof e=="string"?e:e.name,r.schema);return s?(s==="node"&&(o=Ht(e,r.schema)),s==="mark"&&(a=$c(e,r.schema)),i&&n.selection.ranges.forEach(c=>{r.doc.nodesBetween(c.$from.pos,c.$to.pos,(u,l)=>{o&&o===u.type&&n.setNodeMarkup(l,void 0,oj(u.attrs,t)),a&&u.marks.length&&u.marks.forEach(d=>{a===d.type&&n.addMark(l,l+u.nodeSize,a.create(oj(d.attrs,t)))})})}),!0):!1},i7e=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),o7e=()=>({tr:e,dispatch:t})=>{if(t){const n=new Si(e.doc);e.setSelection(n)}return!0},a7e=()=>({state:e,dispatch:t})=>U8e(e,t),s7e=()=>({state:e,dispatch:t})=>N8e(e,t),c7e=()=>({state:e,dispatch:t})=>Y8e(e,t),u7e=()=>({state:e,dispatch:t})=>Z8e(e,t),l7e=()=>({state:e,dispatch:t})=>J8e(e,t);function d7e(e,t,n={},r={}){return cy(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}const f7e=(e,t=!1,n={},r={})=>({editor:i,tr:o,dispatch:a,commands:s})=>{var c,u;const{doc:l}=o;if(n.preserveWhitespace!=="full"){const d=d7e(e,i.schema,n,{errorOnInvalidContent:(c=r.errorOnInvalidContent)!==null&&c!==void 0?c:i.options.enableContentCheck});return a&&o.replaceWith(0,l.content.size,d).setMeta("preventUpdate",!t),!0}return a&&o.setMeta("preventUpdate",!t),s.insertContentAt({from:0,to:l.content.size},e,{parseOptions:n,errorOnInvalidContent:(u=r.errorOnInvalidContent)!==null&&u!==void 0?u:i.options.enableContentCheck})};function p7e(e,t){const n=$c(t,e.schema),{from:r,to:i,empty:o}=e.selection,a=[];o?(e.storedMarks&&a.push(...e.storedMarks),a.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,i,c=>{a.push(...c.marks)});const s=a.find(c=>c.type.name===n.name);return s?{...s.attrs}:{}}function h7e(e){for(let t=0;t<e.edgeCount;t+=1){const{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function fX(e,t){for(let n=e.depth;n>0;n-=1){const r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}function kS(e){return t=>fX(t.$from,e)}function A7e(e,t){const n=cd.resolve(e);return oX(n,t)}function pX(e,t,n){const r=[];return e===t?n.resolve(e).marks().forEach(i=>{const o=n.resolve(e),a=AL(o,i.type);a&&r.push({mark:i,...a})}):n.nodesBetween(e,t,(i,o)=>{!i||(i==null?void 0:i.nodeSize)===void 0||r.push(...i.marks.map(a=>({from:o,to:o+i.nodeSize,mark:a})))}),r}const m7e=(e,t,n,r=20)=>{const i=e.doc.resolve(n);let o=r,a=null;for(;o>0&&a===null;){const s=i.node(o);(s==null?void 0:s.type.name)===t?a=s:o-=1}return[a,o]};function sv(e,t,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const i=e.find(o=>o.type===t&&o.name===r);return i?i.attribute.keepOnSplit:!1}))}function g7e(e,t,n={}){const{empty:r,ranges:i}=e.selection,o=t?$c(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(d=>o?o.name===d.type.name:!0).find(d=>sy(d.attrs,n,{strict:!1}));let a=0;const s=[];if(i.forEach(({$from:d,$to:p})=>{const h=d.pos,A=p.pos;e.doc.nodesBetween(h,A,(g,v)=>{if(!g.isText&&!g.marks.length)return;const b=Math.max(h,v),w=Math.min(A,v+g.nodeSize),S=w-b;a+=S,s.push(...g.marks.map(y=>({mark:y,from:b,to:w})))})}),a===0)return!1;const c=s.filter(d=>o?o.name===d.mark.type.name:!0).filter(d=>sy(d.mark.attrs,n,{strict:!1})).reduce((d,p)=>d+p.to-p.from,0),u=s.filter(d=>o?d.mark.type!==o&&d.mark.type.excludes(o):!0).reduce((d,p)=>d+p.to-p.from,0);return(c>0?c+u:c)>=a}const v7e=(e,t)=>{const{$from:n,$to:r,$anchor:i}=e.selection;if(t){const o=kS(s=>s.type.name===t)(e.selection);if(!o)return!1;const a=e.doc.resolve(o.pos+1);return i.pos+1===a.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},y7e=e=>{const{$from:t,$to:n}=e.selection;return!(t.parentOffset>0||t.pos!==n.pos)};function aj(e,t){const{nodeExtensions:n}=ES(t),r=n.find(a=>a.name===e);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},o=Le(ce(r,"group",i));return typeof o!="string"?!1:o.split(" ").includes("list")}function gL(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(e.type.name==="hardBreak")return!0;if(e.isText)return/^\s*$/m.test((r=e.text)!==null&&r!==void 0?r:"")}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(e.content.childCount===0)return!0;if(t){let i=!0;return e.content.forEach(o=>{i!==!1&&(gL(o,{ignoreWhitespace:n,checkChildren:t})||(i=!1))}),i}return!1}function b7e(e){return e instanceof ve}function S7e(e,t,n){const i=e.state.doc.content.size,o=va(t,0,i),a=va(n,0,i),s=e.coordsAtPos(o),c=e.coordsAtPos(a,-1),u=Math.min(s.top,c.top),l=Math.max(s.bottom,c.bottom),d=Math.min(s.left,c.left),p=Math.max(s.right,c.right),h=p-d,A=l-u,b={top:u,bottom:l,left:d,right:p,width:h,height:A,x:d,y:u};return{...b,toJSON:()=>b}}function C7e(e,t,n){var r;const{selection:i}=t;let o=null;if(mL(i)&&(o=i.$cursor),o){const s=(r=e.storedMarks)!==null&&r!==void 0?r:o.marks();return!!n.isInSet(s)||!s.some(c=>c.type.excludes(n))}const{ranges:a}=i;return a.some(({$from:s,$to:c})=>{let u=s.depth===0?e.doc.inlineContent&&e.doc.type.allowsMarkType(n):!1;return e.doc.nodesBetween(s.pos,c.pos,(l,d,p)=>{if(u)return!1;if(l.isInline){const h=!p||p.type.allowsMarkType(n),A=!!n.isInSet(l.marks)||!l.marks.some(g=>g.type.excludes(n));u=h&&A}return!u}),u})}const w7e=(e,t={})=>({tr:n,state:r,dispatch:i})=>{const{selection:o}=n,{empty:a,ranges:s}=o,c=$c(e,r.schema);if(i)if(a){const u=p7e(r,c);n.addStoredMark(c.create({...u,...t}))}else s.forEach(u=>{const l=u.$from.pos,d=u.$to.pos;r.doc.nodesBetween(l,d,(p,h)=>{const A=Math.max(h,l),g=Math.min(h+p.nodeSize,d);p.marks.find(b=>b.type===c)?p.marks.forEach(b=>{c===b.type&&n.addMark(A,g,c.create({...b.attrs,...t}))}):n.addMark(A,g,c.create(t))})});return C7e(r,n,c)},x7e=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),_7e=(e,t={})=>({state:n,dispatch:r,chain:i})=>{const o=Ht(e,n.schema);let a;return n.selection.$anchor.sameParent(n.selection.$head)&&(a=n.selection.$anchor.parent.attrs),o.isTextblock?i().command(({commands:s})=>ej(o,{...a,...t})(n)?!0:s.clearNodes()).command(({state:s})=>ej(o,{...a,...t})(s,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},T7e=e=>({tr:t,dispatch:n})=>{if(n){const{doc:r}=t,i=va(e,0,r.content.size),o=ve.create(r,i);t.setSelection(o)}return!0},I7e=e=>({tr:t,dispatch:n})=>{if(n){const{doc:r}=t,{from:i,to:o}=typeof e=="number"?{from:e,to:e}:e,a=Te.atStart(r).from,s=Te.atEnd(r).to,c=va(i,a,s),u=va(o,a,s),l=Te.create(r,c,u);t.setSelection(l)}return!0},E7e=e=>({state:t,dispatch:n})=>{const r=Ht(e,t.schema);return o9e(r)(t,n)};function sj(e,t){const n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){const r=n.filter(i=>t==null?void 0:t.includes(i.type.name));e.tr.ensureMarks(r)}}const R7e=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:i})=>{const{selection:o,doc:a}=t,{$from:s,$to:c}=o,u=i.extensionManager.attributes,l=sv(u,s.node().type.name,s.node().attrs);if(o instanceof ve&&o.node.isBlock)return!s.parentOffset||!nv(a,s.pos)?!1:(r&&(e&&sj(n,i.extensionManager.splittableMarks),t.split(s.pos).scrollIntoView()),!0);if(!s.parent.isBlock)return!1;const d=c.parentOffset===c.parent.content.size,p=s.depth===0?void 0:h7e(s.node(-1).contentMatchAt(s.indexAfter(-1)));let h=d&&p?[{type:p,attrs:l}]:void 0,A=nv(t.doc,t.mapping.map(s.pos),1,h);if(!h&&!A&&nv(t.doc,t.mapping.map(s.pos),1,p?[{type:p}]:void 0)&&(A=!0,h=p?[{type:p,attrs:l}]:void 0),r){if(A&&(o instanceof Te&&t.deleteSelection(),t.split(t.mapping.map(s.pos),1,h),p&&!d&&!s.parentOffset&&s.parent.type!==p)){const g=t.mapping.map(s.before()),v=t.doc.resolve(g);s.node(-1).canReplaceWith(v.index(),v.index()+1,p)&&t.setNodeMarkup(t.mapping.map(s.before()),p)}e&&sj(n,i.extensionManager.splittableMarks),t.scrollIntoView()}return A},$7e=(e,t={})=>({tr:n,state:r,dispatch:i,editor:o})=>{var a;const s=Ht(e,r.schema),{$from:c,$to:u}=r.selection,l=r.selection.node;if(l&&l.isBlock||c.depth<2||!c.sameParent(u))return!1;const d=c.node(-1);if(d.type!==s)return!1;const p=o.extensionManager.attributes;if(c.parent.content.size===0&&c.node(-1).childCount===c.indexAfter(-1)){if(c.depth===2||c.node(-3).type!==s||c.index(-2)!==c.node(-2).childCount-1)return!1;if(i){let b=U.empty;const w=c.index(-1)?1:c.index(-2)?2:3;for(let I=c.depth-w;I>=c.depth-3;I-=1)b=U.from(c.node(I).copy(b));const S=c.indexAfter(-1)<c.node(-2).childCount?1:c.indexAfter(-2)<c.node(-3).childCount?2:3,y={...sv(p,c.node().type.name,c.node().attrs),...t},C=((a=s.contentMatch.defaultType)===null||a===void 0?void 0:a.createAndFill(y))||void 0;b=b.append(U.from(s.createAndFill(null,C)||void 0));const x=c.before(c.depth-(w-1));n.replace(x,c.after(-S),new W(b,4-w,0));let T=-1;n.doc.nodesBetween(x,n.doc.content.size,(I,R)=>{if(T>-1)return!1;I.isTextblock&&I.content.size===0&&(T=R+1)}),T>-1&&n.setSelection(Te.near(n.doc.resolve(T))),n.scrollIntoView()}return!0}const h=u.pos===c.end()?d.contentMatchAt(0).defaultType:null,A={...sv(p,d.type.name,d.attrs),...t},g={...sv(p,c.node().type.name,c.node().attrs),...t};n.delete(c.pos,u.pos);const v=h?[{type:s,attrs:A},{type:h,attrs:g}]:[{type:s,attrs:A}];if(!nv(n.doc,c.pos,2))return!1;if(i){const{selection:b,storedMarks:w}=r,{splittableMarks:S}=o.extensionManager,y=w||b.$to.parentOffset&&b.$from.marks();if(n.split(c.pos,2,v).scrollIntoView(),!y||!i)return!0;const C=y.filter(x=>S.includes(x.type.name));n.ensureMarks(C)}return!0},lw=(e,t)=>{const n=kS(a=>a.type===t)(e.selection);if(!n)return!0;const r=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const i=e.doc.nodeAt(r);return n.node.type===(i==null?void 0:i.type)&&sL(e.doc,n.pos)&&e.join(n.pos),!0},dw=(e,t)=>{const n=kS(a=>a.type===t)(e.selection);if(!n)return!0;const r=e.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const i=e.doc.nodeAt(r);return n.node.type===(i==null?void 0:i.type)&&sL(e.doc,r)&&e.join(r),!0},k7e=(e,t,n,r={})=>({editor:i,tr:o,state:a,dispatch:s,chain:c,commands:u,can:l})=>{const{extensions:d,splittableMarks:p}=i.extensionManager,h=Ht(e,a.schema),A=Ht(t,a.schema),{selection:g,storedMarks:v}=a,{$from:b,$to:w}=g,S=b.blockRange(w),y=v||g.$to.parentOffset&&g.$from.marks();if(!S)return!1;const C=kS(x=>aj(x.type.name,d))(g);if(S.depth>=1&&C&&S.depth-C.depth<=1){if(C.node.type===h)return u.liftListItem(A);if(aj(C.node.type.name,d)&&h.validContent(C.node.content)&&s)return c().command(()=>(o.setNodeMarkup(C.pos,h),!0)).command(()=>lw(o,h)).command(()=>dw(o,h)).run()}return!n||!y||!s?c().command(()=>l().wrapInList(h,r)?!0:u.clearNodes()).wrapInList(h,r).command(()=>lw(o,h)).command(()=>dw(o,h)).run():c().command(()=>{const x=l().wrapInList(h,r),T=y.filter(I=>p.includes(I.type.name));return o.ensureMarks(T),x?!0:u.clearNodes()}).wrapInList(h,r).command(()=>lw(o,h)).command(()=>dw(o,h)).run()},O7e=(e,t={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:o=!1}=n,a=$c(e,r.schema);return g7e(r,a,t)?i.unsetMark(a,{extendEmptyMarkRange:o}):i.setMark(a,t)},M7e=(e,t,n={})=>({state:r,commands:i})=>{const o=Ht(e,r.schema),a=Ht(t,r.schema),s=Pd(r,o,n);let c;return r.selection.$anchor.sameParent(r.selection.$head)&&(c=r.selection.$anchor.parent.attrs),s?i.setNode(a,c):i.setNode(o,{...c,...n})},F7e=(e,t={})=>({state:n,commands:r})=>{const i=Ht(e,n.schema);return Pd(n,i,t)?r.lift(i):r.wrapIn(i,t)},L7e=()=>({state:e,dispatch:t})=>{const n=e.plugins;for(let r=0;r<n.length;r+=1){const i=n[r];let o;if(i.spec.isInputRules&&(o=i.getState(e))){if(t){const a=e.tr,s=o.transform;for(let c=s.steps.length-1;c>=0;c-=1)a.step(s.steps[c].invert(s.docs[c]));if(o.text){const c=a.doc.resolve(o.from).marks();a.replaceWith(o.from,o.to,e.schema.text(o.text,c))}else a.delete(o.from,o.to)}return!0}}return!1},B7e=()=>({tr:e,dispatch:t})=>{const{selection:n}=e,{empty:r,ranges:i}=n;return r||t&&i.forEach(o=>{e.removeMark(o.$from.pos,o.$to.pos)}),!0},D7e=(e,t={})=>({tr:n,state:r,dispatch:i})=>{var o;const{extendEmptyMarkRange:a=!1}=t,{selection:s}=n,c=$c(e,r.schema),{$from:u,empty:l,ranges:d}=s;if(!i)return!0;if(l&&a){let{from:p,to:h}=s;const A=(o=u.marks().find(v=>v.type===c))===null||o===void 0?void 0:o.attrs,g=AL(u,c,A);g&&(p=g.from,h=g.to),n.removeMark(p,h,c)}else d.forEach(p=>{n.removeMark(p.$from.pos,p.$to.pos,c)});return n.removeStoredMark(c),!0},j7e=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let o=null,a=null;const s=dX(typeof e=="string"?e:e.name,r.schema);return s?(s==="node"&&(o=Ht(e,r.schema)),s==="mark"&&(a=$c(e,r.schema)),i&&n.selection.ranges.forEach(c=>{const u=c.$from.pos,l=c.$to.pos;let d,p,h,A;n.selection.empty?r.doc.nodesBetween(u,l,(g,v)=>{o&&o===g.type&&(h=Math.max(v,u),A=Math.min(v+g.nodeSize,l),d=v,p=g)}):r.doc.nodesBetween(u,l,(g,v)=>{v<u&&o&&o===g.type&&(h=Math.max(v,u),A=Math.min(v+g.nodeSize,l),d=v,p=g),v>=u&&v<=l&&(o&&o===g.type&&n.setNodeMarkup(v,void 0,{...g.attrs,...t}),a&&g.marks.length&&g.marks.forEach(b=>{if(a===b.type){const w=Math.max(v,u),S=Math.min(v+g.nodeSize,l);n.addMark(w,S,a.create({...b.attrs,...t}))}}))}),p&&(d!==void 0&&n.setNodeMarkup(d,void 0,{...p.attrs,...t}),a&&p.marks.length&&p.marks.forEach(g=>{a===g.type&&n.addMark(h,A,a.create({...g.attrs,...t}))}))}),!0):!1},U7e=(e,t={})=>({state:n,dispatch:r})=>{const i=Ht(e,n.schema);return X8e(i,t)(n,r)},P7e=(e,t={})=>({state:n,dispatch:r})=>{const i=Ht(e,n.schema);return e9e(i,t)(n,r)};var N7e=Object.freeze({__proto__:null,blur:C9e,clearContent:w9e,clearNodes:x9e,command:_9e,createParagraphNear:T9e,cut:I9e,deleteCurrentNode:E9e,deleteNode:R9e,deleteRange:$9e,deleteSelection:k9e,enter:O9e,exitCode:M9e,extendMarkRange:F9e,first:L9e,focus:D9e,forEach:j9e,insertContent:U9e,insertContentAt:W9e,joinBackward:V9e,joinDown:q9e,joinForward:z9e,joinItemBackward:Q9e,joinItemForward:H9e,joinTextblockBackward:Y9e,joinTextblockForward:G9e,joinUp:K9e,keyboardShortcut:Z9e,lift:X9e,liftEmptyBlock:e7e,liftListItem:t7e,newlineInCode:n7e,resetAttributes:r7e,scrollIntoView:i7e,selectAll:o7e,selectNodeBackward:a7e,selectNodeForward:s7e,selectParentNode:c7e,selectTextblockEnd:u7e,selectTextblockStart:l7e,setContent:f7e,setMark:w7e,setMeta:x7e,setNode:_7e,setNodeSelection:T7e,setTextSelection:I7e,sinkListItem:E7e,splitBlock:R7e,splitListItem:$7e,toggleList:k7e,toggleMark:O7e,toggleNode:M7e,toggleWrap:F7e,undoInputRule:L7e,unsetAllMarks:B7e,unsetMark:D7e,updateAttributes:j7e,wrapIn:U7e,wrapInList:P7e});Cn.create({name:"commands",addCommands(){return{...N7e}}});Cn.create({name:"drop",addProseMirrorPlugins(){return[new kn({key:new Vn("tiptapDrop"),props:{handleDrop:(e,t,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:n,moved:r})}}})]}});Cn.create({name:"editable",addProseMirrorPlugins(){return[new kn({key:new Vn("editable"),props:{editable:()=>this.editor.options.editable}})]}});Cn.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:e}=this;return[new kn({key:new Vn("focusEvents"),props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;const r=e.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;const r=e.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1}}}})]}});Cn.create({name:"keymap",addKeyboardShortcuts(){const e=()=>this.editor.commands.first(({commands:a})=>[()=>a.undoInputRule(),()=>a.command(({tr:s})=>{const{selection:c,doc:u}=s,{empty:l,$anchor:d}=c,{pos:p,parent:h}=d,A=d.parent.isTextblock&&p>0?s.doc.resolve(p-1):d,g=A.parent.type.spec.isolating,v=d.pos-d.parentOffset,b=g&&A.parent.childCount===1?v===d.pos:Ee.atStart(u).from===p;return!l||!h.type.isTextblock||h.textContent.length||!b||b&&d.parent.type.name==="paragraph"?!1:a.clearNodes()}),()=>a.deleteSelection(),()=>a.joinBackward(),()=>a.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:a})=>[()=>a.deleteSelection(),()=>a.deleteCurrentNode(),()=>a.joinForward(),()=>a.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:a})=>[()=>a.newlineInCode(),()=>a.createParagraphNear(),()=>a.liftEmptyBlock(),()=>a.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},o={...r,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return $S()||lX()?o:i},addProseMirrorPlugins(){return[new kn({key:new Vn("clearDocument"),appendTransaction:(e,t,n)=>{if(e.some(g=>g.getMeta("composition")))return;const r=e.some(g=>g.docChanged)&&!t.doc.eq(n.doc),i=e.some(g=>g.getMeta("preventClearDocument"));if(!r||i)return;const{empty:o,from:a,to:s}=t.selection,c=Ee.atStart(t.doc).from,u=Ee.atEnd(t.doc).to;if(o||!(a===c&&s===u)||!gL(n.doc))return;const p=n.tr,h=IS({state:n,transaction:p}),{commands:A}=new fL({editor:this.editor,state:h});if(A.clearNodes(),!!p.steps.length)return p}})]}});Cn.create({name:"paste",addProseMirrorPlugins(){return[new kn({key:new Vn("tiptapPaste"),props:{handlePaste:(e,t,n)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:n})}}})]}});Cn.create({name:"tabindex",addProseMirrorPlugins(){return[new kn({key:new Vn("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});function uy(e){return new hL({find:e.find,handler:({state:t,range:n,match:r})=>{const i=Le(e.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:o}=t,a=r[r.length-1],s=r[0];if(a){const c=s.search(/\S/),u=n.from+s.indexOf(a),l=u+a.length;if(pX(n.from,n.to,t.doc).filter(h=>h.mark.type.excluded.find(g=>g===e.type&&g!==h.mark.type)).filter(h=>h.to>u).length)return null;l<n.to&&o.delete(l,n.to),u>n.from&&o.delete(n.from+c,u);const p=n.from+c+a.length;o.addMark(n.from+c,p,e.type.create(i||{})),o.removeStoredMark(e.type)}}})}function t_(e){return new hL({find:e.find,handler:({state:t,range:n,match:r})=>{const i=t.doc.resolve(n.from),o=Le(e.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,o)}})}function ly(e){return new hL({find:e.find,handler:({state:t,range:n,match:r,chain:i})=>{const o=Le(e.getAttributes,void 0,r)||{},a=t.tr.delete(n.from,n.to),c=a.doc.resolve(n.from).blockRange(),u=c&&m8e(c,e.type,o);if(!u)return null;if(a.wrap(c,u),e.keepMarks&&e.editor){const{selection:d,storedMarks:p}=t,{splittableMarks:h}=e.editor.extensionManager,A=p||d.$to.parentOffset&&d.$from.marks();if(A){const g=A.filter(v=>h.includes(v.type.name));a.ensureMarks(g)}}if(e.keepAttributes){const d=e.type.name==="bulletList"||e.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(d,o).run()}const l=a.doc.resolve(n.from-1).nodeBefore;l&&l.type===e.type&&sL(a.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,l))&&a.join(n.from-1)}})}class Yt{constructor(t={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=Le(ce(this,"addOptions",{name:this.name}))),this.storage=Le(ce(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new Yt(t)}configure(t={}){const n=this.extend({...this.config,addOptions:()=>RS(this.options,t)});return n.name=this.name,n.parent=this.parent,n}extend(t={}){const n=new Yt(t);return n.parent=this,this.child=n,n.name=t.name?t.name:n.parent.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=Le(ce(n,"addOptions",{name:n.name})),n.storage=Le(ce(n,"addStorage",{name:n.name,options:n.options})),n}}class W7e{constructor(t,n,r){this.isDragging=!1,this.component=t,this.editor=n.editor,this.options={stopEvent:null,ignoreMutation:null,...r},this.extension=n.extension,this.node=n.node,this.decorations=n.decorations,this.innerDecorations=n.innerDecorations,this.view=n.view,this.HTMLAttributes=n.HTMLAttributes,this.getPos=n.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(t){var n,r,i,o,a,s,c;const{view:u}=this.editor,l=t.target,d=l.nodeType===3?(n=l.parentElement)===null||n===void 0?void 0:n.closest("[data-drag-handle]"):l.closest("[data-drag-handle]");if(!this.dom||!((r=this.contentDOM)===null||r===void 0)&&r.contains(l)||!d)return;let p=0,h=0;if(this.dom!==d){const b=this.dom.getBoundingClientRect(),w=d.getBoundingClientRect(),S=(i=t.offsetX)!==null&&i!==void 0?i:(o=t.nativeEvent)===null||o===void 0?void 0:o.offsetX,y=(a=t.offsetY)!==null&&a!==void 0?a:(s=t.nativeEvent)===null||s===void 0?void 0:s.offsetY;p=w.x-b.x+S,h=w.y-b.y+y}(c=t.dataTransfer)===null||c===void 0||c.setDragImage(this.dom,p,h);const A=this.getPos();if(typeof A!="number")return;const g=ve.create(u.state.doc,A),v=u.state.tr.setSelection(g);u.dispatch(v)}stopEvent(t){var n;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:t});const r=t.target;if(!(this.dom.contains(r)&&!(!((n=this.contentDOM)===null||n===void 0)&&n.contains(r))))return!1;const o=t.type.startsWith("drag"),a=t.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(r.tagName)||r.isContentEditable)&&!a&&!o)return!0;const{isEditable:c}=this.editor,{isDragging:u}=this,l=!!this.node.type.spec.draggable,d=ve.isSelectable(this.node),p=t.type==="copy",h=t.type==="paste",A=t.type==="cut",g=t.type==="mousedown";if(!l&&d&&o&&t.target===this.dom&&t.preventDefault(),l&&o&&!u&&t.target===this.dom)return t.preventDefault(),!1;if(l&&c&&!u&&g){const v=r.closest("[data-drag-handle]");v&&(this.dom===v||this.dom.contains(v))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!(u||a||p||h||A||g&&d)}ignoreMutation(t){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:t}):this.node.isLeaf||this.node.isAtom?!0:t.type==="selection"||this.dom.contains(t.target)&&t.type==="childList"&&($S()||cX())&&this.editor.isFocused&&[...Array.from(t.addedNodes),...Array.from(t.removedNodes)].every(r=>r.isContentEditable)?!1:this.contentDOM===t.target&&t.type==="attributes"?!0:!this.contentDOM.contains(t.target)}updateAttributes(t){this.editor.commands.command(({tr:n})=>{const r=this.getPos();return typeof r!="number"?!1:(n.setNodeMarkup(r,void 0,{...this.node.attrs,...t}),!0)})}deleteNode(){const t=this.getPos();if(typeof t!="number")return;const n=t+this.node.nodeSize;this.editor.commands.deleteRange({from:t,to:n})}}function dy(e){return new h9e({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:i})=>{const o=Le(e.getAttributes,void 0,r,i);if(o===!1||o===null)return null;const{tr:a}=t,s=r[r.length-1],c=r[0];let u=n.to;if(s){const l=c.search(/\S/),d=n.from+c.indexOf(s),p=d+s.length;if(pX(n.from,n.to,t.doc).filter(A=>A.mark.type.excluded.find(v=>v===e.type&&v!==A.mark.type)).filter(A=>A.to>d).length)return null;p<n.to&&a.delete(p,n.to),d>n.from&&a.delete(n.from+l,d),u=n.from+l+s.length,a.addMark(n.from+l,u,e.type.create(o||{})),a.removeStoredMark(e.type)}}})}function K7e(e){return e.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}var fy=200,rn=function(){};rn.prototype.append=function(t){return t.length?(t=rn.from(t),!this.length&&t||t.length<fy&&this.leafAppend(t)||this.length<fy&&t.leafPrepend(this)||this.appendInner(t)):this};rn.prototype.prepend=function(t){return t.length?rn.from(t).append(this):this};rn.prototype.appendInner=function(t){return new q7e(this,t)};rn.prototype.slice=function(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.length),t>=n?rn.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,n))};rn.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)};rn.prototype.forEach=function(t,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(t,n,r,0):this.forEachInvertedInner(t,n,r,0)};rn.prototype.map=function(t,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(o,a){return i.push(t(o,a))},n,r),i};rn.from=function(t){return t instanceof rn?t:t&&t.length?new hX(t):rn.empty};var hX=function(e){function t(r){e.call(this),this.values=r}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(i,o){return i==0&&o==this.length?this:new t(this.values.slice(i,o))},t.prototype.getInner=function(i){return this.values[i]},t.prototype.forEachInner=function(i,o,a,s){for(var c=o;c<a;c++)if(i(this.values[c],s+c)===!1)return!1},t.prototype.forEachInvertedInner=function(i,o,a,s){for(var c=o-1;c>=a;c--)if(i(this.values[c],s+c)===!1)return!1},t.prototype.leafAppend=function(i){if(this.length+i.length<=fy)return new t(this.values.concat(i.flatten()))},t.prototype.leafPrepend=function(i){if(this.length+i.length<=fy)return new t(i.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(rn);rn.empty=new hX([]);var q7e=function(e){function t(n,r){e.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},t.prototype.forEachInner=function(r,i,o,a){var s=this.left.length;if(i<s&&this.left.forEachInner(r,i,Math.min(o,s),a)===!1||o>s&&this.right.forEachInner(r,Math.max(i-s,0),Math.min(this.length,o)-s,a+s)===!1)return!1},t.prototype.forEachInvertedInner=function(r,i,o,a){var s=this.left.length;if(i>s&&this.right.forEachInvertedInner(r,i-s,Math.max(o,s)-s,a+s)===!1||o<s&&this.left.forEachInvertedInner(r,Math.min(i,s),o,a)===!1)return!1},t.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var o=this.left.length;return i<=o?this.left.slice(r,i):r>=o?this.right.slice(r-o,i-o):this.left.slice(r,o).append(this.right.slice(0,i-o))},t.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new t(this.left,i)},t.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new t(i,this.right)},t.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new t(this.left,new t(this.right,r)):new t(this,r)},t}(rn);const V7e=500;class Ni{constructor(t,n){this.items=t,this.eventCount=n}popEvent(t,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,o;n&&(i=this.remapping(r,this.items.length),o=i.maps.length);let a=t.tr,s,c,u=[],l=[];return this.items.forEach((d,p)=>{if(!d.step){i||(i=this.remapping(r,p+1),o=i.maps.length),o--,l.push(d);return}if(i){l.push(new Co(d.map));let h=d.step.map(i.slice(o)),A;h&&a.maybeStep(h).doc&&(A=a.mapping.maps[a.mapping.maps.length-1],u.push(new Co(A,void 0,void 0,u.length+l.length))),o--,A&&i.appendMap(A,o)}else a.maybeStep(d.step);if(d.selection)return s=i?d.selection.map(i.slice(o)):d.selection,c=new Ni(this.items.slice(0,r).append(l.reverse().concat(u)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:a,selection:s}}addTransform(t,n,r,i){let o=[],a=this.eventCount,s=this.items,c=!i&&s.length?s.get(s.length-1):null;for(let l=0;l<t.steps.length;l++){let d=t.steps[l].invert(t.docs[l]),p=new Co(t.mapping.maps[l],d,n),h;(h=c&&c.merge(p))&&(p=h,l?o.pop():s=s.slice(0,s.length-1)),o.push(p),n&&(a++,n=void 0),i||(c=p)}let u=a-r.depth;return u>Q7e&&(s=z7e(s,u),a-=u),new Ni(s.append(o),a)}remapping(t,n){let r=new sKe;return this.items.forEach((i,o)=>{let a=i.mirrorOffset!=null&&o-i.mirrorOffset>=t?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,a)},t,n),r}addMaps(t){return this.eventCount==0?this:new Ni(this.items.append(t.map(n=>new Co(n))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),o=t.mapping,a=t.steps.length,s=this.eventCount;this.items.forEach(p=>{p.selection&&s--},i);let c=n;this.items.forEach(p=>{let h=o.getMirror(--c);if(h==null)return;a=Math.min(a,h);let A=o.maps[h];if(p.step){let g=t.steps[h].invert(t.docs[h]),v=p.selection&&p.selection.map(o.slice(c+1,h));v&&s++,r.push(new Co(A,g,v))}else r.push(new Co(A))},i);let u=[];for(let p=n;p<a;p++)u.push(new Co(o.maps[p]));let l=this.items.slice(0,i).append(u).append(r),d=new Ni(l,s);return d.emptyItemCount()>V7e&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let t=0;return this.items.forEach(n=>{n.step||t++}),t}compress(t=this.items.length){let n=this.remapping(0,t),r=n.maps.length,i=[],o=0;return this.items.forEach((a,s)=>{if(s>=t)i.push(a),a.selection&&o++;else if(a.step){let c=a.step.map(n.slice(r)),u=c&&c.getMap();if(r--,u&&n.appendMap(u,r),c){let l=a.selection&&a.selection.map(n.slice(r));l&&o++;let d=new Co(u.invert(),c,l),p,h=i.length-1;(p=i.length&&i[h].merge(d))?i[h]=p:i.push(d)}}else a.map&&r--},this.items.length,0),new Ni(rn.from(i.reverse()),o)}}Ni.empty=new Ni(rn.empty,0);function z7e(e,t){let n;return e.forEach((r,i)=>{if(r.selection&&t--==0)return n=i,!1}),e.slice(n)}class Co{constructor(t,n,r,i){this.map=t,this.step=n,this.selection=r,this.mirrorOffset=i}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new Co(n.getMap().invert(),n,this.selection)}}}class ys{constructor(t,n,r,i,o){this.done=t,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}}const Q7e=20;function H7e(e,t,n,r){let i=n.getMeta(au),o;if(i)return i.historyState;n.getMeta(J7e)&&(e=new ys(e.done,e.undone,null,0,-1));let a=n.getMeta("appendedTransaction");if(n.steps.length==0)return e;if(a&&a.getMeta(au))return a.getMeta(au).redo?new ys(e.done.addTransform(n,void 0,r,cv(t)),e.undone,cj(n.mapping.maps),e.prevTime,e.prevComposition):new ys(e.done,e.undone.addTransform(n,void 0,r,cv(t)),null,e.prevTime,e.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(a&&a.getMeta("addToHistory")===!1)){let s=n.getMeta("composition"),c=e.prevTime==0||!a&&e.prevComposition!=s&&(e.prevTime<(n.time||0)-r.newGroupDelay||!Y7e(n,e.prevRanges)),u=a?fw(e.prevRanges,n.mapping):cj(n.mapping.maps);return new ys(e.done.addTransform(n,c?t.selection.getBookmark():void 0,r,cv(t)),Ni.empty,u,n.time,s??e.prevComposition)}else return(o=n.getMeta("rebased"))?new ys(e.done.rebased(n,o),e.undone.rebased(n,o),fw(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new ys(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),fw(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function Y7e(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((r,i)=>{for(let o=0;o<t.length;o+=2)r<=t[o+1]&&i>=t[o]&&(n=!0)}),n}function cj(e){let t=[];for(let n=e.length-1;n>=0&&t.length==0;n--)e[n].forEach((r,i,o,a)=>t.push(o,a));return t}function fw(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let i=t.map(e[r],1),o=t.map(e[r+1],-1);i<=o&&n.push(i,o)}return n}function G7e(e,t,n){let r=cv(t),i=au.get(t).spec.config,o=(n?e.undone:e.done).popEvent(t,r);if(!o)return null;let a=o.selection.resolve(o.transform.doc),s=(n?e.done:e.undone).addTransform(o.transform,t.selection.getBookmark(),i,r),c=new ys(n?s:o.remaining,n?o.remaining:s,null,0,-1);return o.transform.setSelection(a).setMeta(au,{redo:n,historyState:c})}let pw=!1,uj=null;function cv(e){let t=e.plugins;if(uj!=t){pw=!1,uj=t;for(let n=0;n<t.length;n++)if(t[n].spec.historyPreserveItems){pw=!0;break}}return pw}const au=new Vn("history"),J7e=new Vn("closeHistory");function Z7e(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new kn({key:au,state:{init(){return new ys(Ni.empty,Ni.empty,null,0,-1)},apply(t,n,r){return H7e(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(t,n){let r=n.inputType,i=r=="historyUndo"?mX:r=="historyRedo"?gX:null;return i?(n.preventDefault(),i(t.state,t.dispatch)):!1}}}})}function AX(e,t){return(n,r)=>{let i=au.getState(n);if(!i||(e?i.undone:i.done).eventCount==0)return!1;if(r){let o=G7e(i,n,e);o&&r(t?o.scrollIntoView():o)}return!0}}const mX=AX(!1,!0),gX=AX(!0,!0),X7e=Cn.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>mX(e,t),redo:()=>({state:e,dispatch:t})=>gX(e,t)}},addProseMirrorPlugins(){return[Z7e(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),OS=(e,t)=>{const{$from:n}=t.selection,r=Ht(e,t.schema);let i=null,o=n.depth,a=n.pos,s=null;for(;o>0&&s===null;)i=n.node(o),i.type===r?s=o:(o-=1,a-=1);return s===null?null:{$pos:t.doc.resolve(a),depth:s}},vX=(e,t)=>{const n=OS(e,t);if(!n)return!1;const[,r]=m7e(t,e,n.$pos.pos+4);return r},eqe=(e,t,n)=>{const{$anchor:r}=e.selection,i=Math.max(0,r.pos-2),o=e.doc.resolve(i).node();return!(!o||!n.includes(o.type.name))},tqe=(e,t)=>{var n;const{$anchor:r}=t.selection,i=t.doc.resolve(r.pos-2);return!(i.index()===0||((n=i.nodeBefore)===null||n===void 0?void 0:n.type.name)!==e)},nqe=(e,t,n)=>{if(!n)return!1;const r=Ht(e,t.schema);let i=!1;return n.descendants(o=>{o.type===r&&(i=!0)}),i},lj=(e,t,n)=>{if(e.commands.undoInputRule())return!0;if(e.state.selection.from!==e.state.selection.to)return!1;if(!Pd(e.state,t)&&eqe(e.state,t,n)){const{$anchor:s}=e.state.selection,c=e.state.doc.resolve(s.before()-1),u=[];c.node().descendants((p,h)=>{p.type.name===t&&u.push({node:p,pos:h})});const l=u.at(-1);if(!l)return!1;const d=e.state.doc.resolve(c.start()+l.pos+1);return e.chain().cut({from:s.start()-1,to:s.end()+1},d.end()).joinForward().run()}if(!Pd(e.state,t)||!y7e(e.state))return!1;const r=OS(t,e.state);if(!r)return!1;const o=e.state.doc.resolve(r.$pos.pos-2).node(r.depth),a=nqe(t,e.state,o);return tqe(t,e.state)&&!a?e.commands.joinItemBackward():e.chain().liftListItem(t).run()},rqe=(e,t)=>{const n=vX(e,t),r=OS(e,t);return!r||!n?!1:n>r.depth},iqe=(e,t)=>{const n=vX(e,t),r=OS(e,t);return!r||!n?!1:n<r.depth},dj=(e,t)=>{if(!Pd(e.state,t)||!v7e(e.state,t))return!1;const{selection:n}=e.state,{$from:r,$to:i}=n;return!n.empty&&r.sameParent(i)?!1:rqe(t,e.state)?e.chain().focus(e.state.selection.from+4).lift(t).joinBackward().run():iqe(t,e.state)?e.chain().joinForward().joinBackward().run():e.commands.joinItemForward()},oqe=Cn.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&dj(e,n)&&(t=!0)}),t},"Mod-Delete":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&dj(e,n)&&(t=!0)}),t},Backspace:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&lj(e,n,r)&&(t=!0)}),t},"Mod-Backspace":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&lj(e,n,r)&&(t=!0)}),t}}}});var vr="top",wi="bottom",xi="right",yr="left",vL="auto",cg=[vr,wi,xi,yr],Nd="start",Zh="end",aqe="clippingParents",yX="viewport",Rp="popper",sqe="reference",fj=cg.reduce(function(e,t){return e.concat([t+"-"+Nd,t+"-"+Zh])},[]),bX=[].concat(cg,[vL]).reduce(function(e,t){return e.concat([t,t+"-"+Nd,t+"-"+Zh])},[]),cqe="beforeRead",uqe="read",lqe="afterRead",dqe="beforeMain",fqe="main",pqe="afterMain",hqe="beforeWrite",Aqe="write",mqe="afterWrite",gqe=[cqe,uqe,lqe,dqe,fqe,pqe,hqe,Aqe,mqe];function Uo(e){return e?(e.nodeName||"").toLowerCase():null}function Jr(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function Ru(e){var t=Jr(e).Element;return e instanceof t||e instanceof Element}function Ci(e){var t=Jr(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function yL(e){if(typeof ShadowRoot>"u")return!1;var t=Jr(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function vqe(e){var t=e.state;Object.keys(t.elements).forEach(function(n){var r=t.styles[n]||{},i=t.attributes[n]||{},o=t.elements[n];!Ci(o)||!Uo(o)||(Object.assign(o.style,r),Object.keys(i).forEach(function(a){var s=i[a];s===!1?o.removeAttribute(a):o.setAttribute(a,s===!0?"":s)}))})}function yqe(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach(function(r){var i=t.elements[r],o=t.attributes[r]||{},a=Object.keys(t.styles.hasOwnProperty(r)?t.styles[r]:n[r]),s=a.reduce(function(c,u){return c[u]="",c},{});!Ci(i)||!Uo(i)||(Object.assign(i.style,s),Object.keys(o).forEach(function(c){i.removeAttribute(c)}))})}}const SX={name:"applyStyles",enabled:!0,phase:"write",fn:vqe,effect:yqe,requires:["computeStyles"]};function Ro(e){return e.split("-")[0]}var su=Math.max,py=Math.min,Wd=Math.round;function n_(){var e=navigator.userAgentData;return e!=null&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function CX(){return!/^((?!chrome|android).)*safari/i.test(n_())}function Kd(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var r=e.getBoundingClientRect(),i=1,o=1;t&&Ci(e)&&(i=e.offsetWidth>0&&Wd(r.width)/e.offsetWidth||1,o=e.offsetHeight>0&&Wd(r.height)/e.offsetHeight||1);var a=Ru(e)?Jr(e):window,s=a.visualViewport,c=!CX()&&n,u=(r.left+(c&&s?s.offsetLeft:0))/i,l=(r.top+(c&&s?s.offsetTop:0))/o,d=r.width/i,p=r.height/o;return{width:d,height:p,top:l,right:u+d,bottom:l+p,left:u,x:u,y:l}}function bL(e){var t=Kd(e),n=e.offsetWidth,r=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function wX(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&yL(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function _a(e){return Jr(e).getComputedStyle(e)}function bqe(e){return["table","td","th"].indexOf(Uo(e))>=0}function kc(e){return((Ru(e)?e.ownerDocument:e.document)||window.document).documentElement}function MS(e){return Uo(e)==="html"?e:e.assignedSlot||e.parentNode||(yL(e)?e.host:null)||kc(e)}function pj(e){return!Ci(e)||_a(e).position==="fixed"?null:e.offsetParent}function Sqe(e){var t=/firefox/i.test(n_()),n=/Trident/i.test(n_());if(n&&Ci(e)){var r=_a(e);if(r.position==="fixed")return null}var i=MS(e);for(yL(i)&&(i=i.host);Ci(i)&&["html","body"].indexOf(Uo(i))<0;){var o=_a(i);if(o.transform!=="none"||o.perspective!=="none"||o.contain==="paint"||["transform","perspective"].indexOf(o.willChange)!==-1||t&&o.willChange==="filter"||t&&o.filter&&o.filter!=="none")return i;i=i.parentNode}return null}function ug(e){for(var t=Jr(e),n=pj(e);n&&bqe(n)&&_a(n).position==="static";)n=pj(n);return n&&(Uo(n)==="html"||Uo(n)==="body"&&_a(n).position==="static")?t:n||Sqe(e)||t}function SL(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function ih(e,t,n){return su(e,py(t,n))}function Cqe(e,t,n){var r=ih(e,t,n);return r>n?n:r}function xX(){return{top:0,right:0,bottom:0,left:0}}function _X(e){return Object.assign({},xX(),e)}function TX(e,t){return t.reduce(function(n,r){return n[r]=e,n},{})}var wqe=function(t,n){return t=typeof t=="function"?t(Object.assign({},n.rects,{placement:n.placement})):t,_X(typeof t!="number"?t:TX(t,cg))};function xqe(e){var t,n=e.state,r=e.name,i=e.options,o=n.elements.arrow,a=n.modifiersData.popperOffsets,s=Ro(n.placement),c=SL(s),u=[yr,xi].indexOf(s)>=0,l=u?"height":"width";if(!(!o||!a)){var d=wqe(i.padding,n),p=bL(o),h=c==="y"?vr:yr,A=c==="y"?wi:xi,g=n.rects.reference[l]+n.rects.reference[c]-a[c]-n.rects.popper[l],v=a[c]-n.rects.reference[c],b=ug(o),w=b?c==="y"?b.clientHeight||0:b.clientWidth||0:0,S=g/2-v/2,y=d[h],C=w-p[l]-d[A],x=w/2-p[l]/2+S,T=ih(y,x,C),I=c;n.modifiersData[r]=(t={},t[I]=T,t.centerOffset=T-x,t)}}function _qe(e){var t=e.state,n=e.options,r=n.element,i=r===void 0?"[data-popper-arrow]":r;i!=null&&(typeof i=="string"&&(i=t.elements.popper.querySelector(i),!i)||wX(t.elements.popper,i)&&(t.elements.arrow=i))}const Tqe={name:"arrow",enabled:!0,phase:"main",fn:xqe,effect:_qe,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function qd(e){return e.split("-")[1]}var Iqe={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Eqe(e,t){var n=e.x,r=e.y,i=t.devicePixelRatio||1;return{x:Wd(n*i)/i||0,y:Wd(r*i)/i||0}}function hj(e){var t,n=e.popper,r=e.popperRect,i=e.placement,o=e.variation,a=e.offsets,s=e.position,c=e.gpuAcceleration,u=e.adaptive,l=e.roundOffsets,d=e.isFixed,p=a.x,h=p===void 0?0:p,A=a.y,g=A===void 0?0:A,v=typeof l=="function"?l({x:h,y:g}):{x:h,y:g};h=v.x,g=v.y;var b=a.hasOwnProperty("x"),w=a.hasOwnProperty("y"),S=yr,y=vr,C=window;if(u){var x=ug(n),T="clientHeight",I="clientWidth";if(x===Jr(n)&&(x=kc(n),_a(x).position!=="static"&&s==="absolute"&&(T="scrollHeight",I="scrollWidth")),x=x,i===vr||(i===yr||i===xi)&&o===Zh){y=wi;var R=d&&x===C&&C.visualViewport?C.visualViewport.height:x[T];g-=R-r.height,g*=c?1:-1}if(i===yr||(i===vr||i===wi)&&o===Zh){S=xi;var O=d&&x===C&&C.visualViewport?C.visualViewport.width:x[I];h-=O-r.width,h*=c?1:-1}}var k=Object.assign({position:s},u&&Iqe),P=l===!0?Eqe({x:h,y:g},Jr(n)):{x:h,y:g};if(h=P.x,g=P.y,c){var q;return Object.assign({},k,(q={},q[y]=w?"0":"",q[S]=b?"0":"",q.transform=(C.devicePixelRatio||1)<=1?"translate("+h+"px, "+g+"px)":"translate3d("+h+"px, "+g+"px, 0)",q))}return Object.assign({},k,(t={},t[y]=w?g+"px":"",t[S]=b?h+"px":"",t.transform="",t))}function Rqe(e){var t=e.state,n=e.options,r=n.gpuAcceleration,i=r===void 0?!0:r,o=n.adaptive,a=o===void 0?!0:o,s=n.roundOffsets,c=s===void 0?!0:s,u={placement:Ro(t.placement),variation:qd(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:i,isFixed:t.options.strategy==="fixed"};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,hj(Object.assign({},u,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:a,roundOffsets:c})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,hj(Object.assign({},u,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:c})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}const $qe={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:Rqe,data:{}};var jg={passive:!0};function kqe(e){var t=e.state,n=e.instance,r=e.options,i=r.scroll,o=i===void 0?!0:i,a=r.resize,s=a===void 0?!0:a,c=Jr(t.elements.popper),u=[].concat(t.scrollParents.reference,t.scrollParents.popper);return o&&u.forEach(function(l){l.addEventListener("scroll",n.update,jg)}),s&&c.addEventListener("resize",n.update,jg),function(){o&&u.forEach(function(l){l.removeEventListener("scroll",n.update,jg)}),s&&c.removeEventListener("resize",n.update,jg)}}const Oqe={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:kqe,data:{}};var Mqe={left:"right",right:"left",bottom:"top",top:"bottom"};function uv(e){return e.replace(/left|right|bottom|top/g,function(t){return Mqe[t]})}var Fqe={start:"end",end:"start"};function Aj(e){return e.replace(/start|end/g,function(t){return Fqe[t]})}function CL(e){var t=Jr(e),n=t.pageXOffset,r=t.pageYOffset;return{scrollLeft:n,scrollTop:r}}function wL(e){return Kd(kc(e)).left+CL(e).scrollLeft}function Lqe(e,t){var n=Jr(e),r=kc(e),i=n.visualViewport,o=r.clientWidth,a=r.clientHeight,s=0,c=0;if(i){o=i.width,a=i.height;var u=CX();(u||!u&&t==="fixed")&&(s=i.offsetLeft,c=i.offsetTop)}return{width:o,height:a,x:s+wL(e),y:c}}function Bqe(e){var t,n=kc(e),r=CL(e),i=(t=e.ownerDocument)==null?void 0:t.body,o=su(n.scrollWidth,n.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),a=su(n.scrollHeight,n.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),s=-r.scrollLeft+wL(e),c=-r.scrollTop;return _a(i||n).direction==="rtl"&&(s+=su(n.clientWidth,i?i.clientWidth:0)-o),{width:o,height:a,x:s,y:c}}function xL(e){var t=_a(e),n=t.overflow,r=t.overflowX,i=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+i+r)}function IX(e){return["html","body","#document"].indexOf(Uo(e))>=0?e.ownerDocument.body:Ci(e)&&xL(e)?e:IX(MS(e))}function oh(e,t){var n;t===void 0&&(t=[]);var r=IX(e),i=r===((n=e.ownerDocument)==null?void 0:n.body),o=Jr(r),a=i?[o].concat(o.visualViewport||[],xL(r)?r:[]):r,s=t.concat(a);return i?s:s.concat(oh(MS(a)))}function r_(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function Dqe(e,t){var n=Kd(e,!1,t==="fixed");return n.top=n.top+e.clientTop,n.left=n.left+e.clientLeft,n.bottom=n.top+e.clientHeight,n.right=n.left+e.clientWidth,n.width=e.clientWidth,n.height=e.clientHeight,n.x=n.left,n.y=n.top,n}function mj(e,t,n){return t===yX?r_(Lqe(e,n)):Ru(t)?Dqe(t,n):r_(Bqe(kc(e)))}function jqe(e){var t=oh(MS(e)),n=["absolute","fixed"].indexOf(_a(e).position)>=0,r=n&&Ci(e)?ug(e):e;return Ru(r)?t.filter(function(i){return Ru(i)&&wX(i,r)&&Uo(i)!=="body"}):[]}function Uqe(e,t,n,r){var i=t==="clippingParents"?jqe(e):[].concat(t),o=[].concat(i,[n]),a=o[0],s=o.reduce(function(c,u){var l=mj(e,u,r);return c.top=su(l.top,c.top),c.right=py(l.right,c.right),c.bottom=py(l.bottom,c.bottom),c.left=su(l.left,c.left),c},mj(e,a,r));return s.width=s.right-s.left,s.height=s.bottom-s.top,s.x=s.left,s.y=s.top,s}function EX(e){var t=e.reference,n=e.element,r=e.placement,i=r?Ro(r):null,o=r?qd(r):null,a=t.x+t.width/2-n.width/2,s=t.y+t.height/2-n.height/2,c;switch(i){case vr:c={x:a,y:t.y-n.height};break;case wi:c={x:a,y:t.y+t.height};break;case xi:c={x:t.x+t.width,y:s};break;case yr:c={x:t.x-n.width,y:s};break;default:c={x:t.x,y:t.y}}var u=i?SL(i):null;if(u!=null){var l=u==="y"?"height":"width";switch(o){case Nd:c[u]=c[u]-(t[l]/2-n[l]/2);break;case Zh:c[u]=c[u]+(t[l]/2-n[l]/2);break}}return c}function Xh(e,t){t===void 0&&(t={});var n=t,r=n.placement,i=r===void 0?e.placement:r,o=n.strategy,a=o===void 0?e.strategy:o,s=n.boundary,c=s===void 0?aqe:s,u=n.rootBoundary,l=u===void 0?yX:u,d=n.elementContext,p=d===void 0?Rp:d,h=n.altBoundary,A=h===void 0?!1:h,g=n.padding,v=g===void 0?0:g,b=_X(typeof v!="number"?v:TX(v,cg)),w=p===Rp?sqe:Rp,S=e.rects.popper,y=e.elements[A?w:p],C=Uqe(Ru(y)?y:y.contextElement||kc(e.elements.popper),c,l,a),x=Kd(e.elements.reference),T=EX({reference:x,element:S,strategy:"absolute",placement:i}),I=r_(Object.assign({},S,T)),R=p===Rp?I:x,O={top:C.top-R.top+b.top,bottom:R.bottom-C.bottom+b.bottom,left:C.left-R.left+b.left,right:R.right-C.right+b.right},k=e.modifiersData.offset;if(p===Rp&&k){var P=k[i];Object.keys(O).forEach(function(q){var Y=[xi,wi].indexOf(q)>=0?1:-1,te=[vr,wi].indexOf(q)>=0?"y":"x";O[q]+=P[te]*Y})}return O}function Pqe(e,t){t===void 0&&(t={});var n=t,r=n.placement,i=n.boundary,o=n.rootBoundary,a=n.padding,s=n.flipVariations,c=n.allowedAutoPlacements,u=c===void 0?bX:c,l=qd(r),d=l?s?fj:fj.filter(function(A){return qd(A)===l}):cg,p=d.filter(function(A){return u.indexOf(A)>=0});p.length===0&&(p=d);var h=p.reduce(function(A,g){return A[g]=Xh(e,{placement:g,boundary:i,rootBoundary:o,padding:a})[Ro(g)],A},{});return Object.keys(h).sort(function(A,g){return h[A]-h[g]})}function Nqe(e){if(Ro(e)===vL)return[];var t=uv(e);return[Aj(e),t,Aj(t)]}function Wqe(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var i=n.mainAxis,o=i===void 0?!0:i,a=n.altAxis,s=a===void 0?!0:a,c=n.fallbackPlacements,u=n.padding,l=n.boundary,d=n.rootBoundary,p=n.altBoundary,h=n.flipVariations,A=h===void 0?!0:h,g=n.allowedAutoPlacements,v=t.options.placement,b=Ro(v),w=b===v,S=c||(w||!A?[uv(v)]:Nqe(v)),y=[v].concat(S).reduce(function(_e,j){return _e.concat(Ro(j)===vL?Pqe(t,{placement:j,boundary:l,rootBoundary:d,padding:u,flipVariations:A,allowedAutoPlacements:g}):j)},[]),C=t.rects.reference,x=t.rects.popper,T=new Map,I=!0,R=y[0],O=0;O<y.length;O++){var k=y[O],P=Ro(k),q=qd(k)===Nd,Y=[vr,wi].indexOf(P)>=0,te=Y?"width":"height",G=Xh(t,{placement:k,boundary:l,rootBoundary:d,altBoundary:p,padding:u}),ee=Y?q?xi:yr:q?wi:vr;C[te]>x[te]&&(ee=uv(ee));var ne=uv(ee),F=[];if(o&&F.push(G[P]<=0),s&&F.push(G[ee]<=0,G[ne]<=0),F.every(function(_e){return _e})){R=k,I=!1;break}T.set(k,F)}if(I)for(var M=A?3:1,N=function(j){var he=y.find(function(kt){var Qt=T.get(kt);if(Qt)return Qt.slice(0,j).every(function(fi){return fi})});if(he)return R=he,"break"},se=M;se>0;se--){var Oe=N(se);if(Oe==="break")break}t.placement!==R&&(t.modifiersData[r]._skip=!0,t.placement=R,t.reset=!0)}}const Kqe={name:"flip",enabled:!0,phase:"main",fn:Wqe,requiresIfExists:["offset"],data:{_skip:!1}};function gj(e,t,n){return n===void 0&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function vj(e){return[vr,xi,wi,yr].some(function(t){return e[t]>=0})}function qqe(e){var t=e.state,n=e.name,r=t.rects.reference,i=t.rects.popper,o=t.modifiersData.preventOverflow,a=Xh(t,{elementContext:"reference"}),s=Xh(t,{altBoundary:!0}),c=gj(a,r),u=gj(s,i,o),l=vj(c),d=vj(u);t.modifiersData[n]={referenceClippingOffsets:c,popperEscapeOffsets:u,isReferenceHidden:l,hasPopperEscaped:d},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":l,"data-popper-escaped":d})}const Vqe={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:qqe};function zqe(e,t,n){var r=Ro(e),i=[yr,vr].indexOf(r)>=0?-1:1,o=typeof n=="function"?n(Object.assign({},t,{placement:e})):n,a=o[0],s=o[1];return a=a||0,s=(s||0)*i,[yr,xi].indexOf(r)>=0?{x:s,y:a}:{x:a,y:s}}function Qqe(e){var t=e.state,n=e.options,r=e.name,i=n.offset,o=i===void 0?[0,0]:i,a=bX.reduce(function(l,d){return l[d]=zqe(d,t.rects,o),l},{}),s=a[t.placement],c=s.x,u=s.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=c,t.modifiersData.popperOffsets.y+=u),t.modifiersData[r]=a}const Hqe={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:Qqe};function Yqe(e){var t=e.state,n=e.name;t.modifiersData[n]=EX({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})}const Gqe={name:"popperOffsets",enabled:!0,phase:"read",fn:Yqe,data:{}};function Jqe(e){return e==="x"?"y":"x"}function Zqe(e){var t=e.state,n=e.options,r=e.name,i=n.mainAxis,o=i===void 0?!0:i,a=n.altAxis,s=a===void 0?!1:a,c=n.boundary,u=n.rootBoundary,l=n.altBoundary,d=n.padding,p=n.tether,h=p===void 0?!0:p,A=n.tetherOffset,g=A===void 0?0:A,v=Xh(t,{boundary:c,rootBoundary:u,padding:d,altBoundary:l}),b=Ro(t.placement),w=qd(t.placement),S=!w,y=SL(b),C=Jqe(y),x=t.modifiersData.popperOffsets,T=t.rects.reference,I=t.rects.popper,R=typeof g=="function"?g(Object.assign({},t.rects,{placement:t.placement})):g,O=typeof R=="number"?{mainAxis:R,altAxis:R}:Object.assign({mainAxis:0,altAxis:0},R),k=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,P={x:0,y:0};if(x){if(o){var q,Y=y==="y"?vr:yr,te=y==="y"?wi:xi,G=y==="y"?"height":"width",ee=x[y],ne=ee+v[Y],F=ee-v[te],M=h?-I[G]/2:0,N=w===Nd?T[G]:I[G],se=w===Nd?-I[G]:-T[G],Oe=t.elements.arrow,_e=h&&Oe?bL(Oe):{width:0,height:0},j=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:xX(),he=j[Y],kt=j[te],Qt=ih(0,T[G],_e[G]),fi=S?T[G]/2-M-Qt-he-O.mainAxis:N-Qt-he-O.mainAxis,pi=S?-T[G]/2+M+Qt+kt+O.mainAxis:se+Qt+kt+O.mainAxis,vo=t.elements.arrow&&ug(t.elements.arrow),aa=vo?y==="y"?vo.clientTop||0:vo.clientLeft||0:0,ze=(q=k==null?void 0:k[y])!=null?q:0,mt=ee+fi-ze-aa,Xt=ee+pi-ze,Ot=ih(h?py(ne,mt):ne,ee,h?su(F,Xt):F);x[y]=Ot,P[y]=Ot-ee}if(s){var fn,fs=y==="x"?vr:yr,ps=y==="x"?wi:xi,hi=x[C],yo=C==="y"?"height":"width",Oc=hi+v[fs],sa=hi-v[ps],Mc=[vr,yr].indexOf(b)!==-1,Bl=(fn=k==null?void 0:k[C])!=null?fn:0,Dl=Mc?Oc:hi-T[yo]-I[yo]-Bl+O.altAxis,jl=Mc?hi+T[yo]+I[yo]-Bl-O.altAxis:sa,Ul=h&&Mc?Cqe(Dl,hi,jl):ih(h?Dl:Oc,hi,h?jl:sa);x[C]=Ul,P[C]=Ul-hi}t.modifiersData[r]=P}}const Xqe={name:"preventOverflow",enabled:!0,phase:"main",fn:Zqe,requiresIfExists:["offset"]};function eVe(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function tVe(e){return e===Jr(e)||!Ci(e)?CL(e):eVe(e)}function nVe(e){var t=e.getBoundingClientRect(),n=Wd(t.width)/e.offsetWidth||1,r=Wd(t.height)/e.offsetHeight||1;return n!==1||r!==1}function rVe(e,t,n){n===void 0&&(n=!1);var r=Ci(t),i=Ci(t)&&nVe(t),o=kc(t),a=Kd(e,i,n),s={scrollLeft:0,scrollTop:0},c={x:0,y:0};return(r||!r&&!n)&&((Uo(t)!=="body"||xL(o))&&(s=tVe(t)),Ci(t)?(c=Kd(t,!0),c.x+=t.clientLeft,c.y+=t.clientTop):o&&(c.x=wL(o))),{x:a.left+s.scrollLeft-c.x,y:a.top+s.scrollTop-c.y,width:a.width,height:a.height}}function iVe(e){var t=new Map,n=new Set,r=[];e.forEach(function(o){t.set(o.name,o)});function i(o){n.add(o.name);var a=[].concat(o.requires||[],o.requiresIfExists||[]);a.forEach(function(s){if(!n.has(s)){var c=t.get(s);c&&i(c)}}),r.push(o)}return e.forEach(function(o){n.has(o.name)||i(o)}),r}function oVe(e){var t=iVe(e);return gqe.reduce(function(n,r){return n.concat(t.filter(function(i){return i.phase===r}))},[])}function aVe(e){var t;return function(){return t||(t=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})})),t}}function sVe(e){var t=e.reduce(function(n,r){var i=n[r.name];return n[r.name]=i?Object.assign({},i,r,{options:Object.assign({},i.options,r.options),data:Object.assign({},i.data,r.data)}):r,n},{});return Object.keys(t).map(function(n){return t[n]})}var yj={placement:"bottom",modifiers:[],strategy:"absolute"};function bj(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return!t.some(function(r){return!(r&&typeof r.getBoundingClientRect=="function")})}function cVe(e){e===void 0&&(e={});var t=e,n=t.defaultModifiers,r=n===void 0?[]:n,i=t.defaultOptions,o=i===void 0?yj:i;return function(s,c,u){u===void 0&&(u=o);var l={placement:"bottom",orderedModifiers:[],options:Object.assign({},yj,o),modifiersData:{},elements:{reference:s,popper:c},attributes:{},styles:{}},d=[],p=!1,h={state:l,setOptions:function(b){var w=typeof b=="function"?b(l.options):b;g(),l.options=Object.assign({},o,l.options,w),l.scrollParents={reference:Ru(s)?oh(s):s.contextElement?oh(s.contextElement):[],popper:oh(c)};var S=oVe(sVe([].concat(r,l.options.modifiers)));return l.orderedModifiers=S.filter(function(y){return y.enabled}),A(),h.update()},forceUpdate:function(){if(!p){var b=l.elements,w=b.reference,S=b.popper;if(bj(w,S)){l.rects={reference:rVe(w,ug(S),l.options.strategy==="fixed"),popper:bL(S)},l.reset=!1,l.placement=l.options.placement,l.orderedModifiers.forEach(function(O){return l.modifiersData[O.name]=Object.assign({},O.data)});for(var y=0;y<l.orderedModifiers.length;y++){if(l.reset===!0){l.reset=!1,y=-1;continue}var C=l.orderedModifiers[y],x=C.fn,T=C.options,I=T===void 0?{}:T,R=C.name;typeof x=="function"&&(l=x({state:l,options:I,name:R,instance:h})||l)}}}},update:aVe(function(){return new Promise(function(v){h.forceUpdate(),v(l)})}),destroy:function(){g(),p=!0}};if(!bj(s,c))return h;h.setOptions(u).then(function(v){!p&&u.onFirstUpdate&&u.onFirstUpdate(v)});function A(){l.orderedModifiers.forEach(function(v){var b=v.name,w=v.options,S=w===void 0?{}:w,y=v.effect;if(typeof y=="function"){var C=y({state:l,name:b,instance:h,options:S}),x=function(){};d.push(C||x)}})}function g(){d.forEach(function(v){return v()}),d=[]}return h}}var uVe=[Oqe,Gqe,$qe,SX,Hqe,Kqe,Xqe,Tqe,Vqe],lVe=cVe({defaultModifiers:uVe}),dVe="tippy-box",RX="tippy-content",fVe="tippy-backdrop",$X="tippy-arrow",kX="tippy-svg-arrow",Kc={passive:!0,capture:!0},OX=function(){return document.body};function pVe(e,t){return{}.hasOwnProperty.call(e,t)}function hw(e,t,n){if(Array.isArray(e)){var r=e[t];return r??(Array.isArray(n)?n[t]:n)}return e}function _L(e,t){var n={}.toString.call(e);return n.indexOf("[object")===0&&n.indexOf(t+"]")>-1}function MX(e,t){return typeof e=="function"?e.apply(void 0,t):e}function Sj(e,t){if(t===0)return e;var n;return function(r){clearTimeout(n),n=setTimeout(function(){e(r)},t)}}function hVe(e,t){var n=Object.assign({},e);return t.forEach(function(r){delete n[r]}),n}function AVe(e){return e.split(/\s+/).filter(Boolean)}function id(e){return[].concat(e)}function Cj(e,t){e.indexOf(t)===-1&&e.push(t)}function mVe(e){return e.filter(function(t,n){return e.indexOf(t)===n})}function gVe(e){return e.split("-")[0]}function hy(e){return[].slice.call(e)}function wj(e){return Object.keys(e).reduce(function(t,n){return e[n]!==void 0&&(t[n]=e[n]),t},{})}function ah(){return document.createElement("div")}function eA(e){return["Element","Fragment"].some(function(t){return _L(e,t)})}function vVe(e){return _L(e,"NodeList")}function yVe(e){return _L(e,"MouseEvent")}function bVe(e){return!!(e&&e._tippy&&e._tippy.reference===e)}function SVe(e){return eA(e)?[e]:vVe(e)?hy(e):Array.isArray(e)?e:hy(document.querySelectorAll(e))}function Aw(e,t){e.forEach(function(n){n&&(n.style.transitionDuration=t+"ms")})}function xj(e,t){e.forEach(function(n){n&&n.setAttribute("data-state",t)})}function CVe(e){var t,n=id(e),r=n[0];return r!=null&&(t=r.ownerDocument)!=null&&t.body?r.ownerDocument:document}function wVe(e,t){var n=t.clientX,r=t.clientY;return e.every(function(i){var o=i.popperRect,a=i.popperState,s=i.props,c=s.interactiveBorder,u=gVe(a.placement),l=a.modifiersData.offset;if(!l)return!0;var d=u==="bottom"?l.top.y:0,p=u==="top"?l.bottom.y:0,h=u==="right"?l.left.x:0,A=u==="left"?l.right.x:0,g=o.top-r+d>c,v=r-o.bottom-p>c,b=o.left-n+h>c,w=n-o.right-A>c;return g||v||b||w})}function mw(e,t,n){var r=t+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(i){e[r](i,n)})}function _j(e,t){for(var n=t;n;){var r;if(e.contains(n))return!0;n=n.getRootNode==null||(r=n.getRootNode())==null?void 0:r.host}return!1}var wo={isTouch:!1},Tj=0;function xVe(){wo.isTouch||(wo.isTouch=!0,window.performance&&document.addEventListener("mousemove",FX))}function FX(){var e=performance.now();e-Tj<20&&(wo.isTouch=!1,document.removeEventListener("mousemove",FX)),Tj=e}function _Ve(){var e=document.activeElement;if(bVe(e)){var t=e._tippy;e.blur&&!t.state.isVisible&&e.blur()}}function TVe(){document.addEventListener("touchstart",xVe,Kc),window.addEventListener("blur",_Ve)}var IVe=typeof window<"u"&&typeof document<"u",EVe=IVe?!!window.msCrypto:!1;function Hl(e){var t=e==="destroy"?"n already-":" ";return[e+"() was called on a"+t+"destroyed instance. This is a no-op but","indicates a potential memory leak."].join(" ")}function Ij(e){var t=/[ \t]{2,}/g,n=/^[ \t]*/gm;return e.replace(t," ").replace(n,"").trim()}function RVe(e){return Ij(`
|
|
72
|
+
%ctippy.js
|
|
73
|
+
|
|
74
|
+
%c`+Ij(e)+`
|
|
75
|
+
|
|
76
|
+
%c👷 This is a development-only message. It will be removed in production.
|
|
77
|
+
`)}function LX(e){return[RVe(e),"color: #00C584; font-size: 1.3em; font-weight: bold;","line-height: 1.5","color: #a6a095;"]}var tA;process.env.NODE_ENV!=="production"&&$Ve();function $Ve(){tA=new Set}function Aa(e,t){if(e&&!tA.has(t)){var n;tA.add(t),(n=console).warn.apply(n,LX(t))}}function i_(e,t){if(e&&!tA.has(t)){var n;tA.add(t),(n=console).error.apply(n,LX(t))}}function kVe(e){var t=!e,n=Object.prototype.toString.call(e)==="[object Object]"&&!e.addEventListener;i_(t,["tippy() was passed","`"+String(e)+"`","as its targets (first) argument. Valid types are: String, Element,","Element[], or NodeList."].join(" ")),i_(n,["tippy() was passed a plain object which is not supported as an argument","for virtual positioning. Use props.getReferenceClientRect instead."].join(" "))}var BX={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},OVe={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},Pr=Object.assign({appendTo:OX,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},BX,OVe),MVe=Object.keys(Pr),FVe=function(t){process.env.NODE_ENV!=="production"&&jX(t,[]);var n=Object.keys(t);n.forEach(function(r){Pr[r]=t[r]})};function DX(e){var t=e.plugins||[],n=t.reduce(function(r,i){var o=i.name,a=i.defaultValue;if(o){var s;r[o]=e[o]!==void 0?e[o]:(s=Pr[o])!=null?s:a}return r},{});return Object.assign({},e,n)}function LVe(e,t){var n=t?Object.keys(DX(Object.assign({},Pr,{plugins:t}))):MVe,r=n.reduce(function(i,o){var a=(e.getAttribute("data-tippy-"+o)||"").trim();if(!a)return i;if(o==="content")i[o]=a;else try{i[o]=JSON.parse(a)}catch{i[o]=a}return i},{});return r}function Ej(e,t){var n=Object.assign({},t,{content:MX(t.content,[e])},t.ignoreAttributes?{}:LVe(e,t.plugins));return n.aria=Object.assign({},Pr.aria,n.aria),n.aria={expanded:n.aria.expanded==="auto"?t.interactive:n.aria.expanded,content:n.aria.content==="auto"?t.interactive?null:"describedby":n.aria.content},n}function jX(e,t){e===void 0&&(e={}),t===void 0&&(t=[]);var n=Object.keys(e);n.forEach(function(r){var i=hVe(Pr,Object.keys(BX)),o=!pVe(i,r);o&&(o=t.filter(function(a){return a.name===r}).length===0),Aa(o,["`"+r+"`","is not a valid prop. You may have spelled it incorrectly, or if it's","a plugin, forgot to pass it in an array as props.plugins.",`
|
|
78
|
+
|
|
79
|
+
`,`All props: https://atomiks.github.io/tippyjs/v6/all-props/
|
|
80
|
+
`,"Plugins: https://atomiks.github.io/tippyjs/v6/plugins/"].join(" "))})}var BVe=function(){return"innerHTML"};function o_(e,t){e[BVe()]=t}function Rj(e){var t=ah();return e===!0?t.className=$X:(t.className=kX,eA(e)?t.appendChild(e):o_(t,e)),t}function $j(e,t){eA(t.content)?(o_(e,""),e.appendChild(t.content)):typeof t.content!="function"&&(t.allowHTML?o_(e,t.content):e.textContent=t.content)}function a_(e){var t=e.firstElementChild,n=hy(t.children);return{box:t,content:n.find(function(r){return r.classList.contains(RX)}),arrow:n.find(function(r){return r.classList.contains($X)||r.classList.contains(kX)}),backdrop:n.find(function(r){return r.classList.contains(fVe)})}}function UX(e){var t=ah(),n=ah();n.className=dVe,n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var r=ah();r.className=RX,r.setAttribute("data-state","hidden"),$j(r,e.props),t.appendChild(n),n.appendChild(r),i(e.props,e.props);function i(o,a){var s=a_(t),c=s.box,u=s.content,l=s.arrow;a.theme?c.setAttribute("data-theme",a.theme):c.removeAttribute("data-theme"),typeof a.animation=="string"?c.setAttribute("data-animation",a.animation):c.removeAttribute("data-animation"),a.inertia?c.setAttribute("data-inertia",""):c.removeAttribute("data-inertia"),c.style.maxWidth=typeof a.maxWidth=="number"?a.maxWidth+"px":a.maxWidth,a.role?c.setAttribute("role",a.role):c.removeAttribute("role"),(o.content!==a.content||o.allowHTML!==a.allowHTML)&&$j(u,e.props),a.arrow?l?o.arrow!==a.arrow&&(c.removeChild(l),c.appendChild(Rj(a.arrow))):c.appendChild(Rj(a.arrow)):l&&c.removeChild(l)}return{popper:t,onUpdate:i}}UX.$$tippy=!0;var DVe=1,Ug=[],gw=[];function jVe(e,t){var n=Ej(e,Object.assign({},Pr,DX(wj(t)))),r,i,o,a=!1,s=!1,c=!1,u=!1,l,d,p,h=[],A=Sj(mt,n.interactiveDebounce),g,v=DVe++,b=null,w=mVe(n.plugins),S={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},y={id:v,reference:e,popper:ah(),popperInstance:b,props:n,state:S,plugins:w,clearDelayTimeouts:Dl,setProps:jl,setContent:Ul,show:qS,hide:B,hideWithInteractivity:L,enable:Mc,disable:Bl,unmount:K,destroy:je};if(!n.render)return process.env.NODE_ENV!=="production"&&i_(!0,"render() function has not been supplied."),y;var C=n.render(y),x=C.popper,T=C.onUpdate;x.setAttribute("data-tippy-root",""),x.id="tippy-"+y.id,y.popper=x,e._tippy=y,x._tippy=y;var I=w.map(function(D){return D.fn(y)}),R=e.hasAttribute("aria-expanded");return vo(),M(),ee(),ne("onCreate",[y]),n.showOnCreate&&Oc(),x.addEventListener("mouseenter",function(){y.props.interactive&&y.state.isVisible&&y.clearDelayTimeouts()}),x.addEventListener("mouseleave",function(){y.props.interactive&&y.props.trigger.indexOf("mouseenter")>=0&&Y().addEventListener("mousemove",A)}),y;function O(){var D=y.props.touch;return Array.isArray(D)?D:[D,0]}function k(){return O()[0]==="hold"}function P(){var D;return!!((D=y.props.render)!=null&&D.$$tippy)}function q(){return g||e}function Y(){var D=q().parentNode;return D?CVe(D):document}function te(){return a_(x)}function G(D){return y.state.isMounted&&!y.state.isVisible||wo.isTouch||l&&l.type==="focus"?0:hw(y.props.delay,D?0:1,Pr.delay)}function ee(D){D===void 0&&(D=!1),x.style.pointerEvents=y.props.interactive&&!D?"":"none",x.style.zIndex=""+y.props.zIndex}function ne(D,oe,be){if(be===void 0&&(be=!0),I.forEach(function($e){$e[D]&&$e[D].apply($e,oe)}),be){var ge;(ge=y.props)[D].apply(ge,oe)}}function F(){var D=y.props.aria;if(D.content){var oe="aria-"+D.content,be=x.id,ge=id(y.props.triggerTarget||e);ge.forEach(function($e){var xt=$e.getAttribute(oe);if(y.state.isVisible)$e.setAttribute(oe,xt?xt+" "+be:be);else{var Ai=xt&&xt.replace(be,"").trim();Ai?$e.setAttribute(oe,Ai):$e.removeAttribute(oe)}})}}function M(){if(!(R||!y.props.aria.expanded)){var D=id(y.props.triggerTarget||e);D.forEach(function(oe){y.props.interactive?oe.setAttribute("aria-expanded",y.state.isVisible&&oe===q()?"true":"false"):oe.removeAttribute("aria-expanded")})}}function N(){Y().removeEventListener("mousemove",A),Ug=Ug.filter(function(D){return D!==A})}function se(D){if(!(wo.isTouch&&(c||D.type==="mousedown"))){var oe=D.composedPath&&D.composedPath()[0]||D.target;if(!(y.props.interactive&&_j(x,oe))){if(id(y.props.triggerTarget||e).some(function(be){return _j(be,oe)})){if(wo.isTouch||y.state.isVisible&&y.props.trigger.indexOf("click")>=0)return}else ne("onClickOutside",[y,D]);y.props.hideOnClick===!0&&(y.clearDelayTimeouts(),y.hide(),s=!0,setTimeout(function(){s=!1}),y.state.isMounted||he())}}}function Oe(){c=!0}function _e(){c=!1}function j(){var D=Y();D.addEventListener("mousedown",se,!0),D.addEventListener("touchend",se,Kc),D.addEventListener("touchstart",_e,Kc),D.addEventListener("touchmove",Oe,Kc)}function he(){var D=Y();D.removeEventListener("mousedown",se,!0),D.removeEventListener("touchend",se,Kc),D.removeEventListener("touchstart",_e,Kc),D.removeEventListener("touchmove",Oe,Kc)}function kt(D,oe){fi(D,function(){!y.state.isVisible&&x.parentNode&&x.parentNode.contains(x)&&oe()})}function Qt(D,oe){fi(D,oe)}function fi(D,oe){var be=te().box;function ge($e){$e.target===be&&(mw(be,"remove",ge),oe())}if(D===0)return oe();mw(be,"remove",d),mw(be,"add",ge),d=ge}function pi(D,oe,be){be===void 0&&(be=!1);var ge=id(y.props.triggerTarget||e);ge.forEach(function($e){$e.addEventListener(D,oe,be),h.push({node:$e,eventType:D,handler:oe,options:be})})}function vo(){k()&&(pi("touchstart",ze,{passive:!0}),pi("touchend",Xt,{passive:!0})),AVe(y.props.trigger).forEach(function(D){if(D!=="manual")switch(pi(D,ze),D){case"mouseenter":pi("mouseleave",Xt);break;case"focus":pi(EVe?"focusout":"blur",Ot);break;case"focusin":pi("focusout",Ot);break}})}function aa(){h.forEach(function(D){var oe=D.node,be=D.eventType,ge=D.handler,$e=D.options;oe.removeEventListener(be,ge,$e)}),h=[]}function ze(D){var oe,be=!1;if(!(!y.state.isEnabled||fn(D)||s)){var ge=((oe=l)==null?void 0:oe.type)==="focus";l=D,g=D.currentTarget,M(),!y.state.isVisible&&yVe(D)&&Ug.forEach(function($e){return $e(D)}),D.type==="click"&&(y.props.trigger.indexOf("mouseenter")<0||a)&&y.props.hideOnClick!==!1&&y.state.isVisible?be=!0:Oc(D),D.type==="click"&&(a=!be),be&&!ge&&sa(D)}}function mt(D){var oe=D.target,be=q().contains(oe)||x.contains(oe);if(!(D.type==="mousemove"&&be)){var ge=yo().concat(x).map(function($e){var xt,Ai=$e._tippy,Pl=(xt=Ai.popperInstance)==null?void 0:xt.state;return Pl?{popperRect:$e.getBoundingClientRect(),popperState:Pl,props:n}:null}).filter(Boolean);wVe(ge,D)&&(N(),sa(D))}}function Xt(D){var oe=fn(D)||y.props.trigger.indexOf("click")>=0&&a;if(!oe){if(y.props.interactive){y.hideWithInteractivity(D);return}sa(D)}}function Ot(D){y.props.trigger.indexOf("focusin")<0&&D.target!==q()||y.props.interactive&&D.relatedTarget&&x.contains(D.relatedTarget)||sa(D)}function fn(D){return wo.isTouch?k()!==D.type.indexOf("touch")>=0:!1}function fs(){ps();var D=y.props,oe=D.popperOptions,be=D.placement,ge=D.offset,$e=D.getReferenceClientRect,xt=D.moveTransition,Ai=P()?a_(x).arrow:null,Pl=$e?{getBoundingClientRect:$e,contextElement:$e.contextElement||q()}:e,VL={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(hg){var Nl=hg.state;if(P()){var cte=te(),zS=cte.box;["placement","reference-hidden","escaped"].forEach(function(Ag){Ag==="placement"?zS.setAttribute("data-placement",Nl.placement):Nl.attributes.popper["data-popper-"+Ag]?zS.setAttribute("data-"+Ag,""):zS.removeAttribute("data-"+Ag)}),Nl.attributes.popper={}}}},Fc=[{name:"offset",options:{offset:ge}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!xt}},VL];P()&&Ai&&Fc.push({name:"arrow",options:{element:Ai,padding:3}}),Fc.push.apply(Fc,(oe==null?void 0:oe.modifiers)||[]),y.popperInstance=lVe(Pl,x,Object.assign({},oe,{placement:be,onFirstUpdate:p,modifiers:Fc}))}function ps(){y.popperInstance&&(y.popperInstance.destroy(),y.popperInstance=null)}function hi(){var D=y.props.appendTo,oe,be=q();y.props.interactive&&D===OX||D==="parent"?oe=be.parentNode:oe=MX(D,[be]),oe.contains(x)||oe.appendChild(x),y.state.isMounted=!0,fs(),process.env.NODE_ENV!=="production"&&Aa(y.props.interactive&&D===Pr.appendTo&&be.nextElementSibling!==x,["Interactive tippy element may not be accessible via keyboard","navigation because it is not directly after the reference element","in the DOM source order.",`
|
|
81
|
+
|
|
82
|
+
`,"Using a wrapper <div> or <span> tag around the reference element","solves this by creating a new parentNode context.",`
|
|
83
|
+
|
|
84
|
+
`,"Specifying `appendTo: document.body` silences this warning, but it","assumes you are using a focus management solution to handle","keyboard navigation.",`
|
|
85
|
+
|
|
86
|
+
`,"See: https://atomiks.github.io/tippyjs/v6/accessibility/#interactivity"].join(" "))}function yo(){return hy(x.querySelectorAll("[data-tippy-root]"))}function Oc(D){y.clearDelayTimeouts(),D&&ne("onTrigger",[y,D]),j();var oe=G(!0),be=O(),ge=be[0],$e=be[1];wo.isTouch&&ge==="hold"&&$e&&(oe=$e),oe?r=setTimeout(function(){y.show()},oe):y.show()}function sa(D){if(y.clearDelayTimeouts(),ne("onUntrigger",[y,D]),!y.state.isVisible){he();return}if(!(y.props.trigger.indexOf("mouseenter")>=0&&y.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(D.type)>=0&&a)){var oe=G(!1);oe?i=setTimeout(function(){y.state.isVisible&&y.hide()},oe):o=requestAnimationFrame(function(){y.hide()})}}function Mc(){y.state.isEnabled=!0}function Bl(){y.hide(),y.state.isEnabled=!1}function Dl(){clearTimeout(r),clearTimeout(i),cancelAnimationFrame(o)}function jl(D){if(process.env.NODE_ENV!=="production"&&Aa(y.state.isDestroyed,Hl("setProps")),!y.state.isDestroyed){ne("onBeforeUpdate",[y,D]),aa();var oe=y.props,be=Ej(e,Object.assign({},oe,wj(D),{ignoreAttributes:!0}));y.props=be,vo(),oe.interactiveDebounce!==be.interactiveDebounce&&(N(),A=Sj(mt,be.interactiveDebounce)),oe.triggerTarget&&!be.triggerTarget?id(oe.triggerTarget).forEach(function(ge){ge.removeAttribute("aria-expanded")}):be.triggerTarget&&e.removeAttribute("aria-expanded"),M(),ee(),T&&T(oe,be),y.popperInstance&&(fs(),yo().forEach(function(ge){requestAnimationFrame(ge._tippy.popperInstance.forceUpdate)})),ne("onAfterUpdate",[y,D])}}function Ul(D){y.setProps({content:D})}function qS(){process.env.NODE_ENV!=="production"&&Aa(y.state.isDestroyed,Hl("show"));var D=y.state.isVisible,oe=y.state.isDestroyed,be=!y.state.isEnabled,ge=wo.isTouch&&!y.props.touch,$e=hw(y.props.duration,0,Pr.duration);if(!(D||oe||be||ge)&&!q().hasAttribute("disabled")&&(ne("onShow",[y],!1),y.props.onShow(y)!==!1)){if(y.state.isVisible=!0,P()&&(x.style.visibility="visible"),ee(),j(),y.state.isMounted||(x.style.transition="none"),P()){var xt=te(),Ai=xt.box,Pl=xt.content;Aw([Ai,Pl],0)}p=function(){var Fc;if(!(!y.state.isVisible||u)){if(u=!0,x.offsetHeight,x.style.transition=y.props.moveTransition,P()&&y.props.animation){var VS=te(),hg=VS.box,Nl=VS.content;Aw([hg,Nl],$e),xj([hg,Nl],"visible")}F(),M(),Cj(gw,y),(Fc=y.popperInstance)==null||Fc.forceUpdate(),ne("onMount",[y]),y.props.animation&&P()&&Qt($e,function(){y.state.isShown=!0,ne("onShown",[y])})}},hi()}}function B(){process.env.NODE_ENV!=="production"&&Aa(y.state.isDestroyed,Hl("hide"));var D=!y.state.isVisible,oe=y.state.isDestroyed,be=!y.state.isEnabled,ge=hw(y.props.duration,1,Pr.duration);if(!(D||oe||be)&&(ne("onHide",[y],!1),y.props.onHide(y)!==!1)){if(y.state.isVisible=!1,y.state.isShown=!1,u=!1,a=!1,P()&&(x.style.visibility="hidden"),N(),he(),ee(!0),P()){var $e=te(),xt=$e.box,Ai=$e.content;y.props.animation&&(Aw([xt,Ai],ge),xj([xt,Ai],"hidden"))}F(),M(),y.props.animation?P()&&kt(ge,y.unmount):y.unmount()}}function L(D){process.env.NODE_ENV!=="production"&&Aa(y.state.isDestroyed,Hl("hideWithInteractivity")),Y().addEventListener("mousemove",A),Cj(Ug,A),A(D)}function K(){process.env.NODE_ENV!=="production"&&Aa(y.state.isDestroyed,Hl("unmount")),y.state.isVisible&&y.hide(),y.state.isMounted&&(ps(),yo().forEach(function(D){D._tippy.unmount()}),x.parentNode&&x.parentNode.removeChild(x),gw=gw.filter(function(D){return D!==y}),y.state.isMounted=!1,ne("onHidden",[y]))}function je(){process.env.NODE_ENV!=="production"&&Aa(y.state.isDestroyed,Hl("destroy")),!y.state.isDestroyed&&(y.clearDelayTimeouts(),y.unmount(),aa(),delete e._tippy,y.state.isDestroyed=!0,ne("onDestroy",[y]))}}function lg(e,t){t===void 0&&(t={});var n=Pr.plugins.concat(t.plugins||[]);process.env.NODE_ENV!=="production"&&(kVe(e),jX(t,n)),TVe();var r=Object.assign({},t,{plugins:n}),i=SVe(e);if(process.env.NODE_ENV!=="production"){var o=eA(r.content),a=i.length>1;Aa(o&&a,["tippy() was passed an Element as the `content` prop, but more than","one tippy instance was created by this invocation. This means the","content element will only be appended to the last tippy instance.",`
|
|
87
|
+
|
|
88
|
+
`,"Instead, pass the .innerHTML of the element, or use a function that","returns a cloned version of the element instead.",`
|
|
89
|
+
|
|
90
|
+
`,`1) content: element.innerHTML
|
|
91
|
+
`,"2) content: () => element.cloneNode(true)"].join(" "))}var s=i.reduce(function(c,u){var l=u&&jVe(u,r);return l&&c.push(l),c},[]);return eA(e)?s[0]:s}lg.defaultProps=Pr;lg.setDefaultProps=FVe;lg.currentInput=wo;Object.assign({},SX,{effect:function(t){var n=t.state,r={popper:{position:n.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(n.elements.popper.style,r.popper),n.styles=r,n.elements.arrow&&Object.assign(n.elements.arrow.style,r.arrow)}});lg.setDefaultProps({render:UX});class UVe{constructor({editor:t,element:n,view:r,tippyOptions:i={},updateDelay:o=250,shouldShow:a}){this.preventHide=!1,this.shouldShow=({view:s,state:c,from:u,to:l})=>{const{doc:d,selection:p}=c,{empty:h}=p,A=!d.textBetween(u,l).length&&mL(c.selection),g=this.element.contains(document.activeElement);return!(!(s.hasFocus()||g)||h||A||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:s})=>{var c;if(this.preventHide){this.preventHide=!1;return}s!=null&&s.relatedTarget&&(!((c=this.element.parentNode)===null||c===void 0)&&c.contains(s.relatedTarget))||(s==null?void 0:s.relatedTarget)!==this.editor.view.dom&&this.hide()},this.tippyBlurHandler=s=>{this.blurHandler({event:s})},this.handleDebouncedUpdate=(s,c)=>{const u=!(c!=null&&c.selection.eq(s.state.selection)),l=!(c!=null&&c.doc.eq(s.state.doc));!u&&!l||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(s,u,l,c)},this.updateDelay))},this.updateHandler=(s,c,u,l)=>{var d,p,h;const{state:A,composing:g}=s,{selection:v}=A;if(g||!c&&!u)return;this.createTooltip();const{ranges:w}=v,S=Math.min(...w.map(x=>x.$from.pos)),y=Math.max(...w.map(x=>x.$to.pos));if(!((d=this.shouldShow)===null||d===void 0?void 0:d.call(this,{editor:this.editor,element:this.element,view:s,state:A,oldState:l,from:S,to:y}))){this.hide();return}(p=this.tippy)===null||p===void 0||p.setProps({getReferenceClientRect:((h=this.tippyOptions)===null||h===void 0?void 0:h.getReferenceClientRect)||(()=>{if(b7e(A.selection)){let x=s.nodeDOM(S);if(x){const T=x.dataset.nodeViewWrapper?x:x.querySelector("[data-node-view-wrapper]");if(T&&(x=T.firstChild),x)return x.getBoundingClientRect()}}return S7e(s,S,y)})}),this.show()},this.editor=t,this.element=n,this.view=r,this.updateDelay=o,a&&(this.shouldShow=a),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.tippyOptions=i,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:t}=this.editor.options,n=!!t.parentElement;this.tippy||!n||(this.tippy=lg(t,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"top",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",this.tippyBlurHandler))}update(t,n){const{state:r}=t,i=r.selection.from!==r.selection.to;if(this.updateDelay>0&&i){this.handleDebouncedUpdate(t,n);return}const o=!(n!=null&&n.selection.eq(t.state.selection)),a=!(n!=null&&n.doc.eq(t.state.doc));this.updateHandler(t,o,a,n)}show(){var t;(t=this.tippy)===null||t===void 0||t.show()}hide(){var t;(t=this.tippy)===null||t===void 0||t.hide()}destroy(){var t,n;!((t=this.tippy)===null||t===void 0)&&t.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),(n=this.tippy)===null||n===void 0||n.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}const PX=e=>new kn({key:typeof e.pluginKey=="string"?new Vn(e.pluginKey):e.pluginKey,view:t=>new UVe({view:t,...e})});Cn.create({name:"bubbleMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"bubbleMenu",updateDelay:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[PX({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,updateDelay:this.options.updateDelay,shouldShow:this.options.shouldShow})]:[]}});var s_={exports:{}},vw={};/**
|
|
92
|
+
* @license React
|
|
93
|
+
* use-sync-external-store-shim.production.min.js
|
|
94
|
+
*
|
|
95
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
96
|
+
*
|
|
97
|
+
* This source code is licensed under the MIT license found in the
|
|
98
|
+
* LICENSE file in the root directory of this source tree.
|
|
99
|
+
*/var kj;function PVe(){if(kj)return vw;kj=1;var e=E;function t(d,p){return d===p&&(d!==0||1/d===1/p)||d!==d&&p!==p}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,i=e.useEffect,o=e.useLayoutEffect,a=e.useDebugValue;function s(d,p){var h=p(),A=r({inst:{value:h,getSnapshot:p}}),g=A[0].inst,v=A[1];return o(function(){g.value=h,g.getSnapshot=p,c(g)&&v({inst:g})},[d,h,p]),i(function(){return c(g)&&v({inst:g}),d(function(){c(g)&&v({inst:g})})},[d]),a(h),h}function c(d){var p=d.getSnapshot;d=d.value;try{var h=p();return!n(d,h)}catch{return!0}}function u(d,p){return p()}var l=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:s;return vw.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:l,vw}var yw={};/**
|
|
100
|
+
* @license React
|
|
101
|
+
* use-sync-external-store-shim.development.js
|
|
102
|
+
*
|
|
103
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
104
|
+
*
|
|
105
|
+
* This source code is licensed under the MIT license found in the
|
|
106
|
+
* LICENSE file in the root directory of this source tree.
|
|
107
|
+
*/var Oj;function NVe(){return Oj||(Oj=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var e=E,t=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function n(S){{for(var y=arguments.length,C=new Array(y>1?y-1:0),x=1;x<y;x++)C[x-1]=arguments[x];r("error",S,C)}}function r(S,y,C){{var x=t.ReactDebugCurrentFrame,T=x.getStackAddendum();T!==""&&(y+="%s",C=C.concat([T]));var I=C.map(function(R){return String(R)});I.unshift("Warning: "+y),Function.prototype.apply.call(console[S],console,I)}}function i(S,y){return S===y&&(S!==0||1/S===1/y)||S!==S&&y!==y}var o=typeof Object.is=="function"?Object.is:i,a=e.useState,s=e.useEffect,c=e.useLayoutEffect,u=e.useDebugValue,l=!1,d=!1;function p(S,y,C){l||e.startTransition!==void 0&&(l=!0,n("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var x=y();if(!d){var T=y();o(x,T)||(n("The result of getSnapshot should be cached to avoid an infinite loop"),d=!0)}var I=a({inst:{value:x,getSnapshot:y}}),R=I[0].inst,O=I[1];return c(function(){R.value=x,R.getSnapshot=y,h(R)&&O({inst:R})},[S,x,y]),s(function(){h(R)&&O({inst:R});var k=function(){h(R)&&O({inst:R})};return S(k)},[S]),u(x),x}function h(S){var y=S.getSnapshot,C=S.value;try{var x=y();return!o(C,x)}catch{return!0}}function A(S,y,C){return y()}var g=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",v=!g,b=v?A:p,w=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:b;yw.useSyncExternalStore=w,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),yw}process.env.NODE_ENV==="production"?s_.exports=PVe():s_.exports=NVe();var TL=s_.exports;const WVe=(...e)=>t=>{e.forEach(n=>{typeof n=="function"?n(t):n&&(n.current=t)})},KVe=({contentComponent:e})=>{const t=TL.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getServerSnapshot);return E.createElement(E.Fragment,null,Object.values(t))};function qVe(){const e=new Set;let t={};return{subscribe(n){return e.add(n),()=>{e.delete(n)}},getSnapshot(){return t},getServerSnapshot(){return t},setRenderer(n,r){t={...t,[n]:M_.createPortal(r.reactElement,r.element,n)},e.forEach(i=>i())},removeRenderer(n){const r={...t};delete r[n],t=r,e.forEach(i=>i())}}}class VVe extends E.Component{constructor(t){var n;super(t),this.editorContentRef=E.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!(!((n=t.editor)===null||n===void 0)&&n.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){const t=this.props.editor;if(t&&!t.isDestroyed&&t.options.element){if(t.contentComponent)return;const n=this.editorContentRef.current;n.append(...t.options.element.childNodes),t.setOptions({element:n}),t.contentComponent=qVe(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=t.contentComponent.subscribe(()=>{this.setState(r=>r.hasContentComponentInitialized?r:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),t.createNodeViews(),this.initialized=!0}}componentWillUnmount(){const t=this.props.editor;if(!t||(this.initialized=!1,t.isDestroyed||t.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),t.contentComponent=null,!t.options.element.firstChild))return;const n=document.createElement("div");n.append(...t.options.element.childNodes),t.setOptions({element:n})}render(){const{editor:t,innerRef:n,...r}=this.props;return E.createElement(E.Fragment,null,E.createElement("div",{ref:WVe(n,this.editorContentRef),...r}),(t==null?void 0:t.contentComponent)&&E.createElement(KVe,{contentComponent:t.contentComponent}))}}const zVe=E.forwardRef((e,t)=>{const n=E.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[e.editor]);return E.createElement(VVe,{key:n,innerRef:t,...e})}),QVe=E.memo(zVe);var bw={};/**
|
|
108
|
+
* @license React
|
|
109
|
+
* use-sync-external-store-shim/with-selector.production.min.js
|
|
110
|
+
*
|
|
111
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
112
|
+
*
|
|
113
|
+
* This source code is licensed under the MIT license found in the
|
|
114
|
+
* LICENSE file in the root directory of this source tree.
|
|
115
|
+
*/var Mj;function HVe(){if(Mj)return bw;Mj=1;var e=E,t=TL;function n(u,l){return u===l&&(u!==0||1/u===1/l)||u!==u&&l!==l}var r=typeof Object.is=="function"?Object.is:n,i=t.useSyncExternalStore,o=e.useRef,a=e.useEffect,s=e.useMemo,c=e.useDebugValue;return bw.useSyncExternalStoreWithSelector=function(u,l,d,p,h){var A=o(null);if(A.current===null){var g={hasValue:!1,value:null};A.current=g}else g=A.current;A=s(function(){function b(x){if(!w){if(w=!0,S=x,x=p(x),h!==void 0&&g.hasValue){var T=g.value;if(h(T,x))return y=T}return y=x}if(T=y,r(S,x))return T;var I=p(x);return h!==void 0&&h(T,I)?T:(S=x,y=I)}var w=!1,S,y,C=d===void 0?null:d;return[function(){return b(l())},C===null?void 0:function(){return b(C())}]},[l,d,p,h]);var v=i(u,A[0],A[1]);return a(function(){g.hasValue=!0,g.value=v},[v]),c(v),v},bw}var Sw={};/**
|
|
116
|
+
* @license React
|
|
117
|
+
* use-sync-external-store-shim/with-selector.development.js
|
|
118
|
+
*
|
|
119
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
120
|
+
*
|
|
121
|
+
* This source code is licensed under the MIT license found in the
|
|
122
|
+
* LICENSE file in the root directory of this source tree.
|
|
123
|
+
*/var Fj;function YVe(){return Fj||(Fj=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var e=E,t=TL;function n(l,d){return l===d&&(l!==0||1/l===1/d)||l!==l&&d!==d}var r=typeof Object.is=="function"?Object.is:n,i=t.useSyncExternalStore,o=e.useRef,a=e.useEffect,s=e.useMemo,c=e.useDebugValue;function u(l,d,p,h,A){var g=o(null),v;g.current===null?(v={hasValue:!1,value:null},g.current=v):v=g.current;var b=s(function(){var C=!1,x,T,I=function(P){if(!C){C=!0,x=P;var q=h(P);if(A!==void 0&&v.hasValue){var Y=v.value;if(A(Y,q))return T=Y,Y}return T=q,q}var te=x,G=T;if(r(te,P))return G;var ee=h(P);return A!==void 0&&A(G,ee)?G:(x=P,T=ee,ee)},R=p===void 0?null:p,O=function(){return I(d())},k=R===null?void 0:function(){return I(R())};return[O,k]},[d,p,h,A]),w=b[0],S=b[1],y=i(l,w,S);return a(function(){v.hasValue=!0,v.value=y},[y]),c(y),y}Sw.useSyncExternalStoreWithSelector=u,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),Sw}process.env.NODE_ENV==="production"?HVe():YVe();process.env.NODE_ENV;const NX=E.createContext({editor:null});NX.Consumer;const GVe=()=>E.useContext(NX),Cw=e=>{const[t,n]=E.useState(null),{editor:r}=GVe();return E.useEffect(()=>{var i;if(!t||!((i=e.editor)===null||i===void 0)&&i.isDestroyed||r!=null&&r.isDestroyed)return;const{pluginKey:o="bubbleMenu",editor:a,tippyOptions:s={},updateDelay:c,shouldShow:u=null}=e,l=a||r;if(!l){console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");return}const d=PX({updateDelay:c,editor:l,element:t,pluginKey:o,shouldShow:u,tippyOptions:s});return l.registerPlugin(d),()=>{l.unregisterPlugin(o)}},[e.editor,r,t]),E.createElement("div",{ref:n,className:e.className,style:{visibility:"hidden"}},e.children)},WX=E.createContext({onDragStart:void 0}),KX=()=>E.useContext(WX),JVe=e=>{const t=e.as||"div",{nodeViewContentRef:n}=KX();return E.createElement(t,{...e,ref:n,"data-node-view-content":"",style:{whiteSpace:"pre-wrap",...e.style}})},IL=E.forwardRef((e,t)=>{const{onDragStart:n}=KX(),r=e.as||"div";return E.createElement(r,{...e,ref:t,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...e.style}})});function ZVe(e){return!!(typeof e=="function"&&e.prototype&&e.prototype.isReactComponent)}function XVe(e){var t;return typeof e=="object"&&((t=e.$$typeof)===null||t===void 0?void 0:t.toString())==="Symbol(react.forward_ref)"}class qX{constructor(t,{editor:n,props:r={},as:i="div",className:o=""}){this.ref=null,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=t,this.editor=n,this.props=r,this.element=document.createElement(i),this.element.classList.add("react-renderer"),o&&this.element.classList.add(...o.split(" ")),this.editor.isInitialized?M_.flushSync(()=>{this.render()}):this.render()}render(){var t;const n=this.component,r=this.props,i=this.editor;(ZVe(n)||XVe(n))&&(r.ref=o=>{this.ref=o}),this.reactElement=E.createElement(n,{...r}),(t=i==null?void 0:i.contentComponent)===null||t===void 0||t.setRenderer(this.id,this)}updateProps(t={}){this.props={...this.props,...t},this.render()}destroy(){var t;const n=this.editor;(t=n==null?void 0:n.contentComponent)===null||t===void 0||t.removeRenderer(this.id)}updateAttributes(t){Object.keys(t).forEach(n=>{this.element.setAttribute(n,t[n])})}}class eze extends W7e{mount(){const t={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extension,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(u={})=>this.updateAttributes(u),deleteNode:()=>this.deleteNode()};if(!this.component.displayName){const u=l=>l.charAt(0).toUpperCase()+l.substring(1);this.component.displayName=u(this.extension.name)}const i={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:u=>{u&&this.contentDOMElement&&u.firstChild!==this.contentDOMElement&&u.appendChild(this.contentDOMElement)}},o=this.component,a=E.memo(u=>E.createElement(WX.Provider,{value:i},E.createElement(o,u)));a.displayName="ReactNodeView",this.node.isLeaf?this.contentDOMElement=null:this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement&&(this.contentDOMElement.dataset.nodeViewContentReact="",this.contentDOMElement.style.whiteSpace="inherit");let s=this.node.isInline?"span":"div";this.options.as&&(s=this.options.as);const{className:c=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new qX(a,{editor:this.editor,props:t,as:s,className:`node-${this.node.type.name} ${c}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes()}get dom(){var t;if(this.renderer.element.firstElementChild&&!(!((t=this.renderer.element.firstElementChild)===null||t===void 0)&&t.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){const{from:t,to:n}=this.editor.state.selection,r=this.getPos();if(typeof r=="number")if(t<=r&&n>=r+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}}update(t,n,r){const i=o=>{this.renderer.updateProps(o),typeof this.options.attrs=="function"&&this.updateElementAttributes()};if(t.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const o=this.node,a=this.decorations,s=this.innerDecorations;return this.node=t,this.decorations=n,this.innerDecorations=r,this.options.update({oldNode:o,oldDecorations:a,newNode:t,newDecorations:n,oldInnerDecorations:s,innerDecorations:r,updateProps:()=>i({node:t,decorations:n,innerDecorations:r})})}return t===this.node&&this.decorations===n&&this.innerDecorations===r||(this.node=t,this.decorations=n,this.innerDecorations=r,i({node:t,decorations:n,innerDecorations:r})),!0}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove("ProseMirror-selectednode")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate),this.contentDOMElement=null}updateElementAttributes(){if(this.options.attrs){let t={};if(typeof this.options.attrs=="function"){const n=this.editor.extensionManager.attributes,r=ay(this.node,n);t=this.options.attrs({node:this.node,HTMLAttributes:r})}else t=this.options.attrs;this.renderer.updateAttributes(t)}}}function EL(e,t){return n=>n.editor.contentComponent?new eze(e,n,t):{}}function tze(e){return e.type==="table"}const cu={...de.RichTextNodeType,table:"table"};function nze(e){return!!(e&&e.has(cu.table))}const rze=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,ize=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,oze=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,aze=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,sze=sg.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:e=>e.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:e=>e.type.name===this.name},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return["strong",Rt(this.options.HTMLAttributes,e),0]},addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[uy({find:rze,type:this.type}),uy({find:oze,type:this.type})]},addPasteRules(){return[dy({find:ize,type:this.type}),dy({find:aze,type:this.type})]}});var Ll=(e=>(e.Document="document",e.Mark="mark",e.Node="node",e))(Ll||{}),Hc=(e=>(e.Text="text",e.Embed="embed",e.Image="image",e.Table="table",e))(Hc||{});class cze{constructor(t,n,r){en(this,"extType","document");this.name=t,this.component=n,this.converter=r}}class dg{constructor(t,n,r,i,o,a=!1){en(this,"extType","node");en(this,"nodeType","text");this.richTextNodeTypes=t,this.name=n,this.component=r,this.converter=i,this.placeholder=o,this.lockedFormat=a}}function VX(e){return e instanceof dg}class uze{constructor(t,n,r,i){en(this,"extType","node");en(this,"nodeType","embed");this.richTextNodeTypes=t,this.name=n,this.component=r,this.converter=i}}class lze{constructor(t,n,r,i){en(this,"extType","node");en(this,"nodeType","image");this.richTextNodeTypes=t,this.name=n,this.component=r,this.converter=i}}class dze extends dg{constructor(t,n,r,i,o){super(t,"heading",n,i,o),this.levels=r}}class RL extends dg{constructor(t,n,r,i){super(t,n,r,i)}}class fze{constructor(t,n,r,i){en(this,"extType","node");en(this,"nodeType","table");this.richTextNodeTypes=t,this.name=n,this.component=r,this.converter=i}}function pze(e){return e instanceof RL}const zX=Yt.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:e}){return["br",Rt(this.options.HTMLAttributes,e)]},renderText(){return`
|
|
124
|
+
`},addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:r})=>e.first([()=>e.exitCode(),()=>e.command(()=>{const{selection:i,storedMarks:o}=n;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:a}=this.options,{splittableMarks:s}=r.extensionManager,c=o||i.$to.parentOffset&&i.$from.marks();return t().insertContent({type:this.name}).command(({tr:u,dispatch:l})=>{if(l&&c&&a){const d=c.filter(p=>s.includes(p.type.name));u.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),Qs={isHardBreak(e){return e.type.name===zX.name},children:{reduce(e,t,n){let r=n;return e.forEach((i,o,a)=>{r=t(r,i,a)}),r},map(e,t){return this.reduce(e,(n,r)=>[...n,t(r)],[])},exists(e,t){return this.reduce(e,(n,r)=>n||t(r),!1)},filter(e,t){return this.reduce(e,(n,r)=>[...n,...t(r)?[r]:[]],[])}},marks:{reduce(e,t,n){let r=n;return e.marks.forEach((i,o)=>{r=t(r,i,o)}),r},map(e,t){return this.reduce(e,(n,r)=>[...n,t(r)],[])},filter(e,t){return this.reduce(e,(n,r)=>[...n,...t(r)?[r]:[]],[])}}};function hze(e){if(!e||!(e!=null&&e.single)&&!(e!=null&&e.multi))return Lj();const t=Aze(e);if(!t.size)return Lj();const n=mze(t),r=gze(n,e);return{nodeTypes:t,extensions:r}}function Aze(e){const n=(e.single||e.multi||"").split(/\s*,\s*/).map(r=>{if(r==="table")return r;const i=de.RichTextNodeTypeCodec.decode(r);return i._tag==="Right"?i.right:void 0}).filter(qi.isDefined);return new Set(n)}function mze(e){return nte(e).filter(n=>Kr.some(e,r=>n.richTextNodeTypes.includes(r)))}function gze(e,t){var r;const n=new Set(e);return Kr.some(n,pze)&&n.add(br),Kr.some(n,VX)||n.add(br),(r=t==null?void 0:t.labels)!=null&&r.length&&n.add(DL),[...n]}function Lj(){return{extensions:nte(),nodeTypes:new Set(Yd.keys(de.RichTextNodeTypeCodec.keys))}}class vze{constructor(t,n,r){en(this,"extType",Ll.Mark);en(this,"richTextNodeTypes",[de.RichTextNodeType.strong]);this.name=t,this.component=n,this.converter=r}}const QX="bold",HX=sze.extend({name:QX}),yze={fromPrismic(e){return function(){var t;return(t=e.marks[HX.name])==null?void 0:t.create()}},toPrismic(){}},bze=new vze(QX,HX,yze),$L=bze,Sze="listItem",Bj="textStyle",Dj=/^\s*([-+*])\s$/,Cze=Yt.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:e}){return["ul",Rt(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Sze,this.editor.getAttributes(Bj)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=ly({find:Dj,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=ly({find:Dj,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Bj),editor:this.editor})),[e]}}),wze=Yt.create({name:"doc",topNode:!0,content:"block+"}),xze=Yt.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:e}){return["li",Rt(this.options.HTMLAttributes,e),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),YX=xze.extend({name:"listItem",content:"paragraph*",addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name)}}}),_ze={fromPrismic(e){return function(t){var r;const n=br.converter.fromPrismic(e)(t);if(n)return(r=e.nodes[YX.name])==null?void 0:r.create({},n)}},toPrismic(e,t){return Qs.children.reduce(e,(n,r)=>{const i=br.converter.toPrismic(r),o=(()=>i instanceof Array?i.map(a=>({...a,type:t})):i?[{...i,type:t}]:[])();return[...n,...o]},[])}},Vd={component:YX,converter:_ze,placeholder:"List"};function Tze(e,t){return e.copy(e.content.append(t.content))}const od={heading1:"heading1",heading2:"heading2",heading3:"heading3",heading4:"heading4",heading5:"heading5",heading6:"heading6",paragraph:"paragraph",preformatted:"preformatted",strong:"strong",em:"em",listItem:"list-item",oListItem:"o-list-item",list:"group-list-item",oList:"group-o-list-item",image:"image",embed:"embed",hyperlink:"hyperlink",label:"label",span:"span"},FS=()=>(++FS.i).toString();FS.i=0;const Ize=e=>{const t=Eze(e),n=[];for(let r=0;r<t.length;r++)n.push(GX(t[r]));return{key:FS(),children:n}},sh=(e,t=[])=>({key:FS(),type:e.type,text:"text"in e?e.text:void 0,node:e,children:t}),ww=e=>sh({type:od.span,text:e,spans:[]}),Eze=e=>{const t=e.slice(0);for(let n=0;n<t.length;n++){const r=t[n];if(r.type===od.listItem||r.type===od.oListItem){const i=[r];for(;t[n+1]&&t[n+1].type===r.type;)i.push(t[n+1]),t.splice(n,1);r.type===od.listItem?t[n]={type:od.list,items:i}:t[n]={type:od.oList,items:i}}}return t},GX=e=>{if("text"in e)return sh(e,JX(e.spans,e));if("items"in e){const t=[];for(let n=0;n<e.items.length;n++)t.push(GX(e.items[n]));return sh(e,t)}return sh(e)},JX=(e,t,n)=>{if(!e.length)return[ww(t.text)];const r=e.slice(0);r.sort((o,a)=>o.start-a.start||a.end-o.end);const i=[];for(let o=0;o<r.length;o++){const a=r[o],s=n&&n.start||0,c=a.start-s,u=a.end-s,l=t.text.slice(c,u),d=[];for(let h=o;h<r.length;h++){const A=r[h];A!==a&&A.start>=a.start&&A.end<=a.end&&(d.push(A),r.splice(h,1),h--)}o===0&&c>0&&i.push(ww(t.text.slice(0,c)));const p={...a,text:l};i.push(sh(p,JX(d,{...t,text:l},a))),u<t.text.length&&i.push(ww(t.text.slice(u,r[o+1]?r[o+1].start-s:void 0)))}return i},Rze=(e,t)=>ZX(Ize(e).children,t),ZX=(e,t)=>{const n=[];for(let r=0;r<e.length;r++){const i=e[r],o=t(i.type,i.node,i.text,ZX(i.children,t),i.key);o!=null&&n.push(o)}return n},$ze=Yt.create({name:"text",group:"inline"});function kze(e){return e.reduce((t,n)=>{const r=(t[n.type]||[]).concat(n);return{...t,[n.type]:r}},{})}function jj(e){return e.sort((t,n)=>t.start-n.start)}function Oze(e){const t=kze(e),n=Object.entries(t).map(([r,i])=>jj(i).reduce((a,s)=>{if(!a.length)return[s];const c=a.length-1,u=a[c];return u?u.end<s.start?[...a,s]:u.end>=s.end?a:[...a.slice(0,c),{...u,end:s.end}]:a},[])).flat();return jj(n)}const Ay=zX.extend({name:"hard_break"}),my=`
|
|
125
|
+
`,XX={fromPrismic(e){return function(t){var n;if(t===my)return(n=e.nodes[Ay.name])==null?void 0:n.create({})}},toPrismic(e){if(e.type.name===Ay.name)return my}},xw={isEmptyLine(e){return e.length===0},isFirst(e){return e===0}};function Mze(e,t){return function(n){const r=XX.fromPrismic(e)(my);if(!r)return[n(t)];const i=t.split(my);return i.length===1?t.length?[n(t)]:[r]:i.reduce((o,a,s)=>xw.isFirst(s)?xw.isEmptyLine(a)?o:[...o,n(a)]:xw.isEmptyLine(a)?[...o,r]:[...o,r,n(a)],[])}}const Fze={name:Ay.name,component:Ay,converter:XX,splitTextToNodes:Mze},gy=Fze,eee={fromPrismic(e){return t=>{switch(t.type){case"hyperlink":return Eee.converter.fromPrismic(e)(t);case"em":return BL.converter.fromPrismic(e)(t);case"strong":return $L.converter.fromPrismic(e)(t);case"label":return DL.converter.fromPrismic(e)(t);case"list-item":return}}},toPrismic(e,t,n){const r=tte.find(i=>e.type.name===i.name);if(!r)throw new Error(`Invalid mark extension '${e.type.name}'.`);switch(r.name){case"bold":return{type:"strong",start:t,end:n};case"em":return{type:r.name,start:t,end:n};case"hyperlink":return{type:r.name,start:t,end:n,data:r.converter.toPrismic(e)};case"label":return{type:r.name,start:t,end:n,data:r.converter.toPrismic(e)}}}},Lze={strong:"bold",label:"label",em:"em",hyperlink:"hyperlink","list-item":void 0},Uj=$ze.extend({name:"text"}),Bze={fromPrismic(e){return function(t,n,r=!1){const i={type:t,text:n.content.text,spans:n.content.spans||[]};return Rze([i],Dze(e,r)).flat()}},toPrismic(e,t,n){const r=Qs.children.reduce(e,(i,o)=>{const a=(()=>o.type.name===gy.name?gy.converter.toPrismic(o):o.textContent)(),s=a?i.text+a:i.text,c=i.text.length,u=s.length,l=(()=>o.marks.length?Qs.marks.map(o,p=>eee.toPrismic(p,c,u)):void 0)();return{...i,text:s,spans:l?[...i.spans,...l]:i.spans}},{text:"",spans:[]});return{type:t,content:{text:r.text,spans:[...Oze(r.spans)].sort((i,o)=>i.type.localeCompare(o.type))},...n}}};function Dze(e,t=!1){return(n,r,i,o)=>{if(n==="span"&&i&&i.length)return t?[e.text(i)]:gy.splitTextToNodes(e,i)(c=>e.text(c));const a=eee.fromPrismic(e)(r);return a?jze(a,o):o.flat()}}function jze(e,t){return t.flat().map(r=>{const o=[...r.marks,e].sort((a,s)=>a.type.name.localeCompare(s.type.name));return r.mark(o)})}const Uze={name:Uj.name,component:Uj,converter:Bze},$u=Uze,kL="document";function Pze(e){return wze.extend({name:kL,content:e?"block+":"block"})}function Nze(e){return{fromPrismic(t,n,r){var o;const i=r.value.reduce((a,s)=>{const{extension:c,block:u}=Vze(e,s,t,n),l=Kze({extension:c,block:u,schema:t}),d=a.slice(0,a.length-1),p=yt.last(a),h=qze({node:l,previousNode:p});return h.updatedNode?[...h.merged?d:a,h.updatedNode]:a},[]);return(o=t.nodes[kL])==null?void 0:o.create({},i)},toPrismic(t){return{__TYPE__:"StructuredTextContent",value:[...Qs.children.reduce(t,(r,i)=>{const o=Object.values(e).find(s=>i.type.name===s.name),a=o==null?void 0:o.converter.toPrismic(i);return a||console.warn(`Cannot convert node of type '${i.type.name}'.`),a?[...r,...a instanceof Array?a:[a]]:r},[])]}}}}const Wze=new cze(kL,Pze,Nze),c_=Wze;function Kze(e){const{extension:t,block:n,schema:r}=e;if(t)switch(t.nodeType){case Hc.Embed:return ue.EmbedBlock.is(n)?t.converter.fromPrismic(r)(n):void 0;case Hc.Text:return ue.TextBlock.is(n)?t.converter.fromPrismic(r)(n):void 0;case Hc.Image:return ue.ImageBlock.is(n)?t.converter.fromPrismic(r)(n):void 0;case Hc.Table:return tze(n)?t.converter.fromPrismic(r)(n):void 0}}function qze(e){const{node:t,previousNode:n}=e;return!t||!n?{merged:!1,updatedNode:t}:t.type.name===n.type.name&&(t.type.name===Cy.name||t.type.name===xy.name)?{merged:!0,updatedNode:Tze(n,t)}:{merged:!1,updatedNode:t}}function Vze(e,t,n,r){var s;const i=e.find(c=>c.richTextNodeTypes.includes(t.type)&&r.has(t.type));if(i)return{extension:i,block:t};if(!ue.TextBlock.is(t))return{extension:void 0,block:t};const o=e.find(c=>VX(c)&&c.name in n.nodes),a=(s=t.content.spans)==null?void 0:s.filter(c=>{const u=Lze[c.type];return u&&u in n.marks});return{extension:o,block:{...t,content:{text:t.content.text,spans:a}}}}const zze=Cn.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new kn({key:new Vn("placeholder"),props:{decorations:({doc:e,selection:t})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=t,i=[];if(!n)return null;const o=this.editor.isEmpty;return e.descendants((a,s)=>{const c=r>=s&&r<=s+a.nodeSize,u=!a.isLeaf&&gL(a);if((c||!this.options.showOnlyCurrent)&&u){const l=[this.options.emptyNodeClass];o&&l.push(this.options.emptyEditorClass);const d=gr.node(s,s+a.nodeSize,{class:l.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:a,pos:s,hasAnchor:c}):this.options.placeholder});i.push(d)}return this.options.includeChildren}),_t.create(e,i)}}})]}}),Qze=Yt.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:e}){return["p",Rt(this.options.HTMLAttributes,e),0]},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),lv="ltr",Yc="rtl",ma="dir",Pj=de.RichTextNodeType.rtl,Hze=Cn.create({name:"textDirection",addOptions(){return{supportedExtensionNames:[]}},addGlobalAttributes(){return[{types:this.options.supportedExtensionNames,attributes:{[ma]:{default:lv,parseHTML:e=>e.getAttribute(ma),renderHTML:e=>({[ma]:u_(e[ma])})}}}]},addCommands(){return{setDirection:e=>({commands:t})=>{switch(e){case lv:return t.setLeftToRight();case Yc:return t.setRightToLeft()}},toggleDirection:e=>({commands:t})=>{const n=e===Yc?lv:Yc;return t.setDirection(n)},setRightToLeft:()=>({commands:e})=>this.options.supportedExtensionNames.every(t=>e.updateAttributes(t,{[ma]:Yc})),setLeftToRight:()=>({commands:e})=>this.options.supportedExtensionNames.every(t=>e.resetAttributes(t,ma))}},addKeyboardShortcuts(){return{"Mod-Shift-r":()=>this.editor.commands.setRightToLeft(),"Mod-Shift-l":()=>this.editor.commands.setLeftToRight()}}}),Ta={parseNodeAttrsDirection(e){return u_(e[ma])},fromPrismic(e){return{[ma]:u_(e.direction)}},toPrismic(e){return{direction:this.parseNodeAttrsDirection(e.attrs)}}};function u_(e){return e===Yc?Yc:lv}const vy=Qze.extend({name:"paragraph",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:e}){return["p",Rt(this.options.HTMLAttributes,e),0]}}),Yze={fromPrismic(e){return function(t){var r;const n=$u.converter.fromPrismic(e)(vy.name,t);return(r=e.nodes[vy.name])==null?void 0:r.create(Ta.fromPrismic(t),n)}},toPrismic(e){return $u.converter.toPrismic(e,de.RichTextNodeType.paragraph,Ta.toPrismic(e))}},Gze=new dg([de.RichTextNodeType.paragraph],vy.name,vy,Yze,"Type '/' for commands"),br=Gze,Jze=e=>zze.configure({includeChildren:!0,placeholder:t=>Zze(t,e),showOnlyCurrent:!1,showOnlyWhenEditable:!1});function Zze(e,t){const{editor:n,hasAnchor:r,pos:i,node:o}=e,{placeholderByNodeType:a,unfocusedPlaceholder:s,nodeExtensions:c}=t,u=!Qs.children.exists(n.state.doc,w=>w===o),l=n.isEditable;if(s&&!n.isFocused&&n.isEmpty&&i===0)return s;const d=o.type.name!==br.name,p=n.isFocused&&r||d||u,h=c.filter(w=>w!==br).length>1;function A(w){return w===br.placeholder?l&&p&&h:l&&p}function g(){if(u)return Vd.placeholder;const w=a[o.type.name];return typeof w=="string"?w:w==null?void 0:w(o.attrs)}const v=g();return A(v)&&v||""}function LS(e){return e.split("-")[1]}function tee(e){return e==="y"?"height":"width"}function Ms(e){return e.split("-")[0]}function fg(e){return["top","bottom"].includes(Ms(e))?"x":"y"}function Nj(e,t,n){let{reference:r,floating:i}=e;const o=r.x+r.width/2-i.width/2,a=r.y+r.height/2-i.height/2,s=fg(t),c=tee(s),u=r[c]/2-i[c]/2,l=s==="x";let d;switch(Ms(t)){case"top":d={x:o,y:r.y-i.height};break;case"bottom":d={x:o,y:r.y+r.height};break;case"right":d={x:r.x+r.width,y:a};break;case"left":d={x:r.x-i.width,y:a};break;default:d={x:r.x,y:r.y}}switch(LS(t)){case"start":d[s]-=u*(n&&l?-1:1);break;case"end":d[s]+=u*(n&&l?-1:1)}return d}const Xze=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:a}=n,s=o.filter(Boolean),c=await(a.isRTL==null?void 0:a.isRTL(t));let u=await a.getElementRects({reference:e,floating:t,strategy:i}),{x:l,y:d}=Nj(u,r,c),p=r,h={},A=0;for(let g=0;g<s.length;g++){const{name:v,fn:b}=s[g],{x:w,y:S,data:y,reset:C}=await b({x:l,y:d,initialPlacement:r,placement:p,strategy:i,middlewareData:h,rects:u,platform:a,elements:{reference:e,floating:t}});l=w??l,d=S??d,h={...h,[v]:{...h[v],...y}},C&&A<=50&&(A++,typeof C=="object"&&(C.placement&&(p=C.placement),C.rects&&(u=C.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:i}):C.rects),{x:l,y:d}=Nj(u,p,c)),g=-1)}return{x:l,y:d,placement:p,strategy:i,middlewareData:h}};function eQe(e){return typeof e!="number"?function(t){return{top:0,right:0,bottom:0,left:0,...t}}(e):{top:e,right:e,bottom:e,left:e}}function l_(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}async function nee(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:o,rects:a,elements:s,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:l="viewport",elementContext:d="floating",altBoundary:p=!1,padding:h=0}=t,A=eQe(h),g=s[p?d==="floating"?"reference":"floating":d],v=l_(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(g)))==null||n?g:g.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(s.floating)),boundary:u,rootBoundary:l,strategy:c})),b=d==="floating"?{...a.floating,x:r,y:i}:a.reference,w=await(o.getOffsetParent==null?void 0:o.getOffsetParent(s.floating)),S=await(o.isElement==null?void 0:o.isElement(w))&&await(o.getScale==null?void 0:o.getScale(w))||{x:1,y:1},y=l_(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({rect:b,offsetParent:w,strategy:c}):b);return{top:(v.top-y.top+A.top)/S.y,bottom:(y.bottom-v.bottom+A.bottom)/S.y,left:(v.left-y.left+A.left)/S.x,right:(y.right-v.right+A.right)/S.x}}const tQe=Math.min,nQe=Math.max;function Wj(e,t,n){return nQe(e,tQe(t,n))}const rQe=["top","right","bottom","left"];rQe.reduce((e,t)=>e.concat(t,t+"-start",t+"-end"),[]);const iQe={left:"right",right:"left",bottom:"top",top:"bottom"};function yy(e){return e.replace(/left|right|bottom|top/g,t=>iQe[t])}function oQe(e,t,n){n===void 0&&(n=!1);const r=LS(e),i=fg(e),o=tee(i);let a=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(a=yy(a)),{main:a,cross:yy(a)}}const aQe={start:"end",end:"start"};function _w(e){return e.replace(/start|end/g,t=>aQe[t])}const sQe=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n;const{placement:r,middlewareData:i,rects:o,initialPlacement:a,platform:s,elements:c}=t,{mainAxis:u=!0,crossAxis:l=!0,fallbackPlacements:d,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:A=!0,...g}=e,v=Ms(r),b=Ms(a)===a,w=await(s.isRTL==null?void 0:s.isRTL(c.floating)),S=d||(b||!A?[yy(a)]:function(k){const P=yy(k);return[_w(k),P,_w(P)]}(a));d||h==="none"||S.push(...function(k,P,q,Y){const te=LS(k);let G=function(ee,ne,F){const M=["left","right"],N=["right","left"],se=["top","bottom"],Oe=["bottom","top"];switch(ee){case"top":case"bottom":return F?ne?N:M:ne?M:N;case"left":case"right":return ne?se:Oe;default:return[]}}(Ms(k),q==="start",Y);return te&&(G=G.map(ee=>ee+"-"+te),P&&(G=G.concat(G.map(_w)))),G}(a,A,h,w));const y=[a,...S],C=await nee(t,g),x=[];let T=((n=i.flip)==null?void 0:n.overflows)||[];if(u&&x.push(C[v]),l){const{main:k,cross:P}=oQe(r,o,w);x.push(C[k],C[P])}if(T=[...T,{placement:r,overflows:x}],!x.every(k=>k<=0)){var I,R;const k=(((I=i.flip)==null?void 0:I.index)||0)+1,P=y[k];if(P)return{data:{index:k,overflows:T},reset:{placement:P}};let q=(R=T.filter(Y=>Y.overflows[0]<=0).sort((Y,te)=>Y.overflows[1]-te.overflows[1])[0])==null?void 0:R.placement;if(!q)switch(p){case"bestFit":{var O;const Y=(O=T.map(te=>[te.placement,te.overflows.filter(G=>G>0).reduce((G,ee)=>G+ee,0)]).sort((te,G)=>te[1]-G[1])[0])==null?void 0:O[0];Y&&(q=Y);break}case"initialPlacement":q=a}if(r!==q)return{reset:{placement:q}}}return{}}}},cQe=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){const{x:n,y:r}=t,i=await async function(o,a){const{placement:s,platform:c,elements:u}=o,l=await(c.isRTL==null?void 0:c.isRTL(u.floating)),d=Ms(s),p=LS(s),h=fg(s)==="x",A=["left","top"].includes(d)?-1:1,g=l&&h?-1:1,v=typeof a=="function"?a(o):a;let{mainAxis:b,crossAxis:w,alignmentAxis:S}=typeof v=="number"?{mainAxis:v,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...v};return p&&typeof S=="number"&&(w=p==="end"?-1*S:S),h?{x:w*g,y:b*A}:{x:b*A,y:w*g}}(t,e);return{x:n+i.x,y:r+i.y,data:i}}}};function ree(e){return e==="x"?"y":"x"}const uQe=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i}=t,{mainAxis:o=!0,crossAxis:a=!1,limiter:s={fn:v=>{let{x:b,y:w}=v;return{x:b,y:w}}},...c}=e,u={x:n,y:r},l=await nee(t,c),d=fg(Ms(i)),p=ree(d);let h=u[d],A=u[p];if(o){const v=d==="y"?"bottom":"right";h=Wj(h+l[d==="y"?"top":"left"],h,h-l[v])}if(a){const v=p==="y"?"bottom":"right";A=Wj(A+l[p==="y"?"top":"left"],A,A-l[v])}const g=s.fn({...t,[d]:h,[p]:A});return{...g,data:{x:g.x-n,y:g.y-r}}}}},lQe=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:i,rects:o,middlewareData:a}=t,{offset:s=0,mainAxis:c=!0,crossAxis:u=!0}=e,l={x:n,y:r},d=fg(i),p=ree(d);let h=l[d],A=l[p];const g=typeof s=="function"?s(t):s,v=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(c){const S=d==="y"?"height":"width",y=o.reference[d]-o.floating[S]+v.mainAxis,C=o.reference[d]+o.reference[S]-v.mainAxis;h<y?h=y:h>C&&(h=C)}if(u){var b,w;const S=d==="y"?"width":"height",y=["top","left"].includes(Ms(i)),C=o.reference[p]-o.floating[S]+(y&&((b=a.offset)==null?void 0:b[p])||0)+(y?0:v.crossAxis),x=o.reference[p]+o.reference[S]+(y?0:((w=a.offset)==null?void 0:w[p])||0)-(y?v.crossAxis:0);A<C?A=C:A>x&&(A=x)}return{[d]:h,[p]:A}}}};function qr(e){var t;return((t=e.ownerDocument)==null?void 0:t.defaultView)||window}function $o(e){return qr(e).getComputedStyle(e)}const Kj=Math.min,ch=Math.max,by=Math.round;function iee(e){const t=$o(e);let n=parseFloat(t.width),r=parseFloat(t.height);const i=e.offsetWidth,o=e.offsetHeight,a=by(n)!==i||by(r)!==o;return a&&(n=i,r=o),{width:n,height:r,fallback:a}}function Hs(e){return aee(e)?(e.nodeName||"").toLowerCase():""}let Pg;function oee(){if(Pg)return Pg;const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?(Pg=e.brands.map(t=>t.brand+"/"+t.version).join(" "),Pg):navigator.userAgent}function ko(e){return e instanceof qr(e).HTMLElement}function zi(e){return e instanceof qr(e).Element}function aee(e){return e instanceof qr(e).Node}function qj(e){return typeof ShadowRoot>"u"?!1:e instanceof qr(e).ShadowRoot||e instanceof ShadowRoot}function BS(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=$o(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(i)}function dQe(e){return["table","td","th"].includes(Hs(e))}function d_(e){const t=/firefox/i.test(oee()),n=$o(e),r=n.backdropFilter||n.WebkitBackdropFilter;return n.transform!=="none"||n.perspective!=="none"||!!r&&r!=="none"||t&&n.willChange==="filter"||t&&!!n.filter&&n.filter!=="none"||["transform","perspective"].some(i=>n.willChange.includes(i))||["paint","layout","strict","content"].some(i=>{const o=n.contain;return o!=null&&o.includes(i)})}function f_(){return/^((?!chrome|android).)*safari/i.test(oee())}function OL(e){return["html","body","#document"].includes(Hs(e))}function see(e){return zi(e)?e:e.contextElement}const cee={x:1,y:1};function hd(e){const t=see(e);if(!ko(t))return cee;const n=t.getBoundingClientRect(),{width:r,height:i,fallback:o}=iee(t);let a=(o?by(n.width):n.width)/r,s=(o?by(n.height):n.height)/i;return a&&Number.isFinite(a)||(a=1),s&&Number.isFinite(s)||(s=1),{x:a,y:s}}function ku(e,t,n,r){var i,o;t===void 0&&(t=!1),n===void 0&&(n=!1);const a=e.getBoundingClientRect(),s=see(e);let c=cee;t&&(r?zi(r)&&(c=hd(r)):c=hd(e));const u=s?qr(s):window,l=f_()&&n;let d=(a.left+(l&&((i=u.visualViewport)==null?void 0:i.offsetLeft)||0))/c.x,p=(a.top+(l&&((o=u.visualViewport)==null?void 0:o.offsetTop)||0))/c.y,h=a.width/c.x,A=a.height/c.y;if(s){const g=qr(s),v=r&&zi(r)?qr(r):r;let b=g.frameElement;for(;b&&r&&v!==g;){const w=hd(b),S=b.getBoundingClientRect(),y=getComputedStyle(b);S.x+=(b.clientLeft+parseFloat(y.paddingLeft))*w.x,S.y+=(b.clientTop+parseFloat(y.paddingTop))*w.y,d*=w.x,p*=w.y,h*=w.x,A*=w.y,d+=S.x,p+=S.y,b=qr(b).frameElement}}return{width:h,height:A,top:p,right:d+h,bottom:p+A,left:d,x:d,y:p}}function Fs(e){return((aee(e)?e.ownerDocument:e.document)||window.document).documentElement}function DS(e){return zi(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function uee(e){return ku(Fs(e)).left+DS(e).scrollLeft}function nA(e){if(Hs(e)==="html")return e;const t=e.assignedSlot||e.parentNode||qj(e)&&e.host||Fs(e);return qj(t)?t.host:t}function lee(e){const t=nA(e);return OL(t)?t.ownerDocument.body:ko(t)&&BS(t)?t:lee(t)}function uu(e,t){var n;t===void 0&&(t=[]);const r=lee(e),i=r===((n=e.ownerDocument)==null?void 0:n.body),o=qr(r);return i?t.concat(o,o.visualViewport||[],BS(r)?r:[]):t.concat(r,uu(r))}function Vj(e,t,n){let r;if(t==="viewport")r=function(a,s){const c=qr(a),u=Fs(a),l=c.visualViewport;let d=u.clientWidth,p=u.clientHeight,h=0,A=0;if(l){d=l.width,p=l.height;const g=f_();(!g||g&&s==="fixed")&&(h=l.offsetLeft,A=l.offsetTop)}return{width:d,height:p,x:h,y:A}}(e,n);else if(t==="document")r=function(a){const s=Fs(a),c=DS(a),u=a.ownerDocument.body,l=ch(s.scrollWidth,s.clientWidth,u.scrollWidth,u.clientWidth),d=ch(s.scrollHeight,s.clientHeight,u.scrollHeight,u.clientHeight);let p=-c.scrollLeft+uee(a);const h=-c.scrollTop;return $o(u).direction==="rtl"&&(p+=ch(s.clientWidth,u.clientWidth)-l),{width:l,height:d,x:p,y:h}}(Fs(e));else if(zi(t))r=function(a,s){const c=ku(a,!0,s==="fixed"),u=c.top+a.clientTop,l=c.left+a.clientLeft,d=ko(a)?hd(a):{x:1,y:1};return{width:a.clientWidth*d.x,height:a.clientHeight*d.y,x:l*d.x,y:u*d.y}}(t,n);else{const a={...t};if(f_()){var i,o;const s=qr(e);a.x-=((i=s.visualViewport)==null?void 0:i.offsetLeft)||0,a.y-=((o=s.visualViewport)==null?void 0:o.offsetTop)||0}r=a}return l_(r)}function zj(e,t){return ko(e)&&$o(e).position!=="fixed"?t?t(e):e.offsetParent:null}function Qj(e,t){const n=qr(e);let r=zj(e,t);for(;r&&dQe(r)&&$o(r).position==="static";)r=zj(r,t);return r&&(Hs(r)==="html"||Hs(r)==="body"&&$o(r).position==="static"&&!d_(r))?n:r||function(i){let o=nA(i);for(;ko(o)&&!OL(o);){if(d_(o))return o;o=nA(o)}return null}(e)||n}function fQe(e,t,n){const r=ko(t),i=Fs(t),o=ku(e,!0,n==="fixed",t);let a={scrollLeft:0,scrollTop:0};const s={x:0,y:0};if(r||!r&&n!=="fixed")if((Hs(t)!=="body"||BS(i))&&(a=DS(t)),ko(t)){const c=ku(t,!0);s.x=c.x+t.clientLeft,s.y=c.y+t.clientTop}else i&&(s.x=uee(i));return{x:o.left+a.scrollLeft-s.x,y:o.top+a.scrollTop-s.y,width:o.width,height:o.height}}const pQe={getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const o=n==="clippingAncestors"?function(u,l){const d=l.get(u);if(d)return d;let p=uu(u).filter(v=>zi(v)&&Hs(v)!=="body"),h=null;const A=$o(u).position==="fixed";let g=A?nA(u):u;for(;zi(g)&&!OL(g);){const v=$o(g),b=d_(g);v.position==="fixed"?h=null:(A?b||h:b||v.position!=="static"||!h||!["absolute","fixed"].includes(h.position))?h=v:p=p.filter(w=>w!==g),g=nA(g)}return l.set(u,p),p}(t,this._c):[].concat(n),a=[...o,r],s=a[0],c=a.reduce((u,l)=>{const d=Vj(t,l,i);return u.top=ch(d.top,u.top),u.right=Kj(d.right,u.right),u.bottom=Kj(d.bottom,u.bottom),u.left=ch(d.left,u.left),u},Vj(t,s,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}},convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{rect:t,offsetParent:n,strategy:r}=e;const i=ko(n),o=Fs(n);if(n===o)return t;let a={scrollLeft:0,scrollTop:0},s={x:1,y:1};const c={x:0,y:0};if((i||!i&&r!=="fixed")&&((Hs(n)!=="body"||BS(o))&&(a=DS(n)),ko(n))){const u=ku(n);s=hd(n),c.x=u.x+n.clientLeft,c.y=u.y+n.clientTop}return{width:t.width*s.x,height:t.height*s.y,x:t.x*s.x-a.scrollLeft*s.x+c.x,y:t.y*s.y-a.scrollTop*s.y+c.y}},isElement:zi,getDimensions:function(e){return ko(e)?iee(e):e.getBoundingClientRect()},getOffsetParent:Qj,getDocumentElement:Fs,getScale:hd,async getElementRects(e){let{reference:t,floating:n,strategy:r}=e;const i=this.getOffsetParent||Qj,o=this.getDimensions;return{reference:fQe(t,await i(n),r),floating:{x:0,y:0,...await o(n)}}},getClientRects:e=>Array.from(e.getClientRects()),isRTL:e=>$o(e).direction==="rtl"};function hQe(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:a=!0,animationFrame:s=!1}=r,c=i&&!s,u=c||o?[...zi(e)?uu(e):e.contextElement?uu(e.contextElement):[],...uu(t)]:[];u.forEach(h=>{c&&h.addEventListener("scroll",n,{passive:!0}),o&&h.addEventListener("resize",n)});let l,d=null;if(a){let h=!0;d=new ResizeObserver(()=>{h||n(),h=!1}),zi(e)&&!s&&d.observe(e),zi(e)||!e.contextElement||s||d.observe(e.contextElement),d.observe(t)}let p=s?ku(e):null;return s&&function h(){const A=ku(e);!p||A.x===p.x&&A.y===p.y&&A.width===p.width&&A.height===p.height||n(),p=A,l=requestAnimationFrame(h)}(),n(),()=>{var h;u.forEach(A=>{c&&A.removeEventListener("scroll",n),o&&A.removeEventListener("resize",n)}),(h=d)==null||h.disconnect(),d=null,s&&cancelAnimationFrame(l)}}const AQe=(e,t,n)=>{const r=new Map,i={platform:pQe,...n},o={...i.platform,_c:r};return Xze(e,t,{...i,platform:o})};var dv=typeof document<"u"?E.useLayoutEffect:E.useEffect;function Sy(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(!Sy(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){const o=i[r];if(!(o==="_owner"&&e.$$typeof)&&!Sy(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function Hj(e){const t=Ie.useRef(e);return dv(()=>{t.current=e}),t}function mQe(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,whileElementsMounted:o,open:a}=e,[s,c]=Ie.useState({x:null,y:null,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[u,l]=Ie.useState(r);Sy(u,r)||l(r);const d=Ie.useRef(null),p=Ie.useRef(null),h=Ie.useRef(s),A=Hj(o),g=Hj(i),[v,b]=Ie.useState(null),[w,S]=Ie.useState(null),y=Ie.useCallback(O=>{d.current!==O&&(d.current=O,b(O))},[]),C=Ie.useCallback(O=>{p.current!==O&&(p.current=O,S(O))},[]),x=Ie.useCallback(()=>{if(!d.current||!p.current)return;const O={placement:t,strategy:n,middleware:u};g.current&&(O.platform=g.current),AQe(d.current,p.current,O).then(k=>{const P={...k,isPositioned:!0};T.current&&!Sy(h.current,P)&&(h.current=P,Ate.flushSync(()=>{c(P)}))})},[u,t,n,g]);dv(()=>{a===!1&&h.current.isPositioned&&(h.current.isPositioned=!1,c(O=>({...O,isPositioned:!1})))},[a]);const T=Ie.useRef(!1);dv(()=>(T.current=!0,()=>{T.current=!1}),[]),dv(()=>{if(v&&w){if(A.current)return A.current(v,w,x);x()}},[v,w,x,A]);const I=Ie.useMemo(()=>({reference:d,floating:p,setReference:y,setFloating:C}),[y,C]),R=Ie.useMemo(()=>({reference:v,floating:w}),[v,w]);return Ie.useMemo(()=>({...s,update:x,refs:I,elements:R,reference:y,floating:C}),[s,x,I,R,y,C])}var Is=typeof document<"u"?E.useLayoutEffect:E.useEffect;function gQe(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(i=>i(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){e.set(t,(e.get(t)||[]).filter(r=>r!==n))}}}let Tw=!1,vQe=0;const Yj=()=>"floating-ui-"+vQe++;function yQe(){const[e,t]=Ie.useState(()=>Tw?Yj():void 0);return Is(()=>{e==null&&t(Yj())},[]),Ie.useEffect(()=>{Tw||(Tw=!0)},[]),e}const Gj=Ie["useId".toString()],Jj=Gj??yQe,bQe=Ie.createContext(null),SQe=Ie.createContext(null),dee=()=>{var e,t;return(e=(t=Ie.useContext(bQe))==null?void 0:t.id)!=null?e:null},ML=()=>Ie.useContext(SQe);function FL(e){var t;return(t=e==null?void 0:e.ownerDocument)!=null?t:document}function fee(e){var t;return(t=FL(e).defaultView)!=null?t:window}function fv(e){return e?e instanceof fee(e).Element:!1}function CQe(e){return e?e instanceof fee(e).HTMLElement:!1}const Zj=Ie["useInsertionEffect".toString()];function p_(e){const t=Ie.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return Zj?Zj(()=>{t.current=e}):t.current=e,Ie.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return t.current==null?void 0:t.current(...r)},[])}function wQe(e){let{open:t=!1,onOpenChange:n,whileElementsMounted:r,placement:i,middleware:o,strategy:a,nodeId:s}=e===void 0?{}:e;const[c,u]=Ie.useState(null),l=ML(),d=Ie.useRef(null),p=Ie.useRef({}),h=Ie.useState(()=>gQe())[0],A=mQe({placement:i,middleware:o,strategy:a,whileElementsMounted:r}),g=p_(n),v=Ie.useMemo(()=>({...A.refs,domReference:d}),[A.refs]),b=Ie.useMemo(()=>({...A,refs:v,dataRef:p,nodeId:s,events:h,open:t,onOpenChange:g,_:{domReference:c}}),[A,s,h,t,g,v,c]);Is(()=>{const y=l==null?void 0:l.nodesRef.current.find(C=>C.id===s);y&&(y.context=b)});const{reference:w}=A,S=Ie.useCallback(y=>{(fv(y)||y===null)&&(b.refs.domReference.current=y,u(y)),w(y)},[w,b.refs]);return Ie.useMemo(()=>({...A,context:b,refs:v,reference:S}),[A,v,b,S])}function Iw(e,t,n){const r=new Map;return{...n==="floating"&&{tabIndex:-1},...e,...t.map(i=>i?i[n]:null).concat(e).reduce((i,o)=>(o&&Object.entries(o).forEach(a=>{let[s,c]=a;if(s.indexOf("on")===0){if(r.has(s)||r.set(s,[]),typeof c=="function"){var u;(u=r.get(s))==null||u.push(c),i[s]=function(){for(var l,d=arguments.length,p=new Array(d),h=0;h<d;h++)p[h]=arguments[h];(l=r.get(s))==null||l.forEach(A=>A(...p))}}}else i[s]=c}),i),{})}}const xQe=function(e){return e===void 0&&(e=[]),{getReferenceProps:t=>Iw(t,e,"reference"),getFloatingProps:t=>Iw(t,e,"floating"),getItemProps:t=>Iw(t,e,"item")}};function Ew(e,t){var n;let r=(n=e.filter(a=>{var s;return a.parentId===t&&((s=a.context)==null?void 0:s.open)}))!=null?n:[],i=r;for(;i.length;){var o;i=(o=e.filter(a=>{var s;return(s=i)==null?void 0:s.some(c=>{var u;return a.parentId===c.id&&((u=a.context)==null?void 0:u.open)})}))!=null?o:[],r=r.concat(i)}return r}function Xj(e){let t=e.activeElement;for(;((n=t)==null||(r=n.shadowRoot)==null?void 0:r.activeElement)!=null;){var n,r;t=t.shadowRoot.activeElement}return t}function _Qe(e){return"composedPath"in e?e.composedPath()[0]:e.target}function As(e){e.preventDefault(),e.stopPropagation()}function TQe(e){const t=E.useRef(e);return Is(()=>{t.current=e}),t}function eU(e){const t=E.useRef();return Is(()=>{t.current=e},[e]),t.current}const IQe=function(e,t){let{open:n}=e,{enabled:r=!0,role:i="dialog"}=t===void 0?{}:t;const o=Jj(),a=Jj(),s={id:o,role:i};return r?i==="tooltip"?{reference:{"aria-describedby":n?o:void 0},floating:s}:{reference:{"aria-expanded":n?"true":"false","aria-haspopup":i==="alertdialog"?"dialog":i,"aria-controls":n?o:void 0,...i==="listbox"&&{role:"combobox"},...i==="menu"&&{id:a}},floating:{...s,...i==="menu"&&{"aria-labelledby":a}}}:{}};function Rw(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}const EQe=function(e,t){let{open:n,onOpenChange:r,refs:i,events:o,nodeId:a}=e,{enabled:s=!0,escapeKey:c=!0,outsidePointerDown:u=!0,referencePointerDown:l=!1,ancestorScroll:d=!1,bubbles:p=!0}=t===void 0?{}:t;const h=ML(),A=dee()!=null,g=Ie.useRef(!1);return Ie.useEffect(()=>{if(!n||!s)return;function v(C){if(C.key==="Escape"){if(!p&&h&&Ew(h.nodesRef.current,a).length>0)return;o.emit("dismiss",{preventScroll:!1}),r(!1)}}function b(C){const x=g.current;if(g.current=!1,x)return;const T=_Qe(C);if(fv(T)&&i.floating.current){var I;const O=(I=i.floating.current.ownerDocument.defaultView)!=null?I:window,k=T.scrollWidth>T.clientWidth,P=T.scrollHeight>T.clientHeight;let q=P&&C.offsetX>T.clientWidth;if(P&&O.getComputedStyle(T).direction==="rtl"&&(q=C.offsetX<=T.offsetWidth-T.clientWidth),q||k&&C.offsetY>T.clientHeight)return}const R=h&&Ew(h.nodesRef.current,a).some(O=>{var k;return Rw(C,(k=O.context)==null?void 0:k.refs.floating.current)});Rw(C,i.floating.current)||Rw(C,i.domReference.current)||R||!p&&h&&Ew(h.nodesRef.current,a).length>0||(o.emit("dismiss",A?{preventScroll:!0}:!1),r(!1))}function w(){r(!1)}const S=FL(i.floating.current);c&&S.addEventListener("keydown",v),u&&S.addEventListener("pointerdown",b);const y=(d?[...fv(i.reference.current)?uu(i.reference.current):[],...fv(i.floating.current)?uu(i.floating.current):[]]:[]).filter(C=>{var x;return C!==((x=S.defaultView)==null?void 0:x.visualViewport)});return y.forEach(C=>C.addEventListener("scroll",w,{passive:!0})),()=>{c&&S.removeEventListener("keydown",v),u&&S.removeEventListener("pointerdown",b),y.forEach(C=>C.removeEventListener("scroll",w))}},[c,u,o,h,a,n,r,d,s,p,i,A]),s?{reference:{onPointerDown(){l&&(o.emit("dismiss"),r(!1))}},floating:{onPointerDownCapture(){g.current=!0}}}:{}},LL="ArrowUp",jS="ArrowDown",zd="ArrowLeft",pg="ArrowRight";function Ng(e,t,n){return Math.floor(e/t)!==n}function $p(e,t){return t<0||t>=e.current.length}function Dn(e,t){let{startingIndex:n=-1,decrement:r=!1,disabledIndices:i,amount:o=1}=t===void 0?{}:t;const a=e.current;let s=n;do{var c,u;s=s+(r?-o:o)}while(s>=0&&s<=a.length-1&&(i?i.includes(s):a[s]==null||(c=a[s])!=null&&c.hasAttribute("disabled")||((u=a[s])==null?void 0:u.getAttribute("aria-disabled"))==="true"));return s}function US(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function tU(e,t){return US(t,e===LL||e===jS,e===zd||e===pg)}function $w(e,t,n){return US(t,e===jS,n?e===zd:e===pg)||e==="Enter"||e==" "||e===""}function RQe(e,t,n){return US(t,n?e===zd:e===pg,e===jS)}function $Qe(e,t,n){return US(t,n?e===pg:e===zd,e===LL)}function kw(e,t){return Dn(e,{disabledIndices:t})}function nU(e,t){return Dn(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}const kQe=function(e,t){let{open:n,onOpenChange:r,refs:i}=e,{listRef:o,activeIndex:a,onNavigate:s=()=>{},enabled:c=!0,selectedIndex:u=null,allowEscape:l=!1,loop:d=!1,nested:p=!1,rtl:h=!1,virtual:A=!1,focusItemOnOpen:g="auto",focusItemOnHover:v=!0,openOnArrowKeyDown:b=!0,disabledIndices:w=void 0,orientation:S="vertical",cols:y=1}=t===void 0?{listRef:{current:[]},activeIndex:null,onNavigate:()=>{}}:t;process.env.NODE_ENV!=="production"&&(l&&(d||console.warn(["Floating UI: `useListNavigation` looping must be enabled to allow","escaping."].join(" ")),A||console.warn(["Floating UI: `useListNavigation` must be virtual to allow","escaping."].join(" "))),S==="vertical"&&y>1&&console.warn(["Floating UI: In grid list navigation mode (`cols` > 1), the",'`orientation` should be either "horizontal" or "both".'].join(" ")));const C=dee(),x=ML(),T=eU(n),I=p_(s),R=p_(eU(s)),O=Ie.useRef(g),k=Ie.useRef(u??-1),P=Ie.useRef(null),q=TQe(w),Y=Ie.useRef(!1),te=Ie.useRef(-1),[G,ee]=Ie.useState(),ne=Ie.useCallback((M,N)=>{te.current=requestAnimationFrame(()=>{if(A){var se;ee((se=M.current[N.current])==null?void 0:se.id)}else{var Oe;(Oe=M.current[N.current])==null||Oe.focus({preventScroll:!0})}})},[A]);Is(()=>{c&&(!T&&n&&O.current&&u!=null&&I(u),T&&!n&&(cancelAnimationFrame(te.current),k.current=-1,R(null)))},[n,T,u,o,ne,c,I,R]),Is(()=>{if(c&&n)if(a==null){if(u!=null)return;T&&(k.current=-1,ne(o,k)),!T&&O.current&&(P.current!=null||O.current===!0&&P.current==null)&&(k.current=P.current==null||$w(P.current,S,h)||p?kw(o,q.current):nU(o,q.current),I(k.current),ne(o,k))}else $p(o,a)||(k.current=a,ne(o,k))},[n,T,a,u,p,o,I,ne,c,l,S,h,A,q]),Is(()=>{if(c&&!n&&T){var M,N;const se=x==null||(M=x.nodesRef.current.find(Oe=>Oe.id===C))==null||(N=M.context)==null?void 0:N.refs.floating.current;se&&!se.contains(Xj(FL(se)))&&se.focus({preventScroll:!0})}},[c,n,T,x,C]),Is(()=>{P.current=null});function F(M){if(Y.current=!0,p&&$Qe(M.key,S,h)){As(M),r(!1),CQe(i.domReference.current)&&i.domReference.current.focus();return}const N=k.current,se=kw(o,w),Oe=nU(o,w);if(M.key==="Home"&&(k.current=se,I(k.current)),M.key==="End"&&(k.current=Oe,I(k.current)),y>1){const _e=k.current;if(M.key===LL){if(As(M),_e===-1)k.current=Oe;else if(k.current=Dn(o,{startingIndex:_e,amount:y,decrement:!0,disabledIndices:w}),d&&(_e-y<se||k.current<0)){const j=_e%y,he=Oe%y,kt=Oe-(he-j);he===j?k.current=Oe:k.current=he>j?kt:kt-y}$p(o,k.current)&&(k.current=_e),I(k.current)}if(M.key===jS&&(As(M),_e===-1?k.current=se:(k.current=Dn(o,{startingIndex:_e,amount:y,disabledIndices:w}),d&&_e+y>Oe&&(k.current=Dn(o,{startingIndex:_e%y-y,amount:y,disabledIndices:w}))),$p(o,k.current)&&(k.current=_e),I(k.current)),S==="both"){const j=Math.floor(_e/y);M.key===pg&&(As(M),_e%y!==y-1?(k.current=Dn(o,{startingIndex:_e,disabledIndices:w}),d&&Ng(k.current,y,j)&&(k.current=Dn(o,{startingIndex:_e-_e%y-1,disabledIndices:w}))):d&&(k.current=Dn(o,{startingIndex:_e-_e%y-1,disabledIndices:w})),Ng(k.current,y,j)&&(k.current=_e)),M.key===zd&&(As(M),_e%y!==0?(k.current=Dn(o,{startingIndex:_e,disabledIndices:w,decrement:!0}),d&&Ng(k.current,y,j)&&(k.current=Dn(o,{startingIndex:_e+(y-_e%y),decrement:!0,disabledIndices:w}))):d&&(k.current=Dn(o,{startingIndex:_e+(y-_e%y),decrement:!0,disabledIndices:w})),Ng(k.current,y,j)&&(k.current=_e));const he=Math.floor(Oe/y)===j;$p(o,k.current)&&(d&&he?k.current=M.key===zd?Oe:Dn(o,{startingIndex:_e-_e%y-1,disabledIndices:w}):k.current=_e),I(k.current);return}}if(tU(M.key,S)){if(As(M),n&&!A&&Xj(M.currentTarget.ownerDocument)===M.currentTarget){k.current=$w(M.key,S,h)?se:Oe,I(k.current);return}$w(M.key,S,h)?d?k.current=N>=Oe?l&&N!==o.current.length?-1:se:Dn(o,{startingIndex:N,disabledIndices:w}):k.current=Math.min(Oe,Dn(o,{startingIndex:N,disabledIndices:w})):d?k.current=N<=se?l&&N!==-1?o.current.length:Oe:Dn(o,{startingIndex:N,decrement:!0,disabledIndices:w}):k.current=Math.max(se,Dn(o,{startingIndex:N,decrement:!0,disabledIndices:w})),$p(o,k.current)?I(null):I(k.current)}}return c?{reference:{...A&&n&&a!=null&&{"aria-activedescendant":G},onKeyDown(M){if(Y.current=!0,A&&n)return F(M);if((M.key.indexOf("Arrow")===0||M.key==="Enter"||M.key===" "||M.key==="")&&(P.current=M.key),p){RQe(M.key,S,h)&&(As(M),n?(k.current=kw(o,w),I(k.current)):r(!0));return}tU(M.key,S)&&(u!=null&&(k.current=u),As(M),!n&&b?r(!0):F(M),n&&I(k.current))}},floating:{"aria-orientation":S==="both"?void 0:S,...A&&a!=null&&{"aria-activedescendant":G},onKeyDown:F,onPointerMove(){Y.current=!1}},item:{onFocus(M){let{currentTarget:N}=M;const se=o.current.indexOf(N);se!==-1&&I(se)},onClick:M=>{let{currentTarget:N}=M;return N.focus({preventScroll:!0})},...v&&{onMouseMove(M){let{currentTarget:N}=M;const se=N;if(se){const Oe=o.current.indexOf(se);Oe!==-1&&I(Oe)}},onPointerLeave(){if(!Y.current&&(k.current=-1,ne(o,k),I(null),!A)){var M;(M=i.floating.current)==null||M.focus({preventScroll:!0})}}}}}:{}};function OQe(e){var t;const{char:n,allowSpaces:r,allowToIncludeChar:i,allowedPrefixes:o,startOfLine:a,$position:s}=e,c=r&&!i,u=K7e(n),l=new RegExp(`\\s${u}$`),d=a?"^":"",p=i?"":u,h=c?new RegExp(`${d}${u}.*?(?=\\s${p}|$)`,"gm"):new RegExp(`${d}(?:^)?${u}[^\\s${p}]*`,"gm"),A=((t=s.nodeBefore)===null||t===void 0?void 0:t.isText)&&s.nodeBefore.text;if(!A)return null;const g=s.pos-A.length,v=Array.from(A.matchAll(h)).pop();if(!v||v.input===void 0||v.index===void 0)return null;const b=v.input.slice(Math.max(0,v.index-1),v.index),w=new RegExp(`^[${o==null?void 0:o.join("")}\0]?$`).test(b);if(o!==null&&!w)return null;const S=g+v.index;let y=S+v[0].length;return c&&l.test(A.slice(y-1,y+1))&&(v[0]+=" ",y+=1),S<s.pos&&y>=s.pos?{range:{from:S,to:y},query:v[0].slice(n.length),text:v[0]}:null}const MQe=new Vn("suggestion");function FQe({pluginKey:e=MQe,editor:t,char:n="@",allowSpaces:r=!1,allowToIncludeChar:i=!1,allowedPrefixes:o=[" "],startOfLine:a=!1,decorationTag:s="span",decorationClass:c="suggestion",command:u=()=>null,items:l=()=>[],render:d=()=>({}),allow:p=()=>!0,findSuggestionMatch:h=OQe}){let A;const g=d==null?void 0:d(),v=new kn({key:e,view(){return{update:async(b,w)=>{var S,y,C,x,T,I,R;const O=(S=this.key)===null||S===void 0?void 0:S.getState(w),k=(y=this.key)===null||y===void 0?void 0:y.getState(b.state),P=O.active&&k.active&&O.range.from!==k.range.from,q=!O.active&&k.active,Y=O.active&&!k.active,te=!q&&!Y&&O.query!==k.query,G=q||P&&te,ee=te||P,ne=Y||P&&te;if(!G&&!ee&&!ne)return;const F=ne&&!G?O:k,M=b.dom.querySelector(`[data-decoration-id="${F.decorationId}"]`);A={editor:t,range:F.range,query:F.query,text:F.text,items:[],command:N=>u({editor:t,range:F.range,props:N}),decorationNode:M,clientRect:M?()=>{var N;const{decorationId:se}=(N=this.key)===null||N===void 0?void 0:N.getState(t.state),Oe=b.dom.querySelector(`[data-decoration-id="${se}"]`);return(Oe==null?void 0:Oe.getBoundingClientRect())||null}:null},G&&((C=g==null?void 0:g.onBeforeStart)===null||C===void 0||C.call(g,A)),ee&&((x=g==null?void 0:g.onBeforeUpdate)===null||x===void 0||x.call(g,A)),(ee||G)&&(A.items=await l({editor:t,query:F.query})),ne&&((T=g==null?void 0:g.onExit)===null||T===void 0||T.call(g,A)),ee&&((I=g==null?void 0:g.onUpdate)===null||I===void 0||I.call(g,A)),G&&((R=g==null?void 0:g.onStart)===null||R===void 0||R.call(g,A))},destroy:()=>{var b;A&&((b=g==null?void 0:g.onExit)===null||b===void 0||b.call(g,A))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(b,w,S,y){const{isEditable:C}=t,{composing:x}=t.view,{selection:T}=b,{empty:I,from:R}=T,O={...w};if(O.composing=x,C&&(I||t.view.composing)){(R<w.range.from||R>w.range.to)&&!x&&!w.composing&&(O.active=!1);const k=h({char:n,allowSpaces:r,allowToIncludeChar:i,allowedPrefixes:o,startOfLine:a,$position:T.$from}),P=`id_${Math.floor(Math.random()*4294967295)}`;k&&p({editor:t,state:y,range:k.range,isActive:w.active})?(O.active=!0,O.decorationId=w.decorationId?w.decorationId:P,O.range=k.range,O.query=k.query,O.text=k.text):O.active=!1}else O.active=!1;return O.active||(O.decorationId=null,O.range={from:0,to:0},O.query=null,O.text=null),O}},props:{handleKeyDown(b,w){var S;const{active:y,range:C}=v.getState(b.state);return y&&((S=g==null?void 0:g.onKeyDown)===null||S===void 0?void 0:S.call(g,{view:b,event:w,range:C}))||!1},decorations(b){const{active:w,range:S,decorationId:y}=v.getState(b);return w?_t.create(b.doc,[gr.inline(S.from,S.to,{nodeName:s,class:c,"data-decoration-id":y})]):null}}});return v}const pee=["ArrowDown","ArrowUp","End","Home"],hee=["Enter"],LQe=["Escape",...pee,...hee],BQe=Cn.create({name:"slash-commands",addOptions(){return{nodeTypes:[]}},addProseMirrorPlugins(){const e=mv(rte,this.options.nodeTypes);return e.length>1?[FQe({allowSpaces:!0,char:"/",editor:this.editor,startOfLine:!0,allow:({state:t})=>{const n=t.selection.$from;return n.parent.type.name===br.name&&n.depth===1},command:({editor:t,props:n,range:r})=>{n.runCommands(t,{deleteRange:r})},items:({query:t})=>{const n=t.toLocaleLowerCase().trim();return e.filter(r=>{var i,o;return((i=r.shortText)==null?void 0:i.toLocaleLowerCase().includes(n))||((o=r.text)==null?void 0:o.toLocaleLowerCase().includes(n))})},render:()=>{let t;return{onStart:n=>{t=new qX(DQe,{editor:n.editor,props:n}),document.body.appendChild(t.element)},onUpdate:n=>{t==null||t.updateProps(n)},onKeyDown:({event:n})=>{var r;return!!(LQe.includes(n.key)&&((r=t==null?void 0:t.ref)!=null&&r.handleKeyDown(n)))},onExit:()=>{t==null||t.destroy(),t==null||t.element.remove()}}}})]:[]}}),DQe=E.forwardRef(function(t,n){const{command:r,decorationNode:i,editor:o,items:a}=t,[s,c]=E.useState(!0),{context:u,floating:l,reference:d,x:p,y:h}=wQe({middleware:[cQe(0),sQe(),uQe({limiter:lQe()})],onOpenChange:c,open:s,placement:"top-start",strategy:"fixed",whileElementsMounted:hQe});E.useLayoutEffect(()=>{d(i)},[d,i]),E.useEffect(()=>{let T;const I=()=>{T=window.setTimeout(()=>{c(!0)})},R=()=>{c(!1)};return o.on("focus",I).on("blur",R),()=>{o.off("focus",I).off("blur",R),clearTimeout(T)}},[o]);const[A,g]=E.useState(0),v=E.useRef([]);We.useOnChange(a,()=>{g(0),v.current=[]});const{getFloatingProps:b,getItemProps:w,getReferenceProps:S}=xQe([EQe(u,{outsidePointerDown:!1}),kQe(u,{activeIndex:A,listRef:v,onNavigate:T=>{g(I=>T??I)},openOnArrowKeyDown:!1,virtual:!0}),IQe(u,{role:"menu"})]),C=S().onKeyDown;E.useImperativeHandle(n,()=>({handleKeyDown:T=>{if(s){if(pee.includes(T.key)&&C(T),hee.includes(T.key)){const I=a[A];I!==void 0&&r(I)}return!0}else return!1}}),[A,r,a,C,s]);const x=p!==null&&h!==null;return s?f.jsxs(m.Box,{...b(),minWidth:256,backgroundColor:"grey1",border:!0,borderStyle:"solid",borderRadius:6,flexDirection:"column",ref:l,top:0,left:0,position:"fixed",transform:x?`translate3d(${Math.round(p)}px, ${Math.round(h)}px, 0)`:"translate3d(0, -200%, 0)",overflow:"hidden",children:[a.map((T,I)=>{const R=w({onClick:()=>{r(T)},onPointerDown:O=>{O.preventDefault()}});return E.createElement(rU,{...R,key:T.nodeType,ref:O=>{v.current[I]=O},active:I===A,isFirstItem:I===0,isLastItem:I===a.length-1,shortcut:`/${T.shortText??""}`},T.text)}),a.length===0&&f.jsx(rU,{...w({onPointerDown:T=>{T.preventDefault()}}),disabled:!0,ref:T=>{v.current[0]=T},children:"No results"})]}):null}),rU=E.forwardRef(function(t,n){const{children:r,disabled:i=!1,shortcut:o,active:a=!1,isFirstItem:s=!1,isLastItem:c=!1,...u}=t;return f.jsx("div",{...u,role:"button",style:{cursor:i?"default":"pointer"},ref:n,children:f.jsxs(m.Box,{alignItems:"center",height:32,flexDirection:"row",gap:8,padding:8,backgroundColor:a?"grey4":"inherit",justifyContent:"space-between",opacity:i?.5:1,children:[f.jsx(m.Text,{color:"grey12",component:"span",children:r}),o&&f.jsx(m.Text,{color:"inherit",component:"span",variant:"small",children:o})]})})});function jQe(e,t){var c,u;const n=t.map(l=>l.richTextNodeTypes).flat(),i={placeholderByNodeType:UQe(t),unfocusedPlaceholder:(c=e.config)==null?void 0:c.placeholder,nodeExtensions:t},o=n.includes(cu.orderedList)||n.includes(cu.list),a=!n.includes(cu.table);return[c_.component(((u=e.config)==null?void 0:u.single)===void 0),$u.component,gy.component,a?Jze(i):void 0,o?Vd.component:void 0,BQe.configure({nodeTypes:n})].filter(qi.isDefined)}function UQe(e){return e.reduce((t,n)=>(n.nodeType===Hc.Text&&(t[n.name]=n.placeholder),t),{})}const h_=Cze.extend({name:"bulletList",parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:e}){return["ul",Rt(this.options.HTMLAttributes,e),0]}}).configure({itemTypeName:"listItem"}),PQe={fromPrismic(e){return function(t){var r;const n=Vd.converter.fromPrismic(e)(t);if(n)return(r=e.nodes[h_.name])==null?void 0:r.create(Ta.fromPrismic(t),n)}},toPrismic(e){return Qs.children.map(e,t=>Vd.converter.toPrismic(t,de.RichTextNodeType.list).filter(qi.isDefined)).flat()}},NQe=new RL([de.RichTextNodeType.list],h_.name,h_,PQe),Cy=NQe,WQe=/^```([a-z]+)?[\s\n]$/,KQe=/^~~~([a-z]+)?[\s\n]$/,qQe=Yt.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{var t;const{languageClassPrefix:n}=this.options,o=[...((t=e.firstElementChild)===null||t===void 0?void 0:t.classList)||[]].filter(a=>a.startsWith(n)).map(a=>a.replace(n,""))[0];return o||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:e,HTMLAttributes:t}){return["pre",Rt(this.options.HTMLAttributes,t),["code",{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:e,$anchor:t}=this.editor.state.selection,n=t.pos===1;return!e||t.parent.type.name!==this.name?!1:n||!t.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:t}=e,{selection:n}=t,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;const o=r.parentOffset===r.parent.nodeSize-2,a=r.parent.textContent.endsWith(`
|
|
126
|
+
|
|
127
|
+
`);return!o||!a?!1:e.chain().command(({tr:s})=>(s.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;const{state:t}=e,{selection:n,doc:r}=t,{$from:i,empty:o}=n;if(!o||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const s=i.after();return s===void 0?!1:r.nodeAt(s)?e.commands.command(({tr:u})=>(u.setSelection(Ee.near(r.resolve(s))),!0)):e.commands.exitCode()}}},addInputRules(){return[t_({find:WQe,type:this.type,getAttributes:e=>({language:e[1]})}),t_({find:KQe,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new kn({key:new Vn("codeBlockVSCodeHandler"),props:{handlePaste:(e,t)=>{if(!t.clipboardData||this.editor.isActive(this.type.name))return!1;const n=t.clipboardData.getData("text/plain"),r=t.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,o=i==null?void 0:i.mode;if(!n||!o)return!1;const{tr:a,schema:s}=e.state,c=s.text(n.replace(/\r\n?/g,`
|
|
128
|
+
`));return a.replaceSelectionWith(this.type.create({language:o},c)),a.selection.$from.parent.type!==this.type&&a.setSelection(Te.near(a.doc.resolve(Math.max(0,a.selection.from-2)))),a.setMeta("paste",!0),e.dispatch(a),!0}}})]}}),wy=qQe.extend({name:"preformatted",addAttributes(){return{language:{default:null,parseHTML:e=>{var o;const{languageClassPrefix:t}=this.options,i=[...((o=e.firstElementChild)==null?void 0:o.classList)||[]].filter(a=>a.startsWith(t)).map(a=>a.replace(t,""))[0];return i||null},renderHTML:e=>e.language?{class:this.options.languageClassPrefix+e.language}:null}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({HTMLAttributes:e}){return["pre",Rt(this.options.HTMLAttributes),["code",e,0]]}}).configure({exitOnTripleEnter:!1}),VQe={fromPrismic(e){return function(t){var r;const n=$u.converter.fromPrismic(e)(wy.name,t,!0);return(r=e.nodes[wy.name])==null?void 0:r.create(Ta.fromPrismic(t),n)}},toPrismic(e){return $u.converter.toPrismic(e,de.RichTextNodeType.preformatted,Ta.toPrismic(e))}},zQe=new dg([de.RichTextNodeType.preformatted],wy.name,wy,VQe,"",!0),Aee=zQe;function mee(e){const{editor:t,getPos:n,node:r}=e,[i,o]=E.useState(!1);return E.useEffect(()=>{function a(){const{from:c,to:u}=t.state.selection,l=n(),d=n()+r.nodeSize,p=c<=l&&u>=d;o(p)}function s(){o(!1)}return t.on("blur",s),t.on("selectionUpdate",a),()=>{t.off("blur",s),t.off("selectionUpdate",a)}},[t,n,r.nodeSize]),{selected:i}}function QQe(e,t,n){const{node:r}=e,i=r.attrs.content,o=We.useStableCallback(e.updateAttributes),a=We.useDebounceState({initialState:(i==null?void 0:i.embed_url)??"",startTransition:E.startTransition});function s(l){o({content:l})}function c(l){a.set(l),Vr.toURL(l)||s(void 0)}const{onKeyDown:u}=HQe(e,a.value,t,n);return{inputRef:t,containerRef:n,onKeyDown:u,url:a.value,urlChanged:c,onContentChange:s,debouncedUrl:a.debouncedValue,content:e.node.attrs.content}}function HQe(e,t,n,r){const{editor:i,getPos:o,node:a}=e,[s,c]=E.useState(!0);E.useEffect(()=>{!s||!e.editor.isFocused||m.handleEditorFlushSyncError(()=>{var l;return(l=n.current)==null?void 0:l.focus()})},[n,s,e.editor.isFocused]);function u(l){const d=o(),p=o()+a.nodeSize;l.code==="Enter"&&(c(!1),i.chain().insertContentAt(p,{type:"paragraph"}).focus(p+1).run()),l.code==="Backspace"&&t===""&&i.chain().deleteRange({from:d,to:p}).focus(p+1).run(),l.code==="ArrowUp"&&(c(!1),i.chain().focus(d-1).run()),l.code==="ArrowDown"&&(c(!1),i.chain().focus(p+1).run())}return{containerRef:r,inputRef:n,onKeyDown:u}}function YQe(e){const t=E.useRef(null),n=E.useRef(null),{onKeyDown:r,url:i,urlChanged:o,onContentChange:a,debouncedUrl:s,content:c}=QQe(e,t,n),{selected:u}=mee(e);return f.jsx(IL,{className:"custom-embed",children:f.jsxs("div",{contentEditable:"false",suppressContentEditableWarning:!0,children:[f.jsxs(m.Box,{flexGrow:1,alignItems:"center",children:[f.jsx(m.Icon,{size:"small",name:"cloud",color:"grey11"}),f.jsx(m.Box,{flexGrow:1,height:40,ref:n,children:f.jsx(Ic,{id:"id",ref:t,value:i,variant:Vr.toURL(i)?"link":"normal",placeholder:"Paste your link here",onValueChange:o,onKeyDown:r})})]}),Vr.toURL(i)&&f.jsx(JG,{selected:u,debouncedUrl:s,onContentChange:a,content:c})]})})}const A_=Yt.create({name:"embed",group:"block",atom:!0,content:"block*",marks:"",addAttributes(){return{content:{default:void 0}}},addCommands(){return{setEmbed:()=>({tr:e,dispatch:t})=>{const n=this.type.create();return t&&e.replaceSelectionWith(n),!0}}},parseHTML(){return[{tag:"embed"}]},renderHTML(){return["embed"]},addNodeView(){return EL(YQe)}}),GQe={fromPrismic(e){return function(t){var n;return(n=e.nodes[A_.name])==null?void 0:n.create({content:t.data})}},toPrismic(e){return e.attrs.content===void 0?{type:"embed",data:{type:"embed",embed_url:"",__TYPE__:"EmbedContent",all:[]}}:{type:"embed",data:{...e.attrs.content}}}},gee=new uze([de.RichTextNodeType.embed],A_.name,A_,GQe),JQe=Yt.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,Rt(this.options.HTMLAttributes,t),0]},addCommands(){return{setHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.setNode(this.name,e):!1,toggleHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.toggleNode(this.name,"paragraph",e):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>t_({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}}),m_="heading";function PS(e){switch(e){case 1:return de.RichTextNodeType.heading1;case 2:return de.RichTextNodeType.heading2;case 3:return de.RichTextNodeType.heading3;case 4:return de.RichTextNodeType.heading4;case 5:return de.RichTextNodeType.heading5;case 6:return de.RichTextNodeType.heading6}}function iU(e){return{fullName:PS(e),level:e}}const vee=[1,2,3,4,5,6];function yee(e,t=vee){const n=new RegExp(`^heading([${t.join(",")}]){1}$`),r=e.match(n);if(!r||!r[1])return;const i=parseInt(r[1]);return{fullName:PS(i),level:i}}function bee(e,t){const n=e.level;if(t.includes(n))return{fullName:PS(n),level:n}}const ZQe=e=>{const t=e[0]??1;return{fromPrismic(n){return function(r){var a;const i=$u.converter.fromPrismic(n)(m_,r),o=yee(r.type,e)||iU(t);return(a=n.nodes[m_])==null?void 0:a.create({level:o.level,...Ta.fromPrismic(r)},i)}},toPrismic(n){const{fullName:r}=bee(n.attrs,e)||iU(t);return $u.converter.toPrismic(n,r,Ta.toPrismic(n))}}};function XQe(e){return e?e.size?Array.from(e.values()).reduce((n,r)=>{const i=yee(r);return i?[...n,i.level]:n},[]).sort((n,r)=>n-r):[]:vee}function eHe(e){return JQe.extend({name:"heading"}).configure({levels:e})}const qc={name:m_,build:e=>{const t=XQe(e);if(!t)return;const n=t.map(r=>PS(r));return new dze(n,eHe(t),t,ZQe(t),r=>{const i=bee(r,t);return i&&`Heading ${i.level}`})}};function tHe(e){const{content:t,thumbnail:n,imageViewProps:{getPos:r,updateAttributes:i,editor:o,node:a}}=e,[s,c]=E.useTransition();function u(g){c(()=>i({content:g}))}function l(g){const v=Hg(g),b=r()+a.nodeSize;u({...t,...v}),o.chain().focus(b+1).run()}function d({croppedImages:g}){if(!t)return;const v=g[n.name];if(!v)return;const b=aJ({content:t,croppedImage:v});b!==t&&u(b)}function p(){const g=r(),v=r()+a.nodeSize;o.chain().deleteRange({from:g,to:v}).focus(v).run()}const{uploadImage:h,isUploadingImage:A}=bJ({onMediaSelected:l});return{onMediaSelected:l,onCropperDialogClose:d,isUpdating:s,updateContent:u,onClear:p,uploadImage:h,isUploadingImage:A}}function nHe(e){const{node:t}=e,n=t.attrs.content,{selected:r}=mee(e),i=E.useRef(null),o={width:void 0,height:void 0,name:Cp},{onMediaSelected:a,onCropperDialogClose:s,isUpdating:c,updateContent:u,onClear:l,uploadImage:d,isUploadingImage:p}=tHe({content:n,thumbnail:o,imageViewProps:e}),[h,A]=E.useState(!1),g="Feature image",v=(n==null?void 0:n.width)===0&&(n==null?void 0:n.height)===0,b=n&&!v?[`${n.width}×${n.height}px`]:[],w={thumbnail:o,contentView:n,labels:Ex(o,n,n)};E.useLayoutEffect(()=>{var C;const y=(C=i==null?void 0:i.current)==null?void 0:C.closest(`.${See}`);fte.isHTMLElement(y)&&y.style.removeProperty("min-height")},[]);const S=p||c;return f.jsx(IL,{children:f.jsx(rJ,{ref:i,isMediaDialogOpen:h,selected:r,onMediaSelected:a,onMediaDialogOpenChange:A,children:f.jsx(E.Suspense,{fallback:oHe,children:n!=null&&n.url?f.jsx(yJ,{allContentViews:[n],content:n,contentView:n,fieldLabel:g,imageLabel:b,initialImages:[w],isUpdating:S,readOnly:!1,thumbnailName:o.name,onClear:l,onContentChange:u,onCropperDialogClose:s,onMediaDialogOpenChange:A}):f.jsx(iJ,{uploadImage:d,isUploading:p,disabled:h,children:f.jsx(eJ,{fieldLabel:g,isUpdating:S,readOnly:!1,onMediaDialogOpenChange:A})})})})})}const See="imageViewNodeWrapper",Cee=144,rHe=94;function iHe(e){return(e?rHe:Cee)+12+12+1+1}const oHe=f.jsx("div",{style:{height:Cee}}),g_=Yt.create({name:"image",group:"block",atom:!0,addAttributes(){return{content:{default:void 0}}},addCommands(){return{setImage:()=>e=>{const{dispatch:t,tr:n}=e,r=this.type.create();return t&&n.replaceSelectionWith(r),!0}}},parseHTML(){return[{tag:"image"}]},renderHTML({HTMLAttributes:e}){return["image",e]},addNodeView(){return function(t){const n=t.node.attrs.content===void 0;return EL(nHe,{attrs:{style:`min-height: ${iHe(n)}px`,class:See}})(t)}}}),aHe={fromPrismic(e){return function(t){var n;return(n=e.nodes[g_.name])==null?void 0:n.create({content:t.data})}},toPrismic(e){if(e.attrs.content!==void 0)return{type:"image",data:{...e.attrs.content}}}},wee=new lze([de.RichTextNodeType.image],g_.name,g_,aHe),sHe=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,cHe=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,uHe=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,lHe=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,dHe=sg.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:e=>e.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:e=>e.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:e}){return["em",Rt(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[uy({find:sHe,type:this.type}),uy({find:uHe,type:this.type})]},addPasteRules(){return[dy({find:cHe,type:this.type}),dy({find:lHe,type:this.type})]}});class fHe{constructor(t,n,r){en(this,"extType",Ll.Mark);en(this,"richTextNodeTypes",[de.RichTextNodeType.em]);this.name=t,this.component=n,this.converter=r}}const xee="em",_ee=dHe.extend({name:xee}),pHe={fromPrismic(e){return function(){var t;return(t=e.marks[_ee.name])==null?void 0:t.create()}},toPrismic(){}},hHe=new fHe(xee,_ee,pHe),BL=hHe;class AHe{constructor(t,n,r){en(this,"extType",Ll.Mark);en(this,"richTextNodeTypes",[]);this.name=t,this.component=n,this.converter=r}}const Tee="label",v_=sg.create({name:Tee,priority:1e3,keepOnSplit:!1,inclusive:!1,addOptions(){return{htmlAttributes:{style:"background-color: hsl(251, 89%, 96%); border: 1px dashed rgba(68, 53, 146, 0.4); border-radius: 0px 2px 2px 2px"}}},addAttributes(){return{label:{default:""}}},addCommands(){return{setLabel:e=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMark(this.name,e).run(),unsetLabel:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},renderHTML({HTMLAttributes:e}){return["span",Rt(this.options.htmlAttributes,e),0]}}),mHe={fromPrismic(e){return function(t){var i;const n=t.data,r={type:v_.name,label:n};return(i=e.marks[v_.name])==null?void 0:i.create(r)}},toPrismic(e){return e.attrs.label}},DL=new AHe(Tee,v_,mHe);class gHe{constructor(t,n,r){en(this,"extType",Ll.Mark);en(this,"richTextNodeTypes",[de.RichTextNodeType.hyperlink]);this.name=t,this.component=n,this.converter=r}}const Iee="hyperlink",pa=sg.create({name:Iee,priority:1e3,keepOnSplit:!1,inclusive:!1,addOptions(){return{openOnClick:!1,linkOnPaste:!0,autolink:!0,protocols:[],htmlAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null,id:""},validate:void 0}},addAttributes(){return{href:{default:""},id:{default:""},target:{default:"_blank"},rel:{default:"noopener noreferrer nofollow"},class:{default:null},media:{default:null}}},parseHTML(){return[{tag:'a[href]:not([href *= "javascript:" i])'}]},renderHTML({HTMLAttributes:e}){return["a",Rt(this.options.htmlAttributes,e),0]},addCommands(){return{setWebLink:e=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMark(this.name,e).setMeta("preventAutolink",!0).run(),setDocumentLink:e=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMark(this.name,e).setMeta("preventAutolink",!0).run(),setMediaLink:e=>({chain:t})=>{const n=y_(AJ({media:e.media}).value);return t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMark(this.name,{media:n}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}}}),vHe={fromPrismic(e){return function(t){var r,i,o,a;const n=t.data;if(n.__TYPE__==="DocumentLink"){const s={type:pa.name,id:n.id};return(r=e.marks[pa.name])==null?void 0:r.create(s)}if(n.__TYPE__==="ImageLink"){const s={type:pa.name,media:y_(n)};return(i=e.marks[pa.name])==null?void 0:i.create(s)}if(n.__TYPE__==="FileLink"){const s={type:pa.name,media:y_(n)};return(o=e.marks[pa.name])==null?void 0:o.create(s)}if(n.__TYPE__==="ExternalLink"){const s={type:pa.name,url:n.url,href:n.url,target:n.target};return(a=e.marks[pa.name])==null?void 0:a.create(s)}}},toPrismic(e){return e.attrs.media?Ree(e.attrs.media):e.attrs.id?{__TYPE__:"DocumentLink",id:e.attrs.id}:{__TYPE__:"ExternalLink",url:e.attrs.href,target:e.attrs.target}}},Eee=new gHe(Iee,pa,vHe);function y_(e){return JSON.stringify(e)}function Ree(e){return JSON.parse(e)}const yHe="listItem",oU="textStyle",aU=/^(\d+)\.\s$/,bHe=Yt.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:e=>e.hasAttribute("start")?parseInt(e.getAttribute("start")||"",10):1},type:{default:void 0,parseHTML:e=>e.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:e}){const{start:t,...n}=e;return t===1?["ol",Rt(this.options.HTMLAttributes,n),0]:["ol",Rt(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(yHe,this.editor.getAttributes(oU)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=ly({find:aU,type:this.type,getAttributes:t=>({start:+t[1]}),joinPredicate:(t,n)=>n.childCount+n.attrs.start===+t[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=ly({find:aU,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:t=>({start:+t[1],...this.editor.getAttributes(oU)}),joinPredicate:(t,n)=>n.childCount+n.attrs.start===+t[1],editor:this.editor})),[e]}}),b_=bHe.extend({name:"orderedList",addAttributes(){return{start:{default:1,parseHTML:e=>e.hasAttribute("start")?parseInt(e.getAttribute("start")||"",10):1}}},renderHTML({HTMLAttributes:e}){const{start:t,...n}=e;return t===1?["ol",Rt(this.options.HTMLAttributes,n),0]:["ol",Rt(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleOrderedList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}}}).configure({itemTypeName:"listItem"}),SHe={fromPrismic(e){return function(t){var r;const n=Vd.converter.fromPrismic(e)(t);if(n)return(r=e.nodes[b_.name])==null?void 0:r.create(Ta.fromPrismic(t),n)}},toPrismic(e){return Qs.children.map(e,t=>Vd.converter.toPrismic(t,de.RichTextNodeType.orderedList).filter(qi.isDefined)).flat()}},CHe=new RL([de.RichTextNodeType.orderedList],b_.name,b_,SHe),xy=CHe,$ee=65535,kee=Math.pow(2,16);function wHe(e,t){return e+t*kee}function sU(e){return e&$ee}function xHe(e){return(e-(e&$ee))/kee}const Oee=1,Mee=2,pv=4,Fee=8;class S_{constructor(t,n,r){this.pos=t,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&Fee)>0}get deletedBefore(){return(this.delInfo&(Oee|pv))>0}get deletedAfter(){return(this.delInfo&(Mee|pv))>0}get deletedAcross(){return(this.delInfo&pv)>0}}class Nr{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&Nr.empty)return Nr.empty}recover(t){let n=0,r=sU(t);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+xHe(t)}mapResult(t,n=1){return this._map(t,n,!1)}map(t,n=1){return this._map(t,n,!0)}_map(t,n,r){let i=0,o=this.inverted?2:1,a=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let c=this.ranges[s]-(this.inverted?i:0);if(c>t)break;let u=this.ranges[s+o],l=this.ranges[s+a],d=c+u;if(t<=d){let p=u?t==c?-1:t==d?1:n:n,h=c+i+(p<0?0:l);if(r)return h;let A=t==(n<0?c:d)?null:wHe(s/3,t-c),g=t==c?Mee:t==d?Oee:pv;return(n<0?t!=c:t!=d)&&(g|=Fee),new S_(h,g,A)}i+=l-u}return r?t+i:new S_(t+i,0,null)}touches(t,n){let r=0,i=sU(n),o=this.inverted?2:1,a=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let c=this.ranges[s]-(this.inverted?r:0);if(c>t)break;let u=this.ranges[s+o],l=c+u;if(t<=l&&s==i*3)return!0;r+=this.ranges[s+a]-u}return!1}forEach(t){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,o=0;i<this.ranges.length;i+=3){let a=this.ranges[i],s=a-(this.inverted?o:0),c=a+(this.inverted?0:o),u=this.ranges[i+n],l=this.ranges[i+r];t(s,s+u,c,c+l),o+=l-u}}invert(){return new Nr(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(t){return t==0?Nr.empty:new Nr(t<0?[0,-t,0]:[0,0,t])}}Nr.empty=new Nr([]);class uh{constructor(t=[],n,r=0,i=t.length){this.maps=t,this.mirror=n,this.from=r,this.to=i}slice(t=0,n=this.maps.length){return new uh(this.maps,this.mirror,t,n)}copy(){return new uh(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(t,n){this.to=this.maps.push(t),n!=null&&this.setMirror(this.maps.length-1,n)}appendMapping(t){for(let n=0,r=this.maps.length;n<t.maps.length;n++){let i=t.getMirror(n);this.appendMap(t.maps[n],i!=null&&i<n?r+i:void 0)}}getMirror(t){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==t)return this.mirror[n+(n%2?-1:1)]}}setMirror(t,n){this.mirror||(this.mirror=[]),this.mirror.push(t,n)}appendMappingInverted(t){for(let n=t.maps.length-1,r=this.maps.length+t.maps.length;n>=0;n--){let i=t.getMirror(n);this.appendMap(t.maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let t=new uh;return t.appendMappingInverted(this),t}map(t,n=1){if(this.mirror)return this._map(t,n,!0);for(let r=this.from;r<this.to;r++)t=this.maps[r].map(t,n);return t}mapResult(t,n=1){return this._map(t,n,!1)}_map(t,n,r){let i=0;for(let o=this.from;o<this.to;o++){let a=this.maps[o],s=a.mapResult(t,n);if(s.recover!=null){let c=this.getMirror(o);if(c!=null&&c>o&&c<this.to){o=c,t=this.maps[c].recover(s.recover);continue}}i|=s.delInfo,t=s.pos}return r?t:new S_(t,i,null)}}const Ow=Object.create(null);class Hn{getMap(){return Nr.empty}merge(t){return null}static fromJSON(t,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Ow[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(t,n)}static jsonID(t,n){if(t in Ow)throw new RangeError("Duplicate use of step JSON ID "+t);return Ow[t]=n,n.prototype.jsonID=t,n}}class Kt{constructor(t,n){this.doc=t,this.failed=n}static ok(t){return new Kt(t,null)}static fail(t){return new Kt(null,t)}static fromReplace(t,n,r,i){try{return Kt.ok(t.replace(n,r,i))}catch(o){if(o instanceof _u)return Kt.fail(o.message);throw o}}}function jL(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let o=e.child(i);o.content.size&&(o=o.copy(jL(o.content,t,o))),o.isInline&&(o=t(o,n,i)),r.push(o)}return U.fromArray(r)}class Es extends Hn{constructor(t,n,r){super(),this.from=t,this.to=n,this.mark=r}apply(t){let n=t.slice(this.from,this.to),r=t.resolve(this.from),i=r.node(r.sharedDepth(this.to)),o=new W(jL(n.content,(a,s)=>!a.isAtom||!s.type.allowsMarkType(this.mark.type)?a:a.mark(this.mark.addToSet(a.marks)),i),n.openStart,n.openEnd);return Kt.fromReplace(t,this.from,this.to,o)}invert(){return new Io(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Es(n.pos,r.pos,this.mark)}merge(t){return t instanceof Es&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new Es(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Es(n.from,n.to,t.markFromJSON(n.mark))}}Hn.jsonID("addMark",Es);class Io extends Hn{constructor(t,n,r){super(),this.from=t,this.to=n,this.mark=r}apply(t){let n=t.slice(this.from,this.to),r=new W(jL(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),t),n.openStart,n.openEnd);return Kt.fromReplace(t,this.from,this.to,r)}invert(){return new Es(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Io(n.pos,r.pos,this.mark)}merge(t){return t instanceof Io&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new Io(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Io(n.from,n.to,t.markFromJSON(n.mark))}}Hn.jsonID("removeMark",Io);class Rs extends Hn{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.nodeAt(this.pos);if(!n)return Kt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Kt.fromReplace(t,this.pos,this.pos+1,new W(U.from(r),0,n.isLeaf?0:1))}invert(t){let n=t.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new Rs(this.pos,n.marks[i]);return new Rs(this.pos,this.mark)}}return new Qd(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new Rs(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Rs(n.pos,t.markFromJSON(n.mark))}}Hn.jsonID("addNodeMark",Rs);class Qd extends Hn{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.nodeAt(this.pos);if(!n)return Kt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Kt.fromReplace(t,this.pos,this.pos+1,new W(U.from(r),0,n.isLeaf?0:1))}invert(t){let n=t.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Rs(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new Qd(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Qd(n.pos,t.markFromJSON(n.mark))}}Hn.jsonID("removeNodeMark",Qd);class Zn extends Hn{constructor(t,n,r,i=!1){super(),this.from=t,this.to=n,this.slice=r,this.structure=i}apply(t){return this.structure&&C_(t,this.from,this.to)?Kt.fail("Structure replace would overwrite content"):Kt.fromReplace(t,this.from,this.to,this.slice)}getMap(){return new Nr([this.from,this.to-this.from,this.slice.size])}invert(t){return new Zn(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new Zn(n.pos,Math.max(n.pos,r.pos),this.slice)}merge(t){if(!(t instanceof Zn)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let n=this.slice.size+t.slice.size==0?W.empty:new W(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new Zn(this.from,this.to+(t.to-t.from),n,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let n=this.slice.size+t.slice.size==0?W.empty:new W(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new Zn(t.from,this.to,n,this.structure)}else return null}toJSON(){let t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Zn(n.from,n.to,W.fromJSON(t,n.slice),!!n.structure)}}Hn.jsonID("replace",Zn);class Oo extends Hn{constructor(t,n,r,i,o,a,s=!1){super(),this.from=t,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=o,this.insert=a,this.structure=s}apply(t){if(this.structure&&(C_(t,this.from,this.gapFrom)||C_(t,this.gapTo,this.to)))return Kt.fail("Structure gap-replace would overwrite content");let n=t.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Kt.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Kt.fromReplace(t,this.from,this.to,r):Kt.fail("Content does not fit in gap")}getMap(){return new Nr([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new Oo(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:t.map(this.gapFrom,-1),o=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||o>r.pos?null:new Oo(n.pos,r.pos,i,o,this.slice,this.insert,this.structure)}toJSON(){let t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Oo(n.from,n.to,n.gapFrom,n.gapTo,W.fromJSON(t,n.slice),n.insert,!!n.structure)}}Hn.jsonID("replaceAround",Oo);function C_(e,t,n){let r=e.resolve(t),i=n-t,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let a=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!a||a.isLeaf)return!0;a=a.firstChild,i--}}return!1}function _He(e,t,n,r){let i=[],o=[],a,s;e.doc.nodesBetween(t,n,(c,u,l)=>{if(!c.isInline)return;let d=c.marks;if(!r.isInSet(d)&&l.type.allowsMarkType(r.type)){let p=Math.max(u,t),h=Math.min(u+c.nodeSize,n),A=r.addToSet(d);for(let g=0;g<d.length;g++)d[g].isInSet(A)||(a&&a.to==p&&a.mark.eq(d[g])?a.to=h:i.push(a=new Io(p,h,d[g])));s&&s.to==p?s.to=h:o.push(s=new Es(p,h,r))}}),i.forEach(c=>e.step(c)),o.forEach(c=>e.step(c))}function THe(e,t,n,r){let i=[],o=0;e.doc.nodesBetween(t,n,(a,s)=>{if(!a.isInline)return;o++;let c=null;if(r instanceof bS){let u=a.marks,l;for(;l=r.isInSet(u);)(c||(c=[])).push(l),u=l.removeFromSet(u)}else r?r.isInSet(a.marks)&&(c=[r]):c=a.marks;if(c&&c.length){let u=Math.min(s+a.nodeSize,n);for(let l=0;l<c.length;l++){let d=c[l],p;for(let h=0;h<i.length;h++){let A=i[h];A.step==o-1&&d.eq(i[h].style)&&(p=A)}p?(p.to=u,p.step=o):i.push({style:d,from:Math.max(s,t),to:u,step:o})}}}),i.forEach(a=>e.step(new Io(a.from,a.to,a.style)))}function UL(e,t,n,r=n.contentMatch,i=!0){let o=e.doc.nodeAt(t),a=[],s=t+1;for(let c=0;c<o.childCount;c++){let u=o.child(c),l=s+u.nodeSize,d=r.matchType(u.type);if(!d)a.push(new Zn(s,l,W.empty));else{r=d;for(let p=0;p<u.marks.length;p++)n.allowsMarkType(u.marks[p].type)||e.step(new Io(s,l,u.marks[p]));if(i&&u.isText&&n.whitespace!="pre"){let p,h=/\r?\n|\r/g,A;for(;p=h.exec(u.text);)A||(A=new W(U.from(n.schema.text(" ",n.allowedMarks(u.marks))),0,0)),a.push(new Zn(s+p.index,s+p.index+p[0].length,A))}}s=l}if(!r.validEnd){let c=r.fillBefore(U.empty,!0);e.replace(s,s,new W(c,0,0))}for(let c=a.length-1;c>=0;c--)e.step(a[c])}function IHe(e,t,n){let{$from:r,$to:i,depth:o}=t,a=r.before(o+1),s=i.after(o+1),c=a,u=s,l=U.empty,d=0;for(let A=o,g=!1;A>n;A--)g||r.index(A)>0?(g=!0,l=U.from(r.node(A).copy(l)),d++):c--;let p=U.empty,h=0;for(let A=o,g=!1;A>n;A--)g||i.after(A+1)<i.end(A)?(g=!0,p=U.from(i.node(A).copy(p)),h++):u++;e.step(new Oo(c,u,a,s,new W(l.append(p),d,h),l.size-d,!0))}function EHe(e,t,n){let r=U.empty;for(let a=n.length-1;a>=0;a--){if(r.size){let s=n[a].type.contentMatch.matchFragment(r);if(!s||!s.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=U.from(n[a].type.create(n[a].attrs,r))}let i=t.start,o=t.end;e.step(new Oo(i,o,i,o,new W(r,0,0),n.length,!0))}function RHe(e,t,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=e.steps.length;e.doc.nodesBetween(t,n,(a,s)=>{let c=typeof i=="function"?i(a):i;if(a.isTextblock&&!a.hasMarkup(r,c)&&$He(e.doc,e.mapping.slice(o).map(s),r)){let u=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",A=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!A?u=!1:!h&&A&&(u=!0)}u===!1&&Bee(e,a,s,o),UL(e,e.mapping.slice(o).map(s,1),r,void 0,u===null);let l=e.mapping.slice(o),d=l.map(s,1),p=l.map(s+a.nodeSize,1);return e.step(new Oo(d,p,d+1,p-1,new W(U.from(r.create(c,null,a.marks)),0,0),1,!0)),u===!0&&Lee(e,a,s,o),!1}})}function Lee(e,t,n,r){t.forEach((i,o)=>{if(i.isText){let a,s=/\r?\n|\r/g;for(;a=s.exec(i.text);){let c=e.mapping.slice(r).map(n+1+o+a.index);e.replaceWith(c,c+1,t.type.schema.linebreakReplacement.create())}}})}function Bee(e,t,n,r){t.forEach((i,o)=>{if(i.type==i.type.schema.linebreakReplacement){let a=e.mapping.slice(r).map(n+1+o);e.replaceWith(a,a+1,t.type.schema.text(`
|
|
129
|
+
`))}})}function $He(e,t,n){let r=e.resolve(t),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function kHe(e,t,n,r,i){let o=e.doc.nodeAt(t);if(!o)throw new RangeError("No node at given position");n||(n=o.type);let a=n.create(r,null,i||o.marks);if(o.isLeaf)return e.replaceWith(t,t+o.nodeSize,a);if(!n.validContent(o.content))throw new RangeError("Invalid content for node type "+n.name);e.step(new Oo(t,t+o.nodeSize,t+1,t+o.nodeSize-1,new W(U.from(a),0,0),1,!0))}function OHe(e,t,n=1,r){let i=e.doc.resolve(t),o=U.empty,a=U.empty;for(let s=i.depth,c=i.depth-n,u=n-1;s>c;s--,u--){o=U.from(i.node(s).copy(o));let l=r&&r[u];a=U.from(l?l.type.create(l.attrs,a):i.node(s).copy(a))}e.step(new Zn(t,t,new W(o.append(a),n,n),!0))}function MHe(e,t,n){let r=null,{linebreakReplacement:i}=e.doc.type.schema,o=e.doc.resolve(t-n),a=o.node().type;if(i&&a.inlineContent){let l=a.whitespace=="pre",d=!!a.contentMatch.matchType(i);l&&!d?r=!1:!l&&d&&(r=!0)}let s=e.steps.length;if(r===!1){let l=e.doc.resolve(t+n);Bee(e,l.node(),l.before(),s)}a.inlineContent&&UL(e,t+n-1,a,o.node().contentMatchAt(o.index()),r==null);let c=e.mapping.slice(s),u=c.map(t-n);if(e.step(new Zn(u,c.map(t+n,-1),W.empty,!0)),r===!0){let l=e.doc.resolve(u);Lee(e,l.node(),l.before(),e.steps.length)}return e}function FHe(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let o=r.index(i);if(r.node(i).canReplaceWith(o,o,n))return r.before(i+1);if(o>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let o=r.indexAfter(i);if(r.node(i).canReplaceWith(o,o,n))return r.after(i+1);if(o<r.node(i).childCount)return null}return null}function LHe(e,t,n=t,r=W.empty){if(t==n&&!r.size)return null;let i=e.resolve(t),o=e.resolve(n);return Dee(i,o,r)?new Zn(t,n,r):new BHe(i,o,r).fit()}function Dee(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}class BHe{constructor(t,n,r){this.$from=t,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=U.empty;for(let i=0;i<=t.depth;i++){let o=t.node(i);this.frontier.push({type:o.type,match:o.contentMatchAt(t.indexAfter(i))})}for(let i=t.depth;i>0;i--)this.placed=U.from(t.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let u=this.findFittable();u?this.placeNodes(u):this.openMore()||this.dropNode()}let t=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(t<0?this.$to:r.doc.resolve(t));if(!i)return null;let o=this.placed,a=r.depth,s=i.depth;for(;a&&s&&o.childCount==1;)o=o.firstChild.content,a--,s--;let c=new W(o,a,s);return t>-1?new Oo(r.pos,t,this.$to.pos,this.$to.end(),c,n):c.size||r.pos!=this.$to.pos?new Zn(r.pos,i.pos,c):null}findFittable(){let t=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<t;r++){let o=n.firstChild;if(n.childCount>1&&(i=0),o.type.spec.isolating&&i<=r){t=r;break}n=o.content}for(let n=1;n<=2;n++)for(let r=n==1?t:this.unplaced.openStart;r>=0;r--){let i,o=null;r?(o=Mw(this.unplaced.content,r-1).firstChild,i=o.content):i=this.unplaced.content;let a=i.firstChild;for(let s=this.depth;s>=0;s--){let{type:c,match:u}=this.frontier[s],l,d=null;if(n==1&&(a?u.matchType(a.type)||(d=u.fillBefore(U.from(a),!1)):o&&c.compatibleContent(o.type)))return{sliceDepth:r,frontierDepth:s,parent:o,inject:d};if(n==2&&a&&(l=u.findWrapping(a.type)))return{sliceDepth:r,frontierDepth:s,parent:o,wrap:l};if(o&&u.matchType(o.type))break}}}openMore(){let{content:t,openStart:n,openEnd:r}=this.unplaced,i=Mw(t,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new W(t,n+1,Math.max(r,i.size+n>=t.size-r?n+1:0)),!0)}dropNode(){let{content:t,openStart:n,openEnd:r}=this.unplaced,i=Mw(t,n);if(i.childCount<=1&&n>0){let o=t.size-n<=n+i.size;this.unplaced=new W(Hp(t,n-1,1),n-1,o?n-1:r)}else this.unplaced=new W(Hp(t,n,1),n,r)}placeNodes({sliceDepth:t,frontierDepth:n,parent:r,inject:i,wrap:o}){for(;this.depth>n;)this.closeFrontierNode();if(o)for(let g=0;g<o.length;g++)this.openFrontierNode(o[g]);let a=this.unplaced,s=r?r.content:a.content,c=a.openStart-t,u=0,l=[],{match:d,type:p}=this.frontier[n];if(i){for(let g=0;g<i.childCount;g++)l.push(i.child(g));d=d.matchFragment(i)}let h=s.size+t-(a.content.size-a.openEnd);for(;u<s.childCount;){let g=s.child(u),v=d.matchType(g.type);if(!v)break;u++,(u>1||c==0||g.content.size)&&(d=v,l.push(jee(g.mark(p.allowedMarks(g.marks)),u==1?c:0,u==s.childCount?h:-1)))}let A=u==s.childCount;A||(h=-1),this.placed=Yp(this.placed,n,U.from(l)),this.frontier[n].match=d,A&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,v=s;g<h;g++){let b=v.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),v=b.content}this.unplaced=A?t==0?W.empty:new W(Hp(a.content,t-1,1),t-1,h<0?a.openEnd:t-1):new W(Hp(a.content,t,u),a.openStart,a.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let t=this.frontier[this.depth],n;if(!t.type.isTextblock||!Fw(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(t){e:for(let n=Math.min(this.depth,t.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],o=n<t.depth&&t.end(n+1)==t.pos+(t.depth-(n+1)),a=Fw(t,n,i,r,o);if(a){for(let s=n-1;s>=0;s--){let{match:c,type:u}=this.frontier[s],l=Fw(t,s,u,c,!0);if(!l||l.childCount)continue e}return{depth:n,fit:a,move:o?t.doc.resolve(t.after(n+1)):t}}}}close(t){let n=this.findCloseLevel(t);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=Yp(this.placed,n.depth,n.fit)),t=n.move;for(let r=n.depth+1;r<=t.depth;r++){let i=t.node(r),o=i.type.contentMatch.fillBefore(i.content,!0,t.index(r));this.openFrontierNode(i.type,i.attrs,o)}return t}openFrontierNode(t,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(t),this.placed=Yp(this.placed,this.depth,U.from(t.create(n,r))),this.frontier.push({type:t,match:t.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(U.empty,!0);n.childCount&&(this.placed=Yp(this.placed,this.frontier.length,n))}}function Hp(e,t,n){return t==0?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(Hp(e.firstChild.content,t-1,n)))}function Yp(e,t,n){return t==0?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(Yp(e.lastChild.content,t-1,n)))}function Mw(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function jee(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,jee(r.firstChild,t-1,r.childCount==1?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(U.empty,!0)))),e.copy(r)}function Fw(e,t,n,r,i){let o=e.node(t),a=i?e.indexAfter(t):e.index(t);if(a==o.childCount&&!n.compatibleContent(o.type))return null;let s=r.fillBefore(o.content,!0,a);return s&&!DHe(n,o.content,a)?s:null}function DHe(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}function jHe(e){return e.spec.defining||e.spec.definingForContent}function UHe(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let i=e.doc.resolve(t),o=e.doc.resolve(n);if(Dee(i,o,r))return e.step(new Zn(t,n,r));let a=Pee(i,e.doc.resolve(n));a[a.length-1]==0&&a.pop();let s=-(i.depth+1);a.unshift(s);for(let p=i.depth,h=i.pos-1;p>0;p--,h--){let A=i.node(p).type.spec;if(A.defining||A.definingAsContext||A.isolating)break;a.indexOf(p)>-1?s=p:i.before(p)==h&&a.splice(1,0,-p)}let c=a.indexOf(s),u=[],l=r.openStart;for(let p=r.content,h=0;;h++){let A=p.firstChild;if(u.push(A),h==r.openStart)break;p=A.content}for(let p=l-1;p>=0;p--){let h=u[p],A=jHe(h.type);if(A&&!h.sameMarkup(i.node(Math.abs(s)-1)))l=p;else if(A||!h.type.isTextblock)break}for(let p=r.openStart;p>=0;p--){let h=(p+l+1)%(r.openStart+1),A=u[h];if(A)for(let g=0;g<a.length;g++){let v=a[(g+c)%a.length],b=!0;v<0&&(b=!1,v=-v);let w=i.node(v-1),S=i.index(v-1);if(w.canReplaceWith(S,S,A.type,A.marks))return e.replace(i.before(v),b?o.after(v):n,new W(Uee(r.content,0,r.openStart,h),h,r.openEnd))}}let d=e.steps.length;for(let p=a.length-1;p>=0&&(e.replace(t,n,r),!(e.steps.length>d));p--){let h=a[p];h<0||(t=i.before(h),n=o.after(h))}}function Uee(e,t,n,r,i){if(t<n){let o=e.firstChild;e=e.replaceChild(0,o.copy(Uee(o.content,t+1,n,r,o)))}if(t>r){let o=i.contentMatchAt(0),a=o.fillBefore(e).append(e);e=a.append(o.matchFragment(a).fillBefore(U.empty,!0))}return e}function PHe(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let i=FHe(e.doc,t,r.type);i!=null&&(t=n=i)}e.replaceRange(t,n,new W(U.from(r),0,0))}function NHe(e,t,n){let r=e.doc.resolve(t),i=e.doc.resolve(n),o=Pee(r,i);for(let a=0;a<o.length;a++){let s=o[a],c=a==o.length-1;if(c&&s==0||r.node(s).type.contentMatch.validEnd)return e.delete(r.start(s),i.end(s));if(s>0&&(c||r.node(s-1).canReplace(r.index(s-1),i.indexAfter(s-1))))return e.delete(r.before(s),i.after(s))}for(let a=1;a<=r.depth&&a<=i.depth;a++)if(t-r.start(a)==r.depth-a&&n>r.end(a)&&i.end(a)-n!=i.depth-a&&r.start(a-1)==i.start(a-1)&&r.node(a-1).canReplace(r.index(a-1),i.index(a-1)))return e.delete(r.before(a),n);e.delete(t,n)}function Pee(e,t){let n=[],r=Math.min(e.depth,t.depth);for(let i=r;i>=0;i--){let o=e.start(i);if(o<e.pos-(e.depth-i)||t.end(i)>t.pos+(t.depth-i)||e.node(i).type.spec.isolating||t.node(i).type.spec.isolating)break;(o==t.start(i)||i==e.depth&&i==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&i&&t.start(i-1)==o-1)&&n.push(i)}return n}class Ad extends Hn{constructor(t,n,r){super(),this.pos=t,this.attr=n,this.value=r}apply(t){let n=t.nodeAt(this.pos);if(!n)return Kt.fail("No node at attribute step's position");let r=Object.create(null);for(let o in n.attrs)r[o]=n.attrs[o];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return Kt.fromReplace(t,this.pos,this.pos+1,new W(U.from(i),0,n.isLeaf?0:1))}getMap(){return Nr.empty}invert(t){return new Ad(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new Ad(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Ad(n.pos,n.attr,n.value)}}Hn.jsonID("attr",Ad);class rA extends Hn{constructor(t,n){super(),this.attr=t,this.value=n}apply(t){let n=Object.create(null);for(let i in t.attrs)n[i]=t.attrs[i];n[this.attr]=this.value;let r=t.type.create(n,t.content,t.marks);return Kt.ok(r)}getMap(){return Nr.empty}invert(t){return new rA(this.attr,t.attrs[this.attr])}map(t){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new rA(n.attr,n.value)}}Hn.jsonID("docAttr",rA);let Hd=class extends Error{};Hd=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n};Hd.prototype=Object.create(Error.prototype);Hd.prototype.constructor=Hd;Hd.prototype.name="TransformError";class WHe{constructor(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new uh}get before(){return this.docs.length?this.docs[0]:this.doc}step(t){let n=this.maybeStep(t);if(n.failed)throw new Hd(n.failed);return this}maybeStep(t){let n=t.apply(this.doc);return n.failed||this.addStep(t,n.doc),n}get docChanged(){return this.steps.length>0}addStep(t,n){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=n}replace(t,n=t,r=W.empty){let i=LHe(this.doc,t,n,r);return i&&this.step(i),this}replaceWith(t,n,r){return this.replace(t,n,new W(U.from(r),0,0))}delete(t,n){return this.replace(t,n,W.empty)}insert(t,n){return this.replaceWith(t,t,n)}replaceRange(t,n,r){return UHe(this,t,n,r),this}replaceRangeWith(t,n,r){return PHe(this,t,n,r),this}deleteRange(t,n){return NHe(this,t,n),this}lift(t,n){return IHe(this,t,n),this}join(t,n=1){return MHe(this,t,n),this}wrap(t,n){return EHe(this,t,n),this}setBlockType(t,n=t,r,i=null){return RHe(this,t,n,r,i),this}setNodeMarkup(t,n,r=null,i){return kHe(this,t,n,r,i),this}setNodeAttribute(t,n,r){return this.step(new Ad(t,n,r)),this}setDocAttribute(t,n){return this.step(new rA(t,n)),this}addNodeMark(t,n){return this.step(new Rs(t,n)),this}removeNodeMark(t,n){if(!(n instanceof ft)){let r=this.doc.nodeAt(t);if(!r)throw new RangeError("No node at position "+t);if(n=n.isInSet(r.marks),!n)return this}return this.step(new Qd(t,n)),this}split(t,n=1,r){return OHe(this,t,n,r),this}addMark(t,n,r){return _He(this,t,n,r),this}removeMark(t,n,r){return THe(this,t,n,r),this}clearIncompatible(t,n,r){return UL(this,t,n,r),this}}var w_,x_;if(typeof WeakMap<"u"){let e=new WeakMap;w_=t=>e.get(t),x_=(t,n)=>(e.set(t,n),n)}else{const e=[];let n=0;w_=r=>{for(let i=0;i<e.length;i+=2)if(e[i]==r)return e[i+1]},x_=(r,i)=>(n==10&&(n=0),e[n++]=r,e[n++]=i)}var Tt=class{constructor(e,t,n,r){this.width=e,this.height=t,this.map=n,this.problems=r}findCell(e){for(let t=0;t<this.map.length;t++){const n=this.map[t];if(n!=e)continue;const r=t%this.width,i=t/this.width|0;let o=r+1,a=i+1;for(let s=1;o<this.width&&this.map[t+s]==n;s++)o++;for(let s=1;a<this.height&&this.map[t+this.width*s]==n;s++)a++;return{left:r,top:i,right:o,bottom:a}}throw new RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw new RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){const{left:r,right:i,top:o,bottom:a}=this.findCell(e);return t=="horiz"?(n<0?r==0:i==this.width)?null:this.map[o*this.width+(n<0?r-1:i)]:(n<0?o==0:a==this.height)?null:this.map[r+this.width*(n<0?o-1:a)]}rectBetween(e,t){const{left:n,right:r,top:i,bottom:o}=this.findCell(e),{left:a,right:s,top:c,bottom:u}=this.findCell(t);return{left:Math.min(n,a),top:Math.min(i,c),right:Math.max(r,s),bottom:Math.max(o,u)}}cellsInRect(e){const t=[],n={};for(let r=e.top;r<e.bottom;r++)for(let i=e.left;i<e.right;i++){const o=r*this.width+i,a=this.map[o];n[a]||(n[a]=!0,!(i==e.left&&i&&this.map[o-1]==a||r==e.top&&r&&this.map[o-this.width]==a)&&t.push(a))}return t}positionAt(e,t,n){for(let r=0,i=0;;r++){const o=i+n.child(r).nodeSize;if(r==e){let a=t+e*this.width;const s=(e+1)*this.width;for(;a<s&&this.map[a]<i;)a++;return a==s?o-1:this.map[a]}i=o}}static get(e){return w_(e)||x_(e,KHe(e))}};function KHe(e){if(e.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+e.type.name);const t=qHe(e),n=e.childCount,r=[];let i=0,o=null;const a=[];for(let u=0,l=t*n;u<l;u++)r[u]=0;for(let u=0,l=0;u<n;u++){const d=e.child(u);l++;for(let A=0;;A++){for(;i<r.length&&r[i]!=0;)i++;if(A==d.childCount)break;const g=d.child(A),{colspan:v,rowspan:b,colwidth:w}=g.attrs;for(let S=0;S<b;S++){if(S+u>=n){(o||(o=[])).push({type:"overlong_rowspan",pos:l,n:b-S});break}const y=i+S*t;for(let C=0;C<v;C++){r[y+C]==0?r[y+C]=l:(o||(o=[])).push({type:"collision",row:u,pos:l,n:v-C});const x=w&&w[C];if(x){const T=(y+C)%t*2,I=a[T];I==null||I!=x&&a[T+1]==1?(a[T]=x,a[T+1]=1):I==x&&a[T+1]++}}}i+=v,l+=g.nodeSize}const p=(u+1)*t;let h=0;for(;i<p;)r[i++]==0&&h++;h&&(o||(o=[])).push({type:"missing",row:u,n:h}),l++}(t===0||n===0)&&(o||(o=[])).push({type:"zero_sized"});const s=new Tt(t,n,r,o);let c=!1;for(let u=0;!c&&u<a.length;u+=2)a[u]!=null&&a[u+1]<n&&(c=!0);return c&&VHe(s,a,e),s}function qHe(e){let t=-1,n=!1;for(let r=0;r<e.childCount;r++){const i=e.child(r);let o=0;if(n)for(let a=0;a<r;a++){const s=e.child(a);for(let c=0;c<s.childCount;c++){const u=s.child(c);a+u.attrs.rowspan>r&&(o+=u.attrs.colspan)}}for(let a=0;a<i.childCount;a++){const s=i.child(a);o+=s.attrs.colspan,s.attrs.rowspan>1&&(n=!0)}t==-1?t=o:t!=o&&(t=Math.max(t,o))}return t}function VHe(e,t,n){e.problems||(e.problems=[]);const r={};for(let i=0;i<e.map.length;i++){const o=e.map[i];if(r[o])continue;r[o]=!0;const a=n.nodeAt(o);if(!a)throw new RangeError(`No cell with offset ${o} found`);let s=null;const c=a.attrs;for(let u=0;u<c.colspan;u++){const l=(i+u)%e.width,d=t[l*2];d!=null&&(!c.colwidth||c.colwidth[u]!=d)&&((s||(s=zHe(c)))[u]=d)}s&&e.problems.unshift({type:"colwidth mismatch",pos:o,colwidth:s})}}function zHe(e){if(e.colwidth)return e.colwidth.slice();const t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function Nn(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(const n in e.nodes){const r=e.nodes[n],i=r.spec.tableRole;i&&(t[i]=r)}}return t}var ws=new Vn("selectingCells");function xp(e){for(let t=e.depth-1;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return e.node(0).resolve(e.before(t+1));return null}function QHe(e){for(let t=e.depth;t>0;t--){const n=e.node(t).type.spec.tableRole;if(n==="cell"||n==="header_cell")return e.node(t)}return null}function Zr(e){const t=e.selection.$head;for(let n=t.depth;n>0;n--)if(t.node(n).type.spec.tableRole=="row")return!0;return!1}function NS(e){const t=e.selection;if("$anchorCell"in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if("node"in t&&t.node&&t.node.type.spec.tableRole=="cell")return t.$anchor;const n=xp(t.$head)||HHe(t.$head);if(n)return n;throw new RangeError(`No cell found around position ${t.head}`)}function HHe(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){const r=t.type.spec.tableRole;if(r=="cell"||r=="header_cell")return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){const r=t.type.spec.tableRole;if(r=="cell"||r=="header_cell")return e.doc.resolve(n-t.nodeSize)}}function __(e){return e.parent.type.spec.tableRole=="row"&&!!e.nodeAfter}function YHe(e){return e.node(0).resolve(e.pos+e.nodeAfter.nodeSize)}function PL(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function Nee(e,t,n){const r=e.node(-1),i=Tt.get(r),o=e.start(-1),a=i.nextCell(e.pos-o,t,n);return a==null?null:e.node(0).resolve(o+a)}function Ou(e,t,n=1){const r={...e,colspan:e.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(t,n),r.colwidth.some(i=>i>0)||(r.colwidth=null)),r}function Wee(e,t,n=1){const r={...e,colspan:e.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let i=0;i<n;i++)r.colwidth.splice(t,0,0)}return r}function GHe(e,t,n){const r=Nn(t.type.schema).header_cell;for(let i=0;i<e.height;i++)if(t.nodeAt(e.map[n+i*e.width]).type!=r)return!1;return!0}var at=class ha extends Ee{constructor(t,n=t){const r=t.node(-1),i=Tt.get(r),o=t.start(-1),a=i.rectBetween(t.pos-o,n.pos-o),s=t.node(0),c=i.cellsInRect(a).filter(l=>l!=n.pos-o);c.unshift(n.pos-o);const u=c.map(l=>{const d=r.nodeAt(l);if(!d)throw RangeError(`No cell with offset ${l} found`);const p=o+l+1;return new ZJ(s.resolve(p),s.resolve(p+d.content.size))});super(u[0].$from,u[0].$to,u),this.$anchorCell=t,this.$headCell=n}map(t,n){const r=t.resolve(n.map(this.$anchorCell.pos)),i=t.resolve(n.map(this.$headCell.pos));if(__(r)&&__(i)&&PL(r,i)){const o=this.$anchorCell.node(-1)!=r.node(-1);return o&&this.isRowSelection()?ha.rowSelection(r,i):o&&this.isColSelection()?ha.colSelection(r,i):new ha(r,i)}return Te.between(r,i)}content(){const t=this.$anchorCell.node(-1),n=Tt.get(t),r=this.$anchorCell.start(-1),i=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),o={},a=[];for(let c=i.top;c<i.bottom;c++){const u=[];for(let l=c*n.width+i.left,d=i.left;d<i.right;d++,l++){const p=n.map[l];if(o[p])continue;o[p]=!0;const h=n.findCell(p);let A=t.nodeAt(p);if(!A)throw RangeError(`No cell with offset ${p} found`);const g=i.left-h.left,v=h.right-i.right;if(g>0||v>0){let b=A.attrs;if(g>0&&(b=Ou(b,0,g)),v>0&&(b=Ou(b,b.colspan-v,v)),h.left<i.left){if(A=A.type.createAndFill(b),!A)throw RangeError(`Could not create cell with attrs ${JSON.stringify(b)}`)}else A=A.type.create(b,A.content)}if(h.top<i.top||h.bottom>i.bottom){const b={...A.attrs,rowspan:Math.min(h.bottom,i.bottom)-Math.max(h.top,i.top)};h.top<i.top?A=A.type.createAndFill(b):A=A.type.create(b,A.content)}u.push(A)}a.push(t.child(c).copy(U.from(u)))}const s=this.isColSelection()&&this.isRowSelection()?t:a;return new W(U.from(s),1,1)}replace(t,n=W.empty){const r=t.steps.length,i=this.ranges;for(let a=0;a<i.length;a++){const{$from:s,$to:c}=i[a],u=t.mapping.slice(r);t.replace(u.map(s.pos),u.map(c.pos),a?W.empty:n)}const o=Ee.findFrom(t.doc.resolve(t.mapping.slice(r).map(this.to)),-1);o&&t.setSelection(o)}replaceWith(t,n){this.replace(t,new W(U.from(n),0,0))}forEachCell(t){const n=this.$anchorCell.node(-1),r=Tt.get(n),i=this.$anchorCell.start(-1),o=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let a=0;a<o.length;a++)t(n.nodeAt(o[a]),i+o[a])}isColSelection(){const t=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(t,n)>0)return!1;const r=t+this.$anchorCell.nodeAfter.attrs.rowspan,i=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,i)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){const r=t.node(-1),i=Tt.get(r),o=t.start(-1),a=i.findCell(t.pos-o),s=i.findCell(n.pos-o),c=t.node(0);return a.top<=s.top?(a.top>0&&(t=c.resolve(o+i.map[a.left])),s.bottom<i.height&&(n=c.resolve(o+i.map[i.width*(i.height-1)+s.right-1]))):(s.top>0&&(n=c.resolve(o+i.map[s.left])),a.bottom<i.height&&(t=c.resolve(o+i.map[i.width*(i.height-1)+a.right-1]))),new ha(t,n)}isRowSelection(){const t=this.$anchorCell.node(-1),n=Tt.get(t),r=this.$anchorCell.start(-1),i=n.colCount(this.$anchorCell.pos-r),o=n.colCount(this.$headCell.pos-r);if(Math.min(i,o)>0)return!1;const a=i+this.$anchorCell.nodeAfter.attrs.colspan,s=o+this.$headCell.nodeAfter.attrs.colspan;return Math.max(a,s)==n.width}eq(t){return t instanceof ha&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){const r=t.node(-1),i=Tt.get(r),o=t.start(-1),a=i.findCell(t.pos-o),s=i.findCell(n.pos-o),c=t.node(0);return a.left<=s.left?(a.left>0&&(t=c.resolve(o+i.map[a.top*i.width])),s.right<i.width&&(n=c.resolve(o+i.map[i.width*(s.top+1)-1]))):(s.left>0&&(n=c.resolve(o+i.map[s.top*i.width])),a.right<i.width&&(t=c.resolve(o+i.map[i.width*(a.top+1)-1]))),new ha(t,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new ha(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){return new ha(t.resolve(n),t.resolve(r))}getBookmark(){return new JHe(this.$anchorCell.pos,this.$headCell.pos)}};at.prototype.visible=!1;Ee.jsonID("cell",at);var JHe=class Kee{constructor(t,n){this.anchor=t,this.head=n}map(t){return new Kee(t.map(this.anchor),t.map(this.head))}resolve(t){const n=t.resolve(this.anchor),r=t.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&r.index()<r.parent.childCount&&PL(n,r)?new at(n,r):Ee.near(r,1)}};function ZHe(e){if(!(e.selection instanceof at))return null;const t=[];return e.selection.forEachCell((n,r)=>{t.push(gr.node(r,r+n.nodeSize,{class:"selectedCell"}))}),_t.create(e.doc,t)}function XHe({$from:e,$to:t}){if(e.pos==t.pos||e.pos<t.pos-6)return!1;let n=e.pos,r=t.pos,i=e.depth;for(;i>=0&&!(e.after(i+1)<e.end(i));i--,n++);for(let o=t.depth;o>=0&&!(t.before(o+1)>t.start(o));o--,r--);return n==r&&/row|table/.test(e.node(i).type.spec.tableRole)}function eYe({$from:e,$to:t}){let n,r;for(let i=e.depth;i>0;i--){const o=e.node(i);if(o.type.spec.tableRole==="cell"||o.type.spec.tableRole==="header_cell"){n=o;break}}for(let i=t.depth;i>0;i--){const o=t.node(i);if(o.type.spec.tableRole==="cell"||o.type.spec.tableRole==="header_cell"){r=o;break}}return n!==r&&t.parentOffset===0}function tYe(e,t,n){const r=(t||e).selection,i=(t||e).doc;let o,a;if(r instanceof ve&&(a=r.node.type.spec.tableRole)){if(a=="cell"||a=="header_cell")o=at.create(i,r.from);else if(a=="row"){const s=i.resolve(r.from+1);o=at.rowSelection(s,s)}else if(!n){const s=Tt.get(r.node),c=r.from+1,u=c+s.map[s.width*s.height-1];o=at.create(i,c+1,u)}}else r instanceof Te&&XHe(r)?o=Te.create(i,r.from):r instanceof Te&&eYe(r)&&(o=Te.create(i,r.$from.start(),r.$from.end()));return o&&(t||(t=e.tr)).setSelection(o),t}var nYe=new Vn("fix-tables");function qee(e,t,n,r){const i=e.childCount,o=t.childCount;e:for(let a=0,s=0;a<o;a++){const c=t.child(a);for(let u=s,l=Math.min(i,a+3);u<l;u++)if(e.child(u)==c){s=u+1,n+=c.nodeSize;continue e}r(c,n),s<i&&e.child(s).sameMarkup(c)?qee(e.child(s),c,n+1,r):c.nodesBetween(0,c.content.size,r,n+1),n+=c.nodeSize}}function Vee(e,t){let n;const r=(i,o)=>{i.type.spec.tableRole=="table"&&(n=rYe(e,i,o,n))};return t?t.doc!=e.doc&&qee(t.doc,e.doc,0,r):e.doc.descendants(r),n}function rYe(e,t,n,r){const i=Tt.get(t);if(!i.problems)return r;r||(r=e.tr);const o=[];for(let c=0;c<i.height;c++)o.push(0);for(let c=0;c<i.problems.length;c++){const u=i.problems[c];if(u.type=="collision"){const l=t.nodeAt(u.pos);if(!l)continue;const d=l.attrs;for(let p=0;p<d.rowspan;p++)o[u.row+p]+=u.n;r.setNodeMarkup(r.mapping.map(n+1+u.pos),null,Ou(d,d.colspan-u.n,u.n))}else if(u.type=="missing")o[u.row]+=u.n;else if(u.type=="overlong_rowspan"){const l=t.nodeAt(u.pos);if(!l)continue;r.setNodeMarkup(r.mapping.map(n+1+u.pos),null,{...l.attrs,rowspan:l.attrs.rowspan-u.n})}else if(u.type=="colwidth mismatch"){const l=t.nodeAt(u.pos);if(!l)continue;r.setNodeMarkup(r.mapping.map(n+1+u.pos),null,{...l.attrs,colwidth:u.colwidth})}else if(u.type=="zero_sized"){const l=r.mapping.map(n);r.delete(l,l+t.nodeSize)}}let a,s;for(let c=0;c<o.length;c++)o[c]&&(a==null&&(a=c),s=c);for(let c=0,u=n+1;c<i.height;c++){const l=t.child(c),d=u+l.nodeSize,p=o[c];if(p>0){let h="cell";l.firstChild&&(h=l.firstChild.type.spec.tableRole);const A=[];for(let v=0;v<p;v++){const b=Nn(e.schema)[h].createAndFill();b&&A.push(b)}const g=(c==0||a==c-1)&&s==c?u+1:d-1;r.insert(r.mapping.map(g),A)}u=d}return r.setMeta(nYe,{fixTables:!0})}function _i(e){const t=e.selection,n=NS(e),r=n.node(-1),i=n.start(-1),o=Tt.get(r);return{...t instanceof at?o.rectBetween(t.$anchorCell.pos-i,t.$headCell.pos-i):o.findCell(n.pos-i),tableStart:i,map:o,table:r}}function NL(e,{map:t,tableStart:n,table:r},i){let o=i>0?-1:0;GHe(t,r,i+o)&&(o=i==0||i==t.width?null:0);for(let a=0;a<t.height;a++){const s=a*t.width+i;if(i>0&&i<t.width&&t.map[s-1]==t.map[s]){const c=t.map[s],u=r.nodeAt(c);e.setNodeMarkup(e.mapping.map(n+c),null,Wee(u.attrs,i-t.colCount(c))),a+=u.attrs.rowspan-1}else{const c=o==null?Nn(r.type.schema).cell:r.nodeAt(t.map[s+o]).type,u=t.positionAt(a,i,r);e.insert(e.mapping.map(n+u),c.createAndFill())}}return e}function iYe(e,t){if(!Zr(e))return!1;if(t){const n=_i(e);t(NL(e.tr,n,n.left))}return!0}function oYe(e,t){if(!Zr(e))return!1;if(t){const n=_i(e);t(NL(e.tr,n,n.right))}return!0}function aYe(e,{map:t,table:n,tableStart:r},i){const o=e.mapping.maps.length;for(let a=0;a<t.height;){const s=a*t.width+i,c=t.map[s],u=n.nodeAt(c),l=u.attrs;if(i>0&&t.map[s-1]==c||i<t.width-1&&t.map[s+1]==c)e.setNodeMarkup(e.mapping.slice(o).map(r+c),null,Ou(l,i-t.colCount(c)));else{const d=e.mapping.slice(o).map(r+c);e.delete(d,d+u.nodeSize)}a+=l.rowspan}}function sYe(e,t){if(!Zr(e))return!1;if(t){const n=_i(e),r=e.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let i=n.right-1;aYe(r,n,i),i!=n.left;i--){const o=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!o)throw RangeError("No table found");n.table=o,n.map=Tt.get(o)}t(r)}return!0}function cYe(e,t,n){var r;const i=Nn(t.type.schema).header_cell;for(let o=0;o<e.width;o++)if(((r=t.nodeAt(e.map[o+n*e.width]))==null?void 0:r.type)!=i)return!1;return!0}function WL(e,{map:t,tableStart:n,table:r},i){var o;let a=n;for(let u=0;u<i;u++)a+=r.child(u).nodeSize;const s=[];let c=i>0?-1:0;cYe(t,r,i+c)&&(c=i==0||i==t.height?null:0);for(let u=0,l=t.width*i;u<t.width;u++,l++)if(i>0&&i<t.height&&t.map[l]==t.map[l-t.width]){const d=t.map[l],p=r.nodeAt(d).attrs;e.setNodeMarkup(n+d,null,{...p,rowspan:p.rowspan+1}),u+=p.colspan-1}else{const d=c==null?Nn(r.type.schema).cell:(o=r.nodeAt(t.map[l+c*t.width]))==null?void 0:o.type,p=d==null?void 0:d.createAndFill();p&&s.push(p)}return e.insert(a,Nn(r.type.schema).row.create(null,s)),e}function uYe(e,t){if(!Zr(e))return!1;if(t){const n=_i(e);t(WL(e.tr,n,n.top))}return!0}function lYe(e,t){if(!Zr(e))return!1;if(t){const n=_i(e);t(WL(e.tr,n,n.bottom))}return!0}function dYe(e,{map:t,table:n,tableStart:r},i){let o=0;for(let u=0;u<i;u++)o+=n.child(u).nodeSize;const a=o+n.child(i).nodeSize,s=e.mapping.maps.length;e.delete(o+r,a+r);const c=new Set;for(let u=0,l=i*t.width;u<t.width;u++,l++){const d=t.map[l];if(!c.has(d)){if(c.add(d),i>0&&d==t.map[l-t.width]){const p=n.nodeAt(d).attrs;e.setNodeMarkup(e.mapping.slice(s).map(d+r),null,{...p,rowspan:p.rowspan-1}),u+=p.colspan-1}else if(i<t.height&&d==t.map[l+t.width]){const p=n.nodeAt(d),h=p.attrs,A=p.type.create({...h,rowspan:p.attrs.rowspan-1},p.content),g=t.positionAt(i+1,u,n);e.insert(e.mapping.slice(s).map(r+g),A),u+=h.colspan-1}}}}function fYe(e,t){if(!Zr(e))return!1;if(t){const n=_i(e),r=e.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let i=n.bottom-1;dYe(r,n,i),i!=n.top;i--){const o=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!o)throw RangeError("No table found");n.table=o,n.map=Tt.get(n.table)}t(r)}return!0}function cU(e){const t=e.content;return t.childCount==1&&t.child(0).isTextblock&&t.child(0).childCount==0}function pYe({width:e,height:t,map:n},r){let i=r.top*e+r.left,o=i,a=(r.bottom-1)*e+r.left,s=i+(r.right-r.left-1);for(let c=r.top;c<r.bottom;c++){if(r.left>0&&n[o]==n[o-1]||r.right<e&&n[s]==n[s+1])return!0;o+=e,s+=e}for(let c=r.left;c<r.right;c++){if(r.top>0&&n[i]==n[i-e]||r.bottom<t&&n[a]==n[a+e])return!0;i++,a++}return!1}function uU(e,t){const n=e.selection;if(!(n instanceof at)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=_i(e),{map:i}=r;if(pYe(i,r))return!1;if(t){const o=e.tr,a={};let s=U.empty,c,u;for(let l=r.top;l<r.bottom;l++)for(let d=r.left;d<r.right;d++){const p=i.map[l*i.width+d],h=r.table.nodeAt(p);if(!(a[p]||!h))if(a[p]=!0,c==null)c=p,u=h;else{cU(h)||(s=s.append(h.content));const A=o.mapping.map(p+r.tableStart);o.delete(A,A+h.nodeSize)}}if(c==null||u==null)return!0;if(o.setNodeMarkup(c+r.tableStart,null,{...Wee(u.attrs,u.attrs.colspan,r.right-r.left-u.attrs.colspan),rowspan:r.bottom-r.top}),s.size){const l=c+1+u.content.size,d=cU(u)?c+1:l;o.replaceWith(d+r.tableStart,l+r.tableStart,s)}o.setSelection(new at(o.doc.resolve(c+r.tableStart))),t(o)}return!0}function lU(e,t){const n=Nn(e.schema);return hYe(({node:r})=>n[r.type.spec.tableRole])(e,t)}function hYe(e){return(t,n)=>{var r;const i=t.selection;let o,a;if(i instanceof at){if(i.$anchorCell.pos!=i.$headCell.pos)return!1;o=i.$anchorCell.nodeAfter,a=i.$anchorCell.pos}else{if(o=QHe(i.$from),!o)return!1;a=(r=xp(i.$from))==null?void 0:r.pos}if(o==null||a==null||o.attrs.colspan==1&&o.attrs.rowspan==1)return!1;if(n){let s=o.attrs;const c=[],u=s.colwidth;s.rowspan>1&&(s={...s,rowspan:1}),s.colspan>1&&(s={...s,colspan:1});const l=_i(t),d=t.tr;for(let h=0;h<l.right-l.left;h++)c.push(u?{...s,colwidth:u&&u[h]?[u[h]]:null}:s);let p;for(let h=l.top;h<l.bottom;h++){let A=l.map.positionAt(h,l.left,l.table);h==l.top&&(A+=o.nodeSize);for(let g=l.left,v=0;g<l.right;g++,v++)g==l.left&&h==l.top||d.insert(p=d.mapping.map(A+l.tableStart,1),e({node:o,row:h,col:g}).createAndFill(c[v]))}d.setNodeMarkup(a,e({node:o,row:l.top,col:l.left}),c[0]),i instanceof at&&d.setSelection(new at(d.doc.resolve(i.$anchorCell.pos),p?d.doc.resolve(p):void 0)),n(d)}return!0}}function AYe(e,t){return function(n,r){if(!Zr(n))return!1;const i=NS(n);if(i.nodeAfter.attrs[e]===t)return!1;if(r){const o=n.tr;n.selection instanceof at?n.selection.forEachCell((a,s)=>{a.attrs[e]!==t&&o.setNodeMarkup(s,null,{...a.attrs,[e]:t})}):o.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[e]:t}),r(o)}return!0}}function mYe(e){return function(t,n){if(!Zr(t))return!1;if(n){const r=Nn(t.schema),i=_i(t),o=t.tr,a=i.map.cellsInRect(e=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:e=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),s=a.map(c=>i.table.nodeAt(c));for(let c=0;c<a.length;c++)s[c].type==r.header_cell&&o.setNodeMarkup(i.tableStart+a[c],r.cell,s[c].attrs);if(o.steps.length==0)for(let c=0;c<a.length;c++)o.setNodeMarkup(i.tableStart+a[c],r.header_cell,s[c].attrs);n(o)}return!0}}function dU(e,t,n){const r=t.map.cellsInRect({left:0,top:0,right:e=="row"?t.map.width:1,bottom:e=="column"?t.map.height:1});for(let i=0;i<r.length;i++){const o=t.table.nodeAt(r[i]);if(o&&o.type!==n.header_cell)return!1}return!0}function iA(e,t){return t=t||{useDeprecatedLogic:!1},t.useDeprecatedLogic?mYe(e):function(n,r){if(!Zr(n))return!1;if(r){const i=Nn(n.schema),o=_i(n),a=n.tr,s=dU("row",o,i),c=dU("column",o,i),l=(e==="column"?s:e==="row"?c:!1)?1:0,d=e=="column"?{left:0,top:l,right:1,bottom:o.map.height}:e=="row"?{left:l,top:0,right:o.map.width,bottom:1}:o,p=e=="column"?c?i.cell:i.header_cell:e=="row"?s?i.cell:i.header_cell:i.cell;o.map.cellsInRect(d).forEach(h=>{const A=h+o.tableStart,g=a.doc.nodeAt(A);g&&a.setNodeMarkup(A,p,g.attrs)}),r(a)}return!0}}iA("row",{useDeprecatedLogic:!0});iA("column",{useDeprecatedLogic:!0});var gYe=iA("cell",{useDeprecatedLogic:!0});function vYe(e,t){if(t<0){const n=e.nodeBefore;if(n)return e.pos-n.nodeSize;for(let r=e.index(-1)-1,i=e.before();r>=0;r--){const o=e.node(-1).child(r),a=o.lastChild;if(a)return i-1-a.nodeSize;i-=o.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;const n=e.node(-1);for(let r=e.indexAfter(-1),i=e.after();r<n.childCount;r++){const o=n.child(r);if(o.childCount)return i+1;i+=o.nodeSize}}return null}function fU(e){return function(t,n){if(!Zr(t))return!1;const r=vYe(NS(t),e);if(r==null)return!1;if(n){const i=t.doc.resolve(r);n(t.tr.setSelection(Te.between(i,YHe(i))).scrollIntoView())}return!0}}function yYe(e,t){const n=e.selection.$anchor;for(let r=n.depth;r>0;r--)if(n.node(r).type.spec.tableRole=="table")return t&&t(e.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function Wg(e,t){const n=e.selection;if(!(n instanceof at))return!1;if(t){const r=e.tr,i=Nn(e.schema).cell.createAndFill().content;n.forEachCell((o,a)=>{o.content.eq(i)||r.replace(r.mapping.map(a+1),r.mapping.map(a+o.nodeSize-1),new W(i,0,0))}),r.docChanged&&t(r)}return!0}function bYe(e){if(!e.size)return null;let{content:t,openStart:n,openEnd:r}=e;for(;t.childCount==1&&(n>0&&r>0||t.child(0).type.spec.tableRole=="table");)n--,r--,t=t.child(0).content;const i=t.child(0),o=i.type.spec.tableRole,a=i.type.schema,s=[];if(o=="row")for(let c=0;c<t.childCount;c++){let u=t.child(c).content;const l=c?0:Math.max(0,n-1),d=c<t.childCount-1?0:Math.max(0,r-1);(l||d)&&(u=T_(Nn(a).row,new W(u,l,d)).content),s.push(u)}else if(o=="cell"||o=="header_cell")s.push(n||r?T_(Nn(a).row,new W(t,n,r)).content:t);else return null;return SYe(a,s)}function SYe(e,t){const n=[];for(let i=0;i<t.length;i++){const o=t[i];for(let a=o.childCount-1;a>=0;a--){const{rowspan:s,colspan:c}=o.child(a).attrs;for(let u=i;u<i+s;u++)n[u]=(n[u]||0)+c}}let r=0;for(let i=0;i<n.length;i++)r=Math.max(r,n[i]);for(let i=0;i<n.length;i++)if(i>=t.length&&t.push(U.empty),n[i]<r){const o=Nn(e).cell.createAndFill(),a=[];for(let s=n[i];s<r;s++)a.push(o);t[i]=t[i].append(U.from(a))}return{height:t.length,width:r,rows:t}}function T_(e,t){const n=e.createAndFill();return new WHe(n).replace(0,n.content.size,t).doc}function CYe({width:e,height:t,rows:n},r,i){if(e!=r){const o=[],a=[];for(let s=0;s<n.length;s++){const c=n[s],u=[];for(let l=o[s]||0,d=0;l<r;d++){let p=c.child(d%c.childCount);l+p.attrs.colspan>r&&(p=p.type.createChecked(Ou(p.attrs,p.attrs.colspan,l+p.attrs.colspan-r),p.content)),u.push(p),l+=p.attrs.colspan;for(let h=1;h<p.attrs.rowspan;h++)o[s+h]=(o[s+h]||0)+p.attrs.colspan}a.push(U.from(u))}n=a,e=r}if(t!=i){const o=[];for(let a=0,s=0;a<i;a++,s++){const c=[],u=n[s%t];for(let l=0;l<u.childCount;l++){let d=u.child(l);a+d.attrs.rowspan>i&&(d=d.type.create({...d.attrs,rowspan:Math.max(1,i-d.attrs.rowspan)},d.content)),c.push(d)}o.push(U.from(c))}n=o,t=i}return{width:e,height:t,rows:n}}function wYe(e,t,n,r,i,o,a){const s=e.doc.type.schema,c=Nn(s);let u,l;if(i>t.width)for(let d=0,p=0;d<t.height;d++){const h=n.child(d);p+=h.nodeSize;const A=[];let g;h.lastChild==null||h.lastChild.type==c.cell?g=u||(u=c.cell.createAndFill()):g=l||(l=c.header_cell.createAndFill());for(let v=t.width;v<i;v++)A.push(g);e.insert(e.mapping.slice(a).map(p-1+r),A)}if(o>t.height){const d=[];for(let A=0,g=(t.height-1)*t.width;A<Math.max(t.width,i);A++){const v=A>=t.width?!1:n.nodeAt(t.map[g+A]).type==c.header_cell;d.push(v?l||(l=c.header_cell.createAndFill()):u||(u=c.cell.createAndFill()))}const p=c.row.create(null,U.from(d)),h=[];for(let A=t.height;A<o;A++)h.push(p);e.insert(e.mapping.slice(a).map(r+n.nodeSize-2),h)}return!!(u||l)}function pU(e,t,n,r,i,o,a,s){if(a==0||a==t.height)return!1;let c=!1;for(let u=i;u<o;u++){const l=a*t.width+u,d=t.map[l];if(t.map[l-t.width]==d){c=!0;const p=n.nodeAt(d),{top:h,left:A}=t.findCell(d);e.setNodeMarkup(e.mapping.slice(s).map(d+r),null,{...p.attrs,rowspan:a-h}),e.insert(e.mapping.slice(s).map(t.positionAt(a,A,n)),p.type.createAndFill({...p.attrs,rowspan:h+p.attrs.rowspan-a})),u+=p.attrs.colspan-1}}return c}function hU(e,t,n,r,i,o,a,s){if(a==0||a==t.width)return!1;let c=!1;for(let u=i;u<o;u++){const l=u*t.width+a,d=t.map[l];if(t.map[l-1]==d){c=!0;const p=n.nodeAt(d),h=t.colCount(d),A=e.mapping.slice(s).map(d+r);e.setNodeMarkup(A,null,Ou(p.attrs,a-h,p.attrs.colspan-(a-h))),e.insert(A+p.nodeSize,p.type.createAndFill(Ou(p.attrs,0,a-h))),u+=p.attrs.rowspan-1}}return c}function AU(e,t,n,r,i){let o=n?e.doc.nodeAt(n-1):e.doc;if(!o)throw new Error("No table found");let a=Tt.get(o);const{top:s,left:c}=r,u=c+i.width,l=s+i.height,d=e.tr;let p=0;function h(){if(o=n?d.doc.nodeAt(n-1):d.doc,!o)throw new Error("No table found");a=Tt.get(o),p=d.mapping.maps.length}wYe(d,a,o,n,u,l,p)&&h(),pU(d,a,o,n,c,u,s,p)&&h(),pU(d,a,o,n,c,u,l,p)&&h(),hU(d,a,o,n,s,l,c,p)&&h(),hU(d,a,o,n,s,l,u,p)&&h();for(let A=s;A<l;A++){const g=a.positionAt(A,c,o),v=a.positionAt(A,u,o);d.replace(d.mapping.slice(p).map(g+n),d.mapping.slice(p).map(v+n),new W(i.rows[A-s],0,0))}h(),d.setSelection(new at(d.doc.resolve(n+a.positionAt(s,c,o)),d.doc.resolve(n+a.positionAt(l-1,u-1,o)))),t(d)}var xYe=TZ({ArrowLeft:Kg("horiz",-1),ArrowRight:Kg("horiz",1),ArrowUp:Kg("vert",-1),ArrowDown:Kg("vert",1),"Shift-ArrowLeft":qg("horiz",-1),"Shift-ArrowRight":qg("horiz",1),"Shift-ArrowUp":qg("vert",-1),"Shift-ArrowDown":qg("vert",1),Backspace:Wg,"Mod-Backspace":Wg,Delete:Wg,"Mod-Delete":Wg});function hv(e,t,n){return n.eq(e.selection)?!1:(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function Kg(e,t){return(n,r,i)=>{if(!i)return!1;const o=n.selection;if(o instanceof at)return hv(n,r,Ee.near(o.$headCell,t));if(e!="horiz"&&!o.empty)return!1;const a=zee(i,e,t);if(a==null)return!1;if(e=="horiz")return hv(n,r,Ee.near(n.doc.resolve(o.head+t),t));{const s=n.doc.resolve(a),c=Nee(s,e,t);let u;return c?u=Ee.near(c,1):t<0?u=Ee.near(n.doc.resolve(s.before(-1)),-1):u=Ee.near(n.doc.resolve(s.after(-1)),1),hv(n,r,u)}}}function qg(e,t){return(n,r,i)=>{if(!i)return!1;const o=n.selection;let a;if(o instanceof at)a=o;else{const c=zee(i,e,t);if(c==null)return!1;a=new at(n.doc.resolve(c))}const s=Nee(a.$headCell,e,t);return s?hv(n,r,new at(a.$anchorCell,s)):!1}}function _Ye(e,t){const n=e.state.doc,r=xp(n.resolve(t));return r?(e.dispatch(e.state.tr.setSelection(new at(r))),!0):!1}function TYe(e,t,n){if(!Zr(e.state))return!1;let r=bYe(n);const i=e.state.selection;if(i instanceof at){r||(r={width:1,height:1,rows:[U.from(T_(Nn(e.state.schema).cell,n))]});const o=i.$anchorCell.node(-1),a=i.$anchorCell.start(-1),s=Tt.get(o).rectBetween(i.$anchorCell.pos-a,i.$headCell.pos-a);return r=CYe(r,s.right-s.left,s.bottom-s.top),AU(e.state,e.dispatch,a,s,r),!0}else if(r){const o=NS(e.state),a=o.start(-1);return AU(e.state,e.dispatch,a,Tt.get(o.node(-1)).findCell(o.pos-a),r),!0}else return!1}function IYe(e,t){var n;if(t.ctrlKey||t.metaKey)return;const r=mU(e,t.target);let i;if(t.shiftKey&&e.state.selection instanceof at)o(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&r&&(i=xp(e.state.selection.$anchor))!=null&&((n=Lw(e,t))==null?void 0:n.pos)!=i.pos)o(i,t),t.preventDefault();else if(!r)return;function o(c,u){let l=Lw(e,u);const d=ws.getState(e.state)==null;if(!l||!PL(c,l))if(d)l=c;else return;const p=new at(c,l);if(d||!e.state.selection.eq(p)){const h=e.state.tr.setSelection(p);d&&h.setMeta(ws,c.pos),e.dispatch(h)}}function a(){e.root.removeEventListener("mouseup",a),e.root.removeEventListener("dragstart",a),e.root.removeEventListener("mousemove",s),ws.getState(e.state)!=null&&e.dispatch(e.state.tr.setMeta(ws,-1))}function s(c){const u=c,l=ws.getState(e.state);let d;if(l!=null)d=e.state.doc.resolve(l);else if(mU(e,u.target)!=r&&(d=Lw(e,t),!d))return a();d&&o(d,u)}e.root.addEventListener("mouseup",a),e.root.addEventListener("dragstart",a),e.root.addEventListener("mousemove",s)}function zee(e,t,n){if(!(e.state.selection instanceof Te))return null;const{$head:r}=e.state.selection;for(let i=r.depth-1;i>=0;i--){const o=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:o.childCount))return null;if(o.type.spec.tableRole=="cell"||o.type.spec.tableRole=="header_cell"){const s=r.before(i),c=t=="vert"?n>0?"down":"up":n>0?"right":"left";return e.endOfTextblock(c)?s:null}}return null}function mU(e,t){for(;t&&t!=e.dom;t=t.parentNode)if(t.nodeName=="TD"||t.nodeName=="TH")return t;return null}function Lw(e,t){const n=e.posAtCoords({left:t.clientX,top:t.clientY});return n&&n?xp(e.state.doc.resolve(n.pos)):null}var Qee=class{constructor(t,n){this.node=t,this.defaultCellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${n}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),I_(t,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.type!=this.node.type?!1:(this.node=t,I_(t,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(t){return t.type=="attributes"&&(t.target==this.table||this.colgroup.contains(t.target))}};function I_(e,t,n,r,i,o){var a;let s=0,c=!0,u=t.firstChild;const l=e.firstChild;if(l){for(let d=0,p=0;d<l.childCount;d++){const{colspan:h,colwidth:A}=l.child(d).attrs;for(let g=0;g<h;g++,p++){const v=i==p?o:A&&A[g],b=v?v+"px":"";if(s+=v||r,v||(c=!1),u)u.style.width!=b&&(u.style.width=b),u=u.nextSibling;else{const w=document.createElement("col");w.style.width=b,t.appendChild(w)}}}for(;u;){const d=u.nextSibling;(a=u.parentNode)==null||a.removeChild(u),u=d}c?(n.style.width=s+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=s+"px")}}var Wr=new Vn("tableColumnResizing");function EYe({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:n=100,View:r=Qee,lastColumnResizable:i=!0}={}){const o=new kn({key:Wr,state:{init(a,s){var c,u;const l=(u=(c=o.spec)==null?void 0:c.props)==null?void 0:u.nodeViews,d=Nn(s.schema).table.name;return r&&l&&(l[d]=(p,h)=>new r(p,n,h)),new RYe(-1,!1)},apply(a,s){return s.apply(a)}},props:{attributes:a=>{const s=Wr.getState(a);return s&&s.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(a,s)=>{$Ye(a,s,e,i)},mouseleave:a=>{kYe(a)},mousedown:(a,s)=>{OYe(a,s,t,n)}},decorations:a=>{const s=Wr.getState(a);if(s&&s.activeHandle>-1)return DYe(a,s.activeHandle)},nodeViews:{}}});return o}var RYe=class Av{constructor(t,n){this.activeHandle=t,this.dragging=n}apply(t){const n=this,r=t.getMeta(Wr);if(r&&r.setHandle!=null)return new Av(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Av(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&t.docChanged){let i=t.mapping.map(n.activeHandle,-1);return __(t.doc.resolve(i))||(i=-1),new Av(i,n.dragging)}return n}};function $Ye(e,t,n,r){if(!e.editable)return;const i=Wr.getState(e.state);if(i&&!i.dragging){const o=FYe(t.target);let a=-1;if(o){const{left:s,right:c}=o.getBoundingClientRect();t.clientX-s<=n?a=gU(e,t,"left",n):c-t.clientX<=n&&(a=gU(e,t,"right",n))}if(a!=i.activeHandle){if(!r&&a!==-1){const s=e.state.doc.resolve(a),c=s.node(-1),u=Tt.get(c),l=s.start(-1);if(u.colCount(s.pos-l)+s.nodeAfter.attrs.colspan-1==u.width-1)return}Hee(e,a)}}}function kYe(e){if(!e.editable)return;const t=Wr.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&Hee(e,-1)}function OYe(e,t,n,r){var i;if(!e.editable)return!1;const o=(i=e.dom.ownerDocument.defaultView)!=null?i:window,a=Wr.getState(e.state);if(!a||a.activeHandle==-1||a.dragging)return!1;const s=e.state.doc.nodeAt(a.activeHandle),c=MYe(e,a.activeHandle,s.attrs);e.dispatch(e.state.tr.setMeta(Wr,{setDragging:{startX:t.clientX,startWidth:c}}));function u(d){o.removeEventListener("mouseup",u),o.removeEventListener("mousemove",l);const p=Wr.getState(e.state);p!=null&&p.dragging&&(LYe(e,p.activeHandle,vU(p.dragging,d,n)),e.dispatch(e.state.tr.setMeta(Wr,{setDragging:null})))}function l(d){if(!d.which)return u(d);const p=Wr.getState(e.state);if(p&&p.dragging){const h=vU(p.dragging,d,n);yU(e,p.activeHandle,h,r)}}return yU(e,a.activeHandle,c,r),o.addEventListener("mouseup",u),o.addEventListener("mousemove",l),t.preventDefault(),!0}function MYe(e,t,{colspan:n,colwidth:r}){const i=r&&r[r.length-1];if(i)return i;const o=e.domAtPos(t);let s=o.node.childNodes[o.offset].offsetWidth,c=n;if(r)for(let u=0;u<n;u++)r[u]&&(s-=r[u],c--);return s/c}function FYe(e){for(;e&&e.nodeName!="TD"&&e.nodeName!="TH";)e=e.classList&&e.classList.contains("ProseMirror")?null:e.parentNode;return e}function gU(e,t,n,r){const i=n=="right"?-r:r,o=e.posAtCoords({left:t.clientX+i,top:t.clientY});if(!o)return-1;const{pos:a}=o,s=xp(e.state.doc.resolve(a));if(!s)return-1;if(n=="right")return s.pos;const c=Tt.get(s.node(-1)),u=s.start(-1),l=c.map.indexOf(s.pos-u);return l%c.width==0?-1:u+c.map[l-1]}function vU(e,t,n){const r=t.clientX-e.startX;return Math.max(n,e.startWidth+r)}function Hee(e,t){e.dispatch(e.state.tr.setMeta(Wr,{setHandle:t}))}function LYe(e,t,n){const r=e.state.doc.resolve(t),i=r.node(-1),o=Tt.get(i),a=r.start(-1),s=o.colCount(r.pos-a)+r.nodeAfter.attrs.colspan-1,c=e.state.tr;for(let u=0;u<o.height;u++){const l=u*o.width+s;if(u&&o.map[l]==o.map[l-o.width])continue;const d=o.map[l],p=i.nodeAt(d).attrs,h=p.colspan==1?0:s-o.colCount(d);if(p.colwidth&&p.colwidth[h]==n)continue;const A=p.colwidth?p.colwidth.slice():BYe(p.colspan);A[h]=n,c.setNodeMarkup(a+d,null,{...p,colwidth:A})}c.docChanged&&e.dispatch(c)}function yU(e,t,n,r){const i=e.state.doc.resolve(t),o=i.node(-1),a=i.start(-1),s=Tt.get(o).colCount(i.pos-a)+i.nodeAfter.attrs.colspan-1;let c=e.domAtPos(i.start(-1)).node;for(;c&&c.nodeName!="TABLE";)c=c.parentNode;c&&I_(o,c.firstChild,c,r,s,n)}function BYe(e){return Array(e).fill(0)}function DYe(e,t){var n;const r=[],i=e.doc.resolve(t),o=i.node(-1);if(!o)return _t.empty;const a=Tt.get(o),s=i.start(-1),c=a.colCount(i.pos-s)+i.nodeAfter.attrs.colspan-1;for(let u=0;u<a.height;u++){const l=c+u*a.width;if((c==a.width-1||a.map[l]!=a.map[l+1])&&(u==0||a.map[l]!=a.map[l-a.width])){const d=a.map[l],p=s+d+o.nodeAt(d).nodeSize-1,h=document.createElement("div");h.className="column-resize-handle",(n=Wr.getState(e))!=null&&n.dragging&&r.push(gr.node(s+d,s+d+o.nodeAt(d).nodeSize,{class:"column-resize-dragging"})),r.push(gr.widget(p,h))}}return _t.create(e.doc,r)}function jYe({allowTableNodeSelection:e=!1}={}){return new kn({key:ws,state:{init(){return null},apply(t,n){const r=t.getMeta(ws);if(r!=null)return r==-1?null:r;if(n==null||!t.docChanged)return n;const{deleted:i,pos:o}=t.mapping.mapResult(n);return i?null:o}},props:{decorations:ZHe,handleDOMEvents:{mousedown:IYe},createSelectionBetween(t){return ws.getState(t.state)!=null?t.state.selection:null},handleTripleClick:_Ye,handleKeyDown:xYe,handlePaste:TYe},appendTransaction(t,n,r){return tYe(r,Vee(r,n),e)}})}function E_(e,t){return t?["width",`${Math.max(t,e)}px`]:["min-width",`${e}px`]}function bU(e,t,n,r,i,o){var a;let s=0,c=!0,u=t.firstChild;const l=e.firstChild;if(l!==null)for(let d=0,p=0;d<l.childCount;d+=1){const{colspan:h,colwidth:A}=l.child(d).attrs;for(let g=0;g<h;g+=1,p+=1){const v=i===p?o:A&&A[g],b=v?`${v}px`:"";if(s+=v||r,v||(c=!1),u){if(u.style.width!==b){const[w,S]=E_(r,v);u.style.setProperty(w,S)}u=u.nextSibling}else{const w=document.createElement("col"),[S,y]=E_(r,v);w.style.setProperty(S,y),t.appendChild(w)}}}for(;u;){const d=u.nextSibling;(a=u.parentNode)===null||a===void 0||a.removeChild(u),u=d}c?(n.style.width=`${s}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${s}px`)}class UYe{constructor(t,n){this.node=t,this.cellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),bU(t,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.type!==this.node.type?!1:(this.node=t,bU(t,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(t){return t.type==="attributes"&&(t.target===this.table||this.colgroup.contains(t.target))}}function PYe(e,t,n,r){let i=0,o=!0;const a=[],s=e.firstChild;if(!s)return{};for(let d=0,p=0;d<s.childCount;d+=1){const{colspan:h,colwidth:A}=s.child(d).attrs;for(let g=0;g<h;g+=1,p+=1){const v=n===p?r:A&&A[g];i+=v||t,v||(o=!1);const[b,w]=E_(t,v);a.push(["col",{style:`${b}: ${w}`}])}}const c=o?`${i}px`:"",u=o?"":`${i}px`;return{colgroup:["colgroup",{},...a],tableWidth:c,tableMinWidth:u}}function SU(e,t){return t?e.createChecked(null,t):e.createAndFill()}function NYe(e){if(e.cached.tableNodeTypes)return e.cached.tableNodeTypes;const t={};return Object.keys(e.nodes).forEach(n=>{const r=e.nodes[n];r.spec.tableRole&&(t[r.spec.tableRole]=r)}),e.cached.tableNodeTypes=t,t}function WYe(e,t,n,r,i){const o=NYe(e),a=[],s=[];for(let u=0;u<n;u+=1){const l=SU(o.cell,i);if(l&&s.push(l),r){const d=SU(o.header_cell,i);d&&a.push(d)}}const c=[];for(let u=0;u<t;u+=1)c.push(o.row.createChecked(null,r&&u===0?a:s));return o.table.createChecked(null,c)}function KYe(e){return e instanceof at}const Vg=({editor:e})=>{const{selection:t}=e.state;if(!KYe(t))return!1;let n=0;const r=fX(t.ranges[0].$from,o=>o.type.name==="table");return r==null||r.node.descendants(o=>{if(o.type.name==="table")return!1;["tableCell","tableHeader"].includes(o.type.name)&&(n+=1)}),n===t.ranges.length?(e.commands.deleteTable(),!0):!1},qYe=Yt.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:UYe,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:e,HTMLAttributes:t}){const{colgroup:n,tableWidth:r,tableMinWidth:i}=PYe(e,this.options.cellMinWidth);return["table",Rt(this.options.HTMLAttributes,t,{style:r?`width: ${r}`:`min-width: ${i}`}),n,["tbody",0]]},addCommands(){return{insertTable:({rows:e=3,cols:t=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:i,editor:o})=>{const a=WYe(o.schema,e,t,n);if(i){const s=r.selection.from+1;r.replaceSelectionWith(a).scrollIntoView().setSelection(Te.near(r.doc.resolve(s)))}return!0},addColumnBefore:()=>({state:e,dispatch:t})=>iYe(e,t),addColumnAfter:()=>({state:e,dispatch:t})=>oYe(e,t),deleteColumn:()=>({state:e,dispatch:t})=>sYe(e,t),addRowBefore:()=>({state:e,dispatch:t})=>uYe(e,t),addRowAfter:()=>({state:e,dispatch:t})=>lYe(e,t),deleteRow:()=>({state:e,dispatch:t})=>fYe(e,t),deleteTable:()=>({state:e,dispatch:t})=>yYe(e,t),mergeCells:()=>({state:e,dispatch:t})=>uU(e,t),splitCell:()=>({state:e,dispatch:t})=>lU(e,t),toggleHeaderColumn:()=>({state:e,dispatch:t})=>iA("column")(e,t),toggleHeaderRow:()=>({state:e,dispatch:t})=>iA("row")(e,t),toggleHeaderCell:()=>({state:e,dispatch:t})=>gYe(e,t),mergeOrSplit:()=>({state:e,dispatch:t})=>uU(e,t)?!0:lU(e,t),setCellAttribute:(e,t)=>({state:n,dispatch:r})=>AYe(e,t)(n,r),goToNextCell:()=>({state:e,dispatch:t})=>fU(1)(e,t),goToPreviousCell:()=>({state:e,dispatch:t})=>fU(-1)(e,t),fixTables:()=>({state:e,dispatch:t})=>(t&&Vee(e),!0),setCellSelection:e=>({tr:t,dispatch:n})=>{if(n){const r=at.create(t.doc,e.anchorCell,e.headCell);t.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:Vg,"Mod-Backspace":Vg,Delete:Vg,"Mod-Delete":Vg}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[EYe({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],jYe({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(e){const t={name:e.name,options:e.options,storage:e.storage};return{tableRole:Le(ce(e,"tableRole",t))}}}),Yee=Yt.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:e=>{const t=e.getAttribute("colwidth");return t?t.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:e}){return["td",Rt(this.options.HTMLAttributes,e),0]}}),Gee=Yt.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:e=>{const t=e.getAttribute("colwidth");return t?t.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:e}){return["th",Rt(this.options.HTMLAttributes,e),0]}}),Jee=Yt.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:e}){return["tr",Rt(this.options.HTMLAttributes,e),0]}});function VYe({editor:e}){const t=e.isActive("table")&&e.isActive("innerTable");return f.jsxs(IL,{className:m.tableFieldStyles.tableWithControls,children:[f.jsx(JVe,{className:m.tableFieldStyles.tableContent}),f.jsx("button",{type:"button",className:m.tableFieldStyles.addTableRowButton,onClick:e.commands.addRowEnd,"aria-disabled":!t,"aria-label":"Add row",title:"Add row",children:f.jsx(m.Icon,{name:"add",size:"small"})}),f.jsx("button",{type:"button",className:m.tableFieldStyles.addTableColumnButton,onClick:e.commands.addColumnEnd,"aria-disabled":!t,"aria-label":"Add column",title:"Add column",children:f.jsx(m.Icon,{name:"add",size:"small"})})]})}function WS(e,t){const n=e.nodes[t];if(!n)throw new Error(`Unwanted state: ${t} not found in schema.`);return n}function Zee(e){return t=>{switch(t.type){case"hyperlink":case"paragraph":case"strong":case"em":return br.converter.fromPrismic(e)(t)||[];default:return[]}}}const CU={fromPrismic(e){return function(t){return WS(e,Yee.name).create({colspan:1,rowspan:1,colwidth:null},t.content.value.flatMap(Zee(e)))}},toPrismic(e){const t=[];return e.content.forEach(n=>{const r=br.converter.toPrismic(n);ue.TextBlock.is(r)&&t.push(r)}),{type:"tableCell",content:{__TYPE__:"StructuredTextContent",value:t}}}},wU={fromPrismic(e){return function(t){return WS(e,Gee.name).create({colspan:1,rowspan:1,colwidth:null},t.content.value.flatMap(Zee(e)))}},toPrismic(e){const t=[];return e.content.forEach(n=>{const r=br.converter.toPrismic(n);ue.TextBlock.is(r)&&t.push(r)}),{type:"tableHeader",content:{__TYPE__:"StructuredTextContent",value:t}}}},xU={fromPrismic(e){return function(t){return WS(e,Jee.name).create({},t.content.map(r=>{switch(r.type){case"tableHeader":return wU.fromPrismic(e)(r);case"tableCell":return CU.fromPrismic(e)(r)}}))}},toPrismic(e){const t=[];return e.content.forEach(n=>{switch(n.type.name){case"tableHeader":{t.push(wU.toPrismic(n));break}case"tableCell":{t.push(CU.toPrismic(n));break}}}),{type:"tableRow",content:t}}},R_=qYe.extend({name:"innerTable",group:"table",addNodeView(){return({node:e})=>new Qee(e,120)},addCommands(){var e;return{...(e=this.parent)==null?void 0:e.call(this),addRowEnd:()=>({dispatch:t,state:n})=>{if(!Zr(n))return!1;if(t){const r=_i(n),i=r.map.height;t(WL(n.tr,r,i))}return!0},addColumnEnd:()=>({dispatch:t,state:n})=>{if(!Zr(n))return!1;if(t){const r=_i(n),i=r.map.width;t(NL(n.tr,r,i))}return!0}}}}),zYe={fromPrismic(e){return function(t){const r=WS(e,R_.name).create({},t.content.map(xU.fromPrismic(e))),i=e.nodes[Xee.name];return i?i.create({},r):r}},toPrismic(e){var n;const t=((n=e.content.firstChild)==null?void 0:n.type.name)===R_.name?e.content.firstChild:e;return{type:"table",content:Qs.children.map(t,r=>xU.toPrismic(r))}}},Xee=Yt.create({name:"table",group:"block",content:"innerTable",selectable:!1,parseHTML(){return[{tag:"div"}]},renderHTML({HTMLAttributes:e}){return["div",e,0]},addNodeView(){return EL(VYe)}}),QYe=new fze([cu.table],cu.table,[Xee,R_,Jee,Gee,Yee],zYe),ete=[$L,BL,Eee],tte=[...ete,DL];function nte(e){return nze(e)?[...ete,br,QYe].filter(qi.isDefined):[br,Cy,xy,qc.build(e),Aee,gee,wee,...tte].filter(qi.isDefined)}const rte=[{nodeType:de.RichTextNodeType.paragraph,icon:"textFields",isActive:e=>e.isActive(br.name)&&!e.isActive(Cy.name)&&!e.isActive(xy.name),runCommands:Ft((e,t)=>e.clearNodes().setDirection(Pi(t))),shortText:"par",text:"Paragraph"},{nodeType:de.RichTextNodeType.heading1,icon:"looks1",isActive:e=>e.isActive(qc.name,{level:1}),runCommands:Ft((e,t)=>e.setHeading({level:1}).setDirection(Pi(t))),shortText:"h1",text:"Heading 1"},{nodeType:de.RichTextNodeType.heading2,icon:"looks2",isActive:e=>e.isActive(qc.name,{level:2}),runCommands:Ft((e,t)=>e.setHeading({level:2}).setDirection(Pi(t))),shortText:"h2",text:"Heading 2"},{nodeType:de.RichTextNodeType.heading3,icon:"looks3",isActive:e=>e.isActive(qc.name,{level:3}),runCommands:Ft((e,t)=>e.setHeading({level:3}).setDirection(Pi(t))),shortText:"h3",text:"Heading 3"},{nodeType:de.RichTextNodeType.heading4,icon:"looks4",isActive:e=>e.isActive(qc.name,{level:4}),runCommands:Ft((e,t)=>e.setHeading({level:4}).setDirection(Pi(t))),shortText:"h4",text:"Heading 4"},{nodeType:de.RichTextNodeType.heading5,icon:"looks5",isActive:e=>e.isActive(qc.name,{level:5}),runCommands:Ft((e,t)=>e.setHeading({level:5}).setDirection(Pi(t))),shortText:"h5",text:"Heading 5"},{nodeType:de.RichTextNodeType.heading6,icon:"looks6",isActive:e=>e.isActive(qc.name,{level:6}),runCommands:Ft((e,t)=>e.setHeading({level:6}).setDirection(Pi(t))),shortText:"h6",text:"Heading 6"},{nodeType:de.RichTextNodeType.list,icon:"formatListBulleted",isActive:e=>e.isActive(Cy.name),runCommands:Ft((e,t)=>e.toggleBulletList().setDirection(Pi(t))),shortText:"bull",text:"Bulleted list"},{nodeType:de.RichTextNodeType.orderedList,icon:"formatListNumbered",isActive:e=>e.isActive(xy.name),runCommands:Ft((e,t)=>e.toggleOrderedList().setDirection(Pi(t))),shortText:"num",text:"Numbered list"},{nodeType:de.RichTextNodeType.preformatted,icon:"dataObject",isActive:e=>e.isActive(Aee.name),runCommands:Ft((e,t)=>e.setCodeBlock().setDirection(Pi(t))),shortText:"code",text:"Code"},{nodeType:de.RichTextNodeType.embed,icon:"cloud",isActive:e=>e.isActive(gee.name),runCommands:Ft(e=>e.setEmbed()),shortText:"emb",text:"Embed"},{nodeType:de.RichTextNodeType.image,icon:"image",isActive:e=>e.isActive(wee.name),runCommands:Ft(e=>e.setImage()),shortText:"img",text:"Image"}],HYe=[{nodeType:de.RichTextNodeType.strong,icon:"formatBold",isActive:e=>e.isActive($L.name),runCommands:Ft(e=>e.toggleBold())},{nodeType:de.RichTextNodeType.em,icon:"formatItalic",isActive:e=>e.isActive(BL.name),runCommands:Ft(e=>e.toggleItalic())}],YYe=[{nodeType:de.RichTextNodeType.rtl,icon:"formatTextDirectionRToL",isActive:e=>e.isActive({[ma]:Yc}),runCommands:Ft((e,t)=>e.toggleDirection(Pi(t)))}];function Ft(e){return(t,n={})=>{let r=n.can===!0?t.can().chain():t.chain().focus();return n.deleteRange!==void 0&&(r=r.deleteRange(n.deleteRange)),n.can?GYe(t,r,e):e(r,t).run()}}function Pi(e){const t=e.state.selection.$from.parent.attrs;return Ta.parseNodeAttrsDirection(t)}function mv(e,t){return e.filter(n=>t.includes(n.nodeType))}function GYe(e,t,n){try{return n(t,e).run()}catch{return!1}}function JYe(e){const{items:t,editor:n}=e;return t.length===0?null:f.jsxs(f.Fragment,{children:[t.map(r=>f.jsx(m.ToolbarToggleButton,{disabled:!r.runCommands(n,{can:!0}),onPressedChange:()=>{r.runCommands(n)},pressed:r.isActive(n),startIcon:r.icon},r.nodeType)),f.jsx(m.ToolbarSeparator,{})]})}function ZYe(e){const{labels:t,editor:n}=e,r=n.getAttributes("label").label;return f.jsxs(f.Fragment,{children:[f.jsxs(m.DropdownMenu,{children:[f.jsx(m.DropdownMenuTrigger,{disabled:t.length===0,children:f.jsx(m.Button,{endIcon:"arrowDropDown",size:"small",color:"grey",children:_U(r??"Labels")})}),f.jsx(m.DropdownMenuContent,{align:"start",asPortal:!1,maxHeight:256,avoidCollisions:!1,children:t.map((i,o)=>{const a=r===i;return f.jsx(m.DropdownMenuItem,{onSelect:()=>a?n.commands.unsetLabel():XYe(n,i),endIcon:a&&f.jsx(m.Icon,{name:"check",size:"extraSmall"}),children:_U(i)},`${i}-${o}`)})})]}),f.jsx(m.ToolbarSeparator,{})]})}function XYe(e,t){Ft(r=>r.setLabel({label:t}))(e)}function _U(e){return bi.overflow(e,20)}function eGe(e){const{editor:t}=e,n=t.getAttributes("label");if(!n.label)return null;const r=n.label;return f.jsx(m.Box,{backgroundColor:"purple9",padding:{block:2,inline:4},alignItems:"center",borderRadius:{topLeft:2,topRight:2,bottomRight:2},maxWidth:125,children:f.jsx(m.Text,{color:"white",variant:"small",noWrap:!0,children:r})})}function tGe(e){const{disabled:t,showWebLinkModal:n,showDocumentsLinkModal:r,showMediaLinkModal:i}=nGe(e);return f.jsxs(f.Fragment,{children:[f.jsxs(m.ToolbarButtonGroup,{density:"compact",children:[f.jsx(m.ToolbarButton,{disabled:t,startIcon:"link",onClick:n},de.RichTextNodeType.hyperlink),f.jsxs(m.DropdownMenu,{children:[f.jsx(m.DropdownMenuTrigger,{children:f.jsx(m.ToolbarButton,{startIcon:"arrowDropDown"})}),f.jsxs(m.DropdownMenuContent,{align:"end",asPortal:!1,children:[f.jsx(m.DropdownMenuItem,{startIcon:f.jsx(m.Icon,{name:"public"}),onSelect:n,children:"Link to web page"}),f.jsx(m.DropdownMenuItem,{startIcon:f.jsx(m.Icon,{name:"description"}),onSelect:r,children:"Link to document"}),f.jsx(m.DropdownMenuItem,{startIcon:f.jsx(m.Icon,{name:"image"}),onSelect:i,children:"Link to media"})]})]})]}),f.jsx(m.ToolbarSeparator,{})]})}function nGe(e){const{editor:t,setModal:n}=e;function r(){n("webLink")}function i(){n("documentLink")}function o(){n("mediaLink")}return{disabled:!Ft(s=>s.setWebLink({href:""}))(t,{can:!0}),showWebLinkModal:r,showDocumentsLinkModal:i,showMediaLinkModal:o}}function rGe(e){const{docId:t,onEdit:n,onUnlink:r}=e,i=iGe(t),o=ye();if(!i)return null;const a=i.versions[0],s=AF({status:a==null?void 0:a.status,releaseId:(a==null?void 0:a.status)==="release"?a.release_id:void 0,documentId:i.id,versionId:a==null?void 0:a.version_id,baseUrl:o.baseUrl}),c=(a==null?void 0:a.preview_summary)??"",u=(a==null?void 0:a.custom_type_label)??"";return f.jsx(xu,{url:s,title:i.title,subTitle:u,description:c,onEdit:n,onUnlink:r,largeIconName:"description"})}function iGe(e){const t=ye();t.searchDocuments||bt("searchDocuments");const{coreApiBaseUrl:n,authStrategy:r}=t;return Ye.useRequest(tg,[n,r,e])}function oGe(e){const{editor:t}=e,{searchDocuments:n}=ye(),r=t.getAttributes(de.RichTextNodeType.hyperlink);if(r.id&&n){const i=r.id;return f.jsx(aGe,{docId:i,...e})}if(r.href){const i=r.href;return f.jsx(sGe,{url:i,...e})}if(r.media){const i=Ree(r.media);return f.jsx(cGe,{media:i,...e})}return null}function aGe(e){const{editor:t,onEditDocumentLink:n,docId:r}=e;return f.jsx(m.ErrorBoundary,{renderError:()=>f.jsx(xu,{title:"Failed to Load Linked Document Data",error:!0,onEdit:n,onUnlink:()=>lu(t)}),children:f.jsx(E.Suspense,{fallback:f.jsx(xu,{loading:!0,onEdit:n,onUnlink:()=>lu(t)}),children:f.jsx(rGe,{docId:r,onEdit:n,onUnlink:()=>lu(t)})})})}function sGe(e){const{url:t,editor:n,onEditWebLink:r}=e,i=Vr.toURL(t);return i?f.jsx(xu,{url:t,title:Vr.getUrlTitle(i),subTitle:t,onEdit:r,onUnlink:()=>lu(n)}):f.jsx(xu,{url:t,subTitle:t,onEdit:r,onUnlink:()=>lu(n)})}function cGe(e){const{media:t,editor:n,onEditMediaLink:r}=e;return ue.FilledImageLinkContent.is(t)?f.jsx(hJ,{url:t.url,title:t.name,subTitle:`${t.width} x ${t.height} pixels`,onEdit:r,onUnlink:()=>lu(n)}):ue.FilledFileLinkContent.is(t)?f.jsx(xu,{url:t.url,title:t.name,subTitle:uGe({filename:t.name}),largeIconName:"insertDriveFile",onEdit:r,onUnlink:()=>lu(n)}):null}function lu(e){Ft(n=>n.unsetLink())(e)}function uGe(e){const{filename:t}=e,n=t.split(".").pop();return n?n.toLowerCase():""}function lGe(e){const{open:t}=e,{onOpenChange:n,onSelectDocument:r}=dGe(e);return f.jsx(lJ,{open:t,onOpenChange:n,onSelectDocument:r})}function dGe(e){const{editor:t,setOpen:n}=e;function r(o){Ft(s=>s.extendMarkRange(de.RichTextNodeType.hyperlink).setDocumentLink({id:o}))(t),n(!1)}function i(o){n(o)}return{onSelectDocument:r,onOpenChange:i}}function fGe(e){const{open:t}=e,{onOpenChange:n,onMediaSelected:r}=pGe(e);return f.jsx(HF,{open:t,onOpenChange:n,onMediaSelected:r,assetType:"all"})}function pGe(e){const{editor:t,setOpen:n}=e;function r(i){Ft(a=>a.extendMarkRange(de.RichTextNodeType.hyperlink).setMediaLink({media:i}))(t),n(!1)}return{onMediaSelected:r,onOpenChange:n}}function hGe(e){const{open:t,setOpen:n}=e,{url:r,setUrl:i,openInNewTab:o,setOpenInNewTab:a,disabled:s,onUpdate:c}=AGe(e);return f.jsxs(m.Dialog,{open:t,onOpenChange:n,size:"small",noDescription:!0,children:[f.jsx(m.DialogHeader,{title:"Set Link URL"}),f.jsxs(m.DialogContent,{padding:16,children:[f.jsx(m.FormInput,{value:r,onValueChange:i,placeholder:"Paste URL",icon:"public"}),r&&f.jsx(m.InlineLabel,{value:"Open in new tab",children:f.jsx(m.Checkbox,{checked:o,onCheckedChange:a})})]}),f.jsxs(m.DialogActions,{children:[f.jsx(m.DialogCancelButton,{}),f.jsx(m.DialogActionButton,{onClick:c,disabled:s,children:"Update"})]})]})}function AGe(e){const{editor:t,open:n,setOpen:r}=e,i=mGe(t),[o,a]=E.useState(i.url),[s,c]=E.useState(i.openInNewTab);We.useOnChange(n,()=>{n&&(a(i.url),c(i.openInNewTab))});const u=!o||o===i.url&&s===i.openInNewTab;function l(){const d=s?"_blank":"_self";Ft(p=>p.extendMarkRange(de.RichTextNodeType.hyperlink).setWebLink({href:o,target:d}))(t),r(!1)}return{url:o,setUrl:a,openInNewTab:s,disabled:u,setOpenInNewTab:c,onUpdate:l}}function mGe(e){const t=e.getAttributes(de.RichTextNodeType.hyperlink);return{url:t.href??"",openInNewTab:t.target==="_blank"}}function gGe(e){const{items:t,editor:n}=e;return t.length===0?null:f.jsxs(f.Fragment,{children:[f.jsx(m.ToolbarToggleButtonGroup,{onValueChange:r=>{t.forEach(i=>{(i.isActive(n)&&!r.includes(i.nodeType)||!i.isActive(n)&&r.includes(i.nodeType))&&i.runCommands(n)})},type:"multiple",value:t.filter(r=>r.isActive(n)).map(r=>r.nodeType),children:t.map(r=>f.jsx(m.ToolbarToggleButtonGroupItem,{disabled:!r.runCommands(n,{can:!0}),startIcon:r.icon,value:r.nodeType},r.nodeType))},"mark"),f.jsx(m.ToolbarSeparator,{})]})}function vGe(e){var r;const{items:t,editor:n}=e;return t.length===0?null:f.jsxs(f.Fragment,{children:[f.jsxs(m.DropdownMenu,{children:[f.jsx(m.DropdownMenuTrigger,{disabled:t.length===1,children:f.jsx(m.Button,{endIcon:"arrowDropDown",size:"small",color:"grey",children:((r=t.find(i=>i.isActive(n)))==null?void 0:r.text)??""})}),f.jsx(m.DropdownMenuContent,{align:"start",asPortal:!1,maxHeight:256,avoidCollisions:!1,children:t.map(i=>f.jsx(m.DropdownMenuItem,{onSelect:()=>{i.runCommands(n)},children:i.text},i.nodeType))})]}),f.jsx(m.ToolbarSeparator,{})]})}function Bw(e){return{duration:100,hideOnClick:!0,offset:e,placement:"top-start",appendTo:document.querySelector("body > div")??"parent"}}function yGe(e){const{editor:t,nodeTypes:n,labels:r,hideDisabledOptions:i=!1}=e,[o,a]=E.useState(),s=n.includes(de.RichTextNodeType.hyperlink),c=!o,{shouldShowBubbleMenu:u,shouldshowPopover:l}=SGe({editor:t}),[d,p]=E.useState(!0);E.useEffect(()=>{p(!1)},[]);function h(v){a(v?"webLink":void 0)}function A(v){a(v?"documentLink":void 0)}function g(v){a(v?"mediaLink":void 0)}return d?null:f.jsxs(f.Fragment,{children:[f.jsx(Cw,{editor:t,tippyOptions:Bw([-48,0]),shouldShow:u,children:c&&f.jsx(bGe,{editor:t,nodeTypes:n,labels:r,setModal:a,hideDisabledOptions:i})}),f.jsx(Cw,{editor:t,tippyOptions:Bw([-48,0]),shouldShow:v=>l(v,"hyperlink"),children:c&&f.jsx(oGe,{editor:t,onEditWebLink:()=>a("webLink"),onEditDocumentLink:()=>a("documentLink"),onEditMediaLink:()=>a("mediaLink")})}),f.jsx(Cw,{editor:t,tippyOptions:Bw([0,0]),shouldShow:v=>l(v,"label"),children:f.jsx(eGe,{editor:t})}),s&&f.jsxs(f.Fragment,{children:[f.jsx(hGe,{open:o==="webLink",setOpen:h,editor:t}),f.jsx(lGe,{open:o==="documentLink",setOpen:A,editor:t}),f.jsx(fGe,{open:o==="mediaLink",setOpen:g,editor:t})]})]})}function bGe(e){const{editor:t,nodeTypes:n,labels:r,setModal:i,hideDisabledOptions:o}=e,a=n.includes("hyperlink"),s=r.length>0,c=mv(rte,n),u=mv(HYe,n),l=mv(YYe,n),d=o&&c.length===1?0:c.length,p=d+u.length+l.length+Number(a);return p===0?null:f.jsxs(m.Toolbar,{children:[d>0&&f.jsx(vGe,{items:c,editor:t}),s&&f.jsx(ZYe,{labels:r,editor:t}),f.jsx(gGe,{items:u,editor:t}),a&&f.jsx(tGe,{editor:t,setModal:i}),f.jsx(JYe,{items:l,editor:t}),p>1&&f.jsx(m.ToolbarButton,{onClick:()=>{t.chain().focus().clearNodes().unsetAllMarks().run()},startIcon:"formatClear"},"clear")]})}function SGe(e){const{editor:t}=e;function n(i){const{view:o,state:a,from:s,to:c}=i;if(!o.hasFocus())return!1;const{doc:u,selection:l}=a;return!(t.isActive(de.RichTextNodeType.preformatted)||l.empty||u.textBetween(s,c).length===0)}function r(i,o){const{view:a,state:s,from:c,to:u}=i,l=a.state.doc.nodeAt(c),{doc:d,selection:p}=s;return!p.empty||d.textBetween(c,u).length>0?!1:!!(l!=null&&l.marks.some(A=>A.type.name===o))}return{shouldShowBubbleMenu:n,shouldshowPopover:r}}function ite(e){const{content:t,field:n,id:r,readOnly:i}=e,o=CGe(n),a=t&&c_.converter(o.nodeExtensions).fromPrismic(o.schema,o.nodeTypes,t),s=We.useStableCallback(e.onContentChange),c=m.useEditor({content:a==null?void 0:a.toJSON(),editable:!i,editorProps:{attributes:{class:`${m.contentEditableClass} ${m.contentEditableMultilinePlaceholderClass}`,id:r,tabIndex:"0"}},extensions:o.allComponents,injectCSS:!1,onUpdate({editor:u}){if(u.isEmpty)return s(void 0);const l=c_.converter(o.nodeExtensions).toPrismic(u.state.doc);s(l)}},[o,i]);return f.jsxs(m.Field,{children:[f.jsx(m.FieldLabel,{htmlFor:r,children:pr(n)}),f.jsxs(m.FieldControl,{children:[c.isEditable&&f.jsx(yGe,{editor:c,nodeTypes:o.names,labels:o.labels,hideDisabledOptions:!0}),f.jsx(QVe,{editor:c,style:{flexGrow:1}})]})]})}function CGe(e){var n,r;const t=`${((n=e.config)==null?void 0:n.multi)??""}-${((r=e.config)==null?void 0:r.single)??""}`;return E.useMemo(()=>{var A;const{extensions:i,nodeTypes:o}=hze(e.config),a=i.filter(wGe),s=i.flatMap(g=>g.richTextNodeTypes);o.has(Pj)&&s.push(Pj);const c=i.flatMap(g=>g.component),u=i.filter(xGe).map(g=>g.name),l=[...c,...jQe(e,a),Hze.configure({supportedExtensionNames:u}),oqe,X7e],d=l.map(g=>g.name),p=A7e(l),h=_Ge((A=e.config)==null?void 0:A.labels);return{allComponents:l,extensionNames:d,nodeTypes:o,nodeExtensions:a,names:s,schema:p,labels:h}},[t])}function wGe(e){return e.extType===Ll.Node}function xGe(e){return!(e.extType!==Ll.Node||e.nodeType!==Hc.Text||e.lockedFormat)}function _Ge(e){return Array.from(e??[])}function TGe(e){const{content:t,field:n,id:r,readOnly:i,onContentChange:o}=e,{placeholder:a,options:s}=n.config??{},c=!!(s!=null&&s.includes("")),u=RGe(n),l=IGe({content:t,placeholder:a,defaultValue:u,canHaveEmptyValue:c}),d=a&&u===void 0||a===void 0&&!c;return f.jsxs(m.Field,{children:[f.jsx(m.FieldIcon,{name:"arrowDropDownCircle"}),f.jsx(m.FieldLabel,{htmlFor:r,children:pr(n)}),f.jsx(m.FieldControl,{children:f.jsxs(m.Select,{id:r,size:"large",color:"grey",value:l,disabled:i,renderTrigger:()=>f.jsx(m.SelectGhostTrigger,{id:r}),onValueChange:p=>{o(EGe({value:p,placeholder:a}))},children:[d&&f.jsx(m.SelectItem,{value:a||_y,children:a||""}),s==null?void 0:s.map(p=>f.jsx(m.SelectItem,{value:p||_y,children:p},p))]})})]})}function IGe(e){const{content:t,placeholder:n,defaultValue:r,canHaveEmptyValue:i}=e;let{value:o}=t??{};return o===""&&i?_y:(o===""&&(o=void 0),o??r??n??"")}function EGe(e){const{placeholder:t}=e;let{value:n}=e;if(n!==t)return n===_y&&(n=""),{__TYPE__:"FieldContent",type:"Select",value:n}}function RGe(e){var t,n;return((t=e.config)==null?void 0:t.default_value)===void 0||(n=e.config.options)==null?void 0:n[0]}const _y=" ";function $Ge(e){const{field:t,content:n,onContentChange:r,...i}=e;function o(a){if(!a)return r(void 0);e.onContentChange(FGe(a))}return f.jsx(ite,{...i,field:LGe(t),content:OGe(n),onContentChange:o})}const kGe={__TYPE__:"StructuredTextContent",value:[{type:"paragraph",content:{text:""}}]},TU=Array.from({length:3},()=>({type:"tableRow",content:Array.from({length:2},()=>({type:"tableCell",content:kGe}))}));function OGe(e){return{__TYPE__:"StructuredTextContent",value:[{type:"table",content:MGe(e)}]}}function MGe(e){const t=ue.TableContent.decode(e);return t._tag==="Left"||!t.right.content.some(r=>r.content.some(i=>i.content.value.some(({type:o})=>o)))?TU:t.right.content}function FGe(e){return{__TYPE__:"TableContent",content:e.value.flatMap(t=>t.type==="table"?t.content:[])}}function LGe(e){var t;return{...de.TableCell,config:{...de.TableCell.config,label:(t=e.config)==null?void 0:t.label,allowTargetBlank:!0,multi:[de.TableCell.config.multi,cu.table].join(",")}}}function BGe(e){const{id:t,readOnly:n,field:r,content:i,onContentChange:o}=e,a=i!=null&&i.value?O_.dateFromISOString(i.value):void 0;return f.jsxs(m.Field,{children:[f.jsx(m.FieldIcon,{name:"event"}),f.jsx(m.FieldLabel,{id:t,children:pr(r)}),f.jsx(m.FieldControl,{children:f.jsx(m.Box,{padding:{left:4,right:12},width:"100%",flexDirection:"column",justifyContent:"center",children:f.jsx(m.DateInput,{mode:"date-time","aria-labelledby":t,disabled:n,value:a,onValueChange:s=>o(DGe(s))})})})]})}function DGe(e){if(e)return{__TYPE__:"FieldContent",type:"Timestamp",value:jGe(e)}}function jGe(e){const t=`${e.getUTCFullYear()}`.padStart(4,"0"),n=`${e.getUTCMonth()+1}`.padStart(2,"0"),r=`${e.getUTCDate()}`.padStart(2,"0"),i=`${e.getUTCHours()}`.padStart(2,"0"),o=`${e.getUTCMinutes()}`.padStart(2,"0");return`${t}-${n}-${r}T${i}:${o}:00+00:00`}function KS(e){const{id:t,readOnly:n,content:r,nestableWidget:i}=e,o=We.useStableCallback(e.onContentChange);return E.useMemo(()=>{const a={id:t,readOnly:n,onContentChange:o};return i.type==="Boolean"?f.jsx(MWe,{...a,field:i,content:ue.isBooleanContent(r)?r:void 0}):i.type==="Date"?f.jsx(DWe,{...a,field:i,content:ue.isDateContent(r)?r:void 0}):i.type==="Timestamp"?f.jsx(BGe,{...a,field:i,content:ue.isTimestampContent(r)?r:void 0}):i.type==="Image"?f.jsx(v4e,{...a,field:i,content:ue.isImageContent(r)?r:void 0}):i.type==="Link"?f.jsx(M4e,{...a,field:i,content:r}):i.type==="Number"?f.jsx(F4e,{...a,field:i,content:ue.isNumberContent(r)?r:void 0}):i.type==="StructuredText"?f.jsx(ite,{...a,field:i,content:ue.isRichTextContent(r)?r:void 0}):i.type==="Select"?f.jsx(TGe,{...a,field:i,content:ue.isSelectContent(r)?r:void 0}):i.type==="Text"?f.jsx(wJ,{...a,field:i,content:ue.isTextContent(r)?r:void 0}):i.type==="Embed"?f.jsx(HWe,{...a,field:i,content:ue.isEmbedContent(r)?r:void 0}):i.type==="Color"?f.jsx(LWe,{...a,field:i,content:ue.isColorContent(r)?r:void 0}):i.type==="GeoPoint"?f.jsx(YWe,{...a,field:i,content:ue.isGeoPointContent(r)?r:void 0}):i.type==="IntegrationFields"?f.jsx(k4e,{...a,field:i,content:ue.isIntegrationFieldContent(r)?r:void 0}):i.type==="Table"?f.jsx($Ge,{...a,field:i,content:ue.isTableContent(r)?r:void 0}):null},[r,t,i,o,n])}function UGe(e){const{content:t,id:n,nonRepeatableZone:r,onContentChange:i,readOnly:o}=e,a=E.useMemo(()=>Object.entries(r),[r]);return f.jsx(f.Fragment,{children:a.map(([s,c])=>{const u=t[s];return f.jsx(KS,{id:`${n}.${s}`,readOnly:o,nestableWidget:c,content:ue.isNestableContent(u)?u:void 0,onContentChange:l=>{i(PGe(t,s,l))}},s)})})}function PGe(e,t,n){return n?{...e,[t]:n}:Yd.removeKey(e,t)}function KL(e){var o,a;const{group:t,content:n,onContentChange:r,...i}=e;return f.jsx(RWe,{children:f.jsx(qL,{...i,title:$_(t),addItemButtonTitle:`Add item in "${$_(t)}"`,repeatable:((o=t.config)==null?void 0:o.repeat)!==!1,repeatableZone:((a=t.config)==null?void 0:a.fields)??{},content:n==null?void 0:n.value,onContentChange:s=>{r({__TYPE__:"GroupContentType",value:s})}})})}function $_(e){var t;return((t=e.config)==null?void 0:t.label)??e.fieldset??e.type}function ote(e){const{id:t,readOnly:n,content:r,widget:i}=e,o=We.useStableCallback(e.onContentChange);return E.useMemo(()=>{const a={id:t,readOnly:n,onContentChange:o};return i.type==="Group"?f.jsx(KL,{...a,group:i,content:ue.isGroupContent(r)?r:void 0}):f.jsx(KS,{...a,nestableWidget:i,content:ue.isNestableContent(r)?r:void 0})},[r,t,i,o,n])}function qL(e){const{id:t,title:n,addItemButtonTitle:r,content:i,onContentChange:o,readOnly:a,repeatable:s=!0,repeatableZone:c}=e,u=Object.entries(c);let l=i??[KGe];!s&&l.length>1&&(l=l.slice(0,1));const{scrollOffsetTop:d}=ye(),p=E.useRef(new WeakMap);NGe(p.current,l);function h(w){return p.current.get(w)??"!bugged!"}function A(w){const S=k_();o(yt.insertAtIndex(l,w,S))}function g(w){const{index:S,offset:y}=w;o(yt.move(l,S,S+y))}function v(w){o(yt.removeIndex(l,w))}function b(w,S,y,C){const x=VGe(w,[y,C]),T=qGe(l,[S,x]);WGe(p.current,w,x),o(T)}return Object.keys(c).length===0?null:f.jsx(m.Group,{title:n??"Repeatable zone",addItemButtonTitle:r??"Add item in repeatable zone",items:l,maxItems:s?void 0:1,getItemKey:h,onAddItem:A,dnd:{scrollOffsetTop:d,onReorder:o,renderDragPreview:({index:w})=>f.jsx(zGe,{title:n??"Repeatable zone",index:w}),renderDropIndicator:QGe},children:(w,S)=>{const y=new Map(w.value),C=h(w);return f.jsx(m.LazyRender,{keepLoaded:!0,loadWhenSearching:!0,children:f.jsx(m.GroupItem,{index:S,title:`${S+1} • Item`,onMove:g,onDelete:v,children:u.map(([x,T])=>f.jsx(ote,{id:`${t}[${C}].${x}`,content:y.get(x),widget:T,onContentChange:I=>b(w,S,x,I),readOnly:a},x))})})}})}function NGe(e,t){t.forEach(n=>{e.has(n)||e.set(n,pte.uniqueNumber())})}function WGe(e,t,n){const r=e.get(t);r!==void 0&&e.set(n,r)}const KGe={__TYPE__:"GroupItemContent",value:[]};function qGe(e,t){const[n,r]=t;return r?e.map((i,o)=>o===n?r:i):e.filter((i,o)=>o!==n)}function VGe(e,t){const[n,r]=t;if(!r){const o=e.value.filter(([a])=>a!==n);return k_(o)}const i=Array.from(new Map(e.value).set(n,r));return k_(i)}function k_(e=[]){return{__TYPE__:"GroupItemContent",value:e}}function zGe(e){const{title:t,index:n}=e;return f.jsxs(m.Box,{padding:{block:8,inline:12},backgroundColor:"grey3",border:!0,borderRadius:6,alignItems:"center",justifyContent:"space-between",width:"100%",children:[f.jsxs("div",{children:[f.jsx(m.Text,{variant:"smallBold",color:"grey11",children:t??"Repeatable zone"}),f.jsxs(m.Text,{variant:"small",color:"grey11",children:[n+1," • Item"]})]}),f.jsx(m.Icon,{name:"dragIndicator",size:"small",color:"grey8"})]})}function QGe(e){const{isDropTarget:t,itemIndex:n,position:r}=e,i=t?f.jsx(m.Line,{color:"purple",thickness:2,sx:{position:"absolute",left:0,right:0,bottom:n===0&&r==="before"?0:void 0}},"line"):void 0;return f.jsx(m.AnimatedElement,{enterDuration:150,children:i})}function HGe(e){const{compositeSlice:t,content:n,onContentChange:r,sliceKey:i,id:o,readOnly:a,header:s}=e,c=yS();function u(){i&&c.update({id:i,requestedFrom:"sliceFieldSet"})}return f.jsxs(m.FieldSet,{id:i&&vS("sliceFieldSet",i),selected:i?c.isSelected(i):!1,onFocus:u,legend:YGe(t),header:s,children:[f.jsx(UGe,{id:o,readOnly:a,nonRepeatableZone:t["non-repeat"]??{},content:n.nonRepeat,onContentChange:l=>{r({...n,nonRepeat:l})}}),f.jsx(qL,{id:o,readOnly:a,repeatableZone:t.repeat??{},content:n.repeat,onContentChange:l=>{r({...n,repeat:l})}})]})}function YGe(e){var t;return((t=e.config)==null?void 0:t.label)??e.fieldset??e.type}const ate={__TYPE__:"ImageContent",edit:{background:"",crop:{x:0,y:0},zoom:0},height:0,width:0,origin:{height:0,width:0,id:"",url:""},url:""};function GGe(e){const{field:t}=e;if(t.type==="Image")return ate}function JGe(e){const{content:t,legacySlice:n,sliceKey:r,id:i,readOnly:o,onContentChange:a,header:s}=e,c=yS();function u(){r&&c.update({id:r,requestedFrom:"sliceFieldSet"})}const l=n.type==="Group"?$_(n):pr(n);return f.jsx(m.FieldSet,{id:r&&vS("sliceFieldSet",r),selected:r?c.isSelected(r):!1,onFocus:u,legend:l,header:s,children:n.type==="Group"?f.jsx(KL,{id:i,readOnly:o,onContentChange:a,group:n,content:ue.isGroupContent(t)?t:void 0}):f.jsx(KS,{id:i,readOnly:o,nestableWidget:n,content:ue.isNestableContent(t)?t:void 0,onContentChange:d=>{const p=GGe({field:n});!d&&p&&a(p),d&&a(d)}})})}function ZGe(e){const{content:t,id:n,slicePrimaryZone:r,onContentChange:i,readOnly:o}=e,a=E.useMemo(()=>Object.entries(r),[r]);return f.jsx(f.Fragment,{children:a.map(([s,c])=>{const u=t[s];return f.jsx(ote,{id:`${n}.${s}`,readOnly:o,widget:c,content:ue.isSlicePrimaryContent(u)?u:void 0,onContentChange:l=>{i(XGe(t,s,l))}},s)})})}function XGe(e,t,n){return n?{...e,[t]:n}:Yd.removeKey(e,t)}function ste(e){const{config:t,content:n,sliceKey:r,readOnly:i=!1,sharedSlice:o,onContentChange:a,...s}=e,c=eJe(o,n.variation),u=E.useId(),d={id:s.id??u,readOnly:i},p=yS();function h(){r&&p.update({id:r,requestedFrom:"sliceFieldSet"})}return c===void 0?null:f.jsx(sS.Provider,{value:t,children:f.jsx(EWe,{children:f.jsxs(m.FieldSet,{id:r&&vS("sliceFieldSet",r),selected:r?p.isSelected(r):!1,onFocus:h,legend:tJe(o,c),children:[f.jsx(m.LazyRender,{heightEstimate:400,gap:16,keepLoaded:!0,loadWhenSearching:!0,children:f.jsx(ZGe,{...d,slicePrimaryZone:c.primary??{},content:n.primary,onContentChange:A=>{a({...n,primary:A})}})}),f.jsx(qL,{...d,repeatableZone:c.items??{},content:n.items,onContentChange:A=>{a({...n,items:A})}})]})})})}function eJe(e,t){return E.useMemo(()=>e.variations.find(n=>n.id===t),[e,t])}function tJe(e,t){return[e.name,t.name].join(" • ")}function IU(e){var c,u;const{sliceZone:t,onChange:n,slices:r,sliceContent:i}=e,o=(u=(c=t.config)==null?void 0:c.labels)==null?void 0:u[i.name];if(!o)return null;const a=o.find(l=>l.name===i.maybeLabel);function s(l){const d=r.value.map(p=>p.key===i.key?{...p,maybeLabel:l}:p);n({...r,value:d})}return f.jsxs(f.Fragment,{children:[f.jsx(m.Text,{component:"span",variant:"smallBold",children:"•"}),f.jsxs(m.DropdownMenu,{children:[f.jsx(m.DropdownMenuTrigger,{children:f.jsx(m.Button,{color:"grey",size:"small",endIcon:"arrowDropDown",invisible:!0,children:(a==null?void 0:a.display)??"Slice variation"})}),f.jsxs(m.DropdownMenuContent,{align:"start",maxHeight:256,children:[f.jsx(m.DropdownMenuItem,{onSelect:()=>s(void 0),endIcon:i.maybeLabel===void 0?f.jsx(m.Icon,{name:"check"}):void 0,children:"..."}),o==null?void 0:o.map(l=>f.jsx(m.DropdownMenuItem,{onSelect:()=>s(l.name),endIcon:l.name===i.maybeLabel?f.jsx(m.Icon,{name:"check"}):void 0,children:l.display??"[Missing display value]"},l.name))]})]})]})}function nJe(e){const{content:t,id:n,onContentChange:r,readOnly:i,sliceZone:o}=e,a=ye();return f.jsx(f.Fragment,{children:t==null?void 0:t.value.map((s,c)=>{var p,h;const u=(h=(p=o.config)==null?void 0:p.choices)==null?void 0:h[s.name];if(u===void 0)return null;const l=s.widget,d={id:`${n}[${s.key}]`,key:s.key,sliceKey:s.key,onContentChange:A=>{const g={...s,widget:A},v=rJe(t,[c,g]);r(v)},readOnly:i};return u.type==="SharedSlice"?ue.isSharedSliceContent(l)?f.jsx(ste,{...d,config:a,sharedSlice:u,content:l}):null:u.type==="Slice"?ue.isCompositeSliceContent(l)?f.jsx(HGe,{...d,compositeSlice:u,content:l,header:f.jsx(IU,{sliceContent:s,sliceZone:o,slices:t,onChange:r})}):null:ue.isSimpleSliceContent(l)?f.jsx(JGe,{...d,legacySlice:u,content:l,header:f.jsx(IU,{sliceContent:s,sliceZone:o,slices:t,onChange:r})}):null})})}function rJe(e,[t,n]){return{__TYPE__:"SliceContentType",value:e.value.map((r,i)=>i===t?n:r)}}function iJe(e){const{content:t,metadataFieldType:n,documentId:r,documentContent:i,documentCustomType:o,documentLocale:a,...s}=e,{showAlert:c}=m.useAlert(),[u,l]=E.useState(!1),d=ye(),p=E.useMemo(()=>jY(i,o),[i,o]),h=UY(p);async function A(){if(!d.aiSeoMetadataEnabled)return;const{awsBedrockRegion:g,awsBedrockAccessKeyId:v,awsBedrockSecretAccessKey:b,trackMetadataGeneration:w}=d;l(!0);try{const S=await DY({pageTextContent:p,contentLocale:a,config:{region:g,accessKeyId:v,secretAccessKey:b}});e.onContentChange({__TYPE__:"FieldContent",type:"Text",value:S[n]}),w({documentId:r,locale:a,suggestion:S[n],type:n})}catch{c({id:n,title:"Error",subtitle:`Failed to generate SEO metadata for ${EU[n]}`})}l(!1)}return f.jsx(wJ,{...s,content:t,placeholder:`${EU[n]}..`,endAdornment:f.jsxs(f.Fragment,{children:[f.jsx(qG,{type:n,value:(t==null?void 0:t.value)||""}),f.jsx(m.Tooltip,{content:h?"Generate SEO metadata from your page content.":"Your page content is too short to generate SEO metadata.",children:f.jsx(m.Button,{disabled:!h,onClick:A,size:"small",color:"grey",startIcon:"autoFixHigh",loading:u,sx:{alignSelf:"center",marginInline:8},children:"Generate"})})]})})}const EU={[mo]:"Meta title",[oa]:"Meta description"};function oJe(e){const{id:t,field:n,content:r,onContentChange:i}=e,o=We.useDebounceState({state:(r==null?void 0:r.value)??"",synchronize:!0}),{onEditUID:a}=E.useContext(zG);function s(u){a();const l=bi.slugify(u);i(cJe(l)),o.set(l)}function c(u){s(u.clipboardData.getData("Text").trim()),u.preventDefault()}return f.jsxs(m.Field,{children:[f.jsx(m.FieldIcon,{name:"tag"}),f.jsx(m.FieldLabel,{htmlFor:t,children:pr(n)}),f.jsx(m.FieldControl,{children:f.jsx(Ic,{id:t,variant:"success",placeholder:Ol(n,"Enter a unique identifier"),value:o.value,onPaste:c,onValueChange:s,endAdornment:f.jsx(m.AnimatedElement,{enterDuration:150,children:f.jsx(aJe,{uid:o.debouncedValue})})})})]})}function aJe(e){const{uid:t}=e,n=ye();return t?n.uidField?f.jsx(m.ErrorBoundary,{children:f.jsx(E.Suspense,{children:f.jsx(sJe,{uid:t})})}):null:f.jsx(m.Badge,{color:"tomato",title:"Required",size:"medium"})}function sJe(e){const t=uJe(e),n=ye();if(!t.documentId)return null;const r=AF({status:t.status,releaseId:t.releaseId,documentId:t.documentId,versionId:t.versionId,baseUrl:n.baseUrl});return f.jsx("a",{href:r.href,target:"_blank",rel:"noreferrer",children:f.jsx(m.Badge,{color:"tomato",size:"medium",title:f.jsxs(m.Text,{color:"tomato11",variant:"small",children:["Value already used in"," ",f.jsx(m.Text,{color:"tomato11",variant:"small",underline:!0,children:"another document"})]})})})}function cJe(e){return e===""?void 0:{__TYPE__:"UIDContent",value:e}}function uJe(e){var p,h,A,g;const{uid:t}=e,n=ye();n.uidField||bt("uidField");const{coreApiBaseUrl:r,authStrategy:i,customTypeId:o,localeId:a,documentId:s}=n,{data:c}=NF({baseUrl:r,authStrategy:i,uids:[t]}),u=c.results,d=HG({customTypeId:o,languageId:a,documentsWithUid:u,documentId:s,uid:t})[0];return d?{documentId:d.id,versionId:(p=d.versions[0])==null?void 0:p.version_id,status:(h=d.versions[0])==null?void 0:h.status,releaseId:((A=d.versions[0])==null?void 0:A.status)==="release"?(g=d.versions[0])==null?void 0:g.release_id:void 0}:{}}function lJe(e){const{id:t,readOnly:n,staticZone:r,content:i,onContentChange:o,documentId:a,documentContent:s,documentCustomType:c,documentLocale:u}=e,l=ye(),d=E.useMemo(()=>Object.entries(r),[r]),p=E.useRef(i);if(E.useEffect(()=>{p.current=i},[i]),d.length===0)return null;const h=fJe(d),A=Qv(i[mo])||"Meta title..",g=Qv(i[oa])||"Meta description..";return f.jsxs(m.FieldSet,{legend:"Page data",children:[h&&f.jsx(VG,{title:A,description:g}),d.map(([v,b])=>{const w={id:`${t}.${v}`,onContentChange:y=>{const{[v]:C,...x}=p.current;o({...x,...y!==void 0&&{[v]:y}})},readOnly:n},S=i[v];return b.type==="UID"?E.createElement(oJe,{...w,content:ue.isUIDContent(S)?S:void 0,key:v,field:b}):b.type==="Group"?E.createElement(KL,{...w,content:ue.isGroupContent(S)?S:void 0,group:b,key:v}):l.aiSeoMetadataEnabled&&dJe(v)&&b.type==="Text"?E.createElement(iJe,{...w,content:ue.isTextContent(S)?S:void 0,field:b,key:v,metadataFieldType:v,documentId:a,documentContent:s,documentCustomType:c,documentLocale:u}):E.createElement(KS,{...w,content:ue.isNestableContent(S)?S:void 0,key:v,nestableWidget:b})})]})}function dJe(e){return e===mo||e===oa}const fJe=e=>{var t,n;return((t=e[0])==null?void 0:t[0])===mo&&((n=e[1])==null?void 0:n[0])===oa};function pJe(e){const{id:t,readOnly:n,section:r,content:i,onContentChange:o,documentId:a,documentContent:s,documentCustomType:c,documentLocale:u}=e,[l,d]=AJe(r),[p,h]=mJe(i);return f.jsxs("div",{style:{display:"flex",flexDirection:"column",position:"relative",zIndex:0},children:[f.jsx(lJe,{id:t,readOnly:n,staticZone:l,documentId:a,content:p,onContentChange:A=>o({...h,...A}),documentContent:s,documentCustomType:c,documentLocale:u}),d.map(([A,g])=>{const v=h[A];return f.jsx(nJe,{id:`${t}.${A}`,readOnly:n,sliceZone:g,content:v,onContentChange:b=>o({...p,...h,[A]:b})},A)})]})}function hJe(e){return e.type==="Choice"||e.type==="Slices"}function AJe(e){return Object.entries(e).reduce(([t,n],[r,i])=>(hJe(i)?n.push([r,i]):Object.assign(t,{[r]:i}),[t,n]),[{},[]])}function mJe(e){return Object.entries(e).reduce(([t,n],[r,i])=>{const o={[r]:i};return Object.assign(ue.isSlicesContent(i)?n:t,o),[t,n]},[{},{}])}function gJe(e){const{config:t,readOnly:n=!1,customType:r,sectionName:i,documentId:o,content:a,locale:s,onContentChange:c}=e,u=E.useId();if(Yd.isEmpty(r.json))return null;const l=vJe(r,i),[d,p]=yJe(l,a);return f.jsx(sS.Provider,{value:t,children:f.jsx(IWe,{customTypeFormat:r.format,children:f.jsx(pJe,{id:u,readOnly:n,section:l,documentId:o,content:d,onContentChange:h=>c({...p,...h}),documentContent:a,documentCustomType:r,documentLocale:s})})})}function vJe(e,t){const n=e.json[t];if(n===void 0)throw new Error(`Cannot find a section with name '${t}'.`);return n}function yJe(e,t){return Object.entries(t).reduce(([n,r],[i,o])=>{const a=e[i]!==void 0,s={[i]:o};return[{...n,...a?s:{}},{...r,...a?{}:s}]},[{},{}])}exports.BasicRole=cG;exports.DeferredCodeBlock=Dw;exports.DocumentEditor=gJe;exports.EditorConfigContext=sS;exports.EditorErrorBoundary=vLe;exports.LocaleId=sG;exports.MediaLibrary=KG;exports.MetadataBadge=qG;exports.MetadataPreview=VG;exports.OnboardingGuide=vWe;exports.OnboardingStepId=y3e;exports.RolesPerLocale=AS;exports.RolesPerLocaleByUser=WF;exports.SelectionManagerProvider=TH;exports.SharedSliceEditor=ste;exports.SliceSelectionContext=YG;exports.TeamSpace=mS;exports.UIDContext=zG;exports.createSearchParams=YY;exports.createTeamSpace=T3e;exports.defaultGroupContentWithOneItem=wH;exports.defaultImageContentWidget=ate;exports.deleteTeamSpace=E3e;exports.documentKeys=To;exports.documentMetaSchema=UF;exports.documentSchema=c3e;exports.documentStatus=xH;exports.extractTextFromField=Qv;exports.fetchCustomTypes=JNe;exports.frameworkCreateProjectCodeSnippet=kU;exports.frameworkLabels=$U;exports.generateSEOMetadata=DY;exports.getConflictingUidDocuments=HG;exports.getCustomTypesOptions=eg;exports.getDocumentById=tg;exports.getDocumentList=PF;exports.getDocumentListOptions=GY;exports.getOnboarding=b3e;exports.getPageTextContent=jY;exports.getProfile=fG;exports.getRepository=hS;exports.getRepositoryTags=nG;exports.getRepositoryV2=v3e;exports.getSliceSelectionDOMId=vS;exports.getTeamSpaces=uG;exports.getTeamSpacesOptions=x3e;exports.hasUIDField=QG;exports.invalidateCustomTypes=XNe;exports.invalidateDocumentListData=d3e;exports.isDocumentSearchVersion=Ix;exports.isDocumentVersion=VY;exports.isMissingUID=xWe;exports.isPageContentRelevantForAISeo=UY;exports.isValidSimulatorURL=tG;exports.languageSchema=jF;exports.makeSearchFullTextDocumentsQueryString=HY;exports.metaDescriptionConfig=Bd;exports.metaDescriptionProperty=oa;exports.metaTitleConfig=Ld;exports.metaTitleProperty=mo;exports.onboardingStateSchema=iG;exports.onboardingToggleResultSchema=aG;exports.onboardingToggleStepResultSchema=oG;exports.prefetchCustomTypes=GNe;exports.prefetchStaticCustomType=r3e;exports.prepareDocumentForSave=hLe;exports.profileResponse=dG;exports.repositoryFramework=pS;exports.repositorySchemaV2=rG;exports.roleMap=k3e;exports.searchDocumentStatus=ox;exports.searchDocuments=JY;exports.searchDocumentsQueryOptions=ZY;exports.searchFullTextDocuments=QY;exports.sliceItemContentSchema=u3e;exports.suppressErrors=SLe;exports.throwConfigError=bt;exports.toggleOnboarding=C3e;exports.toggleOnboardingStep=S3e;exports.updateDocumentListData=l3e;exports.updateTeamSpace=I3e;exports.useCustomType=ZNe;exports.useCustomTypes=DF;exports.useDocumentList=NF;exports.useInvalidateTeamSpaces=_3e;exports.useProfile=KF;exports.useSelectionManager=_c;exports.useSliceSelection=yS;exports.useStaticCustomType=n3e;
|