From 422fb7c5d25166d3f527a8dc9fd86a5d109de2c5 Mon Sep 17 00:00:00 2001
From: Patricio Marroquin <55117912+patricio0312rev@users.noreply.github.com>
Date: Mon, 20 Nov 2023 08:51:59 -0500
Subject: [PATCH 01/21] feat: hidden collections toggle for create a gallery
page (#457)
---
.../MyGalleryCollectionController.php | 7 +-
app/Http/Controllers/MyGalleryController.php | 8 +++
app/Models/Collection.php | 9 +++
lang/en/pages.php | 3 +
.../Galleries/Hooks/useGalleryNftsContext.tsx | 4 +-
.../Galleries/Hooks/useGalleryNtfs.tsx | 14 ++--
.../Hooks/useGallerysNftsContext.test.tsx | 43 +++++++++++-
.../NftCollection/NftCollectionSearch.tsx | 8 +--
.../NftCollectionSlider.test.tsx | 26 ++++++-
.../NftCollection/NftCollectionSlider.tsx | 25 ++++++-
.../NftHiddenCollectionsToggle.test.tsx | 66 ++++++++++++++++++
.../NftHiddenCollectionsToggle.tsx | 34 +++++++++
.../NftHiddenCollectionsToggle.test.tsx.snap | 69 +++++++++++++++++++
.../Galleries/NftGridEditable.test.tsx | 13 ++--
.../Components/Galleries/NftGridEditable.tsx | 4 +-
.../Components/Layout/LayoutWrapper.test.tsx | 2 +-
resources/js/I18n/Locales/en.json | 2 +-
.../Components/CreateGalleryButton.tsx | 27 ++++++++
.../js/Pages/Galleries/MyGalleries/Create.tsx | 3 +
.../js/Pages/Galleries/MyGalleries/Index.tsx | 34 +++++++--
.../MyGalleryCollectionControllerTest.php | 34 +++++++++
21 files changed, 401 insertions(+), 34 deletions(-)
create mode 100644 resources/js/Components/Galleries/NftCollection/NftHiddenCollectionsToggle.test.tsx
create mode 100644 resources/js/Components/Galleries/NftCollection/NftHiddenCollectionsToggle.tsx
create mode 100644 resources/js/Components/Galleries/NftCollection/__snapshots__/NftHiddenCollectionsToggle.test.tsx.snap
diff --git a/app/Http/Controllers/MyGalleryCollectionController.php b/app/Http/Controllers/MyGalleryCollectionController.php
index 48d1ce9c4..24b49dd21 100644
--- a/app/Http/Controllers/MyGalleryCollectionController.php
+++ b/app/Http/Controllers/MyGalleryCollectionController.php
@@ -20,8 +20,11 @@ public function index(Request $request): JsonResponse
/** @var User $user */
$user = $request->user();
- $collections = $user
- ->collections()
+ $collectionsQuery = $request->get('showHidden') === 'true'
+ ? $user->hiddenCollections()
+ : $user->collections()->notHidden($user);
+
+ $collections = $collectionsQuery
->where('collections.name', 'ilike', sprintf('%%%s%%', $request->get('query')))
->withUserNftsCount($user)
->orderBy('id')
diff --git a/app/Http/Controllers/MyGalleryController.php b/app/Http/Controllers/MyGalleryController.php
index 35e3a3819..87c0bcf47 100644
--- a/app/Http/Controllers/MyGalleryController.php
+++ b/app/Http/Controllers/MyGalleryController.php
@@ -35,12 +35,17 @@ public function index(Request $request, GalleryRepository $galleries): Response
/** @var PaginatedDataCollection
1?f.getGridIndex():f.getColIndex();e.dispatch("MOVE_ITEM",{query:r,index:p});let m=a.getIndex();if(m===void 0||m!==p){if(a.setIndex(p),m===void 0)return;e.dispatch("DID_REORDER_ITEMS",{items:e.query("GET_ACTIVE_ITEMS"),origin:l,target:p})}},tc=ue({DID_ADD_ITEM:Qs,DID_REMOVE_ITEM:Ks,DID_DRAG_ITEM:ec}),ic=({root:e,props:t,actions:i,shouldOptimize:a})=>{tc({root:e,props:t,actions:i});let{dragCoordinates:n}=t,r=e.rect.element.width,o=e.childViews.filter(T=>T.rect.element.height),l=e.query("GET_ACTIVE_ITEMS").map(T=>o.find(_=>_.id===T.id)).filter(T=>T),s=n?Wi(e,l,n):null,u=e.ref.addIndex||null;e.ref.addIndex=null;let c=0,d=0,h=0;if(l.length===0)return;let f=l[0].rect.element,p=f.marginTop+f.marginBottom,m=f.marginLeft+f.marginRight,g=f.width+m,b=f.height+p,E=Hi(r,g);if(E===1){let T=0,_=0;l.forEach((y,I)=>{if(s){let S=I-s;S===-2?_=-p*.25:S===-1?_=-p*.75:S===0?_=p*.75:S===1?_=p*.25:_=0}a&&(y.translateX=null,y.translateY=null),y.markedForRemoval||Xa(y,0,T+_);let R=(y.rect.element.height+p)*(y.markedForRemoval?y.opacity:1);T+=R})}else{let T=0,_=0;l.forEach((y,I)=>{I===s&&(c=1),I===u&&(h+=1),y.markedForRemoval&&y.opacity<.5&&(d-=1);let v=I+h+c+d,R=v%E,S=Math.floor(v/E),P=R*g,x=S*b,O=Math.sign(P-T),B=Math.sign(x-_);T=P,_=x,!y.markedForRemoval&&(a&&(y.translateX=null,y.translateY=null),Xa(y,P,x,O,B))})}},ac=(e,t)=>t.filter(i=>i.data&&i.data.id?e.id===i.data.id:!0),nc=te({create:js,write:ic,tag:"ul",name:"list",didWriteView:({root:e})=>{e.childViews.filter(t=>t.markedForRemoval&&t.opacity===0&&t.resting).forEach(t=>{t._destroy(),e.removeChildView(t)})},filterFrameActionsForChild:ac,mixins:{apis:["dragCoordinates"]}}),rc=({root:e,props:t})=>{e.ref.list=e.appendChildView(e.createChildView(nc)),t.dragCoordinates=null,t.overflowing=!1},oc=({root:e,props:t,action:i})=>{e.query("GET_ITEM_INSERT_LOCATION_FREEDOM")&&(t.dragCoordinates={left:i.position.scopeLeft-e.ref.list.rect.element.left,top:i.position.scopeTop-(e.rect.outer.top+e.rect.element.marginTop+e.rect.element.scrollTop)})},lc=({props:e})=>{e.dragCoordinates=null},sc=ue({DID_DRAG:oc,DID_END_DRAG:lc}),cc=({root:e,props:t,actions:i})=>{if(sc({root:e,props:t,actions:i}),e.ref.list.dragCoordinates=t.dragCoordinates,t.overflowing&&!t.overflow&&(t.overflowing=!1,e.element.dataset.state="",e.height=null),t.overflow){let a=Math.round(t.overflow);a!==e.height&&(t.overflowing=!0,e.element.dataset.state="overflow",e.height=a)}},dc=te({create:rc,write:cc,name:"list-scroller",mixins:{apis:["overflow","dragCoordinates"],styles:["height","translateY"],animations:{translateY:"spring"}}}),ve=(e,t,i,a="")=>{i?ee(e,t,a):e.removeAttribute(t)},uc=e=>{if(!(!e||e.value==="")){try{e.value=""}catch{}if(e.value){let t=Fe("form"),i=e.parentNode,a=e.nextSibling;t.appendChild(e),t.reset(),a?i.insertBefore(e,a):i.appendChild(e)}}},hc=({root:e,props:t})=>{e.element.id=`filepond--browser-${t.id}`,ee(e.element,"name",e.query("GET_NAME")),ee(e.element,"aria-controls",`filepond--assistant-${t.id}`),ee(e.element,"aria-labelledby",`filepond--drop-label-${t.id}`),On({root:e,action:{value:e.query("GET_ACCEPTED_FILE_TYPES")}}),xn({root:e,action:{value:e.query("GET_ALLOW_MULTIPLE")}}),Dn({root:e,action:{value:e.query("GET_ALLOW_DIRECTORIES_ONLY")}}),Oi({root:e}),Pn({root:e,action:{value:e.query("GET_REQUIRED")}}),Fn({root:e,action:{value:e.query("GET_CAPTURE_METHOD")}}),e.ref.handleChange=i=>{if(!e.element.value)return;let a=Array.from(e.element.files).map(n=>(n._relativePath=n.webkitRelativePath,n));setTimeout(()=>{t.onload(a),uc(e.element)},250)},e.element.addEventListener("change",e.ref.handleChange)},On=({root:e,action:t})=>{e.query("GET_ALLOW_SYNC_ACCEPT_ATTRIBUTE")&&ve(e.element,"accept",!!t.value,t.value?t.value.join(","):"")},xn=({root:e,action:t})=>{ve(e.element,"multiple",t.value)},Dn=({root:e,action:t})=>{ve(e.element,"webkitdirectory",t.value)},Oi=({root:e})=>{let t=e.query("GET_DISABLED"),i=e.query("GET_ALLOW_BROWSE"),a=t||!i;ve(e.element,"disabled",a)},Pn=({root:e,action:t})=>{t.value?e.query("GET_TOTAL_ITEMS")===0&&ve(e.element,"required",!0):ve(e.element,"required",!1)},Fn=({root:e,action:t})=>{ve(e.element,"capture",!!t.value,t.value===!0?"":t.value)},ja=({root:e})=>{let{element:t}=e;e.query("GET_TOTAL_ITEMS")>0?(ve(t,"required",!1),ve(t,"name",!1)):(ve(t,"name",!0,e.query("GET_NAME")),e.query("GET_CHECK_VALIDITY")&&t.setCustomValidity(""),e.query("GET_REQUIRED")&&ve(t,"required",!0))},fc=({root:e})=>{e.query("GET_CHECK_VALIDITY")&&e.element.setCustomValidity(e.query("GET_LABEL_INVALID_FIELD"))},pc=te({tag:"input",name:"browser",ignoreRect:!0,ignoreRectUpdate:!0,attributes:{type:"file"},create:hc,destroy:({root:e})=>{e.element.removeEventListener("change",e.ref.handleChange)},write:ue({DID_LOAD_ITEM:ja,DID_REMOVE_ITEM:ja,DID_THROW_ITEM_INVALID:fc,DID_SET_DISABLED:Oi,DID_SET_ALLOW_BROWSE:Oi,DID_SET_ALLOW_DIRECTORIES_ONLY:Dn,DID_SET_ALLOW_MULTIPLE:xn,DID_SET_ACCEPTED_FILE_TYPES:On,DID_SET_CAPTURE_METHOD:Fn,DID_SET_REQUIRED:Pn})}),Qa={ENTER:13,SPACE:32},mc=({root:e,props:t})=>{let i=Fe("label");ee(i,"for",`filepond--browser-${t.id}`),ee(i,"id",`filepond--drop-label-${t.id}`),ee(i,"aria-hidden","true"),e.ref.handleKeyDown=a=>{(a.keyCode===Qa.ENTER||a.keyCode===Qa.SPACE)&&(a.preventDefault(),e.ref.label.click())},e.ref.handleClick=a=>{a.target===i||i.contains(a.target)||e.ref.label.click()},i.addEventListener("keydown",e.ref.handleKeyDown),e.element.addEventListener("click",e.ref.handleClick),Cn(i,t.caption),e.appendChild(i),e.ref.label=i},Cn=(e,t)=>{e.innerHTML=t;let i=e.querySelector(".filepond--label-action");return i&&ee(i,"tabindex","0"),t},gc=te({name:"drop-label",ignoreRect:!0,create:mc,destroy:({root:e})=>{e.ref.label.addEventListener("keydown",e.ref.handleKeyDown),e.element.removeEventListener("click",e.ref.handleClick)},write:ue({DID_SET_LABEL_IDLE:({root:e,action:t})=>{Cn(e.ref.label,t.value)}}),mixins:{styles:["opacity","translateX","translateY"],animations:{opacity:{type:"tween",duration:150},translateX:"spring",translateY:"spring"}}}),Ec=te({name:"drip-blob",ignoreRect:!0,mixins:{styles:["translateX","translateY","scaleX","scaleY","opacity"],animations:{scaleX:"spring",scaleY:"spring",translateX:"spring",translateY:"spring",opacity:{type:"tween",duration:250}}}}),Tc=({root:e})=>{let t=e.rect.element.width*.5,i=e.rect.element.height*.5;e.ref.blob=e.appendChildView(e.createChildView(Ec,{opacity:0,scaleX:2.5,scaleY:2.5,translateX:t,translateY:i}))},Ic=({root:e,action:t})=>{if(!e.ref.blob){Tc({root:e});return}e.ref.blob.translateX=t.position.scopeLeft,e.ref.blob.translateY=t.position.scopeTop,e.ref.blob.scaleX=1,e.ref.blob.scaleY=1,e.ref.blob.opacity=1},bc=({root:e})=>{e.ref.blob&&(e.ref.blob.opacity=0)},_c=({root:e})=>{e.ref.blob&&(e.ref.blob.scaleX=2.5,e.ref.blob.scaleY=2.5,e.ref.blob.opacity=0)},Rc=({root:e,props:t,actions:i})=>{yc({root:e,props:t,actions:i});let{blob:a}=e.ref;i.length===0&&a&&a.opacity===0&&(e.removeChildView(a),e.ref.blob=null)},yc=ue({DID_DRAG:Ic,DID_DROP:_c,DID_END_DRAG:bc}),Sc=te({ignoreRect:!0,ignoreRectUpdate:!0,name:"drip",write:Rc}),zn=(e,t)=>{try{let i=new DataTransfer;t.forEach(a=>{a instanceof File?i.items.add(a):i.items.add(new File([a],a.name,{type:a.type}))}),e.files=i.files}catch{return!1}return!0},wc=({root:e})=>e.ref.fields={},ni=(e,t)=>e.ref.fields[t],Yi=e=>{e.query("GET_ACTIVE_ITEMS").forEach(t=>{e.ref.fields[t.id]&&e.element.appendChild(e.ref.fields[t.id])})},Za=({root:e})=>Yi(e),vc=({root:e,action:t})=>{let n=!(e.query("GET_ITEM",t.id).origin===ae.LOCAL)&&e.query("SHOULD_UPDATE_FILE_INPUT"),r=Fe("input");r.type=n?"file":"hidden",r.name=e.query("GET_NAME"),r.disabled=e.query("GET_DISABLED"),e.ref.fields[t.id]=r,Yi(e)},Ac=({root:e,action:t})=>{let i=ni(e,t.id);if(!i||(t.serverFileReference!==null&&(i.value=t.serverFileReference),!e.query("SHOULD_UPDATE_FILE_INPUT")))return;let a=e.query("GET_ITEM",t.id);zn(i,[a.file])},Lc=({root:e,action:t})=>{e.query("SHOULD_UPDATE_FILE_INPUT")&&setTimeout(()=>{let i=ni(e,t.id);i&&zn(i,[t.file])},0)},Mc=({root:e})=>{e.element.disabled=e.query("GET_DISABLED")},Oc=({root:e,action:t})=>{let i=ni(e,t.id);i&&(i.parentNode&&i.parentNode.removeChild(i),delete e.ref.fields[t.id])},xc=({root:e,action:t})=>{let i=ni(e,t.id);i&&(t.value===null?i.removeAttribute("value"):i.value=t.value,Yi(e))},Dc=ue({DID_SET_DISABLED:Mc,DID_ADD_ITEM:vc,DID_LOAD_ITEM:Ac,DID_REMOVE_ITEM:Oc,DID_DEFINE_VALUE:xc,DID_PREPARE_OUTPUT:Lc,DID_REORDER_ITEMS:Za,DID_SORT_ITEMS:Za}),Pc=te({tag:"fieldset",name:"data",create:wc,write:Dc,ignoreRect:!0}),Fc=e=>"getRootNode"in e?e.getRootNode():document,Cc=["jpg","jpeg","png","gif","bmp","webp","svg","tiff"],zc=["css","csv","html","txt"],Nc={zip:"zip|compressed",epub:"application/epub+zip"},Nn=(e="")=>(e=e.toLowerCase(),Cc.includes(e)?"image/"+(e==="jpg"?"jpeg":e==="svg"?"svg+xml":e):zc.includes(e)?"text/"+e:Nc[e]||""),$i=e=>new Promise((t,i)=>{let a=Yc(e);if(a.length&&!Bc(e))return t(a);Gc(e).then(t)}),Bc=e=>e.files?e.files.length>0:!1,Gc=e=>new Promise((t,i)=>{let a=(e.items?Array.from(e.items):[]).filter(n=>Vc(n)).map(n=>Uc(n));if(!a.length){t(e.files?Array.from(e.files):[]);return}Promise.all(a).then(n=>{let r=[];n.forEach(o=>{r.push.apply(r,o)}),t(r.filter(o=>o).map(o=>(o._relativePath||(o._relativePath=o.webkitRelativePath),o)))}).catch(console.error)}),Vc=e=>{if(Bn(e)){let t=qi(e);if(t)return t.isFile||t.isDirectory}return e.kind==="file"},Uc=e=>new Promise((t,i)=>{if(Wc(e)){kc(qi(e)).then(t).catch(i);return}t([e.getAsFile()])}),kc=e=>new Promise((t,i)=>{let a=[],n=0,r=0,o=()=>{r===0&&n===0&&t(a)},l=s=>{n++;let u=s.createReader(),c=()=>{u.readEntries(d=>{if(d.length===0){n--,o();return}d.forEach(h=>{h.isDirectory?l(h):(r++,h.file(f=>{let p=Hc(f);h.fullPath&&(p._relativePath=h.fullPath),a.push(p),r--,o()}))}),c()},i)};c()};l(e)}),Hc=e=>{if(e.type.length)return e;let t=e.lastModifiedDate,i=e.name,a=Nn(ai(e.name));return a.length&&(e=e.slice(0,e.size,a),e.name=i,e.lastModifiedDate=t),e},Wc=e=>Bn(e)&&(qi(e)||{}).isDirectory,Bn=e=>"webkitGetAsEntry"in e,qi=e=>e.webkitGetAsEntry(),Yc=e=>{let t=[];try{if(t=qc(e),t.length)return t;t=$c(e)}catch{}return t},$c=e=>{let t=e.getData("url");return typeof t=="string"&&t.length?[t]:[]},qc=e=>{let t=e.getData("text/html");if(typeof t=="string"&&t.length){let i=t.match(/src\s*=\s*"(.+?)"/);if(i)return[i[1]]}return[]},Zt=[],qe=e=>({pageLeft:e.pageX,pageTop:e.pageY,scopeLeft:e.offsetX||e.layerX,scopeTop:e.offsetY||e.layerY}),Xc=(e,t,i)=>{let a=jc(t),n={element:e,filterElement:i,state:null,ondrop:()=>{},onenter:()=>{},ondrag:()=>{},onexit:()=>{},onload:()=>{},allowdrop:()=>{}};return n.destroy=a.addListener(n),n},jc=e=>{let t=Zt.find(a=>a.element===e);if(t)return t;let i=Qc(e);return Zt.push(i),i},Qc=e=>{let t=[],i={dragenter:Kc,dragover:Jc,dragleave:td,drop:ed},a={};Z(i,(r,o)=>{a[r]=o(e,t),e.addEventListener(r,a[r],!1)});let n={element:e,addListener:r=>(t.push(r),()=>{t.splice(t.indexOf(r),1),t.length===0&&(Zt.splice(Zt.indexOf(n),1),Z(i,o=>{e.removeEventListener(o,a[o],!1)}))})};return n},Zc=(e,t)=>("elementFromPoint"in e||(e=document),e.elementFromPoint(t.x,t.y)),Xi=(e,t)=>{let i=Fc(t),a=Zc(i,{x:e.pageX-window.pageXOffset,y:e.pageY-window.pageYOffset});return a===t||t.contains(a)},Gn=null,$t=(e,t)=>{try{e.dropEffect=t}catch{}},Kc=(e,t)=>i=>{i.preventDefault(),Gn=i.target,t.forEach(a=>{let{element:n,onenter:r}=a;Xi(i,n)&&(a.state="enter",r(qe(i)))})},Jc=(e,t)=>i=>{i.preventDefault();let a=i.dataTransfer;$i(a).then(n=>{let r=!1;t.some(o=>{let{filterElement:l,element:s,onenter:u,onexit:c,ondrag:d,allowdrop:h}=o;$t(a,"copy");let f=h(n);if(!f){$t(a,"none");return}if(Xi(i,s)){if(r=!0,o.state===null){o.state="enter",u(qe(i));return}if(o.state="over",l&&!f){$t(a,"none");return}d(qe(i))}else l&&!r&&$t(a,"none"),o.state&&(o.state=null,c(qe(i)))})})},ed=(e,t)=>i=>{i.preventDefault();let a=i.dataTransfer;$i(a).then(n=>{t.forEach(r=>{let{filterElement:o,element:l,ondrop:s,onexit:u,allowdrop:c}=r;if(r.state=null,!(o&&!Xi(i,l))){if(!c(n))return u(qe(i));s(qe(i),n)}})})},td=(e,t)=>i=>{Gn===i.target&&t.forEach(a=>{let{onexit:n}=a;a.state=null,n(qe(i))})},id=(e,t,i)=>{e.classList.add("filepond--hopper");let{catchesDropsOnPage:a,requiresDropOnElement:n,filterItems:r=c=>c}=i,o=Xc(e,a?document.documentElement:e,n),l="",s="";o.allowdrop=c=>t(r(c)),o.ondrop=(c,d)=>{let h=r(d);if(!t(h)){u.ondragend(c);return}s="drag-drop",u.onload(h,c)},o.ondrag=c=>{u.ondrag(c)},o.onenter=c=>{s="drag-over",u.ondragstart(c)},o.onexit=c=>{s="drag-exit",u.ondragend(c)};let u={updateHopperState:()=>{l!==s&&(e.dataset.hopperState=s,l=s)},onload:()=>{},ondragstart:()=>{},ondrag:()=>{},ondragend:()=>{},destroy:()=>{o.destroy()}};return u},xi=!1,rt=[],Vn=e=>{let t=document.activeElement;if(t&&/textarea|input/i.test(t.nodeName)){let i=!1,a=t;for(;a!==document.body;){if(a.classList.contains("filepond--root")){i=!0;break}a=a.parentNode}if(!i)return}$i(e.clipboardData).then(i=>{i.length&&rt.forEach(a=>a(i))})},ad=e=>{rt.includes(e)||(rt.push(e),!xi&&(xi=!0,document.addEventListener("paste",Vn)))},nd=e=>{Gi(rt,rt.indexOf(e)),rt.length===0&&(document.removeEventListener("paste",Vn),xi=!1)},rd=()=>{let e=i=>{t.onload(i)},t={destroy:()=>{nd(e)},onload:()=>{}};return ad(e),t},od=({root:e,props:t})=>{e.element.id=`filepond--assistant-${t.id}`,ee(e.element,"role","status"),ee(e.element,"aria-live","polite"),ee(e.element,"aria-relevant","additions")},Ka=null,Ja=null,yi=[],ri=(e,t)=>{e.element.textContent=t},ld=e=>{e.element.textContent=""},Un=(e,t,i)=>{let a=e.query("GET_TOTAL_ITEMS");ri(e,`${i} ${t}, ${a} ${a===1?e.query("GET_LABEL_FILE_COUNT_SINGULAR"):e.query("GET_LABEL_FILE_COUNT_PLURAL")}`),clearTimeout(Ja),Ja=setTimeout(()=>{ld(e)},1500)},kn=e=>e.element.parentNode.contains(document.activeElement),sd=({root:e,action:t})=>{if(!kn(e))return;e.element.textContent="";let i=e.query("GET_ITEM",t.id);yi.push(i.filename),clearTimeout(Ka),Ka=setTimeout(()=>{Un(e,yi.join(", "),e.query("GET_LABEL_FILE_ADDED")),yi.length=0},750)},cd=({root:e,action:t})=>{if(!kn(e))return;let i=t.item;Un(e,i.filename,e.query("GET_LABEL_FILE_REMOVED"))},dd=({root:e,action:t})=>{let a=e.query("GET_ITEM",t.id).filename,n=e.query("GET_LABEL_FILE_PROCESSING_COMPLETE");ri(e,`${a} ${n}`)},en=({root:e,action:t})=>{let a=e.query("GET_ITEM",t.id).filename,n=e.query("GET_LABEL_FILE_PROCESSING_ABORTED");ri(e,`${a} ${n}`)},qt=({root:e,action:t})=>{let a=e.query("GET_ITEM",t.id).filename;ri(e,`${t.status.main} ${a} ${t.status.sub}`)},ud=te({create:od,ignoreRect:!0,ignoreRectUpdate:!0,write:ue({DID_LOAD_ITEM:sd,DID_REMOVE_ITEM:cd,DID_COMPLETE_ITEM_PROCESSING:dd,DID_ABORT_ITEM_PROCESSING:en,DID_REVERT_ITEM_PROCESSING:en,DID_THROW_ITEM_REMOVE_ERROR:qt,DID_THROW_ITEM_LOAD_ERROR:qt,DID_THROW_ITEM_INVALID:qt,DID_THROW_ITEM_PROCESSING_ERROR:qt}),tag:"span",name:"assistant"}),Hn=(e,t="-")=>e.replace(new RegExp(`${t}.`,"g"),i=>i.charAt(1).toUpperCase()),Wn=(e,t=16,i=!0)=>{let a=Date.now(),n=null;return(...r)=>{clearTimeout(n);let o=Date.now()-a,l=()=>{a=Date.now(),e(...r)};o