@bluepic/embed 0.4.0-next.163 → 0.4.0-next.164
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/bluepic-embed.iife.js +2 -2
- package/dist/bluepic-embed.umd.js +2 -2
- package/dist/components/BxCard.vue.d.ts +14 -0
- package/dist/components/BxList.vue.d.ts +9 -0
- package/dist/components/BxListItem.vue.d.ts +13 -1
- package/dist/embed/embed.d.ts +2 -2
- package/dist/main.cjs +2 -2
- package/dist/main.mjs +23 -7
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -102,7 +102,7 @@ list should be an Array.`),L.length===0)return new C(0);if(L.length===1)return L
|
|
|
102
102
|
</defs>
|
|
103
103
|
<rect x="0" y="0" width="100%" height="100%" style="fill: #fff;" mask="url('#popoverArrowMask')" />
|
|
104
104
|
</svg>
|
|
105
|
-
`);`${window.btoa(B.value)}`;const N=c.computed(()=>`url('data:image/svg+xml;base64,${window.btoa(S.value)}')`),D=c.computed(()=>`url('data:image/svg+xml;base64,${window.btoa(B.value)}')`);return(Q,z)=>{var A,P,W,O;return c.openBlock(),c.createElementBlock("div",{ref_key:"popoverWrapperRef",ref:i,class:c.normalizeClass(["popover-wrapper",{...Object.fromEntries(e.customClasses.map(R=>[R,!0])),"no-pointer-events":e.noPointerEvents}]),onClick:E,"data-bx-popover-id":e.bxPopoverId},[c.createElementVNode("div",{ref_key:"popoverElementRef",ref:o,class:"popover-element",style:c.normalizeStyle({...c.unref(f),...e.styles,"--rel-origin-x":(A=C.value)==null?void 0:A.x,"--rel-origin-y":(P=C.value)==null?void 0:P.y,"--arrow-mask-image":N.value}),onClick:x,onMouseenter:v,onMouseleave:I},[c.createElementVNode("div",{ref_key:"popoverFrameWrapperRef",ref:l,class:c.normalizeClass(["popover-frame-wrapper",{arrow:e.arrow,"overflow-visible":e.overflowVisible,[`placement-${c.unref(g)}`]:!0}]),"data-origin":y.value,"data-placement":c.unref(g),style:c.normalizeStyle({"transform-origin":`${(((W=C.value)==null?void 0:W.x)??0)*100}% ${(((O=C.value)==null?void 0:O.y)??0)*100}%`,"max-height":`calc(100vh - ${c.unref(h)}px - 20px)`})},[c.createElementVNode("div",{class:c.normalizeClass(["arrow-element",{["placement-"+c.unref(g)]:!0}])},[c.createElementVNode("div",{class:"arrow-symbol",style:c.normalizeStyle({"mask-image":N.value})},null,4),c.createElementVNode("div",{class:"arrow-border",style:c.normalizeStyle({"mask-image":D.value})},null,4)],2),c.createElementVNode("div",{class:"popover-frame",style:c.normalizeStyle({"max-height":`min(${e.popoverMaxHeight??"100vh"}, calc(100vh - ${c.unref(h)}px - 20px))`})},[c.createElementVNode("div",qJ,[c.renderSlot(Q.$slots,"default",{},void 0,!0)])],4)],14,KJ)],36)],10,JJ)}}}),[["__scopeId","data-v-148f949a"]]),h8=300,Yv=300;window.addEventListener("load",()=>{var t;const e=document.querySelector(hc);e&&(e.classList.add("bluepic-popup-app-wrapper"),(t=e.parentElement)==null||t.classList.add("bluepic-popup-body"))});function A1(e){const t=window.bluepicPopupProvider,r=e.capturedContext||fu(),n=qr();function a(){t.messageProviderRef.pull(n)}const i=e.keepOnHover??!0,o=e.closeAfter??5e3;let l=null,s=o,u=0;function f(){s<=0||o<=0||(u=Date.now(),l=setTimeout(a,s))}function g(){l!==null&&(clearTimeout(l),l=null,s-=Date.now()-u,s<0&&(s=0))}function d(){f()}return t.messageProviderRef.push(n,()=>c.h(nJ,{type:e.type,title:typeof e.title=="string"?e.title:void 0,message:typeof e.message=="string"?e.message:void 0,closeable:e.closeable??!0,customClasses:e.customClasses??[],maxWidth:e.maxWidth,capturedContext:r,onClose:a,showIcon:e.showIcon,...i?{onMouseenter:g,onMouseleave:d}:{}},{title:typeof e.title=="function"?e.title:void 0,message:typeof e.message=="function"?e.message:void 0,icon:e.icon}),{placement:e.placement??"top-right"}),f(),{close:a}}function m1(e){const t=window.bluepicPopupProvider,r=e.capturedContext||fu(),n=qr();let a=!1;const i=()=>{var s;a||(a=!0,(s=e.onClose)==null||s.call(e))},o=c.computed({get(){return t.overlayProviderRef.isVisible(n)},set(s){s?t.overlayProviderRef.pushPopup(n,()=>c.h(VB,{type:e.type??"frame",title:typeof e.title=="string"?e.title:void 0,fullscreen:!1,closeable:e.closeable??!0,transculent:e.transculent??!1,customClasses:e.customClasses??[],fullLayer:e.fullLayer??!1,draggable:e.draggable??!0,drawerPlacement:e.drawerPlacement,drawerWidth:e.drawerWidth,drawerHeight:e.drawerHeight,capturedContext:r},{default:()=>c.h("div",{},[typeof e.content=="string"?e.content:e.content(),...e.actions?typeof e.actions=="function"?(()=>{const u=e.actions();return Array.isArray(u)?u:[u]})():[c.h("div",{},e.actions.map(u=>c.h(Lt,{...u.props},{icon:u.icon,default:()=>u.label})))]:[]]),title:typeof e.title=="function"?e.title:void 0,"header-actions":e.headerActions?e.headerActions():void 0,icon:e.icon,"close-btn":e.closeBtn}),{type:e.type??"frame",close(){o.value=!1},disableBackgroundEffect:e.disableBackgroundEffect??!1,wrapperCustomClasses:e.wrapperCustomClasses??[],handleClickOutside(){o.value=!1},drawerPlacement:e.drawerPlacement,transitionDuration:e.transitionDuration??h8,role:"popup",trapFocus:e.trapFocus??!0}):(t.overlayProviderRef.pull(n),i())}});function l(){o.value=!1}return o.value=!0,{close:l}}const rK={success:Nv,error:_v,warning:Lv,info:c1};function nK(e){const t=e.capturedContext||fu(),r=e.closeOnAction??!0,n=c.ref({positive:!1,negative:!1}),{close:a}=m1({type:"frame",closeable:e.closeable??!0,draggable:e.draggable??!0,disableBackgroundEffect:e.disableBackgroundEffect??!0,customClasses:["bx-dialog",...e.customClasses??[]],wrapperCustomClasses:e.wrapperCustomClasses,capturedContext:t,title:e.title,icon:e.icon??(e.type?()=>c.h(rK[e.type]):void 0),content:()=>{const i=[];return e.content&&i.push(c.h("div",{class:"bx-dialog-content popup-no-drag"},[typeof e.content=="function"?e.content():e.content])),(e.action||e.positiveText||e.negativeText)&&i.push(c.h("div",{class:"bx-dialog-actions popup-no-drag",style:"display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px;"},[e.action?e.action():[e.negativeText?c.h(Lt,{secondary:!1,...e.negativeButtonProps??{},loading:n.value.negative,onClick:async()=>{if(e.onNegativeClick){n.value.negative=!0;try{if(await e.onNegativeClick()===!1)return}finally{n.value.negative=!1}}r&&a()}},{default:()=>e.negativeText}):null,e.positiveText?c.h(Lt,{active:!0,...e.positiveButtonProps??{},loading:n.value.positive,onClick:async()=>{if(e.onPositiveClick){n.value.positive=!0;try{if(await e.onPositiveClick()===!1)return}finally{n.value.positive=!1}}r&&a()}},{default:()=>e.positiveText}):null]])),i}});return{close:a}}function aK(e){return m1({type:"drawer",title:e.title,closeable:e.closeable??!0,content:e.content,drawerPlacement:e.placement??"right",drawerWidth:e.width,drawerHeight:e.height,disableBackgroundEffect:e.disableBackgroundEffect,customClasses:e.customClasses,wrapperCustomClasses:e.wrapperCustomClasses,capturedContext:e.capturedContext})}function iK(e,t,r,n){return{getBoundingClientRect(){return{x:e,y:t,width:r,height:n,top:t,left:e,right:e+r,bottom:t+n,toJSON(){return this}}}}}function oK(e){const t=window.bluepicPopupProvider,r=e.capturedContext||fu(),n=qr(),a=e.floatingElement??(e.x!==void 0&&e.y!==void 0?iK(e.x,e.y,e.width??0,e.height??0):void 0),i=c.computed({get(){return t.overlayProviderRef.isVisible(n)},set(l){l?t.overlayProviderRef.pushPopover(n,()=>c.h(g8,{floatingElement:a,styles:{...e.customStyles},floatingPadding:e.floatingPadding??0,customClasses:e.customClasses??[],onClose(){i.value=!1},arrow:e.arrow??!0,allowedPlacements:e.allowedPlacements??["top","right","bottom","left","top-start","top-end","right-start","right-end","bottom-start","bottom-end","left-start","left-end"],bxPopoverId:n,noPointerEvents:e.noPointerEvents??!1,scrollPassthrough:e.scrollPassthrough??!(e.darkenBackground??!0),overflowVisible:e.overflowVisible??!1,capturedContext:r},{default:()=>e.content()}),{darkenBackground:e.darkenBackground??!0,handleClickOutside(){e.closeOnClickOutside&&(i.value=!1)},transitionDuration:e.transitionDuration??Yv,role:"popover",close(){i.value=!1}}):t.overlayProviderRef.pull(n)}});function o(){i.value=!1}return i.value=!0,{close:o}}function w2(){const e=fu();return{createPopup:(t,r)=>(console.log("createPopup",t,e),m1({...t,capturedContext:{...e,...r}})),createDialog:t=>nK({...t,capturedContext:e}),createMessage:t=>A1({...t,capturedContext:e}),createPopover:t=>oK({...t,capturedContext:e}),createDrawer:t=>aK({...t,capturedContext:e})}}function A8(e){const t=window.bluepicPopupProvider,r=qr();return t.overlayProviderRef.pushPopover(r,()=>c.h("div",{},e()),{darkenBackground:!1,handleClickOutside(){},transitionDuration:Yv,role:"popover",trapFocus:!0,close(){t.overlayProviderRef.pull(r)}}),{destroy:()=>{t.overlayProviderRef.pull(r)}}}const sK={key:0,class:"bx-progress__circle"},lK={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 100 100"},cK=["d"],uK={class:"bx-progress__bar-inner"},p1=ht(c.defineComponent({__name:"BxProgress",props:{value:{},circle:{type:Boolean,default:!1},transition:{type:Boolean,default:!0}},setup(e){const t=e;function r(a,i,o=0,l=0){a=Math.max(0,Math.min(100,a));const s=a/100*360,u=(s-90)*(Math.PI/180),f=o+i*Math.cos(u),g=l+i*Math.sin(u),d=s>180?1:0;return[`M ${o} ${l-i}`,`A ${i} ${i} 0 ${d} 1 ${f} ${g}`].join(" ")}const n=c.computed(()=>t.value!==void 0?r(t.value*100,45,50,50):"");return(a,i)=>(c.openBlock(),c.createElementBlock("div",{class:c.normalizeClass(["bx-progress",{circle:e.circle}])},[e.circle?(c.openBlock(),c.createElementBlock("div",sK,[(c.openBlock(),c.createElementBlock("svg",lK,[c.createElementVNode("path",{d:n.value,class:"circle-progress-path"},null,8,cK)]))])):(c.openBlock(),c.createElementBlock("div",{key:1,class:c.normalizeClass(["bx-progress__bar",{circle:e.circle}]),style:c.normalizeStyle({"--progress":e.value})},[c.createElementVNode("div",uK,[c.createElementVNode("div",{class:c.normalizeClass(["bx-progress__bar-fill",{transition:e.transition}])},null,2)])],6))],2))}}),[["__scopeId","data-v-223c9a98"]]);function x2(e){let t=[];const r=c.ref([]),n=c.computed(()=>{const i=e();return Array.isArray(i)?i:[i]}),a=i=>o=>{const l=(()=>{if(o instanceof HTMLElement)return o;if(o instanceof Node)return o.nextSibling;if((o==null?void 0:o.$el)instanceof HTMLElement)return o.$el})();l&&(t[i]=l)};return c.watch(n,()=>{t=[],c.nextTick(()=>{r.value=t})},{immediate:!0}),{setSlotRef:a,slotElements:r,vNodes:n}}const mu=c.defineComponent({__name:"Popup",props:{trigger:{default:"click"},type:{default:"layer"},title:{},fullscreen:{type:Boolean,default:!1},show:{type:Boolean,default:!1},closeable:{type:Boolean,default:!0},transculent:{type:Boolean,default:!1},customClasses:{default:()=>[]},wrapperCustomClasses:{default:()=>[]},fullLayer:{type:Boolean,default:!1},draggable:{type:Boolean,default:!0},disableBackgroundEffect:{type:Boolean,default:!1},drawerPlacement:{},drawerWidth:{},drawerHeight:{},debug:{type:Boolean,default:!1},transitionDuration:{},trapFocus:{type:Boolean,default:!0}},emits:["update:show"],setup(e,{emit:t}){const r=e,n=t,a=qr(),i=c.useSlots(),{setSlotRef:o,slotElements:l,vNodes:s}=x2(i.trigger),u=fu(),f=c.computed({get(){return d.overlayProviderRef.isVisible(a)},set(h){h?d.overlayProviderRef.pushPopup(a,()=>c.h(VB,{type:r.type,title:r.title,fullscreen:r.fullscreen,transculent:r.transculent,customClasses:r.customClasses,closeable:r.closeable,fullLayer:r.fullLayer,draggable:r.draggable,drawerPlacement:r.drawerPlacement,drawerWidth:r.drawerWidth,drawerHeight:r.drawerHeight,capturedContext:u},{default:i.content,title:i.title,"header-actions":i["header-actions"],"close-btn":i["close-btn"]}),{type:r.type,close(){f.value=!1},disableBackgroundEffect:r.disableBackgroundEffect,wrapperCustomClasses:r.wrapperCustomClasses,handleClickOutside:()=>{f.value=!1},drawerPlacement:r.drawerPlacement,transitionDuration:r.transitionDuration??h8,role:"popup",trapFocus:r.trapFocus}):d.overlayProviderRef.pull(a),r.show!==h&&n("update:show",h)}});c.onUnmounted(()=>{d.overlayProviderRef.pull(a)}),c.watch(()=>r.show,()=>{r.show!==f.value&&(f.value=r.show)});function g(){f.value=!f.value}c.watch(l,()=>{for(const h of l.value)h.addEventListener("click",g)}),c.onUnmounted(()=>{for(const h of l.value)h.removeEventListener("click",g)});const d=window.bluepicPopupProvider;return c.onMounted(()=>{var m;const h=document.querySelector(hc);h&&(h.classList.add("bluepic-popup-app-wrapper"),(m=h.parentElement)==null||m.classList.add("bluepic-popup-body"))}),(h,m)=>(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(c.unref(s),(p,C)=>(c.openBlock(),c.createBlock(c.resolveDynamicComponent(p),{ref_for:!0,ref:c.unref(o)(C)},null,512))),256))}}),dK={key:0,class:"bx-card__header"},fK={class:"bx-card__header-inner"},gK={key:1,class:"bx-card__title-wrapper"},hK={key:1},AK={key:0,class:"bx-card__header-extra"},mK={key:1,class:"bx-card__cover"},pK=["src"],bK={key:2,class:"bx-card__content"},CK={key:3,class:"bx-card__footer"},b1=ht(c.defineComponent({__name:"BxCard",props:{title:{},description:{},cover:{},size:{default:"medium"},bordered:{type:Boolean,default:!1},transculent:{type:Boolean,default:!1},coverWidth:{},hoverable:{type:Boolean,default:!1},dividers:{type:Boolean,default:!0},state:{default:"default"}},setup(e){const t=c.useSlots();return(r,n)=>(c.openBlock(),c.createElementBlock("div",{class:c.normalizeClass(["bx-card",{bordered:e.bordered,transculent:e.transculent,["size-"+e.size]:!0,hoverable:e.hoverable,dividers:e.dividers,[`state-${e.state}`]:e.state!=="default"}])},[t.header||t.title||e.title?(c.openBlock(),c.createElementBlock("div",dK,[c.createElementVNode("div",fK,[t.header?c.renderSlot(r.$slots,"header",{},void 0,!0,0):(c.openBlock(),c.createElementBlock("div",gK,[t.title?c.renderSlot(r.$slots,"title",{},void 0,!0,0):e.title?(c.openBlock(),c.createElementBlock("h3",hK,c.toDisplayString(e.title),1)):c.createCommentVNode("",!0)]))]),t["header-extra"]?(c.openBlock(),c.createElementBlock("div",AK,[c.renderSlot(r.$slots,"header-extra",{},void 0,!0)])):c.createCommentVNode("",!0)])):c.createCommentVNode("",!0),t.cover||e.cover?(c.openBlock(),c.createElementBlock("div",mK,[t.cover?c.renderSlot(r.$slots,"cover",{},void 0,!0,0):(c.openBlock(),c.createElementBlock("img",{key:1,src:e.cover,alt:"cover",style:c.normalizeStyle({"--cover-width":e.coverWidth})},null,12,pK))])):c.createCommentVNode("",!0),t.default?(c.openBlock(),c.createElementBlock("div",bK,[c.renderSlot(r.$slots,"default",{},void 0,!0)])):c.createCommentVNode("",!0),t.footer?(c.openBlock(),c.createElementBlock("div",CK,[c.renderSlot(r.$slots,"footer",{},void 0,!0)])):c.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-3b4b80b4"]]),vK={class:"bx-upload"},yK=["tabindex","aria-label","aria-busy","aria-disabled"],IK={class:"bx-upload__icon-wrapper"},wK={class:"bx-upload__title"},xK={class:"bx-upload__description"},m8=ht(c.defineComponent({__name:"BxUpload",props:{type:{},accept:{default:()=>["image/*"]},title:{default:"Upload"},description:{default:"Drag and drop files here or click to upload"},uploadProgress:{},maxSize:{default:1/0},ariaLabel:{}},emits:["select"],setup(e,{emit:t}){const r=e,n=t,a=c.useSlots(),i=c.ref(!1);function o(h){h.preventDefault(),h.stopPropagation()}function l(h){h.preventDefault(),h.stopPropagation(),i.value=!0}function s(h){h.preventDefault(),h.stopPropagation()}function u(h){h.preventDefault(),h.stopPropagation(),i.value=!1}async function f(h){h.preventDefault(),h.stopPropagation(),i.value=!1;const m=Array.from(h.dataTransfer.files).filter(p=>{const[C,v]=p.type.split("/");return r.accept.some(I=>{const[y,x]=I.split("/");return(y==="*"||y===C)&&(x==="*"||x===v)})});n("select",m)}function g(h){r.uploadProgress===void 0&&(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),d())}async function d(){if(r.uploadProgress!==void 0)return;const h=await Sv({types:r.accept,maxSize:r.maxSize,multiple:!0});n("select",h)}return(h,m)=>(c.openBlock(),c.createElementBlock("div",vK,[e.type==="area"?(c.openBlock(),c.createElementBlock("div",{key:0,class:c.normalizeClass(["bx-upload__area",{dragging:i.value}]),role:"button",tabindex:e.uploadProgress!==void 0?-1:0,"aria-label":e.ariaLabel,"aria-busy":e.uploadProgress!==void 0?"true":void 0,"aria-disabled":e.uploadProgress!==void 0?"true":void 0,onDragstart:o,onDragenter:l,onDragover:s,onDragleave:u,onDrop:f,onClick:d,onKeydown:g},[c.createElementVNode("div",IK,[e.uploadProgress!==void 0?(c.openBlock(),c.createBlock(p1,{key:0,value:e.uploadProgress,circle:"",size:"medium"},null,8,["value"])):(c.openBlock(),c.createElementBlock(c.Fragment,{key:1},[a.icon?c.renderSlot(h.$slots,"icon",{},void 0,!0,0):(c.openBlock(),c.createBlock(c.unref(QB),{key:1}))],64))]),c.createElementVNode("div",wK,[e.uploadProgress!==void 0?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[c.createTextVNode(" Uploading ")],64)):(c.openBlock(),c.createElementBlock(c.Fragment,{key:1},[a.title?c.renderSlot(h.$slots,"title",{},void 0,!0,0):(c.openBlock(),c.createElementBlock(c.Fragment,{key:1},[c.createTextVNode(c.toDisplayString(e.title),1)],64))],64))]),c.createElementVNode("div",xK,[e.uploadProgress!==void 0?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[c.createTextVNode(c.toDisplayString(c.unref(xo)(e.uploadProgress*100,5))+"% ",1)],64)):(c.openBlock(),c.createElementBlock(c.Fragment,{key:1},[a.description?c.renderSlot(h.$slots,"description",{},void 0,!0,0):(c.openBlock(),c.createElementBlock(c.Fragment,{key:1},[c.createTextVNode(c.toDisplayString(e.description),1)],64))],64))])],42,yK)):e.type==="button"?(c.openBlock(),c.createBlock(Lt,{key:1,accept:e.accept,onClick:d},{icon:c.withCtx(()=>[a.icon?c.renderSlot(h.$slots,"icon",{},void 0,!0,0):(c.openBlock(),c.createBlock(c.unref(QB),{key:1}))]),default:c.withCtx(()=>[m[0]||(m[0]=c.createTextVNode(" Upload ",-1))]),_:3},8,["accept"])):c.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-3e51d474"]]),EK={class:"image-library-upload"},BK={class:"upload-progress-wrapper"},kK=ht(c.defineComponent({__name:"Upload",props:{width:{},height:{},quality:{},convertTo:{},field:{},handleUpload:{type:Function}},emits:["upload"],setup(e,{emit:t}){const r=e,n=t,{uploadFiles:a,uploadProgresses:i,uploading:o}=Xh(c.toRef(r,"width"),c.toRef(r,"height"),c.toRef(r,"convertTo"),c.toRef(r,"quality"),r.handleUpload,c.toRef(r,"field")),l=c.computed(()=>{const u=xo(i.value.reduce((f,g)=>f+g,0)/i.value.length,5);if(!isNaN(u))return u});async function s(u){const f=await a(u);n("upload",f)}return(u,f)=>(c.openBlock(),c.createElementBlock("div",EK,[c.createVNode(m8,{type:"area",onSelect:s,"upload-progress":l.value},null,8,["upload-progress"]),c.createElementVNode("div",BK,[c.unref(o)?(c.openBlock(),c.createBlock(p1,{key:0,value:l.value},null,8,["value"])):c.createCommentVNode("",!0)])]))}}),[["__scopeId","data-v-73dc9b99"]]),p8=Object.getPrototypeOf,b8=Object.getOwnPropertySymbols?function(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}:Object.keys;function C1(e,t,r){var n,a,i,o=Object.prototype.toString.call(e),l=Object.prototype.toString.call(t);if(e===t)return!0;if(e==null||t==null)return!1;if(r.indexOf(e)>-1&&r.indexOf(t)>-1)return!0;if(r.push(e,t),o!=l||(n=b8(e),a=b8(t),n.length!=a.length||n.some(function(s){return!C1(e[s],t[s],r)})))return!1;switch(o.slice(8,-1)){case"Symbol":return e.valueOf()==t.valueOf();case"Date":case"Number":return+e==+t||+e!=+e&&+t!=+t;case"RegExp":case"Function":case"String":case"Boolean":return""+e==""+t;case"Set":case"Map":{n=e.entries(),a=t.entries();do if(i=n.next(),!C1(i.value,a.next().value,r))return!1;while(!i.done);return!0}case"ArrayBuffer":e=new Uint8Array(e),t=new Uint8Array(t);case"DataView":e=new Uint8Array(e.buffer),t=new Uint8Array(t.buffer);case"Float32Array":case"Float64Array":case"Int8Array":case"Int16Array":case"Int32Array":case"Uint8Array":case"Uint16Array":case"Uint32Array":case"Uint8ClampedArray":case"Arguments":case"Array":if(e.length!=t.length)return!1;for(i=0;i<e.length;i++)if(!(!(i in e)&&!(i in t))&&(i in e!=i in t||!C1(e[i],t[i],r)))return!1;return!0;case"Object":return C1(p8(e),p8(t),r);default:return!1}}function Ia(e,t){return C1(e,t,[])}function $l(e){return structuredClone(c.toRaw(e))}function C8({text:e,format:t},...r){return{text:e.slice(...r),format:t}}function E2(e){const t=[[]];let r=0;for(;r in e;){const n=t.length-1,a=e[r],i=a.text.search(`
|
|
105
|
+
`);`${window.btoa(B.value)}`;const N=c.computed(()=>`url('data:image/svg+xml;base64,${window.btoa(S.value)}')`),D=c.computed(()=>`url('data:image/svg+xml;base64,${window.btoa(B.value)}')`);return(Q,z)=>{var A,P,W,O;return c.openBlock(),c.createElementBlock("div",{ref_key:"popoverWrapperRef",ref:i,class:c.normalizeClass(["popover-wrapper",{...Object.fromEntries(e.customClasses.map(R=>[R,!0])),"no-pointer-events":e.noPointerEvents}]),onClick:E,"data-bx-popover-id":e.bxPopoverId},[c.createElementVNode("div",{ref_key:"popoverElementRef",ref:o,class:"popover-element",style:c.normalizeStyle({...c.unref(f),...e.styles,"--rel-origin-x":(A=C.value)==null?void 0:A.x,"--rel-origin-y":(P=C.value)==null?void 0:P.y,"--arrow-mask-image":N.value}),onClick:x,onMouseenter:v,onMouseleave:I},[c.createElementVNode("div",{ref_key:"popoverFrameWrapperRef",ref:l,class:c.normalizeClass(["popover-frame-wrapper",{arrow:e.arrow,"overflow-visible":e.overflowVisible,[`placement-${c.unref(g)}`]:!0}]),"data-origin":y.value,"data-placement":c.unref(g),style:c.normalizeStyle({"transform-origin":`${(((W=C.value)==null?void 0:W.x)??0)*100}% ${(((O=C.value)==null?void 0:O.y)??0)*100}%`,"max-height":`calc(100vh - ${c.unref(h)}px - 20px)`})},[c.createElementVNode("div",{class:c.normalizeClass(["arrow-element",{["placement-"+c.unref(g)]:!0}])},[c.createElementVNode("div",{class:"arrow-symbol",style:c.normalizeStyle({"mask-image":N.value})},null,4),c.createElementVNode("div",{class:"arrow-border",style:c.normalizeStyle({"mask-image":D.value})},null,4)],2),c.createElementVNode("div",{class:"popover-frame",style:c.normalizeStyle({"max-height":`min(${e.popoverMaxHeight??"100vh"}, calc(100vh - ${c.unref(h)}px - 20px))`})},[c.createElementVNode("div",qJ,[c.renderSlot(Q.$slots,"default",{},void 0,!0)])],4)],14,KJ)],36)],10,JJ)}}}),[["__scopeId","data-v-148f949a"]]),h8=300,Yv=300;window.addEventListener("load",()=>{var t;const e=document.querySelector(hc);e&&(e.classList.add("bluepic-popup-app-wrapper"),(t=e.parentElement)==null||t.classList.add("bluepic-popup-body"))});function A1(e){const t=window.bluepicPopupProvider,r=e.capturedContext||fu(),n=qr();function a(){t.messageProviderRef.pull(n)}const i=e.keepOnHover??!0,o=e.closeAfter??5e3;let l=null,s=o,u=0;function f(){s<=0||o<=0||(u=Date.now(),l=setTimeout(a,s))}function g(){l!==null&&(clearTimeout(l),l=null,s-=Date.now()-u,s<0&&(s=0))}function d(){f()}return t.messageProviderRef.push(n,()=>c.h(nJ,{type:e.type,title:typeof e.title=="string"?e.title:void 0,message:typeof e.message=="string"?e.message:void 0,closeable:e.closeable??!0,customClasses:e.customClasses??[],maxWidth:e.maxWidth,capturedContext:r,onClose:a,showIcon:e.showIcon,...i?{onMouseenter:g,onMouseleave:d}:{}},{title:typeof e.title=="function"?e.title:void 0,message:typeof e.message=="function"?e.message:void 0,icon:e.icon}),{placement:e.placement??"top-right"}),f(),{close:a}}function m1(e){const t=window.bluepicPopupProvider,r=e.capturedContext||fu(),n=qr();let a=!1;const i=()=>{var s;a||(a=!0,(s=e.onClose)==null||s.call(e))},o=c.computed({get(){return t.overlayProviderRef.isVisible(n)},set(s){s?t.overlayProviderRef.pushPopup(n,()=>c.h(VB,{type:e.type??"frame",title:typeof e.title=="string"?e.title:void 0,fullscreen:!1,closeable:e.closeable??!0,transculent:e.transculent??!1,customClasses:e.customClasses??[],fullLayer:e.fullLayer??!1,draggable:e.draggable??!0,drawerPlacement:e.drawerPlacement,drawerWidth:e.drawerWidth,drawerHeight:e.drawerHeight,capturedContext:r},{default:()=>c.h("div",{},[typeof e.content=="string"?e.content:e.content(),...e.actions?typeof e.actions=="function"?(()=>{const u=e.actions();return Array.isArray(u)?u:[u]})():[c.h("div",{},e.actions.map(u=>c.h(Lt,{...u.props},{icon:u.icon,default:()=>u.label})))]:[]]),title:typeof e.title=="function"?e.title:void 0,"header-actions":e.headerActions?e.headerActions():void 0,icon:e.icon,"close-btn":e.closeBtn}),{type:e.type??"frame",close(){o.value=!1},disableBackgroundEffect:e.disableBackgroundEffect??!1,wrapperCustomClasses:e.wrapperCustomClasses??[],handleClickOutside(){o.value=!1},drawerPlacement:e.drawerPlacement,transitionDuration:e.transitionDuration??h8,role:"popup",trapFocus:e.trapFocus??!0}):(t.overlayProviderRef.pull(n),i())}});function l(){o.value=!1}return o.value=!0,{close:l}}const rK={success:Nv,error:_v,warning:Lv,info:c1};function nK(e){const t=e.capturedContext||fu(),r=e.closeOnAction??!0,n=c.ref({positive:!1,negative:!1}),{close:a}=m1({type:"frame",closeable:e.closeable??!0,draggable:e.draggable??!0,disableBackgroundEffect:e.disableBackgroundEffect??!0,customClasses:["bx-dialog",...e.customClasses??[]],wrapperCustomClasses:e.wrapperCustomClasses,capturedContext:t,title:e.title,icon:e.icon??(e.type?()=>c.h(rK[e.type]):void 0),content:()=>{const i=[];return e.content&&i.push(c.h("div",{class:"bx-dialog-content popup-no-drag"},[typeof e.content=="function"?e.content():e.content])),(e.action||e.positiveText||e.negativeText)&&i.push(c.h("div",{class:"bx-dialog-actions popup-no-drag",style:"display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px;"},[e.action?e.action():[e.negativeText?c.h(Lt,{secondary:!1,...e.negativeButtonProps??{},loading:n.value.negative,onClick:async()=>{if(e.onNegativeClick){n.value.negative=!0;try{if(await e.onNegativeClick()===!1)return}finally{n.value.negative=!1}}r&&a()}},{default:()=>e.negativeText}):null,e.positiveText?c.h(Lt,{active:!0,...e.positiveButtonProps??{},loading:n.value.positive,onClick:async()=>{if(e.onPositiveClick){n.value.positive=!0;try{if(await e.onPositiveClick()===!1)return}finally{n.value.positive=!1}}r&&a()}},{default:()=>e.positiveText}):null]])),i}});return{close:a}}function aK(e){return m1({type:"drawer",title:e.title,closeable:e.closeable??!0,content:e.content,drawerPlacement:e.placement??"right",drawerWidth:e.width,drawerHeight:e.height,disableBackgroundEffect:e.disableBackgroundEffect,customClasses:e.customClasses,wrapperCustomClasses:e.wrapperCustomClasses,capturedContext:e.capturedContext})}function iK(e,t,r,n){return{getBoundingClientRect(){return{x:e,y:t,width:r,height:n,top:t,left:e,right:e+r,bottom:t+n,toJSON(){return this}}}}}function oK(e){const t=window.bluepicPopupProvider,r=e.capturedContext||fu(),n=qr(),a=e.floatingElement??(e.x!==void 0&&e.y!==void 0?iK(e.x,e.y,e.width??0,e.height??0):void 0),i=c.computed({get(){return t.overlayProviderRef.isVisible(n)},set(l){l?t.overlayProviderRef.pushPopover(n,()=>c.h(g8,{floatingElement:a,styles:{...e.customStyles},floatingPadding:e.floatingPadding??0,customClasses:e.customClasses??[],onClose(){i.value=!1},arrow:e.arrow??!0,allowedPlacements:e.allowedPlacements??["top","right","bottom","left","top-start","top-end","right-start","right-end","bottom-start","bottom-end","left-start","left-end"],bxPopoverId:n,noPointerEvents:e.noPointerEvents??!1,scrollPassthrough:e.scrollPassthrough??!(e.darkenBackground??!0),overflowVisible:e.overflowVisible??!1,capturedContext:r},{default:()=>e.content()}),{darkenBackground:e.darkenBackground??!0,handleClickOutside(){e.closeOnClickOutside&&(i.value=!1)},transitionDuration:e.transitionDuration??Yv,role:"popover",close(){i.value=!1}}):t.overlayProviderRef.pull(n)}});function o(){i.value=!1}return i.value=!0,{close:o}}function w2(){const e=fu();return{createPopup:(t,r)=>(console.log("createPopup",t,e),m1({...t,capturedContext:{...e,...r}})),createDialog:t=>nK({...t,capturedContext:e}),createMessage:t=>A1({...t,capturedContext:e}),createPopover:t=>oK({...t,capturedContext:e}),createDrawer:t=>aK({...t,capturedContext:e})}}function A8(e){const t=window.bluepicPopupProvider,r=qr();return t.overlayProviderRef.pushPopover(r,()=>c.h("div",{},e()),{darkenBackground:!1,handleClickOutside(){},transitionDuration:Yv,role:"popover",trapFocus:!0,close(){t.overlayProviderRef.pull(r)}}),{destroy:()=>{t.overlayProviderRef.pull(r)}}}const sK={key:0,class:"bx-progress__circle"},lK={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 100 100"},cK=["d"],uK={class:"bx-progress__bar-inner"},p1=ht(c.defineComponent({__name:"BxProgress",props:{value:{},circle:{type:Boolean,default:!1},transition:{type:Boolean,default:!0}},setup(e){const t=e;function r(a,i,o=0,l=0){a=Math.max(0,Math.min(100,a));const s=a/100*360,u=(s-90)*(Math.PI/180),f=o+i*Math.cos(u),g=l+i*Math.sin(u),d=s>180?1:0;return[`M ${o} ${l-i}`,`A ${i} ${i} 0 ${d} 1 ${f} ${g}`].join(" ")}const n=c.computed(()=>t.value!==void 0?r(t.value*100,45,50,50):"");return(a,i)=>(c.openBlock(),c.createElementBlock("div",{class:c.normalizeClass(["bx-progress",{circle:e.circle}])},[e.circle?(c.openBlock(),c.createElementBlock("div",sK,[(c.openBlock(),c.createElementBlock("svg",lK,[c.createElementVNode("path",{d:n.value,class:"circle-progress-path"},null,8,cK)]))])):(c.openBlock(),c.createElementBlock("div",{key:1,class:c.normalizeClass(["bx-progress__bar",{circle:e.circle}]),style:c.normalizeStyle({"--progress":e.value})},[c.createElementVNode("div",uK,[c.createElementVNode("div",{class:c.normalizeClass(["bx-progress__bar-fill",{transition:e.transition}])},null,2)])],6))],2))}}),[["__scopeId","data-v-223c9a98"]]);function x2(e){let t=[];const r=c.ref([]),n=c.computed(()=>{const i=e();return Array.isArray(i)?i:[i]}),a=i=>o=>{const l=(()=>{if(o instanceof HTMLElement)return o;if(o instanceof Node)return o.nextSibling;if((o==null?void 0:o.$el)instanceof HTMLElement)return o.$el})();l&&(t[i]=l)};return c.watch(n,()=>{t=[],c.nextTick(()=>{r.value=t})},{immediate:!0}),{setSlotRef:a,slotElements:r,vNodes:n}}const mu=c.defineComponent({__name:"Popup",props:{trigger:{default:"click"},type:{default:"layer"},title:{},fullscreen:{type:Boolean,default:!1},show:{type:Boolean,default:!1},closeable:{type:Boolean,default:!0},transculent:{type:Boolean,default:!1},customClasses:{default:()=>[]},wrapperCustomClasses:{default:()=>[]},fullLayer:{type:Boolean,default:!1},draggable:{type:Boolean,default:!0},disableBackgroundEffect:{type:Boolean,default:!1},drawerPlacement:{},drawerWidth:{},drawerHeight:{},debug:{type:Boolean,default:!1},transitionDuration:{},trapFocus:{type:Boolean,default:!0}},emits:["update:show"],setup(e,{emit:t}){const r=e,n=t,a=qr(),i=c.useSlots(),{setSlotRef:o,slotElements:l,vNodes:s}=x2(i.trigger),u=fu(),f=c.computed({get(){return d.overlayProviderRef.isVisible(a)},set(h){h?d.overlayProviderRef.pushPopup(a,()=>c.h(VB,{type:r.type,title:r.title,fullscreen:r.fullscreen,transculent:r.transculent,customClasses:r.customClasses,closeable:r.closeable,fullLayer:r.fullLayer,draggable:r.draggable,drawerPlacement:r.drawerPlacement,drawerWidth:r.drawerWidth,drawerHeight:r.drawerHeight,capturedContext:u},{default:i.content,title:i.title,"header-actions":i["header-actions"],"close-btn":i["close-btn"]}),{type:r.type,close(){f.value=!1},disableBackgroundEffect:r.disableBackgroundEffect,wrapperCustomClasses:r.wrapperCustomClasses,handleClickOutside:()=>{f.value=!1},drawerPlacement:r.drawerPlacement,transitionDuration:r.transitionDuration??h8,role:"popup",trapFocus:r.trapFocus}):d.overlayProviderRef.pull(a),r.show!==h&&n("update:show",h)}});c.onUnmounted(()=>{d.overlayProviderRef.pull(a)}),c.watch(()=>r.show,()=>{r.show!==f.value&&(f.value=r.show)});function g(){f.value=!f.value}c.watch(l,()=>{for(const h of l.value)h.addEventListener("click",g)}),c.onUnmounted(()=>{for(const h of l.value)h.removeEventListener("click",g)});const d=window.bluepicPopupProvider;return c.onMounted(()=>{var m;const h=document.querySelector(hc);h&&(h.classList.add("bluepic-popup-app-wrapper"),(m=h.parentElement)==null||m.classList.add("bluepic-popup-body"))}),(h,m)=>(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(c.unref(s),(p,C)=>(c.openBlock(),c.createBlock(c.resolveDynamicComponent(p),{ref_for:!0,ref:c.unref(o)(C)},null,512))),256))}}),dK={key:0,class:"bx-card__header"},fK={class:"bx-card__header-inner"},gK={key:1,class:"bx-card__title-wrapper"},hK={key:1},AK={key:0,class:"bx-card__header-extra"},mK={key:1,class:"bx-card__cover"},pK=["src"],bK={key:2,class:"bx-card__content"},CK={key:3,class:"bx-card__footer"},b1=ht(c.defineComponent({__name:"BxCard",props:{title:{},description:{},cover:{},size:{default:"medium"},bordered:{type:Boolean,default:!1},transculent:{type:Boolean,default:!1},coverWidth:{},hoverable:{type:Boolean,default:!1},dividers:{type:Boolean,default:!0},radius:{default:"md"},contentGap:{default:"none"},state:{default:"default"}},setup(e){const t=c.useSlots();return(r,n)=>(c.openBlock(),c.createElementBlock("div",{class:c.normalizeClass(["bx-card",{bordered:e.bordered,transculent:e.transculent,["size-"+e.size]:!0,hoverable:e.hoverable,dividers:e.dividers,[`radius-${e.radius}`]:!0,[`content-gap-${e.contentGap}`]:e.contentGap!=="none",[`state-${e.state}`]:e.state!=="default"}])},[t.header||t.title||e.title?(c.openBlock(),c.createElementBlock("div",dK,[c.createElementVNode("div",fK,[t.header?c.renderSlot(r.$slots,"header",{},void 0,!0,0):(c.openBlock(),c.createElementBlock("div",gK,[t.title?c.renderSlot(r.$slots,"title",{},void 0,!0,0):e.title?(c.openBlock(),c.createElementBlock("h3",hK,c.toDisplayString(e.title),1)):c.createCommentVNode("",!0)]))]),t["header-extra"]?(c.openBlock(),c.createElementBlock("div",AK,[c.renderSlot(r.$slots,"header-extra",{},void 0,!0)])):c.createCommentVNode("",!0)])):c.createCommentVNode("",!0),t.cover||e.cover?(c.openBlock(),c.createElementBlock("div",mK,[t.cover?c.renderSlot(r.$slots,"cover",{},void 0,!0,0):(c.openBlock(),c.createElementBlock("img",{key:1,src:e.cover,alt:"cover",style:c.normalizeStyle({"--cover-width":e.coverWidth})},null,12,pK))])):c.createCommentVNode("",!0),t.default?(c.openBlock(),c.createElementBlock("div",bK,[c.renderSlot(r.$slots,"default",{},void 0,!0)])):c.createCommentVNode("",!0),t.footer?(c.openBlock(),c.createElementBlock("div",CK,[c.renderSlot(r.$slots,"footer",{},void 0,!0)])):c.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-ba552816"]]),vK={class:"bx-upload"},yK=["tabindex","aria-label","aria-busy","aria-disabled"],IK={class:"bx-upload__icon-wrapper"},wK={class:"bx-upload__title"},xK={class:"bx-upload__description"},m8=ht(c.defineComponent({__name:"BxUpload",props:{type:{},accept:{default:()=>["image/*"]},title:{default:"Upload"},description:{default:"Drag and drop files here or click to upload"},uploadProgress:{},maxSize:{default:1/0},ariaLabel:{}},emits:["select"],setup(e,{emit:t}){const r=e,n=t,a=c.useSlots(),i=c.ref(!1);function o(h){h.preventDefault(),h.stopPropagation()}function l(h){h.preventDefault(),h.stopPropagation(),i.value=!0}function s(h){h.preventDefault(),h.stopPropagation()}function u(h){h.preventDefault(),h.stopPropagation(),i.value=!1}async function f(h){h.preventDefault(),h.stopPropagation(),i.value=!1;const m=Array.from(h.dataTransfer.files).filter(p=>{const[C,v]=p.type.split("/");return r.accept.some(I=>{const[y,x]=I.split("/");return(y==="*"||y===C)&&(x==="*"||x===v)})});n("select",m)}function g(h){r.uploadProgress===void 0&&(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),d())}async function d(){if(r.uploadProgress!==void 0)return;const h=await Sv({types:r.accept,maxSize:r.maxSize,multiple:!0});n("select",h)}return(h,m)=>(c.openBlock(),c.createElementBlock("div",vK,[e.type==="area"?(c.openBlock(),c.createElementBlock("div",{key:0,class:c.normalizeClass(["bx-upload__area",{dragging:i.value}]),role:"button",tabindex:e.uploadProgress!==void 0?-1:0,"aria-label":e.ariaLabel,"aria-busy":e.uploadProgress!==void 0?"true":void 0,"aria-disabled":e.uploadProgress!==void 0?"true":void 0,onDragstart:o,onDragenter:l,onDragover:s,onDragleave:u,onDrop:f,onClick:d,onKeydown:g},[c.createElementVNode("div",IK,[e.uploadProgress!==void 0?(c.openBlock(),c.createBlock(p1,{key:0,value:e.uploadProgress,circle:"",size:"medium"},null,8,["value"])):(c.openBlock(),c.createElementBlock(c.Fragment,{key:1},[a.icon?c.renderSlot(h.$slots,"icon",{},void 0,!0,0):(c.openBlock(),c.createBlock(c.unref(QB),{key:1}))],64))]),c.createElementVNode("div",wK,[e.uploadProgress!==void 0?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[c.createTextVNode(" Uploading ")],64)):(c.openBlock(),c.createElementBlock(c.Fragment,{key:1},[a.title?c.renderSlot(h.$slots,"title",{},void 0,!0,0):(c.openBlock(),c.createElementBlock(c.Fragment,{key:1},[c.createTextVNode(c.toDisplayString(e.title),1)],64))],64))]),c.createElementVNode("div",xK,[e.uploadProgress!==void 0?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[c.createTextVNode(c.toDisplayString(c.unref(xo)(e.uploadProgress*100,5))+"% ",1)],64)):(c.openBlock(),c.createElementBlock(c.Fragment,{key:1},[a.description?c.renderSlot(h.$slots,"description",{},void 0,!0,0):(c.openBlock(),c.createElementBlock(c.Fragment,{key:1},[c.createTextVNode(c.toDisplayString(e.description),1)],64))],64))])],42,yK)):e.type==="button"?(c.openBlock(),c.createBlock(Lt,{key:1,accept:e.accept,onClick:d},{icon:c.withCtx(()=>[a.icon?c.renderSlot(h.$slots,"icon",{},void 0,!0,0):(c.openBlock(),c.createBlock(c.unref(QB),{key:1}))]),default:c.withCtx(()=>[m[0]||(m[0]=c.createTextVNode(" Upload ",-1))]),_:3},8,["accept"])):c.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-3e51d474"]]),EK={class:"image-library-upload"},BK={class:"upload-progress-wrapper"},kK=ht(c.defineComponent({__name:"Upload",props:{width:{},height:{},quality:{},convertTo:{},field:{},handleUpload:{type:Function}},emits:["upload"],setup(e,{emit:t}){const r=e,n=t,{uploadFiles:a,uploadProgresses:i,uploading:o}=Xh(c.toRef(r,"width"),c.toRef(r,"height"),c.toRef(r,"convertTo"),c.toRef(r,"quality"),r.handleUpload,c.toRef(r,"field")),l=c.computed(()=>{const u=xo(i.value.reduce((f,g)=>f+g,0)/i.value.length,5);if(!isNaN(u))return u});async function s(u){const f=await a(u);n("upload",f)}return(u,f)=>(c.openBlock(),c.createElementBlock("div",EK,[c.createVNode(m8,{type:"area",onSelect:s,"upload-progress":l.value},null,8,["upload-progress"]),c.createElementVNode("div",BK,[c.unref(o)?(c.openBlock(),c.createBlock(p1,{key:0,value:l.value},null,8,["value"])):c.createCommentVNode("",!0)])]))}}),[["__scopeId","data-v-73dc9b99"]]),p8=Object.getPrototypeOf,b8=Object.getOwnPropertySymbols?function(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}:Object.keys;function C1(e,t,r){var n,a,i,o=Object.prototype.toString.call(e),l=Object.prototype.toString.call(t);if(e===t)return!0;if(e==null||t==null)return!1;if(r.indexOf(e)>-1&&r.indexOf(t)>-1)return!0;if(r.push(e,t),o!=l||(n=b8(e),a=b8(t),n.length!=a.length||n.some(function(s){return!C1(e[s],t[s],r)})))return!1;switch(o.slice(8,-1)){case"Symbol":return e.valueOf()==t.valueOf();case"Date":case"Number":return+e==+t||+e!=+e&&+t!=+t;case"RegExp":case"Function":case"String":case"Boolean":return""+e==""+t;case"Set":case"Map":{n=e.entries(),a=t.entries();do if(i=n.next(),!C1(i.value,a.next().value,r))return!1;while(!i.done);return!0}case"ArrayBuffer":e=new Uint8Array(e),t=new Uint8Array(t);case"DataView":e=new Uint8Array(e.buffer),t=new Uint8Array(t.buffer);case"Float32Array":case"Float64Array":case"Int8Array":case"Int16Array":case"Int32Array":case"Uint8Array":case"Uint16Array":case"Uint32Array":case"Uint8ClampedArray":case"Arguments":case"Array":if(e.length!=t.length)return!1;for(i=0;i<e.length;i++)if(!(!(i in e)&&!(i in t))&&(i in e!=i in t||!C1(e[i],t[i],r)))return!1;return!0;case"Object":return C1(p8(e),p8(t),r);default:return!1}}function Ia(e,t){return C1(e,t,[])}function $l(e){return structuredClone(c.toRaw(e))}function C8({text:e,format:t},...r){return{text:e.slice(...r),format:t}}function E2(e){const t=[[]];let r=0;for(;r in e;){const n=t.length-1,a=e[r],i=a.text.search(`
|
|
106
106
|
`);if(i>-1){const o=C8(a,0,i),l=C8(a,i+1);t[n].push(o);const s=E2([l]);for(const u of s)t.push(u)}else t[n].push(e[r]);r++}return t.map(n=>n.filter((a,i)=>{i===0&&n.length;const o=i===n.length-1&&n.slice(0,i).every(l=>l.text==="");return a.text!==""||o}))}function Pv(e){var a;const t=[];let r=0;for(const i of $l(e)){for(const o of i)t.push(o);r<e.length-1&&t[t.length-1]&&(t[t.length-1].text+=`
|
|
107
107
|
`),r++}const n=[];{let i=0;for(;i<t.length;){const o={text:"",format:$l(t[i].format)};for(;Ia((a=t[i])==null?void 0:a.format,o.format);)o.text+=t[i].text,i++;n.push(o)}}return n}function v8(e,t,r){return e.map(({text:n,format:a},i)=>{const o=e.slice(0,i).reduce((s,{text:u})=>s+u.length,0),l=o+n.length;return{text:t<l&&o<r?n.slice(Math.max(t-o,0),r-o):"",format:a}}).filter(({text:n})=>n.length>0)}function B2(e){return(e[0]instanceof Array?Pv(e):e).reduce((r,n)=>r+n.text,"")}function y8(e){return typeof e=="string"?[{text:e,format:{}}]:typeof e=="boolean"?[{text:e?"true":"false",format:{}}]:typeof e=="number"?[{text:e.toString(),format:{}}]:e}const Vv={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};for(const e in Vv)Object.freeze(Vv[e]);const us=Object.freeze(Vv),I8=Object.create(null);for(const e in us)Object.hasOwn(us,e)&&(I8[us[e]]=e);const $n={to:{},get:{}};$n.get=function(e){const t=e.slice(0,3).toLowerCase();let r,n;switch(t){case"hsl":{r=$n.get.hsl(e),n="hsl";break}case"hwb":{r=$n.get.hwb(e),n="hwb";break}default:{r=$n.get.rgb(e),n="rgb";break}}return r?{model:n,value:r}:null},$n.get.rgb=function(e){if(!e)return null;const t=/^#([a-f\d]{3,4})$/i,r=/^#([a-f\d]{6})([a-f\d]{2})?$/i,n=/^rgba?\(\s*([+-]?(?:\d*\.)?\d+(?:e\d+)?)(?=[\s,])\s*(?:,\s*)?([+-]?(?:\d*\.)?\d+(?:e\d+)?)(?=[\s,])\s*(?:,\s*)?([+-]?(?:\d*\.)?\d+(?:e\d+)?)\s*(?:[\s,|/]\s*([+-]?(?:\d*\.)?\d+(?:e\d+)?)(%?)\s*)?\)$/i,a=/^rgba?\(\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[\s,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/i,i=/^(\w+)$/;let o=[0,0,0,1],l,s,u;if(l=e.match(r)){for(u=l[2],l=l[1],s=0;s<3;s++){const f=s*2;o[s]=Number.parseInt(l.slice(f,f+2),16)}u&&(o[3]=Number.parseInt(u,16)/255)}else if(l=e.match(t)){for(l=l[1],u=l[3],s=0;s<3;s++)o[s]=Number.parseInt(l[s]+l[s],16);u&&(o[3]=Number.parseInt(u+u,16)/255)}else if(l=e.match(n)){for(s=0;s<3;s++)o[s]=Number.parseFloat(l[s+1]);l[4]&&(o[3]=l[5]?Number.parseFloat(l[4])*.01:Number.parseFloat(l[4]))}else if(l=e.match(a)){for(s=0;s<3;s++)o[s]=Math.round(Number.parseFloat(l[s+1])*2.55);l[4]&&(o[3]=l[5]?Number.parseFloat(l[4])*.01:Number.parseFloat(l[4]))}else return(l=e.toLowerCase().match(i))?l[1]==="transparent"?[0,0,0,0]:Object.hasOwn(us,l[1])?(o=us[l[1]].slice(),o[3]=1,o):null:null;for(s=0;s<3;s++)o[s]=Jl(o[s],0,255);return o[3]=Jl(o[3],0,1),o},$n.get.hsl=function(e){if(!e)return null;const t=/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[,|/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:e[+-]?\d+)?)\s*)?\)$/i,r=e.match(t);if(r){const n=Number.parseFloat(r[4]),a=(Number.parseFloat(r[1])%360+360)%360,i=Jl(Number.parseFloat(r[2]),0,100),o=Jl(Number.parseFloat(r[3]),0,100),l=Jl(Number.isNaN(n)?1:n,0,1);return[a,i,o,l]}return null},$n.get.hwb=function(e){if(!e)return null;const t=/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*[\s,]\s*([+-]?[\d.]+)%\s*[\s,]\s*([+-]?[\d.]+)%\s*(?:[\s,]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:e[+-]?\d+)?)\s*)?\)$/i,r=e.match(t);if(r){const n=Number.parseFloat(r[4]),a=(Number.parseFloat(r[1])%360+360)%360,i=Jl(Number.parseFloat(r[2]),0,100),o=Jl(Number.parseFloat(r[3]),0,100),l=Jl(Number.isNaN(n)?1:n,0,1);return[a,i,o,l]}return null},$n.to.hex=function(...e){return"#"+k2(e[0])+k2(e[1])+k2(e[2])+(e[3]<1?k2(Math.round(e[3]*255)):"")},$n.to.rgb=function(...e){return e.length<4||e[3]===1?"rgb("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+")":"rgba("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+", "+e[3]+")"},$n.to.rgb.percent=function(...e){const t=Math.round(e[0]/255*100),r=Math.round(e[1]/255*100),n=Math.round(e[2]/255*100);return e.length<4||e[3]===1?"rgb("+t+"%, "+r+"%, "+n+"%)":"rgba("+t+"%, "+r+"%, "+n+"%, "+e[3]+")"},$n.to.hsl=function(...e){return e.length<4||e[3]===1?"hsl("+e[0]+", "+e[1]+"%, "+e[2]+"%)":"hsla("+e[0]+", "+e[1]+"%, "+e[2]+"%, "+e[3]+")"},$n.to.hwb=function(...e){let t="";return e.length>=4&&e[3]!==1&&(t=", "+e[3]),"hwb("+e[0]+", "+e[1]+"%, "+e[2]+"%"+t+")"},$n.to.keyword=function(...e){return I8[e.slice(0,3)]};function Jl(e,t,r){return Math.min(Math.max(t,e),r)}function k2(e){const t=Math.round(e).toString(16).toUpperCase();return t.length<2?"0"+t:t}const w8={};for(const e of Object.keys(us))w8[us[e]]=e;const Et={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},oklab:{channels:3,labels:["okl","oka","okb"]},lch:{channels:3,labels:"lch"},oklch:{channels:3,labels:["okl","okc","okh"]},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}},Xs=(6/29)**3;function X0(e){const t=e>.0031308?1.055*e**.4166666666666667-.055:e*12.92;return Math.min(Math.max(0,t),1)}function $0(e){return e>.04045?((e+.055)/1.055)**2.4:e/12.92}for(const e of Object.keys(Et)){if(!("channels"in Et[e]))throw new Error("missing channels property: "+e);if(!("labels"in Et[e]))throw new Error("missing channel labels property: "+e);if(Et[e].labels.length!==Et[e].channels)throw new Error("channel and label counts mismatch: "+e);const{channels:t,labels:r}=Et[e];delete Et[e].channels,delete Et[e].labels,Object.defineProperty(Et[e],"channels",{value:t}),Object.defineProperty(Et[e],"labels",{value:r})}Et.rgb.hsl=function(e){const t=e[0]/255,r=e[1]/255,n=e[2]/255,a=Math.min(t,r,n),i=Math.max(t,r,n),o=i-a;let l,s;switch(i){case a:{l=0;break}case t:{l=(r-n)/o;break}case r:{l=2+(n-t)/o;break}case n:{l=4+(t-r)/o;break}}l=Math.min(l*60,360),l<0&&(l+=360);const u=(a+i)/2;return i===a?s=0:u<=.5?s=o/(i+a):s=o/(2-i-a),[l,s*100,u*100]},Et.rgb.hsv=function(e){let t,r,n,a,i;const o=e[0]/255,l=e[1]/255,s=e[2]/255,u=Math.max(o,l,s),f=u-Math.min(o,l,s),g=function(d){return(u-d)/6/f+1/2};if(f===0)a=0,i=0;else{switch(i=f/u,t=g(o),r=g(l),n=g(s),u){case o:{a=n-r;break}case l:{a=.3333333333333333+t-n;break}case s:{a=.6666666666666666+r-t;break}}a<0?a+=1:a>1&&(a-=1)}return[a*360,i*100,u*100]},Et.rgb.hwb=function(e){const t=e[0],r=e[1];let n=e[2];const a=Et.rgb.hsl(e)[0],i=1/255*Math.min(t,Math.min(r,n));return n=1-.00392156862745098*Math.max(t,Math.max(r,n)),[a,i*100,n*100]},Et.rgb.oklab=function(e){const t=$0(e[0]/255),r=$0(e[1]/255),n=$0(e[2]/255),a=Math.cbrt(.4122214708*t+.5363325363*r+.0514459929*n),i=Math.cbrt(.2119034982*t+.6806995451*r+.1073969566*n),o=Math.cbrt(.0883024619*t+.2817188376*r+.6299787005*n),l=.2104542553*a+.793617785*i-.0040720468*o,s=1.9779984951*a-2.428592205*i+.4505937099*o,u=.0259040371*a+.7827717662*i-.808675766*o;return[l*100,s*100,u*100]},Et.rgb.cmyk=function(e){const t=e[0]/255,r=e[1]/255,n=e[2]/255,a=Math.min(1-t,1-r,1-n),i=(1-t-a)/(1-a)||0,o=(1-r-a)/(1-a)||0,l=(1-n-a)/(1-a)||0;return[i*100,o*100,l*100,a*100]};function SK(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2}Et.rgb.keyword=function(e){const t=w8[e];if(t)return t;let r=Number.POSITIVE_INFINITY,n;for(const a of Object.keys(us)){const i=us[a],o=SK(e,i);o<r&&(r=o,n=a)}return n},Et.keyword.rgb=function(e){return[...us[e]]},Et.rgb.xyz=function(e){const t=$0(e[0]/255),r=$0(e[1]/255),n=$0(e[2]/255),a=t*.4124564+r*.3575761+n*.1804375,i=t*.2126729+r*.7151522+n*.072175,o=t*.0193339+r*.119192+n*.9503041;return[a*100,i*100,o*100]},Et.rgb.lab=function(e){const t=Et.rgb.xyz(e);let r=t[0],n=t[1],a=t[2];r/=95.047,n/=100,a/=108.883,r=r>Xs?r**.3333333333333333:7.787*r+.13793103448275862,n=n>Xs?n**.3333333333333333:7.787*n+.13793103448275862,a=a>Xs?a**.3333333333333333:7.787*a+.13793103448275862;const i=116*n-16,o=500*(r-n),l=200*(n-a);return[i,o,l]},Et.hsl.rgb=function(e){const t=e[0]/360,r=e[1]/100,n=e[2]/100;let a,i;if(r===0)return i=n*255,[i,i,i];const o=n<.5?n*(1+r):n+r-n*r,l=2*n-o,s=[0,0,0];for(let u=0;u<3;u++)a=t+.3333333333333333*-(u-1),a<0&&a++,a>1&&a--,6*a<1?i=l+(o-l)*6*a:2*a<1?i=o:3*a<2?i=l+(o-l)*(.6666666666666666-a)*6:i=l,s[u]=i*255;return s},Et.hsl.hsv=function(e){const t=e[0];let r=e[1]/100,n=e[2]/100,a=r;const i=Math.max(n,.01);n*=2,r*=n<=1?n:2-n,a*=i<=1?i:2-i;const o=(n+r)/2,l=n===0?2*a/(i+a):2*r/(n+r);return[t,l*100,o*100]},Et.hsv.rgb=function(e){const t=e[0]/60,r=e[1]/100;let n=e[2]/100;const a=Math.floor(t)%6,i=t-Math.floor(t),o=255*n*(1-r),l=255*n*(1-r*i),s=255*n*(1-r*(1-i));switch(n*=255,a){case 0:return[n,s,o];case 1:return[l,n,o];case 2:return[o,n,s];case 3:return[o,l,n];case 4:return[s,o,n];case 5:return[n,o,l]}},Et.hsv.hsl=function(e){const t=e[0],r=e[1]/100,n=e[2]/100,a=Math.max(n,.01);let i,o;o=(2-r)*n;const l=(2-r)*a;return i=r*a,i/=l<=1?l:2-l,i=i||0,o/=2,[t,i*100,o*100]},Et.hwb.rgb=function(e){const t=e[0]/360;let r=e[1]/100,n=e[2]/100;const a=r+n;let i;a>1&&(r/=a,n/=a);const o=Math.floor(6*t),l=1-n;i=6*t-o,o&1&&(i=1-i);const s=r+i*(l-r);let u,f,g;switch(o){default:case 6:case 0:{u=l,f=s,g=r;break}case 1:{u=s,f=l,g=r;break}case 2:{u=r,f=l,g=s;break}case 3:{u=r,f=s,g=l;break}case 4:{u=s,f=r,g=l;break}case 5:{u=l,f=r,g=s;break}}return[u*255,f*255,g*255]},Et.cmyk.rgb=function(e){const t=e[0]/100,r=e[1]/100,n=e[2]/100,a=e[3]/100,i=1-Math.min(1,t*(1-a)+a),o=1-Math.min(1,r*(1-a)+a),l=1-Math.min(1,n*(1-a)+a);return[i*255,o*255,l*255]},Et.xyz.rgb=function(e){const t=e[0]/100,r=e[1]/100,n=e[2]/100;let a,i,o;return a=t*3.2404542+r*-1.5371385+n*-.4985314,i=t*-.969266+r*1.8760108+n*.041556,o=t*.0556434+r*-.2040259+n*1.0572252,a=X0(a),i=X0(i),o=X0(o),[a*255,i*255,o*255]},Et.xyz.lab=function(e){let t=e[0],r=e[1],n=e[2];t/=95.047,r/=100,n/=108.883,t=t>Xs?t**.3333333333333333:7.787*t+.13793103448275862,r=r>Xs?r**.3333333333333333:7.787*r+.13793103448275862,n=n>Xs?n**.3333333333333333:7.787*n+.13793103448275862;const a=116*r-16,i=500*(t-r),o=200*(r-n);return[a,i,o]},Et.xyz.oklab=function(e){const t=e[0]/100,r=e[1]/100,n=e[2]/100,a=Math.cbrt(.8189330101*t+.3618667424*r-.1288597137*n),i=Math.cbrt(.0329845436*t+.9293118715*r+.0361456387*n),o=Math.cbrt(.0482003018*t+.2643662691*r+.633851707*n),l=.2104542553*a+.793617785*i-.0040720468*o,s=1.9779984951*a-2.428592205*i+.4505937099*o,u=.0259040371*a+.7827717662*i-.808675766*o;return[l*100,s*100,u*100]},Et.oklab.oklch=function(e){return Et.lab.lch(e)},Et.oklab.xyz=function(e){const t=e[0]/100,r=e[1]/100,n=e[2]/100,a=(.999999998*t+.396337792*r+.215803758*n)**3,i=(1.000000008*t-.105561342*r-.063854175*n)**3,o=(1.000000055*t-.089484182*r-1.291485538*n)**3,l=1.227013851*a-.55779998*i+.281256149*o,s=-.040580178*a+1.11225687*i-.071676679*o,u=-.076381285*a-.421481978*i+1.58616322*o;return[l*100,s*100,u*100]},Et.oklab.rgb=function(e){const t=e[0]/100,r=e[1]/100,n=e[2]/100,a=(t+.3963377774*r+.2158037573*n)**3,i=(t-.1055613458*r-.0638541728*n)**3,o=(t-.0894841775*r-1.291485548*n)**3,l=X0(4.0767416621*a-3.3077115913*i+.2309699292*o),s=X0(-1.2684380046*a+2.6097574011*i-.3413193965*o),u=X0(-.0041960863*a-.7034186147*i+1.707614701*o);return[l*255,s*255,u*255]},Et.oklch.oklab=function(e){return Et.lch.lab(e)},Et.lab.xyz=function(e){const t=e[0],r=e[1],n=e[2];let a,i,o;i=(t+16)/116,a=r/500+i,o=i-n/200;const l=i**3,s=a**3,u=o**3;return i=l>Xs?l:(i-.13793103448275862)/7.787,a=s>Xs?s:(a-.13793103448275862)/7.787,o=u>Xs?u:(o-.13793103448275862)/7.787,a*=95.047,i*=100,o*=108.883,[a,i,o]},Et.lab.lch=function(e){const t=e[0],r=e[1],n=e[2];let a;a=Math.atan2(n,r)*360/2/Math.PI,a<0&&(a+=360);const o=Math.sqrt(r*r+n*n);return[t,o,a]},Et.lch.lab=function(e){const t=e[0],r=e[1],a=e[2]/360*2*Math.PI,i=r*Math.cos(a),o=r*Math.sin(a);return[t,i,o]},Et.rgb.ansi16=function(e,t=null){const[r,n,a]=e;let i=t===null?Et.rgb.hsv(e)[2]:t;if(i=Math.round(i/50),i===0)return 30;let o=30+(Math.round(a/255)<<2|Math.round(n/255)<<1|Math.round(r/255));return i===2&&(o+=60),o},Et.hsv.ansi16=function(e){return Et.rgb.ansi16(Et.hsv.rgb(e),e[2])},Et.rgb.ansi256=function(e){const t=e[0],r=e[1],n=e[2];return t>>4===r>>4&&r>>4===n>>4?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)},Et.ansi16.rgb=function(e){e=e[0];let t=e%10;if(t===0||t===7)return e>50&&(t+=3.5),t=t/10.5*255,[t,t,t];const r=(Math.trunc(e>50)+1)*.5,n=(t&1)*r*255,a=(t>>1&1)*r*255,i=(t>>2&1)*r*255;return[n,a,i]},Et.ansi256.rgb=function(e){if(e=e[0],e>=232){const i=(e-232)*10+8;return[i,i,i]}e-=16;let t;const r=Math.floor(e/36)/5*255,n=Math.floor((t=e%36)/6)/5*255,a=t%6/5*255;return[r,n,a]},Et.rgb.hex=function(e){const r=(((Math.round(e[0])&255)<<16)+((Math.round(e[1])&255)<<8)+(Math.round(e[2])&255)).toString(16).toUpperCase();return"000000".slice(r.length)+r},Et.hex.rgb=function(e){const t=e.toString(16).match(/[a-f\d]{6}|[a-f\d]{3}/i);if(!t)return[0,0,0];let r=t[0];t[0].length===3&&(r=[...r].map(l=>l+l).join(""));const n=Number.parseInt(r,16),a=n>>16&255,i=n>>8&255,o=n&255;return[a,i,o]},Et.rgb.hcg=function(e){const t=e[0]/255,r=e[1]/255,n=e[2]/255,a=Math.max(Math.max(t,r),n),i=Math.min(Math.min(t,r),n),o=a-i;let l;const s=o<1?i/(1-o):0;return o<=0?l=0:a===t?l=(r-n)/o%6:a===r?l=2+(n-t)/o:l=4+(t-r)/o,l/=6,l%=1,[l*360,o*100,s*100]},Et.hsl.hcg=function(e){const t=e[1]/100,r=e[2]/100,n=r<.5?2*t*r:2*t*(1-r);let a=0;return n<1&&(a=(r-.5*n)/(1-n)),[e[0],n*100,a*100]},Et.hsv.hcg=function(e){const t=e[1]/100,r=e[2]/100,n=t*r;let a=0;return n<1&&(a=(r-n)/(1-n)),[e[0],n*100,a*100]},Et.hcg.rgb=function(e){const t=e[0]/360,r=e[1]/100,n=e[2]/100;if(r===0)return[n*255,n*255,n*255];const a=[0,0,0],i=t%1*6,o=i%1,l=1-o;let s=0;switch(Math.floor(i)){case 0:{a[0]=1,a[1]=o,a[2]=0;break}case 1:{a[0]=l,a[1]=1,a[2]=0;break}case 2:{a[0]=0,a[1]=1,a[2]=o;break}case 3:{a[0]=0,a[1]=l,a[2]=1;break}case 4:{a[0]=o,a[1]=0,a[2]=1;break}default:a[0]=1,a[1]=0,a[2]=l}return s=(1-r)*n,[(r*a[0]+s)*255,(r*a[1]+s)*255,(r*a[2]+s)*255]},Et.hcg.hsv=function(e){const t=e[1]/100,r=e[2]/100,n=t+r*(1-t);let a=0;return n>0&&(a=t/n),[e[0],a*100,n*100]},Et.hcg.hsl=function(e){const t=e[1]/100,n=e[2]/100*(1-t)+.5*t;let a=0;return n>0&&n<.5?a=t/(2*n):n>=.5&&n<1&&(a=t/(2*(1-n))),[e[0],a*100,n*100]},Et.hcg.hwb=function(e){const t=e[1]/100,r=e[2]/100,n=t+r*(1-t);return[e[0],(n-t)*100,(1-n)*100]},Et.hwb.hcg=function(e){const t=e[1]/100,n=1-e[2]/100,a=n-t;let i=0;return a<1&&(i=(n-a)/(1-a)),[e[0],a*100,i*100]},Et.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]},Et.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]},Et.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]},Et.gray.hsl=function(e){return[0,0,e[0]]},Et.gray.hsv=Et.gray.hsl,Et.gray.hwb=function(e){return[0,100,e[0]]},Et.gray.cmyk=function(e){return[0,0,0,e[0]]},Et.gray.lab=function(e){return[e[0],0,0]},Et.gray.hex=function(e){const t=Math.round(e[0]/100*255)&255,n=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".slice(n.length)+n},Et.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]};function _K(){const e={},t=Object.keys(Et);for(let{length:r}=t,n=0;n<r;n++)e[t[n]]={distance:-1,parent:null};return e}function DK(e){const t=_K(),r=[e];for(t[e].distance=0;r.length>0;){const n=r.pop(),a=Object.keys(Et[n]);for(let{length:i}=a,o=0;o<i;o++){const l=a[o],s=t[l];s.distance===-1&&(s.distance=t[n].distance+1,s.parent=n,r.unshift(l))}}return t}function NK(e,t){return function(r){return t(e(r))}}function RK(e,t){const r=[t[e].parent,e];let n=Et[t[e].parent][e],a=t[e].parent;for(;t[a].parent;)r.unshift(t[a].parent),n=NK(Et[t[a].parent][a],n),a=t[a].parent;return n.conversion=r,n}function FK(e){const t=DK(e),r={},n=Object.keys(t);for(let{length:a}=n,i=0;i<a;i++){const o=n[i];t[o].parent!==null&&(r[o]=RK(o,t))}return r}const la={},ZK=Object.keys(Et);function GK(e){const t=function(...r){const n=r[0];return n==null?n:(n.length>1&&(r=n),e(r))};return"conversion"in e&&(t.conversion=e.conversion),t}function LK(e){const t=function(...r){const n=r[0];if(n==null)return n;n.length>1&&(r=n);const a=e(r);if(typeof a=="object")for(let{length:i}=a,o=0;o<i;o++)a[o]=Math.round(a[o]);return a};return"conversion"in e&&(t.conversion=e.conversion),t}for(const e of ZK){la[e]={},Object.defineProperty(la[e],"channels",{value:Et[e].channels}),Object.defineProperty(la[e],"labels",{value:Et[e].labels});const t=FK(e),r=Object.keys(t);for(const n of r){const a=t[n];la[e][n]=LK(a),la[e][n].raw=GK(a)}}const x8=["keyword","gray","hex"],jv={};for(const e of Object.keys(la))jv[[...la[e].labels].sort().join("")]=e;const v1={};function Tn(e,t){if(!(this instanceof Tn))return new Tn(e,t);if(t&&t in x8&&(t=null),t&&!(t in la))throw new Error("Unknown model: "+t);let r,n;if(e==null)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(e instanceof Tn)this.model=e.model,this.color=[...e.color],this.valpha=e.valpha;else if(typeof e=="string"){const a=$n.get(e);if(a===null)throw new Error("Unable to parse color from string: "+e);this.model=a.model,n=la[this.model].channels,this.color=a.value.slice(0,n),this.valpha=typeof a.value[n]=="number"?a.value[n]:1}else if(e.length>0){this.model=t||"rgb",n=la[this.model].channels;const a=Array.prototype.slice.call(e,0,n);this.color=Hv(a,n),this.valpha=typeof e[n]=="number"?e[n]:1}else if(typeof e=="number")this.model="rgb",this.color=[e>>16&255,e>>8&255,e&255],this.valpha=1;else{this.valpha=1;const a=Object.keys(e);"alpha"in e&&(a.splice(a.indexOf("alpha"),1),this.valpha=typeof e.alpha=="number"?e.alpha:0);const i=a.sort().join("");if(!(i in jv))throw new Error("Unable to parse color from object: "+JSON.stringify(e));this.model=jv[i];const{labels:o}=la[this.model],l=[];for(r=0;r<o.length;r++)l.push(e[o[r]]);this.color=Hv(l)}if(v1[this.model])for(n=la[this.model].channels,r=0;r<n;r++){const a=v1[this.model][r];a&&(this.color[r]=a(this.color[r]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}Tn.prototype={toString(){return this.string()},toJSON(){return this[this.model]()},string(e){let t=this.model in $n.to?this:this.rgb();t=t.round(typeof e=="number"?e:1);const r=t.valpha===1?t.color:[...t.color,this.valpha];return $n.to[t.model](...r)},percentString(e){const t=this.rgb().round(typeof e=="number"?e:1),r=t.valpha===1?t.color:[...t.color,this.valpha];return $n.to.rgb.percent(...r)},array(){return this.valpha===1?[...this.color]:[...this.color,this.valpha]},object(){const e={},{channels:t}=la[this.model],{labels:r}=la[this.model];for(let n=0;n<t;n++)e[r[n]]=this.color[n];return this.valpha!==1&&(e.alpha=this.valpha),e},unitArray(){const e=this.rgb().color;return e[0]/=255,e[1]/=255,e[2]/=255,this.valpha!==1&&e.push(this.valpha),e},unitObject(){const e=this.rgb().object();return e.r/=255,e.g/=255,e.b/=255,this.valpha!==1&&(e.alpha=this.valpha),e},round(e){return e=Math.max(e||0,0),new Tn([...this.color.map(zK(e)),this.valpha],this.model)},alpha(e){return e!==void 0?new Tn([...this.color,Math.max(0,Math.min(1,e))],this.model):this.valpha},red:yn("rgb",0,Jn(255)),green:yn("rgb",1,Jn(255)),blue:yn("rgb",2,Jn(255)),hue:yn(["hsl","hsv","hsl","hwb","hcg"],0,e=>(e%360+360)%360),saturationl:yn("hsl",1,Jn(100)),lightness:yn("hsl",2,Jn(100)),saturationv:yn("hsv",1,Jn(100)),value:yn("hsv",2,Jn(100)),chroma:yn("hcg",1,Jn(100)),gray:yn("hcg",2,Jn(100)),white:yn("hwb",1,Jn(100)),wblack:yn("hwb",2,Jn(100)),cyan:yn("cmyk",0,Jn(100)),magenta:yn("cmyk",1,Jn(100)),yellow:yn("cmyk",2,Jn(100)),black:yn("cmyk",3,Jn(100)),x:yn("xyz",0,Jn(95.047)),y:yn("xyz",1,Jn(100)),z:yn("xyz",2,Jn(108.833)),l:yn("lab",0,Jn(100)),a:yn("lab",1),b:yn("lab",2),keyword(e){return e!==void 0?new Tn(e):la[this.model].keyword(this.color)},hex(e){return e!==void 0?new Tn(e):$n.to.hex(...this.rgb().round().color)},hexa(e){if(e!==void 0)return new Tn(e);const t=this.rgb().round().color;let r=Math.round(this.valpha*255).toString(16).toUpperCase();return r.length===1&&(r="0"+r),$n.to.hex(...t)+r},rgbNumber(){const e=this.rgb().color;return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255},luminosity(){const e=this.rgb().color,t=[];for(const[r,n]of e.entries()){const a=n/255;t[r]=a<=.04045?a/12.92:((a+.055)/1.055)**2.4}return .2126*t[0]+.7152*t[1]+.0722*t[2]},contrast(e){const t=this.luminosity(),r=e.luminosity();return t>r?(t+.05)/(r+.05):(r+.05)/(t+.05)},level(e){const t=this.contrast(e);return t>=7?"AAA":t>=4.5?"AA":""},isDark(){const e=this.rgb().color;return(e[0]*2126+e[1]*7152+e[2]*722)/1e4<128},isLight(){return!this.isDark()},negate(){const e=this.rgb();for(let t=0;t<3;t++)e.color[t]=255-e.color[t];return e},lighten(e){const t=this.hsl();return t.color[2]+=t.color[2]*e,t},darken(e){const t=this.hsl();return t.color[2]-=t.color[2]*e,t},saturate(e){const t=this.hsl();return t.color[1]+=t.color[1]*e,t},desaturate(e){const t=this.hsl();return t.color[1]-=t.color[1]*e,t},whiten(e){const t=this.hwb();return t.color[1]+=t.color[1]*e,t},blacken(e){const t=this.hwb();return t.color[2]+=t.color[2]*e,t},grayscale(){const e=this.rgb().color,t=e[0]*.3+e[1]*.59+e[2]*.11;return Tn.rgb(t,t,t)},fade(e){return this.alpha(this.valpha-this.valpha*e)},opaquer(e){return this.alpha(this.valpha+this.valpha*e)},rotate(e){const t=this.hsl();let r=t.color[0];return r=(r+e)%360,r=r<0?360+r:r,t.color[0]=r,t},mix(e,t){if(!e||!e.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof e);const r=e.rgb(),n=this.rgb(),a=t===void 0?.5:t,i=2*a-1,o=r.alpha()-n.alpha(),l=((i*o===-1?i:(i+o)/(1+i*o))+1)/2,s=1-l;return Tn.rgb(l*r.red()+s*n.red(),l*r.green()+s*n.green(),l*r.blue()+s*n.blue(),r.alpha()*a+n.alpha()*(1-a))}};for(const e of Object.keys(la)){if(x8.includes(e))continue;const{channels:t}=la[e];Tn.prototype[e]=function(...r){return this.model===e?new Tn(this):r.length>0?new Tn(r,e):new Tn([...TK(la[this.model][e].raw(this.color)),this.valpha],e)},Tn[e]=function(...r){let n=r[0];return typeof n=="number"&&(n=Hv(r,t)),new Tn(n,e)}}function QK(e,t){return Number(e.toFixed(t))}function zK(e){return function(t){return QK(t,e)}}function yn(e,t,r){e=Array.isArray(e)?e:[e];for(const n of e)(v1[n]||(v1[n]=[]))[t]=r;return e=e[0],function(n){let a;return n!==void 0?(r&&(n=r(n)),a=this[e](),a.color[t]=n,a):(a=this[e]().color[t],r&&(a=r(a)),a)}}function Jn(e){return function(t){return Math.max(0,Math.min(e,t))}}function TK(e){return Array.isArray(e)?e:[e]}function Hv(e,t){for(let r=0;r<t;r++)typeof e[r]!="number"&&(e[r]=0);return e}var y1=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Uv={exports:{}};/**
|
|
108
108
|
* @license
|
|
@@ -145,7 +145,7 @@ list should be an Array.`),L.length===0)return new C(0);if(L.length===1)return L
|
|
|
145
145
|
`).slice(0,n.maxLines??1/0).map(ue=>ue.slice(0,n.maxLineLength??1/0)).join(`
|
|
146
146
|
`).slice(0,n.maxLength??1/0));c.watch(o,ee=>{Ia(ee,h.value)||(l.value=ee)}),c.watch(l,ee=>{if(typeof ee=="object"&&ee!==null){const ne=v8(ee,0,n.maxLength);o.value=ne}else{const ue=String(ee).split(`
|
|
147
147
|
`);o.value!==h.value&&(o.value=h.value),n.maxLineLength!==1/0&&n.maxLineLength!==null&&(s.value=ue.filter(be=>be.length>(n.maxLineLength??1/0)).map(be=>({index:ue.indexOf(be),length:be.length}))),n.maxLines!==1/0&&n.maxLines!==null&&(u.value=Math.max(0,String(ee).split(`
|
|
148
|
-
`).length-(n.maxLines??1/0))),n.maxLength!==1/0&&n.maxLength!==null&&(f.value=String(ee).length-n.maxLength)}});const m=c.computed({get(){return B2(p.value)},set(ee){n.richtext?l.value=[{text:ee,format:{}}]:l.value=ee}}),p=c.computed({get(){return y8(o.value)},set(ee){n.richtext?l.value=ee:l.value=B2(ee)}}),C=c.ref(),v=Uo("bx-input-count"),I=c.computed(()=>n.state==="error"||d.value),y=c.computed(()=>n.showWordCount?v:void 0),x=c.ref();let E;const k=c.ref(!1);c.watch(k,()=>{k.value?a("focus"):a("blur",E)});function S(ee){k.value=!0}function B(ee){E=ee,k.value=!1}c.watch(x,(ee,ne)=>{ee&&(ne&&(ne.removeEventListener("focus",S),ne.removeEventListener("blur",B)),ee.addEventListener("focus",S),ee.addEventListener("blur",B))});const N=c.computed(()=>String(Math.max(1,n.maxRows)));function D(){if(n.type!=="textarea")return;const ee=x.value;!ee||ee.tagName!=="TEXTAREA"||(ee.style.height="auto",ee.style.height=`${ee.scrollHeight}px`)}c.watch([x,m,()=>n.type,()=>n.minHeight,()=>n.maxHeight,N],async()=>{await c.nextTick(),D()},{immediate:!0,flush:"post"}),window.addEventListener("blur",B);const Q=()=>{var ee;n.disabled||n.readonly||(ee=x.value)==null||ee.focus()},z=ee=>{ee.key==="Enter"&&a("enter",ee)},A=c.ref(""),P=c.computed(()=>{const ee=n.richtext?A.value:l.value;return[...new Intl.Segmenter().segment(ee)].length}),W=c.computed(()=>n.richtext?A.value.length>0:String(l.value).length>0);function O(ee){return ee.en}const R=c.ref(),Z=c.ref({start:0,length:0}),G=c.computed({get(){var ae,L;const ee=(ae=C.value)==null?void 0:ae.richTextInstance;if(!ee)return;const ue=ee.resolveFeatures(Z.value.start,Z.value.length).flat(),be=X(ue);if(be!==void 0)return be===null?"multiple":(L=M.value.find(T=>Ia(T.value,be)))==null?void 0:L.value},set(ee){var ue;const ne=(ue=C.value)==null?void 0:ue.richTextInstance;ne&&ee!=="multiple"&&(ee===void 0?ne.applyFormat(Z.value.start,Z.value.length,{}):(ne.resolveFeatures(Z.value.start,Z.value.length),ne.applyFormat(Z.value.start,Z.value.length,ee)),J.value.closePopover())}});c.watch(R,()=>{R.value&&(Z.value=R.value)});const M=c.computed(()=>n.richtext?[{label:O(n.richtext.noStyleLabel),value:void 0},...n.richtext.options.map((ee,ne)=>({label:ee.label,value:ee.style}))]:[]),J=c.ref();function X(ee){let ne=!1,ue;for(const be of ee)if(!ue)ue=be.format;else if(!Ia(ue,be.format)){ne=!0;break}return ne?null:ue}function re(){n.richtext?p.value=[{text:"",format:{}}]:o.value=""}return c.onUnmounted(()=>{s.value=[],u.value=0,f.value=0}),t({inputEelRef:x,setFocus(ee){var ne,ue;ee?(ne=x.value)==null||ne.focus():(ue=x.value)==null||ue.blur()}}),(ee,ne)=>(c.openBlock(),c.createElementBlock("div",{class:c.normalizeClass(["bx-input",{readonly:e.readonly,bordered:e.bordered,"is-textarea":e.type==="textarea"}])},[e.richtext?(c.openBlock(),c.createBlock($s,{key:0,ref_key:"bxSelectRef",ref:J,class:"select-richtext",modelValue:G.value,"onUpdate:modelValue":ne[0]||(ne[0]=ue=>G.value=ue),options:M.value,disabled:!Z.value||Z.value.length===0},{label:c.withCtx(({label:ue})=>[c.createTextVNode(c.toDisplayString(ue??"Multiple"),1)]),_:1},8,["modelValue","options","disabled"])):c.createCommentVNode("",!0),c.createElementVNode("div",{class:c.normalizeClass(["bx-input-wrapper",{focus:k.value&&!e.readonly,round:e.round,ring:e.ring,bordered:e.bordered,["size-"+e.size]:e.size,disabled:e.disabled,readonly:e.readonly,"rich-text":e.richtext,error:d.value,"state-active":e.state==="active","state-success":e.state==="success","state-error":e.state==="error","state-warning":e.state==="warning",ghost:e.ghost}]),style:c.normalizeStyle({"--max-height":e.richtext?"auto":e.maxHeight,"--min-height":e.minHeight,"--textarea-max-lines":N.value}),onClick:Q},[i.prefix?(c.openBlock(),c.createElementBlock("div",Aq,[c.renderSlot(ee.$slots,"prefix",{},void 0,!0)])):c.createCommentVNode("",!0),c.createElementVNode("div",{class:c.normalizeClass(["bx-input__input",{"swiper-no-swiping":k.value,"has-prefix":!!i.prefix}])},[e.richtext?(c.openBlock(),c.createBlock(N8,{key:0,ref_key:"bxRichTextInstance",ref:C,modelValue:p.value,"onUpdate:modelValue":ne[1]||(ne[1]=ue=>p.value=ue),selection:R.value,"onUpdate:selection":ne[2]||(ne[2]=ue=>R.value=ue),"raw-text":A.value,"onUpdate:rawText":ne[3]||(ne[3]=ue=>A.value=ue),focus:k.value,"onUpdate:focus":ne[4]||(ne[4]=ue=>k.value=ue),"aria-label":e.ariaLabelledby?void 0:e.ariaLabel,"aria-labelledby":e.ariaLabelledby},null,8,["modelValue","selection","raw-text","focus","aria-label","aria-labelledby"])):(c.openBlock(),c.createElementBlock(c.Fragment,{key:1},[e.type==="textarea"?c.withDirectives((c.openBlock(),c.createElementBlock("textarea",{key:0,ref_key:"inputEelRef",ref:x,rows:"1",class:c.normalizeClass({resizeable:e.resizeable}),"onUpdate:modelValue":ne[5]||(ne[5]=ue=>m.value=ue),placeholder:e.placeholder,onKeydown:z,readonly:e.readonly,title:e.readonly?e.readonlyMessage:void 0,"aria-label":e.ariaLabelledby?void 0:e.ariaLabel,"aria-labelledby":e.ariaLabelledby,"aria-invalid":I.value?"true":void 0,"aria-describedby":y.value},null,42,mq)),[[c.vModelText,m.value]]):c.withDirectives((c.openBlock(),c.createElementBlock("input",{key:1,ref_key:"inputEelRef",ref:x,"onUpdate:modelValue":ne[6]||(ne[6]=ue=>o.value=ue),readonly:e.readonly,placeholder:e.placeholder,type:e.type,onKeydown:z,title:e.readonly?e.readonlyMessage:void 0,"aria-label":e.ariaLabelledby?void 0:e.ariaLabel,"aria-labelledby":e.ariaLabelledby,"aria-invalid":I.value?"true":void 0,"aria-describedby":y.value},null,40,pq)),[[c.vModelDynamic,o.value]])],64))],2),i.suffix||e.clearable||e.showWordCount||i.loading||e.loading||d.value?(c.openBlock(),c.createElementBlock("div",{key:1,"data-suffix":!!i.suffix,class:"bx-input__suffix"},[i.loading||e.loading?(c.openBlock(),c.createElementBlock("div",Cq,[i.loading?c.renderSlot(ee.$slots,"loading",{},void 0,!0,0):(c.openBlock(),c.createBlock(Pl,{key:1,size:"small"}))])):c.createCommentVNode("",!0),c.renderSlot(ee.$slots,"suffix",{},void 0,!0),e.showWordCount?(c.openBlock(),c.createElementBlock("div",{key:1,id:c.unref(v),class:"bx-input__word-count"},[e.maxLength&&e.maxLength!==1/0?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[c.createTextVNode(c.toDisplayString(P.value)+" / "+c.toDisplayString(e.maxLength),1)],64)):(c.openBlock(),c.createElementBlock(c.Fragment,{key:1},[c.createTextVNode(c.toDisplayString(P.value),1)],64))],8,vq)):c.createCommentVNode("",!0),d.value?(c.openBlock(),c.createBlock(I1,{key:2,trigger:"hover","custom-popover-classes":["text-overflow-tooltip"],"allowed-placements":["bottom","top","right"]},{trigger:c.withCtx(()=>[c.createVNode(Lt,{circle:"",size:"tiny",secondary:"",state:"error",class:"errors-button","aria-label":"Show input warnings"},{icon:c.withCtx(()=>[c.createVNode(At,null,{default:c.withCtx(()=>[c.createVNode(c.unref(LB))]),_:1})]),_:1})]),content:c.withCtx(()=>{var ue,be,ae;return[c.createElementVNode("div",yq,[(ue=g.value)!=null&&ue.overflowingCharacters?(c.openBlock(),c.createElementBlock("div",Iq,[c.createElementVNode("span",wq,c.toDisplayString(e.maxLength+f.value)+" / "+c.toDisplayString(e.maxLength),1),ne[7]||(ne[7]=c.createTextVNode(" characters ",-1))])):c.createCommentVNode("",!0),(be=g.value)!=null&&be.overlowingLines?(c.openBlock(),c.createElementBlock("div",xq,[c.createElementVNode("span",Eq,c.toDisplayString(e.maxLines+u.value)+" / "+c.toDisplayString(e.maxLines),1),ne[8]||(ne[8]=c.createTextVNode(" lines ",-1))])):c.createCommentVNode("",!0),(ae=g.value)!=null&&ae.lineOverflows?(c.openBlock(),c.createElementBlock("div",Bq,[ne[9]||(ne[9]=c.createTextVNode(" Lines are too long: ",-1)),c.createElementVNode("ul",null,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(g.value.lineOverflows,({index:L,length:T})=>(c.openBlock(),c.createElementBlock("li",null,[c.createElementVNode("span",kq,"("+c.toDisplayString(L+1)+")",1),c.createElementVNode("span",Sq,c.toDisplayString(T)+" / "+c.toDisplayString(e.maxLineLength),1)]))),256))])])):c.createCommentVNode("",!0)])]}),_:1})):c.createCommentVNode("",!0),e.clearable&&W.value?(c.openBlock(),c.createElementBlock("button",{key:3,type:"button",class:"bx-input__clear-btn",onClick:c.withModifiers(re,["stop"]),title:"Clear","aria-label":"Clear"},[c.createVNode(At,{size:12},{default:c.withCtx(()=>[c.createVNode(c.unref(ss))]),_:1})])):c.createCommentVNode("",!0)],8,bq)):c.createCommentVNode("",!0)],6)],2))}}),[["__scopeId","data-v-19f6427a"]]);function $v(e){return new URLSearchParams(Object.fromEntries(Object.entries(e).map(([t,r])=>[t,String(r)]))).toString()}function _q(e){const t=c.ref([]),r=c.ref(0);let n=25;async function a(i,o){o=o??t.value.length??0;const s=await(await fetch(`https://api.pexels.com/v1/search?${$v({page:Math.ceil(o/n),query:i,per_page:n})}`,{headers:{Authorization:e}})).json();if("error"in s)throw new Error(s.error);r.value=s.total_results,t.value=[...t.value.slice(0,o),...s.photos]}return{photos:t,total:r,searchPhotos:a}}const Dq=c.defineComponent({__name:"LazyLoadingItemWrapper",emits:["update:visible"],setup(e,{emit:t}){c.ref();const r=t,n=c.ref(),a=hW(n);return r("update:visible",a.value),c.watch(a,(i,o)=>{!o&&i&&r("update:visible",a.value)}),(i,o)=>(c.openBlock(),c.createElementBlock("div",{class:"item-wrapper",ref_key:"itemWrapperRef",ref:n},[c.renderSlot(i.$slots,"default")],512))}}),Nq=c.defineComponent({__name:"LazyLoading",props:{items:{},total:{},fetch:{type:Function},visibleTriggerOffset:{}},setup(e){c.ref();const t=e;t.fetch(0);const r=(n,a)=>{a&&n>=t.items.length-t.visibleTriggerOffset-1&&t.total>t.items.length&&t.fetch()};return(n,a)=>(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(e.items,(i,o)=>(c.openBlock(),c.createBlock(Dq,{key:o,class:"item-wrapper",item:i,index:o,"onUpdate:visible":l=>r(o,l)},{default:c.withCtx(()=>[c.renderSlot(n.$slots,"item",{item:i,index:o})]),_:2},1032,["item","index","onUpdate:visible"]))),128))}}),Rq={class:"bx-empty-icon"},Fq={key:1,viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Zq={key:0,class:"bx-empty-description"},Gq={key:1,class:"bx-empty-extra"},Jv=ht(c.defineComponent({__name:"BxEmpty",props:{description:{default:"No Data"},size:{default:"medium"}},setup(e){const t=c.useSlots();return(r,n)=>(c.openBlock(),c.createElementBlock("div",{class:c.normalizeClass(["bx-empty",{[`size-${e.size}`]:!0}])},[c.createElementVNode("div",Rq,[t.icon?c.renderSlot(r.$slots,"icon",{},void 0,!0,0):(c.openBlock(),c.createElementBlock("svg",Fq,[...n[0]||(n[0]=[c.createElementVNode("path",{d:"M26 7.5C26 11.0899 23.0899 14 19.5 14C15.9101 14 13 11.0899 13 7.5C13 3.91015 15.9101 1 19.5 1C23.0899 1 26 3.91015 26 7.5ZM14 7.5C14 3.91015 11.0899 1 7.5 1C3.91015 1 1 3.91015 1 7.5C1 11.0899 3.91015 14 7.5 14C11.0899 14 14 11.0899 14 7.5ZM14 19.5C14 15.9101 11.0899 13 7.5 13C3.91015 13 1 15.9101 1 19.5C1 23.0899 3.91015 26 7.5 26C11.0899 26 14 23.0899 14 19.5Z",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round",opacity:"0.4"},null,-1),c.createElementVNode("circle",{cx:"19.5",cy:"19.5",r:"6.5",stroke:"currentColor","stroke-width":"1.5","stroke-dasharray":"3 3",opacity:"0.25"},null,-1)])]))]),e.description||t.description?(c.openBlock(),c.createElementBlock("div",Zq,[t.description?c.renderSlot(r.$slots,"description",{},void 0,!0,0):(c.openBlock(),c.createElementBlock(c.Fragment,{key:1},[c.createTextVNode(c.toDisplayString(e.description),1)],64))])):c.createCommentVNode("",!0),t.default?(c.openBlock(),c.createElementBlock("div",Gq,[c.renderSlot(r.$slots,"default",{},void 0,!0)])):c.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-d66bc5e4"]]),Lq={class:"image-library-pexels"},Qq={class:"search-bar-wrapper"},zq={key:0,class:"photos"},Tq=["onClick"],Wq=["src"],Mq={key:0,class:"loading-wrapper"},Oq={key:1,class:"loading-wrapper"},Yq=c.defineComponent({__name:"Pexels",props:{apiKey:{},width:{},height:{},uploadContext:{},uploadImageAsset:{type:Function}},emits:["select"],setup(e,{emit:t}){const r=Yl(),n=e,a=t,i=c.ref("city"),{searchPhotos:o,photos:l,total:s}=_q(n.apiKey),u=c.ref(),f=c.ref(!1);async function g(){i.value.length>0&&(f.value=!0,s.value=25,l.value=[],await o(i.value),u.value=i.value,f.value=!1)}async function d(p,C){await o(i.value,p)}const h=c.ref();async function m(p){h.value=p.id;const C=await n.uploadImageAsset({blob:await fetch(r(p.src.original)).then(v=>v.blob()),context:n.uploadContext,width:n.width,height:n.height,key:`pexels-${p.id}`,name:p.id.toString(),onProgress(v){console.log("upload progress",v)}});h.value=void 0,a("select",C.src)}return(p,C)=>(c.openBlock(),c.createElementBlock("div",Lq,[c.createElementVNode("header",null,[c.createElementVNode("div",Qq,[c.createVNode(bu,{modelValue:i.value,"onUpdate:modelValue":C[0]||(C[0]=v=>i.value=v),round:"",placeholder:"Search...",size:"medium",onEnter:g},null,8,["modelValue"]),c.createVNode(Lt,{active:"",onClick:g},{default:c.withCtx(()=>[...C[1]||(C[1]=[c.createTextVNode("Search",-1)])]),_:1})])]),c.createElementVNode("main",null,[u.value?(c.openBlock(),c.createElementBlock("div",zq,[c.createVNode(Nq,{items:c.unref(l),total:c.unref(s),fetch:d,"visible-trigger-offset":0},{item:c.withCtx(({item:v})=>[(c.openBlock(),c.createElementBlock("div",{key:v.id,class:"photo-wrapper",onClick:I=>m(v)},[c.createElementVNode("div",{class:c.normalizeClass(["preview",{loading:h.value===v.id}])},[c.createElementVNode("img",{src:c.unref(r)(v.src.tiny)},null,8,Wq),h.value===v.id?(c.openBlock(),c.createElementBlock("div",Mq,[c.createVNode(Pl)])):c.createCommentVNode("",!0)],2)],8,Tq))]),_:1},8,["items","total"])])):f.value?(c.openBlock(),c.createElementBlock("div",Oq,[c.createVNode(Pl)])):(c.openBlock(),c.createBlock(Jv,{key:2,description:"Search for images on Pexels"},{icon:c.withCtx(()=>[c.createVNode(c.unref(M$))]),_:1}))])]))}});function Pq(e,t,r){return e.map(n=>({src:`https://shared-drive.bluepic.io/image?url=${encodeURIComponent(n["@microsoft.graph.downloadUrl"])}&w=${t}&h=${r}&fit=cover&quality=80&format=png`,key:n.id,width:n.image.width,height:n.image.height,previews:{small:{src:`https://shared-drive.bluepic.io/image?url=${encodeURIComponent(n["@microsoft.graph.downloadUrl"])}&h=200&fit=cover&quality=80&format=png`,width:n.image.width,height:n.image.height},medium:{src:`https://shared-drive.bluepic.io/image?url=${encodeURIComponent(n["@microsoft.graph.downloadUrl"])}&h=400&fit=cover&quality=80&format=png`,width:n.image.width,height:n.image.height}}}))}function Vq(e,t,r){return e.map(({thumbnailLink:n,webContentLink:a,sha256Checksum:i,imageMediaMetadata:o})=>({src:`https://shared-drive.bluepic.io/image?url=${encodeURIComponent(a)}&w=${t}&h=${r}&fit=cover&quality=80&format=png`,key:i,width:(o==null?void 0:o.width)??0,height:(o==null?void 0:o.height)??0,previews:{small:{src:`https://shared-drive.bluepic.io/image?url=${encodeURIComponent(n)}&h=200&fit=cover&quality=80&format=png`,width:(o==null?void 0:o.width)??0,height:(o==null?void 0:o.height)??0},medium:{src:`https://shared-drive.bluepic.io/image?url=${encodeURIComponent(n)}&h=400&fit=cover&quality=80&format=png`,width:(o==null?void 0:o.width)??0,height:(o==null?void 0:o.height)??0}}}))}function jq(e,t,r,n){const a=c.ref();return{sharedItems:a,fetchSharedDrive:async()=>{if(e==="onedrive"){const o=`https://shared-drive.bluepic.io/onedrive?${$v({sharing:t})}`,s=await(await fetch(o)).json();a.value=Pq(s.children,r,n)}else if(e==="googledrive"){const o=`https://shared-drive.bluepic.io/googledrive?${$v({sharing:t})}`,s=await(await fetch(o)).json();a.value=Vq(s.files,r,n)}}}}const Hq={class:"image-library-shared-drive"},Uq={key:0,class:"photos"},Xq=["onClick"],$q={class:"preview"},Jq=["src"],Kq={key:1,class:"loading-wrapper"},qq=ht(c.defineComponent({__name:"SharedDrive",props:{service:{},sharedUrl:{},width:{},height:{}},emits:["select"],setup(e,{emit:t}){const r=Yl(),n=e,a=t,{fetchSharedDrive:i,sharedItems:o}=jq(n.service,n.sharedUrl,n.width,n.height);i();function l(s){a("select",s.src)}return(s,u)=>(c.openBlock(),c.createElementBlock("div",Hq,[c.unref(o)?(c.openBlock(),c.createElementBlock("div",Uq,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(c.unref(o),f=>(c.openBlock(),c.createElementBlock("div",{class:"photo-wrapper",onClick:g=>l(f)},[c.createElementVNode("div",$q,[c.createElementVNode("img",{src:c.unref(r)(f.previews.small.src)},null,8,Jq)])],8,Xq))),256))])):(c.openBlock(),c.createElementBlock("div",Kq,[c.createVNode(Pl)]))]))}}),[["__scopeId","data-v-6b7dadc2"]]),eee={class:"image-library-custom"},tee=c.defineComponent({__name:"Custom",props:{controller:{},label:{},name:{},props:{}},setup(e){const t=e,r=import(t.controller),n=c.ref();return r.then(a=>{n.value=new a.default(t.props)}),(a,i)=>(c.openBlock(),c.createElementBlock("div",eee,"JAJAJA"))}}),ree={class:"image-library-wrapper"},nee={key:0,class:"nav-view-wrapper"},aee={class:"icon-wrapper"},iee={class:"label"},oee={key:1,class:"library-view-wrapper"},F8=ht(c.defineComponent({__name:"ImageLibraryWrapper",props:{options:{},activeKey:{},imageLibraries:{},convertTo:{},quality:{},width:{},height:{},bridge:{},field:{}},emits:["select","update:active-key"],setup(e,{emit:t}){const r=e,n=t,a=c.ref(r.activeKey);c.watch(a,()=>{r.activeKey!==a.value&&n("update:active-key",a.value)}),c.watch(()=>r.activeKey,()=>{r.activeKey!==a.value&&(a.value=r.activeKey)});function i(m){a.value=m}const o=c.computed(()=>{var m;return(m=r.imageLibraries.find(p=>p.type==="pexels"))==null?void 0:m.apiKey}),l=c.computed(()=>r.imageLibraries.find(m=>m.type==="sharedDrive"&&m.service===a.value).sharedUrl),s=c.computed(()=>{var m;return(m=r.imageLibraries.find(p=>p.type===a.value))==null?void 0:m.label}),u=c.computed(()=>{var m;return(m=r.imageLibraries.find(p=>p.type===a.value))==null?void 0:m.name}),f=c.computed(()=>{var m;return(m=r.imageLibraries.find(p=>p.type===a.value))==null?void 0:m.controller}),g=c.computed(()=>{var m;return(m=r.imageLibraries.find(p=>p.type===a.value))==null?void 0:m.props});function d(m){const p=m[0];p&&h(p.src)}function h(m){n("select",m)}return(m,p)=>(c.openBlock(),c.createElementBlock("div",ree,[c.createVNode(c.Transition,{name:"slide-library"},{default:c.withCtx(()=>[a.value===void 0?(c.openBlock(),c.createElementBlock("div",nee,[c.createElementVNode("div",{class:"image-library-source-navigation",style:c.normalizeStyle({"--options-length":e.options.length})},[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(r.options,C=>(c.openBlock(),c.createBlock(b1,{key:C.key,bordered:!0,onClick:v=>i(C.key)},{default:c.withCtx(()=>[c.createElementVNode("div",aee,[(c.openBlock(),c.createBlock(c.resolveDynamicComponent(C.icon)))]),c.createElementVNode("div",iee,c.toDisplayString(C.label),1)]),_:2},1032,["onClick"]))),128))],4)])):(c.openBlock(),c.createElementBlock("div",oee,[a.value==="upload"?(c.openBlock(),c.createBlock(kK,{key:0,width:e.width,height:e.height,"convert-to":e.convertTo,quality:e.quality,field:e.field,"handle-upload":e.bridge.handleUpload,onUpload:d},null,8,["width","height","convert-to","quality","field","handle-upload"])):a.value==="pexels"?(c.openBlock(),c.createBlock(Yq,{key:1,"api-key":o.value,width:e.width,height:e.height,"upload-image-asset":e.bridge.handleUpload,"upload-context":{field:e.field},onSelect:h},null,8,["api-key","width","height","upload-image-asset","upload-context"])):a.value==="googledrive"||a.value==="onedrive"||a.value==="icloud"||a.value==="dropbox"?(c.openBlock(),c.createBlock(qq,{key:2,service:a.value,"shared-url":l.value,width:e.width,height:e.height,onSelect:h},null,8,["service","shared-url","width","height"])):a.value==="custom"?(c.openBlock(),c.createBlock(tee,{key:3,label:s.value??"Custom Library",name:u.value,controller:f.value,props:g.value},null,8,["label","name","controller","props"])):c.createCommentVNode("",!0)]))]),_:1})]))}}),[["__scopeId","data-v-61c69114"]]),Z8=ht(c.defineComponent({__name:"BxList",props:{divider:{type:Boolean,default:!0}},setup(e){return c.useSlots(),(t,r)=>(c.openBlock(),c.createElementBlock("div",{class:c.normalizeClass(["bx-list",{"has-divider":e.divider}])},[c.renderSlot(t.$slots,"default",{},void 0,!0)],2))}}),[["__scopeId","data-v-8ef24162"]]),see={class:"bx-list-item__inner"},lee={key:0,class:"bx-list-item__prefix"},cee={class:"bx-list-item__content"},uee={key:1,class:"bx-list-item__suffix"},G8=ht(c.defineComponent({__name:"BxListItem",setup(e){const t=c.useSlots(),r=c.computed(()=>!!t.prefix),n=c.computed(()=>!!t.suffix);return(a,i)=>(c.openBlock(),c.createElementBlock("div",{class:c.normalizeClass(["bx-list-item",{"has-prefix":r.value,"has-suffix":n.value}])},[c.createElementVNode("div",see,[t.prefix?(c.openBlock(),c.createElementBlock("div",lee,[c.renderSlot(a.$slots,"prefix",{},void 0,!0)])):c.createCommentVNode("",!0),c.createElementVNode("div",cee,[c.renderSlot(a.$slots,"default",{},void 0,!0)]),t.suffix?(c.openBlock(),c.createElementBlock("div",uee,[c.renderSlot(a.$slots,"suffix",{},void 0,!0)])):c.createCommentVNode("",!0)])],2))}}),[["__scopeId","data-v-637e586e"]]),dee=["aria-label"],fee=["onClick"],gee={class:"icon"},hee={class:"label"},Aee={class:"pullup-menu"},mee={class:"icon"},N2=ht(c.defineComponent({__name:"BxDropdown",props:c.mergeModels({options:{},allowedPlacements:{},mobileLayout:{type:Boolean,default:!1},ariaLabel:{default:"Menu"}},{show:{type:Boolean,required:!1,default:!1},showModifiers:{}}),emits:c.mergeModels(["select"],["update:show"]),setup(e,{emit:t}){const r=e,n=t,a=c.useModel(e,"show");function i(I){a.value=!1,n("select",I.value)}const o=c.useSlots(),l=Uo("bx-dropdown-menu"),{setSlotRef:s,vNodes:u,slotElements:f}=x2(o.trigger);function g(I){(I.key==="ArrowDown"||I.key==="ArrowUp")&&(I.preventDefault(),a.value||(a.value=!0),C(0))}let d;c.watch(f,(I,y)=>{for(const E of y??[])E instanceof HTMLElement&&E.removeEventListener("keydown",g);d=void 0;const x=I[0];x instanceof HTMLElement&&(x.setAttribute("aria-haspopup","menu"),x.setAttribute("aria-controls",l),x.setAttribute("aria-expanded",String(a.value)),x.addEventListener("keydown",g),d=x)},{immediate:!0});const h=c.ref(0),m=[];function p(I,y){if(!I){m[y]=void 0;return}const x=I instanceof HTMLElement?I:I.$el;m[y]=x instanceof HTMLElement?x:void 0}function C(I){if(r.options.length===0)return;const y=(I+r.options.length)%r.options.length;h.value=y,c.nextTick(()=>{var x;return(x=m[y])==null?void 0:x.focus()})}function v(I){const y=r.options.length;if(y!==0)switch(I.key){case"ArrowDown":I.preventDefault(),C(h.value+1);break;case"ArrowUp":I.preventDefault(),C(h.value-1);break;case"Home":I.preventDefault(),C(0);break;case"End":I.preventDefault(),C(y-1);break;case"Enter":case" ":I.preventDefault(),i(r.options[h.value]),d==null||d.focus();break;case"Escape":I.preventDefault(),I.stopPropagation(),a.value=!1,d==null||d.focus();break;case"Tab":a.value=!1;break}}return c.watch(a,I=>{d==null||d.setAttribute("aria-expanded",String(I)),I&&(h.value=0,c.nextTick(()=>{var y;return(y=m[0])==null?void 0:y.focus()}))}),c.onUnmounted(()=>{d&&d.removeEventListener("keydown",g)}),(I,y)=>e.mobileLayout?(c.openBlock(),c.createBlock(mu,{key:0,show:a.value,"onUpdate:show":y[1]||(y[1]=x=>a.value=x),"disable-background-effect":"","custom-classes":["bx-dropdown-mobile-layout-popup"],closeable:!1},{trigger:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(c.unref(u),(x,E)=>(c.openBlock(),c.createBlock(c.resolveDynamicComponent(x),{key:E,ref_for:!0,ref:c.unref(s)(E)},null,512))),128))]),content:c.withCtx(()=>[c.createElementVNode("div",{class:c.normalizeClass(["pullup-menu-wrapper",{}])},[c.createElementVNode("div",{class:"pullup-menu",role:"menu","aria-label":e.ariaLabel},[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(e.options,x=>(c.openBlock(),c.createElementBlock("button",{type:"button",role:"menuitem",class:"select-button",onClick:E=>i(x)},[c.createElementVNode("div",gee,[c.createVNode(At,null,{default:c.withCtx(()=>[(c.openBlock(),c.createBlock(c.resolveDynamicComponent(x.icon)))]),_:2},1024)]),c.createElementVNode("div",hee,[o.optionLabel?c.renderSlot(I.$slots,"optionLabel",{option:x},void 0,!0,0):(c.openBlock(),c.createElementBlock(c.Fragment,{key:1},[c.createTextVNode(c.toDisplayString(x.label),1)],64))])],8,fee))),256))],8,dee),c.createElementVNode("div",Aee,[c.createElementVNode("button",{type:"button",class:"select-button","aria-label":"Close menu",onClick:y[0]||(y[0]=x=>a.value=!1)},[c.createElementVNode("div",mee,[c.createVNode(At,null,{default:c.withCtx(()=>[c.createVNode(c.unref(ss))]),_:1})]),y[3]||(y[3]=c.createElementVNode("div",{class:"label"},"Close",-1))])])])]),_:3},8,["show"])):(c.openBlock(),c.createBlock(K0,{key:1,show:a.value,"onUpdate:show":y[2]||(y[2]=x=>a.value=x),trigger:"click","allowed-placements":e.allowedPlacements??["bottom","top"],arrow:!0,"custom-styles":{},"custom-classes":["dropdown-popover"],"disable-background-effect":""},{trigger:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(c.unref(u),(x,E)=>(c.openBlock(),c.createBlock(c.resolveDynamicComponent(x),{key:E,ref_for:!0,ref:c.unref(s)(E)},null,512))),128))]),content:c.withCtx(()=>[c.createVNode(Z8,{id:c.unref(l),role:"menu","aria-label":e.ariaLabel,onKeydown:v},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(e.options,(x,E)=>(c.openBlock(),c.createBlock(G8,{key:x.value,ref_for:!0,ref:k=>p(k,E),role:"menuitem",tabindex:E===h.value?0:-1,onClick:k=>i(x)},c.createSlots({default:c.withCtx(()=>[o.optionLabel?c.renderSlot(I.$slots,"optionLabel",{option:x},void 0,!0,0):(c.openBlock(),c.createElementBlock(c.Fragment,{key:1},[c.createTextVNode(c.toDisplayString(x.label),1)],64))]),_:2},[x.icon?{name:"prefix",fn:c.withCtx(()=>[c.createVNode(At,null,{default:c.withCtx(()=>[(c.openBlock(),c.createBlock(c.resolveDynamicComponent(x.icon)))]),_:2},1024)]),key:"0"}:void 0]),1032,["tabindex","onClick"]))),128))]),_:3},8,["id","aria-label"])]),_:3},8,["show","allowed-placements"]))}}),[["__scopeId","data-v-f3fd4a7e"]]);function q0(e){return new Promise(function(t,r){if(typeof e!="string"&&!(e instanceof Blob)){r({err:"no image source"});return}const n=new Image;n.addEventListener("load",a=>{t({width:n.width,height:n.height,ratio:n.height/n.width})}),n.addEventListener("error",()=>r({err:"image corrupted"})),n.src=typeof e=="string"?e:URL.createObjectURL(e)})}function L8({height:e,left:t,top:r,width:n},a,i){const o=1/Math.max((n??0)/a,(e??0)/i),l=[Math.min(1,xo(Math.max(1e-6,t??0)/(a-(n??0)),6)),Math.min(1,xo(Math.max(1e-6,r??0)/(i-(e??0)),6))],s=[Math.max(-1,Math.min(1,(l[0]-.5)*2)),Math.max(-1,Math.min(1,(l[1]-.5)*2))];return{scale:o,innerPos:s}}function R2(e,t,r,n){const a=e.innerPos[0]/2+.5,i=e.innerPos[1]/2+.5,o=t/r>n?r*n:t,l=t/r>n?r:t/n,s=o/e.scale,u=l/e.scale,f=t-s,g=r-u,d=f*a,h=g*i;return{left:d,top:h,width:s,height:u}}var pee=Object.defineProperty,bee=(e,t,r)=>t in e?pee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,wa=(e,t,r)=>bee(e,typeof t!="symbol"?t+"":t,r);function Cee(e){return e*Math.PI/180}function Q8(e,t,r){return Math.min(Math.max(e,t),r)}function F2(e,t,r){const[n,a]=e,[i,o]=t,l=Math.cos(r)*(n-i)-Math.sin(r)*(a-o)+i,s=Math.sin(r)*(n-i)+Math.cos(r)*(a-o)+o;return[l,s]}function vee(e){return e.deltaMode===0}let yee=class extends EventTarget{constructor(t,r,n,a,i,o,l=.1,s=10,u=!1,f=!0){super(),wa(this,"wrapperBounds",{x:0,y:0,width:100,height:100}),wa(this,"canvasBounds",{x:0,y:0,width:100,height:100}),wa(this,"translateSpeed",1),wa(this,"zoomSpeed",1),wa(this,"translateSpeedAppleTrackpad",1),wa(this,"zoomSpeedAppleTrackpad",1),wa(this,"isGestureActive",!1),wa(this,"roElement",null),wa(this,"roCanvas",null),wa(this,"ancestorMotionCleanup",null),wa(this,"gestureStartRotate",0),wa(this,"dragStart",null),wa(this,"dragStartFrozenX",null),wa(this,"dragStartFrozenY",null),wa(this,"touchStarts",null),wa(this,"touchStartTranslateX",0),wa(this,"touchStartTranslateY",0),this.element=t,this.offset=r,this.translateX=n,this.translateY=a,this.scale=i,this.rotate=o,this.minScale=l,this.maxScale=s,this.clampBounds=u,this.rotation=f,this.roElement=new ResizeObserver(()=>{const{x:g,y:d,width:h,height:m}=this.element.getBoundingClientRect();this.wrapperBounds={x:g,y:d,width:h,height:m},this.update()}),this.roCanvas=new ResizeObserver(g=>{const{width:d,height:h}=g[0].contentRect;(d!==this.canvasBounds.width||h!==this.canvasBounds.height)&&(this.canvasBounds={...this.canvasBounds,width:d,height:h},this.isGestureActive||this.update())}),requestAnimationFrame(()=>{this.wrapperBounds=this.element.getBoundingClientRect(),this.canvasBounds=this.canvasElement.getBoundingClientRect(),this.update(),this.dispatchEvent(new Event("init"))}),this.roCanvas.observe(this.canvasElement),this.roElement.observe(this.element),this.installAncestorMotionListeners()}installAncestorMotionListeners(){const t=()=>{const{x:i,y:o,width:l,height:s}=this.element.getBoundingClientRect();i===this.wrapperBounds.x&&o===this.wrapperBounds.y&&l===this.wrapperBounds.width&&s===this.wrapperBounds.height||(this.wrapperBounds={x:i,y:o,width:l,height:s},this.update())},r=i=>!(i instanceof Node)||i===this.element?!1:i.contains(this.element),n=i=>{r(i.target)&&t()},a=["transitionrun","transitionend","transitioncancel","animationend","animationcancel"];for(const i of a)document.addEventListener(i,n,!0);this.ancestorMotionCleanup=()=>{for(const i of a)document.removeEventListener(i,n,!0)}}get canvasElement(){return this.element.querySelector(".canvas")}get wrapperInnerX(){return this.wrapperBounds.x+this.offset.left}get wrapperInnerY(){return this.wrapperBounds.y+this.offset.top}get wrapperInnerWidth(){return this.wrapperBounds.width-this.offset.left-this.offset.right}get wrapperInnerHeight(){return this.wrapperBounds.height-this.offset.top-this.offset.bottom}get wrapperInnerRatio(){return this.wrapperInnerWidth/this.wrapperInnerHeight}get canvasNaturalRatio(){return this.canvasBounds.width/this.canvasBounds.height}get naturalScale(){return this.canvasNaturalRatio>=this.wrapperInnerRatio?this.wrapperInnerWidth/this.canvasBounds.width:this.wrapperInnerHeight/this.canvasBounds.height}setTranslateFromUserGesture(t,r){if(this.clampBounds){const n=this.clampTranslate({translateX:t,translateY:r,scale:this.scale,rotate:this.rotate});this.translateX=n.translateX,this.translateY=n.translateY,this.rotate=0}else this.translateX=t,this.translateY=r}handleGesturestart(t){this.gestureStartRotate=this.rotate}handleGesturechange(t){const{clientX:r,clientY:n}=t,a=t.rotation;if(a===0||!this.rotation)return;const i=this.normalizeClientCoords(r,n);this.rotateCanvas(i[0],i[1],this.gestureStartRotate+Cee(a))}handleGestureend(t){}handleMousedown(t){t.preventDefault(),this.dragStart=[t.clientX,t.clientY],this.dragStartFrozenX=this.translateX,this.dragStartFrozenY=this.translateY}handleMouseup(t){t.preventDefault(),this.dragStart=null,this.dragStartFrozenX=null,this.dragStartFrozenY=null}handleMousemove(t){if(t.preventDefault(),this.dragStart&&this.dragStartFrozenX!==null&&this.dragStartFrozenY!==null){const r=t.clientX-this.dragStart[0],n=t.clientY-this.dragStart[1],a=this.dragStartFrozenX- -r,i=this.dragStartFrozenY- -n;this.setTranslateFromUserGesture(a,i),this.update()}}handleWheel(t){let{deltaX:r,deltaY:n,ctrlKey:a}=t;const i=vee(t);i||(Math.abs(n)>=100&&(n=Math.sign(n)*(Math.abs(n)/120)),Math.abs(r)>=100&&(r=Math.sign(r)*(Math.abs(r)/120)));const o=this.scale;if(a){const l=i?.01*this.zoomSpeedAppleTrackpad:.1*this.zoomSpeed,s=1+-n*l;let u=o*s;if(u=Q8(u,this.minScale,this.maxScale),(u===this.minScale||u===this.maxScale)&&(u===this.minScale&&s<1||u===this.maxScale&&s>1)){t.preventDefault();return}const f=this.relativeWrapperCoordinatesFromClientCoords(t.clientX,t.clientY),[g,d]=this.calcProjectionTranslate(u,f,this.normalizeMatrixCoordinates(t.clientX,t.clientY));this.setTranslateFromUserGesture(g,d),this.scale=u}else{const l=i?1*this.translateSpeedAppleTrackpad:25*this.translateSpeed;this.setTranslateFromUserGesture(this.translateX-r*l,this.translateY-n*l)}this.update(),t.preventDefault()}freezeTouches(t){return Array.from(t).map(r=>{const n=this.clientCoordsToWrapperCoords(r.clientX,r.clientY);return{client:[r.clientX,r.clientY],canvasRel:this.getCanvasCoordsRel(n[0],n[1])}})}handleTouchstart(t){this.touchStarts=this.freezeTouches(t.touches),this.touchStartTranslateX=this.translateX,this.touchStartTranslateY=this.translateY,this.isGestureActive=!0,t.preventDefault()}handleTouchmove(t){t.preventDefault();const r=Array.from(t.touches).map(n=>this.clientCoordsToWrapperCoords(n.clientX,n.clientY));if(this.touchStarts){if(r.length>=2&&this.touchStarts.length>=2){const n=[this.touchStarts[0].canvasRel[0]*this.canvasBounds.width,this.touchStarts[0].canvasRel[1]*this.canvasBounds.height],a=[this.touchStarts[1].canvasRel[0]*this.canvasBounds.width,this.touchStarts[1].canvasRel[1]*this.canvasBounds.height],i=Math.sqrt(Math.pow(n[0]-a[0],2)+Math.pow(n[1]-a[1],2)),o=Math.sqrt(Math.pow(r[0][0]-r[1][0],2)+Math.pow(r[0][1]-r[1][1],2))/this.naturalScale,l=Q8(o/i,this.minScale,this.maxScale),s=[r[0][0]/this.wrapperInnerWidth,r[0][1]/this.wrapperInnerHeight],u=this.touchStarts[0].canvasRel,[f,g]=this.calcProjectionTranslate(l,s,u,0);if(this.rotation){let d=0,h=0,m=0;const p=Math.atan2(a[1]-n[1],a[0]-n[0]);m=Math.atan2(r[1][1]-r[0][1],r[1][0]-r[0][0])-p;const C=(x,E)=>[this.offset.left+this.canvasBounds.width*x*this.naturalScale*l+f,this.offset.top+this.canvasBounds.height*E*this.naturalScale*l+g],v=C(0,0),I=C(this.touchStarts[0].canvasRel[0],this.touchStarts[0].canvasRel[1]),y=F2(v,I,m);d=y[0]-v[0],h=y[1]-v[1],this.scale=l,this.rotate=m,this.setTranslateFromUserGesture(f+d,g+h)}else this.scale=l,this.setTranslateFromUserGesture(f,g)}else{const n=t.touches[0].clientX-this.touchStarts[0].client[0],a=t.touches[0].clientY-this.touchStarts[0].client[1],i=this.touchStartTranslateX+n,o=this.touchStartTranslateY+a;this.setTranslateFromUserGesture(i,o)}this.update()}}handleTouchend(t){t.touches.length===0?this.touchStarts=null:(this.touchStarts=this.freezeTouches(t.touches),this.touchStartTranslateX=this.translateX,this.touchStartTranslateY=this.translateY),this.isGestureActive=!1}calcProjectionTranslate(t,r,n,a){const i=this.canvasBounds.width*this.naturalScale,o=this.canvasBounds.height*this.naturalScale,l=n[0]*i*t,s=n[1]*o*t,u=F2([l,s],[0,0],a??this.rotate),f=r[0]*this.wrapperInnerWidth,g=r[1]*this.wrapperInnerHeight,d=f-u[0],h=g-u[1];return[d,h]}applyTransform(t,r,n){const a=this.calcProjectionTranslate(t,r,n,0);this.scale=t,this.setTranslateFromUserGesture(a[0],a[1]),this.update()}composeRelPoint(t,r,n,a,i,o){n=n??this.scale,a=a??this.translateX,i=i??this.translateY,o=o??this.rotate;const l=[this.offset.left,this.offset.top],s=[this.offset.left+this.canvasBounds.width*(n*this.naturalScale)*t,this.offset.top+this.canvasBounds.height*(n*this.naturalScale)*r],u=F2(s,l,o);return[u[0]+a,u[1]+i]}composePoint(t,r){const n=t/this.canvasBounds.width,a=r/this.canvasBounds.height;return this.composeRelPoint(n,a)}getAnchorOffset(t,r,n,a,i=[.5,.5]){const o=this.calcProjectionTranslate(t,i,i,0),l=[this.offset.left+o[0]+this.canvasBounds.width*(t*this.naturalScale)*i[0],this.offset.top+o[1]+this.canvasBounds.height*(t*this.naturalScale)*i[1]],s=this.composeRelPoint(i[0],i[1],t,r,n,a),u=s[0]-l[0],f=s[1]-l[1];return[u,f]}getCanvasCoordsRel(t,r){const n=[0,0],a=[t-this.translateX,r-this.translateY],i=F2(a,n,-this.rotate),o=[i[0]/this.renderinScale,i[1]/this.renderinScale];return[o[0]/this.canvasBounds.width,o[1]/this.canvasBounds.height]}clientCoordsToWrapperCoords(t,r){const{x:n,y:a}=this.element.getBoundingClientRect();return[t-n-this.offset.left,r-a-this.offset.top]}relativeWrapperCoordinatesFromClientCoords(t,r){const[n,a]=this.clientCoordsToWrapperCoords(t,r);return[n/this.wrapperInnerWidth,a/this.wrapperInnerHeight]}normalizeMatrixCoordinates(t,r){const n=this.clientCoordsToWrapperCoords(t,r);return this.getCanvasCoordsRel(n[0],n[1])}normalizeClientCoords(t,r){const[n,a]=this.normalizeMatrixCoordinates(t,r);return[n*this.canvasBounds.width,a*this.canvasBounds.height]}rotateCanvas(t,r,n){const a=t/this.canvasBounds.width,i=r/this.canvasBounds.height,o=this.composeRelPoint(a,i,this.scale,0,0,n),l=this.composeRelPoint(a,i);this.setTranslateFromUserGesture(l[0]-o[0],l[1]-o[1]),this.rotate=n,this.update()}get renderinScale(){return this.naturalScale*this.scale}get renderingTranslateX(){return this.offset.left+this.translateX}get renderingTranslateY(){return this.offset.top+this.translateY}get renderingRotate(){return this.rotate}clampTranslate(t,r=[.5,.5]){const n=this.canvasBounds.width*this.naturalScale*t.scale,a=this.canvasBounds.height*this.naturalScale*t.scale,i=n-this.wrapperInnerWidth,o=a-this.wrapperInnerHeight,l=i>0?-i:0,s=Math.min(0,Math.max(t.translateX,l)),u=o>0?-o:0,f=Math.min(0,Math.max(t.translateY,u)),g=-Math.min(0,i)*r[0],d=-Math.min(0,o)*r[1];return{translateX:s+g,translateY:f+d}}update(){this.canvasElement.style.transformOrigin="top left",this.canvasElement.style.transform=`translateX(${this.renderingTranslateX}px) translateY(${this.renderingTranslateY}px) scale(${this.renderinScale}) rotate(${this.renderingRotate}rad)`,this.dispatchEvent(new Event("update"))}destroy(){var t,r,n;(t=this.roElement)==null||t.disconnect(),this.roElement=null,(r=this.roCanvas)==null||r.disconnect(),this.roCanvas=null,(n=this.ancestorMotionCleanup)==null||n.call(this),this.ancestorMotionCleanup=null}};const Iee={class:"canvas"},wee={class:"matrix"},xee=c.defineComponent({__name:"Zoompinch",props:{transform:{default:()=>({translateX:0,translateY:0,scale:1,rotate:0})},offset:{default:()=>({left:0,top:0,right:0,bottom:0})},maxScale:{default:10},minScale:{default:.5},clampBounds:{type:Boolean,default:!1},rotation:{type:Boolean,default:!0},mouse:{type:Boolean,default:!0},wheel:{type:Boolean,default:!0},touch:{type:Boolean,default:!0},gesture:{type:Boolean,default:!0},zoomSpeed:{},translateSpeed:{},zoomSpeedAppleTrackpad:{},translateSpeedAppleTrackpad:{}},emits:["update:transform","init","dragGestureStart","dragGestureEnd"],setup(e,{expose:t,emit:r}){const n=e,a=r,i=c.ref(),o=c.ref(),l=c.ref(!1);window.zoompinchEngine=o;const s=c.ref(()=>{throw new Error("Not initialized yet")}),u=c.ref(0),f=c.ref(0);c.onMounted(()=>{i.value&&(o.value=new yee(i.value,n.offset,n.transform.translateX,n.transform.translateY,n.transform.scale,n.transform.rotate,n.minScale,n.maxScale,n.clampBounds,n.rotation),n.zoomSpeed!==void 0&&(o.value.zoomSpeed=n.zoomSpeed),n.translateSpeed!==void 0&&(o.value.translateSpeed=n.translateSpeed),n.zoomSpeedAppleTrackpad!==void 0&&(o.value.zoomSpeedAppleTrackpad=n.zoomSpeedAppleTrackpad),n.translateSpeedAppleTrackpad!==void 0&&(o.value.translateSpeedAppleTrackpad=n.translateSpeedAppleTrackpad),o.value.addEventListener("init",()=>{a("init")}),o.value.addEventListener("update",()=>{if(!o.value)return;const B={translateX:o.value.translateX,translateY:o.value.translateY,scale:o.value.scale,rotate:o.value.rotate};(B.translateX!==n.transform.translateX||B.translateY!==n.transform.translateY||B.scale!==n.transform.scale||B.rotate!==n.transform.rotate)&&a("update:transform",B),s.value=(N,D)=>o.value.composePoint(N,D),u.value=o.value.canvasBounds.width,f.value=o.value.canvasBounds.height}),o.value.addEventListener("init",()=>{l.value=!0}))}),c.watch(()=>n.transform,()=>{o.value&&(o.value.translateX!==n.transform.translateX||o.value.translateY!==n.transform.translateY||o.value.scale!==n.transform.scale||o.value.rotate!==n.transform.rotate)&&(o.value.translateX=n.transform.translateX,o.value.translateY=n.transform.translateY,o.value.scale=n.transform.scale,o.value.rotate=n.transform.rotate,o.value.update())},{deep:!0}),c.watch(()=>n.offset,B=>{o.value&&(o.value.offset=B,o.value.update())},{deep:!0}),c.watch(()=>n.minScale,B=>{o.value&&(o.value.minScale=B,o.value.update())}),c.watch(()=>n.maxScale,B=>{o.value&&(o.value.maxScale=B,o.value.update())}),c.watch(()=>n.clampBounds,B=>{o.value&&(o.value.clampBounds=B,o.value.setTranslateFromUserGesture(o.value.translateX,o.value.translateY),o.value.update())}),c.watch(()=>n.rotation,B=>{o.value&&(o.value.rotation=B,o.value.update())}),c.watch(()=>n.zoomSpeed,()=>{!o.value||n.zoomSpeed===void 0||(o.value.zoomSpeed=n.zoomSpeed)}),c.watch(()=>n.translateSpeed,()=>{!o.value||n.translateSpeed===void 0||(o.value.translateSpeed=n.translateSpeed)}),c.watch(()=>n.zoomSpeedAppleTrackpad,()=>{!o.value||n.zoomSpeedAppleTrackpad===void 0||(o.value.zoomSpeedAppleTrackpad=n.zoomSpeedAppleTrackpad)}),c.watch(()=>n.translateSpeedAppleTrackpad,()=>{!o.value||n.translateSpeedAppleTrackpad===void 0||(o.value.translateSpeedAppleTrackpad=n.translateSpeedAppleTrackpad)});const g=(B,N,D,Q)=>{o.value&&(Q!==void 0&&(o.value.rotate=Q),o.value.applyTransform(B,N,D))},d=B=>{o.value&&n.wheel&&o.value.handleWheel(B)},h=B=>{o.value&&n.gesture&&o.value.handleGesturestart(B)},m=B=>{o.value&&n.gesture&&o.value.handleGesturechange(B)},p=B=>{o.value&&n.gesture&&o.value.handleGestureend(B)},C=B=>{o.value&&n.mouse&&o.value.handleMousedown(B)},v=B=>{o.value&&n.mouse&&o.value.handleMousemove(B)},I=B=>{o.value&&n.mouse&&o.value.handleMouseup(B)},y=B=>{o.value&&n.touch&&o.value.handleTouchstart(B)},x=B=>{o.value&&n.touch&&o.value.handleTouchmove(B)},E=B=>{o.value&&n.touch&&o.value.handleTouchend(B)};window.addEventListener("gesturechange",m),window.addEventListener("gestureend",p),window.addEventListener("mousemove",v),window.addEventListener("mouseup",I),window.addEventListener("touchmove",x),window.addEventListener("touchend",E),c.onUnmounted(()=>{window.removeEventListener("gesturechange",m),window.removeEventListener("gestureend",p),window.removeEventListener("mousemove",v),window.removeEventListener("mouseup",I),window.removeEventListener("touchmove",x),window.removeEventListener("touchend",E)});const k=(B,N)=>{if(!o.value)throw new Error("Zoompinch engine not initialized");return o.value.normalizeClientCoords(B,N)},S=(B,N,D)=>{o.value&&o.value.rotateCanvas(B,N,D)};return c.useSlots(),t({applyTransform:g,composePoint:s,normalizeClientCoords:k,zoompinchEngine:o,canvasWidth:u,canvasHeight:f,rotateCanvas:S}),(B,N)=>(c.openBlock(),c.createElementBlock("div",{ref_key:"zoompinchRef",ref:i,class:"zoompinch",onWheel:d,onGesturestart:h,onMousedown:C,onTouchstart:y},[c.createElementVNode("div",Iee,[c.renderSlot(B.$slots,"default",{},void 0,!0)]),c.createElementVNode("div",wee,[l.value&&s.value?c.renderSlot(B.$slots,"matrix",{key:0,composePoint:s.value,normalizeClientCoords:k,canvasWidth:u.value,canvasHeight:f.value},void 0,!0):c.createCommentVNode("",!0)])],544))}}),Eee=(e,t)=>{const r=e.__vccOpts||e;for(const[n,a]of t)r[n]=a;return r},z8=Eee(xee,[["__scopeId","data-v-fbdbcf7c"]]),w1=new Set;requestAnimationFrame(function e(){w1.forEach(t=>t()),requestAnimationFrame(e)});function T8(e,t,r){let n;const a=()=>{const o=e instanceof Function?e():e.value,l=n;o!==n&&(n=o,t(o,l))};return w1.add(a),()=>{w1.delete(a)}}function Kv(e,t){let r=null;const n=this;return()=>{clearTimeout(r);var a=arguments;r=setTimeout(()=>{e.apply(n,a)},t)}}const Bee=["x","y","width","height"],kee=["cx","cy","r"],See=["cx","cy","r"],_ee=["cx","cy","r"],Dee=["cx","cy","r"],Nee=["cx","cy","r"],Ree=["cx","cy","r"],Fee=["cx","cy","r"],Zee=["cx","cy","r"],Gee=["cx","cy","r"],Lee=["cx","cy","r"],Qee=["cx","cy","r"],zee=["cx","cy","r"],Tee=["cx","cy","r"],Wee=["cx","cy","r"],Mee=["cx","cy","r"],Oee=["cx","cy","r"],Yee=ht(c.defineComponent({__name:"CropSkeleton",props:{x:{},y:{},width:{},height:{},aspectRatio:{},clamp:{}},emits:["update","effectiveHandleChange"],setup(e,{emit:t}){const r=e,n=t,a=c.ref(5),i=c.computed(()=>{const Z=Math.min(r.width,r.height);return Z>=a.value*8?a.value*4:Math.max(Z/2,a.value)}),o=c.computed(()=>({x:r.x,y:r.y})),l=c.computed(()=>({x:r.x+r.width,y:r.y})),s=c.computed(()=>({x:r.x+r.width,y:r.y+r.height})),u=c.computed(()=>({x:r.x,y:r.y+r.height})),f=c.computed(()=>({x:r.x+r.width/2,y:r.y})),g=c.computed(()=>({x:r.x+r.width,y:r.y+r.height/2})),d=c.computed(()=>({x:r.x+r.width/2,y:r.y+r.height})),h=c.computed(()=>({x:r.x,y:r.y+r.height/2})),m=c.computed(()=>r.width>a.value*4&&r.height>a.value*4),p=c.ref(null),C=c.ref(null),v=c.ref(null),I=c.ref(null),y=c.ref(null),x=c.ref(null),E=c.ref(null);c.watch(x,Z=>{n("effectiveHandleChange",Z)});function k(Z,G){console.log("handleThumbMouseDown",Z,G),y.value=G,x.value=G,E.value=null,v.value={x:r.x,y:r.y,width:r.width,height:r.height},I.value={x:Z.clientX,y:Z.clientY},Z.preventDefault(),Z.stopPropagation()}function S(Z,G){console.log("handleThumbTouchstart",Z,G);const M=Z.touches[0];y.value=G,x.value=G,E.value=null,v.value={x:r.x,y:r.y,width:r.width,height:r.height},I.value={x:M.clientX,y:M.clientY},Z.preventDefault(),Z.stopPropagation()}const B=()=>{y.value=null,x.value=null,E.value=null,v.value=null,I.value=null,p.value=null,C.value=null},N=()=>{y.value=null,x.value=null,E.value=null,v.value=null,I.value=null,p.value=null,C.value=null},D=Z=>{if(p.value){if(!v.value)return;const G=Z.clientX-p.value.x,M=Z.clientY-p.value.y;C.value={x:v.value.x+G,y:v.value.y+M,width:v.value.width,height:v.value.height}}else y.value&&(E.value={x:Z.clientX,y:Z.clientY})},Q=Z=>{const G=Z.touches[0];if(p.value){if(!v.value)return;const M=G.clientX-p.value.x,J=G.clientY-p.value.y;C.value={x:v.value.x+M,y:v.value.y+J,width:v.value.width,height:v.value.height}}else y.value&&(E.value={x:G.clientX,y:G.clientY})};function z(Z){p.value={x:Z.clientX,y:Z.clientY},I.value={x:Z.clientX,y:Z.clientY},v.value={x:r.x,y:r.y,width:r.width,height:r.height},Z.preventDefault(),Z.stopPropagation()}function A(Z){const G=Z.touches[0];p.value={x:G.clientX,y:G.clientY},I.value={x:G.clientX,y:G.clientY},v.value={x:r.x,y:r.y,width:r.width,height:r.height},Z.preventDefault(),Z.stopPropagation()}function P(Z){var re,ee;const G=((re=r.clamp)==null?void 0:re.x)??-1/0,M=((ee=r.clamp)==null?void 0:ee.y)??-1/0,J=r.clamp?r.clamp.x+r.clamp.width:1/0,X=r.clamp?r.clamp.y+r.clamp.height:1/0;return{x:Math.min(Math.max(Z.x,G),J-Z.width),y:Math.min(Math.max(Z.y,M),X-Z.height),width:Z.width,height:Z.height}}function W(Z){const G=Z.shiftKey?10:4;let M=0,J=0;switch(Z.key){case"ArrowLeft":M=-G;break;case"ArrowRight":M=G;break;case"ArrowUp":J=-G;break;case"ArrowDown":J=G;break;default:return}Z.preventDefault();const X={x:r.x,y:r.y,width:r.width,height:r.height};if(Z.shiftKey)if(r.aspectRatio!=null){const ee=Z.key==="ArrowRight"||Z.key==="ArrowDown"?G:-G,{bbox:ne}=R("br",X,ee,ee,r.aspectRatio,r.clamp);n("update",ne)}else{const{bbox:re}=R("br",X,M,J,void 0,r.clamp);n("update",re)}else n("update",P({...X,x:X.x+M,y:X.y+J}))}function O(Z,G,M){const J={tl:"tr",tr:"tl",bl:"br",br:"bl",l:"r",r:"l"},X={tl:"bl",bl:"tl",tr:"br",br:"tr",t:"b",b:"t"};let re=Z;return G&&(re=J[re]??re),M&&(re=X[re]??re),re}function R(Z,G,M,J,X,re){let ee=G.x,ne=G.y,ue=G.x+G.width,be=G.y+G.height;switch(Z){case"tl":ee+=M,ne+=J;break;case"t":ne+=J;break;case"tr":ue+=M,ne+=J;break;case"r":ue+=M;break;case"br":ue+=M,be+=J;break;case"b":be+=J;break;case"bl":ee+=M,be+=J;break;case"l":ee+=M;break}const ae=ee>ue,L=ne>be,T=O(Z,ae,L),V=(re==null?void 0:re.x)??-1/0,q=(re==null?void 0:re.y)??-1/0,ge=re?re.x+re.width:1/0,fe=re?re.y+re.height:1/0;if(X!=null)if(Z==="tl"||Z==="tr"||Z==="bl"||Z==="br"){const Re=Z==="tl"||Z==="bl"?ue:ee,ye=Z==="tl"||Z==="tr"?be:ne,ke=Z==="tl"||Z==="bl"?ee:ue,He=Z==="tl"||Z==="tr"?ne:be,Xe=ke>=Re,Ye=He>=ye;let Je=Math.max(Math.abs(ke-Re),1),we=Math.max(Math.abs(He-ye),1);if(Je/we>X?Je=we*X:we=Je/X,re){const Qe=Xe?ge-Re:Re-V,at=Ye?fe-ye:ye-q;(Je>Qe||we>at)&&(Qe/at>X?(we=Math.min(we,at),Je=we*X):(Je=Math.min(Je,Qe),we=Je/X))}Xe?(ee=Re,ue=Re+Je):(ue=Re,ee=Re-Je),Ye?(ne=ye,be=ye+we):(be=ye,ne=ye-we)}else if(Z==="r"||Z==="l"){const ye=Z==="r"?G.x:G.x+G.width,ke=Z==="r"?ue:ee,He=G.y+G.height/2,Xe=ke>=ye;let Ye=Math.max(Math.abs(ke-ye),1);if(re){const we=Xe?ge-ye:ye-V,Qe=Math.min(He-q,fe-He)*2;Ye=Math.max(Math.min(Ye,we,Qe*X),1)}const Je=Ye/X;Xe?(ee=ye,ue=ye+Ye):(ue=ye,ee=ye-Ye),ne=He-Je/2,be=He+Je/2}else{const ye=Z==="b"?G.y:G.y+G.height,ke=Z==="b"?be:ne,He=G.x+G.width/2,Xe=ke>=ye;let Ye=Math.max(Math.abs(ke-ye),1);if(re){const we=Xe?fe-ye:ye-q,Qe=Math.min(He-V,ge-He)*2;Ye=Math.max(Math.min(Ye,we,Qe/X),1)}const Je=Ye*X;Xe?(ne=ye,be=ye+Ye):(be=ye,ne=ye-Ye),ee=He-Je/2,ue=He+Je/2}else{const Ie=Math.min(ee,ue),Re=Math.min(ne,be),ye=Math.max(ee,ue),ke=Math.max(ne,be);ee=Ie,ne=Re,ue=ye,be=ke,re&&(ee=Math.max(ee,V),ne=Math.max(ne,q),ue=Math.min(ue,ge),be=Math.min(be,fe))}return{bbox:{x:ee,y:ne,width:ue-ee,height:be-ne},effectiveHandle:T}}return T8(C,()=>{var Z,G;if(C.value){const M=((Z=r.clamp)==null?void 0:Z.x)??-1/0,J=((G=r.clamp)==null?void 0:G.y)??-1/0,X=r.clamp?r.clamp.x+r.clamp.width:1/0,re=r.clamp?r.clamp.y+r.clamp.height:1/0;C.value.x<M&&(C.value.x=M),C.value.y<J&&(C.value.y=J),C.value.x+C.value.width>X&&(C.value.x=X-C.value.width),C.value.y+C.value.height>re&&(C.value.y=re-C.value.height),n("update",C.value)}}),T8(E,()=>{if(!y.value||!E.value||!I.value||!v.value)return;const Z=E.value.x-I.value.x,G=E.value.y-I.value.y,{bbox:M,effectiveHandle:J}=R(y.value,v.value,Z,G,r.aspectRatio,r.clamp);x.value=J,n("update",M)}),window.addEventListener("mouseup",B),window.addEventListener("touchend",N),window.addEventListener("mousemove",D),window.addEventListener("touchmove",Q),c.onUnmounted(()=>{window.removeEventListener("mouseup",B),window.removeEventListener("touchend",N),window.removeEventListener("mousemove",D),window.removeEventListener("touchmove",Q)}),(Z,G)=>(c.openBlock(),c.createElementBlock("g",null,[c.createElementVNode("rect",{x:e.x,y:e.y,width:e.width,height:e.height,class:"skeleton-rect",tabindex:"0",role:"application","aria-roledescription":"Crop area","aria-label":"Crop area. Use arrow keys to move, Shift plus arrow keys to resize.",onMousedown:z,onTouchstart:A,onKeydown:W},null,40,Bee),c.createElementVNode("g",{class:c.normalizeClass({inactive:!m.value})},[c.createElementVNode("g",null,[c.createElementVNode("circle",{cx:f.value.x,cy:f.value.y,r:i.value,class:"thumb-circle-hitbox thumb-circle-hitbox-t",onMousedown:G[0]||(G[0]=M=>k(M,"t")),onTouchstart:G[1]||(G[1]=M=>S(M,"t"))},null,40,kee),c.createElementVNode("circle",{cx:f.value.x,cy:f.value.y,r:a.value,class:c.normalizeClass(["thumb-circle",{pressing:x.value==="t"}])},null,10,See)]),c.createElementVNode("g",null,[c.createElementVNode("circle",{cx:g.value.x,cy:g.value.y,r:i.value,class:"thumb-circle-hitbox thumb-circle-hitbox-r",onMousedown:G[2]||(G[2]=M=>k(M,"r")),onTouchstart:G[3]||(G[3]=M=>S(M,"r"))},null,40,_ee),c.createElementVNode("circle",{cx:g.value.x,cy:g.value.y,r:a.value,class:c.normalizeClass(["thumb-circle",{pressing:x.value==="r"}])},null,10,Dee)]),c.createElementVNode("g",null,[c.createElementVNode("circle",{cx:d.value.x,cy:d.value.y,r:i.value,class:"thumb-circle-hitbox thumb-circle-hitbox-b",onMousedown:G[4]||(G[4]=M=>k(M,"b")),onTouchstart:G[5]||(G[5]=M=>S(M,"b"))},null,40,Nee),c.createElementVNode("circle",{cx:d.value.x,cy:d.value.y,r:a.value,class:c.normalizeClass(["thumb-circle",{pressing:x.value==="b"}])},null,10,Ree)]),c.createElementVNode("g",null,[c.createElementVNode("circle",{cx:h.value.x,cy:h.value.y,r:i.value,class:"thumb-circle-hitbox thumb-circle-hitbox-l",onMousedown:G[6]||(G[6]=M=>k(M,"l")),onTouchstart:G[7]||(G[7]=M=>S(M,"l"))},null,40,Fee),c.createElementVNode("circle",{cx:h.value.x,cy:h.value.y,r:a.value,class:c.normalizeClass(["thumb-circle",{pressing:x.value==="l"}])},null,10,Zee)])],2),c.createElementVNode("g",null,[c.createElementVNode("g",null,[c.createElementVNode("circle",{cx:o.value.x,cy:o.value.y,r:i.value,class:"thumb-circle-hitbox thumb-circle-hitbox-tl",onMousedown:G[8]||(G[8]=M=>k(M,"tl")),onTouchstart:G[9]||(G[9]=M=>S(M,"tl"))},null,40,Gee),c.createElementVNode("circle",{cx:o.value.x,cy:o.value.y,r:a.value,class:c.normalizeClass(["thumb-circle",{pressing:x.value==="tl"}])},null,10,Lee)]),c.createElementVNode("g",null,[c.createElementVNode("circle",{cx:l.value.x,cy:l.value.y,r:i.value,class:"thumb-circle-hitbox thumb-circle-hitbox-tr",onMousedown:G[10]||(G[10]=M=>k(M,"tr")),onTouchstart:G[11]||(G[11]=M=>S(M,"tr"))},null,40,Qee),c.createElementVNode("circle",{cx:l.value.x,cy:l.value.y,r:a.value,class:c.normalizeClass(["thumb-circle",{pressing:x.value==="tr"}])},null,10,zee)]),c.createElementVNode("g",null,[c.createElementVNode("circle",{cx:u.value.x,cy:u.value.y,r:i.value,class:"thumb-circle-hitbox thumb-circle-hitbox-bl",onMousedown:G[12]||(G[12]=M=>k(M,"bl")),onTouchstart:G[13]||(G[13]=M=>S(M,"bl"))},null,40,Tee),c.createElementVNode("circle",{cx:u.value.x,cy:u.value.y,r:a.value,class:c.normalizeClass(["thumb-circle",{pressing:x.value==="bl"}])},null,10,Wee)]),c.createElementVNode("g",null,[c.createElementVNode("circle",{cx:s.value.x,cy:s.value.y,r:i.value,class:"thumb-circle-hitbox thumb-circle-hitbox-br",onMousedown:G[14]||(G[14]=M=>k(M,"br")),onTouchstart:G[15]||(G[15]=M=>S(M,"br"))},null,40,Mee),c.createElementVNode("circle",{cx:s.value.x,cy:s.value.y,r:a.value,class:c.normalizeClass(["thumb-circle",{pressing:x.value==="br"}])},null,10,Oee)])])]))}}),[["__scopeId","data-v-ab8c8451"]]);function ed(e,t,r){return Math.min(Math.max(e,t),r)}function Pee(e,t){const r=ed(e.x,t.x,t.x+t.width),n=ed(e.y,t.y,t.y+t.height),a=ed(e.x+e.width,t.x,t.x+t.width),i=ed(e.y+e.height,t.y,t.y+t.height);return{x:r,y:n,width:a-r,height:i-n}}function Vee(e,t,r){if(r==null)return Pee(e,t);let n=e.width,a=e.height;n>t.width&&(n=t.width,a=n/r),a>t.height&&(a=t.height,n=a*r);const i=ed(e.x,t.x,t.x+t.width-n),o=ed(e.y,t.y,t.y+t.height-a);return{x:i,y:o,width:n,height:a}}function jee(e){return new Promise((t,r)=>{if(e.complete&&e.naturalWidth!==0){console.log("[0] getBoundingClientRect",e.getBoundingClientRect()),t();return}const n=()=>{e.naturalWidth*e.naturalHeight>0&&(console.log("[1] getBoundingClientRect",e.getBoundingClientRect()),setTimeout(()=>{console.log("[2] getBoundingClientRect",e.getBoundingClientRect()),t()}),w1.delete(n))};w1.add(n),e.addEventListener("error",()=>r(new Error("Failed to load image")),{once:!0})})}const Hee={class:"bx-cropper"},Uee={xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"100%",class:"matrix-svg"},Xee={key:0,class:"layer loading-layer"},$ee={class:"layer"},W8=ht(c.defineComponent({__name:"BxCropper",props:{crop:{},aspectRatio:{},offset:{default:()=>({top:10,right:10,bottom:10,left:10})},mirrorX:{type:Boolean,default:!1},mirrorY:{type:Boolean,default:!1}},emits:["update:crop"],setup(e,{emit:t}){const r=e,n=t;c.useSlots();const a=c.ref(),i=c.ref({translateX:0,translateY:0,scale:1,rotate:0}),o=c.ref(),l=c.ref();function s(C){let{left:v,top:I,width:y,height:x}=C;return r.mirrorX&&a.value&&(v=a.value.canvasWidth-v-y),r.mirrorY&&a.value&&(I=a.value.canvasHeight-I-x),{left:v,top:I,width:y,height:x}}function u(C){if(!a.value)throw new Error("Zoompinch ref not available");const v=s(C),[I,y]=a.value.composePoint(v.left,v.top),[x,E]=a.value.composePoint(v.left+v.width,v.top+v.height),k=x-I,S=E-y;return{x:I,y,width:k,height:S}}function f(C){if(!a.value||!a.value.zoompinchEngine)throw new Error("Zoompinch ref or engine not available");const v=C.x+(a.value.zoompinchEngine.wrapperInnerX-r.offset.left),I=C.y+(a.value.zoompinchEngine.wrapperInnerY-r.offset.top),[y,x]=a.value.normalizeClientCoords(v,I),[E,k]=a.value.normalizeClientCoords(v+C.width,I+C.height),S=E-y,B=k-x;return{left:Math.round(y),top:Math.round(x),width:Math.round(S),height:Math.round(B)}}const g=c.ref(!1);async function d(){var I;if(!((I=a.value)!=null&&I.zoompinchEngine))return;const C=Array.from(a.value.zoompinchEngine.canvasElement.children);for(const y of C)y.tagName==="IMG"&&await jee(y);g.value=!0,a.value.applyTransform(1,[.5,.5],[.5,.5]);const v=r.crop??(()=>{const y=a.value.canvasWidth,x=a.value.canvasHeight,E=y/x;if(r.aspectRatio){const k=E>r.aspectRatio?x*r.aspectRatio:y,S=E>r.aspectRatio?x:y/r.aspectRatio;return{left:(y-k)/2,top:(x-S)/2,width:k,height:S}}else return{left:0,top:0,width:y,height:x}})();l.value=v,o.value=u(v)}const h=c.ref(null);window.test=()=>f(o.value);const m=c.computed(()=>{if(i.value,!a.value)throw new Error("Zoompinch ref not available");return u({left:0,top:0,width:a.value.canvasWidth,height:a.value.canvasHeight})});function p(C){o.value=C}return c.watch(i,()=>{!o.value||!a.value||(o.value=Vee(o.value,m.value,r.aspectRatio))}),c.watch(o,C=>{if(!C)return;const v=f(C),I=s(v);l.value=I,n("update:crop",I)}),c.watch([()=>r.mirrorX,()=>r.mirrorY],()=>{!g.value||!l.value||!a.value||(o.value=u(l.value))}),(C,v)=>(c.openBlock(),c.createElementBlock("div",Hee,[c.createVNode(c.unref(z8),{ref_key:"zoompinchRef",ref:a,transform:i.value,"onUpdate:transform":v[1]||(v[1]=I=>i.value=I),rotation:!1,"min-scale":1,offset:e.offset,"clamp-bounds":"",onInit:d,class:c.normalizeClass({[`effective-handle-${h.value}`]:h.value!==null})},{default:c.withCtx(()=>[c.renderSlot(C.$slots,"default",{},void 0,!0)]),matrix:c.withCtx(()=>[(c.openBlock(),c.createElementBlock("svg",Uee,[o.value?(c.openBlock(),c.createBlock(Yee,c.mergeProps({key:0},o.value,{"aspect-ratio":e.aspectRatio,clamp:m.value,onUpdate:p,onEffectiveHandleChange:v[0]||(v[0]=I=>h.value=I)}),null,16,["aspect-ratio","clamp"])):c.createCommentVNode("",!0)])),g.value?c.createCommentVNode("",!0):(c.openBlock(),c.createElementBlock("div",Xee,[c.createVNode(Pl)])),c.createElementVNode("div",$ee,[c.renderSlot(C.$slots,"layer",{},void 0,!0)])]),_:3},8,["transform","offset","class"])]))}}),[["__scopeId","data-v-8d2848fa"]]),Jee={class:"bx-image-cropper"},Kee=["src"],qee={class:"actions-left"},ete={class:"actions-right"},M8=ht(c.defineComponent({__name:"BxImageCropper",props:c.mergeModels({src:{},aspectRatio:{},offset:{}},{crop:{required:!1},cropModifiers:{},mirrorX:{type:Boolean,required:!1,default:!1},mirrorXModifiers:{},mirrorY:{type:Boolean,required:!1,default:!1},mirrorYModifiers:{}}),emits:c.mergeModels(["cancel","done"],["update:crop","update:mirrorX","update:mirrorY"]),setup(e,{emit:t}){const r=c.useModel(e,"crop"),n=c.useModel(e,"mirrorX"),a=c.useModel(e,"mirrorY"),i=t;function o(){n.value=!n.value}function l(){a.value=!a.value}return(s,u)=>(c.openBlock(),c.createElementBlock("div",Jee,[c.createVNode(W8,{"aspect-ratio":e.aspectRatio,crop:r.value,"onUpdate:crop":u[4]||(u[4]=f=>r.value=f),offset:e.offset,"mirror-x":n.value,"mirror-y":a.value},{layer:c.withCtx(()=>[c.createElementVNode("div",{class:"actions-wrapper",onTouchstart:u[2]||(u[2]=c.withModifiers(()=>{},["stop"])),onTouchend:u[3]||(u[3]=c.withModifiers(()=>{},["stop"]))},[c.createElementVNode("div",qee,[c.createVNode(Lt,{onClick:o,class:c.normalizeClass({active:!0}),"aria-label":"Mirror horizontally"},{icon:c.withCtx(()=>[c.createVNode(At,null,{default:c.withCtx(()=>[...u[5]||(u[5]=[c.createElementVNode("svg",{fill:"none",viewBox:"0 0 24 24","data-fpl-icon-size":"24"},[c.createElementVNode("g",{style:{"transform-origin":"center center",transform:"scale(1.5)"}},[c.createElementVNode("path",{style:{fill:"currentColor","fill-rule":"evenodd"},d:"M12.5 6.5a.5.5 0 0 0-1 0v11a.5.5 0 0 0 1 0zM6 9.104a.75.75 0 0 1 1.28-.53L10 11.292a1 1 0 0 1 0 1.414l-2.72 2.72a.75.75 0 0 1-1.28-.53zm1 .603v4.586L9.293 12zm11-.603a.75.75 0 0 0-1.28-.53L14 11.292a1 1 0 0 0 0 1.414l2.72 2.72a.75.75 0 0 0 1.28-.53zm-1 .603v4.586L14.707 12z","clip-rule":"evenodd"})])],-1)])]),_:1})]),_:1}),c.createVNode(Lt,{onClick:l,class:c.normalizeClass({active:!0}),"aria-label":"Mirror vertically"},{icon:c.withCtx(()=>[c.createVNode(At,null,{default:c.withCtx(()=>[...u[6]||(u[6]=[c.createElementVNode("svg",{fill:"none",viewBox:"0 0 24 24","data-fpl-icon-size":"24"},[c.createElementVNode("g",{style:{"transform-origin":"center center",transform:"scale(1.5)"}},[c.createElementVNode("path",{style:{fill:"currentColor","fill-rule":"evenodd"},d:"M17.5 12.5a.5.5 0 0 0 0-1h-11a.5.5 0 0 0 0 1zM14.896 18a.75.75 0 0 0 .53-1.28L12.708 14a1 1 0 0 0-1.414 0l-2.72 2.72a.75.75 0 0 0 .53 1.28zm-.603-1H9.707L12 14.707zm.603-11a.75.75 0 0 1 .53 1.28L12.708 10a1 1 0 0 1-1.414 0l-2.72-2.72A.75.75 0 0 1 9.103 6zm-.603 1H9.707L12 9.293z","clip-rule":"evenodd"})])],-1)])]),_:1})]),_:1})]),c.createElementVNode("div",ete,[c.createVNode(Lt,{secondary:"",onClick:u[0]||(u[0]=f=>i("cancel"))},{default:c.withCtx(()=>[...u[7]||(u[7]=[c.createTextVNode(" Cancel ",-1)])]),_:1}),c.createVNode(Lt,{active:"",onClick:u[1]||(u[1]=f=>i("done"))},{default:c.withCtx(()=>[...u[8]||(u[8]=[c.createTextVNode(" Done ",-1)])]),_:1})])],32)]),default:c.withCtx(()=>[c.createElementVNode("img",{src:e.src,class:c.normalizeClass(["image",{"mirror-x":n.value,"mirror-y":a.value}])},null,10,Kee)]),_:1},8,["aspect-ratio","crop","offset","mirror-x","mirror-y"])]))}}),[["__scopeId","data-v-0924dbd3"]]),O8=.6,Y8=.4,P8=.6,V8=(e,t,r)=>Math.min(r,Math.max(t,e));function j8(e){const{faces:t,natural:r,aspectRatio:n,cropMode:a,zoom:i=!1}=e;if(a!=="cover"||!Number.isFinite(n)||n<=0||!(r.width>0)||!(r.height>0))return null;const o=t.filter(E=>E.score>=O8&&E.width>0&&E.height>0);if(o.length===0)return null;const l=Math.min(...o.map(E=>E.x)),s=Math.min(...o.map(E=>E.y)),u=Math.max(...o.map(E=>E.x+E.width)),f=Math.max(...o.map(E=>E.y+E.height)),g=(l+u)/2,d=(s+f)/2,h=r.width/r.height,m=h>n?r.height*n:r.width,p=h>n?r.height:r.width/n;let C=m,v=p;if(i){const E=(u-l)*(1+2*P8),k=(f-s)*(1+2*P8),S=Math.max(E,k*n),B=S/n;C=Math.min(m,S),v=Math.min(p,B)}const I=g-C/2,y=d-v*Y8,x={left:V8(I,0,Math.max(0,r.width-C)),top:V8(y,0,Math.max(0,r.height-v)),width:C,height:v};return x.left===0&&x.top===0&&Math.abs(x.width-r.width)<.5&&Math.abs(x.height-r.height)<.5?null:x}let Z2=null;function tte(e){Z2=e}function H8(){return Z2!==null}async function rte(e){if(!Z2)return[];try{const t=await Z2(e);return Array.isArray(t)?t:[]}catch(t){return console.warn("[autoCrop] face detection failed, skipping auto-crop",t),[]}}const nte=640;function ate(e){return new Promise(t=>{const r=new Image;r.crossOrigin="anonymous",r.addEventListener("load",()=>t(r)),r.addEventListener("error",()=>t(null)),r.src=e})}function ite(e){const t=e.naturalWidth||e.width,r=e.naturalHeight||e.height;if(!(t>0)||!(r>0))return null;const n=Math.min(1,nte/Math.max(t,r)),a=document.createElement("canvas");a.width=Math.max(1,Math.round(t*n)),a.height=Math.max(1,Math.round(r*n));const i=a.getContext("2d",{willReadFrequently:!0});if(!i)return null;i.drawImage(e,0,0,a.width,a.height);try{i.getImageData(0,0,1,1)}catch{return null}return{canvas:a,scale:n}}async function U8(e){if(!H8()||e.cropMode!=="cover")return null;const t=await ate(e.src);if(!t)return null;const r=ite(t);if(!r)return null;const n=await rte(r.canvas);if(n.length===0)return null;const a=1/r.scale,i=n.map(o=>({x:o.x*a,y:o.y*a,width:o.width*a,height:o.height*a,score:o.score}));return j8({faces:i,natural:e.natural,aspectRatio:e.aspectRatio,cropMode:e.cropMode,zoom:e.zoom})}var Kl={},qv={},X8={};Object.defineProperty(X8,"__esModule",{value:!0});var $8={};Object.defineProperty($8,"__esModule",{value:!0});var J8={};Object.defineProperty(J8,"__esModule",{value:!0});var e3={};Object.defineProperty(e3,"__esModule",{value:!0});var Wn={},K8;function ote(){if(K8)return Wn;K8=1,Object.defineProperty(Wn,"__esModule",{value:!0}),Wn.SERIAL_CANVAS_DOC_KEYS=void 0,Wn.cloneSerialJson=t,Wn.isMultiCanvas=r,Wn.getActiveCanvasId=n,Wn.getSerialCanvasById=a,Wn.extractDocState=i,Wn.docStateFromCanvas=o,Wn.syncActiveCanvasEntry=l,Wn.materializeCanvas=s,Wn.toPersistedSerial=u,Wn.fromPersistedSerial=f,Wn.canvasSizeToken=g,Wn.canvasDisplayName=d,Wn.findCanvasBySize=h,Wn.isCanvasSizeTaken=m,Wn.duplicateCanvasSizeCounts=p;const e=ek();Wn.SERIAL_CANVAS_DOC_KEYS=["context","width","height","frames","fill","grid"];function t(C){return JSON.parse(JSON.stringify(C))}function r(C){var v;return(((v=C.canvases)==null?void 0:v.length)??0)>=2}function n(C){return C.activeCanvasId??e.DEFAULT_CANVAS_ID}function a(C,v){var I;return(I=C.canvases)==null?void 0:I.find(y=>y.id===v)}function i(C){return{context:C.context,width:C.width,height:C.height,frames:C.frames,fill:C.fill,grid:C.grid}}function o(C){return{context:C.context,width:C.width,height:C.height,frames:C.frames,fill:C.fill,grid:C.grid??{horizontal:[],vertical:[]}}}function l(C){if(!r(C))return C.canvases;const v=n(C),I=C.canvases.findIndex(E=>E.id===v);if(I===-1)return C.canvases;const y=C.canvases[I],x=C.canvases.slice();return x[I]={...y,...t(i(C)),frames:C.frames?t(C.frames):void 0,fill:C.fill?t(C.fill):void 0},x}function s(C,v){if(!r(C))return C;const I=a(C,v);return I?{...C,...o(I),activeCanvasId:v}:C}function u(C){if(!r(C))return C;const v=l(C),I=(v==null?void 0:v.find(y=>y.id===e.DEFAULT_CANVAS_ID))??(v==null?void 0:v[0]);return I?{...C,canvases:v,...o(I)}:C}function f(C){if(!r(C))return C;const v=n(C);if(v===e.DEFAULT_CANVAS_ID)return C;const I=a(C,v);return I?{...C,...t(o(I))}:{...C,activeCanvasId:void 0}}function g(C,v){return`${Math.round(C)}x${Math.round(v)}`}function d(C){return`${Math.round(C.width)}×${Math.round(C.height)}`}function h(C,v,I,y){const x=g(v,I);return C.find(E=>E.id!==y&&g(E.width,E.height)===x)}function m(C,v,I,y){return!!h(C,v,I,y)}function p(C){const v={};for(const I of C){const y=g(I.width,I.height);v[y]=(v[y]??0)+1}for(const I of Object.keys(v))v[I]<2&&delete v[I];return v}return Wn}var G2={};Object.defineProperty(G2,"__esModule",{value:!0}),G2.isBlankSerial=ste,G2.applyBlankDocumentFormat=lte;function ste(e){var t;return!(e.context.length>0||(((t=e.canvases)==null?void 0:t.length)??0)>0)}function lte(e,t){return e.width=t.width,e.height=t.height,t.frames?e.frames={...t.frames}:delete e.frames,e}var q8;function ek(){return q8||(q8=1,function(e){var t=le&&le.__createBinding||(Object.create?function(i,o,l,s){s===void 0&&(s=l);var u=Object.getOwnPropertyDescriptor(o,l);(!u||("get"in u?!o.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return o[l]}}),Object.defineProperty(i,s,u)}:function(i,o,l,s){s===void 0&&(s=l),i[s]=o[l]}),r=le&&le.__setModuleDefault||(Object.create?function(i,o){Object.defineProperty(i,"default",{enumerable:!0,value:o})}:function(i,o){i.default=o}),n=le&&le.__importStar||function(){var i=function(o){return i=Object.getOwnPropertyNames||function(l){var s=[];for(var u in l)Object.prototype.hasOwnProperty.call(l,u)&&(s[s.length]=u);return s},i(o)};return function(o){if(o&&o.__esModule)return o;var l={};if(o!=null)for(var s=i(o),u=0;u<s.length;u++)s[u]!=="default"&&t(l,o,s[u]);return r(l,o),l}}(),a=le&&le.__exportStar||function(i,o){for(var l in i)l!=="default"&&!Object.prototype.hasOwnProperty.call(o,l)&&t(o,i,l)};Object.defineProperty(e,"__esModule",{value:!0}),e.SupportedInternalLinkedinKeys=e.DEFAULT_CANVAS_ID=e.Fields=e.Config=e.Elements=e.Geometry=void 0,e.Geometry=n(X8),e.Elements=n($8),e.Config=n(J8),e.Fields=n(e3),a(ote(),e),a(G2,e),e.DEFAULT_CANVAS_ID="default",e.SupportedInternalLinkedinKeys=["LINKEDIN_NAME","LINKEDIN_PICTURE","LINKEDIN_EMAIL","LINKEDIN_FAMILY_NAME","LINKEDIN_GIVEN_NAME"]}(qv)),qv}var L2={};Object.defineProperty(L2,"__esModule",{value:!0}),L2.Platforms=void 0,L2.Platforms=["instagram","facebook","x","tiktok","linkedin"];var tk={},rk={};Object.defineProperty(rk,"__esModule",{value:!0}),function(e){var t=le&&le.__createBinding||(Object.create?function(n,a,i,o){o===void 0&&(o=i);var l=Object.getOwnPropertyDescriptor(a,i);(!l||("get"in l?!a.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return a[i]}}),Object.defineProperty(n,o,l)}:function(n,a,i,o){o===void 0&&(o=i),n[o]=a[i]}),r=le&&le.__exportStar||function(n,a){for(var i in n)i!=="default"&&!Object.prototype.hasOwnProperty.call(a,i)&&t(a,n,i)};Object.defineProperty(e,"__esModule",{value:!0}),r(rk,e)}(tk);var nk={},ak={};Object.defineProperty(ak,"__esModule",{value:!0}),function(e){var t=le&&le.__createBinding||(Object.create?function(n,a,i,o){o===void 0&&(o=i);var l=Object.getOwnPropertyDescriptor(a,i);(!l||("get"in l?!a.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return a[i]}}),Object.defineProperty(n,o,l)}:function(n,a,i,o){o===void 0&&(o=i),n[o]=a[i]}),r=le&&le.__exportStar||function(n,a){for(var i in n)i!=="default"&&!Object.prototype.hasOwnProperty.call(a,i)&&t(a,n,i)};Object.defineProperty(e,"__esModule",{value:!0}),r(ak,e)}(nk);var ik={};Object.defineProperty(ik,"__esModule",{value:!0});var ok={};Object.defineProperty(ok,"__esModule",{value:!0});var sk={};Object.defineProperty(sk,"__esModule",{value:!0});var lk={};Object.defineProperty(lk,"__esModule",{value:!0});var ck={};Object.defineProperty(ck,"__esModule",{value:!0});var uk={};Object.defineProperty(uk,"__esModule",{value:!0});var dk={};Object.defineProperty(dk,"__esModule",{value:!0});var fk={},$t={};function ds(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]]);return r}typeof SuppressedError=="function"&&SuppressedError;const cte={ZodAny:"any",ZodArray:"array",ZodBigInt:"bigint",ZodBoolean:"boolean",ZodDefault:"default",ZodPrefault:"prefault",ZodTransform:"transform",ZodEnum:"enum",ZodIntersection:"intersection",ZodLazy:"lazy",ZodLiteral:"literal",ZodNever:"never",ZodNull:"null",ZodNullable:"nullable",ZodNumber:"number",ZodNonOptional:"nonoptional",ZodObject:"object",ZodOptional:"optional",ZodPipe:"pipe",ZodReadonly:"readonly",ZodRecord:"record",ZodString:"string",ZodTuple:"tuple",ZodType:"type",ZodUnion:"union",ZodDiscriminatedUnion:"union",ZodUnknown:"unknown",ZodVoid:"void",ZodDate:"date",ZodTemplateLiteral:"template_literal"};function Ht(e,t){return(Array.isArray(t)?t:[t]).some(n=>{var a;const i=((a=e==null?void 0:e.def)===null||a===void 0?void 0:a.type)===cte[n];return n==="ZodDiscriminatedUnion"?i&&"discriminator"in e.def:i})}function ca(e){return e&&"def"in e}function x1(e){return e.safeParse(null).success}function gk(e){return e.safeParse(void 0).success}let ute=class{constructor(){this._map=new Map,this._idmap=new Map}add(t,...r){const n=r[0];if(this._map.set(t,n),n&&typeof n=="object"&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,t)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(t){const r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){const r=t._zod.parent;if(r){const n={...this.get(r)??{}};return delete n.id,{...n,...this._map.get(t)}}return this._map.get(t)}has(t){return this._map.has(t)}};function dte(){return new ute}function Q2(e,t){if(e==null||t===null||t===void 0)return e===t;if(e===t||e.valueOf()===t.valueOf())return!0;if(Array.isArray(e)&&(!Array.isArray(t)||e.length!==t.length)||!(e instanceof Object)||!(t instanceof Object))return!1;const r=Object.keys(e);return Object.keys(t).every(n=>r.indexOf(n)!==-1)&&r.every(n=>Q2(e[n],t[n]))}class fte{constructor(){this.buckets=new Map}put(t){const r=this.hashCodeOf(t),n=this.buckets.get(r);if(!n){this.buckets.set(r,[t]);return}n.some(i=>Q2(i,t))||n.push(t)}contains(t){const r=this.hashCodeOf(t),n=this.buckets.get(r);return n?n.some(a=>Q2(a,t)):!1}values(){return[...this.buckets.values()].flat()}stats(){let t=0,r=0,n=0;for(const i of this.buckets.values())t+=1,r+=i.length,i.length>1&&(n+=1);const a=t/r;return{totalBuckets:t,collisions:n,totalValues:r,hashEffectiveness:a}}hashCodeOf(t){let r=0;if(Array.isArray(t)){for(let n=0;n<t.length;n++)r^=this.hashCodeOf(t[n])*n;return r}if(typeof t=="string"){for(let n=0;n<t.length;n++)r^=t.charCodeAt(n)*n;return r}if(typeof t=="number")return t;if(typeof t=="object")for(const[n,a]of Object.entries(t))r^=this.hashCodeOf(n)+this.hashCodeOf(a??"");return r}}function td(e){return e===void 0}function E1(e,t){const r={};return Object.entries(e).forEach(([n,a])=>{r[n]=t(a)}),r}function gte(e,t){const r={};return Object.entries(e).forEach(([n,a])=>{t.some(i=>i===n)||(r[n]=a)}),r}function Cu(e,t){const r={};return Object.entries(e).forEach(([n,a])=>{t(a,n)||(r[n]=a)}),r}function hk(e){return e.filter(t=>!td(t))}const B1=Q2;function Ak(e){const t=new fte;return e.forEach(r=>t.put(r)),[...t.values()]}function t3(e){return typeof e=="string"}function mk(e){return Object.fromEntries(Object.entries(e).sort(([t],[r])=>t.localeCompare(r)))}const r3=dte();class mr{static collectMetadata(t,r){const n=this.getMetadataFromRegistry(t),a=Object.assign(Object.assign({},n==null?void 0:n._internal),r==null?void 0:r._internal),i=Object.assign(Object.assign({},n==null?void 0:n.param),r==null?void 0:r.param),o=Object.assign(Object.assign(Object.assign(Object.assign({},Object.keys(a).length>0?{_internal:a}:{}),n),r),Object.keys(i).length>0?{param:i}:{});if(Ht(t,["ZodOptional","ZodNullable","ZodDefault","ZodPrefault","ZodReadonly","ZodNonOptional"])&&ca(t._zod.def.innerType))return this.collectMetadata(t._zod.def.innerType,o);if(Ht(t,"ZodPipe")){const l=t._zod.def.in,s=t._zod.def.out;if(Ht(l,"ZodTransform")&&ca(s))return this.collectMetadata(s,o);if(ca(l))return this.collectMetadata(l,o)}return o}static getMetadata(t){return this.collectMetadata(t)}static getOpenApiMetadata(t){const r=this.collectMetadata(t),n=r??{},{_internal:a}=n;return ds(n,["_internal"])}static getInternalMetadata(t){var r;return(r=this.collectMetadata(t))===null||r===void 0?void 0:r._internal}static getParamMetadata(t){const r=this.collectMetadata(t);return Object.assign(Object.assign({},r),{param:Object.assign(Object.assign({},r!=null&&r.description?{description:r.description}:{}),r==null?void 0:r.param)})}static buildSchemaMetadata(t){return Cu(gte(t,["param","_internal"]),td)}static buildParameterMetadata(t){return Cu(t,td)}static applySchemaMetadata(t,r){return Cu(Object.assign(Object.assign({},t),this.buildSchemaMetadata(r)),td)}static getRefId(t){var r;return(r=this.getInternalMetadata(t))===null||r===void 0?void 0:r.refId}static unwrapChained(t){return this.unwrapUntil(t)}static getDefaultValue(t){var r;const n=(r=this.unwrapUntil(t,"ZodDefault"))!==null&&r!==void 0?r:this.unwrapUntil(t,"ZodPrefault");return n==null?void 0:n._zod.def.defaultValue}static unwrapUntil(t,r){if(r&&Ht(t,r))return t;if(Ht(t,["ZodOptional","ZodNullable","ZodDefault","ZodPrefault","ZodReadonly","ZodNonOptional"])&&ca(t._zod.def.innerType))return this.unwrapUntil(t._zod.def.innerType,r);if(Ht(t,"ZodPipe")){const n=t._zod.def.in,a=t._zod.def.out;if(Ht(n,"ZodTransform")&&ca(a))return this.unwrapUntil(a,r);if(ca(n))return this.unwrapUntil(n,r)}return r?void 0:t}static getMetadataFromInternalRegistry(t){return r3.get(t)}static getMetadataFromRegistry(t){const r=this.getMetadataFromInternalRegistry(t),n=t.meta();if(!r)return n;const{_internal:a}=r,i=ds(r,["_internal"]),o=n??{},{id:l,title:s}=o,u=ds(o,["id","title"]);return Object.assign(Object.assign(Object.assign({_internal:Object.assign(Object.assign({},l?{refId:l}:{}),a)},i),s?{description:s}:{}),u)}static setMetadataInRegistry(t,r){r3.add(t,r)}}function Js(e,t){const r=e[t];typeof r=="function"&&(e[t]=function(...n){const a=r.apply(this,n),i=mr.getMetadataFromRegistry(this);return i&&mr.setMetadataInRegistry(a,i),a})}function hte(e){typeof e.ZodType.prototype.openapi<"u"||(e.ZodType.prototype.openapi=function(...t){const{refId:r,metadata:n,options:a}=Ate(...t),i=n??{},{param:o}=i,l=ds(i,["param"]),s=mr.getMetadataFromRegistry(this),u=s??{},{_internal:f}=u,g=ds(u,["_internal"]),d=Object.assign(Object.assign(Object.assign({},f),a),r?{refId:r}:void 0),h=Object.assign(Object.assign(Object.assign({},g),l),g!=null&&g.param||o?{param:Object.assign(Object.assign({},g==null?void 0:g.param),o)}:void 0),m=new this.constructor(this._def);function p(v){mr.setMetadataInRegistry(v,Object.assign(Object.assign({},Object.keys(d).length>0?{_internal:d}:void 0),h))}if(p(m),Ht(m,"ZodLazy")&&p(this),Ht(m,"ZodObject")){const v=mr.getMetadataFromRegistry(m),I=m.extend;m.extend=function(...y){const x=I.apply(m,y),E=v??{},{_internal:k}=E,S=ds(E,["_internal"]);return mr.setMetadataInRegistry(x,{_internal:{extendedFrom:k!=null&&k.refId?{refId:k.refId,schema:m}:k==null?void 0:k.extendedFrom}}),x.openapi(S)},Js(m,"catchall")}Js(m,"optional"),Js(m,"nullable"),Js(m,"default"),Js(m,"transform"),Js(m,"refine"),Js(m,"length"),Js(m,"min"),Js(m,"max");const C=m.meta;return m.meta=function(...v){const I=C.apply(this,v);if(v[0]){const y=mr.getMetadataFromInternalRegistry(this);y&&mr.setMetadataInRegistry(I,Object.assign(Object.assign({},y),v[0]))}return I},m})}function Ate(e,t,r){return typeof e=="string"?{refId:e,metadata:t,options:r}:{refId:void 0,metadata:e,options:t}}function mte(e){var t;return Cu((t=mr.getOpenApiMetadata(e))!==null&&t!==void 0?t:{},td)}function pte(e){return mr.getRefId(e)}class bte{constructor(t){this.parents=t,this._definitions=[]}get definitions(){var t,r;return[...(r=(t=this.parents)===null||t===void 0?void 0:t.flatMap(a=>a._definitions))!==null&&r!==void 0?r:[],...this._definitions]}register(t,r){const n=this.schemaWithRefId(t,r);return this._definitions.push({type:"schema",schema:n}),n}registerParameter(t,r){var n,a,i;const o=this.schemaWithRefId(t,r),l=(n=mr.getOpenApiMetadata(o))!==null&&n!==void 0?n:{},s=o.openapi(Object.assign(Object.assign({},l),{param:Object.assign(Object.assign({},l==null?void 0:l.param),{name:(i=(a=l==null?void 0:l.param)===null||a===void 0?void 0:a.name)!==null&&i!==void 0?i:t})}));return this._definitions.push({type:"parameter",schema:s}),s}registerPath(t){this._definitions.push({type:"route",route:t})}registerWebhook(t){this._definitions.push({type:"webhook",webhook:t})}registerComponent(t,r,n){return this._definitions.push({type:"component",componentType:t,name:r,component:n}),{name:r,ref:{$ref:`#/components/${t}/${r}`}}}schemaWithRefId(t,r){return r.openapi(t)}}class z2{constructor(t){this.message=t}}class k1 extends z2{constructor(t,r){super(t),this.data=r}}class T2 extends z2{constructor(t){super(`Missing parameter data, please specify \`${t.missingField}\` and other OpenAPI parameter props using the \`param\` field of \`schema.openapi\``),this.data=t}}function S1(e,t){try{return e()}catch(r){throw r instanceof T2?new T2(Object.assign(Object.assign({},r.data),t)):r}}class Cte extends z2{constructor(t){super("Unknown zod object type, please specify `type` and other OpenAPI props using `schema.openapi`."),this.data=t}}class vte{transform(t,r,n){var a,i,o,l;const s=t.def.element,u=(i=(a=t.def.checks)===null||a===void 0?void 0:a.find(g=>g._zod.def.check==="min_length"))===null||i===void 0?void 0:i._zod.def.minimum,f=(l=(o=t.def.checks)===null||o===void 0?void 0:o.find(g=>g._zod.def.check==="max_length"))===null||l===void 0?void 0:l._zod.def.maximum;return Object.assign(Object.assign({},r("array")),{items:ca(s)?n(s):{},minItems:u,maxItems:f})}}class pk{transform(t){return Object.assign(Object.assign({},t("string")),{pattern:"^\\d+$"})}}class yte{transform(t,r,n,a,i){const o=t.def.options.filter(ca),l=o.map(a);if(r)return{oneOf:n(l,r)};const s=t._zod.def.discriminator;return s?{oneOf:l,discriminator:this.mapDiscriminator(o,s,i)}:(console.error("No discriminator found for discriminated union",t),{oneOf:l})}mapDiscriminator(t,r,n){if(t.some(i=>mr.getRefId(i)===void 0))return;const a={};for(const i of t){const o=mr.getRefId(i),l=this.getDiscriminatorValues(i,r);for(const s of l)a[s]=n(o)}return{propertyName:r,mapping:a}}getDiscriminatorValues(t,r){var n;if(Ht(t,"ZodObject")){const a=(n=t.def.shape)===null||n===void 0?void 0:n[r];return a?Ht(a,"ZodEnum")?Object.values(a._zod.def.entries).filter(t3):Ht(a,"ZodLiteral")?a.def.values.filter(t3):[]:[]}if(Ht(t,"ZodDiscriminatedUnion")){const a=t.def.options.filter(ca);return[...new Set(a.flatMap(i=>this.getDiscriminatorValues(i,r)))]}return[]}}function bk(e){const r=Object.keys(e).filter(i=>typeof e[e[i]]!="number").map(i=>e[i]),n=r.filter(i=>typeof i=="number").length,a=n===0?"string":n===r.length?"numeric":"mixed";return{values:r,type:a}}class Ite{transform(t,r,n){const{type:a,values:i}=bk(t._zod.def.entries);if(a==="mixed")throw new z2("Enum has mixed string and number values, please specify the OpenAPI type manually");return Object.assign(Object.assign({},n(a==="numeric"?"integer":"string")),{enum:r?[...i,null]:i})}}class wte{transform(t,r,n,a){const o={allOf:this.flattenIntersectionTypes(t).map(a)};return r?{anyOf:n([o],r)}:o}flattenIntersectionTypes(t){if(!Ht(t,"ZodIntersection"))return[t];const r=ca(t._zod.def.left)?this.flattenIntersectionTypes(t._zod.def.left):[],n=ca(t._zod.def.right)?this.flattenIntersectionTypes(t._zod.def.right):[];return[...r,...n]}}class xte{constructor(){this.bigIntTransformer=new pk}transform(t,r){const n=typeof t.def.values[0];return n==="boolean"||n==="number"||n==="string"||n==="object"?Object.assign(Object.assign({},r(n)),{enum:[t.def.values[0]]}):n==="bigint"?this.bigIntTransformer.transform(r):r("null")}}class Ete{transform(t,r,n){var a;return Object.assign(Object.assign(Object.assign({},r("number")),r(t.format==="safeint"?"integer":"number")),n((a=t.def.checks)!==null&&a!==void 0?a:[]))}}class Bte{transform(t,r,n,a){var i;const o=(i=mr.getInternalMetadata(t))===null||i===void 0?void 0:i.extendedFrom,l=this.requiredKeysOf(t),s=E1(t.def.shape,a);if(!o)return Object.assign(Object.assign(Object.assign(Object.assign({},n("object")),{properties:s,default:r}),l.length>0?{required:l}:{}),this.generateAdditionalProperties(t,a));const u=o.schema;a(u);const f=this.requiredKeysOf(u),g=E1(u==null?void 0:u.def.shape,a),d=Object.fromEntries(Object.entries(s).filter(([p,C])=>!B1(g[p],C))),h=l.filter(p=>!f.includes(p)),m=Object.assign(Object.assign(Object.assign(Object.assign({},n("object")),{default:r,properties:d}),h.length>0?{required:h}:{}),this.generateAdditionalProperties(t,a));return{allOf:[{$ref:`#/components/schemas/${o.refId}`},m]}}generateAdditionalProperties(t,r){const n=t.def.catchall;return n?Ht(n,"ZodNever")?{additionalProperties:!1}:ca(n)?{additionalProperties:r(n)}:{}:{}}requiredKeysOf(t){return Object.entries(t.def.shape).filter(([r,n])=>!gk(n)).map(([r,n])=>r)}}class kte{transform(t,r,n){const a=t.valueType,i=t.keyType,o=ca(a)?n(a):{};if(Ht(i,"ZodEnum")){const s=Object.values(i._zod.def.entries).filter(t3).reduce((u,f)=>Object.assign(Object.assign({},u),{[f]:o}),{});return Object.assign(Object.assign({},r("object")),{properties:s})}return Object.assign(Object.assign({},r("object")),{additionalProperties:o})}}function Ste(e){return e._zod.def.check==="length_equals"}function _te(e){return e._zod.def.check==="string_format"&&e._zod.def.format==="regex"}class Dte{transform(t,r){var n,a,i,o;const l=(n=t.def.checks)===null||n===void 0?void 0:n.find(_te),s=l==null?void 0:l._zod.def.pattern.toString().replace(/^\/|\/$/g,""),u=(a=t.def.checks)===null||a===void 0?void 0:a.find(Ste),f=u==null?void 0:u._zod.def.length,g=Number.isFinite(t.minLength)&&(i=t.minLength)!==null&&i!==void 0?i:void 0,d=Number.isFinite(t.maxLength)&&(o=t.maxLength)!==null&&o!==void 0?o:void 0;return Object.assign(Object.assign({},r("string")),{minLength:f??g,maxLength:f??d,format:this.mapStringFormat(t),pattern:s})}mapStringFormat(t){if(t.format==="uuid"||t.format==="guid")return"uuid";if(t.format==="email")return"email";if(t.format==="url")return"uri";if(t.format==="date")return"date";if(t.format==="datetime")return"date-time";if(t.format==="time")return"time";if(t.format==="duration")return"duration";if(t.format==="cuid")return"cuid";if(t.format==="cuid2")return"cuid2";if(t.format==="ulid")return"ulid";if(t.format==="ipv4"||t.format==="ipv6")return"ip";if(t.format==="cidrv4")return"ipv4-cidr";if(t.format==="cidrv6")return"ipv6-cidr";if(t.format==="base64url")return"base64url";if(t.format==="emoji")return"emoji"}}class Nte{constructor(t){this.versionSpecifics=t}transform(t,r,n){const i=t._zod.def.items.map(o=>ca(o)?n(o):{});return Object.assign(Object.assign({},r("array")),this.versionSpecifics.mapTupleItems(i))}}class Rte{constructor(t){this.options=t}transform(t,r,n){var a,i,o;const l=mr.getInternalMetadata(t),s=(o=(a=l==null?void 0:l.unionPreferredType)!==null&&a!==void 0?a:(i=this.options)===null||i===void 0?void 0:i.unionPreferredType)!==null&&o!==void 0?o:"anyOf",f=this.flattenUnionTypes(t).map(g=>{const d=this.unwrapNullable(g);return n(d)});return{[s]:r(f)}}flattenUnionTypes(t){return Ht(t,"ZodUnion")?t.def.options.flatMap(n=>ca(n)?this.flattenUnionTypes(n):[]):[t]}unwrapNullable(t){if(Ht(t,"ZodNullable")){const r=t.unwrap();if(ca(r))return this.unwrapNullable(r)}return t}}class Fte{transform(t){return Object.assign(Object.assign({},t("string")),{format:"date-time"})}}class W2{transform(t,r,n,a){const i=r(t._zod.def.getter());return W2.mapRecursive(i,n,a)}static mapRecursive(t,r,n){return"$ref"in t?n(t):t.type?Object.assign(Object.assign({},t),r(t.type)):t}}class Zte{transform(t,r){const a=t.def.parts.map(i=>this.generatePattern(i)).join("");return Object.assign(Object.assign({},r("string")),{pattern:`^${a}$`})}generatePattern(t){if(typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"||t===null||t===void 0)return this.escapeRegex(String(t));if(Ht(t,"ZodLiteral")){const r=t.def.values[0];return this.escapeRegex(String(r))}if(Ht(t,"ZodNumber"))return"[+-]?\\d+(\\.\\d+)?";if(Ht(t,"ZodBoolean"))return"(true|false)";if(Ht(t,"ZodEnum")){const{values:r}=bk(t.def.entries);return`(${r.map(n=>this.escapeRegex(String(n))).join("|")})`}return".*"}escapeRegex(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}}class Gte{constructor(t,r){this.versionSpecifics=t,this.objectTransformer=new Bte,this.stringTransformer=new Dte,this.numberTransformer=new Ete,this.bigIntTransformer=new pk,this.dateTransformer=new Fte,this.lazyTransformer=new W2,this.literalTransformer=new xte,this.templateLiteralTransformer=new Zte,this.enumTransformer=new Ite,this.arrayTransformer=new vte,this.discriminatedUnionTransformer=new yte,this.intersectionTransformer=new wte,this.recordTransformer=new kte,this.tupleTransformer=new Nte(t),this.unionTransformer=new Rte(r)}transform(t,r,n,a,i){if(Ht(t,"ZodNull"))return this.versionSpecifics.nullType;if(Ht(t,"ZodUnknown")||Ht(t,"ZodAny"))return this.versionSpecifics.mapNullableType(void 0,r);if(Ht(t,"ZodObject"))return this.objectTransformer.transform(t,i,l=>this.versionSpecifics.mapNullableType(l,r),n);const o=this.transformSchemaWithoutDefault(t,r,n,a);return Object.assign(Object.assign({},o),{default:i})}transformSchemaWithoutDefault(t,r,n,a){if(Ht(t,"ZodUnknown")||Ht(t,"ZodAny"))return this.versionSpecifics.mapNullableType(void 0,r);if(Ht(t,"ZodString"))return this.stringTransformer.transform(t,o=>this.versionSpecifics.mapNullableType(o,r));if(Ht(t,"ZodNumber"))return this.numberTransformer.transform(t,o=>this.versionSpecifics.mapNullableType(o,r),o=>this.versionSpecifics.getNumberChecks(o));if(Ht(t,"ZodBigInt"))return this.bigIntTransformer.transform(o=>this.versionSpecifics.mapNullableType(o,r));if(Ht(t,"ZodBoolean"))return this.versionSpecifics.mapNullableType("boolean",r);if(Ht(t,"ZodLazy"))return this.lazyTransformer.transform(t,n,o=>this.versionSpecifics.mapNullableType(o,r),o=>this.versionSpecifics.mapNullableOfRef(o,r));if(Ht(t,"ZodLiteral"))return this.literalTransformer.transform(t,o=>this.versionSpecifics.mapNullableType(o,r));if(Ht(t,"ZodTemplateLiteral"))return this.templateLiteralTransformer.transform(t,o=>this.versionSpecifics.mapNullableType(o,r));if(Ht(t,"ZodEnum"))return this.enumTransformer.transform(t,r,o=>this.versionSpecifics.mapNullableType(o,r));if(Ht(t,"ZodArray"))return this.arrayTransformer.transform(t,o=>this.versionSpecifics.mapNullableType(o,r),n);if(Ht(t,"ZodTuple"))return this.tupleTransformer.transform(t,o=>this.versionSpecifics.mapNullableType(o,r),n);if(Ht(t,"ZodDiscriminatedUnion"))return this.discriminatedUnionTransformer.transform(t,r,o=>this.versionSpecifics.mapNullableOfArray(o,r),n,a);if(Ht(t,"ZodUnion"))return this.unionTransformer.transform(t,o=>this.versionSpecifics.mapNullableOfArray(o,r),n);if(Ht(t,"ZodIntersection"))return this.intersectionTransformer.transform(t,r,o=>this.versionSpecifics.mapNullableOfArray(o,r),n);if(Ht(t,"ZodRecord"))return this.recordTransformer.transform(t,o=>this.versionSpecifics.mapNullableType(o,r),n);if(Ht(t,"ZodDate"))return this.dateTransformer.transform(o=>this.versionSpecifics.mapNullableType(o,r));const i=mr.getRefId(t);throw new Cte({currentSchema:t.def,schemaName:i})}}class n3{constructor(t,r,n){this.definitions=t,this.versionSpecifics=r,this.options=n,this.schemaRefs={},this.paramRefs={},this.pathRefs={},this.rawComponents=[],this.openApiTransformer=new Gte(r,n),this.sortDefinitions()}generateDocumentData(){return this.definitions.forEach(t=>this.generateSingle(t)),{components:this.buildComponents(),paths:this.pathRefs}}generateComponents(){return this.definitions.forEach(t=>this.generateSingle(t)),{components:this.buildComponents()}}buildComponents(){var t,r,n,a;const i={};this.rawComponents.forEach(({componentType:d,name:h,component:m})=>{var p;(p=i[d])!==null&&p!==void 0||(i[d]={}),i[d][h]=m});const o=(t=i.schemas)!==null&&t!==void 0?t:{},l=Object.assign(Object.assign({},o),this.filteredSchemaRefs),s=((r=this.options)===null||r===void 0?void 0:r.sortComponents)==="alphabetically"?mk(l):l,u=(n=i.parameters)!==null&&n!==void 0?n:{},f=Object.assign(Object.assign({},u),this.paramRefs),g=((a=this.options)===null||a===void 0?void 0:a.sortComponents)==="alphabetically"?mk(f):f;return Object.assign(Object.assign({},i),{schemas:s,parameters:g})}isNotPendingRefEntry(t){return t[1]!=="pending"}get filteredSchemaRefs(){const t=Object.entries(this.schemaRefs).filter(this.isNotPendingRefEntry);return Object.fromEntries(t)}sortDefinitions(){const t=["schema","parameter","component","route","webhook"];this.definitions.sort((r,n)=>{if(!("type"in r))return"type"in n?-1:0;if(!("type"in n))return 1;const a=t.findIndex(o=>o===r.type),i=t.findIndex(o=>o===n.type);return a-i})}generateSingle(t){if(!("type"in t)){this.generateSchemaWithRef(t);return}switch(t.type){case"parameter":this.generateParameterDefinition(t.schema);return;case"schema":this.generateSchemaWithRef(t.schema);return;case"route":this.generateSingleRoute(t.route);return;case"component":this.rawComponents.push(t);return}}generateParameterDefinition(t){const r=mr.getRefId(t),n=this.generateParameter(t);return r&&(this.paramRefs[r]=n),n}getParameterRef(t,r){const n=mr.getOpenApiMetadata(t),a=mr.getInternalMetadata(t),i=n==null?void 0:n.param,o=a!=null&&a.refId?this.paramRefs[a.refId]:void 0;if(!(!(a!=null&&a.refId)||!o)){if(i&&o.in!==i.in||r!=null&&r.in&&o.in!==r.in)throw new k1(`Conflicting location for parameter ${o.name}`,{key:"in",values:hk([o.in,r==null?void 0:r.in,i==null?void 0:i.in])});if(i&&o.name!==i.name||r!=null&&r.name&&o.name!==(r==null?void 0:r.name))throw new k1("Conflicting names for parameter",{key:"name",values:hk([o.name,r==null?void 0:r.name,i==null?void 0:i.name])});return{$ref:`#/components/parameters/${a.refId}`}}}generateInlineParameters(t,r){const n=mr.getOpenApiMetadata(t),a=n==null?void 0:n.param,i=this.getParameterRef(t,{in:r});if(i)return[i];if(Ht(t,"ZodObject")){const o=t.def.shape;return Object.entries(o).map(([s,u])=>{var f;const g=mr.getOpenApiMetadata(u),d=this.getParameterRef(u,{in:r,name:s});if(d)return d;const h=g==null?void 0:g.param;if(h!=null&&h.name&&h.name!==s)throw new k1("Conflicting names for parameter",{key:"name",values:[s,h.name]});if(h!=null&&h.in&&h.in!==r)throw new k1(`Conflicting location for parameter ${(f=h.name)!==null&&f!==void 0?f:s}`,{key:"in",values:[r,h.in]});return this.generateParameter(u,{name:s,in:r})})}if(a!=null&&a.in&&a.in!==r)throw new k1(`Conflicting location for parameter ${a.name}`,{key:"in",values:[r,a.in]});return[this.generateParameter(t,{in:r})]}generateSimpleParameter(t,r){const n=mr.getParamMetadata(t),a=n==null?void 0:n.param,i=Object.assign(Object.assign({},a),r),o=!gk(t)&&!x1(t),l=this.generateSchemaWithRef(t);return Object.assign({schema:l,required:o},Object.keys(i).length>0?mr.buildParameterMetadata(i):{})}generateParameter(t,r){var n,a;const i=mr.getOpenApiMetadata(t),o=i==null?void 0:i.param,l=(n=r==null?void 0:r.name)!==null&&n!==void 0?n:o==null?void 0:o.name,s=(a=r==null?void 0:r.in)!==null&&a!==void 0?a:o==null?void 0:o.in;if(!l)throw new T2({missingField:"name"});if(!s)throw new T2({missingField:"in",paramName:l});const u=this.generateSimpleParameter(t,r);return Object.assign(Object.assign({},u),{in:s,name:l})}generateSchemaWithMetadata(t){const r=mr.unwrapChained(t),n=mr.getOpenApiMetadata(t),a=mr.getDefaultValue(t),i=mr.getRefId(t);if(i&&typeof this.schemaRefs[i]=="object")return this.schemaRefs[i];if(i&&this.schemaRefs[i]==="pending"){const l={$ref:this.generateSchemaRef(i)};return this.versionSpecifics.mapNullableOfRef(l,x1(t))}i&&!this.schemaRefs[i]&&(this.schemaRefs[i]="pending");const o=n!=null&&n.type?{type:n.type}:this.toOpenAPISchema(r,x1(t),a);return n?mr.applySchemaMetadata(o,n):Cu(o,td)}constructReferencedOpenAPISchema(t){const r=mr.getOpenApiMetadata(t),n=mr.unwrapChained(t),a=mr.getDefaultValue(t),i=x1(t);if(r!=null&&r.type)return this.versionSpecifics.mapNullableType(r.type,i);const o=mr.getRefId(t);if(o&&typeof this.schemaRefs[o]=="object")return W2.mapRecursive(this.schemaRefs[o],l=>this.versionSpecifics.mapNullableType(l,i),l=>this.versionSpecifics.mapNullableOfRef(l,i));if(o&&this.schemaRefs[o]==="pending"){const l={$ref:this.generateSchemaRef(o)};return this.versionSpecifics.mapNullableOfRef(l,i)}return o&&!this.schemaRefs[o]&&(this.schemaRefs[o]="pending"),this.toOpenAPISchema(n,i,a)}generateSimpleSchema(t){const r=mr.getOpenApiMetadata(t),n=mr.getRefId(t);if(!n||!this.schemaRefs[n])return this.generateSchemaWithMetadata(t);const a=this.schemaRefs[n],i={$ref:this.generateSchemaRef(n)};if(this.schemaRefs[n]==="pending")return this.versionSpecifics.mapNullableOfRef(i,x1(t));const o=Cu(mr.buildSchemaMetadata(r??{}),(u,f)=>u===void 0||B1(u,a[f]));if(o.type)return{allOf:[i,o]};const l=Cu(this.constructReferencedOpenAPISchema(t),(u,f)=>u===void 0||B1(u,a[f])),s=mr.applySchemaMetadata(l,o);return Object.keys(s).length>0?{allOf:[i,s]}:i}generateSchemaWithRef(t){const r=mr.getRefId(t);return r&&!this.schemaRefs[r]?(this.schemaRefs[r]=this.generateSimpleSchema(t),{$ref:this.generateSchemaRef(r)}):this.generateSimpleSchema(t)}generateSchemaRef(t){return`#/components/schemas/${t}`}getRequestBody(t){if(!t)return;const{content:r}=t,n=ds(t,["content"]),a=this.getBodyContent(r);return Object.assign(Object.assign({},n),{content:a})}getParameters(t){if(!t)return[];const{headers:r}=t,n=this.cleanParameter(t.query),a=this.cleanParameter(t.params),i=this.cleanParameter(t.cookies),o=S1(()=>n?this.generateInlineParameters(n,"query"):[],{location:"query"}),l=S1(()=>a?this.generateInlineParameters(a,"path"):[],{location:"path"}),s=S1(()=>i?this.generateInlineParameters(i,"cookie"):[],{location:"cookie"}),u=S1(()=>{if(Array.isArray(r))return r.flatMap(g=>this.generateInlineParameters(g,"header"));const f=this.cleanParameter(r);return f?this.generateInlineParameters(f,"header"):[]},{location:"header"});return[...l,...o,...u,...s]}cleanParameter(t){if(t){if(Ht(t,"ZodPipe")){const r=t._zod.def.in,n=t._zod.def.out;return Ht(r,"ZodObject")?this.cleanParameter(r):Ht(n,"ZodObject")?this.cleanParameter(n):void 0}return t}}generatePath(t){const{method:r,path:n,request:a,responses:i}=t,o=ds(t,["method","path","request","responses"]),l=E1(i,g=>this.getResponse(g)),s=S1(()=>this.getParameters(a),{route:`${r} ${n}`}),u=this.getRequestBody(a==null?void 0:a.body);return{[r]:Object.assign(Object.assign(Object.assign(Object.assign({},o),s.length>0?{parameters:[...o.parameters||[],...s]}:{}),u?{requestBody:u}:{}),{responses:l})}}generateSingleRoute(t){const r=this.generatePath(t);return this.pathRefs[t.path]=Object.assign(Object.assign({},this.pathRefs[t.path]),r),r}getResponse(t){if(this.isReferenceObject(t))return t;const{content:r,headers:n}=t,a=ds(t,["content","headers"]),i=r?{content:this.getBodyContent(r)}:{};if(!n)return Object.assign(Object.assign({},a),i);const o=Ht(n,"ZodObject")?this.getResponseHeaders(n):n;return Object.assign(Object.assign(Object.assign({},a),{headers:o}),i)}isReferenceObject(t){return"$ref"in t}getResponseHeaders(t){const r=t.def.shape;return E1(r,a=>this.generateSimpleParameter(a))}getBodyContent(t){return E1(t,r=>{if(!r||"$ref"in r)return r;const{schema:n,itemSchema:a}=r,i=ds(r,["schema","itemSchema"]),o=typeof n=="object"&&ca(n)?this.generateSchemaWithRef(n):n,l=typeof a=="object"&&ca(a)?this.generateSchemaWithRef(a):a;return Object.assign(Object.assign(Object.assign({},i),o!==void 0?{schema:o}:{}),l!==void 0?{itemSchema:l}:{})})}toOpenAPISchema(t,r,n){return this.openApiTransformer.transform(t,r,i=>this.generateSchemaWithRef(i),i=>this.generateSchemaRef(i),n)}}class Lte{get nullType(){return{nullable:!0}}mapNullableOfArray(t,r){return r&&!t.some(n=>B1(n,this.nullType))?[...t,this.nullType]:t}mapNullableType(t,r){return Object.assign(Object.assign({},t?{type:t}:void 0),r?this.nullType:void 0)}mapNullableOfRef(t,r){return r?{allOf:[t,this.nullType]}:t}mapTupleItems(t){const r=Ak(t);return{items:r.length===1?r[0]:{anyOf:r},minItems:t.length,maxItems:t.length}}getNumberChecks(t){return Object.assign({},...t.map(r=>{switch(r._zod.def.check){case"greater_than":{const n=r;return n._zod.def.inclusive?{minimum:Number(n._zod.def.value)}:{minimum:Number(n._zod.def.value),exclusiveMinimum:!0}}case"less_than":{const n=r;return n._zod.def.inclusive?{maximum:Number(n._zod.def.value)}:{maximum:Number(n._zod.def.value),exclusiveMaximum:!n._zod.def.inclusive}}default:return{}}}))}}class Qte{constructor(t,r){const n=new Lte;this.generator=new n3(t,n,r)}generateDocument(t){const r=this.generator.generateDocumentData();return Object.assign(Object.assign({},t),r)}generateComponents(){return this.generator.generateComponents()}}class Ck{get nullType(){return{type:"null"}}mapNullableOfArray(t,r){return r&&!t.some(n=>B1(n,this.nullType))?[...t,this.nullType]:t}mapNullableType(t,r){if(!t)return{};if(r){const n=Array.isArray(t)?t:[t];return{type:Ak([...n,"null"])}}return{type:t}}mapNullableOfRef(t,r){return r?{oneOf:[t,this.nullType]}:t}mapTupleItems(t){return{prefixItems:t}}getNumberChecks(t){return Object.assign({},...t.map(r=>{switch(r._zod.def.check){case"greater_than":{const n=r;return n._zod.def.inclusive?{minimum:Number(n._zod.def.value)}:{exclusiveMinimum:Number(n._zod.def.value)}}case"less_than":{const n=r;return n._zod.def.inclusive?{maximum:Number(n._zod.def.value)}:{exclusiveMaximum:Number(n._zod.def.value)}}default:return{}}}))}}function zte(e){return"type"in e&&e.type==="webhook"}class Tte{constructor(t,r){this.definitions=t,this.webhookRefs={};const n=new Ck;this.generator=new n3(this.definitions,n,r)}generateDocument(t){this.generateWebhooks();const r=this.generator.generateDocumentData();return Object.assign(Object.assign(Object.assign({},t),r),{webhooks:this.webhookRefs})}generateComponents(){return this.generator.generateComponents()}generateWebhooks(){this.webhookRefs={},this.definitions.filter(zte).forEach(t=>this.generateSingleWebhook(t.webhook))}generateSingleWebhook(t){const r=this.generator.generatePath(t);return this.webhookRefs[t.path]=Object.assign(Object.assign({},this.webhookRefs[t.path]),r),r}}function Wte(e){return"type"in e&&e.type==="webhook"}class Mte{constructor(t,r){this.definitions=t,this.webhookRefs={};const n=new Ck;this.generator=new n3(this.definitions,n,r)}generateDocument(t){this.generateWebhooks();const r=this.generator.generateDocumentData();return Object.assign(Object.assign(Object.assign({},t),r),{webhooks:this.webhookRefs})}generateComponents(){return this.generator.generateComponents()}generateWebhooks(){this.webhookRefs={},this.definitions.filter(Wte).forEach(t=>this.generateSingleWebhook(t.webhook))}generateSingleWebhook(t){const r=this.generator.generatePath(t);return this.webhookRefs[t.path]=Object.assign(Object.assign({},this.webhookRefs[t.path]),r),r}}const Ote=Ox(Object.freeze(Object.defineProperty({__proto__:null,OpenAPIRegistry:bte,OpenApiGeneratorV3:Qte,OpenApiGeneratorV31:Tte,OpenApiGeneratorV32:Mte,extendZodWithOpenApi:hte,getOpenApiMetadata:mte,getRefId:pte,zodToOpenAPIRegistry:r3},Symbol.toStringTag,{value:"Module"})));var vk={},a3=Object.defineProperty,Yte=Object.getOwnPropertyDescriptor,Pte=Object.getOwnPropertyNames,Vte=Object.prototype.hasOwnProperty,jte=(e,t)=>{for(var r in t)a3(e,r,{get:t[r],enumerable:!0})},Hte=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Pte(t))!Vte.call(e,a)&&a!==r&&a3(e,a,{get:()=>t[a],enumerable:!(n=Yte(t,a))||n.enumerable});return e},Ute=e=>Hte(a3({},"__esModule",{value:!0}),e),yk={};jte(yk,{checkOptionalParameter:()=>tre,decodeURIComponent_:()=>Sk,getPath:()=>xk,getPathNoStrict:()=>ere,getPattern:()=>Kte,getQueryParam:()=>rre,getQueryParams:()=>nre,getQueryStrings:()=>qte,mergePath:()=>Ek,splitPath:()=>Ik,splitRoutingPath:()=>Xte,tryDecode:()=>i3,tryDecodeURI:()=>wk,tryDecodeURIComponent:()=>Bk});var vu=Ute(yk);const Ik=e=>{const t=e.split("/");return t[0]===""&&t.shift(),t},Xte=e=>{const{groups:t,path:r}=$te(e),n=Ik(r);return Jte(n,t)},$te=e=>{const t=[];return e=e.replace(/\{[^}]+\}/g,(r,n)=>{const a=`@${n}`;return t.push([a,r]),a}),{groups:t,path:e}},Jte=(e,t)=>{for(let r=t.length-1;r>=0;r--){const[n]=t[r];for(let a=e.length-1;a>=0;a--)if(e[a].includes(n)){e[a]=e[a].replace(n,t[r][1]);break}}return e},M2={},Kte=(e,t)=>{if(e==="*")return"*";const r=e.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);if(r){const n=`${e}#${t}`;return M2[n]||(r[2]?M2[n]=t&&t[0]!==":"&&t[0]!=="*"?[n,r[1],new RegExp(`^${r[2]}(?=/${t})`)]:[e,r[1],new RegExp(`^${r[2]}$`)]:M2[n]=[e,r[1],!0]),M2[n]}return null},i3=(e,t)=>{try{return t(e)}catch{return e.replace(/(?:%[0-9A-Fa-f]{2})+/g,r=>{try{return t(r)}catch{return r}})}},wk=e=>i3(e,decodeURI),xk=e=>{const t=e.url,r=t.indexOf("/",t.indexOf(":")+4);let n=r;for(;n<t.length;n++){const a=t.charCodeAt(n);if(a===37){const i=t.indexOf("?",n),o=t.indexOf("#",n),l=i===-1?o===-1?void 0:o:o===-1?i:Math.min(i,o),s=t.slice(r,l);return wk(s.includes("%25")?s.replace(/%25/g,"%2525"):s)}else if(a===63||a===35)break}return t.slice(r,n)},qte=e=>{const t=e.indexOf("?",8);if(t===-1)return"";const r=e.indexOf("#",8);return r===-1?e.slice(t):t<r?e.slice(t,r):""},ere=e=>{const t=xk(e);return t.length>1&&t.at(-1)==="/"?t.slice(0,-1):t},Ek=(e,t,...r)=>(r.length&&(t=Ek(t,...r)),`${(e==null?void 0:e[0])==="/"?"":"/"}${e}${t==="/"?"":`${(e==null?void 0:e.at(-1))==="/"?"":"/"}${(t==null?void 0:t[0])==="/"?t.slice(1):t}`}`),tre=e=>{if(e.charCodeAt(e.length-1)!==63||!e.includes(":"))return null;const t=e.split("/"),r=[];let n="";return t.forEach(a=>{if(a!==""&&!/\:/.test(a))n+="/"+a;else if(/\:/.test(a))if(a.charCodeAt(a.length-1)===63){r.length===0&&n===""?r.push("/"):r.push(n);const i=a.slice(0,-1);n+="/"+i,r.push(n)}else n+="/"+a}),r.filter((a,i,o)=>o.indexOf(a)===i)},Bk=e=>e.indexOf("%")!==-1?i3(e,Sk):e,o3=e=>(e.indexOf("+")!==-1&&(e=e.replace(/\+/g," ")),Bk(e)),kk=(e,t,r)=>{const n=e.indexOf("#",8);n!==-1&&(e=e.slice(0,n));let a;if(!r&&t&&t.indexOf("%")===-1&&t.indexOf("+")===-1){let l=e.indexOf("?",8);if(l===-1)return;for(e.startsWith(t,l+1)||(l=e.indexOf(`&${t}`,l+1));l!==-1;){const s=e.charCodeAt(l+t.length+1);if(s===61){const u=l+t.length+2,f=e.indexOf("&",u);return o3(e.slice(u,f===-1?void 0:f))}else if(s==38||isNaN(s))return"";l=e.indexOf(`&${t}`,l+1)}if(a=/[%+]/.test(e),!a)return}const i=Object.create(null);a??(a=/[%+]/.test(e));let o=e.indexOf("?",8);for(;o!==-1;){const l=e.indexOf("&",o+1);let s=e.indexOf("=",o);s>l&&l!==-1&&(s=-1);let u=e.slice(o+1,s===-1?l===-1?void 0:l:s);if(a&&(u=o3(u)),o=l,u==="")continue;let f;s===-1?f="":(f=e.slice(s+1,l===-1?void 0:l),a&&(f=o3(f))),r?(i[u]&&Array.isArray(i[u])||(i[u]=[]),i[u].push(f)):i[u]??(i[u]=f)}return t?i[t]:i},rre=kk,nre=(e,t)=>kk(e,t,!0),Sk=decodeURIComponent;var s3=Object.defineProperty,are=Object.getOwnPropertyDescriptor,ire=Object.getOwnPropertyNames,ore=Object.prototype.hasOwnProperty,sre=(e,t)=>{for(var r in t)s3(e,r,{get:t[r],enumerable:!0})},lre=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of ire(t))!ore.call(e,a)&&a!==r&&s3(e,a,{get:()=>t[a],enumerable:!(n=are(t,a))||n.enumerable});return e},cre=e=>lre(s3({},"__esModule",{value:!0}),e),_k={};sre(_k,{parse:()=>Rk,parseSigned:()=>pre,serialize:()=>bre,serializeSigned:()=>Cre});var ure=cre(_k),dre=vu;const l3={name:"HMAC",hash:"SHA-256"},Dk=async e=>{const t=typeof e=="string"?new TextEncoder().encode(e):e;return await crypto.subtle.importKey("raw",t,l3,!1,["sign","verify"])},fre=async(e,t)=>{const r=await Dk(t),n=await crypto.subtle.sign(l3.name,r,new TextEncoder().encode(e));return btoa(String.fromCharCode(...new Uint8Array(n)))},gre=async(e,t,r)=>{try{const n=atob(e),a=new Uint8Array(n.length);for(let i=0,o=n.length;i<o;i++)a[i]=n.charCodeAt(i);return await crypto.subtle.verify(l3,r,a,new TextEncoder().encode(t))}catch{return!1}},hre=/^[\w!#$%&'*.^`|~+-]+$/,Are=/^[!#-:<>-[\]-~]+$/,mre=/^[ !#-:<-[\]-~]*$/,Nk=e=>{let t=0,r=e.length;for(;t<r;){const n=e.charCodeAt(t);if(n!==32&&n!==9)break;t++}for(;r>t;){const n=e.charCodeAt(r-1);if(n!==32&&n!==9)break;r--}return t===0&&r===e.length?e:e.slice(t,r)},Rk=(e,t)=>{if(t&&e.indexOf(t)===-1)return{};const r=e.split(";"),n=Object.create(null);for(const a of r){const i=a.indexOf("=");if(i===-1)continue;const o=Nk(a.substring(0,i));if(t&&t!==o||!Are.test(o)||o in n)continue;let l=Nk(a.substring(i+1));if(l.startsWith('"')&&l.endsWith('"')&&(l=l.slice(1,-1)),mre.test(l)&&(n[o]=(0,dre.tryDecodeURIComponent)(l),t))break}return n},pre=async(e,t,r)=>{const n=Object.create(null),a=await Dk(t);for(const[i,o]of Object.entries(Rk(e,r))){const l=o.lastIndexOf(".");if(l<0)continue;const s=o.substring(0,l),u=o.substring(l+1);if(u.length!==44||!u.endsWith("="))continue;const f=await gre(u,s,a);n[i]=f?s:!1}return n},Fk=(e,t,r={})=>{if(!hre.test(e))throw new Error("Invalid cookie name");let n=`${e}=${t}`;if(e.startsWith("__Secure-")&&!r.secure)throw new Error("__Secure- Cookie must have Secure attributes");if(e.startsWith("__Host-")){if(!r.secure)throw new Error("__Host- Cookie must have Secure attributes");if(r.path!=="/")throw new Error('__Host- Cookie must have Path attributes with "/"');if(r.domain)throw new Error("__Host- Cookie must not have Domain attributes")}for(const a of["domain","path","sameSite","priority"])if(r[a]&&/[;\r\n]/.test(r[a]))throw new Error(`${a} must not contain ";", "\\r", or "\\n"`);if(r&&typeof r.maxAge=="number"&&r.maxAge>=0){if(r.maxAge>3456e4)throw new Error("Cookies Max-Age SHOULD NOT be greater than 400 days (34560000 seconds) in duration.");n+=`; Max-Age=${r.maxAge|0}`}if(r.domain&&r.prefix!=="host"&&(n+=`; Domain=${r.domain}`),r.path&&(n+=`; Path=${r.path}`),r.expires){if(r.expires.getTime()-Date.now()>3456e7)throw new Error("Cookies Expires SHOULD NOT be greater than 400 days (34560000 seconds) in the future.");n+=`; Expires=${r.expires.toUTCString()}`}if(r.httpOnly&&(n+="; HttpOnly"),r.secure&&(n+="; Secure"),r.sameSite&&(n+=`; SameSite=${r.sameSite.charAt(0).toUpperCase()+r.sameSite.slice(1)}`),r.priority&&(n+=`; Priority=${r.priority.charAt(0).toUpperCase()+r.priority.slice(1)}`),r.partitioned){if(!r.secure)throw new Error("Partitioned Cookie must have Secure attributes");n+="; Partitioned"}return n},bre=(e,t,r)=>(t=encodeURIComponent(t),Fk(e,t,r)),Cre=async(e,t,r,n={})=>{const a=await fre(t,r);return t=`${t}.${a}`,t=encodeURIComponent(t),Fk(e,t,n)};var c3=Object.defineProperty,vre=Object.getOwnPropertyDescriptor,yre=Object.getOwnPropertyNames,Ire=Object.prototype.hasOwnProperty,wre=(e,t)=>{for(var r in t)c3(e,r,{get:t[r],enumerable:!0})},xre=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of yre(t))!Ire.call(e,a)&&a!==r&&c3(e,a,{get:()=>t[a],enumerable:!(n=vre(t,a))||n.enumerable});return e},Ere=e=>xre(c3({},"__esModule",{value:!0}),e),Zk={};wre(Zk,{deleteCookie:()=>_re,generateCookie:()=>Lk,generateSignedCookie:()=>zk,getCookie:()=>Gk,getSignedCookie:()=>kre,setCookie:()=>Qk,setSignedCookie:()=>Sre});var Bre=Ere(Zk),fs=ure;const Gk=(e,t,r)=>{const n=e.req.raw.headers.get("Cookie");if(typeof t=="string"){if(!n)return;let i=t;return r==="secure"?i="__Secure-"+t:r==="host"&&(i="__Host-"+t),(0,fs.parse)(n,i)[i]}return n?(0,fs.parse)(n):{}},kre=async(e,t,r,n)=>{const a=e.req.raw.headers.get("Cookie");if(typeof r=="string"){if(!a)return;let o=r;return n==="secure"?o="__Secure-"+r:n==="host"&&(o="__Host-"+r),(await(0,fs.parseSigned)(a,t,o))[o]}return a?await(0,fs.parseSigned)(a,t):{}},Lk=(e,t,r)=>{let n;return(r==null?void 0:r.prefix)==="secure"?n=(0,fs.serialize)("__Secure-"+e,t,{path:"/",...r,secure:!0}):(r==null?void 0:r.prefix)==="host"?n=(0,fs.serialize)("__Host-"+e,t,{...r,path:"/",secure:!0,domain:void 0}):n=(0,fs.serialize)(e,t,{path:"/",...r}),n},Qk=(e,t,r,n)=>{const a=Lk(t,r,n);e.header("Set-Cookie",a,{append:!0})},zk=async(e,t,r,n)=>{let a;return(n==null?void 0:n.prefix)==="secure"?a=await(0,fs.serializeSigned)("__Secure-"+e,t,r,{path:"/",...n,secure:!0}):(n==null?void 0:n.prefix)==="host"?a=await(0,fs.serializeSigned)("__Host-"+e,t,r,{...n,path:"/",secure:!0,domain:void 0}):a=await(0,fs.serializeSigned)(e,t,r,{path:"/",...n}),a},Sre=async(e,t,r,n,a)=>{const i=await zk(t,r,n,a);e.header("set-cookie",i,{append:!0})},_re=(e,t,r)=>{const n=Gk(e,t,r==null?void 0:r.prefix);return Qk(e,t,"",{...r,maxAge:0}),n};var u3=Object.defineProperty,Dre=Object.getOwnPropertyDescriptor,Nre=Object.getOwnPropertyNames,Rre=Object.prototype.hasOwnProperty,Fre=(e,t)=>{for(var r in t)u3(e,r,{get:t[r],enumerable:!0})},Zre=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Nre(t))!Rre.call(e,a)&&a!==r&&u3(e,a,{get:()=>t[a],enumerable:!(n=Dre(t,a))||n.enumerable});return e},Gre=e=>Zre(u3({},"__esModule",{value:!0}),e),Tk={};Fre(Tk,{HTTPException:()=>Lre});var Wk=Gre(Tk);class Lre extends Error{constructor(r=500,n){super(n==null?void 0:n.message,{cause:n==null?void 0:n.cause});Be(this,"res");Be(this,"status");this.res=n==null?void 0:n.res,this.status=r}getResponse(){return this.res?new Response(this.res.body,{status:this.status,headers:this.res.headers}):new Response(this.message,{status:this.status})}}var d3=Object.defineProperty,Qre=Object.getOwnPropertyDescriptor,zre=Object.getOwnPropertyNames,Tre=Object.prototype.hasOwnProperty,Wre=(e,t)=>{for(var r in t)d3(e,r,{get:t[r],enumerable:!0})},Mre=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of zre(t))!Tre.call(e,a)&&a!==r&&d3(e,a,{get:()=>t[a],enumerable:!(n=Qre(t,a))||n.enumerable});return e},Ore=e=>Mre(d3({},"__esModule",{value:!0}),e),Mk={};Wre(Mk,{createHash:()=>O2,md5:()=>jre,sha1:()=>Vre,sha256:()=>Pre});var Yre=Ore(Mk);const Pre=async e=>await O2(e,{name:"SHA-256"}),Vre=async e=>await O2(e,{name:"SHA-1"}),jre=async e=>await O2(e,{name:"MD5"}),O2=async(e,t)=>{let r;if(ArrayBuffer.isView(e)||e instanceof ArrayBuffer?r=e:(typeof e=="object"&&(e=JSON.stringify(e)),r=new TextEncoder().encode(String(e))),crypto&&crypto.subtle){const n=await crypto.subtle.digest({name:t.name},r);return Array.prototype.map.call(new Uint8Array(n),i=>("00"+i.toString(16)).slice(-2)).join("")}return null};var f3=Object.defineProperty,Hre=Object.getOwnPropertyDescriptor,Ure=Object.getOwnPropertyNames,Xre=Object.prototype.hasOwnProperty,$re=(e,t)=>{for(var r in t)f3(e,r,{get:t[r],enumerable:!0})},Jre=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Ure(t))!Xre.call(e,a)&&a!==r&&f3(e,a,{get:()=>t[a],enumerable:!(n=Hre(t,a))||n.enumerable});return e},Kre=e=>Jre(f3({},"__esModule",{value:!0}),e),Ok={};$re(Ok,{bufferToFormData:()=>rne,bufferToString:()=>tne,equal:()=>qre,timingSafeEqual:()=>ene});var Yk=Kre(Ok),Pk=Yre;const qre=(e,t)=>{if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;const r=new DataView(e),n=new DataView(t);let a=r.byteLength;for(;a--;)if(r.getUint8(a)!==n.getUint8(a))return!1;return!0},Vk=(e,t)=>{const r=e.length,n=t.length,a=Math.max(r,n);let i=r^n;for(let o=0;o<a;o++){const l=o<r?e.charCodeAt(o):0,s=o<n?t.charCodeAt(o):0;i|=l^s}return i===0},jk=async(e,t,r)=>{r||(r=Pk.sha256);const[n,a]=await Promise.all([r(e),r(t)]);if(n==null||a==null||typeof n!="string"||typeof a!="string")return!1;const i=Vk(n,a),o=Vk(e,t);return i&&o},ene=async(e,t,r)=>{if(typeof e=="string"&&typeof t=="string")return jk(e,t,r);r||(r=Pk.sha256);const[n,a]=await Promise.all([r(e),r(t)]);return!n||!a||typeof n!="string"||typeof a!="string"?!1:jk(n,a)},tne=e=>e instanceof ArrayBuffer?new TextDecoder("utf-8").decode(e):e,rne=(e,t)=>new Response(e,{headers:{"Content-Type":t.replace(/^[^;]+/,n=>n.toLowerCase())}}).formData();var g3=Object.defineProperty,nne=Object.getOwnPropertyDescriptor,ane=Object.getOwnPropertyNames,ine=Object.prototype.hasOwnProperty,one=(e,t)=>{for(var r in t)g3(e,r,{get:t[r],enumerable:!0})},sne=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of ane(t))!ine.call(e,a)&&a!==r&&g3(e,a,{get:()=>t[a],enumerable:!(n=nne(t,a))||n.enumerable});return e},lne=e=>sne(g3({},"__esModule",{value:!0}),e),Hk={};one(Hk,{validator:()=>Ane});var cne=lne(Hk),une=Bre,Uk=Wk,dne=Yk;const fne=/^application\/([a-z-\.]+\+)?json(;\s*[a-zA-Z0-9\-]+\=([^;]+))*$/i,gne=/^multipart\/form-data(;\s?boundary=[a-zA-Z0-9'"()+_,\-./:=?]+)?$/i,hne=/^application\/x-www-form-urlencoded(;\s*[a-zA-Z0-9\-]+\=([^;]+))*$/i,Ane=(e,t)=>async(r,n)=>{let a={};const i=r.req.header("Content-Type");switch(e){case"json":if(!i||!fne.test(i))break;try{a=await r.req.json()}catch{const l="Malformed JSON in request body";throw new Uk.HTTPException(400,{message:l})}break;case"form":{if(!i||!(gne.test(i)||hne.test(i)))break;let l;if(r.req.bodyCache.formData)l=await r.req.bodyCache.formData;else try{const u=await r.req.arrayBuffer();l=await(0,dne.bufferToFormData)(u,i),r.req.bodyCache.formData=l}catch(u){let f="Malformed FormData request.";throw f+=u instanceof Error?` ${u.message}`:` ${String(u)}`,new Uk.HTTPException(400,{message:f})}const s=Object.create(null);l.forEach((u,f)=>{f.endsWith("[]")?(s[f]??(s[f]=[])).push(u):Array.isArray(s[f])?s[f].push(u):Object.hasOwn(s,f)?s[f]=[s[f],u]:s[f]=u}),a=s;break}case"query":a=Object.fromEntries(Object.entries(r.req.queries()).map(([l,s])=>s.length===1?[l,s[0]]:[l,s]));break;case"param":a=r.req.param();break;case"header":a=r.req.header();break;case"cookie":a=(0,une.getCookie)(r);break}const o=await t(a,r);return o instanceof Response?o:(r.req.addValidatedData(e,o),await n())};var h3=Object.defineProperty,mne=Object.getOwnPropertyDescriptor,pne=Object.getOwnPropertyNames,bne=Object.prototype.hasOwnProperty,Cne=(e,t)=>{for(var r in t)h3(e,r,{get:t[r],enumerable:!0})},vne=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of pne(t))!bne.call(e,a)&&a!==r&&h3(e,a,{get:()=>t[a],enumerable:!(n=mne(t,a))||n.enumerable});return e},yne=e=>vne(h3({},"__esModule",{value:!0}),e),Xk={};Cne(Xk,{validator:()=>wne.validator});var Ine=yne(Xk),wne=cne;(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});let t=Ine;function r(a,i,o,l){return(0,t.validator)(a,async(s,u)=>{let f=s;if(a==="header"&&"_def"in i||a==="header"&&"_zod"in i){const d=Object.keys("in"in i?i.in.shape:i.shape),h=Object.fromEntries(d.map(m=>[m.toLowerCase(),m]));f=Object.fromEntries(Object.entries(s).map(([m,p])=>[h[m]||m,p]))}const g=l&&l.validationFunction?await l.validationFunction(i,f):await i.safeParseAsync(f);if(o){const d=await o({data:f,...g,target:a},u);if(d){if(d instanceof Response)return d;if("response"in d)return d.response}}return g.success?g.data:u.json(g,400)})}const n=r;e.zValidator=n})(vk);var A3=Object.defineProperty,xne=Object.getOwnPropertyDescriptor,Ene=Object.getOwnPropertyNames,Bne=Object.prototype.hasOwnProperty,kne=(e,t)=>{for(var r in t)A3(e,r,{get:t[r],enumerable:!0})},Sne=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Ene(t))!Bne.call(e,a)&&a!==r&&A3(e,a,{get:()=>t[a],enumerable:!(n=xne(t,a))||n.enumerable});return e},_ne=e=>Sne(A3({},"__esModule",{value:!0}),e),$k={};kne($k,{compose:()=>Nne});var Dne=_ne($k);const Nne=(e,t,r)=>(n,a)=>{let i=-1;return o(0);async function o(l){if(l<=i)throw new Error("next() called multiple times");i=l;let s,u=!1,f;if(e[l]?(f=e[l][0][0],n.req.routeIndex=l):f=l===e.length&&a||void 0,f)try{s=await f(n,()=>o(l+1))}catch(g){if(g instanceof Error&&t)n.error=g,s=await t(g,n),u=!0;else throw g}else n.finalized===!1&&r&&(s=await r(n));return s&&(n.finalized===!1||u)&&(n.res=s),n}};var m3=Object.defineProperty,Rne=Object.getOwnPropertyDescriptor,Fne=Object.getOwnPropertyNames,Zne=Object.prototype.hasOwnProperty,Gne=(e,t)=>{for(var r in t)m3(e,r,{get:t[r],enumerable:!0})},Lne=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Fne(t))!Zne.call(e,a)&&a!==r&&m3(e,a,{get:()=>t[a],enumerable:!(n=Rne(t,a))||n.enumerable});return e},Qne=e=>Lne(m3({},"__esModule",{value:!0}),e),Jk={};Gne(Jk,{GET_MATCH_RESULT:()=>Tne});var zne=Qne(Jk);const Tne=Symbol();var p3=Object.defineProperty,Wne=Object.getOwnPropertyDescriptor,Mne=Object.getOwnPropertyNames,One=Object.prototype.hasOwnProperty,Yne=(e,t)=>{for(var r in t)p3(e,r,{get:t[r],enumerable:!0})},Pne=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Mne(t))!One.call(e,a)&&a!==r&&p3(e,a,{get:()=>t[a],enumerable:!(n=Wne(t,a))||n.enumerable});return e},Vne=e=>Pne(p3({},"__esModule",{value:!0}),e),Kk={};Yne(Kk,{parseBody:()=>Xne});var jne=Vne(Kk),Hne=Yk;const qk=32,Une=1e4,Y2=e=>"headers"in e,Xne=async(e,t=Object.create(null))=>{const{all:r=!1,dot:n=!1}=t,i=(Y2(e)?e.headers:e.raw.headers).get("Content-Type"),o=i==null?void 0:i.split(";")[0].trim().toLowerCase();return o==="multipart/form-data"||o==="application/x-www-form-urlencoded"?$ne(e,{all:r,dot:n}):{}};async function $ne(e,t){if(!Y2(e)&&e.bodyCache.formData)return e7(await e.bodyCache.formData,t);const r=Y2(e)?e.headers:e.raw.headers,n=await e.arrayBuffer(),a=(0,Hne.bufferToFormData)(n,r.get("Content-Type")||"");Y2(e)||(e.bodyCache.formData=a);const i=await a;return i?e7(i,t):{}}function e7(e,t){const r=Object.create(null),n={count:0};return e.forEach((a,i)=>{t.all||i.endsWith("[]")?Jne(r,i,a):r[i]=a}),t.dot&&Object.entries(r).forEach(([a,i])=>{a.includes(".")&&(Kne(r,a,i,n),delete r[a])}),r}const Jne=(e,t,r)=>{e[t]!==void 0?Array.isArray(e[t])?e[t].push(r):e[t]=[e[t],r]:t.endsWith("[]")?e[t]=[r]:e[t]=r},Kne=(e,t,r,n)=>{if(/(?:^|\.)__proto__\./.test(t))return;let a=e;const i=t.split(".",qk+2);i.length>qk+1&&t7(),i.forEach((o,l)=>{l===i.length-1?a[o]=r:((!a[o]||typeof a[o]!="object"||Array.isArray(a[o])||a[o]instanceof File)&&(n.count++>=Une&&t7(),a[o]=Object.create(null)),a=a[o])})},t7=()=>{throw new Error("Nesting limit exceeded")};var b3=Object.defineProperty,qne=Object.getOwnPropertyDescriptor,eae=Object.getOwnPropertyNames,tae=Object.prototype.hasOwnProperty,rae=(e,t)=>{for(var r in t)b3(e,r,{get:t[r],enumerable:!0})},nae=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of eae(t))!tae.call(e,a)&&a!==r&&b3(e,a,{get:()=>t[a],enumerable:!(n=qne(t,a))||n.enumerable});return e},aae=e=>nae(b3({},"__esModule",{value:!0}),e),r7={};rae(r7,{HonoRequest:()=>cae,cloneRawRequest:()=>uae});var iae=aae(r7),oae=Wk,sae=zne,lae=jne,P2=vu;class cae{constructor(t,r="/",n=[[]]){Xt(this,dl);Be(this,"raw");Xt(this,ph);Xt(this,go);Be(this,"routeIndex",0);Be(this,"path");Be(this,"bodyCache",{});Xt(this,fl,t=>{const{bodyCache:r,raw:n}=this,a=r[t];if(a)return a;for(const i in r)return r[i].then(o=>(i==="json"&&(o=JSON.stringify(o)),new Response(o)[t]()));return r[t]=n[t]()});this.raw=t,this.path=r,zt(this,go,n)}param(t){return t?hr(this,dl,yT).call(this,t):hr(this,dl,IT).call(this)}query(t){return(0,P2.getQueryParam)(this.url,t)}queries(t){return(0,P2.getQueryParams)(this.url,t)}header(t){if(t)return this.raw.headers.get(t)??void 0;const r=Object.create(null);return this.raw.headers.forEach((n,a)=>{r[a]=n}),r}async parseBody(t){return(0,lae.parseBody)(this,t)}json(){return Oe(this,fl).call(this,"text").then(t=>JSON.parse(t))}text(){return Oe(this,fl).call(this,"text")}arrayBuffer(){return Oe(this,fl).call(this,"arrayBuffer")}bytes(){return Oe(this,fl).call(this,"arrayBuffer").then(t=>new Uint8Array(t))}blob(){return Oe(this,fl).call(this,"blob")}formData(){return Oe(this,fl).call(this,"formData")}addValidatedData(t,r){(Oe(this,ph)??zt(this,ph,{}))[t]=r}valid(t){var r;return(r=Oe(this,ph))==null?void 0:r[t]}get url(){return this.raw.url}get method(){return this.raw.method}get[sae.GET_MATCH_RESULT](){return Oe(this,go)}get matchedRoutes(){return Oe(this,go)[0].map(([[,t]])=>t)}get routePath(){return Oe(this,go)[0].map(([[,t]])=>t)[this.routeIndex].path}}ph=new WeakMap,go=new WeakMap,dl=new WeakSet,yT=function(t){var a;const r=(a=Oe(this,go)[0][this.routeIndex])==null?void 0:a[1][t],n=hr(this,dl,wx).call(this,r);return n&&(0,P2.tryDecodeURIComponent)(n)},IT=function(){var n;const t={},r=Object.keys(((n=Oe(this,go)[0][this.routeIndex])==null?void 0:n[1])??{});for(const a of r){const i=hr(this,dl,wx).call(this,Oe(this,go)[0][this.routeIndex][1][a]);i!==void 0&&(t[a]=(0,P2.tryDecodeURIComponent)(i))}return t},wx=function(t){return Oe(this,go)[1]?Oe(this,go)[1][t]:t},fl=new WeakMap;const uae=async e=>{if(!e.raw.bodyUsed)return e.raw.clone();const t=Object.keys(e.bodyCache)[0];if(!t)throw new oae.HTTPException(500,{message:"Cannot clone request: body was already consumed and not cached. Please use HonoRequest methods (e.g., req.json(), req.text()) instead of consuming req.raw directly."});let r=await e[t]();const n=e.header();t==="json"?(r=JSON.stringify(r),delete n["content-length"]):r instanceof FormData&&(delete n["content-type"],delete n["content-length"]);const a={body:r,cache:e.raw.cache,credentials:e.raw.credentials,headers:n,integrity:e.raw.integrity,keepalive:e.raw.keepalive,method:e.method,mode:e.raw.mode,redirect:e.raw.redirect,referrer:e.raw.referrer,referrerPolicy:e.raw.referrerPolicy,signal:e.raw.signal};return new Request(e.url,a)};var C3=Object.defineProperty,dae=Object.getOwnPropertyDescriptor,fae=Object.getOwnPropertyNames,gae=Object.prototype.hasOwnProperty,hae=(e,t)=>{for(var r in t)C3(e,r,{get:t[r],enumerable:!0})},Aae=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of fae(t))!gae.call(e,a)&&a!==r&&C3(e,a,{get:()=>t[a],enumerable:!(n=dae(t,a))||n.enumerable});return e},mae=e=>Aae(C3({},"__esModule",{value:!0}),e),n7={};hae(n7,{HtmlEscapedCallbackPhase:()=>a7,escapeToBuffer:()=>i7,raw:()=>v3,resolveCallback:()=>o7,resolveCallbackSync:()=>vae,stringBufferToString:()=>Cae});var pae=mae(n7);const a7={Stringify:1,BeforeStream:2,Stream:3},v3=(e,t)=>{const r=new String(e);return r.isEscaped=!0,r.callbacks=t,r},bae=/[&<>'"]/,Cae=async(e,t)=>{let r="";t||(t=[]);const n=await Promise.all(e);for(let a=n.length-1;r+=n[a],a--,!(a<0);a--){let i=n[a];typeof i=="object"&&t.push(...i.callbacks||[]);const o=i.isEscaped;if(i=await(typeof i=="object"?i.toString():i),typeof i=="object"&&t.push(...i.callbacks||[]),i.isEscaped??o)r+=i;else{const l=[r];i7(i,l),r=l[0]}}return v3(r,t)},i7=(e,t)=>{const r=e.search(bae);if(r===-1){t[0]+=e;return}let n,a,i=0;for(a=r;a<e.length;a++){switch(e.charCodeAt(a)){case 34:n=""";break;case 39:n="'";break;case 38:n="&";break;case 60:n="<";break;case 62:n=">";break;default:continue}t[0]+=e.substring(i,a)+n,i=a+1}t[0]+=e.substring(i,a)},vae=e=>{const t=e.callbacks;if(!(t!=null&&t.length))return e;const r=[e],n={};return t.forEach(a=>a({phase:a7.Stringify,buffer:r,context:n})),r[0]},o7=async(e,t,r,n,a)=>{typeof e=="object"&&!(e instanceof String)&&(e instanceof Promise||(e=e.toString()),e instanceof Promise&&(e=await e));const i=e.callbacks;if(!(i!=null&&i.length))return Promise.resolve(e);a?a[0]+=e:a=[e];const o=Promise.all(i.map(l=>l({phase:t,buffer:a,context:n}))).then(l=>Promise.all(l.filter(Boolean).map(s=>o7(s,t,!1,n,a))).then(()=>a[0]));return r?v3(await o,i):o};var y3=Object.defineProperty,yae=Object.getOwnPropertyDescriptor,Iae=Object.getOwnPropertyNames,wae=Object.prototype.hasOwnProperty,xae=(e,t)=>{for(var r in t)y3(e,r,{get:t[r],enumerable:!0})},Eae=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Iae(t))!wae.call(e,a)&&a!==r&&y3(e,a,{get:()=>t[a],enumerable:!(n=yae(t,a))||n.enumerable});return e},Bae=e=>Eae(y3({},"__esModule",{value:!0}),e),s7={};xae(s7,{Context:()=>Sae,TEXT_PLAIN:()=>u7});var l7=Bae(s7),kae=iae,c7=pae;const u7="text/plain; charset=UTF-8",I3=(e,t)=>({"Content-Type":e,...t}),_1=(e,t)=>new Response(e,t);class Sae{constructor(t,r){Xt(this,Nc);Xt(this,bh);Xt(this,Ch);Be(this,"env",{});Xt(this,gl);Be(this,"finalized",!1);Be(this,"error");Xt(this,Kd);Xt(this,hl);Xt(this,ci);Xt(this,vh);Xt(this,qd);Xt(this,ef);Xt(this,d0);Xt(this,yh);Xt(this,Ih);Be(this,"render",(...t)=>(Oe(this,qd)??zt(this,qd,r=>this.html(r)),Oe(this,qd).call(this,...t)));Be(this,"setLayout",t=>zt(this,vh,t));Be(this,"getLayout",()=>Oe(this,vh));Be(this,"setRenderer",t=>{zt(this,qd,t)});Be(this,"header",(t,r,n)=>{this.finalized&&zt(this,ci,_1(Oe(this,ci).body,Oe(this,ci)));const a=Oe(this,ci)?Oe(this,ci).headers:Oe(this,d0)??zt(this,d0,new Headers);r===void 0?a.delete(t):n!=null&&n.append?a.append(t,r):a.set(t,r)});Be(this,"status",t=>{zt(this,Kd,t)});Be(this,"set",(t,r)=>{Oe(this,gl)??zt(this,gl,new Map),Oe(this,gl).set(t,r)});Be(this,"get",t=>Oe(this,gl)?Oe(this,gl).get(t):void 0);Be(this,"newResponse",(...t)=>hr(this,Nc,wf).call(this,...t));Be(this,"body",(t,r,n)=>hr(this,Nc,wf).call(this,t,r,n));Be(this,"text",(t,r,n)=>!Oe(this,d0)&&!Oe(this,Kd)&&!r&&!n&&!this.finalized?new Response(t):hr(this,Nc,wf).call(this,t,r,I3(u7,n)));Be(this,"json",(t,r,n)=>hr(this,Nc,wf).call(this,JSON.stringify(t),r,I3("application/json",n)));Be(this,"html",(t,r,n)=>{const a=i=>hr(this,Nc,wf).call(this,i,r,I3("text/html; charset=UTF-8",n));return typeof t=="object"?(0,c7.resolveCallback)(t,c7.HtmlEscapedCallbackPhase.Stringify,!1,{}).then(a):a(t)});Be(this,"redirect",(t,r)=>{const n=String(t);return this.header("Location",/[^\x00-\xFF]/.test(n)?encodeURI(n):n),this.newResponse(null,r??302)});Be(this,"notFound",()=>(Oe(this,ef)??zt(this,ef,()=>_1()),Oe(this,ef).call(this,this)));zt(this,bh,t),r&&(zt(this,hl,r.executionCtx),this.env=r.env,zt(this,ef,r.notFoundHandler),zt(this,Ih,r.path),zt(this,yh,r.matchResult))}get req(){return Oe(this,Ch)??zt(this,Ch,new kae.HonoRequest(Oe(this,bh),Oe(this,Ih),Oe(this,yh))),Oe(this,Ch)}get event(){if(Oe(this,hl)&&"respondWith"in Oe(this,hl))return Oe(this,hl);throw Error("This context has no FetchEvent")}get executionCtx(){if(Oe(this,hl))return Oe(this,hl);throw Error("This context has no ExecutionContext")}get res(){return Oe(this,ci)||zt(this,ci,_1(null,{headers:Oe(this,d0)??zt(this,d0,new Headers)}))}set res(t){if(Oe(this,ci)&&t){t=_1(t.body,t);for(const[r,n]of Oe(this,ci).headers.entries())if(r!=="content-type")if(r==="set-cookie"){const a=Oe(this,ci).headers.getSetCookie();t.headers.delete("set-cookie");for(const i of a)t.headers.append("set-cookie",i)}else t.headers.set(r,n)}zt(this,ci,t),this.finalized=!0}get var(){return Oe(this,gl)?Object.fromEntries(Oe(this,gl)):{}}}bh=new WeakMap,Ch=new WeakMap,gl=new WeakMap,Kd=new WeakMap,hl=new WeakMap,ci=new WeakMap,vh=new WeakMap,qd=new WeakMap,ef=new WeakMap,d0=new WeakMap,yh=new WeakMap,Ih=new WeakMap,Nc=new WeakSet,wf=function(t,r,n){let a=Oe(this,ci)?new Headers(Oe(this,ci).headers):Oe(this,d0);if(typeof r=="object"&&r.headers){a??(a=new Headers);for(const[o,l]of new Headers(r.headers))o==="set-cookie"?a.append(o,l):a.set(o,l)}if(n){if(!a){let o=0;for(const l in n)if(++o>1||typeof n[l]!="string"){a=new Headers;break}}if(a)for(const o in n){const l=n[o];if(typeof l=="string")a.set(o,l);else{a.delete(o);for(const s of l)a.append(o,s)}}}const i=typeof r=="number"?r:(r==null?void 0:r.status)??Oe(this,Kd);return _1(t,{status:i,headers:a??n})};var w3=Object.defineProperty,_ae=Object.getOwnPropertyDescriptor,Dae=Object.getOwnPropertyNames,Nae=Object.prototype.hasOwnProperty,Rae=(e,t)=>{for(var r in t)w3(e,r,{get:t[r],enumerable:!0})},Fae=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Dae(t))!Nae.call(e,a)&&a!==r&&w3(e,a,{get:()=>t[a],enumerable:!(n=_ae(t,a))||n.enumerable});return e},Zae=e=>Fae(w3({},"__esModule",{value:!0}),e),d7={};Rae(d7,{MESSAGE_MATCHER_IS_ALREADY_BUILT:()=>zae,METHODS:()=>Qae,METHOD_NAME_ALL:()=>Gae,METHOD_NAME_ALL_LOWERCASE:()=>Lae,UnsupportedPathError:()=>Tae});var rd=Zae(d7);const Gae="ALL",Lae="all",Qae=["get","post","put","delete","options","patch","query"],zae="Can not add a route since the matcher is already built.";class Tae extends Error{}var x3=Object.defineProperty,Wae=Object.getOwnPropertyDescriptor,Mae=Object.getOwnPropertyNames,Oae=Object.prototype.hasOwnProperty,Yae=(e,t)=>{for(var r in t)x3(e,r,{get:t[r],enumerable:!0})},Pae=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Mae(t))!Oae.call(e,a)&&a!==r&&x3(e,a,{get:()=>t[a],enumerable:!(n=Wae(t,a))||n.enumerable});return e},Vae=e=>Pae(x3({},"__esModule",{value:!0}),e),f7={};Yae(f7,{COMPOSED_HANDLER:()=>Hae});var jae=Vae(f7);const Hae="__COMPOSED_HANDLER";var E3=Object.defineProperty,Uae=Object.getOwnPropertyDescriptor,Xae=Object.getOwnPropertyNames,$ae=Object.prototype.hasOwnProperty,Jae=(e,t)=>{for(var r in t)E3(e,r,{get:t[r],enumerable:!0})},Kae=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Xae(t))!$ae.call(e,a)&&a!==r&&E3(e,a,{get:()=>t[a],enumerable:!(n=Uae(t,a))||n.enumerable});return e},qae=e=>Kae(E3({},"__esModule",{value:!0}),e),g7={};Jae(g7,{HonoBase:()=>aie});var eie=qae(g7),h7=Dne,tie=l7,V2=rd,rie=jae,ql=vu;const nie=e=>e.text("404 Not Found",404),A7=(e,t)=>{if("getResponse"in e){const r=e.getResponse();return t.newResponse(r.body,r)}return console.error(e),t.text("Internal Server Error",500)};let aie=(tf=class{constructor(t={}){Xt(this,na);Be(this,"get");Be(this,"post");Be(this,"put");Be(this,"delete");Be(this,"options");Be(this,"patch");Be(this,"query");Be(this,"all");Be(this,"on");Be(this,"use");Be(this,"router");Be(this,"getPath");Be(this,"_basePath","/");Xt(this,Mo,"/");Be(this,"routes",[]);Xt(this,Oo,nie);Be(this,"errorHandler",A7);Be(this,"onError",t=>(this.errorHandler=t,this));Be(this,"notFound",t=>(zt(this,Oo,t),this));Be(this,"fetch",(t,...r)=>hr(this,na,_b).call(this,t,r[1],r[0],t.method));Be(this,"request",(t,r,n,a)=>t instanceof Request?this.fetch(r?new Request(t,r):t,n,a):(t=t.toString(),this.fetch(new Request(/^https?:\/\//.test(t)?t:`http://localhost${(0,ql.mergePath)("/",t)}`,r),n,a)));Be(this,"fire",()=>{addEventListener("fetch",t=>{t.respondWith(hr(this,na,_b).call(this,t.request,t,void 0,t.request.method))})});[...V2.METHODS,V2.METHOD_NAME_ALL_LOWERCASE].forEach(i=>{this[i]=(o,...l)=>(typeof o=="string"?zt(this,Mo,o):hr(this,na,B0).call(this,i,Oe(this,Mo),o),l.forEach(s=>{hr(this,na,B0).call(this,i,Oe(this,Mo),s)}),this)}),this.on=(i,o,...l)=>{for(const s of[o].flat()){zt(this,Mo,s);for(const u of[i].flat())l.map(f=>{hr(this,na,B0).call(this,u.toUpperCase(),Oe(this,Mo),f)})}return this},this.use=(i,...o)=>(typeof i=="string"?zt(this,Mo,i):(zt(this,Mo,"*"),o.unshift(i)),o.forEach(l=>{hr(this,na,B0).call(this,V2.METHOD_NAME_ALL,Oe(this,Mo),l)}),this);const{strict:n,...a}=t;Object.assign(this,a),this.getPath=n??!0?t.getPath??ql.getPath:ql.getPathNoStrict}route(t,r){const n=this.basePath(t);return r.routes.map(a=>{var o;let i;r.errorHandler===A7?i=a.handler:(i=async(l,s)=>(await(0,h7.compose)([],r.errorHandler)(l,()=>a.handler(l,s))).res,i[rie.COMPOSED_HANDLER]=a.handler),hr(o=n,na,B0).call(o,a.method,a.path,i,a.basePath)}),this}basePath(t){const r=hr(this,na,wT).call(this);return r._basePath=(0,ql.mergePath)(this._basePath,t),r}mount(t,r,n){let a,i;n&&(typeof n=="function"?i=n:(i=n.optionHandler,n.replaceRequest===!1?a=s=>s:a=n.replaceRequest));const o=i?s=>{const u=i(s);return Array.isArray(u)?u:[u]}:s=>{let u;try{u=s.executionCtx}catch{}return[s.env,u]};a||(a=(()=>{const s=(0,ql.mergePath)(this._basePath,t),u=s==="/"?0:s.length;return f=>{const g=new URL(f.url);return g.pathname=this.getPath(f).slice(u)||"/",new Request(g,f)}})());const l=async(s,u)=>{const f=await r(a(s.req.raw),...o(s));if(f)return f;await u()};return hr(this,na,B0).call(this,V2.METHOD_NAME_ALL,(0,ql.mergePath)(t,"*"),l),this}},Mo=new WeakMap,na=new WeakSet,wT=function(){const t=new tf({router:this.router,getPath:this.getPath});return t.errorHandler=this.errorHandler,zt(t,Oo,Oe(this,Oo)),t.routes=this.routes,t},Oo=new WeakMap,B0=function(t,r,n,a){t=t.toUpperCase(),r=(0,ql.mergePath)(this._basePath,r);const i={basePath:a!==void 0?(0,ql.mergePath)(this._basePath,a):this._basePath,path:r,method:t,handler:n};this.router.add(t,r,[n,i]),this.routes.push(i)},Sb=function(t,r){if(t instanceof Error)return this.errorHandler(t,r);throw t},_b=function(t,r,n,a){if(a==="HEAD")return(async()=>new Response(null,await hr(this,na,_b).call(this,t,r,n,"GET")))();const i=this.getPath(t,{env:n}),o=this.router.match(a,i),l=new tie.Context(t,{path:i,matchResult:o,env:n,executionCtx:r,notFoundHandler:Oe(this,Oo)});if(o[0].length===1){let u;try{u=o[0][0][0][0](l,async()=>{l.res=await Oe(this,Oo).call(this,l)})}catch(f){return hr(this,na,Sb).call(this,f,l)}return u instanceof Promise?u.then(f=>f||(l.finalized?l.res:Oe(this,Oo).call(this,l))).catch(f=>hr(this,na,Sb).call(this,f,l)):u??Oe(this,Oo).call(this,l)}const s=(0,h7.compose)(o[0],this.errorHandler,Oe(this,Oo));return(async()=>{try{const u=await s(l);if(!u.finalized)throw new Error("Context is not finalized. Did you forget to return a Response object or `await next()`?");return u.res}catch(u){return hr(this,na,Sb).call(this,u,l)}})()},tf);var B3=Object.defineProperty,iie=Object.getOwnPropertyDescriptor,oie=Object.getOwnPropertyNames,sie=Object.prototype.hasOwnProperty,lie=(e,t)=>{for(var r in t)B3(e,r,{get:t[r],enumerable:!0})},cie=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of oie(t))!sie.call(e,a)&&a!==r&&B3(e,a,{get:()=>t[a],enumerable:!(n=iie(t,a))||n.enumerable});return e},uie=e=>cie(B3({},"__esModule",{value:!0}),e),m7={};lie(m7,{createNullObject:()=>die});var j2=uie(m7);const die=()=>Object.create(null);var k3=Object.defineProperty,fie=Object.getOwnPropertyDescriptor,gie=Object.getOwnPropertyNames,hie=Object.prototype.hasOwnProperty,Aie=(e,t)=>{for(var r in t)k3(e,r,{get:t[r],enumerable:!0})},mie=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of gie(t))!hie.call(e,a)&&a!==r&&k3(e,a,{get:()=>t[a],enumerable:!(n=fie(t,a))||n.enumerable});return e},pie=e=>mie(k3({},"__esModule",{value:!0}),e),p7={};Aie(p7,{emptyParam:()=>C7,match:()=>Cie});var b7=pie(p7),bie=rd;const C7=[];function Cie(e,t){const r=this.buildAllMatchers(),n=(a,i)=>{const o=r[a]||r[bie.METHOD_NAME_ALL],l=o[2][i];if(l)return l;const s=i.match(o[0]);if(!s)return[[],C7];const u=s.indexOf("",1);return[o[1][u],s]};return this.match=n,n(e,t)}var S3=Object.defineProperty,vie=Object.getOwnPropertyDescriptor,yie=Object.getOwnPropertyNames,Iie=Object.prototype.hasOwnProperty,wie=(e,t)=>{for(var r in t)S3(e,r,{get:t[r],enumerable:!0})},xie=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of yie(t))!Iie.call(e,a)&&a!==r&&S3(e,a,{get:()=>t[a],enumerable:!(n=vie(t,a))||n.enumerable});return e},Eie=e=>xie(S3({},"__esModule",{value:!0}),e),v7={};wie(v7,{LABEL_REG_EXP_STR:()=>D1,Node:()=>Sie,ONLY_WILDCARD_REG_EXP_STR:()=>yu,PATH_ERROR:()=>Iu,TAIL_WILDCARD_REG_EXP_STR:()=>ec});var y7=Eie(v7),Bie=j2;const D1="[^/]+",yu=".*",ec="(?:|/.*)",Iu=Symbol(),I7=new Set(".\\+*[^]$()");function kie(e,t){return e.length===1?t.length===1?e<t?-1:1:-1:t.length===1?1:e===yu||e===ec?t===ec?-1:1:t===yu||t===ec?-1:e===D1?1:t===D1?-1:e.length===t.length?e<t?-1:1:t.length-e.length}let Sie=(g0=class{constructor(){Xt(this,Rc);Xt(this,f0);Xt(this,Yo,(0,Bie.createNullObject)())}insert(t,r,n,a,i){let o=this;for(let l=0,s=t.length;l<s;l++){const u=t[l],f=u.length===1?u==="*"?l===s-1?["","",yu]:["","",D1]:null:u==="/*"?["","",ec]:u.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);let g;if(f){const d=f[1];let h=f[2]||D1;if(d&&f[2]&&(h===".*"||(h=h.replace(/^\((?!\?:)(?=[^)]+\)$)/,"(?:"),/\((?!\?:)/.test(h))||h.length===1&&I7.has(h)))throw Iu;if(g=Oe(o,Yo)[h],!g){if(h!==yu&&h!==ec){for(const m in Oe(o,Yo))if((h.length>1||m.length>1)&&m!==yu&&m!==ec)throw Iu}g=Oe(o,Yo)[h]=new g0}d!==""&&(Oe(g,f0)??zt(g,f0,a.varIndex++),n.push([d,Oe(g,f0)]))}else if(g=Oe(o,Yo)[u],!g){for(const d in Oe(o,Yo))if(d.length>1&&d!==yu&&d!==ec)throw Iu;g=Oe(o,Yo)[u]=new g0}o=g}if(Oe(o,Rc)!==void 0)throw Iu;zt(o,Rc,i?-1:r)}buildRegExpStr(){const r=Object.keys(Oe(this,Yo)).sort(kie).map(n=>{const a=Oe(this,Yo)[n],i=a.buildRegExpStr();return i===""?"":(typeof Oe(a,f0)=="number"?`(${n})@${Oe(a,f0)}`:I7.has(n)?`\\${n}`:n)+i}).filter(Boolean);return typeof Oe(this,Rc)=="number"&&Oe(this,Rc)!==-1&&r.unshift(`#${Oe(this,Rc)}`),r.length===0?"":r.length===1?r[0]:"(?:"+r.join("|")+")"}},Rc=new WeakMap,f0=new WeakMap,Yo=new WeakMap,g0);var _3=Object.defineProperty,_ie=Object.getOwnPropertyDescriptor,Die=Object.getOwnPropertyNames,Nie=Object.prototype.hasOwnProperty,Rie=(e,t)=>{for(var r in t)_3(e,r,{get:t[r],enumerable:!0})},Fie=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Die(t))!Nie.call(e,a)&&a!==r&&_3(e,a,{get:()=>t[a],enumerable:!(n=_ie(t,a))||n.enumerable});return e},Zie=e=>Fie(_3({},"__esModule",{value:!0}),e),w7={};Rie(w7,{Trie:()=>zie});var Gie=Zie(w7),Lie=j2,Qie=y7;class zie{constructor(){Xt(this,wh,{varIndex:0});Xt(this,rf,new Qie.Node);Xt(this,xh,0);Be(this,"paths",(0,Lie.createNullObject)())}insert(t,r){if(r){Oe(this,rf).insert(t.split(""),0,[],Oe(this,wh),!0);return}const n=[],a=[];let i=t;for(let l=0;;){let s=!1;if(i=i.replace(/\{[^}]+\}/g,u=>{const f=`@\\${l}`;return a[l]=[f,u],l++,s=!0,f}),!s)break}const o=i.match(/(?::[^\/]+)|(?:\/\*$)|./g)||[];for(let l=a.length-1;l>=0;l--){const[s]=a[l];for(let u=o.length-1;u>=0;u--)if(o[u].indexOf(s)!==-1){o[u]=o[u].replace(s,a[l][1]);break}}Oe(this,rf).insert(o,Oe(this,xh),n,Oe(this,wh),!1),this.paths[t]=[kb(this,xh)._++,n]}buildRegExp(){let t=Oe(this,rf).buildRegExpStr();if(t==="")return[/^$/,[],[]];let r=0;const n=[],a=[];return t=t.replace(/#(\d+)|@(\d+)|\.\*\$/g,(i,o,l)=>o!==void 0?(n[++r]=Number(o),"$()"):(l!==void 0&&(a[Number(l)]=++r),"")),[new RegExp(`^${t}`),n,a]}}wh=new WeakMap,rf=new WeakMap,xh=new WeakMap;var D3=Object.defineProperty,Tie=Object.getOwnPropertyDescriptor,Wie=Object.getOwnPropertyNames,Mie=Object.prototype.hasOwnProperty,Oie=(e,t)=>{for(var r in t)D3(e,r,{get:t[r],enumerable:!0})},Yie=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Wie(t))!Mie.call(e,a)&&a!==r&&D3(e,a,{get:()=>t[a],enumerable:!(n=Tie(t,a))||n.enumerable});return e},Pie=e=>Yie(D3({},"__esModule",{value:!0}),e),x7={};Oie(x7,{RegExpRouter:()=>jie});var E7=Pie(x7),gs=rd,Vie=vu,Ks=j2,B7=b7,H2=y7,k7=Gie;let U2=(0,Ks.createNullObject)();function S7(e){return U2[e]??(U2[e]=new RegExp(`^${e.replace(/\/:[^/{}]+(?:\{\[\^\/]\+})?(?=[/{]|$)|\/?\*$|([.\\+*[^\]$()?{}|])/g,(t,r)=>r?`\\${r}`:t==="/*"?H2.TAIL_WILDCARD_REG_EXP_STR:t==="*"?H2.ONLY_WILDCARD_REG_EXP_STR:`/:${H2.LABEL_REG_EXP_STR}`)}$`))}function X2(e,t){for(const r of Object.keys(e).sort((n,a)=>a.length-n.length))if(S7(r).test(t))return[...e[r]]}class jie{constructor(){Xt(this,Gc);Be(this,"name","RegExpRouter");Xt(this,h0);Xt(this,Fc);Xt(this,Zc);Be(this,"match",B7.match);zt(this,h0,{[gs.METHOD_NAME_ALL]:(0,Ks.createNullObject)()}),zt(this,Fc,{[gs.METHOD_NAME_ALL]:(0,Ks.createNullObject)()}),zt(this,Zc,{[gs.METHOD_NAME_ALL]:new k7.Trie})}add(t,r,n){const a=Oe(this,h0),i=Oe(this,Fc);if(!a)throw new Error(gs.MESSAGE_MATCHER_IS_ALREADY_BUILT);if(!a[t]){Oe(this,Zc)[t]=new k7.Trie;for(const s of[a,i]){s[t]=(0,Ks.createNullObject)();for(const u in s[gs.METHOD_NAME_ALL])s[t][u]=[...s[gs.METHOD_NAME_ALL][u]],hr(this,Gc,Db).call(this,t,u)}}r==="/*"&&(r="*");const o=t===gs.METHOD_NAME_ALL?Object.keys(a):[t];if(/\*$/.test(r)){const s=S7(r);for(const u of o)a[u][r]||(hr(this,Gc,Db).call(this,u,r),a[u][r]=X2(a[u],r)||X2(a[gs.METHOD_NAME_ALL],r)||[]);for(const u of[a,i])for(const f of o)for(const g in u[f])s.test(g)&&u[f][g].push([n,r]);return}const l=(0,Vie.checkOptionalParameter)(r)||[r];for(const s of l)for(const u of o)i[u][s]||(hr(this,Gc,Db).call(this,u,s),i[u][s]=X2(a[u],s)||X2(a[gs.METHOD_NAME_ALL],s)||[]),i[u][s].push([n,s])}buildAllMatchers(){const t=(0,Ks.createNullObject)();for(const r of Object.keys(Oe(this,Fc)))t[r]=hr(this,Gc,xT).call(this,r);return zt(this,h0,zt(this,Fc,zt(this,Zc,void 0))),U2=(0,Ks.createNullObject)(),t}}h0=new WeakMap,Fc=new WeakMap,Zc=new WeakMap,Gc=new WeakSet,Db=function(t,r){try{Oe(this,Zc)[t].insert(r,!/\*|\/:/.test(r))}catch(n){throw n===H2.PATH_ERROR?new gs.UnsupportedPathError(r):n}},xT=function(t){const r=Oe(this,h0)[t],n=Oe(this,Fc)[t],a=Oe(this,Zc)[t],i=(0,Ks.createNullObject)(),o=[],[l,s,u]=a.buildRegExp();for(const f of[r,n])for(const g in f){const d=f[g],h=a.paths[g];if(!h){i[g]=[d.map(([m])=>[m,(0,Ks.createNullObject)()]),B7.emptyParam];continue}o[h[0]]=d.map(([m,p])=>[m,a.paths[p][1].reduceRight((C,[v],I)=>(C[v]=u[h[1][I][1]],C),(0,Ks.createNullObject)())])}return[l,s.map(f=>o[f]),i]};var N3=Object.defineProperty,Hie=Object.getOwnPropertyDescriptor,Uie=Object.getOwnPropertyNames,Xie=Object.prototype.hasOwnProperty,$ie=(e,t)=>{for(var r in t)N3(e,r,{get:t[r],enumerable:!0})},Jie=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Uie(t))!Xie.call(e,a)&&a!==r&&N3(e,a,{get:()=>t[a],enumerable:!(n=Hie(t,a))||n.enumerable});return e},Kie=e=>Jie(N3({},"__esModule",{value:!0}),e),_7={};$ie(_7,{PreparedRegExpRouter:()=>toe,buildInitParams:()=>roe,serializeInitParams:()=>noe});var qie=Kie(_7),N1=rd,D7=b7,eoe=E7;class toe{constructor(t,r){Xt(this,Lc);Be(this,"name","PreparedRegExpRouter");Xt(this,ho);Xt(this,Eh);Be(this,"match",D7.match);zt(this,ho,t),zt(this,Eh,r)}add(t,r,n){if(!Oe(this,ho)[t]){const i=Oe(this,ho)[N1.METHOD_NAME_ALL],o={};for(const l in i[2])o[l]=[i[2][l][0].slice(),D7.emptyParam];Oe(this,ho)[t]=[i[0],i[1].map(l=>Array.isArray(l)?l.slice():0),o]}if(r==="/*"||r==="*"){const i=[n,{}];if(t===N1.METHOD_NAME_ALL)for(const o in Oe(this,ho))hr(this,Lc,xx).call(this,o,i);else hr(this,Lc,xx).call(this,t,i);return}const a=Oe(this,Eh)[r];if(!a)throw new Error(`Path ${r} is not registered`);for(const[i,o]of a)if(t===N1.METHOD_NAME_ALL)for(const l in Oe(this,ho))hr(this,Lc,Ex).call(this,l,r,n,i,o);else hr(this,Lc,Ex).call(this,t,r,n,i,o)}buildAllMatchers(){return Oe(this,ho)}}ho=new WeakMap,Eh=new WeakMap,Lc=new WeakSet,xx=function(t,r){const n=Oe(this,ho)[t];n[1].forEach(a=>a&&a.push(r)),Object.values(n[2]).forEach(a=>a[0].push(r))},Ex=function(t,r,n,a,i){const o=Oe(this,ho)[t];i?a.forEach(l=>{typeof l=="number"?o[1][l].push([n,i]):o[2][l||r][0].push([n,i])}):o[2][r][0].push([n,{}])};const roe=({paths:e})=>{const t=class extends eoe.RegExpRouter{buildAndExportAllMatchers(){return this.buildAllMatchers()}},r=new t;for(const o of e)r.add(N1.METHOD_NAME_ALL,o,o);const n=r.buildAndExportAllMatchers(),a=n[N1.METHOD_NAME_ALL],i={};for(const o of e)if(!(o==="/*"||o==="*")){a[1].forEach((l,s)=>{l.forEach(([u,f])=>{u===o&&(i[o]?i[o][0][1]={...i[o][0][1],...f}:i[o]=[[[],f]],i[o][0][0].findIndex(g=>g===s)===-1&&i[o][0][0].push(s))})});for(const l in a[2])a[2][l][0].forEach(([s])=>{if(s===o){i[o]||(i[o]=[[[]]]);const u=l===o?"":l;i[o][0][0].findIndex(f=>f===u)===-1&&i[o][0][0].push(u)}})}for(let o=0,l=a[1].length;o<l;o++)a[1][o]=a[1][o]?[]:0;for(const o in a[2])a[2][o][0]=[];return[n,i]},noe=([e,t])=>{const r=JSON.stringify(e,(a,i)=>i instanceof RegExp?`##${i.toString()}##`:i).replace(/"##(.+?)##"/g,(a,i)=>i.replace(/\\\\/g,"\\")),n=JSON.stringify(t);return`[${r},${n}]`};var R3=Object.defineProperty,aoe=Object.getOwnPropertyDescriptor,ioe=Object.getOwnPropertyNames,ooe=Object.prototype.hasOwnProperty,soe=(e,t)=>{for(var r in t)R3(e,r,{get:t[r],enumerable:!0})},loe=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of ioe(t))!ooe.call(e,a)&&a!==r&&R3(e,a,{get:()=>t[a],enumerable:!(n=aoe(t,a))||n.enumerable});return e},coe=e=>loe(R3({},"__esModule",{value:!0}),e),N7={};soe(N7,{PreparedRegExpRouter:()=>F3.PreparedRegExpRouter,RegExpRouter:()=>doe.RegExpRouter,buildInitParams:()=>F3.buildInitParams,serializeInitParams:()=>F3.serializeInitParams});var uoe=coe(N7),doe=E7,F3=qie,Z3=Object.defineProperty,foe=Object.getOwnPropertyDescriptor,goe=Object.getOwnPropertyNames,hoe=Object.prototype.hasOwnProperty,Aoe=(e,t)=>{for(var r in t)Z3(e,r,{get:t[r],enumerable:!0})},moe=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of goe(t))!hoe.call(e,a)&&a!==r&&Z3(e,a,{get:()=>t[a],enumerable:!(n=foe(t,a))||n.enumerable});return e},poe=e=>moe(Z3({},"__esModule",{value:!0}),e),R7={};Aoe(R7,{SmartRouter:()=>Coe});var boe=poe(R7),F7=rd;class Coe{constructor(t){Be(this,"name","SmartRouter");Xt(this,Qc,[]);Xt(this,Al,[]);zt(this,Qc,t.routers)}add(t,r,n){if(!Oe(this,Al))throw new Error(F7.MESSAGE_MATCHER_IS_ALREADY_BUILT);Oe(this,Al).push([t,r,n])}match(t,r){if(!Oe(this,Al))throw new Error("Fatal error");const n=Oe(this,Qc),a=Oe(this,Al),i=n.length;let o=0,l;for(;o<i;o++){const s=n[o];try{for(let u=0,f=a.length;u<f;u++)s.add(...a[u]);l=s.match(t,r)}catch(u){if(u instanceof F7.UnsupportedPathError)continue;throw u}this.match=s.match.bind(s),zt(this,Qc,[s]),zt(this,Al,void 0);break}if(o===i)throw new Error("Fatal error");return this.name=`SmartRouter + ${this.activeRouter.name}`,l}get activeRouter(){if(Oe(this,Al)||Oe(this,Qc).length!==1)throw new Error("No active router has been determined yet.");return Oe(this,Qc)[0]}}Qc=new WeakMap,Al=new WeakMap;var G3=Object.defineProperty,voe=Object.getOwnPropertyDescriptor,yoe=Object.getOwnPropertyNames,Ioe=Object.prototype.hasOwnProperty,woe=(e,t)=>{for(var r in t)G3(e,r,{get:t[r],enumerable:!0})},xoe=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of yoe(t))!Ioe.call(e,a)&&a!==r&&G3(e,a,{get:()=>t[a],enumerable:!(n=voe(t,a))||n.enumerable});return e},Eoe=e=>xoe(G3({},"__esModule",{value:!0}),e),Z7={};woe(Z7,{SmartRouter:()=>koe.SmartRouter});var Boe=Eoe(Z7),koe=boe,L3=Object.defineProperty,Soe=Object.getOwnPropertyDescriptor,_oe=Object.getOwnPropertyNames,Doe=Object.prototype.hasOwnProperty,Noe=(e,t)=>{for(var r in t)L3(e,r,{get:t[r],enumerable:!0})},Roe=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of _oe(t))!Doe.call(e,a)&&a!==r&&L3(e,a,{get:()=>t[a],enumerable:!(n=Soe(t,a))||n.enumerable});return e},Foe=e=>Roe(L3({},"__esModule",{value:!0}),e),G7={};Noe(G7,{Node:()=>Qoe});var Zoe=Foe(G7),Goe=rd,Q3=vu,z3=j2;const T3=(0,z3.createNullObject)();let Loe=0,Qoe=(of=class{constructor(){Xt(this,Gs);Xt(this,nf,[]);Xt(this,Ao,(0,z3.createNullObject)());Xt(this,Bh,[]);Xt(this,af);Xt(this,ma,T3)}insert(t,r,n){var s;let a=this;const i=(0,Q3.splitRoutingPath)(r),o=new Set;let l=0;for(const u of i){const f=i[++l],g=(0,Q3.getPattern)(u,f)||(f===void 0&&u&&u.indexOf("*")===u.length-1?u:null),d=Array.isArray(g),h=d?g[0]:g||u,m=(s=Oe(a,Ao))[h]||(s[h]=new of);g&&!Oe(m,af)&&(zt(m,af,g),Oe(a,Bh).push(m)),a=m,d&&o.add(g[1])}Oe(a,nf).push({[t]:{handler:n,possibleKeys:[...o],score:++Loe}})}search(t,r){var f;const n=[];zt(this,ma,T3);let i=[this];const o=(0,Q3.splitPath)(r),l=[],s=o.length;let u=null;for(let g=0;g<s;g++){const d=o[g],h=g===s-1,m=[];for(let C=0,v=i.length;C<v;C++){const I=i[C],y=Oe(I,Ao)[d];y&&(zt(y,ma,Oe(I,ma)),h?(Oe(y,Ao)["*"]&&hr(this,Gs,Hc).call(this,n,Oe(y,Ao)["*"],t,Oe(I,ma)),hr(this,Gs,Hc).call(this,n,y,t,Oe(I,ma))):m.push(y));for(const x of Oe(I,Bh)){const E=Oe(x,af),k=Oe(I,ma)===T3?{}:{...Oe(I,ma)};if(typeof E=="string"){(E==="*"||d.startsWith(E.slice(0,-1)))&&(hr(this,Gs,Hc).call(this,n,x,t,Oe(I,ma)),E==="*"&&(zt(x,ma,k),m.push(x)));continue}const[,S,B]=E;if(!(!d&&B===!0)){if(B!==!0){if(!u){u=[];let Q=r[0]==="/"?1:0;for(let z=0;z<s;z++)u[z]=Q,Q+=o[z].length+1}const N=r.slice(u[g]),D=B.exec(N);if(D){k[S]=D[0],hr(this,Gs,Hc).call(this,n,x,t,Oe(I,ma),k),D[0].length===N.length&&Oe(x,Ao)["*"]&&hr(this,Gs,Hc).call(this,n,Oe(x,Ao)["*"],t,Oe(I,ma),k);for(const Q in Oe(x,Ao)){zt(x,ma,k);const z=((f=D[0].match(/\//g))==null?void 0:f.length)??0;(l[z]||(l[z]=[])).push(x);break}continue}}(B===!0||B.test(d))&&(k[S]=d,h?(hr(this,Gs,Hc).call(this,n,x,t,k,Oe(I,ma)),Oe(x,Ao)["*"]&&hr(this,Gs,Hc).call(this,n,Oe(x,Ao)["*"],t,k,Oe(I,ma))):(zt(x,ma,k),m.push(x)))}}}const p=l.shift();i=p?m.concat(p):m}return n[1]&&n.sort((g,d)=>g.score-d.score),[n.map(({handler:g,params:d})=>[g,d])]}},nf=new WeakMap,Ao=new WeakMap,Bh=new WeakMap,af=new WeakMap,ma=new WeakMap,Gs=new WeakSet,Hc=function(t,r,n,a,i){for(let o=0,l=Oe(r,nf).length;o<l;o++){const s=Oe(r,nf)[o],u=s[n]||s[Goe.METHOD_NAME_ALL];if(u){u.params=(0,z3.createNullObject)(),t.push(u);for(let f=0,g=u.possibleKeys.length;f<g;f++){const d=u.possibleKeys[f];u.params[d]=i!=null&&i[d]&&!f?i[d]:a[d]??(i==null?void 0:i[d])}}}},of);var W3=Object.defineProperty,zoe=Object.getOwnPropertyDescriptor,Toe=Object.getOwnPropertyNames,Woe=Object.prototype.hasOwnProperty,Moe=(e,t)=>{for(var r in t)W3(e,r,{get:t[r],enumerable:!0})},Ooe=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Toe(t))!Woe.call(e,a)&&a!==r&&W3(e,a,{get:()=>t[a],enumerable:!(n=zoe(t,a))||n.enumerable});return e},Yoe=e=>Ooe(W3({},"__esModule",{value:!0}),e),L7={};Moe(L7,{TrieRouter:()=>Hoe});var Poe=Yoe(L7),Voe=vu,joe=Zoe;class Hoe{constructor(){Be(this,"name","TrieRouter");Xt(this,kh,new joe.Node)}add(t,r,n){for(const a of(0,Voe.checkOptionalParameter)(r)||[r])Oe(this,kh).insert(t,a,n)}match(t,r){return Oe(this,kh).search(t,r)}}kh=new WeakMap;var M3=Object.defineProperty,Uoe=Object.getOwnPropertyDescriptor,Xoe=Object.getOwnPropertyNames,$oe=Object.prototype.hasOwnProperty,Joe=(e,t)=>{for(var r in t)M3(e,r,{get:t[r],enumerable:!0})},Koe=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Xoe(t))!$oe.call(e,a)&&a!==r&&M3(e,a,{get:()=>t[a],enumerable:!(n=Uoe(t,a))||n.enumerable});return e},qoe=e=>Koe(M3({},"__esModule",{value:!0}),e),Q7={};Joe(Q7,{TrieRouter:()=>tse.TrieRouter});var ese=qoe(Q7),tse=Poe,O3=Object.defineProperty,rse=Object.getOwnPropertyDescriptor,nse=Object.getOwnPropertyNames,ase=Object.prototype.hasOwnProperty,ise=(e,t)=>{for(var r in t)O3(e,r,{get:t[r],enumerable:!0})},ose=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of nse(t))!ase.call(e,a)&&a!==r&&O3(e,a,{get:()=>t[a],enumerable:!(n=rse(t,a))||n.enumerable});return e},sse=e=>ose(O3({},"__esModule",{value:!0}),e),z7={};ise(z7,{Hono:()=>gse});var lse=sse(z7),cse=eie,use=uoe,dse=Boe,fse=ese;class gse extends cse.HonoBase{constructor(t={}){super(t),this.router=t.router??new dse.SmartRouter({routers:[new use.RegExpRouter,new fse.TrieRouter]})}}var Y3=Object.defineProperty,hse=Object.getOwnPropertyDescriptor,Ase=Object.getOwnPropertyNames,mse=Object.prototype.hasOwnProperty,pse=(e,t)=>{for(var r in t)Y3(e,r,{get:t[r],enumerable:!0})},bse=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Ase(t))!mse.call(e,a)&&a!==r&&Y3(e,a,{get:()=>t[a],enumerable:!(n=hse(t,a))||n.enumerable});return e},Cse=e=>bse(Y3({},"__esModule",{value:!0}),e),T7={};pse(T7,{Context:()=>Ise.Context,Hono:()=>yse.Hono});var vse=Cse(T7),yse=lse,Ise=l7,W7={},P3={},pi={},nd={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.globalConfig=e.$ZodEncodeError=e.$ZodAsyncError=e.$brand=e.NEVER=void 0,e.$constructor=t,e.config=a,e.NEVER=Object.freeze({status:"aborted"});function t(i,o,l){function s(d,h){var m;Object.defineProperty(d,"_zod",{value:d._zod??{},enumerable:!1}),(m=d._zod).traits??(m.traits=new Set),d._zod.traits.add(i),o(d,h);for(const p in g.prototype)p in d||Object.defineProperty(d,p,{value:g.prototype[p].bind(d)});d._zod.constr=g,d._zod.def=h}const u=(l==null?void 0:l.Parent)??Object;class f extends u{}Object.defineProperty(f,"name",{value:i});function g(d){var h;const m=l!=null&&l.Parent?new f:this;s(m,d),(h=m._zod).deferred??(h.deferred=[]);for(const p of m._zod.deferred)p();return m}return Object.defineProperty(g,"init",{value:s}),Object.defineProperty(g,Symbol.hasInstance,{value:d=>{var h,m;return l!=null&&l.Parent&&d instanceof l.Parent?!0:(m=(h=d==null?void 0:d._zod)==null?void 0:h.traits)==null?void 0:m.has(i)}}),Object.defineProperty(g,"name",{value:i}),g}e.$brand=Symbol("zod_brand");class r extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}e.$ZodAsyncError=r;class n extends Error{constructor(o){super(`Encountered unidirectional transform during encode: ${o}`),this.name="ZodEncodeError"}}e.$ZodEncodeError=n,e.globalConfig={};function a(i){return i&&Object.assign(e.globalConfig,i),e.globalConfig}})(nd);var V3={},Ui={},qe={};Object.defineProperty(qe,"__esModule",{value:!0}),qe.Class=qe.BIGINT_FORMAT_RANGES=qe.NUMBER_FORMAT_RANGES=qe.primitiveTypes=qe.propertyKeyTypes=qe.getParsedType=qe.allowsEval=qe.captureStackTrace=void 0,qe.assertEqual=wse,qe.assertNotEqual=xse,qe.assertIs=Ese,qe.assertNever=Bse,qe.assert=kse,qe.getEnumValues=Sse,qe.joinValues=_se,qe.jsonStringifyReplacer=Dse,qe.cached=M7,qe.nullish=Nse,qe.cleanRegex=Rse,qe.floatSafeRemainder=Fse,qe.defineLazy=Zse,qe.objectClone=Gse,qe.assignProp=tc,qe.mergeDefs=rc,qe.cloneDef=Lse,qe.getElementAtPath=Qse,qe.promiseAllObject=zse,qe.randomString=Tse,qe.esc=Wse,qe.isObject=j3,qe.isPlainObject=$2,qe.shallowClone=Mse,qe.numKeys=Ose,qe.escapeRegex=Pse,qe.clone=nc,qe.normalizeParams=Vse,qe.createTransparentProxy=jse,qe.stringifyPrimitive=Y7,qe.optionalKeys=Hse,qe.pick=Use,qe.omit=Xse,qe.extend=$se,qe.safeExtend=Jse,qe.merge=Kse,qe.partial=qse,qe.required=ele,qe.aborted=tle,qe.prefixIssues=rle,qe.unwrapMessage=R1,qe.finalizeIssue=nle,qe.getSizableOrigin=ale,qe.getLengthableOrigin=ile,qe.issue=ole,qe.cleanEnum=sle,qe.base64ToUint8Array=P7,qe.uint8ArrayToBase64=V7,qe.base64urlToUint8Array=lle,qe.uint8ArrayToBase64url=cle,qe.hexToUint8Array=ule,qe.uint8ArrayToHex=dle;function wse(e){return e}function xse(e){return e}function Ese(e){}function Bse(e){throw new Error}function kse(e){}function Sse(e){const t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,a])=>t.indexOf(+n)===-1).map(([n,a])=>a)}function _se(e,t="|"){return e.map(r=>Y7(r)).join(t)}function Dse(e,t){return typeof t=="bigint"?t.toString():t}function M7(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Nse(e){return e==null}function Rse(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Fse(e,t){const r=(e.toString().split(".")[1]||"").length,n=t.toString();let a=(n.split(".")[1]||"").length;if(a===0&&/\d?e-\d?/.test(n)){const s=n.match(/\d?e-(\d?)/);s!=null&&s[1]&&(a=Number.parseInt(s[1]))}const i=r>a?r:a,o=Number.parseInt(e.toFixed(i).replace(".","")),l=Number.parseInt(t.toFixed(i).replace(".",""));return o%l/10**i}const O7=Symbol("evaluating");function Zse(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==O7)return n===void 0&&(n=O7,n=r()),n},set(a){Object.defineProperty(e,t,{value:a})},configurable:!0})}function Gse(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function tc(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function rc(...e){const t={};for(const r of e){const n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function Lse(e){return rc(e._zod.def)}function Qse(e,t){return t?t.reduce((r,n)=>r==null?void 0:r[n],e):e}function zse(e){const t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{const a={};for(let i=0;i<t.length;i++)a[t[i]]=n[i];return a})}function Tse(e=10){const t="abcdefghijklmnopqrstuvwxyz";let r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function Wse(e){return JSON.stringify(e)}qe.captureStackTrace="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function j3(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}qe.allowsEval=M7(()=>{var e;if(typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function $2(e){if(j3(e)===!1)return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(j3(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Mse(e){return $2(e)?{...e}:Array.isArray(e)?[...e]:e}function Ose(e){let t=0;for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}const Yse=e=>{const t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}};qe.getParsedType=Yse,qe.propertyKeyTypes=new Set(["string","number","symbol"]),qe.primitiveTypes=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Pse(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function nc(e,t,r){const n=new e._zod.constr(t??e._zod.def);return(!t||r!=null&&r.parent)&&(n._zod.parent=e),n}function Vse(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function jse(e){let t;return new Proxy({},{get(r,n,a){return t??(t=e()),Reflect.get(t,n,a)},set(r,n,a,i){return t??(t=e()),Reflect.set(t,n,a,i)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,a){return t??(t=e()),Reflect.defineProperty(t,n,a)}})}function Y7(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Hse(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}qe.NUMBER_FORMAT_RANGES={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},qe.BIGINT_FORMAT_RANGES={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Use(e,t){const r=e._zod.def,n=rc(e._zod.def,{get shape(){const a={};for(const i in t){if(!(i in r.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&(a[i]=r.shape[i])}return tc(this,"shape",a),a},checks:[]});return nc(e,n)}function Xse(e,t){const r=e._zod.def,n=rc(e._zod.def,{get shape(){const a={...e._zod.def.shape};for(const i in t){if(!(i in r.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&delete a[i]}return tc(this,"shape",a),a},checks:[]});return nc(e,n)}function $se(e,t){if(!$2(t))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");const a=rc(e._zod.def,{get shape(){const i={...e._zod.def.shape,...t};return tc(this,"shape",i),i},checks:[]});return nc(e,a)}function Jse(e,t){if(!$2(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r={...e._zod.def,get shape(){const n={...e._zod.def.shape,...t};return tc(this,"shape",n),n},checks:e._zod.def.checks};return nc(e,r)}function Kse(e,t){const r=rc(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return tc(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return nc(e,r)}function qse(e,t,r){const n=rc(t._zod.def,{get shape(){const a=t._zod.def.shape,i={...a};if(r)for(const o in r){if(!(o in a))throw new Error(`Unrecognized key: "${o}"`);r[o]&&(i[o]=e?new e({type:"optional",innerType:a[o]}):a[o])}else for(const o in a)i[o]=e?new e({type:"optional",innerType:a[o]}):a[o];return tc(this,"shape",i),i},checks:[]});return nc(t,n)}function ele(e,t,r){const n=rc(t._zod.def,{get shape(){const a=t._zod.def.shape,i={...a};if(r)for(const o in r){if(!(o in i))throw new Error(`Unrecognized key: "${o}"`);r[o]&&(i[o]=new e({type:"nonoptional",innerType:a[o]}))}else for(const o in a)i[o]=new e({type:"nonoptional",innerType:a[o]});return tc(this,"shape",i),i},checks:[]});return nc(t,n)}function tle(e,t=0){var r;if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(((r=e.issues[n])==null?void 0:r.continue)!==!0)return!0;return!1}function rle(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function R1(e){return typeof e=="string"?e:e==null?void 0:e.message}function nle(e,t,r){var a,i,o,l,s,u;const n={...e,path:e.path??[]};if(!e.message){const f=R1((o=(i=(a=e.inst)==null?void 0:a._zod.def)==null?void 0:i.error)==null?void 0:o.call(i,e))??R1((l=t==null?void 0:t.error)==null?void 0:l.call(t,e))??R1((s=r.customError)==null?void 0:s.call(r,e))??R1((u=r.localeError)==null?void 0:u.call(r,e))??"Invalid input";n.message=f}return delete n.inst,delete n.continue,t!=null&&t.reportInput||delete n.input,n}function ale(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function ile(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function ole(...e){const[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function sle(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function P7(e){const t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function V7(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function lle(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return P7(t+r)}function cle(e){return V7(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function ule(e){const t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");const r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n/2]=Number.parseInt(t.slice(n,n+2),16);return r}function dle(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}class fle{constructor(...t){}}qe.Class=fle;var gle=le&&le.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var a=Object.getOwnPropertyDescriptor(t,r);(!a||("get"in a?!t.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,a)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),hle=le&&le.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Ale=le&&le.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&gle(t,e,r);return hle(t,e),t};Object.defineProperty(Ui,"__esModule",{value:!0}),Ui.$ZodRealError=Ui.$ZodError=void 0,Ui.flattenError=ple,Ui.formatError=ble,Ui.treeifyError=Cle,Ui.toDotPath=U7,Ui.prettifyError=vle;const j7=nd,mle=Ale(qe),H7=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,mle.jsonStringifyReplacer,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})};Ui.$ZodError=(0,j7.$constructor)("$ZodError",H7),Ui.$ZodRealError=(0,j7.$constructor)("$ZodError",H7,{Parent:Error});function ple(e,t=r=>r.message){const r={},n=[];for(const a of e.issues)a.path.length>0?(r[a.path[0]]=r[a.path[0]]||[],r[a.path[0]].push(t(a))):n.push(t(a));return{formErrors:n,fieldErrors:r}}function ble(e,t=r=>r.message){const r={_errors:[]},n=a=>{for(const i of a.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(o=>n({issues:o}));else if(i.code==="invalid_key")n({issues:i.issues});else if(i.code==="invalid_element")n({issues:i.issues});else if(i.path.length===0)r._errors.push(t(i));else{let o=r,l=0;for(;l<i.path.length;){const s=i.path[l];l===i.path.length-1?(o[s]=o[s]||{_errors:[]},o[s]._errors.push(t(i))):o[s]=o[s]||{_errors:[]},o=o[s],l++}}};return n(e),r}function Cle(e,t=r=>r.message){const r={errors:[]},n=(a,i=[])=>{var o,l;for(const s of a.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(u=>n({issues:u},s.path));else if(s.code==="invalid_key")n({issues:s.issues},s.path);else if(s.code==="invalid_element")n({issues:s.issues},s.path);else{const u=[...i,...s.path];if(u.length===0){r.errors.push(t(s));continue}let f=r,g=0;for(;g<u.length;){const d=u[g],h=g===u.length-1;typeof d=="string"?(f.properties??(f.properties={}),(o=f.properties)[d]??(o[d]={errors:[]}),f=f.properties[d]):(f.items??(f.items=[]),(l=f.items)[d]??(l[d]={errors:[]}),f=f.items[d]),h&&f.errors.push(t(s)),g++}}};return n(e),r}function U7(e){const t=[],r=e.map(n=>typeof n=="object"?n.key:n);for(const n of r)typeof n=="number"?t.push(`[${n}]`):typeof n=="symbol"?t.push(`[${JSON.stringify(String(n))}]`):/[^\w$]/.test(n)?t.push(`[${JSON.stringify(n)}]`):(t.length&&t.push("."),t.push(n));return t.join("")}function vle(e){var n;const t=[],r=[...e.issues].sort((a,i)=>(a.path??[]).length-(i.path??[]).length);for(const a of r)t.push(`✖ ${a.message}`),(n=a.path)!=null&&n.length&&t.push(` → at ${U7(a.path)}`);return t.join(`
|
|
148
|
+
`).length-(n.maxLines??1/0))),n.maxLength!==1/0&&n.maxLength!==null&&(f.value=String(ee).length-n.maxLength)}});const m=c.computed({get(){return B2(p.value)},set(ee){n.richtext?l.value=[{text:ee,format:{}}]:l.value=ee}}),p=c.computed({get(){return y8(o.value)},set(ee){n.richtext?l.value=ee:l.value=B2(ee)}}),C=c.ref(),v=Uo("bx-input-count"),I=c.computed(()=>n.state==="error"||d.value),y=c.computed(()=>n.showWordCount?v:void 0),x=c.ref();let E;const k=c.ref(!1);c.watch(k,()=>{k.value?a("focus"):a("blur",E)});function S(ee){k.value=!0}function B(ee){E=ee,k.value=!1}c.watch(x,(ee,ne)=>{ee&&(ne&&(ne.removeEventListener("focus",S),ne.removeEventListener("blur",B)),ee.addEventListener("focus",S),ee.addEventListener("blur",B))});const N=c.computed(()=>String(Math.max(1,n.maxRows)));function D(){if(n.type!=="textarea")return;const ee=x.value;!ee||ee.tagName!=="TEXTAREA"||(ee.style.height="auto",ee.style.height=`${ee.scrollHeight}px`)}c.watch([x,m,()=>n.type,()=>n.minHeight,()=>n.maxHeight,N],async()=>{await c.nextTick(),D()},{immediate:!0,flush:"post"}),window.addEventListener("blur",B);const Q=()=>{var ee;n.disabled||n.readonly||(ee=x.value)==null||ee.focus()},z=ee=>{ee.key==="Enter"&&a("enter",ee)},A=c.ref(""),P=c.computed(()=>{const ee=n.richtext?A.value:l.value;return[...new Intl.Segmenter().segment(ee)].length}),W=c.computed(()=>n.richtext?A.value.length>0:String(l.value).length>0);function O(ee){return ee.en}const R=c.ref(),Z=c.ref({start:0,length:0}),G=c.computed({get(){var ae,L;const ee=(ae=C.value)==null?void 0:ae.richTextInstance;if(!ee)return;const ue=ee.resolveFeatures(Z.value.start,Z.value.length).flat(),be=X(ue);if(be!==void 0)return be===null?"multiple":(L=M.value.find(T=>Ia(T.value,be)))==null?void 0:L.value},set(ee){var ue;const ne=(ue=C.value)==null?void 0:ue.richTextInstance;ne&&ee!=="multiple"&&(ee===void 0?ne.applyFormat(Z.value.start,Z.value.length,{}):(ne.resolveFeatures(Z.value.start,Z.value.length),ne.applyFormat(Z.value.start,Z.value.length,ee)),J.value.closePopover())}});c.watch(R,()=>{R.value&&(Z.value=R.value)});const M=c.computed(()=>n.richtext?[{label:O(n.richtext.noStyleLabel),value:void 0},...n.richtext.options.map((ee,ne)=>({label:ee.label,value:ee.style}))]:[]),J=c.ref();function X(ee){let ne=!1,ue;for(const be of ee)if(!ue)ue=be.format;else if(!Ia(ue,be.format)){ne=!0;break}return ne?null:ue}function re(){n.richtext?p.value=[{text:"",format:{}}]:o.value=""}return c.onUnmounted(()=>{s.value=[],u.value=0,f.value=0}),t({inputEelRef:x,setFocus(ee){var ne,ue;ee?(ne=x.value)==null||ne.focus():(ue=x.value)==null||ue.blur()}}),(ee,ne)=>(c.openBlock(),c.createElementBlock("div",{class:c.normalizeClass(["bx-input",{readonly:e.readonly,bordered:e.bordered,"is-textarea":e.type==="textarea"}])},[e.richtext?(c.openBlock(),c.createBlock($s,{key:0,ref_key:"bxSelectRef",ref:J,class:"select-richtext",modelValue:G.value,"onUpdate:modelValue":ne[0]||(ne[0]=ue=>G.value=ue),options:M.value,disabled:!Z.value||Z.value.length===0},{label:c.withCtx(({label:ue})=>[c.createTextVNode(c.toDisplayString(ue??"Multiple"),1)]),_:1},8,["modelValue","options","disabled"])):c.createCommentVNode("",!0),c.createElementVNode("div",{class:c.normalizeClass(["bx-input-wrapper",{focus:k.value&&!e.readonly,round:e.round,ring:e.ring,bordered:e.bordered,["size-"+e.size]:e.size,disabled:e.disabled,readonly:e.readonly,"rich-text":e.richtext,error:d.value,"state-active":e.state==="active","state-success":e.state==="success","state-error":e.state==="error","state-warning":e.state==="warning",ghost:e.ghost}]),style:c.normalizeStyle({"--max-height":e.richtext?"auto":e.maxHeight,"--min-height":e.minHeight,"--textarea-max-lines":N.value}),onClick:Q},[i.prefix?(c.openBlock(),c.createElementBlock("div",Aq,[c.renderSlot(ee.$slots,"prefix",{},void 0,!0)])):c.createCommentVNode("",!0),c.createElementVNode("div",{class:c.normalizeClass(["bx-input__input",{"swiper-no-swiping":k.value,"has-prefix":!!i.prefix}])},[e.richtext?(c.openBlock(),c.createBlock(N8,{key:0,ref_key:"bxRichTextInstance",ref:C,modelValue:p.value,"onUpdate:modelValue":ne[1]||(ne[1]=ue=>p.value=ue),selection:R.value,"onUpdate:selection":ne[2]||(ne[2]=ue=>R.value=ue),"raw-text":A.value,"onUpdate:rawText":ne[3]||(ne[3]=ue=>A.value=ue),focus:k.value,"onUpdate:focus":ne[4]||(ne[4]=ue=>k.value=ue),"aria-label":e.ariaLabelledby?void 0:e.ariaLabel,"aria-labelledby":e.ariaLabelledby},null,8,["modelValue","selection","raw-text","focus","aria-label","aria-labelledby"])):(c.openBlock(),c.createElementBlock(c.Fragment,{key:1},[e.type==="textarea"?c.withDirectives((c.openBlock(),c.createElementBlock("textarea",{key:0,ref_key:"inputEelRef",ref:x,rows:"1",class:c.normalizeClass({resizeable:e.resizeable}),"onUpdate:modelValue":ne[5]||(ne[5]=ue=>m.value=ue),placeholder:e.placeholder,onKeydown:z,readonly:e.readonly,title:e.readonly?e.readonlyMessage:void 0,"aria-label":e.ariaLabelledby?void 0:e.ariaLabel,"aria-labelledby":e.ariaLabelledby,"aria-invalid":I.value?"true":void 0,"aria-describedby":y.value},null,42,mq)),[[c.vModelText,m.value]]):c.withDirectives((c.openBlock(),c.createElementBlock("input",{key:1,ref_key:"inputEelRef",ref:x,"onUpdate:modelValue":ne[6]||(ne[6]=ue=>o.value=ue),readonly:e.readonly,placeholder:e.placeholder,type:e.type,onKeydown:z,title:e.readonly?e.readonlyMessage:void 0,"aria-label":e.ariaLabelledby?void 0:e.ariaLabel,"aria-labelledby":e.ariaLabelledby,"aria-invalid":I.value?"true":void 0,"aria-describedby":y.value},null,40,pq)),[[c.vModelDynamic,o.value]])],64))],2),i.suffix||e.clearable||e.showWordCount||i.loading||e.loading||d.value?(c.openBlock(),c.createElementBlock("div",{key:1,"data-suffix":!!i.suffix,class:"bx-input__suffix"},[i.loading||e.loading?(c.openBlock(),c.createElementBlock("div",Cq,[i.loading?c.renderSlot(ee.$slots,"loading",{},void 0,!0,0):(c.openBlock(),c.createBlock(Pl,{key:1,size:"small"}))])):c.createCommentVNode("",!0),c.renderSlot(ee.$slots,"suffix",{},void 0,!0),e.showWordCount?(c.openBlock(),c.createElementBlock("div",{key:1,id:c.unref(v),class:"bx-input__word-count"},[e.maxLength&&e.maxLength!==1/0?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[c.createTextVNode(c.toDisplayString(P.value)+" / "+c.toDisplayString(e.maxLength),1)],64)):(c.openBlock(),c.createElementBlock(c.Fragment,{key:1},[c.createTextVNode(c.toDisplayString(P.value),1)],64))],8,vq)):c.createCommentVNode("",!0),d.value?(c.openBlock(),c.createBlock(I1,{key:2,trigger:"hover","custom-popover-classes":["text-overflow-tooltip"],"allowed-placements":["bottom","top","right"]},{trigger:c.withCtx(()=>[c.createVNode(Lt,{circle:"",size:"tiny",secondary:"",state:"error",class:"errors-button","aria-label":"Show input warnings"},{icon:c.withCtx(()=>[c.createVNode(At,null,{default:c.withCtx(()=>[c.createVNode(c.unref(LB))]),_:1})]),_:1})]),content:c.withCtx(()=>{var ue,be,ae;return[c.createElementVNode("div",yq,[(ue=g.value)!=null&&ue.overflowingCharacters?(c.openBlock(),c.createElementBlock("div",Iq,[c.createElementVNode("span",wq,c.toDisplayString(e.maxLength+f.value)+" / "+c.toDisplayString(e.maxLength),1),ne[7]||(ne[7]=c.createTextVNode(" characters ",-1))])):c.createCommentVNode("",!0),(be=g.value)!=null&&be.overlowingLines?(c.openBlock(),c.createElementBlock("div",xq,[c.createElementVNode("span",Eq,c.toDisplayString(e.maxLines+u.value)+" / "+c.toDisplayString(e.maxLines),1),ne[8]||(ne[8]=c.createTextVNode(" lines ",-1))])):c.createCommentVNode("",!0),(ae=g.value)!=null&&ae.lineOverflows?(c.openBlock(),c.createElementBlock("div",Bq,[ne[9]||(ne[9]=c.createTextVNode(" Lines are too long: ",-1)),c.createElementVNode("ul",null,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(g.value.lineOverflows,({index:L,length:T})=>(c.openBlock(),c.createElementBlock("li",null,[c.createElementVNode("span",kq,"("+c.toDisplayString(L+1)+")",1),c.createElementVNode("span",Sq,c.toDisplayString(T)+" / "+c.toDisplayString(e.maxLineLength),1)]))),256))])])):c.createCommentVNode("",!0)])]}),_:1})):c.createCommentVNode("",!0),e.clearable&&W.value?(c.openBlock(),c.createElementBlock("button",{key:3,type:"button",class:"bx-input__clear-btn",onClick:c.withModifiers(re,["stop"]),title:"Clear","aria-label":"Clear"},[c.createVNode(At,{size:12},{default:c.withCtx(()=>[c.createVNode(c.unref(ss))]),_:1})])):c.createCommentVNode("",!0)],8,bq)):c.createCommentVNode("",!0)],6)],2))}}),[["__scopeId","data-v-19f6427a"]]);function $v(e){return new URLSearchParams(Object.fromEntries(Object.entries(e).map(([t,r])=>[t,String(r)]))).toString()}function _q(e){const t=c.ref([]),r=c.ref(0);let n=25;async function a(i,o){o=o??t.value.length??0;const s=await(await fetch(`https://api.pexels.com/v1/search?${$v({page:Math.ceil(o/n),query:i,per_page:n})}`,{headers:{Authorization:e}})).json();if("error"in s)throw new Error(s.error);r.value=s.total_results,t.value=[...t.value.slice(0,o),...s.photos]}return{photos:t,total:r,searchPhotos:a}}const Dq=c.defineComponent({__name:"LazyLoadingItemWrapper",emits:["update:visible"],setup(e,{emit:t}){c.ref();const r=t,n=c.ref(),a=hW(n);return r("update:visible",a.value),c.watch(a,(i,o)=>{!o&&i&&r("update:visible",a.value)}),(i,o)=>(c.openBlock(),c.createElementBlock("div",{class:"item-wrapper",ref_key:"itemWrapperRef",ref:n},[c.renderSlot(i.$slots,"default")],512))}}),Nq=c.defineComponent({__name:"LazyLoading",props:{items:{},total:{},fetch:{type:Function},visibleTriggerOffset:{}},setup(e){c.ref();const t=e;t.fetch(0);const r=(n,a)=>{a&&n>=t.items.length-t.visibleTriggerOffset-1&&t.total>t.items.length&&t.fetch()};return(n,a)=>(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(e.items,(i,o)=>(c.openBlock(),c.createBlock(Dq,{key:o,class:"item-wrapper",item:i,index:o,"onUpdate:visible":l=>r(o,l)},{default:c.withCtx(()=>[c.renderSlot(n.$slots,"item",{item:i,index:o})]),_:2},1032,["item","index","onUpdate:visible"]))),128))}}),Rq={class:"bx-empty-icon"},Fq={key:1,viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Zq={key:0,class:"bx-empty-description"},Gq={key:1,class:"bx-empty-extra"},Jv=ht(c.defineComponent({__name:"BxEmpty",props:{description:{default:"No Data"},size:{default:"medium"}},setup(e){const t=c.useSlots();return(r,n)=>(c.openBlock(),c.createElementBlock("div",{class:c.normalizeClass(["bx-empty",{[`size-${e.size}`]:!0}])},[c.createElementVNode("div",Rq,[t.icon?c.renderSlot(r.$slots,"icon",{},void 0,!0,0):(c.openBlock(),c.createElementBlock("svg",Fq,[...n[0]||(n[0]=[c.createElementVNode("path",{d:"M26 7.5C26 11.0899 23.0899 14 19.5 14C15.9101 14 13 11.0899 13 7.5C13 3.91015 15.9101 1 19.5 1C23.0899 1 26 3.91015 26 7.5ZM14 7.5C14 3.91015 11.0899 1 7.5 1C3.91015 1 1 3.91015 1 7.5C1 11.0899 3.91015 14 7.5 14C11.0899 14 14 11.0899 14 7.5ZM14 19.5C14 15.9101 11.0899 13 7.5 13C3.91015 13 1 15.9101 1 19.5C1 23.0899 3.91015 26 7.5 26C11.0899 26 14 23.0899 14 19.5Z",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round",opacity:"0.4"},null,-1),c.createElementVNode("circle",{cx:"19.5",cy:"19.5",r:"6.5",stroke:"currentColor","stroke-width":"1.5","stroke-dasharray":"3 3",opacity:"0.25"},null,-1)])]))]),e.description||t.description?(c.openBlock(),c.createElementBlock("div",Zq,[t.description?c.renderSlot(r.$slots,"description",{},void 0,!0,0):(c.openBlock(),c.createElementBlock(c.Fragment,{key:1},[c.createTextVNode(c.toDisplayString(e.description),1)],64))])):c.createCommentVNode("",!0),t.default?(c.openBlock(),c.createElementBlock("div",Gq,[c.renderSlot(r.$slots,"default",{},void 0,!0)])):c.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-d66bc5e4"]]),Lq={class:"image-library-pexels"},Qq={class:"search-bar-wrapper"},zq={key:0,class:"photos"},Tq=["onClick"],Wq=["src"],Mq={key:0,class:"loading-wrapper"},Oq={key:1,class:"loading-wrapper"},Yq=c.defineComponent({__name:"Pexels",props:{apiKey:{},width:{},height:{},uploadContext:{},uploadImageAsset:{type:Function}},emits:["select"],setup(e,{emit:t}){const r=Yl(),n=e,a=t,i=c.ref("city"),{searchPhotos:o,photos:l,total:s}=_q(n.apiKey),u=c.ref(),f=c.ref(!1);async function g(){i.value.length>0&&(f.value=!0,s.value=25,l.value=[],await o(i.value),u.value=i.value,f.value=!1)}async function d(p,C){await o(i.value,p)}const h=c.ref();async function m(p){h.value=p.id;const C=await n.uploadImageAsset({blob:await fetch(r(p.src.original)).then(v=>v.blob()),context:n.uploadContext,width:n.width,height:n.height,key:`pexels-${p.id}`,name:p.id.toString(),onProgress(v){console.log("upload progress",v)}});h.value=void 0,a("select",C.src)}return(p,C)=>(c.openBlock(),c.createElementBlock("div",Lq,[c.createElementVNode("header",null,[c.createElementVNode("div",Qq,[c.createVNode(bu,{modelValue:i.value,"onUpdate:modelValue":C[0]||(C[0]=v=>i.value=v),round:"",placeholder:"Search...",size:"medium",onEnter:g},null,8,["modelValue"]),c.createVNode(Lt,{active:"",onClick:g},{default:c.withCtx(()=>[...C[1]||(C[1]=[c.createTextVNode("Search",-1)])]),_:1})])]),c.createElementVNode("main",null,[u.value?(c.openBlock(),c.createElementBlock("div",zq,[c.createVNode(Nq,{items:c.unref(l),total:c.unref(s),fetch:d,"visible-trigger-offset":0},{item:c.withCtx(({item:v})=>[(c.openBlock(),c.createElementBlock("div",{key:v.id,class:"photo-wrapper",onClick:I=>m(v)},[c.createElementVNode("div",{class:c.normalizeClass(["preview",{loading:h.value===v.id}])},[c.createElementVNode("img",{src:c.unref(r)(v.src.tiny)},null,8,Wq),h.value===v.id?(c.openBlock(),c.createElementBlock("div",Mq,[c.createVNode(Pl)])):c.createCommentVNode("",!0)],2)],8,Tq))]),_:1},8,["items","total"])])):f.value?(c.openBlock(),c.createElementBlock("div",Oq,[c.createVNode(Pl)])):(c.openBlock(),c.createBlock(Jv,{key:2,description:"Search for images on Pexels"},{icon:c.withCtx(()=>[c.createVNode(c.unref(M$))]),_:1}))])]))}});function Pq(e,t,r){return e.map(n=>({src:`https://shared-drive.bluepic.io/image?url=${encodeURIComponent(n["@microsoft.graph.downloadUrl"])}&w=${t}&h=${r}&fit=cover&quality=80&format=png`,key:n.id,width:n.image.width,height:n.image.height,previews:{small:{src:`https://shared-drive.bluepic.io/image?url=${encodeURIComponent(n["@microsoft.graph.downloadUrl"])}&h=200&fit=cover&quality=80&format=png`,width:n.image.width,height:n.image.height},medium:{src:`https://shared-drive.bluepic.io/image?url=${encodeURIComponent(n["@microsoft.graph.downloadUrl"])}&h=400&fit=cover&quality=80&format=png`,width:n.image.width,height:n.image.height}}}))}function Vq(e,t,r){return e.map(({thumbnailLink:n,webContentLink:a,sha256Checksum:i,imageMediaMetadata:o})=>({src:`https://shared-drive.bluepic.io/image?url=${encodeURIComponent(a)}&w=${t}&h=${r}&fit=cover&quality=80&format=png`,key:i,width:(o==null?void 0:o.width)??0,height:(o==null?void 0:o.height)??0,previews:{small:{src:`https://shared-drive.bluepic.io/image?url=${encodeURIComponent(n)}&h=200&fit=cover&quality=80&format=png`,width:(o==null?void 0:o.width)??0,height:(o==null?void 0:o.height)??0},medium:{src:`https://shared-drive.bluepic.io/image?url=${encodeURIComponent(n)}&h=400&fit=cover&quality=80&format=png`,width:(o==null?void 0:o.width)??0,height:(o==null?void 0:o.height)??0}}}))}function jq(e,t,r,n){const a=c.ref();return{sharedItems:a,fetchSharedDrive:async()=>{if(e==="onedrive"){const o=`https://shared-drive.bluepic.io/onedrive?${$v({sharing:t})}`,s=await(await fetch(o)).json();a.value=Pq(s.children,r,n)}else if(e==="googledrive"){const o=`https://shared-drive.bluepic.io/googledrive?${$v({sharing:t})}`,s=await(await fetch(o)).json();a.value=Vq(s.files,r,n)}}}}const Hq={class:"image-library-shared-drive"},Uq={key:0,class:"photos"},Xq=["onClick"],$q={class:"preview"},Jq=["src"],Kq={key:1,class:"loading-wrapper"},qq=ht(c.defineComponent({__name:"SharedDrive",props:{service:{},sharedUrl:{},width:{},height:{}},emits:["select"],setup(e,{emit:t}){const r=Yl(),n=e,a=t,{fetchSharedDrive:i,sharedItems:o}=jq(n.service,n.sharedUrl,n.width,n.height);i();function l(s){a("select",s.src)}return(s,u)=>(c.openBlock(),c.createElementBlock("div",Hq,[c.unref(o)?(c.openBlock(),c.createElementBlock("div",Uq,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(c.unref(o),f=>(c.openBlock(),c.createElementBlock("div",{class:"photo-wrapper",onClick:g=>l(f)},[c.createElementVNode("div",$q,[c.createElementVNode("img",{src:c.unref(r)(f.previews.small.src)},null,8,Jq)])],8,Xq))),256))])):(c.openBlock(),c.createElementBlock("div",Kq,[c.createVNode(Pl)]))]))}}),[["__scopeId","data-v-6b7dadc2"]]),eee={class:"image-library-custom"},tee=c.defineComponent({__name:"Custom",props:{controller:{},label:{},name:{},props:{}},setup(e){const t=e,r=import(t.controller),n=c.ref();return r.then(a=>{n.value=new a.default(t.props)}),(a,i)=>(c.openBlock(),c.createElementBlock("div",eee,"JAJAJA"))}}),ree={class:"image-library-wrapper"},nee={key:0,class:"nav-view-wrapper"},aee={class:"icon-wrapper"},iee={class:"label"},oee={key:1,class:"library-view-wrapper"},F8=ht(c.defineComponent({__name:"ImageLibraryWrapper",props:{options:{},activeKey:{},imageLibraries:{},convertTo:{},quality:{},width:{},height:{},bridge:{},field:{}},emits:["select","update:active-key"],setup(e,{emit:t}){const r=e,n=t,a=c.ref(r.activeKey);c.watch(a,()=>{r.activeKey!==a.value&&n("update:active-key",a.value)}),c.watch(()=>r.activeKey,()=>{r.activeKey!==a.value&&(a.value=r.activeKey)});function i(m){a.value=m}const o=c.computed(()=>{var m;return(m=r.imageLibraries.find(p=>p.type==="pexels"))==null?void 0:m.apiKey}),l=c.computed(()=>r.imageLibraries.find(m=>m.type==="sharedDrive"&&m.service===a.value).sharedUrl),s=c.computed(()=>{var m;return(m=r.imageLibraries.find(p=>p.type===a.value))==null?void 0:m.label}),u=c.computed(()=>{var m;return(m=r.imageLibraries.find(p=>p.type===a.value))==null?void 0:m.name}),f=c.computed(()=>{var m;return(m=r.imageLibraries.find(p=>p.type===a.value))==null?void 0:m.controller}),g=c.computed(()=>{var m;return(m=r.imageLibraries.find(p=>p.type===a.value))==null?void 0:m.props});function d(m){const p=m[0];p&&h(p.src)}function h(m){n("select",m)}return(m,p)=>(c.openBlock(),c.createElementBlock("div",ree,[c.createVNode(c.Transition,{name:"slide-library"},{default:c.withCtx(()=>[a.value===void 0?(c.openBlock(),c.createElementBlock("div",nee,[c.createElementVNode("div",{class:"image-library-source-navigation",style:c.normalizeStyle({"--options-length":e.options.length})},[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(r.options,C=>(c.openBlock(),c.createBlock(b1,{key:C.key,bordered:!0,onClick:v=>i(C.key)},{default:c.withCtx(()=>[c.createElementVNode("div",aee,[(c.openBlock(),c.createBlock(c.resolveDynamicComponent(C.icon)))]),c.createElementVNode("div",iee,c.toDisplayString(C.label),1)]),_:2},1032,["onClick"]))),128))],4)])):(c.openBlock(),c.createElementBlock("div",oee,[a.value==="upload"?(c.openBlock(),c.createBlock(kK,{key:0,width:e.width,height:e.height,"convert-to":e.convertTo,quality:e.quality,field:e.field,"handle-upload":e.bridge.handleUpload,onUpload:d},null,8,["width","height","convert-to","quality","field","handle-upload"])):a.value==="pexels"?(c.openBlock(),c.createBlock(Yq,{key:1,"api-key":o.value,width:e.width,height:e.height,"upload-image-asset":e.bridge.handleUpload,"upload-context":{field:e.field},onSelect:h},null,8,["api-key","width","height","upload-image-asset","upload-context"])):a.value==="googledrive"||a.value==="onedrive"||a.value==="icloud"||a.value==="dropbox"?(c.openBlock(),c.createBlock(qq,{key:2,service:a.value,"shared-url":l.value,width:e.width,height:e.height,onSelect:h},null,8,["service","shared-url","width","height"])):a.value==="custom"?(c.openBlock(),c.createBlock(tee,{key:3,label:s.value??"Custom Library",name:u.value,controller:f.value,props:g.value},null,8,["label","name","controller","props"])):c.createCommentVNode("",!0)]))]),_:1})]))}}),[["__scopeId","data-v-61c69114"]]),Z8=ht(c.defineComponent({__name:"BxList",props:{divider:{type:Boolean,default:!0},bordered:{type:Boolean,default:!1},variant:{default:"plain"}},setup(e){return c.useSlots(),(t,r)=>(c.openBlock(),c.createElementBlock("div",{class:c.normalizeClass(["bx-list",{"has-divider":e.divider&&e.variant==="plain",bordered:e.bordered,[`variant-${e.variant}`]:!0}])},[c.renderSlot(t.$slots,"default",{},void 0,!0)],2))}}),[["__scopeId","data-v-53785398"]]),see={class:"bx-list-item__inner"},lee={key:0,class:"bx-list-item__prefix"},cee={class:"bx-list-item__content"},uee={key:1,class:"bx-list-item__suffix"},G8=ht(c.defineComponent({__name:"BxListItem",props:{interactive:{type:Boolean,default:!0}},setup(e){const t=c.useSlots(),r=c.computed(()=>!!t.prefix),n=c.computed(()=>!!t.suffix);return(a,i)=>(c.openBlock(),c.createElementBlock("div",{class:c.normalizeClass(["bx-list-item",{"has-prefix":r.value,"has-suffix":n.value,interactive:e.interactive}])},[c.createElementVNode("div",see,[t.prefix?(c.openBlock(),c.createElementBlock("div",lee,[c.renderSlot(a.$slots,"prefix",{},void 0,!0)])):c.createCommentVNode("",!0),c.createElementVNode("div",cee,[c.renderSlot(a.$slots,"default",{},void 0,!0)]),t.suffix?(c.openBlock(),c.createElementBlock("div",uee,[c.renderSlot(a.$slots,"suffix",{},void 0,!0)])):c.createCommentVNode("",!0)])],2))}}),[["__scopeId","data-v-1048af22"]]),dee=["aria-label"],fee=["onClick"],gee={class:"icon"},hee={class:"label"},Aee={class:"pullup-menu"},mee={class:"icon"},N2=ht(c.defineComponent({__name:"BxDropdown",props:c.mergeModels({options:{},allowedPlacements:{},mobileLayout:{type:Boolean,default:!1},ariaLabel:{default:"Menu"}},{show:{type:Boolean,required:!1,default:!1},showModifiers:{}}),emits:c.mergeModels(["select"],["update:show"]),setup(e,{emit:t}){const r=e,n=t,a=c.useModel(e,"show");function i(I){a.value=!1,n("select",I.value)}const o=c.useSlots(),l=Uo("bx-dropdown-menu"),{setSlotRef:s,vNodes:u,slotElements:f}=x2(o.trigger);function g(I){(I.key==="ArrowDown"||I.key==="ArrowUp")&&(I.preventDefault(),a.value||(a.value=!0),C(0))}let d;c.watch(f,(I,y)=>{for(const E of y??[])E instanceof HTMLElement&&E.removeEventListener("keydown",g);d=void 0;const x=I[0];x instanceof HTMLElement&&(x.setAttribute("aria-haspopup","menu"),x.setAttribute("aria-controls",l),x.setAttribute("aria-expanded",String(a.value)),x.addEventListener("keydown",g),d=x)},{immediate:!0});const h=c.ref(0),m=[];function p(I,y){if(!I){m[y]=void 0;return}const x=I instanceof HTMLElement?I:I.$el;m[y]=x instanceof HTMLElement?x:void 0}function C(I){if(r.options.length===0)return;const y=(I+r.options.length)%r.options.length;h.value=y,c.nextTick(()=>{var x;return(x=m[y])==null?void 0:x.focus()})}function v(I){const y=r.options.length;if(y!==0)switch(I.key){case"ArrowDown":I.preventDefault(),C(h.value+1);break;case"ArrowUp":I.preventDefault(),C(h.value-1);break;case"Home":I.preventDefault(),C(0);break;case"End":I.preventDefault(),C(y-1);break;case"Enter":case" ":I.preventDefault(),i(r.options[h.value]),d==null||d.focus();break;case"Escape":I.preventDefault(),I.stopPropagation(),a.value=!1,d==null||d.focus();break;case"Tab":a.value=!1;break}}return c.watch(a,I=>{d==null||d.setAttribute("aria-expanded",String(I)),I&&(h.value=0,c.nextTick(()=>{var y;return(y=m[0])==null?void 0:y.focus()}))}),c.onUnmounted(()=>{d&&d.removeEventListener("keydown",g)}),(I,y)=>e.mobileLayout?(c.openBlock(),c.createBlock(mu,{key:0,show:a.value,"onUpdate:show":y[1]||(y[1]=x=>a.value=x),"disable-background-effect":"","custom-classes":["bx-dropdown-mobile-layout-popup"],closeable:!1},{trigger:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(c.unref(u),(x,E)=>(c.openBlock(),c.createBlock(c.resolveDynamicComponent(x),{key:E,ref_for:!0,ref:c.unref(s)(E)},null,512))),128))]),content:c.withCtx(()=>[c.createElementVNode("div",{class:c.normalizeClass(["pullup-menu-wrapper",{}])},[c.createElementVNode("div",{class:"pullup-menu",role:"menu","aria-label":e.ariaLabel},[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(e.options,x=>(c.openBlock(),c.createElementBlock("button",{type:"button",role:"menuitem",class:"select-button",onClick:E=>i(x)},[c.createElementVNode("div",gee,[c.createVNode(At,null,{default:c.withCtx(()=>[(c.openBlock(),c.createBlock(c.resolveDynamicComponent(x.icon)))]),_:2},1024)]),c.createElementVNode("div",hee,[o.optionLabel?c.renderSlot(I.$slots,"optionLabel",{option:x},void 0,!0,0):(c.openBlock(),c.createElementBlock(c.Fragment,{key:1},[c.createTextVNode(c.toDisplayString(x.label),1)],64))])],8,fee))),256))],8,dee),c.createElementVNode("div",Aee,[c.createElementVNode("button",{type:"button",class:"select-button","aria-label":"Close menu",onClick:y[0]||(y[0]=x=>a.value=!1)},[c.createElementVNode("div",mee,[c.createVNode(At,null,{default:c.withCtx(()=>[c.createVNode(c.unref(ss))]),_:1})]),y[3]||(y[3]=c.createElementVNode("div",{class:"label"},"Close",-1))])])])]),_:3},8,["show"])):(c.openBlock(),c.createBlock(K0,{key:1,show:a.value,"onUpdate:show":y[2]||(y[2]=x=>a.value=x),trigger:"click","allowed-placements":e.allowedPlacements??["bottom","top"],arrow:!0,"custom-styles":{},"custom-classes":["dropdown-popover"],"disable-background-effect":""},{trigger:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(c.unref(u),(x,E)=>(c.openBlock(),c.createBlock(c.resolveDynamicComponent(x),{key:E,ref_for:!0,ref:c.unref(s)(E)},null,512))),128))]),content:c.withCtx(()=>[c.createVNode(Z8,{id:c.unref(l),role:"menu","aria-label":e.ariaLabel,onKeydown:v},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(e.options,(x,E)=>(c.openBlock(),c.createBlock(G8,{key:x.value,ref_for:!0,ref:k=>p(k,E),role:"menuitem",tabindex:E===h.value?0:-1,onClick:k=>i(x)},c.createSlots({default:c.withCtx(()=>[o.optionLabel?c.renderSlot(I.$slots,"optionLabel",{option:x},void 0,!0,0):(c.openBlock(),c.createElementBlock(c.Fragment,{key:1},[c.createTextVNode(c.toDisplayString(x.label),1)],64))]),_:2},[x.icon?{name:"prefix",fn:c.withCtx(()=>[c.createVNode(At,null,{default:c.withCtx(()=>[(c.openBlock(),c.createBlock(c.resolveDynamicComponent(x.icon)))]),_:2},1024)]),key:"0"}:void 0]),1032,["tabindex","onClick"]))),128))]),_:3},8,["id","aria-label"])]),_:3},8,["show","allowed-placements"]))}}),[["__scopeId","data-v-f3fd4a7e"]]);function q0(e){return new Promise(function(t,r){if(typeof e!="string"&&!(e instanceof Blob)){r({err:"no image source"});return}const n=new Image;n.addEventListener("load",a=>{t({width:n.width,height:n.height,ratio:n.height/n.width})}),n.addEventListener("error",()=>r({err:"image corrupted"})),n.src=typeof e=="string"?e:URL.createObjectURL(e)})}function L8({height:e,left:t,top:r,width:n},a,i){const o=1/Math.max((n??0)/a,(e??0)/i),l=[Math.min(1,xo(Math.max(1e-6,t??0)/(a-(n??0)),6)),Math.min(1,xo(Math.max(1e-6,r??0)/(i-(e??0)),6))],s=[Math.max(-1,Math.min(1,(l[0]-.5)*2)),Math.max(-1,Math.min(1,(l[1]-.5)*2))];return{scale:o,innerPos:s}}function R2(e,t,r,n){const a=e.innerPos[0]/2+.5,i=e.innerPos[1]/2+.5,o=t/r>n?r*n:t,l=t/r>n?r:t/n,s=o/e.scale,u=l/e.scale,f=t-s,g=r-u,d=f*a,h=g*i;return{left:d,top:h,width:s,height:u}}var pee=Object.defineProperty,bee=(e,t,r)=>t in e?pee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,wa=(e,t,r)=>bee(e,typeof t!="symbol"?t+"":t,r);function Cee(e){return e*Math.PI/180}function Q8(e,t,r){return Math.min(Math.max(e,t),r)}function F2(e,t,r){const[n,a]=e,[i,o]=t,l=Math.cos(r)*(n-i)-Math.sin(r)*(a-o)+i,s=Math.sin(r)*(n-i)+Math.cos(r)*(a-o)+o;return[l,s]}function vee(e){return e.deltaMode===0}let yee=class extends EventTarget{constructor(t,r,n,a,i,o,l=.1,s=10,u=!1,f=!0){super(),wa(this,"wrapperBounds",{x:0,y:0,width:100,height:100}),wa(this,"canvasBounds",{x:0,y:0,width:100,height:100}),wa(this,"translateSpeed",1),wa(this,"zoomSpeed",1),wa(this,"translateSpeedAppleTrackpad",1),wa(this,"zoomSpeedAppleTrackpad",1),wa(this,"isGestureActive",!1),wa(this,"roElement",null),wa(this,"roCanvas",null),wa(this,"ancestorMotionCleanup",null),wa(this,"gestureStartRotate",0),wa(this,"dragStart",null),wa(this,"dragStartFrozenX",null),wa(this,"dragStartFrozenY",null),wa(this,"touchStarts",null),wa(this,"touchStartTranslateX",0),wa(this,"touchStartTranslateY",0),this.element=t,this.offset=r,this.translateX=n,this.translateY=a,this.scale=i,this.rotate=o,this.minScale=l,this.maxScale=s,this.clampBounds=u,this.rotation=f,this.roElement=new ResizeObserver(()=>{const{x:g,y:d,width:h,height:m}=this.element.getBoundingClientRect();this.wrapperBounds={x:g,y:d,width:h,height:m},this.update()}),this.roCanvas=new ResizeObserver(g=>{const{width:d,height:h}=g[0].contentRect;(d!==this.canvasBounds.width||h!==this.canvasBounds.height)&&(this.canvasBounds={...this.canvasBounds,width:d,height:h},this.isGestureActive||this.update())}),requestAnimationFrame(()=>{this.wrapperBounds=this.element.getBoundingClientRect(),this.canvasBounds=this.canvasElement.getBoundingClientRect(),this.update(),this.dispatchEvent(new Event("init"))}),this.roCanvas.observe(this.canvasElement),this.roElement.observe(this.element),this.installAncestorMotionListeners()}installAncestorMotionListeners(){const t=()=>{const{x:i,y:o,width:l,height:s}=this.element.getBoundingClientRect();i===this.wrapperBounds.x&&o===this.wrapperBounds.y&&l===this.wrapperBounds.width&&s===this.wrapperBounds.height||(this.wrapperBounds={x:i,y:o,width:l,height:s},this.update())},r=i=>!(i instanceof Node)||i===this.element?!1:i.contains(this.element),n=i=>{r(i.target)&&t()},a=["transitionrun","transitionend","transitioncancel","animationend","animationcancel"];for(const i of a)document.addEventListener(i,n,!0);this.ancestorMotionCleanup=()=>{for(const i of a)document.removeEventListener(i,n,!0)}}get canvasElement(){return this.element.querySelector(".canvas")}get wrapperInnerX(){return this.wrapperBounds.x+this.offset.left}get wrapperInnerY(){return this.wrapperBounds.y+this.offset.top}get wrapperInnerWidth(){return this.wrapperBounds.width-this.offset.left-this.offset.right}get wrapperInnerHeight(){return this.wrapperBounds.height-this.offset.top-this.offset.bottom}get wrapperInnerRatio(){return this.wrapperInnerWidth/this.wrapperInnerHeight}get canvasNaturalRatio(){return this.canvasBounds.width/this.canvasBounds.height}get naturalScale(){return this.canvasNaturalRatio>=this.wrapperInnerRatio?this.wrapperInnerWidth/this.canvasBounds.width:this.wrapperInnerHeight/this.canvasBounds.height}setTranslateFromUserGesture(t,r){if(this.clampBounds){const n=this.clampTranslate({translateX:t,translateY:r,scale:this.scale,rotate:this.rotate});this.translateX=n.translateX,this.translateY=n.translateY,this.rotate=0}else this.translateX=t,this.translateY=r}handleGesturestart(t){this.gestureStartRotate=this.rotate}handleGesturechange(t){const{clientX:r,clientY:n}=t,a=t.rotation;if(a===0||!this.rotation)return;const i=this.normalizeClientCoords(r,n);this.rotateCanvas(i[0],i[1],this.gestureStartRotate+Cee(a))}handleGestureend(t){}handleMousedown(t){t.preventDefault(),this.dragStart=[t.clientX,t.clientY],this.dragStartFrozenX=this.translateX,this.dragStartFrozenY=this.translateY}handleMouseup(t){t.preventDefault(),this.dragStart=null,this.dragStartFrozenX=null,this.dragStartFrozenY=null}handleMousemove(t){if(t.preventDefault(),this.dragStart&&this.dragStartFrozenX!==null&&this.dragStartFrozenY!==null){const r=t.clientX-this.dragStart[0],n=t.clientY-this.dragStart[1],a=this.dragStartFrozenX- -r,i=this.dragStartFrozenY- -n;this.setTranslateFromUserGesture(a,i),this.update()}}handleWheel(t){let{deltaX:r,deltaY:n,ctrlKey:a}=t;const i=vee(t);i||(Math.abs(n)>=100&&(n=Math.sign(n)*(Math.abs(n)/120)),Math.abs(r)>=100&&(r=Math.sign(r)*(Math.abs(r)/120)));const o=this.scale;if(a){const l=i?.01*this.zoomSpeedAppleTrackpad:.1*this.zoomSpeed,s=1+-n*l;let u=o*s;if(u=Q8(u,this.minScale,this.maxScale),(u===this.minScale||u===this.maxScale)&&(u===this.minScale&&s<1||u===this.maxScale&&s>1)){t.preventDefault();return}const f=this.relativeWrapperCoordinatesFromClientCoords(t.clientX,t.clientY),[g,d]=this.calcProjectionTranslate(u,f,this.normalizeMatrixCoordinates(t.clientX,t.clientY));this.setTranslateFromUserGesture(g,d),this.scale=u}else{const l=i?1*this.translateSpeedAppleTrackpad:25*this.translateSpeed;this.setTranslateFromUserGesture(this.translateX-r*l,this.translateY-n*l)}this.update(),t.preventDefault()}freezeTouches(t){return Array.from(t).map(r=>{const n=this.clientCoordsToWrapperCoords(r.clientX,r.clientY);return{client:[r.clientX,r.clientY],canvasRel:this.getCanvasCoordsRel(n[0],n[1])}})}handleTouchstart(t){this.touchStarts=this.freezeTouches(t.touches),this.touchStartTranslateX=this.translateX,this.touchStartTranslateY=this.translateY,this.isGestureActive=!0,t.preventDefault()}handleTouchmove(t){t.preventDefault();const r=Array.from(t.touches).map(n=>this.clientCoordsToWrapperCoords(n.clientX,n.clientY));if(this.touchStarts){if(r.length>=2&&this.touchStarts.length>=2){const n=[this.touchStarts[0].canvasRel[0]*this.canvasBounds.width,this.touchStarts[0].canvasRel[1]*this.canvasBounds.height],a=[this.touchStarts[1].canvasRel[0]*this.canvasBounds.width,this.touchStarts[1].canvasRel[1]*this.canvasBounds.height],i=Math.sqrt(Math.pow(n[0]-a[0],2)+Math.pow(n[1]-a[1],2)),o=Math.sqrt(Math.pow(r[0][0]-r[1][0],2)+Math.pow(r[0][1]-r[1][1],2))/this.naturalScale,l=Q8(o/i,this.minScale,this.maxScale),s=[r[0][0]/this.wrapperInnerWidth,r[0][1]/this.wrapperInnerHeight],u=this.touchStarts[0].canvasRel,[f,g]=this.calcProjectionTranslate(l,s,u,0);if(this.rotation){let d=0,h=0,m=0;const p=Math.atan2(a[1]-n[1],a[0]-n[0]);m=Math.atan2(r[1][1]-r[0][1],r[1][0]-r[0][0])-p;const C=(x,E)=>[this.offset.left+this.canvasBounds.width*x*this.naturalScale*l+f,this.offset.top+this.canvasBounds.height*E*this.naturalScale*l+g],v=C(0,0),I=C(this.touchStarts[0].canvasRel[0],this.touchStarts[0].canvasRel[1]),y=F2(v,I,m);d=y[0]-v[0],h=y[1]-v[1],this.scale=l,this.rotate=m,this.setTranslateFromUserGesture(f+d,g+h)}else this.scale=l,this.setTranslateFromUserGesture(f,g)}else{const n=t.touches[0].clientX-this.touchStarts[0].client[0],a=t.touches[0].clientY-this.touchStarts[0].client[1],i=this.touchStartTranslateX+n,o=this.touchStartTranslateY+a;this.setTranslateFromUserGesture(i,o)}this.update()}}handleTouchend(t){t.touches.length===0?this.touchStarts=null:(this.touchStarts=this.freezeTouches(t.touches),this.touchStartTranslateX=this.translateX,this.touchStartTranslateY=this.translateY),this.isGestureActive=!1}calcProjectionTranslate(t,r,n,a){const i=this.canvasBounds.width*this.naturalScale,o=this.canvasBounds.height*this.naturalScale,l=n[0]*i*t,s=n[1]*o*t,u=F2([l,s],[0,0],a??this.rotate),f=r[0]*this.wrapperInnerWidth,g=r[1]*this.wrapperInnerHeight,d=f-u[0],h=g-u[1];return[d,h]}applyTransform(t,r,n){const a=this.calcProjectionTranslate(t,r,n,0);this.scale=t,this.setTranslateFromUserGesture(a[0],a[1]),this.update()}composeRelPoint(t,r,n,a,i,o){n=n??this.scale,a=a??this.translateX,i=i??this.translateY,o=o??this.rotate;const l=[this.offset.left,this.offset.top],s=[this.offset.left+this.canvasBounds.width*(n*this.naturalScale)*t,this.offset.top+this.canvasBounds.height*(n*this.naturalScale)*r],u=F2(s,l,o);return[u[0]+a,u[1]+i]}composePoint(t,r){const n=t/this.canvasBounds.width,a=r/this.canvasBounds.height;return this.composeRelPoint(n,a)}getAnchorOffset(t,r,n,a,i=[.5,.5]){const o=this.calcProjectionTranslate(t,i,i,0),l=[this.offset.left+o[0]+this.canvasBounds.width*(t*this.naturalScale)*i[0],this.offset.top+o[1]+this.canvasBounds.height*(t*this.naturalScale)*i[1]],s=this.composeRelPoint(i[0],i[1],t,r,n,a),u=s[0]-l[0],f=s[1]-l[1];return[u,f]}getCanvasCoordsRel(t,r){const n=[0,0],a=[t-this.translateX,r-this.translateY],i=F2(a,n,-this.rotate),o=[i[0]/this.renderinScale,i[1]/this.renderinScale];return[o[0]/this.canvasBounds.width,o[1]/this.canvasBounds.height]}clientCoordsToWrapperCoords(t,r){const{x:n,y:a}=this.element.getBoundingClientRect();return[t-n-this.offset.left,r-a-this.offset.top]}relativeWrapperCoordinatesFromClientCoords(t,r){const[n,a]=this.clientCoordsToWrapperCoords(t,r);return[n/this.wrapperInnerWidth,a/this.wrapperInnerHeight]}normalizeMatrixCoordinates(t,r){const n=this.clientCoordsToWrapperCoords(t,r);return this.getCanvasCoordsRel(n[0],n[1])}normalizeClientCoords(t,r){const[n,a]=this.normalizeMatrixCoordinates(t,r);return[n*this.canvasBounds.width,a*this.canvasBounds.height]}rotateCanvas(t,r,n){const a=t/this.canvasBounds.width,i=r/this.canvasBounds.height,o=this.composeRelPoint(a,i,this.scale,0,0,n),l=this.composeRelPoint(a,i);this.setTranslateFromUserGesture(l[0]-o[0],l[1]-o[1]),this.rotate=n,this.update()}get renderinScale(){return this.naturalScale*this.scale}get renderingTranslateX(){return this.offset.left+this.translateX}get renderingTranslateY(){return this.offset.top+this.translateY}get renderingRotate(){return this.rotate}clampTranslate(t,r=[.5,.5]){const n=this.canvasBounds.width*this.naturalScale*t.scale,a=this.canvasBounds.height*this.naturalScale*t.scale,i=n-this.wrapperInnerWidth,o=a-this.wrapperInnerHeight,l=i>0?-i:0,s=Math.min(0,Math.max(t.translateX,l)),u=o>0?-o:0,f=Math.min(0,Math.max(t.translateY,u)),g=-Math.min(0,i)*r[0],d=-Math.min(0,o)*r[1];return{translateX:s+g,translateY:f+d}}update(){this.canvasElement.style.transformOrigin="top left",this.canvasElement.style.transform=`translateX(${this.renderingTranslateX}px) translateY(${this.renderingTranslateY}px) scale(${this.renderinScale}) rotate(${this.renderingRotate}rad)`,this.dispatchEvent(new Event("update"))}destroy(){var t,r,n;(t=this.roElement)==null||t.disconnect(),this.roElement=null,(r=this.roCanvas)==null||r.disconnect(),this.roCanvas=null,(n=this.ancestorMotionCleanup)==null||n.call(this),this.ancestorMotionCleanup=null}};const Iee={class:"canvas"},wee={class:"matrix"},xee=c.defineComponent({__name:"Zoompinch",props:{transform:{default:()=>({translateX:0,translateY:0,scale:1,rotate:0})},offset:{default:()=>({left:0,top:0,right:0,bottom:0})},maxScale:{default:10},minScale:{default:.5},clampBounds:{type:Boolean,default:!1},rotation:{type:Boolean,default:!0},mouse:{type:Boolean,default:!0},wheel:{type:Boolean,default:!0},touch:{type:Boolean,default:!0},gesture:{type:Boolean,default:!0},zoomSpeed:{},translateSpeed:{},zoomSpeedAppleTrackpad:{},translateSpeedAppleTrackpad:{}},emits:["update:transform","init","dragGestureStart","dragGestureEnd"],setup(e,{expose:t,emit:r}){const n=e,a=r,i=c.ref(),o=c.ref(),l=c.ref(!1);window.zoompinchEngine=o;const s=c.ref(()=>{throw new Error("Not initialized yet")}),u=c.ref(0),f=c.ref(0);c.onMounted(()=>{i.value&&(o.value=new yee(i.value,n.offset,n.transform.translateX,n.transform.translateY,n.transform.scale,n.transform.rotate,n.minScale,n.maxScale,n.clampBounds,n.rotation),n.zoomSpeed!==void 0&&(o.value.zoomSpeed=n.zoomSpeed),n.translateSpeed!==void 0&&(o.value.translateSpeed=n.translateSpeed),n.zoomSpeedAppleTrackpad!==void 0&&(o.value.zoomSpeedAppleTrackpad=n.zoomSpeedAppleTrackpad),n.translateSpeedAppleTrackpad!==void 0&&(o.value.translateSpeedAppleTrackpad=n.translateSpeedAppleTrackpad),o.value.addEventListener("init",()=>{a("init")}),o.value.addEventListener("update",()=>{if(!o.value)return;const B={translateX:o.value.translateX,translateY:o.value.translateY,scale:o.value.scale,rotate:o.value.rotate};(B.translateX!==n.transform.translateX||B.translateY!==n.transform.translateY||B.scale!==n.transform.scale||B.rotate!==n.transform.rotate)&&a("update:transform",B),s.value=(N,D)=>o.value.composePoint(N,D),u.value=o.value.canvasBounds.width,f.value=o.value.canvasBounds.height}),o.value.addEventListener("init",()=>{l.value=!0}))}),c.watch(()=>n.transform,()=>{o.value&&(o.value.translateX!==n.transform.translateX||o.value.translateY!==n.transform.translateY||o.value.scale!==n.transform.scale||o.value.rotate!==n.transform.rotate)&&(o.value.translateX=n.transform.translateX,o.value.translateY=n.transform.translateY,o.value.scale=n.transform.scale,o.value.rotate=n.transform.rotate,o.value.update())},{deep:!0}),c.watch(()=>n.offset,B=>{o.value&&(o.value.offset=B,o.value.update())},{deep:!0}),c.watch(()=>n.minScale,B=>{o.value&&(o.value.minScale=B,o.value.update())}),c.watch(()=>n.maxScale,B=>{o.value&&(o.value.maxScale=B,o.value.update())}),c.watch(()=>n.clampBounds,B=>{o.value&&(o.value.clampBounds=B,o.value.setTranslateFromUserGesture(o.value.translateX,o.value.translateY),o.value.update())}),c.watch(()=>n.rotation,B=>{o.value&&(o.value.rotation=B,o.value.update())}),c.watch(()=>n.zoomSpeed,()=>{!o.value||n.zoomSpeed===void 0||(o.value.zoomSpeed=n.zoomSpeed)}),c.watch(()=>n.translateSpeed,()=>{!o.value||n.translateSpeed===void 0||(o.value.translateSpeed=n.translateSpeed)}),c.watch(()=>n.zoomSpeedAppleTrackpad,()=>{!o.value||n.zoomSpeedAppleTrackpad===void 0||(o.value.zoomSpeedAppleTrackpad=n.zoomSpeedAppleTrackpad)}),c.watch(()=>n.translateSpeedAppleTrackpad,()=>{!o.value||n.translateSpeedAppleTrackpad===void 0||(o.value.translateSpeedAppleTrackpad=n.translateSpeedAppleTrackpad)});const g=(B,N,D,Q)=>{o.value&&(Q!==void 0&&(o.value.rotate=Q),o.value.applyTransform(B,N,D))},d=B=>{o.value&&n.wheel&&o.value.handleWheel(B)},h=B=>{o.value&&n.gesture&&o.value.handleGesturestart(B)},m=B=>{o.value&&n.gesture&&o.value.handleGesturechange(B)},p=B=>{o.value&&n.gesture&&o.value.handleGestureend(B)},C=B=>{o.value&&n.mouse&&o.value.handleMousedown(B)},v=B=>{o.value&&n.mouse&&o.value.handleMousemove(B)},I=B=>{o.value&&n.mouse&&o.value.handleMouseup(B)},y=B=>{o.value&&n.touch&&o.value.handleTouchstart(B)},x=B=>{o.value&&n.touch&&o.value.handleTouchmove(B)},E=B=>{o.value&&n.touch&&o.value.handleTouchend(B)};window.addEventListener("gesturechange",m),window.addEventListener("gestureend",p),window.addEventListener("mousemove",v),window.addEventListener("mouseup",I),window.addEventListener("touchmove",x),window.addEventListener("touchend",E),c.onUnmounted(()=>{window.removeEventListener("gesturechange",m),window.removeEventListener("gestureend",p),window.removeEventListener("mousemove",v),window.removeEventListener("mouseup",I),window.removeEventListener("touchmove",x),window.removeEventListener("touchend",E)});const k=(B,N)=>{if(!o.value)throw new Error("Zoompinch engine not initialized");return o.value.normalizeClientCoords(B,N)},S=(B,N,D)=>{o.value&&o.value.rotateCanvas(B,N,D)};return c.useSlots(),t({applyTransform:g,composePoint:s,normalizeClientCoords:k,zoompinchEngine:o,canvasWidth:u,canvasHeight:f,rotateCanvas:S}),(B,N)=>(c.openBlock(),c.createElementBlock("div",{ref_key:"zoompinchRef",ref:i,class:"zoompinch",onWheel:d,onGesturestart:h,onMousedown:C,onTouchstart:y},[c.createElementVNode("div",Iee,[c.renderSlot(B.$slots,"default",{},void 0,!0)]),c.createElementVNode("div",wee,[l.value&&s.value?c.renderSlot(B.$slots,"matrix",{key:0,composePoint:s.value,normalizeClientCoords:k,canvasWidth:u.value,canvasHeight:f.value},void 0,!0):c.createCommentVNode("",!0)])],544))}}),Eee=(e,t)=>{const r=e.__vccOpts||e;for(const[n,a]of t)r[n]=a;return r},z8=Eee(xee,[["__scopeId","data-v-fbdbcf7c"]]),w1=new Set;requestAnimationFrame(function e(){w1.forEach(t=>t()),requestAnimationFrame(e)});function T8(e,t,r){let n;const a=()=>{const o=e instanceof Function?e():e.value,l=n;o!==n&&(n=o,t(o,l))};return w1.add(a),()=>{w1.delete(a)}}function Kv(e,t){let r=null;const n=this;return()=>{clearTimeout(r);var a=arguments;r=setTimeout(()=>{e.apply(n,a)},t)}}const Bee=["x","y","width","height"],kee=["cx","cy","r"],See=["cx","cy","r"],_ee=["cx","cy","r"],Dee=["cx","cy","r"],Nee=["cx","cy","r"],Ree=["cx","cy","r"],Fee=["cx","cy","r"],Zee=["cx","cy","r"],Gee=["cx","cy","r"],Lee=["cx","cy","r"],Qee=["cx","cy","r"],zee=["cx","cy","r"],Tee=["cx","cy","r"],Wee=["cx","cy","r"],Mee=["cx","cy","r"],Oee=["cx","cy","r"],Yee=ht(c.defineComponent({__name:"CropSkeleton",props:{x:{},y:{},width:{},height:{},aspectRatio:{},clamp:{}},emits:["update","effectiveHandleChange"],setup(e,{emit:t}){const r=e,n=t,a=c.ref(5),i=c.computed(()=>{const Z=Math.min(r.width,r.height);return Z>=a.value*8?a.value*4:Math.max(Z/2,a.value)}),o=c.computed(()=>({x:r.x,y:r.y})),l=c.computed(()=>({x:r.x+r.width,y:r.y})),s=c.computed(()=>({x:r.x+r.width,y:r.y+r.height})),u=c.computed(()=>({x:r.x,y:r.y+r.height})),f=c.computed(()=>({x:r.x+r.width/2,y:r.y})),g=c.computed(()=>({x:r.x+r.width,y:r.y+r.height/2})),d=c.computed(()=>({x:r.x+r.width/2,y:r.y+r.height})),h=c.computed(()=>({x:r.x,y:r.y+r.height/2})),m=c.computed(()=>r.width>a.value*4&&r.height>a.value*4),p=c.ref(null),C=c.ref(null),v=c.ref(null),I=c.ref(null),y=c.ref(null),x=c.ref(null),E=c.ref(null);c.watch(x,Z=>{n("effectiveHandleChange",Z)});function k(Z,G){console.log("handleThumbMouseDown",Z,G),y.value=G,x.value=G,E.value=null,v.value={x:r.x,y:r.y,width:r.width,height:r.height},I.value={x:Z.clientX,y:Z.clientY},Z.preventDefault(),Z.stopPropagation()}function S(Z,G){console.log("handleThumbTouchstart",Z,G);const M=Z.touches[0];y.value=G,x.value=G,E.value=null,v.value={x:r.x,y:r.y,width:r.width,height:r.height},I.value={x:M.clientX,y:M.clientY},Z.preventDefault(),Z.stopPropagation()}const B=()=>{y.value=null,x.value=null,E.value=null,v.value=null,I.value=null,p.value=null,C.value=null},N=()=>{y.value=null,x.value=null,E.value=null,v.value=null,I.value=null,p.value=null,C.value=null},D=Z=>{if(p.value){if(!v.value)return;const G=Z.clientX-p.value.x,M=Z.clientY-p.value.y;C.value={x:v.value.x+G,y:v.value.y+M,width:v.value.width,height:v.value.height}}else y.value&&(E.value={x:Z.clientX,y:Z.clientY})},Q=Z=>{const G=Z.touches[0];if(p.value){if(!v.value)return;const M=G.clientX-p.value.x,J=G.clientY-p.value.y;C.value={x:v.value.x+M,y:v.value.y+J,width:v.value.width,height:v.value.height}}else y.value&&(E.value={x:G.clientX,y:G.clientY})};function z(Z){p.value={x:Z.clientX,y:Z.clientY},I.value={x:Z.clientX,y:Z.clientY},v.value={x:r.x,y:r.y,width:r.width,height:r.height},Z.preventDefault(),Z.stopPropagation()}function A(Z){const G=Z.touches[0];p.value={x:G.clientX,y:G.clientY},I.value={x:G.clientX,y:G.clientY},v.value={x:r.x,y:r.y,width:r.width,height:r.height},Z.preventDefault(),Z.stopPropagation()}function P(Z){var re,ee;const G=((re=r.clamp)==null?void 0:re.x)??-1/0,M=((ee=r.clamp)==null?void 0:ee.y)??-1/0,J=r.clamp?r.clamp.x+r.clamp.width:1/0,X=r.clamp?r.clamp.y+r.clamp.height:1/0;return{x:Math.min(Math.max(Z.x,G),J-Z.width),y:Math.min(Math.max(Z.y,M),X-Z.height),width:Z.width,height:Z.height}}function W(Z){const G=Z.shiftKey?10:4;let M=0,J=0;switch(Z.key){case"ArrowLeft":M=-G;break;case"ArrowRight":M=G;break;case"ArrowUp":J=-G;break;case"ArrowDown":J=G;break;default:return}Z.preventDefault();const X={x:r.x,y:r.y,width:r.width,height:r.height};if(Z.shiftKey)if(r.aspectRatio!=null){const ee=Z.key==="ArrowRight"||Z.key==="ArrowDown"?G:-G,{bbox:ne}=R("br",X,ee,ee,r.aspectRatio,r.clamp);n("update",ne)}else{const{bbox:re}=R("br",X,M,J,void 0,r.clamp);n("update",re)}else n("update",P({...X,x:X.x+M,y:X.y+J}))}function O(Z,G,M){const J={tl:"tr",tr:"tl",bl:"br",br:"bl",l:"r",r:"l"},X={tl:"bl",bl:"tl",tr:"br",br:"tr",t:"b",b:"t"};let re=Z;return G&&(re=J[re]??re),M&&(re=X[re]??re),re}function R(Z,G,M,J,X,re){let ee=G.x,ne=G.y,ue=G.x+G.width,be=G.y+G.height;switch(Z){case"tl":ee+=M,ne+=J;break;case"t":ne+=J;break;case"tr":ue+=M,ne+=J;break;case"r":ue+=M;break;case"br":ue+=M,be+=J;break;case"b":be+=J;break;case"bl":ee+=M,be+=J;break;case"l":ee+=M;break}const ae=ee>ue,L=ne>be,T=O(Z,ae,L),V=(re==null?void 0:re.x)??-1/0,q=(re==null?void 0:re.y)??-1/0,ge=re?re.x+re.width:1/0,fe=re?re.y+re.height:1/0;if(X!=null)if(Z==="tl"||Z==="tr"||Z==="bl"||Z==="br"){const Re=Z==="tl"||Z==="bl"?ue:ee,ye=Z==="tl"||Z==="tr"?be:ne,ke=Z==="tl"||Z==="bl"?ee:ue,He=Z==="tl"||Z==="tr"?ne:be,Xe=ke>=Re,Ye=He>=ye;let Je=Math.max(Math.abs(ke-Re),1),we=Math.max(Math.abs(He-ye),1);if(Je/we>X?Je=we*X:we=Je/X,re){const Qe=Xe?ge-Re:Re-V,at=Ye?fe-ye:ye-q;(Je>Qe||we>at)&&(Qe/at>X?(we=Math.min(we,at),Je=we*X):(Je=Math.min(Je,Qe),we=Je/X))}Xe?(ee=Re,ue=Re+Je):(ue=Re,ee=Re-Je),Ye?(ne=ye,be=ye+we):(be=ye,ne=ye-we)}else if(Z==="r"||Z==="l"){const ye=Z==="r"?G.x:G.x+G.width,ke=Z==="r"?ue:ee,He=G.y+G.height/2,Xe=ke>=ye;let Ye=Math.max(Math.abs(ke-ye),1);if(re){const we=Xe?ge-ye:ye-V,Qe=Math.min(He-q,fe-He)*2;Ye=Math.max(Math.min(Ye,we,Qe*X),1)}const Je=Ye/X;Xe?(ee=ye,ue=ye+Ye):(ue=ye,ee=ye-Ye),ne=He-Je/2,be=He+Je/2}else{const ye=Z==="b"?G.y:G.y+G.height,ke=Z==="b"?be:ne,He=G.x+G.width/2,Xe=ke>=ye;let Ye=Math.max(Math.abs(ke-ye),1);if(re){const we=Xe?fe-ye:ye-q,Qe=Math.min(He-V,ge-He)*2;Ye=Math.max(Math.min(Ye,we,Qe/X),1)}const Je=Ye*X;Xe?(ne=ye,be=ye+Ye):(be=ye,ne=ye-Ye),ee=He-Je/2,ue=He+Je/2}else{const Ie=Math.min(ee,ue),Re=Math.min(ne,be),ye=Math.max(ee,ue),ke=Math.max(ne,be);ee=Ie,ne=Re,ue=ye,be=ke,re&&(ee=Math.max(ee,V),ne=Math.max(ne,q),ue=Math.min(ue,ge),be=Math.min(be,fe))}return{bbox:{x:ee,y:ne,width:ue-ee,height:be-ne},effectiveHandle:T}}return T8(C,()=>{var Z,G;if(C.value){const M=((Z=r.clamp)==null?void 0:Z.x)??-1/0,J=((G=r.clamp)==null?void 0:G.y)??-1/0,X=r.clamp?r.clamp.x+r.clamp.width:1/0,re=r.clamp?r.clamp.y+r.clamp.height:1/0;C.value.x<M&&(C.value.x=M),C.value.y<J&&(C.value.y=J),C.value.x+C.value.width>X&&(C.value.x=X-C.value.width),C.value.y+C.value.height>re&&(C.value.y=re-C.value.height),n("update",C.value)}}),T8(E,()=>{if(!y.value||!E.value||!I.value||!v.value)return;const Z=E.value.x-I.value.x,G=E.value.y-I.value.y,{bbox:M,effectiveHandle:J}=R(y.value,v.value,Z,G,r.aspectRatio,r.clamp);x.value=J,n("update",M)}),window.addEventListener("mouseup",B),window.addEventListener("touchend",N),window.addEventListener("mousemove",D),window.addEventListener("touchmove",Q),c.onUnmounted(()=>{window.removeEventListener("mouseup",B),window.removeEventListener("touchend",N),window.removeEventListener("mousemove",D),window.removeEventListener("touchmove",Q)}),(Z,G)=>(c.openBlock(),c.createElementBlock("g",null,[c.createElementVNode("rect",{x:e.x,y:e.y,width:e.width,height:e.height,class:"skeleton-rect",tabindex:"0",role:"application","aria-roledescription":"Crop area","aria-label":"Crop area. Use arrow keys to move, Shift plus arrow keys to resize.",onMousedown:z,onTouchstart:A,onKeydown:W},null,40,Bee),c.createElementVNode("g",{class:c.normalizeClass({inactive:!m.value})},[c.createElementVNode("g",null,[c.createElementVNode("circle",{cx:f.value.x,cy:f.value.y,r:i.value,class:"thumb-circle-hitbox thumb-circle-hitbox-t",onMousedown:G[0]||(G[0]=M=>k(M,"t")),onTouchstart:G[1]||(G[1]=M=>S(M,"t"))},null,40,kee),c.createElementVNode("circle",{cx:f.value.x,cy:f.value.y,r:a.value,class:c.normalizeClass(["thumb-circle",{pressing:x.value==="t"}])},null,10,See)]),c.createElementVNode("g",null,[c.createElementVNode("circle",{cx:g.value.x,cy:g.value.y,r:i.value,class:"thumb-circle-hitbox thumb-circle-hitbox-r",onMousedown:G[2]||(G[2]=M=>k(M,"r")),onTouchstart:G[3]||(G[3]=M=>S(M,"r"))},null,40,_ee),c.createElementVNode("circle",{cx:g.value.x,cy:g.value.y,r:a.value,class:c.normalizeClass(["thumb-circle",{pressing:x.value==="r"}])},null,10,Dee)]),c.createElementVNode("g",null,[c.createElementVNode("circle",{cx:d.value.x,cy:d.value.y,r:i.value,class:"thumb-circle-hitbox thumb-circle-hitbox-b",onMousedown:G[4]||(G[4]=M=>k(M,"b")),onTouchstart:G[5]||(G[5]=M=>S(M,"b"))},null,40,Nee),c.createElementVNode("circle",{cx:d.value.x,cy:d.value.y,r:a.value,class:c.normalizeClass(["thumb-circle",{pressing:x.value==="b"}])},null,10,Ree)]),c.createElementVNode("g",null,[c.createElementVNode("circle",{cx:h.value.x,cy:h.value.y,r:i.value,class:"thumb-circle-hitbox thumb-circle-hitbox-l",onMousedown:G[6]||(G[6]=M=>k(M,"l")),onTouchstart:G[7]||(G[7]=M=>S(M,"l"))},null,40,Fee),c.createElementVNode("circle",{cx:h.value.x,cy:h.value.y,r:a.value,class:c.normalizeClass(["thumb-circle",{pressing:x.value==="l"}])},null,10,Zee)])],2),c.createElementVNode("g",null,[c.createElementVNode("g",null,[c.createElementVNode("circle",{cx:o.value.x,cy:o.value.y,r:i.value,class:"thumb-circle-hitbox thumb-circle-hitbox-tl",onMousedown:G[8]||(G[8]=M=>k(M,"tl")),onTouchstart:G[9]||(G[9]=M=>S(M,"tl"))},null,40,Gee),c.createElementVNode("circle",{cx:o.value.x,cy:o.value.y,r:a.value,class:c.normalizeClass(["thumb-circle",{pressing:x.value==="tl"}])},null,10,Lee)]),c.createElementVNode("g",null,[c.createElementVNode("circle",{cx:l.value.x,cy:l.value.y,r:i.value,class:"thumb-circle-hitbox thumb-circle-hitbox-tr",onMousedown:G[10]||(G[10]=M=>k(M,"tr")),onTouchstart:G[11]||(G[11]=M=>S(M,"tr"))},null,40,Qee),c.createElementVNode("circle",{cx:l.value.x,cy:l.value.y,r:a.value,class:c.normalizeClass(["thumb-circle",{pressing:x.value==="tr"}])},null,10,zee)]),c.createElementVNode("g",null,[c.createElementVNode("circle",{cx:u.value.x,cy:u.value.y,r:i.value,class:"thumb-circle-hitbox thumb-circle-hitbox-bl",onMousedown:G[12]||(G[12]=M=>k(M,"bl")),onTouchstart:G[13]||(G[13]=M=>S(M,"bl"))},null,40,Tee),c.createElementVNode("circle",{cx:u.value.x,cy:u.value.y,r:a.value,class:c.normalizeClass(["thumb-circle",{pressing:x.value==="bl"}])},null,10,Wee)]),c.createElementVNode("g",null,[c.createElementVNode("circle",{cx:s.value.x,cy:s.value.y,r:i.value,class:"thumb-circle-hitbox thumb-circle-hitbox-br",onMousedown:G[14]||(G[14]=M=>k(M,"br")),onTouchstart:G[15]||(G[15]=M=>S(M,"br"))},null,40,Mee),c.createElementVNode("circle",{cx:s.value.x,cy:s.value.y,r:a.value,class:c.normalizeClass(["thumb-circle",{pressing:x.value==="br"}])},null,10,Oee)])])]))}}),[["__scopeId","data-v-ab8c8451"]]);function ed(e,t,r){return Math.min(Math.max(e,t),r)}function Pee(e,t){const r=ed(e.x,t.x,t.x+t.width),n=ed(e.y,t.y,t.y+t.height),a=ed(e.x+e.width,t.x,t.x+t.width),i=ed(e.y+e.height,t.y,t.y+t.height);return{x:r,y:n,width:a-r,height:i-n}}function Vee(e,t,r){if(r==null)return Pee(e,t);let n=e.width,a=e.height;n>t.width&&(n=t.width,a=n/r),a>t.height&&(a=t.height,n=a*r);const i=ed(e.x,t.x,t.x+t.width-n),o=ed(e.y,t.y,t.y+t.height-a);return{x:i,y:o,width:n,height:a}}function jee(e){return new Promise((t,r)=>{if(e.complete&&e.naturalWidth!==0){console.log("[0] getBoundingClientRect",e.getBoundingClientRect()),t();return}const n=()=>{e.naturalWidth*e.naturalHeight>0&&(console.log("[1] getBoundingClientRect",e.getBoundingClientRect()),setTimeout(()=>{console.log("[2] getBoundingClientRect",e.getBoundingClientRect()),t()}),w1.delete(n))};w1.add(n),e.addEventListener("error",()=>r(new Error("Failed to load image")),{once:!0})})}const Hee={class:"bx-cropper"},Uee={xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"100%",class:"matrix-svg"},Xee={key:0,class:"layer loading-layer"},$ee={class:"layer"},W8=ht(c.defineComponent({__name:"BxCropper",props:{crop:{},aspectRatio:{},offset:{default:()=>({top:10,right:10,bottom:10,left:10})},mirrorX:{type:Boolean,default:!1},mirrorY:{type:Boolean,default:!1}},emits:["update:crop"],setup(e,{emit:t}){const r=e,n=t;c.useSlots();const a=c.ref(),i=c.ref({translateX:0,translateY:0,scale:1,rotate:0}),o=c.ref(),l=c.ref();function s(C){let{left:v,top:I,width:y,height:x}=C;return r.mirrorX&&a.value&&(v=a.value.canvasWidth-v-y),r.mirrorY&&a.value&&(I=a.value.canvasHeight-I-x),{left:v,top:I,width:y,height:x}}function u(C){if(!a.value)throw new Error("Zoompinch ref not available");const v=s(C),[I,y]=a.value.composePoint(v.left,v.top),[x,E]=a.value.composePoint(v.left+v.width,v.top+v.height),k=x-I,S=E-y;return{x:I,y,width:k,height:S}}function f(C){if(!a.value||!a.value.zoompinchEngine)throw new Error("Zoompinch ref or engine not available");const v=C.x+(a.value.zoompinchEngine.wrapperInnerX-r.offset.left),I=C.y+(a.value.zoompinchEngine.wrapperInnerY-r.offset.top),[y,x]=a.value.normalizeClientCoords(v,I),[E,k]=a.value.normalizeClientCoords(v+C.width,I+C.height),S=E-y,B=k-x;return{left:Math.round(y),top:Math.round(x),width:Math.round(S),height:Math.round(B)}}const g=c.ref(!1);async function d(){var I;if(!((I=a.value)!=null&&I.zoompinchEngine))return;const C=Array.from(a.value.zoompinchEngine.canvasElement.children);for(const y of C)y.tagName==="IMG"&&await jee(y);g.value=!0,a.value.applyTransform(1,[.5,.5],[.5,.5]);const v=r.crop??(()=>{const y=a.value.canvasWidth,x=a.value.canvasHeight,E=y/x;if(r.aspectRatio){const k=E>r.aspectRatio?x*r.aspectRatio:y,S=E>r.aspectRatio?x:y/r.aspectRatio;return{left:(y-k)/2,top:(x-S)/2,width:k,height:S}}else return{left:0,top:0,width:y,height:x}})();l.value=v,o.value=u(v)}const h=c.ref(null);window.test=()=>f(o.value);const m=c.computed(()=>{if(i.value,!a.value)throw new Error("Zoompinch ref not available");return u({left:0,top:0,width:a.value.canvasWidth,height:a.value.canvasHeight})});function p(C){o.value=C}return c.watch(i,()=>{!o.value||!a.value||(o.value=Vee(o.value,m.value,r.aspectRatio))}),c.watch(o,C=>{if(!C)return;const v=f(C),I=s(v);l.value=I,n("update:crop",I)}),c.watch([()=>r.mirrorX,()=>r.mirrorY],()=>{!g.value||!l.value||!a.value||(o.value=u(l.value))}),(C,v)=>(c.openBlock(),c.createElementBlock("div",Hee,[c.createVNode(c.unref(z8),{ref_key:"zoompinchRef",ref:a,transform:i.value,"onUpdate:transform":v[1]||(v[1]=I=>i.value=I),rotation:!1,"min-scale":1,offset:e.offset,"clamp-bounds":"",onInit:d,class:c.normalizeClass({[`effective-handle-${h.value}`]:h.value!==null})},{default:c.withCtx(()=>[c.renderSlot(C.$slots,"default",{},void 0,!0)]),matrix:c.withCtx(()=>[(c.openBlock(),c.createElementBlock("svg",Uee,[o.value?(c.openBlock(),c.createBlock(Yee,c.mergeProps({key:0},o.value,{"aspect-ratio":e.aspectRatio,clamp:m.value,onUpdate:p,onEffectiveHandleChange:v[0]||(v[0]=I=>h.value=I)}),null,16,["aspect-ratio","clamp"])):c.createCommentVNode("",!0)])),g.value?c.createCommentVNode("",!0):(c.openBlock(),c.createElementBlock("div",Xee,[c.createVNode(Pl)])),c.createElementVNode("div",$ee,[c.renderSlot(C.$slots,"layer",{},void 0,!0)])]),_:3},8,["transform","offset","class"])]))}}),[["__scopeId","data-v-8d2848fa"]]),Jee={class:"bx-image-cropper"},Kee=["src"],qee={class:"actions-left"},ete={class:"actions-right"},M8=ht(c.defineComponent({__name:"BxImageCropper",props:c.mergeModels({src:{},aspectRatio:{},offset:{}},{crop:{required:!1},cropModifiers:{},mirrorX:{type:Boolean,required:!1,default:!1},mirrorXModifiers:{},mirrorY:{type:Boolean,required:!1,default:!1},mirrorYModifiers:{}}),emits:c.mergeModels(["cancel","done"],["update:crop","update:mirrorX","update:mirrorY"]),setup(e,{emit:t}){const r=c.useModel(e,"crop"),n=c.useModel(e,"mirrorX"),a=c.useModel(e,"mirrorY"),i=t;function o(){n.value=!n.value}function l(){a.value=!a.value}return(s,u)=>(c.openBlock(),c.createElementBlock("div",Jee,[c.createVNode(W8,{"aspect-ratio":e.aspectRatio,crop:r.value,"onUpdate:crop":u[4]||(u[4]=f=>r.value=f),offset:e.offset,"mirror-x":n.value,"mirror-y":a.value},{layer:c.withCtx(()=>[c.createElementVNode("div",{class:"actions-wrapper",onTouchstart:u[2]||(u[2]=c.withModifiers(()=>{},["stop"])),onTouchend:u[3]||(u[3]=c.withModifiers(()=>{},["stop"]))},[c.createElementVNode("div",qee,[c.createVNode(Lt,{onClick:o,class:c.normalizeClass({active:!0}),"aria-label":"Mirror horizontally"},{icon:c.withCtx(()=>[c.createVNode(At,null,{default:c.withCtx(()=>[...u[5]||(u[5]=[c.createElementVNode("svg",{fill:"none",viewBox:"0 0 24 24","data-fpl-icon-size":"24"},[c.createElementVNode("g",{style:{"transform-origin":"center center",transform:"scale(1.5)"}},[c.createElementVNode("path",{style:{fill:"currentColor","fill-rule":"evenodd"},d:"M12.5 6.5a.5.5 0 0 0-1 0v11a.5.5 0 0 0 1 0zM6 9.104a.75.75 0 0 1 1.28-.53L10 11.292a1 1 0 0 1 0 1.414l-2.72 2.72a.75.75 0 0 1-1.28-.53zm1 .603v4.586L9.293 12zm11-.603a.75.75 0 0 0-1.28-.53L14 11.292a1 1 0 0 0 0 1.414l2.72 2.72a.75.75 0 0 0 1.28-.53zm-1 .603v4.586L14.707 12z","clip-rule":"evenodd"})])],-1)])]),_:1})]),_:1}),c.createVNode(Lt,{onClick:l,class:c.normalizeClass({active:!0}),"aria-label":"Mirror vertically"},{icon:c.withCtx(()=>[c.createVNode(At,null,{default:c.withCtx(()=>[...u[6]||(u[6]=[c.createElementVNode("svg",{fill:"none",viewBox:"0 0 24 24","data-fpl-icon-size":"24"},[c.createElementVNode("g",{style:{"transform-origin":"center center",transform:"scale(1.5)"}},[c.createElementVNode("path",{style:{fill:"currentColor","fill-rule":"evenodd"},d:"M17.5 12.5a.5.5 0 0 0 0-1h-11a.5.5 0 0 0 0 1zM14.896 18a.75.75 0 0 0 .53-1.28L12.708 14a1 1 0 0 0-1.414 0l-2.72 2.72a.75.75 0 0 0 .53 1.28zm-.603-1H9.707L12 14.707zm.603-11a.75.75 0 0 1 .53 1.28L12.708 10a1 1 0 0 1-1.414 0l-2.72-2.72A.75.75 0 0 1 9.103 6zm-.603 1H9.707L12 9.293z","clip-rule":"evenodd"})])],-1)])]),_:1})]),_:1})]),c.createElementVNode("div",ete,[c.createVNode(Lt,{secondary:"",onClick:u[0]||(u[0]=f=>i("cancel"))},{default:c.withCtx(()=>[...u[7]||(u[7]=[c.createTextVNode(" Cancel ",-1)])]),_:1}),c.createVNode(Lt,{active:"",onClick:u[1]||(u[1]=f=>i("done"))},{default:c.withCtx(()=>[...u[8]||(u[8]=[c.createTextVNode(" Done ",-1)])]),_:1})])],32)]),default:c.withCtx(()=>[c.createElementVNode("img",{src:e.src,class:c.normalizeClass(["image",{"mirror-x":n.value,"mirror-y":a.value}])},null,10,Kee)]),_:1},8,["aspect-ratio","crop","offset","mirror-x","mirror-y"])]))}}),[["__scopeId","data-v-0924dbd3"]]),O8=.6,Y8=.4,P8=.6,V8=(e,t,r)=>Math.min(r,Math.max(t,e));function j8(e){const{faces:t,natural:r,aspectRatio:n,cropMode:a,zoom:i=!1}=e;if(a!=="cover"||!Number.isFinite(n)||n<=0||!(r.width>0)||!(r.height>0))return null;const o=t.filter(E=>E.score>=O8&&E.width>0&&E.height>0);if(o.length===0)return null;const l=Math.min(...o.map(E=>E.x)),s=Math.min(...o.map(E=>E.y)),u=Math.max(...o.map(E=>E.x+E.width)),f=Math.max(...o.map(E=>E.y+E.height)),g=(l+u)/2,d=(s+f)/2,h=r.width/r.height,m=h>n?r.height*n:r.width,p=h>n?r.height:r.width/n;let C=m,v=p;if(i){const E=(u-l)*(1+2*P8),k=(f-s)*(1+2*P8),S=Math.max(E,k*n),B=S/n;C=Math.min(m,S),v=Math.min(p,B)}const I=g-C/2,y=d-v*Y8,x={left:V8(I,0,Math.max(0,r.width-C)),top:V8(y,0,Math.max(0,r.height-v)),width:C,height:v};return x.left===0&&x.top===0&&Math.abs(x.width-r.width)<.5&&Math.abs(x.height-r.height)<.5?null:x}let Z2=null;function tte(e){Z2=e}function H8(){return Z2!==null}async function rte(e){if(!Z2)return[];try{const t=await Z2(e);return Array.isArray(t)?t:[]}catch(t){return console.warn("[autoCrop] face detection failed, skipping auto-crop",t),[]}}const nte=640;function ate(e){return new Promise(t=>{const r=new Image;r.crossOrigin="anonymous",r.addEventListener("load",()=>t(r)),r.addEventListener("error",()=>t(null)),r.src=e})}function ite(e){const t=e.naturalWidth||e.width,r=e.naturalHeight||e.height;if(!(t>0)||!(r>0))return null;const n=Math.min(1,nte/Math.max(t,r)),a=document.createElement("canvas");a.width=Math.max(1,Math.round(t*n)),a.height=Math.max(1,Math.round(r*n));const i=a.getContext("2d",{willReadFrequently:!0});if(!i)return null;i.drawImage(e,0,0,a.width,a.height);try{i.getImageData(0,0,1,1)}catch{return null}return{canvas:a,scale:n}}async function U8(e){if(!H8()||e.cropMode!=="cover")return null;const t=await ate(e.src);if(!t)return null;const r=ite(t);if(!r)return null;const n=await rte(r.canvas);if(n.length===0)return null;const a=1/r.scale,i=n.map(o=>({x:o.x*a,y:o.y*a,width:o.width*a,height:o.height*a,score:o.score}));return j8({faces:i,natural:e.natural,aspectRatio:e.aspectRatio,cropMode:e.cropMode,zoom:e.zoom})}var Kl={},qv={},X8={};Object.defineProperty(X8,"__esModule",{value:!0});var $8={};Object.defineProperty($8,"__esModule",{value:!0});var J8={};Object.defineProperty(J8,"__esModule",{value:!0});var e3={};Object.defineProperty(e3,"__esModule",{value:!0});var Wn={},K8;function ote(){if(K8)return Wn;K8=1,Object.defineProperty(Wn,"__esModule",{value:!0}),Wn.SERIAL_CANVAS_DOC_KEYS=void 0,Wn.cloneSerialJson=t,Wn.isMultiCanvas=r,Wn.getActiveCanvasId=n,Wn.getSerialCanvasById=a,Wn.extractDocState=i,Wn.docStateFromCanvas=o,Wn.syncActiveCanvasEntry=l,Wn.materializeCanvas=s,Wn.toPersistedSerial=u,Wn.fromPersistedSerial=f,Wn.canvasSizeToken=g,Wn.canvasDisplayName=d,Wn.findCanvasBySize=h,Wn.isCanvasSizeTaken=m,Wn.duplicateCanvasSizeCounts=p;const e=ek();Wn.SERIAL_CANVAS_DOC_KEYS=["context","width","height","frames","fill","grid"];function t(C){return JSON.parse(JSON.stringify(C))}function r(C){var v;return(((v=C.canvases)==null?void 0:v.length)??0)>=2}function n(C){return C.activeCanvasId??e.DEFAULT_CANVAS_ID}function a(C,v){var I;return(I=C.canvases)==null?void 0:I.find(y=>y.id===v)}function i(C){return{context:C.context,width:C.width,height:C.height,frames:C.frames,fill:C.fill,grid:C.grid}}function o(C){return{context:C.context,width:C.width,height:C.height,frames:C.frames,fill:C.fill,grid:C.grid??{horizontal:[],vertical:[]}}}function l(C){if(!r(C))return C.canvases;const v=n(C),I=C.canvases.findIndex(E=>E.id===v);if(I===-1)return C.canvases;const y=C.canvases[I],x=C.canvases.slice();return x[I]={...y,...t(i(C)),frames:C.frames?t(C.frames):void 0,fill:C.fill?t(C.fill):void 0},x}function s(C,v){if(!r(C))return C;const I=a(C,v);return I?{...C,...o(I),activeCanvasId:v}:C}function u(C){if(!r(C))return C;const v=l(C),I=(v==null?void 0:v.find(y=>y.id===e.DEFAULT_CANVAS_ID))??(v==null?void 0:v[0]);return I?{...C,canvases:v,...o(I)}:C}function f(C){if(!r(C))return C;const v=n(C);if(v===e.DEFAULT_CANVAS_ID)return C;const I=a(C,v);return I?{...C,...t(o(I))}:{...C,activeCanvasId:void 0}}function g(C,v){return`${Math.round(C)}x${Math.round(v)}`}function d(C){return`${Math.round(C.width)}×${Math.round(C.height)}`}function h(C,v,I,y){const x=g(v,I);return C.find(E=>E.id!==y&&g(E.width,E.height)===x)}function m(C,v,I,y){return!!h(C,v,I,y)}function p(C){const v={};for(const I of C){const y=g(I.width,I.height);v[y]=(v[y]??0)+1}for(const I of Object.keys(v))v[I]<2&&delete v[I];return v}return Wn}var G2={};Object.defineProperty(G2,"__esModule",{value:!0}),G2.isBlankSerial=ste,G2.applyBlankDocumentFormat=lte;function ste(e){var t;return!(e.context.length>0||(((t=e.canvases)==null?void 0:t.length)??0)>0)}function lte(e,t){return e.width=t.width,e.height=t.height,t.frames?e.frames={...t.frames}:delete e.frames,e}var q8;function ek(){return q8||(q8=1,function(e){var t=le&&le.__createBinding||(Object.create?function(i,o,l,s){s===void 0&&(s=l);var u=Object.getOwnPropertyDescriptor(o,l);(!u||("get"in u?!o.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return o[l]}}),Object.defineProperty(i,s,u)}:function(i,o,l,s){s===void 0&&(s=l),i[s]=o[l]}),r=le&&le.__setModuleDefault||(Object.create?function(i,o){Object.defineProperty(i,"default",{enumerable:!0,value:o})}:function(i,o){i.default=o}),n=le&&le.__importStar||function(){var i=function(o){return i=Object.getOwnPropertyNames||function(l){var s=[];for(var u in l)Object.prototype.hasOwnProperty.call(l,u)&&(s[s.length]=u);return s},i(o)};return function(o){if(o&&o.__esModule)return o;var l={};if(o!=null)for(var s=i(o),u=0;u<s.length;u++)s[u]!=="default"&&t(l,o,s[u]);return r(l,o),l}}(),a=le&&le.__exportStar||function(i,o){for(var l in i)l!=="default"&&!Object.prototype.hasOwnProperty.call(o,l)&&t(o,i,l)};Object.defineProperty(e,"__esModule",{value:!0}),e.SupportedInternalLinkedinKeys=e.DEFAULT_CANVAS_ID=e.Fields=e.Config=e.Elements=e.Geometry=void 0,e.Geometry=n(X8),e.Elements=n($8),e.Config=n(J8),e.Fields=n(e3),a(ote(),e),a(G2,e),e.DEFAULT_CANVAS_ID="default",e.SupportedInternalLinkedinKeys=["LINKEDIN_NAME","LINKEDIN_PICTURE","LINKEDIN_EMAIL","LINKEDIN_FAMILY_NAME","LINKEDIN_GIVEN_NAME"]}(qv)),qv}var L2={};Object.defineProperty(L2,"__esModule",{value:!0}),L2.Platforms=void 0,L2.Platforms=["instagram","facebook","x","tiktok","linkedin"];var tk={},rk={};Object.defineProperty(rk,"__esModule",{value:!0}),function(e){var t=le&&le.__createBinding||(Object.create?function(n,a,i,o){o===void 0&&(o=i);var l=Object.getOwnPropertyDescriptor(a,i);(!l||("get"in l?!a.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return a[i]}}),Object.defineProperty(n,o,l)}:function(n,a,i,o){o===void 0&&(o=i),n[o]=a[i]}),r=le&&le.__exportStar||function(n,a){for(var i in n)i!=="default"&&!Object.prototype.hasOwnProperty.call(a,i)&&t(a,n,i)};Object.defineProperty(e,"__esModule",{value:!0}),r(rk,e)}(tk);var nk={},ak={};Object.defineProperty(ak,"__esModule",{value:!0}),function(e){var t=le&&le.__createBinding||(Object.create?function(n,a,i,o){o===void 0&&(o=i);var l=Object.getOwnPropertyDescriptor(a,i);(!l||("get"in l?!a.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return a[i]}}),Object.defineProperty(n,o,l)}:function(n,a,i,o){o===void 0&&(o=i),n[o]=a[i]}),r=le&&le.__exportStar||function(n,a){for(var i in n)i!=="default"&&!Object.prototype.hasOwnProperty.call(a,i)&&t(a,n,i)};Object.defineProperty(e,"__esModule",{value:!0}),r(ak,e)}(nk);var ik={};Object.defineProperty(ik,"__esModule",{value:!0});var ok={};Object.defineProperty(ok,"__esModule",{value:!0});var sk={};Object.defineProperty(sk,"__esModule",{value:!0});var lk={};Object.defineProperty(lk,"__esModule",{value:!0});var ck={};Object.defineProperty(ck,"__esModule",{value:!0});var uk={};Object.defineProperty(uk,"__esModule",{value:!0});var dk={};Object.defineProperty(dk,"__esModule",{value:!0});var fk={},$t={};function ds(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]]);return r}typeof SuppressedError=="function"&&SuppressedError;const cte={ZodAny:"any",ZodArray:"array",ZodBigInt:"bigint",ZodBoolean:"boolean",ZodDefault:"default",ZodPrefault:"prefault",ZodTransform:"transform",ZodEnum:"enum",ZodIntersection:"intersection",ZodLazy:"lazy",ZodLiteral:"literal",ZodNever:"never",ZodNull:"null",ZodNullable:"nullable",ZodNumber:"number",ZodNonOptional:"nonoptional",ZodObject:"object",ZodOptional:"optional",ZodPipe:"pipe",ZodReadonly:"readonly",ZodRecord:"record",ZodString:"string",ZodTuple:"tuple",ZodType:"type",ZodUnion:"union",ZodDiscriminatedUnion:"union",ZodUnknown:"unknown",ZodVoid:"void",ZodDate:"date",ZodTemplateLiteral:"template_literal"};function Ht(e,t){return(Array.isArray(t)?t:[t]).some(n=>{var a;const i=((a=e==null?void 0:e.def)===null||a===void 0?void 0:a.type)===cte[n];return n==="ZodDiscriminatedUnion"?i&&"discriminator"in e.def:i})}function ca(e){return e&&"def"in e}function x1(e){return e.safeParse(null).success}function gk(e){return e.safeParse(void 0).success}let ute=class{constructor(){this._map=new Map,this._idmap=new Map}add(t,...r){const n=r[0];if(this._map.set(t,n),n&&typeof n=="object"&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,t)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(t){const r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){const r=t._zod.parent;if(r){const n={...this.get(r)??{}};return delete n.id,{...n,...this._map.get(t)}}return this._map.get(t)}has(t){return this._map.has(t)}};function dte(){return new ute}function Q2(e,t){if(e==null||t===null||t===void 0)return e===t;if(e===t||e.valueOf()===t.valueOf())return!0;if(Array.isArray(e)&&(!Array.isArray(t)||e.length!==t.length)||!(e instanceof Object)||!(t instanceof Object))return!1;const r=Object.keys(e);return Object.keys(t).every(n=>r.indexOf(n)!==-1)&&r.every(n=>Q2(e[n],t[n]))}class fte{constructor(){this.buckets=new Map}put(t){const r=this.hashCodeOf(t),n=this.buckets.get(r);if(!n){this.buckets.set(r,[t]);return}n.some(i=>Q2(i,t))||n.push(t)}contains(t){const r=this.hashCodeOf(t),n=this.buckets.get(r);return n?n.some(a=>Q2(a,t)):!1}values(){return[...this.buckets.values()].flat()}stats(){let t=0,r=0,n=0;for(const i of this.buckets.values())t+=1,r+=i.length,i.length>1&&(n+=1);const a=t/r;return{totalBuckets:t,collisions:n,totalValues:r,hashEffectiveness:a}}hashCodeOf(t){let r=0;if(Array.isArray(t)){for(let n=0;n<t.length;n++)r^=this.hashCodeOf(t[n])*n;return r}if(typeof t=="string"){for(let n=0;n<t.length;n++)r^=t.charCodeAt(n)*n;return r}if(typeof t=="number")return t;if(typeof t=="object")for(const[n,a]of Object.entries(t))r^=this.hashCodeOf(n)+this.hashCodeOf(a??"");return r}}function td(e){return e===void 0}function E1(e,t){const r={};return Object.entries(e).forEach(([n,a])=>{r[n]=t(a)}),r}function gte(e,t){const r={};return Object.entries(e).forEach(([n,a])=>{t.some(i=>i===n)||(r[n]=a)}),r}function Cu(e,t){const r={};return Object.entries(e).forEach(([n,a])=>{t(a,n)||(r[n]=a)}),r}function hk(e){return e.filter(t=>!td(t))}const B1=Q2;function Ak(e){const t=new fte;return e.forEach(r=>t.put(r)),[...t.values()]}function t3(e){return typeof e=="string"}function mk(e){return Object.fromEntries(Object.entries(e).sort(([t],[r])=>t.localeCompare(r)))}const r3=dte();class mr{static collectMetadata(t,r){const n=this.getMetadataFromRegistry(t),a=Object.assign(Object.assign({},n==null?void 0:n._internal),r==null?void 0:r._internal),i=Object.assign(Object.assign({},n==null?void 0:n.param),r==null?void 0:r.param),o=Object.assign(Object.assign(Object.assign(Object.assign({},Object.keys(a).length>0?{_internal:a}:{}),n),r),Object.keys(i).length>0?{param:i}:{});if(Ht(t,["ZodOptional","ZodNullable","ZodDefault","ZodPrefault","ZodReadonly","ZodNonOptional"])&&ca(t._zod.def.innerType))return this.collectMetadata(t._zod.def.innerType,o);if(Ht(t,"ZodPipe")){const l=t._zod.def.in,s=t._zod.def.out;if(Ht(l,"ZodTransform")&&ca(s))return this.collectMetadata(s,o);if(ca(l))return this.collectMetadata(l,o)}return o}static getMetadata(t){return this.collectMetadata(t)}static getOpenApiMetadata(t){const r=this.collectMetadata(t),n=r??{},{_internal:a}=n;return ds(n,["_internal"])}static getInternalMetadata(t){var r;return(r=this.collectMetadata(t))===null||r===void 0?void 0:r._internal}static getParamMetadata(t){const r=this.collectMetadata(t);return Object.assign(Object.assign({},r),{param:Object.assign(Object.assign({},r!=null&&r.description?{description:r.description}:{}),r==null?void 0:r.param)})}static buildSchemaMetadata(t){return Cu(gte(t,["param","_internal"]),td)}static buildParameterMetadata(t){return Cu(t,td)}static applySchemaMetadata(t,r){return Cu(Object.assign(Object.assign({},t),this.buildSchemaMetadata(r)),td)}static getRefId(t){var r;return(r=this.getInternalMetadata(t))===null||r===void 0?void 0:r.refId}static unwrapChained(t){return this.unwrapUntil(t)}static getDefaultValue(t){var r;const n=(r=this.unwrapUntil(t,"ZodDefault"))!==null&&r!==void 0?r:this.unwrapUntil(t,"ZodPrefault");return n==null?void 0:n._zod.def.defaultValue}static unwrapUntil(t,r){if(r&&Ht(t,r))return t;if(Ht(t,["ZodOptional","ZodNullable","ZodDefault","ZodPrefault","ZodReadonly","ZodNonOptional"])&&ca(t._zod.def.innerType))return this.unwrapUntil(t._zod.def.innerType,r);if(Ht(t,"ZodPipe")){const n=t._zod.def.in,a=t._zod.def.out;if(Ht(n,"ZodTransform")&&ca(a))return this.unwrapUntil(a,r);if(ca(n))return this.unwrapUntil(n,r)}return r?void 0:t}static getMetadataFromInternalRegistry(t){return r3.get(t)}static getMetadataFromRegistry(t){const r=this.getMetadataFromInternalRegistry(t),n=t.meta();if(!r)return n;const{_internal:a}=r,i=ds(r,["_internal"]),o=n??{},{id:l,title:s}=o,u=ds(o,["id","title"]);return Object.assign(Object.assign(Object.assign({_internal:Object.assign(Object.assign({},l?{refId:l}:{}),a)},i),s?{description:s}:{}),u)}static setMetadataInRegistry(t,r){r3.add(t,r)}}function Js(e,t){const r=e[t];typeof r=="function"&&(e[t]=function(...n){const a=r.apply(this,n),i=mr.getMetadataFromRegistry(this);return i&&mr.setMetadataInRegistry(a,i),a})}function hte(e){typeof e.ZodType.prototype.openapi<"u"||(e.ZodType.prototype.openapi=function(...t){const{refId:r,metadata:n,options:a}=Ate(...t),i=n??{},{param:o}=i,l=ds(i,["param"]),s=mr.getMetadataFromRegistry(this),u=s??{},{_internal:f}=u,g=ds(u,["_internal"]),d=Object.assign(Object.assign(Object.assign({},f),a),r?{refId:r}:void 0),h=Object.assign(Object.assign(Object.assign({},g),l),g!=null&&g.param||o?{param:Object.assign(Object.assign({},g==null?void 0:g.param),o)}:void 0),m=new this.constructor(this._def);function p(v){mr.setMetadataInRegistry(v,Object.assign(Object.assign({},Object.keys(d).length>0?{_internal:d}:void 0),h))}if(p(m),Ht(m,"ZodLazy")&&p(this),Ht(m,"ZodObject")){const v=mr.getMetadataFromRegistry(m),I=m.extend;m.extend=function(...y){const x=I.apply(m,y),E=v??{},{_internal:k}=E,S=ds(E,["_internal"]);return mr.setMetadataInRegistry(x,{_internal:{extendedFrom:k!=null&&k.refId?{refId:k.refId,schema:m}:k==null?void 0:k.extendedFrom}}),x.openapi(S)},Js(m,"catchall")}Js(m,"optional"),Js(m,"nullable"),Js(m,"default"),Js(m,"transform"),Js(m,"refine"),Js(m,"length"),Js(m,"min"),Js(m,"max");const C=m.meta;return m.meta=function(...v){const I=C.apply(this,v);if(v[0]){const y=mr.getMetadataFromInternalRegistry(this);y&&mr.setMetadataInRegistry(I,Object.assign(Object.assign({},y),v[0]))}return I},m})}function Ate(e,t,r){return typeof e=="string"?{refId:e,metadata:t,options:r}:{refId:void 0,metadata:e,options:t}}function mte(e){var t;return Cu((t=mr.getOpenApiMetadata(e))!==null&&t!==void 0?t:{},td)}function pte(e){return mr.getRefId(e)}class bte{constructor(t){this.parents=t,this._definitions=[]}get definitions(){var t,r;return[...(r=(t=this.parents)===null||t===void 0?void 0:t.flatMap(a=>a._definitions))!==null&&r!==void 0?r:[],...this._definitions]}register(t,r){const n=this.schemaWithRefId(t,r);return this._definitions.push({type:"schema",schema:n}),n}registerParameter(t,r){var n,a,i;const o=this.schemaWithRefId(t,r),l=(n=mr.getOpenApiMetadata(o))!==null&&n!==void 0?n:{},s=o.openapi(Object.assign(Object.assign({},l),{param:Object.assign(Object.assign({},l==null?void 0:l.param),{name:(i=(a=l==null?void 0:l.param)===null||a===void 0?void 0:a.name)!==null&&i!==void 0?i:t})}));return this._definitions.push({type:"parameter",schema:s}),s}registerPath(t){this._definitions.push({type:"route",route:t})}registerWebhook(t){this._definitions.push({type:"webhook",webhook:t})}registerComponent(t,r,n){return this._definitions.push({type:"component",componentType:t,name:r,component:n}),{name:r,ref:{$ref:`#/components/${t}/${r}`}}}schemaWithRefId(t,r){return r.openapi(t)}}class z2{constructor(t){this.message=t}}class k1 extends z2{constructor(t,r){super(t),this.data=r}}class T2 extends z2{constructor(t){super(`Missing parameter data, please specify \`${t.missingField}\` and other OpenAPI parameter props using the \`param\` field of \`schema.openapi\``),this.data=t}}function S1(e,t){try{return e()}catch(r){throw r instanceof T2?new T2(Object.assign(Object.assign({},r.data),t)):r}}class Cte extends z2{constructor(t){super("Unknown zod object type, please specify `type` and other OpenAPI props using `schema.openapi`."),this.data=t}}class vte{transform(t,r,n){var a,i,o,l;const s=t.def.element,u=(i=(a=t.def.checks)===null||a===void 0?void 0:a.find(g=>g._zod.def.check==="min_length"))===null||i===void 0?void 0:i._zod.def.minimum,f=(l=(o=t.def.checks)===null||o===void 0?void 0:o.find(g=>g._zod.def.check==="max_length"))===null||l===void 0?void 0:l._zod.def.maximum;return Object.assign(Object.assign({},r("array")),{items:ca(s)?n(s):{},minItems:u,maxItems:f})}}class pk{transform(t){return Object.assign(Object.assign({},t("string")),{pattern:"^\\d+$"})}}class yte{transform(t,r,n,a,i){const o=t.def.options.filter(ca),l=o.map(a);if(r)return{oneOf:n(l,r)};const s=t._zod.def.discriminator;return s?{oneOf:l,discriminator:this.mapDiscriminator(o,s,i)}:(console.error("No discriminator found for discriminated union",t),{oneOf:l})}mapDiscriminator(t,r,n){if(t.some(i=>mr.getRefId(i)===void 0))return;const a={};for(const i of t){const o=mr.getRefId(i),l=this.getDiscriminatorValues(i,r);for(const s of l)a[s]=n(o)}return{propertyName:r,mapping:a}}getDiscriminatorValues(t,r){var n;if(Ht(t,"ZodObject")){const a=(n=t.def.shape)===null||n===void 0?void 0:n[r];return a?Ht(a,"ZodEnum")?Object.values(a._zod.def.entries).filter(t3):Ht(a,"ZodLiteral")?a.def.values.filter(t3):[]:[]}if(Ht(t,"ZodDiscriminatedUnion")){const a=t.def.options.filter(ca);return[...new Set(a.flatMap(i=>this.getDiscriminatorValues(i,r)))]}return[]}}function bk(e){const r=Object.keys(e).filter(i=>typeof e[e[i]]!="number").map(i=>e[i]),n=r.filter(i=>typeof i=="number").length,a=n===0?"string":n===r.length?"numeric":"mixed";return{values:r,type:a}}class Ite{transform(t,r,n){const{type:a,values:i}=bk(t._zod.def.entries);if(a==="mixed")throw new z2("Enum has mixed string and number values, please specify the OpenAPI type manually");return Object.assign(Object.assign({},n(a==="numeric"?"integer":"string")),{enum:r?[...i,null]:i})}}class wte{transform(t,r,n,a){const o={allOf:this.flattenIntersectionTypes(t).map(a)};return r?{anyOf:n([o],r)}:o}flattenIntersectionTypes(t){if(!Ht(t,"ZodIntersection"))return[t];const r=ca(t._zod.def.left)?this.flattenIntersectionTypes(t._zod.def.left):[],n=ca(t._zod.def.right)?this.flattenIntersectionTypes(t._zod.def.right):[];return[...r,...n]}}class xte{constructor(){this.bigIntTransformer=new pk}transform(t,r){const n=typeof t.def.values[0];return n==="boolean"||n==="number"||n==="string"||n==="object"?Object.assign(Object.assign({},r(n)),{enum:[t.def.values[0]]}):n==="bigint"?this.bigIntTransformer.transform(r):r("null")}}class Ete{transform(t,r,n){var a;return Object.assign(Object.assign(Object.assign({},r("number")),r(t.format==="safeint"?"integer":"number")),n((a=t.def.checks)!==null&&a!==void 0?a:[]))}}class Bte{transform(t,r,n,a){var i;const o=(i=mr.getInternalMetadata(t))===null||i===void 0?void 0:i.extendedFrom,l=this.requiredKeysOf(t),s=E1(t.def.shape,a);if(!o)return Object.assign(Object.assign(Object.assign(Object.assign({},n("object")),{properties:s,default:r}),l.length>0?{required:l}:{}),this.generateAdditionalProperties(t,a));const u=o.schema;a(u);const f=this.requiredKeysOf(u),g=E1(u==null?void 0:u.def.shape,a),d=Object.fromEntries(Object.entries(s).filter(([p,C])=>!B1(g[p],C))),h=l.filter(p=>!f.includes(p)),m=Object.assign(Object.assign(Object.assign(Object.assign({},n("object")),{default:r,properties:d}),h.length>0?{required:h}:{}),this.generateAdditionalProperties(t,a));return{allOf:[{$ref:`#/components/schemas/${o.refId}`},m]}}generateAdditionalProperties(t,r){const n=t.def.catchall;return n?Ht(n,"ZodNever")?{additionalProperties:!1}:ca(n)?{additionalProperties:r(n)}:{}:{}}requiredKeysOf(t){return Object.entries(t.def.shape).filter(([r,n])=>!gk(n)).map(([r,n])=>r)}}class kte{transform(t,r,n){const a=t.valueType,i=t.keyType,o=ca(a)?n(a):{};if(Ht(i,"ZodEnum")){const s=Object.values(i._zod.def.entries).filter(t3).reduce((u,f)=>Object.assign(Object.assign({},u),{[f]:o}),{});return Object.assign(Object.assign({},r("object")),{properties:s})}return Object.assign(Object.assign({},r("object")),{additionalProperties:o})}}function Ste(e){return e._zod.def.check==="length_equals"}function _te(e){return e._zod.def.check==="string_format"&&e._zod.def.format==="regex"}class Dte{transform(t,r){var n,a,i,o;const l=(n=t.def.checks)===null||n===void 0?void 0:n.find(_te),s=l==null?void 0:l._zod.def.pattern.toString().replace(/^\/|\/$/g,""),u=(a=t.def.checks)===null||a===void 0?void 0:a.find(Ste),f=u==null?void 0:u._zod.def.length,g=Number.isFinite(t.minLength)&&(i=t.minLength)!==null&&i!==void 0?i:void 0,d=Number.isFinite(t.maxLength)&&(o=t.maxLength)!==null&&o!==void 0?o:void 0;return Object.assign(Object.assign({},r("string")),{minLength:f??g,maxLength:f??d,format:this.mapStringFormat(t),pattern:s})}mapStringFormat(t){if(t.format==="uuid"||t.format==="guid")return"uuid";if(t.format==="email")return"email";if(t.format==="url")return"uri";if(t.format==="date")return"date";if(t.format==="datetime")return"date-time";if(t.format==="time")return"time";if(t.format==="duration")return"duration";if(t.format==="cuid")return"cuid";if(t.format==="cuid2")return"cuid2";if(t.format==="ulid")return"ulid";if(t.format==="ipv4"||t.format==="ipv6")return"ip";if(t.format==="cidrv4")return"ipv4-cidr";if(t.format==="cidrv6")return"ipv6-cidr";if(t.format==="base64url")return"base64url";if(t.format==="emoji")return"emoji"}}class Nte{constructor(t){this.versionSpecifics=t}transform(t,r,n){const i=t._zod.def.items.map(o=>ca(o)?n(o):{});return Object.assign(Object.assign({},r("array")),this.versionSpecifics.mapTupleItems(i))}}class Rte{constructor(t){this.options=t}transform(t,r,n){var a,i,o;const l=mr.getInternalMetadata(t),s=(o=(a=l==null?void 0:l.unionPreferredType)!==null&&a!==void 0?a:(i=this.options)===null||i===void 0?void 0:i.unionPreferredType)!==null&&o!==void 0?o:"anyOf",f=this.flattenUnionTypes(t).map(g=>{const d=this.unwrapNullable(g);return n(d)});return{[s]:r(f)}}flattenUnionTypes(t){return Ht(t,"ZodUnion")?t.def.options.flatMap(n=>ca(n)?this.flattenUnionTypes(n):[]):[t]}unwrapNullable(t){if(Ht(t,"ZodNullable")){const r=t.unwrap();if(ca(r))return this.unwrapNullable(r)}return t}}class Fte{transform(t){return Object.assign(Object.assign({},t("string")),{format:"date-time"})}}class W2{transform(t,r,n,a){const i=r(t._zod.def.getter());return W2.mapRecursive(i,n,a)}static mapRecursive(t,r,n){return"$ref"in t?n(t):t.type?Object.assign(Object.assign({},t),r(t.type)):t}}class Zte{transform(t,r){const a=t.def.parts.map(i=>this.generatePattern(i)).join("");return Object.assign(Object.assign({},r("string")),{pattern:`^${a}$`})}generatePattern(t){if(typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"||t===null||t===void 0)return this.escapeRegex(String(t));if(Ht(t,"ZodLiteral")){const r=t.def.values[0];return this.escapeRegex(String(r))}if(Ht(t,"ZodNumber"))return"[+-]?\\d+(\\.\\d+)?";if(Ht(t,"ZodBoolean"))return"(true|false)";if(Ht(t,"ZodEnum")){const{values:r}=bk(t.def.entries);return`(${r.map(n=>this.escapeRegex(String(n))).join("|")})`}return".*"}escapeRegex(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}}class Gte{constructor(t,r){this.versionSpecifics=t,this.objectTransformer=new Bte,this.stringTransformer=new Dte,this.numberTransformer=new Ete,this.bigIntTransformer=new pk,this.dateTransformer=new Fte,this.lazyTransformer=new W2,this.literalTransformer=new xte,this.templateLiteralTransformer=new Zte,this.enumTransformer=new Ite,this.arrayTransformer=new vte,this.discriminatedUnionTransformer=new yte,this.intersectionTransformer=new wte,this.recordTransformer=new kte,this.tupleTransformer=new Nte(t),this.unionTransformer=new Rte(r)}transform(t,r,n,a,i){if(Ht(t,"ZodNull"))return this.versionSpecifics.nullType;if(Ht(t,"ZodUnknown")||Ht(t,"ZodAny"))return this.versionSpecifics.mapNullableType(void 0,r);if(Ht(t,"ZodObject"))return this.objectTransformer.transform(t,i,l=>this.versionSpecifics.mapNullableType(l,r),n);const o=this.transformSchemaWithoutDefault(t,r,n,a);return Object.assign(Object.assign({},o),{default:i})}transformSchemaWithoutDefault(t,r,n,a){if(Ht(t,"ZodUnknown")||Ht(t,"ZodAny"))return this.versionSpecifics.mapNullableType(void 0,r);if(Ht(t,"ZodString"))return this.stringTransformer.transform(t,o=>this.versionSpecifics.mapNullableType(o,r));if(Ht(t,"ZodNumber"))return this.numberTransformer.transform(t,o=>this.versionSpecifics.mapNullableType(o,r),o=>this.versionSpecifics.getNumberChecks(o));if(Ht(t,"ZodBigInt"))return this.bigIntTransformer.transform(o=>this.versionSpecifics.mapNullableType(o,r));if(Ht(t,"ZodBoolean"))return this.versionSpecifics.mapNullableType("boolean",r);if(Ht(t,"ZodLazy"))return this.lazyTransformer.transform(t,n,o=>this.versionSpecifics.mapNullableType(o,r),o=>this.versionSpecifics.mapNullableOfRef(o,r));if(Ht(t,"ZodLiteral"))return this.literalTransformer.transform(t,o=>this.versionSpecifics.mapNullableType(o,r));if(Ht(t,"ZodTemplateLiteral"))return this.templateLiteralTransformer.transform(t,o=>this.versionSpecifics.mapNullableType(o,r));if(Ht(t,"ZodEnum"))return this.enumTransformer.transform(t,r,o=>this.versionSpecifics.mapNullableType(o,r));if(Ht(t,"ZodArray"))return this.arrayTransformer.transform(t,o=>this.versionSpecifics.mapNullableType(o,r),n);if(Ht(t,"ZodTuple"))return this.tupleTransformer.transform(t,o=>this.versionSpecifics.mapNullableType(o,r),n);if(Ht(t,"ZodDiscriminatedUnion"))return this.discriminatedUnionTransformer.transform(t,r,o=>this.versionSpecifics.mapNullableOfArray(o,r),n,a);if(Ht(t,"ZodUnion"))return this.unionTransformer.transform(t,o=>this.versionSpecifics.mapNullableOfArray(o,r),n);if(Ht(t,"ZodIntersection"))return this.intersectionTransformer.transform(t,r,o=>this.versionSpecifics.mapNullableOfArray(o,r),n);if(Ht(t,"ZodRecord"))return this.recordTransformer.transform(t,o=>this.versionSpecifics.mapNullableType(o,r),n);if(Ht(t,"ZodDate"))return this.dateTransformer.transform(o=>this.versionSpecifics.mapNullableType(o,r));const i=mr.getRefId(t);throw new Cte({currentSchema:t.def,schemaName:i})}}class n3{constructor(t,r,n){this.definitions=t,this.versionSpecifics=r,this.options=n,this.schemaRefs={},this.paramRefs={},this.pathRefs={},this.rawComponents=[],this.openApiTransformer=new Gte(r,n),this.sortDefinitions()}generateDocumentData(){return this.definitions.forEach(t=>this.generateSingle(t)),{components:this.buildComponents(),paths:this.pathRefs}}generateComponents(){return this.definitions.forEach(t=>this.generateSingle(t)),{components:this.buildComponents()}}buildComponents(){var t,r,n,a;const i={};this.rawComponents.forEach(({componentType:d,name:h,component:m})=>{var p;(p=i[d])!==null&&p!==void 0||(i[d]={}),i[d][h]=m});const o=(t=i.schemas)!==null&&t!==void 0?t:{},l=Object.assign(Object.assign({},o),this.filteredSchemaRefs),s=((r=this.options)===null||r===void 0?void 0:r.sortComponents)==="alphabetically"?mk(l):l,u=(n=i.parameters)!==null&&n!==void 0?n:{},f=Object.assign(Object.assign({},u),this.paramRefs),g=((a=this.options)===null||a===void 0?void 0:a.sortComponents)==="alphabetically"?mk(f):f;return Object.assign(Object.assign({},i),{schemas:s,parameters:g})}isNotPendingRefEntry(t){return t[1]!=="pending"}get filteredSchemaRefs(){const t=Object.entries(this.schemaRefs).filter(this.isNotPendingRefEntry);return Object.fromEntries(t)}sortDefinitions(){const t=["schema","parameter","component","route","webhook"];this.definitions.sort((r,n)=>{if(!("type"in r))return"type"in n?-1:0;if(!("type"in n))return 1;const a=t.findIndex(o=>o===r.type),i=t.findIndex(o=>o===n.type);return a-i})}generateSingle(t){if(!("type"in t)){this.generateSchemaWithRef(t);return}switch(t.type){case"parameter":this.generateParameterDefinition(t.schema);return;case"schema":this.generateSchemaWithRef(t.schema);return;case"route":this.generateSingleRoute(t.route);return;case"component":this.rawComponents.push(t);return}}generateParameterDefinition(t){const r=mr.getRefId(t),n=this.generateParameter(t);return r&&(this.paramRefs[r]=n),n}getParameterRef(t,r){const n=mr.getOpenApiMetadata(t),a=mr.getInternalMetadata(t),i=n==null?void 0:n.param,o=a!=null&&a.refId?this.paramRefs[a.refId]:void 0;if(!(!(a!=null&&a.refId)||!o)){if(i&&o.in!==i.in||r!=null&&r.in&&o.in!==r.in)throw new k1(`Conflicting location for parameter ${o.name}`,{key:"in",values:hk([o.in,r==null?void 0:r.in,i==null?void 0:i.in])});if(i&&o.name!==i.name||r!=null&&r.name&&o.name!==(r==null?void 0:r.name))throw new k1("Conflicting names for parameter",{key:"name",values:hk([o.name,r==null?void 0:r.name,i==null?void 0:i.name])});return{$ref:`#/components/parameters/${a.refId}`}}}generateInlineParameters(t,r){const n=mr.getOpenApiMetadata(t),a=n==null?void 0:n.param,i=this.getParameterRef(t,{in:r});if(i)return[i];if(Ht(t,"ZodObject")){const o=t.def.shape;return Object.entries(o).map(([s,u])=>{var f;const g=mr.getOpenApiMetadata(u),d=this.getParameterRef(u,{in:r,name:s});if(d)return d;const h=g==null?void 0:g.param;if(h!=null&&h.name&&h.name!==s)throw new k1("Conflicting names for parameter",{key:"name",values:[s,h.name]});if(h!=null&&h.in&&h.in!==r)throw new k1(`Conflicting location for parameter ${(f=h.name)!==null&&f!==void 0?f:s}`,{key:"in",values:[r,h.in]});return this.generateParameter(u,{name:s,in:r})})}if(a!=null&&a.in&&a.in!==r)throw new k1(`Conflicting location for parameter ${a.name}`,{key:"in",values:[r,a.in]});return[this.generateParameter(t,{in:r})]}generateSimpleParameter(t,r){const n=mr.getParamMetadata(t),a=n==null?void 0:n.param,i=Object.assign(Object.assign({},a),r),o=!gk(t)&&!x1(t),l=this.generateSchemaWithRef(t);return Object.assign({schema:l,required:o},Object.keys(i).length>0?mr.buildParameterMetadata(i):{})}generateParameter(t,r){var n,a;const i=mr.getOpenApiMetadata(t),o=i==null?void 0:i.param,l=(n=r==null?void 0:r.name)!==null&&n!==void 0?n:o==null?void 0:o.name,s=(a=r==null?void 0:r.in)!==null&&a!==void 0?a:o==null?void 0:o.in;if(!l)throw new T2({missingField:"name"});if(!s)throw new T2({missingField:"in",paramName:l});const u=this.generateSimpleParameter(t,r);return Object.assign(Object.assign({},u),{in:s,name:l})}generateSchemaWithMetadata(t){const r=mr.unwrapChained(t),n=mr.getOpenApiMetadata(t),a=mr.getDefaultValue(t),i=mr.getRefId(t);if(i&&typeof this.schemaRefs[i]=="object")return this.schemaRefs[i];if(i&&this.schemaRefs[i]==="pending"){const l={$ref:this.generateSchemaRef(i)};return this.versionSpecifics.mapNullableOfRef(l,x1(t))}i&&!this.schemaRefs[i]&&(this.schemaRefs[i]="pending");const o=n!=null&&n.type?{type:n.type}:this.toOpenAPISchema(r,x1(t),a);return n?mr.applySchemaMetadata(o,n):Cu(o,td)}constructReferencedOpenAPISchema(t){const r=mr.getOpenApiMetadata(t),n=mr.unwrapChained(t),a=mr.getDefaultValue(t),i=x1(t);if(r!=null&&r.type)return this.versionSpecifics.mapNullableType(r.type,i);const o=mr.getRefId(t);if(o&&typeof this.schemaRefs[o]=="object")return W2.mapRecursive(this.schemaRefs[o],l=>this.versionSpecifics.mapNullableType(l,i),l=>this.versionSpecifics.mapNullableOfRef(l,i));if(o&&this.schemaRefs[o]==="pending"){const l={$ref:this.generateSchemaRef(o)};return this.versionSpecifics.mapNullableOfRef(l,i)}return o&&!this.schemaRefs[o]&&(this.schemaRefs[o]="pending"),this.toOpenAPISchema(n,i,a)}generateSimpleSchema(t){const r=mr.getOpenApiMetadata(t),n=mr.getRefId(t);if(!n||!this.schemaRefs[n])return this.generateSchemaWithMetadata(t);const a=this.schemaRefs[n],i={$ref:this.generateSchemaRef(n)};if(this.schemaRefs[n]==="pending")return this.versionSpecifics.mapNullableOfRef(i,x1(t));const o=Cu(mr.buildSchemaMetadata(r??{}),(u,f)=>u===void 0||B1(u,a[f]));if(o.type)return{allOf:[i,o]};const l=Cu(this.constructReferencedOpenAPISchema(t),(u,f)=>u===void 0||B1(u,a[f])),s=mr.applySchemaMetadata(l,o);return Object.keys(s).length>0?{allOf:[i,s]}:i}generateSchemaWithRef(t){const r=mr.getRefId(t);return r&&!this.schemaRefs[r]?(this.schemaRefs[r]=this.generateSimpleSchema(t),{$ref:this.generateSchemaRef(r)}):this.generateSimpleSchema(t)}generateSchemaRef(t){return`#/components/schemas/${t}`}getRequestBody(t){if(!t)return;const{content:r}=t,n=ds(t,["content"]),a=this.getBodyContent(r);return Object.assign(Object.assign({},n),{content:a})}getParameters(t){if(!t)return[];const{headers:r}=t,n=this.cleanParameter(t.query),a=this.cleanParameter(t.params),i=this.cleanParameter(t.cookies),o=S1(()=>n?this.generateInlineParameters(n,"query"):[],{location:"query"}),l=S1(()=>a?this.generateInlineParameters(a,"path"):[],{location:"path"}),s=S1(()=>i?this.generateInlineParameters(i,"cookie"):[],{location:"cookie"}),u=S1(()=>{if(Array.isArray(r))return r.flatMap(g=>this.generateInlineParameters(g,"header"));const f=this.cleanParameter(r);return f?this.generateInlineParameters(f,"header"):[]},{location:"header"});return[...l,...o,...u,...s]}cleanParameter(t){if(t){if(Ht(t,"ZodPipe")){const r=t._zod.def.in,n=t._zod.def.out;return Ht(r,"ZodObject")?this.cleanParameter(r):Ht(n,"ZodObject")?this.cleanParameter(n):void 0}return t}}generatePath(t){const{method:r,path:n,request:a,responses:i}=t,o=ds(t,["method","path","request","responses"]),l=E1(i,g=>this.getResponse(g)),s=S1(()=>this.getParameters(a),{route:`${r} ${n}`}),u=this.getRequestBody(a==null?void 0:a.body);return{[r]:Object.assign(Object.assign(Object.assign(Object.assign({},o),s.length>0?{parameters:[...o.parameters||[],...s]}:{}),u?{requestBody:u}:{}),{responses:l})}}generateSingleRoute(t){const r=this.generatePath(t);return this.pathRefs[t.path]=Object.assign(Object.assign({},this.pathRefs[t.path]),r),r}getResponse(t){if(this.isReferenceObject(t))return t;const{content:r,headers:n}=t,a=ds(t,["content","headers"]),i=r?{content:this.getBodyContent(r)}:{};if(!n)return Object.assign(Object.assign({},a),i);const o=Ht(n,"ZodObject")?this.getResponseHeaders(n):n;return Object.assign(Object.assign(Object.assign({},a),{headers:o}),i)}isReferenceObject(t){return"$ref"in t}getResponseHeaders(t){const r=t.def.shape;return E1(r,a=>this.generateSimpleParameter(a))}getBodyContent(t){return E1(t,r=>{if(!r||"$ref"in r)return r;const{schema:n,itemSchema:a}=r,i=ds(r,["schema","itemSchema"]),o=typeof n=="object"&&ca(n)?this.generateSchemaWithRef(n):n,l=typeof a=="object"&&ca(a)?this.generateSchemaWithRef(a):a;return Object.assign(Object.assign(Object.assign({},i),o!==void 0?{schema:o}:{}),l!==void 0?{itemSchema:l}:{})})}toOpenAPISchema(t,r,n){return this.openApiTransformer.transform(t,r,i=>this.generateSchemaWithRef(i),i=>this.generateSchemaRef(i),n)}}class Lte{get nullType(){return{nullable:!0}}mapNullableOfArray(t,r){return r&&!t.some(n=>B1(n,this.nullType))?[...t,this.nullType]:t}mapNullableType(t,r){return Object.assign(Object.assign({},t?{type:t}:void 0),r?this.nullType:void 0)}mapNullableOfRef(t,r){return r?{allOf:[t,this.nullType]}:t}mapTupleItems(t){const r=Ak(t);return{items:r.length===1?r[0]:{anyOf:r},minItems:t.length,maxItems:t.length}}getNumberChecks(t){return Object.assign({},...t.map(r=>{switch(r._zod.def.check){case"greater_than":{const n=r;return n._zod.def.inclusive?{minimum:Number(n._zod.def.value)}:{minimum:Number(n._zod.def.value),exclusiveMinimum:!0}}case"less_than":{const n=r;return n._zod.def.inclusive?{maximum:Number(n._zod.def.value)}:{maximum:Number(n._zod.def.value),exclusiveMaximum:!n._zod.def.inclusive}}default:return{}}}))}}class Qte{constructor(t,r){const n=new Lte;this.generator=new n3(t,n,r)}generateDocument(t){const r=this.generator.generateDocumentData();return Object.assign(Object.assign({},t),r)}generateComponents(){return this.generator.generateComponents()}}class Ck{get nullType(){return{type:"null"}}mapNullableOfArray(t,r){return r&&!t.some(n=>B1(n,this.nullType))?[...t,this.nullType]:t}mapNullableType(t,r){if(!t)return{};if(r){const n=Array.isArray(t)?t:[t];return{type:Ak([...n,"null"])}}return{type:t}}mapNullableOfRef(t,r){return r?{oneOf:[t,this.nullType]}:t}mapTupleItems(t){return{prefixItems:t}}getNumberChecks(t){return Object.assign({},...t.map(r=>{switch(r._zod.def.check){case"greater_than":{const n=r;return n._zod.def.inclusive?{minimum:Number(n._zod.def.value)}:{exclusiveMinimum:Number(n._zod.def.value)}}case"less_than":{const n=r;return n._zod.def.inclusive?{maximum:Number(n._zod.def.value)}:{exclusiveMaximum:Number(n._zod.def.value)}}default:return{}}}))}}function zte(e){return"type"in e&&e.type==="webhook"}class Tte{constructor(t,r){this.definitions=t,this.webhookRefs={};const n=new Ck;this.generator=new n3(this.definitions,n,r)}generateDocument(t){this.generateWebhooks();const r=this.generator.generateDocumentData();return Object.assign(Object.assign(Object.assign({},t),r),{webhooks:this.webhookRefs})}generateComponents(){return this.generator.generateComponents()}generateWebhooks(){this.webhookRefs={},this.definitions.filter(zte).forEach(t=>this.generateSingleWebhook(t.webhook))}generateSingleWebhook(t){const r=this.generator.generatePath(t);return this.webhookRefs[t.path]=Object.assign(Object.assign({},this.webhookRefs[t.path]),r),r}}function Wte(e){return"type"in e&&e.type==="webhook"}class Mte{constructor(t,r){this.definitions=t,this.webhookRefs={};const n=new Ck;this.generator=new n3(this.definitions,n,r)}generateDocument(t){this.generateWebhooks();const r=this.generator.generateDocumentData();return Object.assign(Object.assign(Object.assign({},t),r),{webhooks:this.webhookRefs})}generateComponents(){return this.generator.generateComponents()}generateWebhooks(){this.webhookRefs={},this.definitions.filter(Wte).forEach(t=>this.generateSingleWebhook(t.webhook))}generateSingleWebhook(t){const r=this.generator.generatePath(t);return this.webhookRefs[t.path]=Object.assign(Object.assign({},this.webhookRefs[t.path]),r),r}}const Ote=Ox(Object.freeze(Object.defineProperty({__proto__:null,OpenAPIRegistry:bte,OpenApiGeneratorV3:Qte,OpenApiGeneratorV31:Tte,OpenApiGeneratorV32:Mte,extendZodWithOpenApi:hte,getOpenApiMetadata:mte,getRefId:pte,zodToOpenAPIRegistry:r3},Symbol.toStringTag,{value:"Module"})));var vk={},a3=Object.defineProperty,Yte=Object.getOwnPropertyDescriptor,Pte=Object.getOwnPropertyNames,Vte=Object.prototype.hasOwnProperty,jte=(e,t)=>{for(var r in t)a3(e,r,{get:t[r],enumerable:!0})},Hte=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Pte(t))!Vte.call(e,a)&&a!==r&&a3(e,a,{get:()=>t[a],enumerable:!(n=Yte(t,a))||n.enumerable});return e},Ute=e=>Hte(a3({},"__esModule",{value:!0}),e),yk={};jte(yk,{checkOptionalParameter:()=>tre,decodeURIComponent_:()=>Sk,getPath:()=>xk,getPathNoStrict:()=>ere,getPattern:()=>Kte,getQueryParam:()=>rre,getQueryParams:()=>nre,getQueryStrings:()=>qte,mergePath:()=>Ek,splitPath:()=>Ik,splitRoutingPath:()=>Xte,tryDecode:()=>i3,tryDecodeURI:()=>wk,tryDecodeURIComponent:()=>Bk});var vu=Ute(yk);const Ik=e=>{const t=e.split("/");return t[0]===""&&t.shift(),t},Xte=e=>{const{groups:t,path:r}=$te(e),n=Ik(r);return Jte(n,t)},$te=e=>{const t=[];return e=e.replace(/\{[^}]+\}/g,(r,n)=>{const a=`@${n}`;return t.push([a,r]),a}),{groups:t,path:e}},Jte=(e,t)=>{for(let r=t.length-1;r>=0;r--){const[n]=t[r];for(let a=e.length-1;a>=0;a--)if(e[a].includes(n)){e[a]=e[a].replace(n,t[r][1]);break}}return e},M2={},Kte=(e,t)=>{if(e==="*")return"*";const r=e.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);if(r){const n=`${e}#${t}`;return M2[n]||(r[2]?M2[n]=t&&t[0]!==":"&&t[0]!=="*"?[n,r[1],new RegExp(`^${r[2]}(?=/${t})`)]:[e,r[1],new RegExp(`^${r[2]}$`)]:M2[n]=[e,r[1],!0]),M2[n]}return null},i3=(e,t)=>{try{return t(e)}catch{return e.replace(/(?:%[0-9A-Fa-f]{2})+/g,r=>{try{return t(r)}catch{return r}})}},wk=e=>i3(e,decodeURI),xk=e=>{const t=e.url,r=t.indexOf("/",t.indexOf(":")+4);let n=r;for(;n<t.length;n++){const a=t.charCodeAt(n);if(a===37){const i=t.indexOf("?",n),o=t.indexOf("#",n),l=i===-1?o===-1?void 0:o:o===-1?i:Math.min(i,o),s=t.slice(r,l);return wk(s.includes("%25")?s.replace(/%25/g,"%2525"):s)}else if(a===63||a===35)break}return t.slice(r,n)},qte=e=>{const t=e.indexOf("?",8);if(t===-1)return"";const r=e.indexOf("#",8);return r===-1?e.slice(t):t<r?e.slice(t,r):""},ere=e=>{const t=xk(e);return t.length>1&&t.at(-1)==="/"?t.slice(0,-1):t},Ek=(e,t,...r)=>(r.length&&(t=Ek(t,...r)),`${(e==null?void 0:e[0])==="/"?"":"/"}${e}${t==="/"?"":`${(e==null?void 0:e.at(-1))==="/"?"":"/"}${(t==null?void 0:t[0])==="/"?t.slice(1):t}`}`),tre=e=>{if(e.charCodeAt(e.length-1)!==63||!e.includes(":"))return null;const t=e.split("/"),r=[];let n="";return t.forEach(a=>{if(a!==""&&!/\:/.test(a))n+="/"+a;else if(/\:/.test(a))if(a.charCodeAt(a.length-1)===63){r.length===0&&n===""?r.push("/"):r.push(n);const i=a.slice(0,-1);n+="/"+i,r.push(n)}else n+="/"+a}),r.filter((a,i,o)=>o.indexOf(a)===i)},Bk=e=>e.indexOf("%")!==-1?i3(e,Sk):e,o3=e=>(e.indexOf("+")!==-1&&(e=e.replace(/\+/g," ")),Bk(e)),kk=(e,t,r)=>{const n=e.indexOf("#",8);n!==-1&&(e=e.slice(0,n));let a;if(!r&&t&&t.indexOf("%")===-1&&t.indexOf("+")===-1){let l=e.indexOf("?",8);if(l===-1)return;for(e.startsWith(t,l+1)||(l=e.indexOf(`&${t}`,l+1));l!==-1;){const s=e.charCodeAt(l+t.length+1);if(s===61){const u=l+t.length+2,f=e.indexOf("&",u);return o3(e.slice(u,f===-1?void 0:f))}else if(s==38||isNaN(s))return"";l=e.indexOf(`&${t}`,l+1)}if(a=/[%+]/.test(e),!a)return}const i=Object.create(null);a??(a=/[%+]/.test(e));let o=e.indexOf("?",8);for(;o!==-1;){const l=e.indexOf("&",o+1);let s=e.indexOf("=",o);s>l&&l!==-1&&(s=-1);let u=e.slice(o+1,s===-1?l===-1?void 0:l:s);if(a&&(u=o3(u)),o=l,u==="")continue;let f;s===-1?f="":(f=e.slice(s+1,l===-1?void 0:l),a&&(f=o3(f))),r?(i[u]&&Array.isArray(i[u])||(i[u]=[]),i[u].push(f)):i[u]??(i[u]=f)}return t?i[t]:i},rre=kk,nre=(e,t)=>kk(e,t,!0),Sk=decodeURIComponent;var s3=Object.defineProperty,are=Object.getOwnPropertyDescriptor,ire=Object.getOwnPropertyNames,ore=Object.prototype.hasOwnProperty,sre=(e,t)=>{for(var r in t)s3(e,r,{get:t[r],enumerable:!0})},lre=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of ire(t))!ore.call(e,a)&&a!==r&&s3(e,a,{get:()=>t[a],enumerable:!(n=are(t,a))||n.enumerable});return e},cre=e=>lre(s3({},"__esModule",{value:!0}),e),_k={};sre(_k,{parse:()=>Rk,parseSigned:()=>pre,serialize:()=>bre,serializeSigned:()=>Cre});var ure=cre(_k),dre=vu;const l3={name:"HMAC",hash:"SHA-256"},Dk=async e=>{const t=typeof e=="string"?new TextEncoder().encode(e):e;return await crypto.subtle.importKey("raw",t,l3,!1,["sign","verify"])},fre=async(e,t)=>{const r=await Dk(t),n=await crypto.subtle.sign(l3.name,r,new TextEncoder().encode(e));return btoa(String.fromCharCode(...new Uint8Array(n)))},gre=async(e,t,r)=>{try{const n=atob(e),a=new Uint8Array(n.length);for(let i=0,o=n.length;i<o;i++)a[i]=n.charCodeAt(i);return await crypto.subtle.verify(l3,r,a,new TextEncoder().encode(t))}catch{return!1}},hre=/^[\w!#$%&'*.^`|~+-]+$/,Are=/^[!#-:<>-[\]-~]+$/,mre=/^[ !#-:<-[\]-~]*$/,Nk=e=>{let t=0,r=e.length;for(;t<r;){const n=e.charCodeAt(t);if(n!==32&&n!==9)break;t++}for(;r>t;){const n=e.charCodeAt(r-1);if(n!==32&&n!==9)break;r--}return t===0&&r===e.length?e:e.slice(t,r)},Rk=(e,t)=>{if(t&&e.indexOf(t)===-1)return{};const r=e.split(";"),n=Object.create(null);for(const a of r){const i=a.indexOf("=");if(i===-1)continue;const o=Nk(a.substring(0,i));if(t&&t!==o||!Are.test(o)||o in n)continue;let l=Nk(a.substring(i+1));if(l.startsWith('"')&&l.endsWith('"')&&(l=l.slice(1,-1)),mre.test(l)&&(n[o]=(0,dre.tryDecodeURIComponent)(l),t))break}return n},pre=async(e,t,r)=>{const n=Object.create(null),a=await Dk(t);for(const[i,o]of Object.entries(Rk(e,r))){const l=o.lastIndexOf(".");if(l<0)continue;const s=o.substring(0,l),u=o.substring(l+1);if(u.length!==44||!u.endsWith("="))continue;const f=await gre(u,s,a);n[i]=f?s:!1}return n},Fk=(e,t,r={})=>{if(!hre.test(e))throw new Error("Invalid cookie name");let n=`${e}=${t}`;if(e.startsWith("__Secure-")&&!r.secure)throw new Error("__Secure- Cookie must have Secure attributes");if(e.startsWith("__Host-")){if(!r.secure)throw new Error("__Host- Cookie must have Secure attributes");if(r.path!=="/")throw new Error('__Host- Cookie must have Path attributes with "/"');if(r.domain)throw new Error("__Host- Cookie must not have Domain attributes")}for(const a of["domain","path","sameSite","priority"])if(r[a]&&/[;\r\n]/.test(r[a]))throw new Error(`${a} must not contain ";", "\\r", or "\\n"`);if(r&&typeof r.maxAge=="number"&&r.maxAge>=0){if(r.maxAge>3456e4)throw new Error("Cookies Max-Age SHOULD NOT be greater than 400 days (34560000 seconds) in duration.");n+=`; Max-Age=${r.maxAge|0}`}if(r.domain&&r.prefix!=="host"&&(n+=`; Domain=${r.domain}`),r.path&&(n+=`; Path=${r.path}`),r.expires){if(r.expires.getTime()-Date.now()>3456e7)throw new Error("Cookies Expires SHOULD NOT be greater than 400 days (34560000 seconds) in the future.");n+=`; Expires=${r.expires.toUTCString()}`}if(r.httpOnly&&(n+="; HttpOnly"),r.secure&&(n+="; Secure"),r.sameSite&&(n+=`; SameSite=${r.sameSite.charAt(0).toUpperCase()+r.sameSite.slice(1)}`),r.priority&&(n+=`; Priority=${r.priority.charAt(0).toUpperCase()+r.priority.slice(1)}`),r.partitioned){if(!r.secure)throw new Error("Partitioned Cookie must have Secure attributes");n+="; Partitioned"}return n},bre=(e,t,r)=>(t=encodeURIComponent(t),Fk(e,t,r)),Cre=async(e,t,r,n={})=>{const a=await fre(t,r);return t=`${t}.${a}`,t=encodeURIComponent(t),Fk(e,t,n)};var c3=Object.defineProperty,vre=Object.getOwnPropertyDescriptor,yre=Object.getOwnPropertyNames,Ire=Object.prototype.hasOwnProperty,wre=(e,t)=>{for(var r in t)c3(e,r,{get:t[r],enumerable:!0})},xre=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of yre(t))!Ire.call(e,a)&&a!==r&&c3(e,a,{get:()=>t[a],enumerable:!(n=vre(t,a))||n.enumerable});return e},Ere=e=>xre(c3({},"__esModule",{value:!0}),e),Zk={};wre(Zk,{deleteCookie:()=>_re,generateCookie:()=>Lk,generateSignedCookie:()=>zk,getCookie:()=>Gk,getSignedCookie:()=>kre,setCookie:()=>Qk,setSignedCookie:()=>Sre});var Bre=Ere(Zk),fs=ure;const Gk=(e,t,r)=>{const n=e.req.raw.headers.get("Cookie");if(typeof t=="string"){if(!n)return;let i=t;return r==="secure"?i="__Secure-"+t:r==="host"&&(i="__Host-"+t),(0,fs.parse)(n,i)[i]}return n?(0,fs.parse)(n):{}},kre=async(e,t,r,n)=>{const a=e.req.raw.headers.get("Cookie");if(typeof r=="string"){if(!a)return;let o=r;return n==="secure"?o="__Secure-"+r:n==="host"&&(o="__Host-"+r),(await(0,fs.parseSigned)(a,t,o))[o]}return a?await(0,fs.parseSigned)(a,t):{}},Lk=(e,t,r)=>{let n;return(r==null?void 0:r.prefix)==="secure"?n=(0,fs.serialize)("__Secure-"+e,t,{path:"/",...r,secure:!0}):(r==null?void 0:r.prefix)==="host"?n=(0,fs.serialize)("__Host-"+e,t,{...r,path:"/",secure:!0,domain:void 0}):n=(0,fs.serialize)(e,t,{path:"/",...r}),n},Qk=(e,t,r,n)=>{const a=Lk(t,r,n);e.header("Set-Cookie",a,{append:!0})},zk=async(e,t,r,n)=>{let a;return(n==null?void 0:n.prefix)==="secure"?a=await(0,fs.serializeSigned)("__Secure-"+e,t,r,{path:"/",...n,secure:!0}):(n==null?void 0:n.prefix)==="host"?a=await(0,fs.serializeSigned)("__Host-"+e,t,r,{...n,path:"/",secure:!0,domain:void 0}):a=await(0,fs.serializeSigned)(e,t,r,{path:"/",...n}),a},Sre=async(e,t,r,n,a)=>{const i=await zk(t,r,n,a);e.header("set-cookie",i,{append:!0})},_re=(e,t,r)=>{const n=Gk(e,t,r==null?void 0:r.prefix);return Qk(e,t,"",{...r,maxAge:0}),n};var u3=Object.defineProperty,Dre=Object.getOwnPropertyDescriptor,Nre=Object.getOwnPropertyNames,Rre=Object.prototype.hasOwnProperty,Fre=(e,t)=>{for(var r in t)u3(e,r,{get:t[r],enumerable:!0})},Zre=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Nre(t))!Rre.call(e,a)&&a!==r&&u3(e,a,{get:()=>t[a],enumerable:!(n=Dre(t,a))||n.enumerable});return e},Gre=e=>Zre(u3({},"__esModule",{value:!0}),e),Tk={};Fre(Tk,{HTTPException:()=>Lre});var Wk=Gre(Tk);class Lre extends Error{constructor(r=500,n){super(n==null?void 0:n.message,{cause:n==null?void 0:n.cause});Be(this,"res");Be(this,"status");this.res=n==null?void 0:n.res,this.status=r}getResponse(){return this.res?new Response(this.res.body,{status:this.status,headers:this.res.headers}):new Response(this.message,{status:this.status})}}var d3=Object.defineProperty,Qre=Object.getOwnPropertyDescriptor,zre=Object.getOwnPropertyNames,Tre=Object.prototype.hasOwnProperty,Wre=(e,t)=>{for(var r in t)d3(e,r,{get:t[r],enumerable:!0})},Mre=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of zre(t))!Tre.call(e,a)&&a!==r&&d3(e,a,{get:()=>t[a],enumerable:!(n=Qre(t,a))||n.enumerable});return e},Ore=e=>Mre(d3({},"__esModule",{value:!0}),e),Mk={};Wre(Mk,{createHash:()=>O2,md5:()=>jre,sha1:()=>Vre,sha256:()=>Pre});var Yre=Ore(Mk);const Pre=async e=>await O2(e,{name:"SHA-256"}),Vre=async e=>await O2(e,{name:"SHA-1"}),jre=async e=>await O2(e,{name:"MD5"}),O2=async(e,t)=>{let r;if(ArrayBuffer.isView(e)||e instanceof ArrayBuffer?r=e:(typeof e=="object"&&(e=JSON.stringify(e)),r=new TextEncoder().encode(String(e))),crypto&&crypto.subtle){const n=await crypto.subtle.digest({name:t.name},r);return Array.prototype.map.call(new Uint8Array(n),i=>("00"+i.toString(16)).slice(-2)).join("")}return null};var f3=Object.defineProperty,Hre=Object.getOwnPropertyDescriptor,Ure=Object.getOwnPropertyNames,Xre=Object.prototype.hasOwnProperty,$re=(e,t)=>{for(var r in t)f3(e,r,{get:t[r],enumerable:!0})},Jre=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Ure(t))!Xre.call(e,a)&&a!==r&&f3(e,a,{get:()=>t[a],enumerable:!(n=Hre(t,a))||n.enumerable});return e},Kre=e=>Jre(f3({},"__esModule",{value:!0}),e),Ok={};$re(Ok,{bufferToFormData:()=>rne,bufferToString:()=>tne,equal:()=>qre,timingSafeEqual:()=>ene});var Yk=Kre(Ok),Pk=Yre;const qre=(e,t)=>{if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;const r=new DataView(e),n=new DataView(t);let a=r.byteLength;for(;a--;)if(r.getUint8(a)!==n.getUint8(a))return!1;return!0},Vk=(e,t)=>{const r=e.length,n=t.length,a=Math.max(r,n);let i=r^n;for(let o=0;o<a;o++){const l=o<r?e.charCodeAt(o):0,s=o<n?t.charCodeAt(o):0;i|=l^s}return i===0},jk=async(e,t,r)=>{r||(r=Pk.sha256);const[n,a]=await Promise.all([r(e),r(t)]);if(n==null||a==null||typeof n!="string"||typeof a!="string")return!1;const i=Vk(n,a),o=Vk(e,t);return i&&o},ene=async(e,t,r)=>{if(typeof e=="string"&&typeof t=="string")return jk(e,t,r);r||(r=Pk.sha256);const[n,a]=await Promise.all([r(e),r(t)]);return!n||!a||typeof n!="string"||typeof a!="string"?!1:jk(n,a)},tne=e=>e instanceof ArrayBuffer?new TextDecoder("utf-8").decode(e):e,rne=(e,t)=>new Response(e,{headers:{"Content-Type":t.replace(/^[^;]+/,n=>n.toLowerCase())}}).formData();var g3=Object.defineProperty,nne=Object.getOwnPropertyDescriptor,ane=Object.getOwnPropertyNames,ine=Object.prototype.hasOwnProperty,one=(e,t)=>{for(var r in t)g3(e,r,{get:t[r],enumerable:!0})},sne=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of ane(t))!ine.call(e,a)&&a!==r&&g3(e,a,{get:()=>t[a],enumerable:!(n=nne(t,a))||n.enumerable});return e},lne=e=>sne(g3({},"__esModule",{value:!0}),e),Hk={};one(Hk,{validator:()=>Ane});var cne=lne(Hk),une=Bre,Uk=Wk,dne=Yk;const fne=/^application\/([a-z-\.]+\+)?json(;\s*[a-zA-Z0-9\-]+\=([^;]+))*$/i,gne=/^multipart\/form-data(;\s?boundary=[a-zA-Z0-9'"()+_,\-./:=?]+)?$/i,hne=/^application\/x-www-form-urlencoded(;\s*[a-zA-Z0-9\-]+\=([^;]+))*$/i,Ane=(e,t)=>async(r,n)=>{let a={};const i=r.req.header("Content-Type");switch(e){case"json":if(!i||!fne.test(i))break;try{a=await r.req.json()}catch{const l="Malformed JSON in request body";throw new Uk.HTTPException(400,{message:l})}break;case"form":{if(!i||!(gne.test(i)||hne.test(i)))break;let l;if(r.req.bodyCache.formData)l=await r.req.bodyCache.formData;else try{const u=await r.req.arrayBuffer();l=await(0,dne.bufferToFormData)(u,i),r.req.bodyCache.formData=l}catch(u){let f="Malformed FormData request.";throw f+=u instanceof Error?` ${u.message}`:` ${String(u)}`,new Uk.HTTPException(400,{message:f})}const s=Object.create(null);l.forEach((u,f)=>{f.endsWith("[]")?(s[f]??(s[f]=[])).push(u):Array.isArray(s[f])?s[f].push(u):Object.hasOwn(s,f)?s[f]=[s[f],u]:s[f]=u}),a=s;break}case"query":a=Object.fromEntries(Object.entries(r.req.queries()).map(([l,s])=>s.length===1?[l,s[0]]:[l,s]));break;case"param":a=r.req.param();break;case"header":a=r.req.header();break;case"cookie":a=(0,une.getCookie)(r);break}const o=await t(a,r);return o instanceof Response?o:(r.req.addValidatedData(e,o),await n())};var h3=Object.defineProperty,mne=Object.getOwnPropertyDescriptor,pne=Object.getOwnPropertyNames,bne=Object.prototype.hasOwnProperty,Cne=(e,t)=>{for(var r in t)h3(e,r,{get:t[r],enumerable:!0})},vne=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of pne(t))!bne.call(e,a)&&a!==r&&h3(e,a,{get:()=>t[a],enumerable:!(n=mne(t,a))||n.enumerable});return e},yne=e=>vne(h3({},"__esModule",{value:!0}),e),Xk={};Cne(Xk,{validator:()=>wne.validator});var Ine=yne(Xk),wne=cne;(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});let t=Ine;function r(a,i,o,l){return(0,t.validator)(a,async(s,u)=>{let f=s;if(a==="header"&&"_def"in i||a==="header"&&"_zod"in i){const d=Object.keys("in"in i?i.in.shape:i.shape),h=Object.fromEntries(d.map(m=>[m.toLowerCase(),m]));f=Object.fromEntries(Object.entries(s).map(([m,p])=>[h[m]||m,p]))}const g=l&&l.validationFunction?await l.validationFunction(i,f):await i.safeParseAsync(f);if(o){const d=await o({data:f,...g,target:a},u);if(d){if(d instanceof Response)return d;if("response"in d)return d.response}}return g.success?g.data:u.json(g,400)})}const n=r;e.zValidator=n})(vk);var A3=Object.defineProperty,xne=Object.getOwnPropertyDescriptor,Ene=Object.getOwnPropertyNames,Bne=Object.prototype.hasOwnProperty,kne=(e,t)=>{for(var r in t)A3(e,r,{get:t[r],enumerable:!0})},Sne=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Ene(t))!Bne.call(e,a)&&a!==r&&A3(e,a,{get:()=>t[a],enumerable:!(n=xne(t,a))||n.enumerable});return e},_ne=e=>Sne(A3({},"__esModule",{value:!0}),e),$k={};kne($k,{compose:()=>Nne});var Dne=_ne($k);const Nne=(e,t,r)=>(n,a)=>{let i=-1;return o(0);async function o(l){if(l<=i)throw new Error("next() called multiple times");i=l;let s,u=!1,f;if(e[l]?(f=e[l][0][0],n.req.routeIndex=l):f=l===e.length&&a||void 0,f)try{s=await f(n,()=>o(l+1))}catch(g){if(g instanceof Error&&t)n.error=g,s=await t(g,n),u=!0;else throw g}else n.finalized===!1&&r&&(s=await r(n));return s&&(n.finalized===!1||u)&&(n.res=s),n}};var m3=Object.defineProperty,Rne=Object.getOwnPropertyDescriptor,Fne=Object.getOwnPropertyNames,Zne=Object.prototype.hasOwnProperty,Gne=(e,t)=>{for(var r in t)m3(e,r,{get:t[r],enumerable:!0})},Lne=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Fne(t))!Zne.call(e,a)&&a!==r&&m3(e,a,{get:()=>t[a],enumerable:!(n=Rne(t,a))||n.enumerable});return e},Qne=e=>Lne(m3({},"__esModule",{value:!0}),e),Jk={};Gne(Jk,{GET_MATCH_RESULT:()=>Tne});var zne=Qne(Jk);const Tne=Symbol();var p3=Object.defineProperty,Wne=Object.getOwnPropertyDescriptor,Mne=Object.getOwnPropertyNames,One=Object.prototype.hasOwnProperty,Yne=(e,t)=>{for(var r in t)p3(e,r,{get:t[r],enumerable:!0})},Pne=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Mne(t))!One.call(e,a)&&a!==r&&p3(e,a,{get:()=>t[a],enumerable:!(n=Wne(t,a))||n.enumerable});return e},Vne=e=>Pne(p3({},"__esModule",{value:!0}),e),Kk={};Yne(Kk,{parseBody:()=>Xne});var jne=Vne(Kk),Hne=Yk;const qk=32,Une=1e4,Y2=e=>"headers"in e,Xne=async(e,t=Object.create(null))=>{const{all:r=!1,dot:n=!1}=t,i=(Y2(e)?e.headers:e.raw.headers).get("Content-Type"),o=i==null?void 0:i.split(";")[0].trim().toLowerCase();return o==="multipart/form-data"||o==="application/x-www-form-urlencoded"?$ne(e,{all:r,dot:n}):{}};async function $ne(e,t){if(!Y2(e)&&e.bodyCache.formData)return e7(await e.bodyCache.formData,t);const r=Y2(e)?e.headers:e.raw.headers,n=await e.arrayBuffer(),a=(0,Hne.bufferToFormData)(n,r.get("Content-Type")||"");Y2(e)||(e.bodyCache.formData=a);const i=await a;return i?e7(i,t):{}}function e7(e,t){const r=Object.create(null),n={count:0};return e.forEach((a,i)=>{t.all||i.endsWith("[]")?Jne(r,i,a):r[i]=a}),t.dot&&Object.entries(r).forEach(([a,i])=>{a.includes(".")&&(Kne(r,a,i,n),delete r[a])}),r}const Jne=(e,t,r)=>{e[t]!==void 0?Array.isArray(e[t])?e[t].push(r):e[t]=[e[t],r]:t.endsWith("[]")?e[t]=[r]:e[t]=r},Kne=(e,t,r,n)=>{if(/(?:^|\.)__proto__\./.test(t))return;let a=e;const i=t.split(".",qk+2);i.length>qk+1&&t7(),i.forEach((o,l)=>{l===i.length-1?a[o]=r:((!a[o]||typeof a[o]!="object"||Array.isArray(a[o])||a[o]instanceof File)&&(n.count++>=Une&&t7(),a[o]=Object.create(null)),a=a[o])})},t7=()=>{throw new Error("Nesting limit exceeded")};var b3=Object.defineProperty,qne=Object.getOwnPropertyDescriptor,eae=Object.getOwnPropertyNames,tae=Object.prototype.hasOwnProperty,rae=(e,t)=>{for(var r in t)b3(e,r,{get:t[r],enumerable:!0})},nae=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of eae(t))!tae.call(e,a)&&a!==r&&b3(e,a,{get:()=>t[a],enumerable:!(n=qne(t,a))||n.enumerable});return e},aae=e=>nae(b3({},"__esModule",{value:!0}),e),r7={};rae(r7,{HonoRequest:()=>cae,cloneRawRequest:()=>uae});var iae=aae(r7),oae=Wk,sae=zne,lae=jne,P2=vu;class cae{constructor(t,r="/",n=[[]]){Xt(this,dl);Be(this,"raw");Xt(this,ph);Xt(this,go);Be(this,"routeIndex",0);Be(this,"path");Be(this,"bodyCache",{});Xt(this,fl,t=>{const{bodyCache:r,raw:n}=this,a=r[t];if(a)return a;for(const i in r)return r[i].then(o=>(i==="json"&&(o=JSON.stringify(o)),new Response(o)[t]()));return r[t]=n[t]()});this.raw=t,this.path=r,zt(this,go,n)}param(t){return t?hr(this,dl,yT).call(this,t):hr(this,dl,IT).call(this)}query(t){return(0,P2.getQueryParam)(this.url,t)}queries(t){return(0,P2.getQueryParams)(this.url,t)}header(t){if(t)return this.raw.headers.get(t)??void 0;const r=Object.create(null);return this.raw.headers.forEach((n,a)=>{r[a]=n}),r}async parseBody(t){return(0,lae.parseBody)(this,t)}json(){return Oe(this,fl).call(this,"text").then(t=>JSON.parse(t))}text(){return Oe(this,fl).call(this,"text")}arrayBuffer(){return Oe(this,fl).call(this,"arrayBuffer")}bytes(){return Oe(this,fl).call(this,"arrayBuffer").then(t=>new Uint8Array(t))}blob(){return Oe(this,fl).call(this,"blob")}formData(){return Oe(this,fl).call(this,"formData")}addValidatedData(t,r){(Oe(this,ph)??zt(this,ph,{}))[t]=r}valid(t){var r;return(r=Oe(this,ph))==null?void 0:r[t]}get url(){return this.raw.url}get method(){return this.raw.method}get[sae.GET_MATCH_RESULT](){return Oe(this,go)}get matchedRoutes(){return Oe(this,go)[0].map(([[,t]])=>t)}get routePath(){return Oe(this,go)[0].map(([[,t]])=>t)[this.routeIndex].path}}ph=new WeakMap,go=new WeakMap,dl=new WeakSet,yT=function(t){var a;const r=(a=Oe(this,go)[0][this.routeIndex])==null?void 0:a[1][t],n=hr(this,dl,wx).call(this,r);return n&&(0,P2.tryDecodeURIComponent)(n)},IT=function(){var n;const t={},r=Object.keys(((n=Oe(this,go)[0][this.routeIndex])==null?void 0:n[1])??{});for(const a of r){const i=hr(this,dl,wx).call(this,Oe(this,go)[0][this.routeIndex][1][a]);i!==void 0&&(t[a]=(0,P2.tryDecodeURIComponent)(i))}return t},wx=function(t){return Oe(this,go)[1]?Oe(this,go)[1][t]:t},fl=new WeakMap;const uae=async e=>{if(!e.raw.bodyUsed)return e.raw.clone();const t=Object.keys(e.bodyCache)[0];if(!t)throw new oae.HTTPException(500,{message:"Cannot clone request: body was already consumed and not cached. Please use HonoRequest methods (e.g., req.json(), req.text()) instead of consuming req.raw directly."});let r=await e[t]();const n=e.header();t==="json"?(r=JSON.stringify(r),delete n["content-length"]):r instanceof FormData&&(delete n["content-type"],delete n["content-length"]);const a={body:r,cache:e.raw.cache,credentials:e.raw.credentials,headers:n,integrity:e.raw.integrity,keepalive:e.raw.keepalive,method:e.method,mode:e.raw.mode,redirect:e.raw.redirect,referrer:e.raw.referrer,referrerPolicy:e.raw.referrerPolicy,signal:e.raw.signal};return new Request(e.url,a)};var C3=Object.defineProperty,dae=Object.getOwnPropertyDescriptor,fae=Object.getOwnPropertyNames,gae=Object.prototype.hasOwnProperty,hae=(e,t)=>{for(var r in t)C3(e,r,{get:t[r],enumerable:!0})},Aae=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of fae(t))!gae.call(e,a)&&a!==r&&C3(e,a,{get:()=>t[a],enumerable:!(n=dae(t,a))||n.enumerable});return e},mae=e=>Aae(C3({},"__esModule",{value:!0}),e),n7={};hae(n7,{HtmlEscapedCallbackPhase:()=>a7,escapeToBuffer:()=>i7,raw:()=>v3,resolveCallback:()=>o7,resolveCallbackSync:()=>vae,stringBufferToString:()=>Cae});var pae=mae(n7);const a7={Stringify:1,BeforeStream:2,Stream:3},v3=(e,t)=>{const r=new String(e);return r.isEscaped=!0,r.callbacks=t,r},bae=/[&<>'"]/,Cae=async(e,t)=>{let r="";t||(t=[]);const n=await Promise.all(e);for(let a=n.length-1;r+=n[a],a--,!(a<0);a--){let i=n[a];typeof i=="object"&&t.push(...i.callbacks||[]);const o=i.isEscaped;if(i=await(typeof i=="object"?i.toString():i),typeof i=="object"&&t.push(...i.callbacks||[]),i.isEscaped??o)r+=i;else{const l=[r];i7(i,l),r=l[0]}}return v3(r,t)},i7=(e,t)=>{const r=e.search(bae);if(r===-1){t[0]+=e;return}let n,a,i=0;for(a=r;a<e.length;a++){switch(e.charCodeAt(a)){case 34:n=""";break;case 39:n="'";break;case 38:n="&";break;case 60:n="<";break;case 62:n=">";break;default:continue}t[0]+=e.substring(i,a)+n,i=a+1}t[0]+=e.substring(i,a)},vae=e=>{const t=e.callbacks;if(!(t!=null&&t.length))return e;const r=[e],n={};return t.forEach(a=>a({phase:a7.Stringify,buffer:r,context:n})),r[0]},o7=async(e,t,r,n,a)=>{typeof e=="object"&&!(e instanceof String)&&(e instanceof Promise||(e=e.toString()),e instanceof Promise&&(e=await e));const i=e.callbacks;if(!(i!=null&&i.length))return Promise.resolve(e);a?a[0]+=e:a=[e];const o=Promise.all(i.map(l=>l({phase:t,buffer:a,context:n}))).then(l=>Promise.all(l.filter(Boolean).map(s=>o7(s,t,!1,n,a))).then(()=>a[0]));return r?v3(await o,i):o};var y3=Object.defineProperty,yae=Object.getOwnPropertyDescriptor,Iae=Object.getOwnPropertyNames,wae=Object.prototype.hasOwnProperty,xae=(e,t)=>{for(var r in t)y3(e,r,{get:t[r],enumerable:!0})},Eae=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Iae(t))!wae.call(e,a)&&a!==r&&y3(e,a,{get:()=>t[a],enumerable:!(n=yae(t,a))||n.enumerable});return e},Bae=e=>Eae(y3({},"__esModule",{value:!0}),e),s7={};xae(s7,{Context:()=>Sae,TEXT_PLAIN:()=>u7});var l7=Bae(s7),kae=iae,c7=pae;const u7="text/plain; charset=UTF-8",I3=(e,t)=>({"Content-Type":e,...t}),_1=(e,t)=>new Response(e,t);class Sae{constructor(t,r){Xt(this,Nc);Xt(this,bh);Xt(this,Ch);Be(this,"env",{});Xt(this,gl);Be(this,"finalized",!1);Be(this,"error");Xt(this,Kd);Xt(this,hl);Xt(this,ci);Xt(this,vh);Xt(this,qd);Xt(this,ef);Xt(this,d0);Xt(this,yh);Xt(this,Ih);Be(this,"render",(...t)=>(Oe(this,qd)??zt(this,qd,r=>this.html(r)),Oe(this,qd).call(this,...t)));Be(this,"setLayout",t=>zt(this,vh,t));Be(this,"getLayout",()=>Oe(this,vh));Be(this,"setRenderer",t=>{zt(this,qd,t)});Be(this,"header",(t,r,n)=>{this.finalized&&zt(this,ci,_1(Oe(this,ci).body,Oe(this,ci)));const a=Oe(this,ci)?Oe(this,ci).headers:Oe(this,d0)??zt(this,d0,new Headers);r===void 0?a.delete(t):n!=null&&n.append?a.append(t,r):a.set(t,r)});Be(this,"status",t=>{zt(this,Kd,t)});Be(this,"set",(t,r)=>{Oe(this,gl)??zt(this,gl,new Map),Oe(this,gl).set(t,r)});Be(this,"get",t=>Oe(this,gl)?Oe(this,gl).get(t):void 0);Be(this,"newResponse",(...t)=>hr(this,Nc,wf).call(this,...t));Be(this,"body",(t,r,n)=>hr(this,Nc,wf).call(this,t,r,n));Be(this,"text",(t,r,n)=>!Oe(this,d0)&&!Oe(this,Kd)&&!r&&!n&&!this.finalized?new Response(t):hr(this,Nc,wf).call(this,t,r,I3(u7,n)));Be(this,"json",(t,r,n)=>hr(this,Nc,wf).call(this,JSON.stringify(t),r,I3("application/json",n)));Be(this,"html",(t,r,n)=>{const a=i=>hr(this,Nc,wf).call(this,i,r,I3("text/html; charset=UTF-8",n));return typeof t=="object"?(0,c7.resolveCallback)(t,c7.HtmlEscapedCallbackPhase.Stringify,!1,{}).then(a):a(t)});Be(this,"redirect",(t,r)=>{const n=String(t);return this.header("Location",/[^\x00-\xFF]/.test(n)?encodeURI(n):n),this.newResponse(null,r??302)});Be(this,"notFound",()=>(Oe(this,ef)??zt(this,ef,()=>_1()),Oe(this,ef).call(this,this)));zt(this,bh,t),r&&(zt(this,hl,r.executionCtx),this.env=r.env,zt(this,ef,r.notFoundHandler),zt(this,Ih,r.path),zt(this,yh,r.matchResult))}get req(){return Oe(this,Ch)??zt(this,Ch,new kae.HonoRequest(Oe(this,bh),Oe(this,Ih),Oe(this,yh))),Oe(this,Ch)}get event(){if(Oe(this,hl)&&"respondWith"in Oe(this,hl))return Oe(this,hl);throw Error("This context has no FetchEvent")}get executionCtx(){if(Oe(this,hl))return Oe(this,hl);throw Error("This context has no ExecutionContext")}get res(){return Oe(this,ci)||zt(this,ci,_1(null,{headers:Oe(this,d0)??zt(this,d0,new Headers)}))}set res(t){if(Oe(this,ci)&&t){t=_1(t.body,t);for(const[r,n]of Oe(this,ci).headers.entries())if(r!=="content-type")if(r==="set-cookie"){const a=Oe(this,ci).headers.getSetCookie();t.headers.delete("set-cookie");for(const i of a)t.headers.append("set-cookie",i)}else t.headers.set(r,n)}zt(this,ci,t),this.finalized=!0}get var(){return Oe(this,gl)?Object.fromEntries(Oe(this,gl)):{}}}bh=new WeakMap,Ch=new WeakMap,gl=new WeakMap,Kd=new WeakMap,hl=new WeakMap,ci=new WeakMap,vh=new WeakMap,qd=new WeakMap,ef=new WeakMap,d0=new WeakMap,yh=new WeakMap,Ih=new WeakMap,Nc=new WeakSet,wf=function(t,r,n){let a=Oe(this,ci)?new Headers(Oe(this,ci).headers):Oe(this,d0);if(typeof r=="object"&&r.headers){a??(a=new Headers);for(const[o,l]of new Headers(r.headers))o==="set-cookie"?a.append(o,l):a.set(o,l)}if(n){if(!a){let o=0;for(const l in n)if(++o>1||typeof n[l]!="string"){a=new Headers;break}}if(a)for(const o in n){const l=n[o];if(typeof l=="string")a.set(o,l);else{a.delete(o);for(const s of l)a.append(o,s)}}}const i=typeof r=="number"?r:(r==null?void 0:r.status)??Oe(this,Kd);return _1(t,{status:i,headers:a??n})};var w3=Object.defineProperty,_ae=Object.getOwnPropertyDescriptor,Dae=Object.getOwnPropertyNames,Nae=Object.prototype.hasOwnProperty,Rae=(e,t)=>{for(var r in t)w3(e,r,{get:t[r],enumerable:!0})},Fae=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Dae(t))!Nae.call(e,a)&&a!==r&&w3(e,a,{get:()=>t[a],enumerable:!(n=_ae(t,a))||n.enumerable});return e},Zae=e=>Fae(w3({},"__esModule",{value:!0}),e),d7={};Rae(d7,{MESSAGE_MATCHER_IS_ALREADY_BUILT:()=>zae,METHODS:()=>Qae,METHOD_NAME_ALL:()=>Gae,METHOD_NAME_ALL_LOWERCASE:()=>Lae,UnsupportedPathError:()=>Tae});var rd=Zae(d7);const Gae="ALL",Lae="all",Qae=["get","post","put","delete","options","patch","query"],zae="Can not add a route since the matcher is already built.";class Tae extends Error{}var x3=Object.defineProperty,Wae=Object.getOwnPropertyDescriptor,Mae=Object.getOwnPropertyNames,Oae=Object.prototype.hasOwnProperty,Yae=(e,t)=>{for(var r in t)x3(e,r,{get:t[r],enumerable:!0})},Pae=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Mae(t))!Oae.call(e,a)&&a!==r&&x3(e,a,{get:()=>t[a],enumerable:!(n=Wae(t,a))||n.enumerable});return e},Vae=e=>Pae(x3({},"__esModule",{value:!0}),e),f7={};Yae(f7,{COMPOSED_HANDLER:()=>Hae});var jae=Vae(f7);const Hae="__COMPOSED_HANDLER";var E3=Object.defineProperty,Uae=Object.getOwnPropertyDescriptor,Xae=Object.getOwnPropertyNames,$ae=Object.prototype.hasOwnProperty,Jae=(e,t)=>{for(var r in t)E3(e,r,{get:t[r],enumerable:!0})},Kae=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Xae(t))!$ae.call(e,a)&&a!==r&&E3(e,a,{get:()=>t[a],enumerable:!(n=Uae(t,a))||n.enumerable});return e},qae=e=>Kae(E3({},"__esModule",{value:!0}),e),g7={};Jae(g7,{HonoBase:()=>aie});var eie=qae(g7),h7=Dne,tie=l7,V2=rd,rie=jae,ql=vu;const nie=e=>e.text("404 Not Found",404),A7=(e,t)=>{if("getResponse"in e){const r=e.getResponse();return t.newResponse(r.body,r)}return console.error(e),t.text("Internal Server Error",500)};let aie=(tf=class{constructor(t={}){Xt(this,na);Be(this,"get");Be(this,"post");Be(this,"put");Be(this,"delete");Be(this,"options");Be(this,"patch");Be(this,"query");Be(this,"all");Be(this,"on");Be(this,"use");Be(this,"router");Be(this,"getPath");Be(this,"_basePath","/");Xt(this,Mo,"/");Be(this,"routes",[]);Xt(this,Oo,nie);Be(this,"errorHandler",A7);Be(this,"onError",t=>(this.errorHandler=t,this));Be(this,"notFound",t=>(zt(this,Oo,t),this));Be(this,"fetch",(t,...r)=>hr(this,na,_b).call(this,t,r[1],r[0],t.method));Be(this,"request",(t,r,n,a)=>t instanceof Request?this.fetch(r?new Request(t,r):t,n,a):(t=t.toString(),this.fetch(new Request(/^https?:\/\//.test(t)?t:`http://localhost${(0,ql.mergePath)("/",t)}`,r),n,a)));Be(this,"fire",()=>{addEventListener("fetch",t=>{t.respondWith(hr(this,na,_b).call(this,t.request,t,void 0,t.request.method))})});[...V2.METHODS,V2.METHOD_NAME_ALL_LOWERCASE].forEach(i=>{this[i]=(o,...l)=>(typeof o=="string"?zt(this,Mo,o):hr(this,na,B0).call(this,i,Oe(this,Mo),o),l.forEach(s=>{hr(this,na,B0).call(this,i,Oe(this,Mo),s)}),this)}),this.on=(i,o,...l)=>{for(const s of[o].flat()){zt(this,Mo,s);for(const u of[i].flat())l.map(f=>{hr(this,na,B0).call(this,u.toUpperCase(),Oe(this,Mo),f)})}return this},this.use=(i,...o)=>(typeof i=="string"?zt(this,Mo,i):(zt(this,Mo,"*"),o.unshift(i)),o.forEach(l=>{hr(this,na,B0).call(this,V2.METHOD_NAME_ALL,Oe(this,Mo),l)}),this);const{strict:n,...a}=t;Object.assign(this,a),this.getPath=n??!0?t.getPath??ql.getPath:ql.getPathNoStrict}route(t,r){const n=this.basePath(t);return r.routes.map(a=>{var o;let i;r.errorHandler===A7?i=a.handler:(i=async(l,s)=>(await(0,h7.compose)([],r.errorHandler)(l,()=>a.handler(l,s))).res,i[rie.COMPOSED_HANDLER]=a.handler),hr(o=n,na,B0).call(o,a.method,a.path,i,a.basePath)}),this}basePath(t){const r=hr(this,na,wT).call(this);return r._basePath=(0,ql.mergePath)(this._basePath,t),r}mount(t,r,n){let a,i;n&&(typeof n=="function"?i=n:(i=n.optionHandler,n.replaceRequest===!1?a=s=>s:a=n.replaceRequest));const o=i?s=>{const u=i(s);return Array.isArray(u)?u:[u]}:s=>{let u;try{u=s.executionCtx}catch{}return[s.env,u]};a||(a=(()=>{const s=(0,ql.mergePath)(this._basePath,t),u=s==="/"?0:s.length;return f=>{const g=new URL(f.url);return g.pathname=this.getPath(f).slice(u)||"/",new Request(g,f)}})());const l=async(s,u)=>{const f=await r(a(s.req.raw),...o(s));if(f)return f;await u()};return hr(this,na,B0).call(this,V2.METHOD_NAME_ALL,(0,ql.mergePath)(t,"*"),l),this}},Mo=new WeakMap,na=new WeakSet,wT=function(){const t=new tf({router:this.router,getPath:this.getPath});return t.errorHandler=this.errorHandler,zt(t,Oo,Oe(this,Oo)),t.routes=this.routes,t},Oo=new WeakMap,B0=function(t,r,n,a){t=t.toUpperCase(),r=(0,ql.mergePath)(this._basePath,r);const i={basePath:a!==void 0?(0,ql.mergePath)(this._basePath,a):this._basePath,path:r,method:t,handler:n};this.router.add(t,r,[n,i]),this.routes.push(i)},Sb=function(t,r){if(t instanceof Error)return this.errorHandler(t,r);throw t},_b=function(t,r,n,a){if(a==="HEAD")return(async()=>new Response(null,await hr(this,na,_b).call(this,t,r,n,"GET")))();const i=this.getPath(t,{env:n}),o=this.router.match(a,i),l=new tie.Context(t,{path:i,matchResult:o,env:n,executionCtx:r,notFoundHandler:Oe(this,Oo)});if(o[0].length===1){let u;try{u=o[0][0][0][0](l,async()=>{l.res=await Oe(this,Oo).call(this,l)})}catch(f){return hr(this,na,Sb).call(this,f,l)}return u instanceof Promise?u.then(f=>f||(l.finalized?l.res:Oe(this,Oo).call(this,l))).catch(f=>hr(this,na,Sb).call(this,f,l)):u??Oe(this,Oo).call(this,l)}const s=(0,h7.compose)(o[0],this.errorHandler,Oe(this,Oo));return(async()=>{try{const u=await s(l);if(!u.finalized)throw new Error("Context is not finalized. Did you forget to return a Response object or `await next()`?");return u.res}catch(u){return hr(this,na,Sb).call(this,u,l)}})()},tf);var B3=Object.defineProperty,iie=Object.getOwnPropertyDescriptor,oie=Object.getOwnPropertyNames,sie=Object.prototype.hasOwnProperty,lie=(e,t)=>{for(var r in t)B3(e,r,{get:t[r],enumerable:!0})},cie=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of oie(t))!sie.call(e,a)&&a!==r&&B3(e,a,{get:()=>t[a],enumerable:!(n=iie(t,a))||n.enumerable});return e},uie=e=>cie(B3({},"__esModule",{value:!0}),e),m7={};lie(m7,{createNullObject:()=>die});var j2=uie(m7);const die=()=>Object.create(null);var k3=Object.defineProperty,fie=Object.getOwnPropertyDescriptor,gie=Object.getOwnPropertyNames,hie=Object.prototype.hasOwnProperty,Aie=(e,t)=>{for(var r in t)k3(e,r,{get:t[r],enumerable:!0})},mie=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of gie(t))!hie.call(e,a)&&a!==r&&k3(e,a,{get:()=>t[a],enumerable:!(n=fie(t,a))||n.enumerable});return e},pie=e=>mie(k3({},"__esModule",{value:!0}),e),p7={};Aie(p7,{emptyParam:()=>C7,match:()=>Cie});var b7=pie(p7),bie=rd;const C7=[];function Cie(e,t){const r=this.buildAllMatchers(),n=(a,i)=>{const o=r[a]||r[bie.METHOD_NAME_ALL],l=o[2][i];if(l)return l;const s=i.match(o[0]);if(!s)return[[],C7];const u=s.indexOf("",1);return[o[1][u],s]};return this.match=n,n(e,t)}var S3=Object.defineProperty,vie=Object.getOwnPropertyDescriptor,yie=Object.getOwnPropertyNames,Iie=Object.prototype.hasOwnProperty,wie=(e,t)=>{for(var r in t)S3(e,r,{get:t[r],enumerable:!0})},xie=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of yie(t))!Iie.call(e,a)&&a!==r&&S3(e,a,{get:()=>t[a],enumerable:!(n=vie(t,a))||n.enumerable});return e},Eie=e=>xie(S3({},"__esModule",{value:!0}),e),v7={};wie(v7,{LABEL_REG_EXP_STR:()=>D1,Node:()=>Sie,ONLY_WILDCARD_REG_EXP_STR:()=>yu,PATH_ERROR:()=>Iu,TAIL_WILDCARD_REG_EXP_STR:()=>ec});var y7=Eie(v7),Bie=j2;const D1="[^/]+",yu=".*",ec="(?:|/.*)",Iu=Symbol(),I7=new Set(".\\+*[^]$()");function kie(e,t){return e.length===1?t.length===1?e<t?-1:1:-1:t.length===1?1:e===yu||e===ec?t===ec?-1:1:t===yu||t===ec?-1:e===D1?1:t===D1?-1:e.length===t.length?e<t?-1:1:t.length-e.length}let Sie=(g0=class{constructor(){Xt(this,Rc);Xt(this,f0);Xt(this,Yo,(0,Bie.createNullObject)())}insert(t,r,n,a,i){let o=this;for(let l=0,s=t.length;l<s;l++){const u=t[l],f=u.length===1?u==="*"?l===s-1?["","",yu]:["","",D1]:null:u==="/*"?["","",ec]:u.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);let g;if(f){const d=f[1];let h=f[2]||D1;if(d&&f[2]&&(h===".*"||(h=h.replace(/^\((?!\?:)(?=[^)]+\)$)/,"(?:"),/\((?!\?:)/.test(h))||h.length===1&&I7.has(h)))throw Iu;if(g=Oe(o,Yo)[h],!g){if(h!==yu&&h!==ec){for(const m in Oe(o,Yo))if((h.length>1||m.length>1)&&m!==yu&&m!==ec)throw Iu}g=Oe(o,Yo)[h]=new g0}d!==""&&(Oe(g,f0)??zt(g,f0,a.varIndex++),n.push([d,Oe(g,f0)]))}else if(g=Oe(o,Yo)[u],!g){for(const d in Oe(o,Yo))if(d.length>1&&d!==yu&&d!==ec)throw Iu;g=Oe(o,Yo)[u]=new g0}o=g}if(Oe(o,Rc)!==void 0)throw Iu;zt(o,Rc,i?-1:r)}buildRegExpStr(){const r=Object.keys(Oe(this,Yo)).sort(kie).map(n=>{const a=Oe(this,Yo)[n],i=a.buildRegExpStr();return i===""?"":(typeof Oe(a,f0)=="number"?`(${n})@${Oe(a,f0)}`:I7.has(n)?`\\${n}`:n)+i}).filter(Boolean);return typeof Oe(this,Rc)=="number"&&Oe(this,Rc)!==-1&&r.unshift(`#${Oe(this,Rc)}`),r.length===0?"":r.length===1?r[0]:"(?:"+r.join("|")+")"}},Rc=new WeakMap,f0=new WeakMap,Yo=new WeakMap,g0);var _3=Object.defineProperty,_ie=Object.getOwnPropertyDescriptor,Die=Object.getOwnPropertyNames,Nie=Object.prototype.hasOwnProperty,Rie=(e,t)=>{for(var r in t)_3(e,r,{get:t[r],enumerable:!0})},Fie=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Die(t))!Nie.call(e,a)&&a!==r&&_3(e,a,{get:()=>t[a],enumerable:!(n=_ie(t,a))||n.enumerable});return e},Zie=e=>Fie(_3({},"__esModule",{value:!0}),e),w7={};Rie(w7,{Trie:()=>zie});var Gie=Zie(w7),Lie=j2,Qie=y7;class zie{constructor(){Xt(this,wh,{varIndex:0});Xt(this,rf,new Qie.Node);Xt(this,xh,0);Be(this,"paths",(0,Lie.createNullObject)())}insert(t,r){if(r){Oe(this,rf).insert(t.split(""),0,[],Oe(this,wh),!0);return}const n=[],a=[];let i=t;for(let l=0;;){let s=!1;if(i=i.replace(/\{[^}]+\}/g,u=>{const f=`@\\${l}`;return a[l]=[f,u],l++,s=!0,f}),!s)break}const o=i.match(/(?::[^\/]+)|(?:\/\*$)|./g)||[];for(let l=a.length-1;l>=0;l--){const[s]=a[l];for(let u=o.length-1;u>=0;u--)if(o[u].indexOf(s)!==-1){o[u]=o[u].replace(s,a[l][1]);break}}Oe(this,rf).insert(o,Oe(this,xh),n,Oe(this,wh),!1),this.paths[t]=[kb(this,xh)._++,n]}buildRegExp(){let t=Oe(this,rf).buildRegExpStr();if(t==="")return[/^$/,[],[]];let r=0;const n=[],a=[];return t=t.replace(/#(\d+)|@(\d+)|\.\*\$/g,(i,o,l)=>o!==void 0?(n[++r]=Number(o),"$()"):(l!==void 0&&(a[Number(l)]=++r),"")),[new RegExp(`^${t}`),n,a]}}wh=new WeakMap,rf=new WeakMap,xh=new WeakMap;var D3=Object.defineProperty,Tie=Object.getOwnPropertyDescriptor,Wie=Object.getOwnPropertyNames,Mie=Object.prototype.hasOwnProperty,Oie=(e,t)=>{for(var r in t)D3(e,r,{get:t[r],enumerable:!0})},Yie=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Wie(t))!Mie.call(e,a)&&a!==r&&D3(e,a,{get:()=>t[a],enumerable:!(n=Tie(t,a))||n.enumerable});return e},Pie=e=>Yie(D3({},"__esModule",{value:!0}),e),x7={};Oie(x7,{RegExpRouter:()=>jie});var E7=Pie(x7),gs=rd,Vie=vu,Ks=j2,B7=b7,H2=y7,k7=Gie;let U2=(0,Ks.createNullObject)();function S7(e){return U2[e]??(U2[e]=new RegExp(`^${e.replace(/\/:[^/{}]+(?:\{\[\^\/]\+})?(?=[/{]|$)|\/?\*$|([.\\+*[^\]$()?{}|])/g,(t,r)=>r?`\\${r}`:t==="/*"?H2.TAIL_WILDCARD_REG_EXP_STR:t==="*"?H2.ONLY_WILDCARD_REG_EXP_STR:`/:${H2.LABEL_REG_EXP_STR}`)}$`))}function X2(e,t){for(const r of Object.keys(e).sort((n,a)=>a.length-n.length))if(S7(r).test(t))return[...e[r]]}class jie{constructor(){Xt(this,Gc);Be(this,"name","RegExpRouter");Xt(this,h0);Xt(this,Fc);Xt(this,Zc);Be(this,"match",B7.match);zt(this,h0,{[gs.METHOD_NAME_ALL]:(0,Ks.createNullObject)()}),zt(this,Fc,{[gs.METHOD_NAME_ALL]:(0,Ks.createNullObject)()}),zt(this,Zc,{[gs.METHOD_NAME_ALL]:new k7.Trie})}add(t,r,n){const a=Oe(this,h0),i=Oe(this,Fc);if(!a)throw new Error(gs.MESSAGE_MATCHER_IS_ALREADY_BUILT);if(!a[t]){Oe(this,Zc)[t]=new k7.Trie;for(const s of[a,i]){s[t]=(0,Ks.createNullObject)();for(const u in s[gs.METHOD_NAME_ALL])s[t][u]=[...s[gs.METHOD_NAME_ALL][u]],hr(this,Gc,Db).call(this,t,u)}}r==="/*"&&(r="*");const o=t===gs.METHOD_NAME_ALL?Object.keys(a):[t];if(/\*$/.test(r)){const s=S7(r);for(const u of o)a[u][r]||(hr(this,Gc,Db).call(this,u,r),a[u][r]=X2(a[u],r)||X2(a[gs.METHOD_NAME_ALL],r)||[]);for(const u of[a,i])for(const f of o)for(const g in u[f])s.test(g)&&u[f][g].push([n,r]);return}const l=(0,Vie.checkOptionalParameter)(r)||[r];for(const s of l)for(const u of o)i[u][s]||(hr(this,Gc,Db).call(this,u,s),i[u][s]=X2(a[u],s)||X2(a[gs.METHOD_NAME_ALL],s)||[]),i[u][s].push([n,s])}buildAllMatchers(){const t=(0,Ks.createNullObject)();for(const r of Object.keys(Oe(this,Fc)))t[r]=hr(this,Gc,xT).call(this,r);return zt(this,h0,zt(this,Fc,zt(this,Zc,void 0))),U2=(0,Ks.createNullObject)(),t}}h0=new WeakMap,Fc=new WeakMap,Zc=new WeakMap,Gc=new WeakSet,Db=function(t,r){try{Oe(this,Zc)[t].insert(r,!/\*|\/:/.test(r))}catch(n){throw n===H2.PATH_ERROR?new gs.UnsupportedPathError(r):n}},xT=function(t){const r=Oe(this,h0)[t],n=Oe(this,Fc)[t],a=Oe(this,Zc)[t],i=(0,Ks.createNullObject)(),o=[],[l,s,u]=a.buildRegExp();for(const f of[r,n])for(const g in f){const d=f[g],h=a.paths[g];if(!h){i[g]=[d.map(([m])=>[m,(0,Ks.createNullObject)()]),B7.emptyParam];continue}o[h[0]]=d.map(([m,p])=>[m,a.paths[p][1].reduceRight((C,[v],I)=>(C[v]=u[h[1][I][1]],C),(0,Ks.createNullObject)())])}return[l,s.map(f=>o[f]),i]};var N3=Object.defineProperty,Hie=Object.getOwnPropertyDescriptor,Uie=Object.getOwnPropertyNames,Xie=Object.prototype.hasOwnProperty,$ie=(e,t)=>{for(var r in t)N3(e,r,{get:t[r],enumerable:!0})},Jie=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Uie(t))!Xie.call(e,a)&&a!==r&&N3(e,a,{get:()=>t[a],enumerable:!(n=Hie(t,a))||n.enumerable});return e},Kie=e=>Jie(N3({},"__esModule",{value:!0}),e),_7={};$ie(_7,{PreparedRegExpRouter:()=>toe,buildInitParams:()=>roe,serializeInitParams:()=>noe});var qie=Kie(_7),N1=rd,D7=b7,eoe=E7;class toe{constructor(t,r){Xt(this,Lc);Be(this,"name","PreparedRegExpRouter");Xt(this,ho);Xt(this,Eh);Be(this,"match",D7.match);zt(this,ho,t),zt(this,Eh,r)}add(t,r,n){if(!Oe(this,ho)[t]){const i=Oe(this,ho)[N1.METHOD_NAME_ALL],o={};for(const l in i[2])o[l]=[i[2][l][0].slice(),D7.emptyParam];Oe(this,ho)[t]=[i[0],i[1].map(l=>Array.isArray(l)?l.slice():0),o]}if(r==="/*"||r==="*"){const i=[n,{}];if(t===N1.METHOD_NAME_ALL)for(const o in Oe(this,ho))hr(this,Lc,xx).call(this,o,i);else hr(this,Lc,xx).call(this,t,i);return}const a=Oe(this,Eh)[r];if(!a)throw new Error(`Path ${r} is not registered`);for(const[i,o]of a)if(t===N1.METHOD_NAME_ALL)for(const l in Oe(this,ho))hr(this,Lc,Ex).call(this,l,r,n,i,o);else hr(this,Lc,Ex).call(this,t,r,n,i,o)}buildAllMatchers(){return Oe(this,ho)}}ho=new WeakMap,Eh=new WeakMap,Lc=new WeakSet,xx=function(t,r){const n=Oe(this,ho)[t];n[1].forEach(a=>a&&a.push(r)),Object.values(n[2]).forEach(a=>a[0].push(r))},Ex=function(t,r,n,a,i){const o=Oe(this,ho)[t];i?a.forEach(l=>{typeof l=="number"?o[1][l].push([n,i]):o[2][l||r][0].push([n,i])}):o[2][r][0].push([n,{}])};const roe=({paths:e})=>{const t=class extends eoe.RegExpRouter{buildAndExportAllMatchers(){return this.buildAllMatchers()}},r=new t;for(const o of e)r.add(N1.METHOD_NAME_ALL,o,o);const n=r.buildAndExportAllMatchers(),a=n[N1.METHOD_NAME_ALL],i={};for(const o of e)if(!(o==="/*"||o==="*")){a[1].forEach((l,s)=>{l.forEach(([u,f])=>{u===o&&(i[o]?i[o][0][1]={...i[o][0][1],...f}:i[o]=[[[],f]],i[o][0][0].findIndex(g=>g===s)===-1&&i[o][0][0].push(s))})});for(const l in a[2])a[2][l][0].forEach(([s])=>{if(s===o){i[o]||(i[o]=[[[]]]);const u=l===o?"":l;i[o][0][0].findIndex(f=>f===u)===-1&&i[o][0][0].push(u)}})}for(let o=0,l=a[1].length;o<l;o++)a[1][o]=a[1][o]?[]:0;for(const o in a[2])a[2][o][0]=[];return[n,i]},noe=([e,t])=>{const r=JSON.stringify(e,(a,i)=>i instanceof RegExp?`##${i.toString()}##`:i).replace(/"##(.+?)##"/g,(a,i)=>i.replace(/\\\\/g,"\\")),n=JSON.stringify(t);return`[${r},${n}]`};var R3=Object.defineProperty,aoe=Object.getOwnPropertyDescriptor,ioe=Object.getOwnPropertyNames,ooe=Object.prototype.hasOwnProperty,soe=(e,t)=>{for(var r in t)R3(e,r,{get:t[r],enumerable:!0})},loe=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of ioe(t))!ooe.call(e,a)&&a!==r&&R3(e,a,{get:()=>t[a],enumerable:!(n=aoe(t,a))||n.enumerable});return e},coe=e=>loe(R3({},"__esModule",{value:!0}),e),N7={};soe(N7,{PreparedRegExpRouter:()=>F3.PreparedRegExpRouter,RegExpRouter:()=>doe.RegExpRouter,buildInitParams:()=>F3.buildInitParams,serializeInitParams:()=>F3.serializeInitParams});var uoe=coe(N7),doe=E7,F3=qie,Z3=Object.defineProperty,foe=Object.getOwnPropertyDescriptor,goe=Object.getOwnPropertyNames,hoe=Object.prototype.hasOwnProperty,Aoe=(e,t)=>{for(var r in t)Z3(e,r,{get:t[r],enumerable:!0})},moe=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of goe(t))!hoe.call(e,a)&&a!==r&&Z3(e,a,{get:()=>t[a],enumerable:!(n=foe(t,a))||n.enumerable});return e},poe=e=>moe(Z3({},"__esModule",{value:!0}),e),R7={};Aoe(R7,{SmartRouter:()=>Coe});var boe=poe(R7),F7=rd;class Coe{constructor(t){Be(this,"name","SmartRouter");Xt(this,Qc,[]);Xt(this,Al,[]);zt(this,Qc,t.routers)}add(t,r,n){if(!Oe(this,Al))throw new Error(F7.MESSAGE_MATCHER_IS_ALREADY_BUILT);Oe(this,Al).push([t,r,n])}match(t,r){if(!Oe(this,Al))throw new Error("Fatal error");const n=Oe(this,Qc),a=Oe(this,Al),i=n.length;let o=0,l;for(;o<i;o++){const s=n[o];try{for(let u=0,f=a.length;u<f;u++)s.add(...a[u]);l=s.match(t,r)}catch(u){if(u instanceof F7.UnsupportedPathError)continue;throw u}this.match=s.match.bind(s),zt(this,Qc,[s]),zt(this,Al,void 0);break}if(o===i)throw new Error("Fatal error");return this.name=`SmartRouter + ${this.activeRouter.name}`,l}get activeRouter(){if(Oe(this,Al)||Oe(this,Qc).length!==1)throw new Error("No active router has been determined yet.");return Oe(this,Qc)[0]}}Qc=new WeakMap,Al=new WeakMap;var G3=Object.defineProperty,voe=Object.getOwnPropertyDescriptor,yoe=Object.getOwnPropertyNames,Ioe=Object.prototype.hasOwnProperty,woe=(e,t)=>{for(var r in t)G3(e,r,{get:t[r],enumerable:!0})},xoe=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of yoe(t))!Ioe.call(e,a)&&a!==r&&G3(e,a,{get:()=>t[a],enumerable:!(n=voe(t,a))||n.enumerable});return e},Eoe=e=>xoe(G3({},"__esModule",{value:!0}),e),Z7={};woe(Z7,{SmartRouter:()=>koe.SmartRouter});var Boe=Eoe(Z7),koe=boe,L3=Object.defineProperty,Soe=Object.getOwnPropertyDescriptor,_oe=Object.getOwnPropertyNames,Doe=Object.prototype.hasOwnProperty,Noe=(e,t)=>{for(var r in t)L3(e,r,{get:t[r],enumerable:!0})},Roe=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of _oe(t))!Doe.call(e,a)&&a!==r&&L3(e,a,{get:()=>t[a],enumerable:!(n=Soe(t,a))||n.enumerable});return e},Foe=e=>Roe(L3({},"__esModule",{value:!0}),e),G7={};Noe(G7,{Node:()=>Qoe});var Zoe=Foe(G7),Goe=rd,Q3=vu,z3=j2;const T3=(0,z3.createNullObject)();let Loe=0,Qoe=(of=class{constructor(){Xt(this,Gs);Xt(this,nf,[]);Xt(this,Ao,(0,z3.createNullObject)());Xt(this,Bh,[]);Xt(this,af);Xt(this,ma,T3)}insert(t,r,n){var s;let a=this;const i=(0,Q3.splitRoutingPath)(r),o=new Set;let l=0;for(const u of i){const f=i[++l],g=(0,Q3.getPattern)(u,f)||(f===void 0&&u&&u.indexOf("*")===u.length-1?u:null),d=Array.isArray(g),h=d?g[0]:g||u,m=(s=Oe(a,Ao))[h]||(s[h]=new of);g&&!Oe(m,af)&&(zt(m,af,g),Oe(a,Bh).push(m)),a=m,d&&o.add(g[1])}Oe(a,nf).push({[t]:{handler:n,possibleKeys:[...o],score:++Loe}})}search(t,r){var f;const n=[];zt(this,ma,T3);let i=[this];const o=(0,Q3.splitPath)(r),l=[],s=o.length;let u=null;for(let g=0;g<s;g++){const d=o[g],h=g===s-1,m=[];for(let C=0,v=i.length;C<v;C++){const I=i[C],y=Oe(I,Ao)[d];y&&(zt(y,ma,Oe(I,ma)),h?(Oe(y,Ao)["*"]&&hr(this,Gs,Hc).call(this,n,Oe(y,Ao)["*"],t,Oe(I,ma)),hr(this,Gs,Hc).call(this,n,y,t,Oe(I,ma))):m.push(y));for(const x of Oe(I,Bh)){const E=Oe(x,af),k=Oe(I,ma)===T3?{}:{...Oe(I,ma)};if(typeof E=="string"){(E==="*"||d.startsWith(E.slice(0,-1)))&&(hr(this,Gs,Hc).call(this,n,x,t,Oe(I,ma)),E==="*"&&(zt(x,ma,k),m.push(x)));continue}const[,S,B]=E;if(!(!d&&B===!0)){if(B!==!0){if(!u){u=[];let Q=r[0]==="/"?1:0;for(let z=0;z<s;z++)u[z]=Q,Q+=o[z].length+1}const N=r.slice(u[g]),D=B.exec(N);if(D){k[S]=D[0],hr(this,Gs,Hc).call(this,n,x,t,Oe(I,ma),k),D[0].length===N.length&&Oe(x,Ao)["*"]&&hr(this,Gs,Hc).call(this,n,Oe(x,Ao)["*"],t,Oe(I,ma),k);for(const Q in Oe(x,Ao)){zt(x,ma,k);const z=((f=D[0].match(/\//g))==null?void 0:f.length)??0;(l[z]||(l[z]=[])).push(x);break}continue}}(B===!0||B.test(d))&&(k[S]=d,h?(hr(this,Gs,Hc).call(this,n,x,t,k,Oe(I,ma)),Oe(x,Ao)["*"]&&hr(this,Gs,Hc).call(this,n,Oe(x,Ao)["*"],t,k,Oe(I,ma))):(zt(x,ma,k),m.push(x)))}}}const p=l.shift();i=p?m.concat(p):m}return n[1]&&n.sort((g,d)=>g.score-d.score),[n.map(({handler:g,params:d})=>[g,d])]}},nf=new WeakMap,Ao=new WeakMap,Bh=new WeakMap,af=new WeakMap,ma=new WeakMap,Gs=new WeakSet,Hc=function(t,r,n,a,i){for(let o=0,l=Oe(r,nf).length;o<l;o++){const s=Oe(r,nf)[o],u=s[n]||s[Goe.METHOD_NAME_ALL];if(u){u.params=(0,z3.createNullObject)(),t.push(u);for(let f=0,g=u.possibleKeys.length;f<g;f++){const d=u.possibleKeys[f];u.params[d]=i!=null&&i[d]&&!f?i[d]:a[d]??(i==null?void 0:i[d])}}}},of);var W3=Object.defineProperty,zoe=Object.getOwnPropertyDescriptor,Toe=Object.getOwnPropertyNames,Woe=Object.prototype.hasOwnProperty,Moe=(e,t)=>{for(var r in t)W3(e,r,{get:t[r],enumerable:!0})},Ooe=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Toe(t))!Woe.call(e,a)&&a!==r&&W3(e,a,{get:()=>t[a],enumerable:!(n=zoe(t,a))||n.enumerable});return e},Yoe=e=>Ooe(W3({},"__esModule",{value:!0}),e),L7={};Moe(L7,{TrieRouter:()=>Hoe});var Poe=Yoe(L7),Voe=vu,joe=Zoe;class Hoe{constructor(){Be(this,"name","TrieRouter");Xt(this,kh,new joe.Node)}add(t,r,n){for(const a of(0,Voe.checkOptionalParameter)(r)||[r])Oe(this,kh).insert(t,a,n)}match(t,r){return Oe(this,kh).search(t,r)}}kh=new WeakMap;var M3=Object.defineProperty,Uoe=Object.getOwnPropertyDescriptor,Xoe=Object.getOwnPropertyNames,$oe=Object.prototype.hasOwnProperty,Joe=(e,t)=>{for(var r in t)M3(e,r,{get:t[r],enumerable:!0})},Koe=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Xoe(t))!$oe.call(e,a)&&a!==r&&M3(e,a,{get:()=>t[a],enumerable:!(n=Uoe(t,a))||n.enumerable});return e},qoe=e=>Koe(M3({},"__esModule",{value:!0}),e),Q7={};Joe(Q7,{TrieRouter:()=>tse.TrieRouter});var ese=qoe(Q7),tse=Poe,O3=Object.defineProperty,rse=Object.getOwnPropertyDescriptor,nse=Object.getOwnPropertyNames,ase=Object.prototype.hasOwnProperty,ise=(e,t)=>{for(var r in t)O3(e,r,{get:t[r],enumerable:!0})},ose=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of nse(t))!ase.call(e,a)&&a!==r&&O3(e,a,{get:()=>t[a],enumerable:!(n=rse(t,a))||n.enumerable});return e},sse=e=>ose(O3({},"__esModule",{value:!0}),e),z7={};ise(z7,{Hono:()=>gse});var lse=sse(z7),cse=eie,use=uoe,dse=Boe,fse=ese;class gse extends cse.HonoBase{constructor(t={}){super(t),this.router=t.router??new dse.SmartRouter({routers:[new use.RegExpRouter,new fse.TrieRouter]})}}var Y3=Object.defineProperty,hse=Object.getOwnPropertyDescriptor,Ase=Object.getOwnPropertyNames,mse=Object.prototype.hasOwnProperty,pse=(e,t)=>{for(var r in t)Y3(e,r,{get:t[r],enumerable:!0})},bse=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Ase(t))!mse.call(e,a)&&a!==r&&Y3(e,a,{get:()=>t[a],enumerable:!(n=hse(t,a))||n.enumerable});return e},Cse=e=>bse(Y3({},"__esModule",{value:!0}),e),T7={};pse(T7,{Context:()=>Ise.Context,Hono:()=>yse.Hono});var vse=Cse(T7),yse=lse,Ise=l7,W7={},P3={},pi={},nd={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.globalConfig=e.$ZodEncodeError=e.$ZodAsyncError=e.$brand=e.NEVER=void 0,e.$constructor=t,e.config=a,e.NEVER=Object.freeze({status:"aborted"});function t(i,o,l){function s(d,h){var m;Object.defineProperty(d,"_zod",{value:d._zod??{},enumerable:!1}),(m=d._zod).traits??(m.traits=new Set),d._zod.traits.add(i),o(d,h);for(const p in g.prototype)p in d||Object.defineProperty(d,p,{value:g.prototype[p].bind(d)});d._zod.constr=g,d._zod.def=h}const u=(l==null?void 0:l.Parent)??Object;class f extends u{}Object.defineProperty(f,"name",{value:i});function g(d){var h;const m=l!=null&&l.Parent?new f:this;s(m,d),(h=m._zod).deferred??(h.deferred=[]);for(const p of m._zod.deferred)p();return m}return Object.defineProperty(g,"init",{value:s}),Object.defineProperty(g,Symbol.hasInstance,{value:d=>{var h,m;return l!=null&&l.Parent&&d instanceof l.Parent?!0:(m=(h=d==null?void 0:d._zod)==null?void 0:h.traits)==null?void 0:m.has(i)}}),Object.defineProperty(g,"name",{value:i}),g}e.$brand=Symbol("zod_brand");class r extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}e.$ZodAsyncError=r;class n extends Error{constructor(o){super(`Encountered unidirectional transform during encode: ${o}`),this.name="ZodEncodeError"}}e.$ZodEncodeError=n,e.globalConfig={};function a(i){return i&&Object.assign(e.globalConfig,i),e.globalConfig}})(nd);var V3={},Ui={},qe={};Object.defineProperty(qe,"__esModule",{value:!0}),qe.Class=qe.BIGINT_FORMAT_RANGES=qe.NUMBER_FORMAT_RANGES=qe.primitiveTypes=qe.propertyKeyTypes=qe.getParsedType=qe.allowsEval=qe.captureStackTrace=void 0,qe.assertEqual=wse,qe.assertNotEqual=xse,qe.assertIs=Ese,qe.assertNever=Bse,qe.assert=kse,qe.getEnumValues=Sse,qe.joinValues=_se,qe.jsonStringifyReplacer=Dse,qe.cached=M7,qe.nullish=Nse,qe.cleanRegex=Rse,qe.floatSafeRemainder=Fse,qe.defineLazy=Zse,qe.objectClone=Gse,qe.assignProp=tc,qe.mergeDefs=rc,qe.cloneDef=Lse,qe.getElementAtPath=Qse,qe.promiseAllObject=zse,qe.randomString=Tse,qe.esc=Wse,qe.isObject=j3,qe.isPlainObject=$2,qe.shallowClone=Mse,qe.numKeys=Ose,qe.escapeRegex=Pse,qe.clone=nc,qe.normalizeParams=Vse,qe.createTransparentProxy=jse,qe.stringifyPrimitive=Y7,qe.optionalKeys=Hse,qe.pick=Use,qe.omit=Xse,qe.extend=$se,qe.safeExtend=Jse,qe.merge=Kse,qe.partial=qse,qe.required=ele,qe.aborted=tle,qe.prefixIssues=rle,qe.unwrapMessage=R1,qe.finalizeIssue=nle,qe.getSizableOrigin=ale,qe.getLengthableOrigin=ile,qe.issue=ole,qe.cleanEnum=sle,qe.base64ToUint8Array=P7,qe.uint8ArrayToBase64=V7,qe.base64urlToUint8Array=lle,qe.uint8ArrayToBase64url=cle,qe.hexToUint8Array=ule,qe.uint8ArrayToHex=dle;function wse(e){return e}function xse(e){return e}function Ese(e){}function Bse(e){throw new Error}function kse(e){}function Sse(e){const t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,a])=>t.indexOf(+n)===-1).map(([n,a])=>a)}function _se(e,t="|"){return e.map(r=>Y7(r)).join(t)}function Dse(e,t){return typeof t=="bigint"?t.toString():t}function M7(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Nse(e){return e==null}function Rse(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Fse(e,t){const r=(e.toString().split(".")[1]||"").length,n=t.toString();let a=(n.split(".")[1]||"").length;if(a===0&&/\d?e-\d?/.test(n)){const s=n.match(/\d?e-(\d?)/);s!=null&&s[1]&&(a=Number.parseInt(s[1]))}const i=r>a?r:a,o=Number.parseInt(e.toFixed(i).replace(".","")),l=Number.parseInt(t.toFixed(i).replace(".",""));return o%l/10**i}const O7=Symbol("evaluating");function Zse(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==O7)return n===void 0&&(n=O7,n=r()),n},set(a){Object.defineProperty(e,t,{value:a})},configurable:!0})}function Gse(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function tc(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function rc(...e){const t={};for(const r of e){const n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function Lse(e){return rc(e._zod.def)}function Qse(e,t){return t?t.reduce((r,n)=>r==null?void 0:r[n],e):e}function zse(e){const t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{const a={};for(let i=0;i<t.length;i++)a[t[i]]=n[i];return a})}function Tse(e=10){const t="abcdefghijklmnopqrstuvwxyz";let r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function Wse(e){return JSON.stringify(e)}qe.captureStackTrace="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function j3(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}qe.allowsEval=M7(()=>{var e;if(typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function $2(e){if(j3(e)===!1)return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(j3(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Mse(e){return $2(e)?{...e}:Array.isArray(e)?[...e]:e}function Ose(e){let t=0;for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}const Yse=e=>{const t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}};qe.getParsedType=Yse,qe.propertyKeyTypes=new Set(["string","number","symbol"]),qe.primitiveTypes=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Pse(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function nc(e,t,r){const n=new e._zod.constr(t??e._zod.def);return(!t||r!=null&&r.parent)&&(n._zod.parent=e),n}function Vse(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function jse(e){let t;return new Proxy({},{get(r,n,a){return t??(t=e()),Reflect.get(t,n,a)},set(r,n,a,i){return t??(t=e()),Reflect.set(t,n,a,i)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,a){return t??(t=e()),Reflect.defineProperty(t,n,a)}})}function Y7(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Hse(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}qe.NUMBER_FORMAT_RANGES={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},qe.BIGINT_FORMAT_RANGES={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Use(e,t){const r=e._zod.def,n=rc(e._zod.def,{get shape(){const a={};for(const i in t){if(!(i in r.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&(a[i]=r.shape[i])}return tc(this,"shape",a),a},checks:[]});return nc(e,n)}function Xse(e,t){const r=e._zod.def,n=rc(e._zod.def,{get shape(){const a={...e._zod.def.shape};for(const i in t){if(!(i in r.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&delete a[i]}return tc(this,"shape",a),a},checks:[]});return nc(e,n)}function $se(e,t){if(!$2(t))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");const a=rc(e._zod.def,{get shape(){const i={...e._zod.def.shape,...t};return tc(this,"shape",i),i},checks:[]});return nc(e,a)}function Jse(e,t){if(!$2(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r={...e._zod.def,get shape(){const n={...e._zod.def.shape,...t};return tc(this,"shape",n),n},checks:e._zod.def.checks};return nc(e,r)}function Kse(e,t){const r=rc(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return tc(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return nc(e,r)}function qse(e,t,r){const n=rc(t._zod.def,{get shape(){const a=t._zod.def.shape,i={...a};if(r)for(const o in r){if(!(o in a))throw new Error(`Unrecognized key: "${o}"`);r[o]&&(i[o]=e?new e({type:"optional",innerType:a[o]}):a[o])}else for(const o in a)i[o]=e?new e({type:"optional",innerType:a[o]}):a[o];return tc(this,"shape",i),i},checks:[]});return nc(t,n)}function ele(e,t,r){const n=rc(t._zod.def,{get shape(){const a=t._zod.def.shape,i={...a};if(r)for(const o in r){if(!(o in i))throw new Error(`Unrecognized key: "${o}"`);r[o]&&(i[o]=new e({type:"nonoptional",innerType:a[o]}))}else for(const o in a)i[o]=new e({type:"nonoptional",innerType:a[o]});return tc(this,"shape",i),i},checks:[]});return nc(t,n)}function tle(e,t=0){var r;if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(((r=e.issues[n])==null?void 0:r.continue)!==!0)return!0;return!1}function rle(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function R1(e){return typeof e=="string"?e:e==null?void 0:e.message}function nle(e,t,r){var a,i,o,l,s,u;const n={...e,path:e.path??[]};if(!e.message){const f=R1((o=(i=(a=e.inst)==null?void 0:a._zod.def)==null?void 0:i.error)==null?void 0:o.call(i,e))??R1((l=t==null?void 0:t.error)==null?void 0:l.call(t,e))??R1((s=r.customError)==null?void 0:s.call(r,e))??R1((u=r.localeError)==null?void 0:u.call(r,e))??"Invalid input";n.message=f}return delete n.inst,delete n.continue,t!=null&&t.reportInput||delete n.input,n}function ale(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function ile(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function ole(...e){const[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function sle(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function P7(e){const t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function V7(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function lle(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return P7(t+r)}function cle(e){return V7(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function ule(e){const t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");const r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n/2]=Number.parseInt(t.slice(n,n+2),16);return r}function dle(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}class fle{constructor(...t){}}qe.Class=fle;var gle=le&&le.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var a=Object.getOwnPropertyDescriptor(t,r);(!a||("get"in a?!t.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,a)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),hle=le&&le.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Ale=le&&le.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&gle(t,e,r);return hle(t,e),t};Object.defineProperty(Ui,"__esModule",{value:!0}),Ui.$ZodRealError=Ui.$ZodError=void 0,Ui.flattenError=ple,Ui.formatError=ble,Ui.treeifyError=Cle,Ui.toDotPath=U7,Ui.prettifyError=vle;const j7=nd,mle=Ale(qe),H7=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,mle.jsonStringifyReplacer,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})};Ui.$ZodError=(0,j7.$constructor)("$ZodError",H7),Ui.$ZodRealError=(0,j7.$constructor)("$ZodError",H7,{Parent:Error});function ple(e,t=r=>r.message){const r={},n=[];for(const a of e.issues)a.path.length>0?(r[a.path[0]]=r[a.path[0]]||[],r[a.path[0]].push(t(a))):n.push(t(a));return{formErrors:n,fieldErrors:r}}function ble(e,t=r=>r.message){const r={_errors:[]},n=a=>{for(const i of a.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(o=>n({issues:o}));else if(i.code==="invalid_key")n({issues:i.issues});else if(i.code==="invalid_element")n({issues:i.issues});else if(i.path.length===0)r._errors.push(t(i));else{let o=r,l=0;for(;l<i.path.length;){const s=i.path[l];l===i.path.length-1?(o[s]=o[s]||{_errors:[]},o[s]._errors.push(t(i))):o[s]=o[s]||{_errors:[]},o=o[s],l++}}};return n(e),r}function Cle(e,t=r=>r.message){const r={errors:[]},n=(a,i=[])=>{var o,l;for(const s of a.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(u=>n({issues:u},s.path));else if(s.code==="invalid_key")n({issues:s.issues},s.path);else if(s.code==="invalid_element")n({issues:s.issues},s.path);else{const u=[...i,...s.path];if(u.length===0){r.errors.push(t(s));continue}let f=r,g=0;for(;g<u.length;){const d=u[g],h=g===u.length-1;typeof d=="string"?(f.properties??(f.properties={}),(o=f.properties)[d]??(o[d]={errors:[]}),f=f.properties[d]):(f.items??(f.items=[]),(l=f.items)[d]??(l[d]={errors:[]}),f=f.items[d]),h&&f.errors.push(t(s)),g++}}};return n(e),r}function U7(e){const t=[],r=e.map(n=>typeof n=="object"?n.key:n);for(const n of r)typeof n=="number"?t.push(`[${n}]`):typeof n=="symbol"?t.push(`[${JSON.stringify(String(n))}]`):/[^\w$]/.test(n)?t.push(`[${JSON.stringify(n)}]`):(t.length&&t.push("."),t.push(n));return t.join("")}function vle(e){var n;const t=[],r=[...e.issues].sort((a,i)=>(a.path??[]).length-(i.path??[]).length);for(const a of r)t.push(`✖ ${a.message}`),(n=a.path)!=null&&n.length&&t.push(` → at ${U7(a.path)}`);return t.join(`
|
|
149
149
|
`)}(function(e){var t=le&&le.__createBinding||(Object.create?function(y,x,E,k){k===void 0&&(k=E);var S=Object.getOwnPropertyDescriptor(x,E);(!S||("get"in S?!x.__esModule:S.writable||S.configurable))&&(S={enumerable:!0,get:function(){return x[E]}}),Object.defineProperty(y,k,S)}:function(y,x,E,k){k===void 0&&(k=E),y[k]=x[E]}),r=le&&le.__setModuleDefault||(Object.create?function(y,x){Object.defineProperty(y,"default",{enumerable:!0,value:x})}:function(y,x){y.default=x}),n=le&&le.__importStar||function(y){if(y&&y.__esModule)return y;var x={};if(y!=null)for(var E in y)E!=="default"&&Object.prototype.hasOwnProperty.call(y,E)&&t(x,y,E);return r(x,y),x};Object.defineProperty(e,"__esModule",{value:!0}),e.safeDecodeAsync=e._safeDecodeAsync=e.safeEncodeAsync=e._safeEncodeAsync=e.safeDecode=e._safeDecode=e.safeEncode=e._safeEncode=e.decodeAsync=e._decodeAsync=e.encodeAsync=e._encodeAsync=e.decode=e._decode=e.encode=e._encode=e.safeParseAsync=e._safeParseAsync=e.safeParse=e._safeParse=e.parseAsync=e._parseAsync=e.parse=e._parse=void 0;const a=n(nd),i=n(Ui),o=n(qe),l=y=>(x,E,k,S)=>{const B=k?Object.assign(k,{async:!1}):{async:!1},N=x._zod.run({value:E,issues:[]},B);if(N instanceof Promise)throw new a.$ZodAsyncError;if(N.issues.length){const D=new((S==null?void 0:S.Err)??y)(N.issues.map(Q=>o.finalizeIssue(Q,B,a.config())));throw o.captureStackTrace(D,S==null?void 0:S.callee),D}return N.value};e._parse=l,e.parse=(0,e._parse)(i.$ZodRealError);const s=y=>async(x,E,k,S)=>{const B=k?Object.assign(k,{async:!0}):{async:!0};let N=x._zod.run({value:E,issues:[]},B);if(N instanceof Promise&&(N=await N),N.issues.length){const D=new((S==null?void 0:S.Err)??y)(N.issues.map(Q=>o.finalizeIssue(Q,B,a.config())));throw o.captureStackTrace(D,S==null?void 0:S.callee),D}return N.value};e._parseAsync=s,e.parseAsync=(0,e._parseAsync)(i.$ZodRealError);const u=y=>(x,E,k)=>{const S=k?{...k,async:!1}:{async:!1},B=x._zod.run({value:E,issues:[]},S);if(B instanceof Promise)throw new a.$ZodAsyncError;return B.issues.length?{success:!1,error:new(y??i.$ZodError)(B.issues.map(N=>o.finalizeIssue(N,S,a.config())))}:{success:!0,data:B.value}};e._safeParse=u,e.safeParse=(0,e._safeParse)(i.$ZodRealError);const f=y=>async(x,E,k)=>{const S=k?Object.assign(k,{async:!0}):{async:!0};let B=x._zod.run({value:E,issues:[]},S);return B instanceof Promise&&(B=await B),B.issues.length?{success:!1,error:new y(B.issues.map(N=>o.finalizeIssue(N,S,a.config())))}:{success:!0,data:B.value}};e._safeParseAsync=f,e.safeParseAsync=(0,e._safeParseAsync)(i.$ZodRealError);const g=y=>(x,E,k)=>{const S=k?Object.assign(k,{direction:"backward"}):{direction:"backward"};return(0,e._parse)(y)(x,E,S)};e._encode=g,e.encode=(0,e._encode)(i.$ZodRealError);const d=y=>(x,E,k)=>(0,e._parse)(y)(x,E,k);e._decode=d,e.decode=(0,e._decode)(i.$ZodRealError);const h=y=>async(x,E,k)=>{const S=k?Object.assign(k,{direction:"backward"}):{direction:"backward"};return(0,e._parseAsync)(y)(x,E,S)};e._encodeAsync=h,e.encodeAsync=(0,e._encodeAsync)(i.$ZodRealError);const m=y=>async(x,E,k)=>(0,e._parseAsync)(y)(x,E,k);e._decodeAsync=m,e.decodeAsync=(0,e._decodeAsync)(i.$ZodRealError);const p=y=>(x,E,k)=>{const S=k?Object.assign(k,{direction:"backward"}):{direction:"backward"};return(0,e._safeParse)(y)(x,E,S)};e._safeEncode=p,e.safeEncode=(0,e._safeEncode)(i.$ZodRealError);const C=y=>(x,E,k)=>(0,e._safeParse)(y)(x,E,k);e._safeDecode=C,e.safeDecode=(0,e._safeDecode)(i.$ZodRealError);const v=y=>async(x,E,k)=>{const S=k?Object.assign(k,{direction:"backward"}):{direction:"backward"};return(0,e._safeParseAsync)(y)(x,E,S)};e._safeEncodeAsync=v,e.safeEncodeAsync=(0,e._safeEncodeAsync)(i.$ZodRealError);const I=y=>async(x,E,k)=>(0,e._safeParseAsync)(y)(x,E,k);e._safeDecodeAsync=I,e.safeDecodeAsync=(0,e._safeDecodeAsync)(i.$ZodRealError)})(V3);var H3={},J2={},K2={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.sha384_base64=e.sha384_hex=e.sha256_base64url=e.sha256_base64=e.sha256_hex=e.sha1_base64url=e.sha1_base64=e.sha1_hex=e.md5_base64url=e.md5_base64=e.md5_hex=e.hex=e.uppercase=e.lowercase=e.undefined=e.null=e.boolean=e.number=e.integer=e.bigint=e.string=e.date=e.e164=e.domain=e.hostname=e.base64url=e.base64=e.cidrv6=e.cidrv4=e.ipv6=e.ipv4=e.browserEmail=e.idnEmail=e.unicodeEmail=e.rfc5322Email=e.html5Email=e.email=e.uuid7=e.uuid6=e.uuid4=e.uuid=e.guid=e.extendedDuration=e.duration=e.nanoid=e.ksuid=e.xid=e.ulid=e.cuid2=e.cuid=void 0,e.sha512_base64url=e.sha512_base64=e.sha512_hex=e.sha384_base64url=void 0,e.emoji=n,e.time=o,e.datetime=l,e.cuid=/^[cC][^\s-]{8,}$/,e.cuid2=/^[0-9a-z]+$/,e.ulid=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,e.xid=/^[0-9a-vA-V]{20}$/,e.ksuid=/^[A-Za-z0-9]{27}$/,e.nanoid=/^[a-zA-Z0-9_-]{21}$/,e.duration=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,e.extendedDuration=/^[-+]?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)?)??$/,e.guid=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/;const t=h=>h?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${h}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;e.uuid=t,e.uuid4=(0,e.uuid)(4),e.uuid6=(0,e.uuid)(6),e.uuid7=(0,e.uuid)(7),e.email=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,e.html5Email=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,e.rfc5322Email=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,e.unicodeEmail=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,e.idnEmail=e.unicodeEmail,e.browserEmail=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;const r="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function n(){return new RegExp(r,"u")}e.ipv4=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,e.ipv6=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,e.cidrv4=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,e.cidrv6=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,e.base64=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,e.base64url=/^[A-Za-z0-9_-]*$/,e.hostname=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,e.domain=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,e.e164=/^\+(?:[0-9]){6,14}[0-9]$/;const a="(?:(?:\\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])))";e.date=new RegExp(`^${a}$`);function i(h){const m="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof h.precision=="number"?h.precision===-1?`${m}`:h.precision===0?`${m}:[0-5]\\d`:`${m}:[0-5]\\d\\.\\d{${h.precision}}`:`${m}(?::[0-5]\\d(?:\\.\\d+)?)?`}function o(h){return new RegExp(`^${i(h)}$`)}function l(h){const m=i({precision:h.precision}),p=["Z"];h.local&&p.push(""),h.offset&&p.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const C=`${m}(?:${p.join("|")})`;return new RegExp(`^${a}T(?:${C})$`)}const s=h=>{const m=h?`[\\s\\S]{${(h==null?void 0:h.minimum)??0},${(h==null?void 0:h.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${m}$`)};e.string=s,e.bigint=/^-?\d+n?$/,e.integer=/^-?\d+$/,e.number=/^-?\d+(?:\.\d+)?/,e.boolean=/^(?:true|false)$/i;const u=/^null$/i;e.null=u;const f=/^undefined$/i;e.undefined=f,e.lowercase=/^[^A-Z]*$/,e.uppercase=/^[^a-z]*$/,e.hex=/^[0-9a-fA-F]*$/;function g(h,m){return new RegExp(`^[A-Za-z0-9+/]{${h}}${m}$`)}function d(h){return new RegExp(`^[A-Za-z0-9_-]{${h}}$`)}e.md5_hex=/^[0-9a-fA-F]{32}$/,e.md5_base64=g(22,"=="),e.md5_base64url=d(22),e.sha1_hex=/^[0-9a-fA-F]{40}$/,e.sha1_base64=g(27,"="),e.sha1_base64url=d(27),e.sha256_hex=/^[0-9a-fA-F]{64}$/,e.sha256_base64=g(43,"="),e.sha256_base64url=d(43),e.sha384_hex=/^[0-9a-fA-F]{96}$/,e.sha384_base64=g(64,""),e.sha384_base64url=d(64),e.sha512_hex=/^[0-9a-fA-F]{128}$/,e.sha512_base64=g(86,"=="),e.sha512_base64url=d(86)})(K2),function(e){var t=le&&le.__createBinding||(Object.create?function(u,f,g,d){d===void 0&&(d=g);var h=Object.getOwnPropertyDescriptor(f,g);(!h||("get"in h?!f.__esModule:h.writable||h.configurable))&&(h={enumerable:!0,get:function(){return f[g]}}),Object.defineProperty(u,d,h)}:function(u,f,g,d){d===void 0&&(d=g),u[d]=f[g]}),r=le&&le.__setModuleDefault||(Object.create?function(u,f){Object.defineProperty(u,"default",{enumerable:!0,value:f})}:function(u,f){u.default=f}),n=le&&le.__importStar||function(u){if(u&&u.__esModule)return u;var f={};if(u!=null)for(var g in u)g!=="default"&&Object.prototype.hasOwnProperty.call(u,g)&&t(f,u,g);return r(f,u),f};Object.defineProperty(e,"__esModule",{value:!0}),e.$ZodCheckOverwrite=e.$ZodCheckMimeType=e.$ZodCheckProperty=e.$ZodCheckEndsWith=e.$ZodCheckStartsWith=e.$ZodCheckIncludes=e.$ZodCheckUpperCase=e.$ZodCheckLowerCase=e.$ZodCheckRegex=e.$ZodCheckStringFormat=e.$ZodCheckLengthEquals=e.$ZodCheckMinLength=e.$ZodCheckMaxLength=e.$ZodCheckSizeEquals=e.$ZodCheckMinSize=e.$ZodCheckMaxSize=e.$ZodCheckBigIntFormat=e.$ZodCheckNumberFormat=e.$ZodCheckMultipleOf=e.$ZodCheckGreaterThan=e.$ZodCheckLessThan=e.$ZodCheck=void 0;const a=n(nd),i=n(K2),o=n(qe);e.$ZodCheck=a.$constructor("$ZodCheck",(u,f)=>{var g;u._zod??(u._zod={}),u._zod.def=f,(g=u._zod).onattach??(g.onattach=[])});const l={number:"number",bigint:"bigint",object:"date"};e.$ZodCheckLessThan=a.$constructor("$ZodCheckLessThan",(u,f)=>{e.$ZodCheck.init(u,f);const g=l[typeof f.value];u._zod.onattach.push(d=>{const h=d._zod.bag,m=(f.inclusive?h.maximum:h.exclusiveMaximum)??Number.POSITIVE_INFINITY;f.value<m&&(f.inclusive?h.maximum=f.value:h.exclusiveMaximum=f.value)}),u._zod.check=d=>{(f.inclusive?d.value<=f.value:d.value<f.value)||d.issues.push({origin:g,code:"too_big",maximum:f.value,input:d.value,inclusive:f.inclusive,inst:u,continue:!f.abort})}}),e.$ZodCheckGreaterThan=a.$constructor("$ZodCheckGreaterThan",(u,f)=>{e.$ZodCheck.init(u,f);const g=l[typeof f.value];u._zod.onattach.push(d=>{const h=d._zod.bag,m=(f.inclusive?h.minimum:h.exclusiveMinimum)??Number.NEGATIVE_INFINITY;f.value>m&&(f.inclusive?h.minimum=f.value:h.exclusiveMinimum=f.value)}),u._zod.check=d=>{(f.inclusive?d.value>=f.value:d.value>f.value)||d.issues.push({origin:g,code:"too_small",minimum:f.value,input:d.value,inclusive:f.inclusive,inst:u,continue:!f.abort})}}),e.$ZodCheckMultipleOf=a.$constructor("$ZodCheckMultipleOf",(u,f)=>{e.$ZodCheck.init(u,f),u._zod.onattach.push(g=>{var d;(d=g._zod.bag).multipleOf??(d.multipleOf=f.value)}),u._zod.check=g=>{if(typeof g.value!=typeof f.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof g.value=="bigint"?g.value%f.value===BigInt(0):o.floatSafeRemainder(g.value,f.value)===0)||g.issues.push({origin:typeof g.value,code:"not_multiple_of",divisor:f.value,input:g.value,inst:u,continue:!f.abort})}}),e.$ZodCheckNumberFormat=a.$constructor("$ZodCheckNumberFormat",(u,f)=>{var p;e.$ZodCheck.init(u,f),f.format=f.format||"float64";const g=(p=f.format)==null?void 0:p.includes("int"),d=g?"int":"number",[h,m]=o.NUMBER_FORMAT_RANGES[f.format];u._zod.onattach.push(C=>{const v=C._zod.bag;v.format=f.format,v.minimum=h,v.maximum=m,g&&(v.pattern=i.integer)}),u._zod.check=C=>{const v=C.value;if(g){if(!Number.isInteger(v)){C.issues.push({expected:d,format:f.format,code:"invalid_type",continue:!1,input:v,inst:u});return}if(!Number.isSafeInteger(v)){v>0?C.issues.push({input:v,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:u,origin:d,continue:!f.abort}):C.issues.push({input:v,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:u,origin:d,continue:!f.abort});return}}v<h&&C.issues.push({origin:"number",input:v,code:"too_small",minimum:h,inclusive:!0,inst:u,continue:!f.abort}),v>m&&C.issues.push({origin:"number",input:v,code:"too_big",maximum:m,inst:u})}}),e.$ZodCheckBigIntFormat=a.$constructor("$ZodCheckBigIntFormat",(u,f)=>{e.$ZodCheck.init(u,f);const[g,d]=o.BIGINT_FORMAT_RANGES[f.format];u._zod.onattach.push(h=>{const m=h._zod.bag;m.format=f.format,m.minimum=g,m.maximum=d}),u._zod.check=h=>{const m=h.value;m<g&&h.issues.push({origin:"bigint",input:m,code:"too_small",minimum:g,inclusive:!0,inst:u,continue:!f.abort}),m>d&&h.issues.push({origin:"bigint",input:m,code:"too_big",maximum:d,inst:u})}}),e.$ZodCheckMaxSize=a.$constructor("$ZodCheckMaxSize",(u,f)=>{var g;e.$ZodCheck.init(u,f),(g=u._zod.def).when??(g.when=d=>{const h=d.value;return!o.nullish(h)&&h.size!==void 0}),u._zod.onattach.push(d=>{const h=d._zod.bag.maximum??Number.POSITIVE_INFINITY;f.maximum<h&&(d._zod.bag.maximum=f.maximum)}),u._zod.check=d=>{const h=d.value;h.size<=f.maximum||d.issues.push({origin:o.getSizableOrigin(h),code:"too_big",maximum:f.maximum,inclusive:!0,input:h,inst:u,continue:!f.abort})}}),e.$ZodCheckMinSize=a.$constructor("$ZodCheckMinSize",(u,f)=>{var g;e.$ZodCheck.init(u,f),(g=u._zod.def).when??(g.when=d=>{const h=d.value;return!o.nullish(h)&&h.size!==void 0}),u._zod.onattach.push(d=>{const h=d._zod.bag.minimum??Number.NEGATIVE_INFINITY;f.minimum>h&&(d._zod.bag.minimum=f.minimum)}),u._zod.check=d=>{const h=d.value;h.size>=f.minimum||d.issues.push({origin:o.getSizableOrigin(h),code:"too_small",minimum:f.minimum,inclusive:!0,input:h,inst:u,continue:!f.abort})}}),e.$ZodCheckSizeEquals=a.$constructor("$ZodCheckSizeEquals",(u,f)=>{var g;e.$ZodCheck.init(u,f),(g=u._zod.def).when??(g.when=d=>{const h=d.value;return!o.nullish(h)&&h.size!==void 0}),u._zod.onattach.push(d=>{const h=d._zod.bag;h.minimum=f.size,h.maximum=f.size,h.size=f.size}),u._zod.check=d=>{const h=d.value,m=h.size;if(m===f.size)return;const p=m>f.size;d.issues.push({origin:o.getSizableOrigin(h),...p?{code:"too_big",maximum:f.size}:{code:"too_small",minimum:f.size},inclusive:!0,exact:!0,input:d.value,inst:u,continue:!f.abort})}}),e.$ZodCheckMaxLength=a.$constructor("$ZodCheckMaxLength",(u,f)=>{var g;e.$ZodCheck.init(u,f),(g=u._zod.def).when??(g.when=d=>{const h=d.value;return!o.nullish(h)&&h.length!==void 0}),u._zod.onattach.push(d=>{const h=d._zod.bag.maximum??Number.POSITIVE_INFINITY;f.maximum<h&&(d._zod.bag.maximum=f.maximum)}),u._zod.check=d=>{const h=d.value;if(h.length<=f.maximum)return;const p=o.getLengthableOrigin(h);d.issues.push({origin:p,code:"too_big",maximum:f.maximum,inclusive:!0,input:h,inst:u,continue:!f.abort})}}),e.$ZodCheckMinLength=a.$constructor("$ZodCheckMinLength",(u,f)=>{var g;e.$ZodCheck.init(u,f),(g=u._zod.def).when??(g.when=d=>{const h=d.value;return!o.nullish(h)&&h.length!==void 0}),u._zod.onattach.push(d=>{const h=d._zod.bag.minimum??Number.NEGATIVE_INFINITY;f.minimum>h&&(d._zod.bag.minimum=f.minimum)}),u._zod.check=d=>{const h=d.value;if(h.length>=f.minimum)return;const p=o.getLengthableOrigin(h);d.issues.push({origin:p,code:"too_small",minimum:f.minimum,inclusive:!0,input:h,inst:u,continue:!f.abort})}}),e.$ZodCheckLengthEquals=a.$constructor("$ZodCheckLengthEquals",(u,f)=>{var g;e.$ZodCheck.init(u,f),(g=u._zod.def).when??(g.when=d=>{const h=d.value;return!o.nullish(h)&&h.length!==void 0}),u._zod.onattach.push(d=>{const h=d._zod.bag;h.minimum=f.length,h.maximum=f.length,h.length=f.length}),u._zod.check=d=>{const h=d.value,m=h.length;if(m===f.length)return;const p=o.getLengthableOrigin(h),C=m>f.length;d.issues.push({origin:p,...C?{code:"too_big",maximum:f.length}:{code:"too_small",minimum:f.length},inclusive:!0,exact:!0,input:d.value,inst:u,continue:!f.abort})}}),e.$ZodCheckStringFormat=a.$constructor("$ZodCheckStringFormat",(u,f)=>{var g,d;e.$ZodCheck.init(u,f),u._zod.onattach.push(h=>{const m=h._zod.bag;m.format=f.format,f.pattern&&(m.patterns??(m.patterns=new Set),m.patterns.add(f.pattern))}),f.pattern?(g=u._zod).check??(g.check=h=>{f.pattern.lastIndex=0,!f.pattern.test(h.value)&&h.issues.push({origin:"string",code:"invalid_format",format:f.format,input:h.value,...f.pattern?{pattern:f.pattern.toString()}:{},inst:u,continue:!f.abort})}):(d=u._zod).check??(d.check=()=>{})}),e.$ZodCheckRegex=a.$constructor("$ZodCheckRegex",(u,f)=>{e.$ZodCheckStringFormat.init(u,f),u._zod.check=g=>{f.pattern.lastIndex=0,!f.pattern.test(g.value)&&g.issues.push({origin:"string",code:"invalid_format",format:"regex",input:g.value,pattern:f.pattern.toString(),inst:u,continue:!f.abort})}}),e.$ZodCheckLowerCase=a.$constructor("$ZodCheckLowerCase",(u,f)=>{f.pattern??(f.pattern=i.lowercase),e.$ZodCheckStringFormat.init(u,f)}),e.$ZodCheckUpperCase=a.$constructor("$ZodCheckUpperCase",(u,f)=>{f.pattern??(f.pattern=i.uppercase),e.$ZodCheckStringFormat.init(u,f)}),e.$ZodCheckIncludes=a.$constructor("$ZodCheckIncludes",(u,f)=>{e.$ZodCheck.init(u,f);const g=o.escapeRegex(f.includes),d=new RegExp(typeof f.position=="number"?`^.{${f.position}}${g}`:g);f.pattern=d,u._zod.onattach.push(h=>{const m=h._zod.bag;m.patterns??(m.patterns=new Set),m.patterns.add(d)}),u._zod.check=h=>{h.value.includes(f.includes,f.position)||h.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:f.includes,input:h.value,inst:u,continue:!f.abort})}}),e.$ZodCheckStartsWith=a.$constructor("$ZodCheckStartsWith",(u,f)=>{e.$ZodCheck.init(u,f);const g=new RegExp(`^${o.escapeRegex(f.prefix)}.*`);f.pattern??(f.pattern=g),u._zod.onattach.push(d=>{const h=d._zod.bag;h.patterns??(h.patterns=new Set),h.patterns.add(g)}),u._zod.check=d=>{d.value.startsWith(f.prefix)||d.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:f.prefix,input:d.value,inst:u,continue:!f.abort})}}),e.$ZodCheckEndsWith=a.$constructor("$ZodCheckEndsWith",(u,f)=>{e.$ZodCheck.init(u,f);const g=new RegExp(`.*${o.escapeRegex(f.suffix)}$`);f.pattern??(f.pattern=g),u._zod.onattach.push(d=>{const h=d._zod.bag;h.patterns??(h.patterns=new Set),h.patterns.add(g)}),u._zod.check=d=>{d.value.endsWith(f.suffix)||d.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:f.suffix,input:d.value,inst:u,continue:!f.abort})}});function s(u,f,g){u.issues.length&&f.issues.push(...o.prefixIssues(g,u.issues))}e.$ZodCheckProperty=a.$constructor("$ZodCheckProperty",(u,f)=>{e.$ZodCheck.init(u,f),u._zod.check=g=>{const d=f.schema._zod.run({value:g.value[f.property],issues:[]},{});if(d instanceof Promise)return d.then(h=>s(h,g,f.property));s(d,g,f.property)}}),e.$ZodCheckMimeType=a.$constructor("$ZodCheckMimeType",(u,f)=>{e.$ZodCheck.init(u,f);const g=new Set(f.mime);u._zod.onattach.push(d=>{d._zod.bag.mime=f.mime}),u._zod.check=d=>{g.has(d.value.type)||d.issues.push({code:"invalid_value",values:f.mime,input:d.value.type,inst:u,continue:!f.abort})}}),e.$ZodCheckOverwrite=a.$constructor("$ZodCheckOverwrite",(u,f)=>{e.$ZodCheck.init(u,f),u._zod.check=g=>{g.value=f.tx(g.value)}})}(J2);var F1={};Object.defineProperty(F1,"__esModule",{value:!0}),F1.Doc=void 0;class yle{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const n=t.split(`
|
|
150
150
|
`).filter(o=>o),a=Math.min(...n.map(o=>o.length-o.trimStart().length)),i=n.map(o=>o.slice(a)).map(o=>" ".repeat(this.indent*2)+o);for(const o of i)this.content.push(o)}compile(){const t=Function,r=this==null?void 0:this.args,a=[...((this==null?void 0:this.content)??[""]).map(i=>` ${i}`)];return new t(...r,a.join(`
|
|
151
151
|
`))}}F1.Doc=yle;var Z1={};Object.defineProperty(Z1,"__esModule",{value:!0}),Z1.version=void 0,Z1.version={major:4,minor:1,patch:12},function(e){var t=le&&le.__createBinding||(Object.create?function(R,Z,G,M){M===void 0&&(M=G);var J=Object.getOwnPropertyDescriptor(Z,G);(!J||("get"in J?!Z.__esModule:J.writable||J.configurable))&&(J={enumerable:!0,get:function(){return Z[G]}}),Object.defineProperty(R,M,J)}:function(R,Z,G,M){M===void 0&&(M=G),R[M]=Z[G]}),r=le&&le.__setModuleDefault||(Object.create?function(R,Z){Object.defineProperty(R,"default",{enumerable:!0,value:Z})}:function(R,Z){R.default=Z}),n=le&&le.__importStar||function(R){if(R&&R.__esModule)return R;var Z={};if(R!=null)for(var G in R)G!=="default"&&Object.prototype.hasOwnProperty.call(R,G)&&t(Z,R,G);return r(Z,R),Z};Object.defineProperty(e,"__esModule",{value:!0}),e.$ZodMap=e.$ZodRecord=e.$ZodTuple=e.$ZodIntersection=e.$ZodDiscriminatedUnion=e.$ZodUnion=e.$ZodObjectJIT=e.$ZodObject=e.$ZodArray=e.$ZodDate=e.$ZodVoid=e.$ZodNever=e.$ZodUnknown=e.$ZodAny=e.$ZodNull=e.$ZodUndefined=e.$ZodSymbol=e.$ZodBigIntFormat=e.$ZodBigInt=e.$ZodBoolean=e.$ZodNumberFormat=e.$ZodNumber=e.$ZodCustomStringFormat=e.$ZodJWT=e.$ZodE164=e.$ZodBase64URL=e.$ZodBase64=e.$ZodCIDRv6=e.$ZodCIDRv4=e.$ZodIPv6=e.$ZodIPv4=e.$ZodISODuration=e.$ZodISOTime=e.$ZodISODate=e.$ZodISODateTime=e.$ZodKSUID=e.$ZodXID=e.$ZodULID=e.$ZodCUID2=e.$ZodCUID=e.$ZodNanoID=e.$ZodEmoji=e.$ZodURL=e.$ZodEmail=e.$ZodUUID=e.$ZodGUID=e.$ZodStringFormat=e.$ZodString=e.clone=e.$ZodType=void 0,e.$ZodCustom=e.$ZodLazy=e.$ZodPromise=e.$ZodFunction=e.$ZodTemplateLiteral=e.$ZodReadonly=e.$ZodCodec=e.$ZodPipe=e.$ZodNaN=e.$ZodCatch=e.$ZodSuccess=e.$ZodNonOptional=e.$ZodPrefault=e.$ZodDefault=e.$ZodNullable=e.$ZodOptional=e.$ZodTransform=e.$ZodFile=e.$ZodLiteral=e.$ZodEnum=e.$ZodSet=void 0,e.isValidBase64=d,e.isValidBase64URL=h,e.isValidJWT=m;const a=n(J2),i=n(nd),o=F1,l=V3,s=n(K2),u=n(qe),f=Z1;e.$ZodType=i.$constructor("$ZodType",(R,Z)=>{var J;var G;R??(R={}),R._zod.def=Z,R._zod.bag=R._zod.bag||{},R._zod.version=f.version;const M=[...R._zod.def.checks??[]];R._zod.traits.has("$ZodCheck")&&M.unshift(R);for(const X of M)for(const re of X._zod.onattach)re(R);if(M.length===0)(G=R._zod).deferred??(G.deferred=[]),(J=R._zod.deferred)==null||J.push(()=>{R._zod.run=R._zod.parse});else{const X=(ee,ne,ue)=>{let be=u.aborted(ee),ae;for(const L of ne){if(L._zod.def.when){if(!L._zod.def.when(ee))continue}else if(be)continue;const T=ee.issues.length,V=L._zod.check(ee);if(V instanceof Promise&&(ue==null?void 0:ue.async)===!1)throw new i.$ZodAsyncError;if(ae||V instanceof Promise)ae=(ae??Promise.resolve()).then(async()=>{await V,ee.issues.length!==T&&(be||(be=u.aborted(ee,T)))});else{if(ee.issues.length===T)continue;be||(be=u.aborted(ee,T))}}return ae?ae.then(()=>ee):ee},re=(ee,ne,ue)=>{if(u.aborted(ee))return ee.aborted=!0,ee;const be=X(ne,M,ue);if(be instanceof Promise){if(ue.async===!1)throw new i.$ZodAsyncError;return be.then(ae=>R._zod.parse(ae,ue))}return R._zod.parse(be,ue)};R._zod.run=(ee,ne)=>{if(ne.skipChecks)return R._zod.parse(ee,ne);if(ne.direction==="backward"){const be=R._zod.parse({value:ee.value,issues:[]},{...ne,skipChecks:!0});return be instanceof Promise?be.then(ae=>re(ae,ee,ne)):re(be,ee,ne)}const ue=R._zod.parse(ee,ne);if(ue instanceof Promise){if(ne.async===!1)throw new i.$ZodAsyncError;return ue.then(be=>X(be,M,ne))}return X(ue,M,ne)}}R["~standard"]={validate:X=>{var re;try{const ee=(0,l.safeParse)(R,X);return ee.success?{value:ee.data}:{issues:(re=ee.error)==null?void 0:re.issues}}catch{return(0,l.safeParseAsync)(R,X).then(ne=>{var ue;return ne.success?{value:ne.data}:{issues:(ue=ne.error)==null?void 0:ue.issues}})}},vendor:"zod",version:1}});var g=qe;Object.defineProperty(e,"clone",{enumerable:!0,get:function(){return g.clone}}),e.$ZodString=i.$constructor("$ZodString",(R,Z)=>{var G;e.$ZodType.init(R,Z),R._zod.pattern=[...((G=R==null?void 0:R._zod.bag)==null?void 0:G.patterns)??[]].pop()??s.string(R._zod.bag),R._zod.parse=(M,J)=>{if(Z.coerce)try{M.value=String(M.value)}catch{}return typeof M.value=="string"||M.issues.push({expected:"string",code:"invalid_type",input:M.value,inst:R}),M}}),e.$ZodStringFormat=i.$constructor("$ZodStringFormat",(R,Z)=>{a.$ZodCheckStringFormat.init(R,Z),e.$ZodString.init(R,Z)}),e.$ZodGUID=i.$constructor("$ZodGUID",(R,Z)=>{Z.pattern??(Z.pattern=s.guid),e.$ZodStringFormat.init(R,Z)}),e.$ZodUUID=i.$constructor("$ZodUUID",(R,Z)=>{if(Z.version){const M={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[Z.version];if(M===void 0)throw new Error(`Invalid UUID version: "${Z.version}"`);Z.pattern??(Z.pattern=s.uuid(M))}else Z.pattern??(Z.pattern=s.uuid());e.$ZodStringFormat.init(R,Z)}),e.$ZodEmail=i.$constructor("$ZodEmail",(R,Z)=>{Z.pattern??(Z.pattern=s.email),e.$ZodStringFormat.init(R,Z)}),e.$ZodURL=i.$constructor("$ZodURL",(R,Z)=>{e.$ZodStringFormat.init(R,Z),R._zod.check=G=>{try{const M=G.value.trim(),J=new URL(M);Z.hostname&&(Z.hostname.lastIndex=0,Z.hostname.test(J.hostname)||G.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:s.hostname.source,input:G.value,inst:R,continue:!Z.abort})),Z.protocol&&(Z.protocol.lastIndex=0,Z.protocol.test(J.protocol.endsWith(":")?J.protocol.slice(0,-1):J.protocol)||G.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:Z.protocol.source,input:G.value,inst:R,continue:!Z.abort})),Z.normalize?G.value=J.href:G.value=M;return}catch{G.issues.push({code:"invalid_format",format:"url",input:G.value,inst:R,continue:!Z.abort})}}}),e.$ZodEmoji=i.$constructor("$ZodEmoji",(R,Z)=>{Z.pattern??(Z.pattern=s.emoji()),e.$ZodStringFormat.init(R,Z)}),e.$ZodNanoID=i.$constructor("$ZodNanoID",(R,Z)=>{Z.pattern??(Z.pattern=s.nanoid),e.$ZodStringFormat.init(R,Z)}),e.$ZodCUID=i.$constructor("$ZodCUID",(R,Z)=>{Z.pattern??(Z.pattern=s.cuid),e.$ZodStringFormat.init(R,Z)}),e.$ZodCUID2=i.$constructor("$ZodCUID2",(R,Z)=>{Z.pattern??(Z.pattern=s.cuid2),e.$ZodStringFormat.init(R,Z)}),e.$ZodULID=i.$constructor("$ZodULID",(R,Z)=>{Z.pattern??(Z.pattern=s.ulid),e.$ZodStringFormat.init(R,Z)}),e.$ZodXID=i.$constructor("$ZodXID",(R,Z)=>{Z.pattern??(Z.pattern=s.xid),e.$ZodStringFormat.init(R,Z)}),e.$ZodKSUID=i.$constructor("$ZodKSUID",(R,Z)=>{Z.pattern??(Z.pattern=s.ksuid),e.$ZodStringFormat.init(R,Z)}),e.$ZodISODateTime=i.$constructor("$ZodISODateTime",(R,Z)=>{Z.pattern??(Z.pattern=s.datetime(Z)),e.$ZodStringFormat.init(R,Z)}),e.$ZodISODate=i.$constructor("$ZodISODate",(R,Z)=>{Z.pattern??(Z.pattern=s.date),e.$ZodStringFormat.init(R,Z)}),e.$ZodISOTime=i.$constructor("$ZodISOTime",(R,Z)=>{Z.pattern??(Z.pattern=s.time(Z)),e.$ZodStringFormat.init(R,Z)}),e.$ZodISODuration=i.$constructor("$ZodISODuration",(R,Z)=>{Z.pattern??(Z.pattern=s.duration),e.$ZodStringFormat.init(R,Z)}),e.$ZodIPv4=i.$constructor("$ZodIPv4",(R,Z)=>{Z.pattern??(Z.pattern=s.ipv4),e.$ZodStringFormat.init(R,Z),R._zod.onattach.push(G=>{const M=G._zod.bag;M.format="ipv4"})}),e.$ZodIPv6=i.$constructor("$ZodIPv6",(R,Z)=>{Z.pattern??(Z.pattern=s.ipv6),e.$ZodStringFormat.init(R,Z),R._zod.onattach.push(G=>{const M=G._zod.bag;M.format="ipv6"}),R._zod.check=G=>{try{new URL(`http://[${G.value}]`)}catch{G.issues.push({code:"invalid_format",format:"ipv6",input:G.value,inst:R,continue:!Z.abort})}}}),e.$ZodCIDRv4=i.$constructor("$ZodCIDRv4",(R,Z)=>{Z.pattern??(Z.pattern=s.cidrv4),e.$ZodStringFormat.init(R,Z)}),e.$ZodCIDRv6=i.$constructor("$ZodCIDRv6",(R,Z)=>{Z.pattern??(Z.pattern=s.cidrv6),e.$ZodStringFormat.init(R,Z),R._zod.check=G=>{const M=G.value.split("/");try{if(M.length!==2)throw new Error;const[J,X]=M;if(!X)throw new Error;const re=Number(X);if(`${re}`!==X)throw new Error;if(re<0||re>128)throw new Error;new URL(`http://[${J}]`)}catch{G.issues.push({code:"invalid_format",format:"cidrv6",input:G.value,inst:R,continue:!Z.abort})}}});function d(R){if(R==="")return!0;if(R.length%4!==0)return!1;try{return atob(R),!0}catch{return!1}}e.$ZodBase64=i.$constructor("$ZodBase64",(R,Z)=>{Z.pattern??(Z.pattern=s.base64),e.$ZodStringFormat.init(R,Z),R._zod.onattach.push(G=>{G._zod.bag.contentEncoding="base64"}),R._zod.check=G=>{d(G.value)||G.issues.push({code:"invalid_format",format:"base64",input:G.value,inst:R,continue:!Z.abort})}});function h(R){if(!s.base64url.test(R))return!1;const Z=R.replace(/[-_]/g,M=>M==="-"?"+":"/"),G=Z.padEnd(Math.ceil(Z.length/4)*4,"=");return d(G)}e.$ZodBase64URL=i.$constructor("$ZodBase64URL",(R,Z)=>{Z.pattern??(Z.pattern=s.base64url),e.$ZodStringFormat.init(R,Z),R._zod.onattach.push(G=>{G._zod.bag.contentEncoding="base64url"}),R._zod.check=G=>{h(G.value)||G.issues.push({code:"invalid_format",format:"base64url",input:G.value,inst:R,continue:!Z.abort})}}),e.$ZodE164=i.$constructor("$ZodE164",(R,Z)=>{Z.pattern??(Z.pattern=s.e164),e.$ZodStringFormat.init(R,Z)});function m(R,Z=null){try{const G=R.split(".");if(G.length!==3)return!1;const[M]=G;if(!M)return!1;const J=JSON.parse(atob(M));return!("typ"in J&&(J==null?void 0:J.typ)!=="JWT"||!J.alg||Z&&(!("alg"in J)||J.alg!==Z))}catch{return!1}}e.$ZodJWT=i.$constructor("$ZodJWT",(R,Z)=>{e.$ZodStringFormat.init(R,Z),R._zod.check=G=>{m(G.value,Z.alg)||G.issues.push({code:"invalid_format",format:"jwt",input:G.value,inst:R,continue:!Z.abort})}}),e.$ZodCustomStringFormat=i.$constructor("$ZodCustomStringFormat",(R,Z)=>{e.$ZodStringFormat.init(R,Z),R._zod.check=G=>{Z.fn(G.value)||G.issues.push({code:"invalid_format",format:Z.format,input:G.value,inst:R,continue:!Z.abort})}}),e.$ZodNumber=i.$constructor("$ZodNumber",(R,Z)=>{e.$ZodType.init(R,Z),R._zod.pattern=R._zod.bag.pattern??s.number,R._zod.parse=(G,M)=>{if(Z.coerce)try{G.value=Number(G.value)}catch{}const J=G.value;if(typeof J=="number"&&!Number.isNaN(J)&&Number.isFinite(J))return G;const X=typeof J=="number"?Number.isNaN(J)?"NaN":Number.isFinite(J)?void 0:"Infinity":void 0;return G.issues.push({expected:"number",code:"invalid_type",input:J,inst:R,...X?{received:X}:{}}),G}}),e.$ZodNumberFormat=i.$constructor("$ZodNumber",(R,Z)=>{a.$ZodCheckNumberFormat.init(R,Z),e.$ZodNumber.init(R,Z)}),e.$ZodBoolean=i.$constructor("$ZodBoolean",(R,Z)=>{e.$ZodType.init(R,Z),R._zod.pattern=s.boolean,R._zod.parse=(G,M)=>{if(Z.coerce)try{G.value=!!G.value}catch{}const J=G.value;return typeof J=="boolean"||G.issues.push({expected:"boolean",code:"invalid_type",input:J,inst:R}),G}}),e.$ZodBigInt=i.$constructor("$ZodBigInt",(R,Z)=>{e.$ZodType.init(R,Z),R._zod.pattern=s.bigint,R._zod.parse=(G,M)=>{if(Z.coerce)try{G.value=BigInt(G.value)}catch{}return typeof G.value=="bigint"||G.issues.push({expected:"bigint",code:"invalid_type",input:G.value,inst:R}),G}}),e.$ZodBigIntFormat=i.$constructor("$ZodBigInt",(R,Z)=>{a.$ZodCheckBigIntFormat.init(R,Z),e.$ZodBigInt.init(R,Z)}),e.$ZodSymbol=i.$constructor("$ZodSymbol",(R,Z)=>{e.$ZodType.init(R,Z),R._zod.parse=(G,M)=>{const J=G.value;return typeof J=="symbol"||G.issues.push({expected:"symbol",code:"invalid_type",input:J,inst:R}),G}}),e.$ZodUndefined=i.$constructor("$ZodUndefined",(R,Z)=>{e.$ZodType.init(R,Z),R._zod.pattern=s.undefined,R._zod.values=new Set([void 0]),R._zod.optin="optional",R._zod.optout="optional",R._zod.parse=(G,M)=>{const J=G.value;return typeof J>"u"||G.issues.push({expected:"undefined",code:"invalid_type",input:J,inst:R}),G}}),e.$ZodNull=i.$constructor("$ZodNull",(R,Z)=>{e.$ZodType.init(R,Z),R._zod.pattern=s.null,R._zod.values=new Set([null]),R._zod.parse=(G,M)=>{const J=G.value;return J===null||G.issues.push({expected:"null",code:"invalid_type",input:J,inst:R}),G}}),e.$ZodAny=i.$constructor("$ZodAny",(R,Z)=>{e.$ZodType.init(R,Z),R._zod.parse=G=>G}),e.$ZodUnknown=i.$constructor("$ZodUnknown",(R,Z)=>{e.$ZodType.init(R,Z),R._zod.parse=G=>G}),e.$ZodNever=i.$constructor("$ZodNever",(R,Z)=>{e.$ZodType.init(R,Z),R._zod.parse=(G,M)=>(G.issues.push({expected:"never",code:"invalid_type",input:G.value,inst:R}),G)}),e.$ZodVoid=i.$constructor("$ZodVoid",(R,Z)=>{e.$ZodType.init(R,Z),R._zod.parse=(G,M)=>{const J=G.value;return typeof J>"u"||G.issues.push({expected:"void",code:"invalid_type",input:J,inst:R}),G}}),e.$ZodDate=i.$constructor("$ZodDate",(R,Z)=>{e.$ZodType.init(R,Z),R._zod.parse=(G,M)=>{if(Z.coerce)try{G.value=new Date(G.value)}catch{}const J=G.value,X=J instanceof Date;return X&&!Number.isNaN(J.getTime())||G.issues.push({expected:"date",code:"invalid_type",input:J,...X?{received:"Invalid Date"}:{},inst:R}),G}});function p(R,Z,G){R.issues.length&&Z.issues.push(...u.prefixIssues(G,R.issues)),Z.value[G]=R.value}e.$ZodArray=i.$constructor("$ZodArray",(R,Z)=>{e.$ZodType.init(R,Z),R._zod.parse=(G,M)=>{const J=G.value;if(!Array.isArray(J))return G.issues.push({expected:"array",code:"invalid_type",input:J,inst:R}),G;G.value=Array(J.length);const X=[];for(let re=0;re<J.length;re++){const ee=J[re],ne=Z.element._zod.run({value:ee,issues:[]},M);ne instanceof Promise?X.push(ne.then(ue=>p(ue,G,re))):p(ne,G,re)}return X.length?Promise.all(X).then(()=>G):G}});function C(R,Z,G,M){R.issues.length&&Z.issues.push(...u.prefixIssues(G,R.issues)),R.value===void 0?G in M&&(Z.value[G]=void 0):Z.value[G]=R.value}function v(R){var M,J,X,re;const Z=Object.keys(R.shape);for(const ee of Z)if(!((re=(X=(J=(M=R.shape)==null?void 0:M[ee])==null?void 0:J._zod)==null?void 0:X.traits)!=null&&re.has("$ZodType")))throw new Error(`Invalid element at key "${ee}": expected a Zod schema`);const G=u.optionalKeys(R.shape);return{...R,keys:Z,keySet:new Set(Z),numKeys:Z.length,optionalKeys:new Set(G)}}function I(R,Z,G,M,J,X){const re=[],ee=J.keySet,ne=J.catchall._zod,ue=ne.def.type;for(const be of Object.keys(Z)){if(ee.has(be))continue;if(ue==="never"){re.push(be);continue}const ae=ne.run({value:Z[be],issues:[]},M);ae instanceof Promise?R.push(ae.then(L=>C(L,G,be,Z))):C(ae,G,be,Z)}return re.length&&G.issues.push({code:"unrecognized_keys",keys:re,input:Z,inst:X}),R.length?Promise.all(R).then(()=>G):G}e.$ZodObject=i.$constructor("$ZodObject",(R,Z)=>{e.$ZodType.init(R,Z);const G=Object.getOwnPropertyDescriptor(Z,"shape");if(!(G!=null&&G.get)){const ee=Z.shape;Object.defineProperty(Z,"shape",{get:()=>{const ne={...ee};return Object.defineProperty(Z,"shape",{value:ne}),ne}})}const M=u.cached(()=>v(Z));u.defineLazy(R._zod,"propValues",()=>{const ee=Z.shape,ne={};for(const ue in ee){const be=ee[ue]._zod;if(be.values){ne[ue]??(ne[ue]=new Set);for(const ae of be.values)ne[ue].add(ae)}}return ne});const J=u.isObject,X=Z.catchall;let re;R._zod.parse=(ee,ne)=>{re??(re=M.value);const ue=ee.value;if(!J(ue))return ee.issues.push({expected:"object",code:"invalid_type",input:ue,inst:R}),ee;ee.value={};const be=[],ae=re.shape;for(const L of re.keys){const V=ae[L]._zod.run({value:ue[L],issues:[]},ne);V instanceof Promise?be.push(V.then(q=>C(q,ee,L,ue))):C(V,ee,L,ue)}return X?I(be,ue,ee,ne,M.value,R):be.length?Promise.all(be).then(()=>ee):ee}}),e.$ZodObjectJIT=i.$constructor("$ZodObjectJIT",(R,Z)=>{e.$ZodObject.init(R,Z);const G=R._zod.parse,M=u.cached(()=>v(Z)),J=L=>{const T=new o.Doc(["shape","payload","ctx"]),V=M.value,q=Re=>{const ye=u.esc(Re);return`shape[${ye}]._zod.run({ value: input[${ye}], issues: [] }, ctx)`};T.write("const input = payload.value;");const ge=Object.create(null);let fe=0;for(const Re of V.keys)ge[Re]=`key_${fe++}`;T.write("const newResult = {};");for(const Re of V.keys){const ye=ge[Re],ke=u.esc(Re);T.write(`const ${ye} = ${q(Re)};`),T.write(`
|