From 038082a40445563039bdbbf3989127189f2a24c1 Mon Sep 17 00:00:00 2001 From: Glenn 'devalias' Grant Date: Fri, 5 Jan 2024 16:00:22 +1100 Subject: [PATCH] [content] add PEO14vuOqqjOQtCs82SgS content from 2024-01-05Z --- CHANGELOG.md | 44 + .../PEO14vuOqqjOQtCs82SgS/_buildManifest.js | 1 + .../PEO14vuOqqjOQtCs82SgS/_ssgManifest.js | 1 + .../static/chunks/192-b633a5ea9fc82ab3.js | 1 + .../static/chunks/6276-32619f7589d1c892.js | 1 + .../chunks/pages/_app-6f5714b74826d9f8.js | 99 + .../pages/g/[gizmoId]-c5413facf22f70cb.js | 1 + .../pages/gpts/discovery-51c1fb442a5d6a51.js | 1 + .../static/chunks/webpack-5646d29a9fe81c6b.js | 1 + orig/_next/static/css/851ebaec58abad64.css | 2 + .../static/[buildHash]/_buildManifest.js | 18 +- unpacked/_next/static/chunks/192.js | 283 +- unpacked/_next/static/chunks/6276.js | 947 +- unpacked/_next/static/chunks/pages/_app.js | 19851 ++++++++-------- .../_next/static/chunks/pages/g/[gizmoId].js | 74 +- .../static/chunks/pages/gpts/discovery.js | 64 +- unpacked/_next/static/chunks/webpack.js | 100 +- unpacked/_next/static/css/miniCssF.css | 9292 +++++++- 18 files changed, 20377 insertions(+), 10404 deletions(-) create mode 100644 orig/_next/static/PEO14vuOqqjOQtCs82SgS/_buildManifest.js create mode 100644 orig/_next/static/PEO14vuOqqjOQtCs82SgS/_ssgManifest.js create mode 100644 orig/_next/static/chunks/192-b633a5ea9fc82ab3.js create mode 100644 orig/_next/static/chunks/6276-32619f7589d1c892.js create mode 100644 orig/_next/static/chunks/pages/_app-6f5714b74826d9f8.js create mode 100644 orig/_next/static/chunks/pages/g/[gizmoId]-c5413facf22f70cb.js create mode 100644 orig/_next/static/chunks/pages/gpts/discovery-51c1fb442a5d6a51.js create mode 100644 orig/_next/static/chunks/webpack-5646d29a9fe81c6b.js create mode 100644 orig/_next/static/css/851ebaec58abad64.css diff --git a/CHANGELOG.md b/CHANGELOG.md index c4aa858..9263027 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,50 @@ You may also like some of the historical insights captured at the following gist - [Reverse engineering ChatGPT's frontend web app + deep dive explorations of the code (0xdevalias gist)](https://gist.github.com/0xdevalias/4ac297ee3f794c17d0997b4673a2f160#reverse-engineering-chatgpts-frontend-web-app--deep-dive-explorations-of-the-code) +## 2024-01-05Z (`PEO14vuOqqjOQtCs82SgS`) + +### Notes + +The following notes are not necessarily comprehensive, but just things of potential interest that I noted while reviewing the diffs. If you want to see everything that changed, you can look at the diffs of the changed files in the `unpacked/` folder: + +- **tl;dr** + - TODO high level summary of the technical changes listed below + - **Twitter thread:** TODO +- `TODO unpacked file paths here` + - TODO notes about the file here +- The following files had nothing much of note: + - `TODO unpacked file paths here` + +### Not From Build Manifest + +#### Archived + +``` +https://cdn.oaistatic.com/_next/static/chunks/pages/_app-6f5714b74826d9f8.js +https://cdn.oaistatic.com/_next/static/chunks/webpack-5646d29a9fe81c6b.js +https://cdn.oaistatic.com/_next/static/PEO14vuOqqjOQtCs82SgS/_buildManifest.js +https://cdn.oaistatic.com/_next/static/PEO14vuOqqjOQtCs82SgS/_ssgManifest.js +``` + +### From Build Manifest + +#### Archived + +``` +https://cdn.oaistatic.com/_next/static/chunks/pages/g/[gizmoId]-c5413facf22f70cb.js +https://cdn.oaistatic.com/_next/static/chunks/6276-32619f7589d1c892.js +https://cdn.oaistatic.com/_next/static/chunks/pages/gpts/discovery-51c1fb442a5d6a51.js +https://cdn.oaistatic.com/_next/static/chunks/192-b633a5ea9fc82ab3.js +``` + +### From `_next/static/chunks/webpack-5646d29a9fe81c6b.js` + +#### Archived + +``` +https://cdn.oaistatic.com/_next/static/css/851ebaec58abad64.css +``` + ## 2024-01-04Z (`wvxlBkHE5usnj-32Td8Nr`) ### Not From Build Manifest diff --git a/orig/_next/static/PEO14vuOqqjOQtCs82SgS/_buildManifest.js b/orig/_next/static/PEO14vuOqqjOQtCs82SgS/_buildManifest.js new file mode 100644 index 0000000..2086eeb --- /dev/null +++ b/orig/_next/static/PEO14vuOqqjOQtCs82SgS/_buildManifest.js @@ -0,0 +1 @@ +self.__BUILD_MANIFEST=function(a,s,e,c,t){return{__rewrites:{beforeFiles:[],afterFiles:[],fallback:[]},"/_error":["static/chunks/pages/_error-b43f54d044ec2f25.js"],"/account/cancel":["static/chunks/pages/account/cancel-f8e8da26c181d170.js"],"/account/manage":["static/chunks/pages/account/manage-396e4df2072cd915.js"],"/admin":[a,"static/chunks/pages/admin-8f957bad7cabc93f.js"],"/admin/analytics":["static/chunks/3a34cc27-fd0458d5c342aa61.js","static/chunks/7549-d2a333e769651485.js",a,"static/chunks/pages/admin/analytics-cbc0f5c446bb2eb7.js"],"/admin/billing":[a,"static/chunks/pages/admin/billing-2095e104a2691e45.js"],"/admin/identity":[a,"static/chunks/pages/admin/identity-2aea3c696b2df83d.js"],"/admin/settings":[a,"static/chunks/pages/admin/settings-eb692e8b61f01e98.js"],"/aip/[pluginId]/oauth/callback":["static/chunks/pages/aip/[pluginId]/oauth/callback-65793e0a08d56e1d.js"],"/auth/enable/internal":["static/chunks/pages/auth/enable/internal-d991ddf2a6aaad1e.js"],"/auth/error":["static/chunks/pages/auth/error-25b89c24abe59fd8.js"],"/auth/ext_callback":["static/chunks/pages/auth/ext_callback-5eabd2305c18a61d.js"],"/auth/ext_callback_refresh":["static/chunks/pages/auth/ext_callback_refresh-565d8770e52c929a.js"],"/auth/login":[s,e,"static/chunks/pages/auth/login-deef6484f170bae2.js"],"/auth/logout":["static/chunks/pages/auth/logout-d11db11603a1a477.js"],"/auth/mocked_login":["static/chunks/pages/auth/mocked_login-1cbeed1e3f3eedd3.js"],"/bypass":["static/chunks/pages/bypass-71f135c5de432308.js"],"/g/[gizmoId]":["static/chunks/pages/g/[gizmoId]-c5413facf22f70cb.js"],"/g/[gizmoId]/c/[convId]":["static/chunks/pages/g/[gizmoId]/c/[convId]-8c7558ce5704445d.js"],"/gpts/discovery":[c,"static/chunks/pages/gpts/discovery-51c1fb442a5d6a51.js"],"/gpts/editor":[t,"static/chunks/pages/gpts/editor-066904f093c6dd65.js"],"/gpts/editor/[slug]":[t,"static/chunks/pages/gpts/editor/[slug]-145af87f7e35328a.js"],"/gpts/mine":[c,"static/chunks/pages/gpts/mine-7e5560272a89fb83.js"],"/invite/accepted":["static/chunks/pages/invite/accepted-c068cb61b8b506e3.js"],"/invite/[[...referralCodeParam]]":[s,e,"static/chunks/pages/invite/[[...referralCodeParam]]-52636a17fdba5069.js"],"/payments/success":["static/chunks/pages/payments/success-e1c52df5035926ea.js"],"/payments/success-team":["static/chunks/pages/payments/success-team-3e97e6d92488eac1.js"],"/payments/success-trial":["static/chunks/pages/payments/success-trial-6f90b93d2f1db032.js"],"/share/e/[[...shareParams]]":["static/chunks/pages/share/e/[[...shareParams]]-8ad7cd389335ca03.js"],"/share/[[...shareParams]]":["static/chunks/pages/share/[[...shareParams]]-63420656fb636203.js"],"/status":[s,"static/chunks/pages/status-7535f2156b7bed72.js"],"/workspace/deactivated":["static/chunks/pages/workspace/deactivated-5693ccd6d077ee1d.js"],"/[[...default]]":["static/chunks/pages/[[...default]]-e3ee114076ef4ad4.js"],sortedPages:["/_app","/_error","/account/cancel","/account/manage","/admin","/admin/analytics","/admin/billing","/admin/identity","/admin/settings","/aip/[pluginId]/oauth/callback","/auth/enable/internal","/auth/error","/auth/ext_callback","/auth/ext_callback_refresh","/auth/login","/auth/logout","/auth/mocked_login","/bypass","/g/[gizmoId]","/g/[gizmoId]/c/[convId]","/gpts/discovery","/gpts/editor","/gpts/editor/[slug]","/gpts/mine","/invite/accepted","/invite/[[...referralCodeParam]]","/payments/success","/payments/success-team","/payments/success-trial","/share/e/[[...shareParams]]","/share/[[...shareParams]]","/status","/workspace/deactivated","/[[...default]]"]}}("static/chunks/5017-dc62820c5a35986c.js","static/chunks/3975-78ada888750e0be2.js","static/chunks/3754-a18653d9d4bfd554.js","static/chunks/6276-32619f7589d1c892.js","static/chunks/192-b633a5ea9fc82ab3.js"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB(); \ No newline at end of file diff --git a/orig/_next/static/PEO14vuOqqjOQtCs82SgS/_ssgManifest.js b/orig/_next/static/PEO14vuOqqjOQtCs82SgS/_ssgManifest.js new file mode 100644 index 0000000..0511aa8 --- /dev/null +++ b/orig/_next/static/PEO14vuOqqjOQtCs82SgS/_ssgManifest.js @@ -0,0 +1 @@ +self.__SSG_MANIFEST=new Set,self.__SSG_MANIFEST_CB&&self.__SSG_MANIFEST_CB(); \ No newline at end of file diff --git a/orig/_next/static/chunks/192-b633a5ea9fc82ab3.js b/orig/_next/static/chunks/192-b633a5ea9fc82ab3.js new file mode 100644 index 0000000..8b1d1a7 --- /dev/null +++ b/orig/_next/static/chunks/192-b633a5ea9fc82ab3.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[192],{192:function(e,t,n){n.r(t),n.d(t,{__N_SSP:function(){return nj},default:function(){return nw}});var r,i,o,a,s,l,c,u,d,p,f,m,h,g=n(37097),v=n(50134),x=n(6939),b=n(36112),y=n(4399),j=n.n(y),w=n(82256),P=n(61302),k=n(3554),N=n(21120),T=n(14711),O=n(35250);function z(e){var t,n=e.gizmoId,r=(0,g.b9)(n,!0).data,i=(t=(0,v.Z)(j().mark(function e(){return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,T.U.postGizmoCancelAppeal(n);case 2:case"end":return e.stop()}},e)})),function(){return t.apply(this,arguments)});return(0,O.jsx)(N.Z,{isOpen:!0,onClose:function(){},primaryButton:(0,O.jsx)(k.ZP.Button,{title:"Cancel appeal",color:"primary",onClick:i}),type:"warning",children:(0,O.jsxs)("div",{className:"flex flex-col gap-2 text-sm",children:[(0,O.jsx)("h2",{className:"text-lg font-semibold",children:"Reviewing your appeal"}),(0,O.jsxs)("p",{children:["During the review you can continue using “",null==r?void 0:r.gizmo.display.name,"” as your private GPT, but won’t be able to update it or share it with others."]})]})})}var C=n(90038),I=n(21389),_=I.Z.a(a||(a=(0,C.Z)(["bold underline"])));function S(e){var t=e.isFlaggedBrandName,n=e.onClose;return(0,O.jsx)(N.Z,{title:"Your changes couldn’t be published",isOpen:!0,onClose:n,closeButton:(0,O.jsx)(k.ZP.CloseButton,{onClose:n}),primaryButton:(0,O.jsx)(k.ZP.Button,{title:"Continue",color:"primary",onClick:n}),type:"warning",children:(0,O.jsx)("div",{className:"flex flex-col gap-2 text-sm",children:t?(0,O.jsxs)("p",{children:["Your GPT’s name is restricted for public sharing. If this is your organization’s name, please verify your website via the"," ",(0,O.jsx)(_,{href:"/#settings/BuilderProfile",children:"Builder profile in Settings"}),"."]}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)("p",{children:"Your GPT isn’t ready for public sharing yet. Usually, it’s a quick fix."}),(0,O.jsx)("p",{children:"Here’s what you can do"}),(0,O.jsxs)("ul",{className:"list-disc pl-5",children:[(0,O.jsxs)("li",{children:[(0,O.jsx)("b",{children:"Review your info:"})," Check that your description, name, and profile picture meet our"," ",(0,O.jsx)(_,{target:"_blank",href:"https://openai.com/brand",rel:"noreferrer",children:"brand"})," ","and"," ",(0,O.jsx)(_,{target:"_blank",href:"https://openai.com/policies/usage-policies",rel:"noreferrer",children:"usage"})," ","guidelines."]}),(0,O.jsxs)("li",{children:[(0,O.jsx)("b",{children:"Share again:"})," Once updated, go ahead and share your GPT."]})]}),(0,O.jsxs)("p",{children:["Concerns? Your feedback is welcome"," ",(0,O.jsx)(_,{target:"_blank",href:"https://forms.gle/qXd1PjZmuJYhvxow5",rel:"noreferrer",children:"here"})," ","and helps us improve."]}),(0,O.jsx)("p",{children:"Feel free to use your GPT privately for now by publishing to “only me”."})]})})})}var G=n(52336),M=n(63866),E=n(4748),D=n(7144),Z=n(1890),A=n(19954),L=n(73582),U=n(88654),R=n(83380),V=n(28818),q=n(70079),F=n(35427),B=n(69101),W=n(13135),H=n(19841),K=n(61888),J=n(10721),Y=n.n(J),X=n(70671),Q=n(80459),$=n(11591),ee=n(91559),et=n(5063),en=n(32004),er=n(1703),ei=n(998),eo=["className","children"],ea=["value","className","label"],es=["className"];function el(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ec(e){for(var t=1;t0)){e.next=9;break}return o(!1),e.next=4,(0,ez.WI)(t[0],512);case 4:n=e.sent,c({tempId:r=(0,eO.W7)(n),file:n,status:eT.X.Uploading,progress:1,fileId:null,cdnUrl:null}),u.current("uploading"),(0,eO.lU)(r,n,a,w.Ei.ProfilePicture,{onFileCreated:function(e,t,n){c(function(r){return"initial"!==r&&(null==r?void 0:r.tempId)===e&&r.status===eT.X.Uploading?eS(eS({},r),{},{progress:10,fileId:t,cdnUrl:n}):r})},onFileUploadProgress:function(e,t){c(function(n){return"initial"!==n&&(null==n?void 0:n.tempId)===e&&n.status===eT.X.Uploading?eS(eS({},n),{},{progress:t}):n})},onFileUploaded:function(e,t){c(function(n){return"initial"!==n&&(null==n?void 0:n.tempId)===e?(u.current(n),eS(eS({},n),{},{status:eT.X.Ready,progress:100,fileSpec:eS({name:n.file.name,id:n.fileId,size:n.file.size},null!=t?t:{})})):n})},onError:function(e){c(function(t){if("initial"!==t&&(null==t?void 0:t.tempId)===e){u.current(void 0);return}return t})}});case 9:case"end":return e.stop()}},e)}))).apply(this,arguments)}(0,q.useEffect)(function(){u.current=n});var p=(0,ey.uI)(eS({disabled:!1,noClick:!0,onDropAccepted:function(e){return d.apply(this,arguments)},onDropRejected:function(e){return(0,ek.UJ)(e,a,eT.A.ProfilePicture)},multiple:!0,maxSize:eP.xC},(0,ez.Z8)(ez.KL))),f=p.open,m=p.getInputProps;return(0,O.jsx)("div",{className:"flex w-full items-center justify-center gap-4",children:(0,O.jsxs)(eb.fC,{children:[(0,O.jsx)(eb.xz,{className:"h-20 w-20",children:i?(0,O.jsx)(eG,{}):null!=l&&"initial"!=l&&l.status!=eT.X.Ready?(0,O.jsxs)("div",{className:"relative h-full w-full overflow-hidden rounded-full",children:[(0,O.jsx)(eN.l,{file:l.file}),l.status===eT.X.Uploading&&l.progress<90?(0,O.jsx)("div",{className:"absolute inset-0 flex items-center justify-center bg-black/5 text-white",children:(0,O.jsx)(ew.Z,{percentage:l.progress,className:"h-6 w-6"})}):null]}):(null==t?void 0:t.profilePictureUrl)!=null&&(null==t?void 0:t.profilePictureUrl)!==""?(0,O.jsx)(eC.Z,{isFirstParty:!1,src:t.profilePictureUrl}):(0,O.jsx)("div",{className:"flex h-full w-full items-center justify-center rounded-full border-2 border-dashed border-black border-token-border-medium",children:(0,O.jsx)(ej.OvN,{className:"text-4xl"})})}),(0,O.jsx)(eb.Uv,{children:(0,O.jsxs)(eb.VY,{className:"flex min-w-[100px] max-w-xs flex-col rounded-xl border border-gray-400 bg-token-surface-primary shadow-lg dark:border-gray-700",sideOffset:7,children:[(0,O.jsxs)(eI.UA,{onClick:f,children:[(0,O.jsx)("input",eS({},m())),"Upload Photo"]}),(0,O.jsx)(eI.UA,{onClick:r,children:"Use DALL\xb7E"})]})})]})})}var eE=n(46514),eD=n(66027),eZ=n(70737),eA=n(97296),eL=n(7137),eU=n(3125),eR=n(25349),eV=n(99893);function eq(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function eF(e){for(var t=1;t0)){e.next=7;break}return e.next=7,Promise.all(t.map(function(e){var t=(0,eO.W7)(e);u.current.set(t,{tempId:t,gizmoId:n,file:e,status:eT.X.Uploading,progress:1,fileId:null,cdnUrl:null}),(0,eO.cT)((0,eO.W7)(e),e,s,{kind:w.Ei.Gizmo,gizmoId:n},{onFileUploaded:function(e,t,n){var r=u.current.get(e);null!=r&&null!=r.fileId&&(a(function(e){var t;return eF(eF({},e),{},{files:[].concat((0,x.Z)(null!==(t=e.files)&&void 0!==t?t:[]),[{file_id:r.fileId,name:r.file.name,size:r.file.size,type:r.file.type,last_modified:r.file.lastModified,file_size_tokens:null==n?void 0:n.fileTokenSize}])})}),u.current.delete(e),c(function(e){return e+1}))},onFileCreated:function(t,r,i){u.current.set(t,eF(eF({tempId:t,gizmoId:n,file:e,status:eT.X.Uploading,progress:1},u.current.get(t)),{},{fileId:r,cdnUrl:i})),c(function(e){return e+1})},onFileUploadProgress:function(e,t){var n=u.current.get(e);(null==n?void 0:n.status)===eT.X.Uploading&&u.current.set(e,eF(eF({},n),{},{progress:t})),c(function(e){return e+1})},onError:function(e){u.current.delete(e)}},{usesRetrievalIndex:null!=o&&(0,ez._0)(o,e.type,e.name)===w.Cd.Retrieval})}));case 7:case"end":return e.stop()}},e)})),function(e){return t.apply(this,arguments)}),f=(0,ey.uI)(eF({disabled:!1,noClick:!0,onDropAccepted:p,multiple:!0,maxSize:eP.xC,maxFiles:10},(0,ez.Z8)(d))),m=f.getInputProps,h=f.open,g=null!==(n=null==r?void 0:r.files)&&void 0!==n?n:[];function b(e){return(0,O.jsx)(eN.Z,{onRemoveFileClick:function(){u.current.delete(e.tempId),c(function(e){return e+1})},file:e.file,loadingPercentage:e.status===eT.X.Uploading?e.progress:void 0},e.tempId)}function y(e){return(0,O.jsx)(eN.Z,{file:e.name,fileId:e.file_id,onRemoveFileClick:function(){return a(function(t){var n;return eF(eF({},t),{},{files:null==t?void 0:null===(n=t.files)||void 0===n?void 0:n.filter(function(t){return t.file_id!==e.file_id})})})},gizmoId:null==r?void 0:r.id},e.file_id)}var P=Array.from(u.current.values()).filter(function(e){return g.every(function(t){return t.file_id!==e.fileId})}),k=(0,K.partition)(P,function(e){return null!=o&&(0,ez._0)(o,e.file.type,e.file.name)===w.Cd.CodeInterpreter}),N=(0,eU.Z)(k,2),T=N[0],z=N[1],C=(0,K.partition)(g,function(e){return null!=o&&null!=e.type&&(0,ez._0)(o,e.type,e.name)===w.Cd.CodeInterpreter}),I=(0,eU.Z)(C,2),_=I[0],S=I[1],G=(0,q.useRef)(_.length);return(0,q.useEffect)(function(){_.length>G.current&&a(function(e){var t,n;return null!==(t=e.tools)&&void 0!==t&&t.some(function(e){return e.type===w.qK.PYTHON})?e:eF(eF({},e),{},{tools:[].concat((0,x.Z)(null!==(n=e.tools)&&void 0!==n?n:[]),[{type:w.qK.PYTHON}])})}),G.current=_.length},[_.length]),(0,O.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,O.jsx)("div",{className:"rounded-lg text-gray-500",children:(0,O.jsx)(en.Z,eF({},eW.knowledgeWarning))}),z.length>0||S.length>0?(0,O.jsxs)("div",{className:"flex flex-wrap gap-2",children:[z.map(b),S.map(y)]}):null,T.length>0||_.length>0?(0,O.jsxs)("div",{children:[(0,O.jsx)("div",{className:"mb-2 text-xs text-gray-500",children:"The following files are only available for Code Interpreter:"}),(0,O.jsxs)("div",{className:"flex flex-wrap gap-2",children:[T.map(b),_.map(y)]})]}):null,(0,O.jsx)("div",{children:(0,O.jsxs)(eI.cY,{onClick:h,children:[(0,O.jsx)("input",eF({},m())),"Upload files"]})})]})}var eW=(0,ep.vU)({knowledgeWarning:{id:"gizmo.knowledgeWarning",defaultMessage:"If you upload files under Knowledge, conversations with your GPT may include file contents. Files can be downloaded when Code Interpreter is enabled"}});function eH(e){var t=e.placeholder,n=e.text,r=e.onChange,i=e.onClose;return(0,O.jsx)(N.Z,{className:"!max-h-[100vh] !max-w-[80vw]",type:"success",isOpen:!0,onClose:i,primaryButton:(0,O.jsx)(eI.cY,{onClick:i,children:"Close"}),children:(0,O.jsx)("textarea",{className:"h-[70vh] w-full resize-none rounded-lg dark:border-gray-700 dark:bg-gray-800",value:n,onChange:function(e){r(e.target.value)},placeholder:t})})}function eK(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function eJ(e){var t=e.label,n=e.toolType,r=e.enabledTools,i=e.onEnabledToolsChange,o=e.disabled,a=e.disabledTooltip,s=function(e){return r.some(function(t){return t.type===e})},l=(0,O.jsx)(eI.f8,{labelClassName:"w-full cursor-pointer",id:n,label:t,checked:!o&&s(n),disabled:o,onChange:function(){s(n)?i(r.filter(function(e){return e.type!==n})):i([].concat((0,x.Z)(r),[{type:n}]))}});return null!=a?(0,O.jsx)("div",{className:"opacity-70",children:(0,O.jsx)(ev.u,{side:"top",label:a,children:l})}):l}function eY(e){var t=e.enabledTools,n=e.onEnabledToolsChange,r=(0,P.C)(Z.L0.BrowseAvailable);return(0,O.jsxs)("div",{className:"flex flex-col items-start gap-2",children:[(0,O.jsx)(eJ,{label:"Web Browsing",toolType:w.qK.BROWSER,enabledTools:t,onEnabledToolsChange:n,disabled:!r,disabledTooltip:r?void 0:(0,O.jsx)(en.Z,function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);nex.aI,i=(null!==(c=null===(u=e.description)||void 0===u?void 0:u.length)&&void 0!==c?c:0)>ex.P_,o=(null!==(d=null===(p=e.welcomeMessage)||void 0===p?void 0:p.length)&&void 0!==d?d:0)>ex.Lu,a=(null!==(f=null===(m=e.instructions)||void 0===m?void 0:m.length)&&void 0!==f?f:0)>ex.vi,l=[];if((null==e?void 0:e.name)===""&&l.push(s.NameEmpty),r&&l.push(s.GizmoNameTooLong),i&&l.push(s.GizmoDescriptionTooLong),a&&l.push(s.GizmoInstructionsTooLong),o&&l.push(s.GizmoWelcomeMessageTooLong),null!=t&&[G.Zz.Link,G.Zz.Marketplace].includes(t)){var c,u,d,p,f,m,h,g,v=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return e$(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e$(e,t)}}(e))){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}(null===(h=e.tools)||void 0===h?void 0:h.filter(function(e){return e.type===w.qK.JIT_PLUGIN}));try{for(v.s();!(g=v.n()).done;){var x,b=g.value,y=null===(x=b.metadata)||void 0===x?void 0:x.privacy_policy_url;if(null==y||!function(e){try{return new URL(e),!0}catch(e){return!1}}(y)){l.push(s.MissingPublicActionPrivacyPolicyURL);break}}}catch(e){v.e(e)}finally{v.f()}}return t===G.Zz.Marketplace&&null==n&&l.push(s.MissingCategory),l}function e3(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function e5(e){for(var t=1;t=ex.L5?(0,O.jsx)("div",{children:s.formatMessage(ts.maxActionsReached,{number:ex.L5})}):(0,O.jsx)(eI.cY,{disabled:a,onClick:function(){o("Unknown domain")},className:"mt-2",children:(0,O.jsx)(en.Z,e5({},ts.createActionLabel))})]});return a?(0,O.jsx)(ev.u,{side:"top",label:s.formatMessage(ts.disabledCustomActionsTooltip),children:l}):l}function ta(e){var t,n,r,i,o,a,l,c,u,d,p=e.gizmoEditorData,f=e.updateGizmo,m=e.generateProfilePic,h=e.setIsUploadingProfilePic,g=e.isGeneratingProfilePic,b=e.setIsGeneratingProfilePic,y=e.requireGizmoId,k=e.onShowActionsEditor,N=(0,eE.B9)(),T=eE.mx,z=null!==(o=null==p?void 0:p.tools)&&void 0!==o?o:[],C=T?N[T]:void 0,I=(0,q.useState)(!1),_=I[0],S=I[1],G=(0,q.useState)(!1),M=G[0],E=G[1],D=(0,q.useState)(!0),A=D[0],U=D[1],R=null!==(a=null==p?void 0:p.promptStarters)&&void 0!==a?a:[],V=[].concat((0,x.Z)(R),(0,x.Z)(R.length<12?[""]:[])),F=e4(p),B=(0,L.ec)(L.F_.isBusinessWorkspace),W=(0,P.C)(Z.L0.WorkspaceGPTCustomActions),J=(0,X.Z)();return(0,O.jsxs)("div",{className:"flex h-full grow flex-col overflow-y-auto px-2 pt-6 text-sm",children:[(0,O.jsxs)("div",{className:"grow",children:[(0,O.jsxs)(e6,{children:[(0,O.jsx)(eM,{gizmoEditorData:p,generateProfilePic:m,isGeneratingProfilePic:g,setIsGeneratingProfilePic:b,onFileChange:(t=(0,v.Z)(j().mark(function e(t){var n;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(null!=t&&"uploading"!==t&&null!=t.fileId)){e.next=7;break}return e.next=3,eD.ZP.getFileDownloadLink(t.fileId);case 3:(n=e.sent).status===w.KF.Success&&f({profilePictureId:null!=t.fileId?t.fileId:void 0,profilePictureUrl:n.download_url}),e.next=8;break;case 7:f({profilePictureId:void 0,profilePictureUrl:void 0});case 8:h("uploading"===t);case 9:case"end":return e.stop()}},e)})),function(e){return t.apply(this,arguments)})}),(0,O.jsx)(tn,{label:"Name",description:"The name of your GPT"}),(0,O.jsx)(e8,{type:"text",placeholder:"Name your GPT",value:null!==(l=null==p?void 0:p.name)&&void 0!==l?l:"",onChange:function(e){f({name:e.target.value})},onBlurCapture:function(){return f(function(e){return e5(e5({},e),{},{name:e.name.trim()})})}}),F.includes(s.GizmoNameTooLong)?(0,O.jsx)(e9,{className:"mt-1",children:(0,O.jsx)(en.Z,e5(e5({},ts.nameTooLong),{},{values:{length:ex.aI}}))}):null]}),(0,O.jsxs)(e6,{className:"mt-4",children:[(0,O.jsx)(tn,{label:"Description",description:"Short description of what this GPT does"}),(0,O.jsx)(e8,{type:"text",placeholder:"Add a short description about what this GPT does",value:null!==(c=null==p?void 0:p.description)&&void 0!==c?c:"",onChange:function(e){return f({description:e.target.value})},onBlurCapture:function(){return f(function(e){var t,n;return e5(e5({},e),{},{description:null!==(t=null===(n=e.description)||void 0===n?void 0:n.trim())&&void 0!==t?t:""})})}}),F.includes(s.GizmoDescriptionTooLong)?(0,O.jsx)(e9,{className:"mt-1",children:(0,O.jsx)(en.Z,e5(e5({},ts.descriptionTooLong),{},{values:{length:ex.P_}}))}):null]}),(0,O.jsxs)(e6,{children:[(0,O.jsx)(tn,{label:"Instructions",description:"What does this GPT do? How does it behave? What should it avoid doing?"}),(0,O.jsxs)("div",{className:"relative",children:[(0,O.jsx)(e7,{className:"resize-none",rows:8,value:null==p?void 0:p.instructions,onChange:function(e){return f({instructions:e.target.value})},onBlurCapture:function(){return f(function(e){return e5(e5({},e),{},{instructions:e.instructions.trim()})})},placeholder:"What does this GPT do? How does it behave? What should it avoid doing?"}),(0,O.jsx)("button",{className:"absolute bottom-3 right-2 text-token-text-tertiary",onClick:function(){return S(!0)},children:(0,O.jsx)(et.j5,{className:"icon-sm"})})]}),F.includes(s.GizmoInstructionsTooLong)?(0,O.jsx)(e9,{className:"mt-1",children:(0,O.jsx)(en.Z,e5(e5({},ts.instructionsTooLong),{},{values:{length:ex.vi}}))}):null]}),(0,O.jsxs)(e6,{className:"hidden",children:[(0,O.jsx)(tn,{label:"Welcome Message",description:"How this GPT starts conversations."}),(0,O.jsxs)("div",{className:"relative",children:[(0,O.jsx)(e7,{className:(0,H.default)("h-16 resize-none"),value:null==p?void 0:p.welcomeMessage,onChange:function(e){return f({welcomeMessage:e.target.value})},placeholder:"How this GPT starts conversations."}),(0,O.jsx)("button",{className:"absolute bottom-3 right-2 text-token-text-tertiary",onClick:function(){return E(!0)},children:(0,O.jsx)(et.j5,{className:"icon-sm"})})]}),F.includes(s.GizmoWelcomeMessageTooLong)?(0,O.jsx)(e9,{className:"mt-1",children:(0,O.jsx)(en.Z,e5(e5({},ts.welcomeMessageTooLong),{},{values:{length:ex.Lu}}))}):null]}),(0,O.jsxs)(e6,{children:[(0,O.jsx)(tn,{label:"Conversation starters",description:"Examples for the user to start the conversation"}),(0,O.jsx)("div",{className:"flex flex-col gap-1",children:V.map(function(e,t){return(0,O.jsxs)("div",{className:"flex items-center",children:[(0,O.jsx)(e8,{className:"rounded-r-none",value:e,type:"text",onChange:function(e){var n=e.target.value;f(function(e){var r;return e5(e5({},e),{},{promptStarters:(0,K.compact)(t>=(null!==(r=R.length)&&void 0!==r?r:0)?[].concat((0,x.Z)(null!=R?R:[]),[n]):R.map(function(e,r){if(r===t){if(""===n)return;return n}return e}))})})}}),(0,O.jsx)("button",{className:"flex h-9 w-9 items-center justify-center rounded-lg rounded-l-none border border-l-0 border-token-border-medium",onClick:function(){return f(function(e){return e5(e5({},e),{},{promptStarters:R.filter(function(e,n){return n!==t})})})},children:(0,O.jsx)(et.v7,{className:"icon-sm"})})]},t)})})]}),(0,O.jsxs)(e6,{children:[(0,O.jsx)(tn,{label:"Knowledge",description:J.formatMessage(ts.knowledgeExplanation)}),(0,O.jsx)(eB,{gizmoEditorData:p,requireGizmoId:y,currentModelConfig:C,updateGizmo:f})]}),(0,O.jsxs)(e6,{children:[(0,O.jsx)(tn,{label:"Capabilities",description:"Functionality this GPT can use"}),(0,O.jsx)(eY,{enabledTools:z,onEnabledToolsChange:function(e){return f({tools:e})}})]}),(0,O.jsxs)(e6,{children:[(0,O.jsx)(tn,{label:"Actions",description:"APIs this GPT can use"}),(0,O.jsx)(to,{isDisabled:!!(B&&!W),gizmo:p,onShowActionsEditor:k})]}),!B&&((null!==(n=null===(r=p.files)||void 0===r?void 0:r.length)&&void 0!==n?n:0)>0||(null==p?void 0:null===(i=p.tools)||void 0===i?void 0:i.some(function(e){return e.type===w.qK.JIT_PLUGIN})))&&(0,O.jsxs)(e6,{children:[(0,O.jsx)(tn,{label:"Additional Settings",collapsed:!!A,onClick:function(){U(function(e){return!e})}}),(0,O.jsx)(tr,{collapsed:A,initial:!1,children:(0,O.jsx)(eI.f8,{className:"mx-3 my-1",labelClassName:"w-full cursor-pointer",label:"Use conversation data in your GPT to improve our models",id:"improve-chatgpt",checked:!p.trainingDisabled,onChange:function(){f({trainingDisabled:!p.trainingDisabled})}})})]})]}),M&&(0,O.jsx)(eH,{text:null!==(u=p.welcomeMessage)&&void 0!==u?u:"",onChange:function(e){f({welcomeMessage:e})},onClose:function(){return E(!1)},placeholder:"How this GPT starts conversations."}),_&&(0,O.jsx)(eH,{text:null!==(d=p.instructions)&&void 0!==d?d:"",onChange:function(e){f({instructions:e})},onClose:function(){return S(!1)},placeholder:"What does this GPT do? How does it behave? What should it avoid doing?"})]})}var ts=(0,ep.vU)({nameTooLong:{id:"gizmo.nameTooLong",defaultMessage:"GPT names cannot be longer than {length} characters."},knowledgeExplanation:{id:"gizmo.knowledgeExplanation",defaultMessage:"Additional files for this GPT to reference."},descriptionTooLong:{id:"gizmo.descriptionTooLong",defaultMessage:"GPT descriptions cannot be longer than {length} characters."},instructionsTooLong:{id:"gizmo.instructionsTooLong",defaultMessage:"GPT instructions cannot be longer than {length} characters."},welcomeMessageTooLong:{id:"gizmo.welcomeMessageTooLong",defaultMessage:"GPT welcome messages cannot be longer than {length} characters."},disabledCustomActionsTooltip:{id:"gizmo.disabledCustomActionsTooltip",defaultMessage:"Custom actions are disabled for your workspace. Contact your admin to enable them."},createActionLabel:{id:"gizmo.createActionLabel",defaultMessage:"Create new action"},maxActionsReached:{id:"gizmo.maxActionsReached",defaultMessage:"GPTs can have a maximum of {number} actions"}}),tl=n(9559),tc=n(85695);function tu(e){var t=e.clientThreadId,n=(0,A.oq)(t),r=(0,A.U0)(t,n),i=(0,A.Ro)(t),o=(0,x.Z)(Array(r).keys()).map(function(e){var o;return(0,O.jsx)(tc.Z,{isFinalTurn:e===r-1,turnIndex:e,clientThreadId:t,conversationLeafId:n,onChangeItemInView:K.noop,onChangeRating:K.noop,onRequestMoreCompletions:K.noop,onRequestCompletion:K.noop,currentModelId:null!==(o=null==i?void 0:i.id)&&void 0!==o?o:""},e)});return(0,O.jsx)(O.Fragment,{children:o})}function td(e){var t=e.clientThreadIds;return(0,O.jsx)(O.Fragment,{children:t.map(function(e){return(0,O.jsx)(tu,{clientThreadId:e},e)})})}var tp=n(75499),tf=n(82282),tm=n(13366),th=n(18008),tg=n(58272),tv=n(99304),tx=n(84623),tb=n(8844),ty=n(24047),tj=n(90439),tw=n(67404);function tP(){return(0,O.jsxs)("div",{className:"flex items-center",children:[(0,O.jsx)("div",{className:"border-token-border-secondary flex-grow border-b"}),(0,O.jsxs)("div",{className:"flex flex-shrink-0 items-center gap-2 px-2 py-6 text-sm text-token-text-tertiary",children:[(0,O.jsx)(ej.V7f,{}),"GPT updated"]}),(0,O.jsx)("div",{className:"border-token-border-secondary flex-grow border-b"})]})}(i=p||(p={}))[i.MAGIC=1]="MAGIC",i[i.SANDBOX=2]="SANDBOX",(f||(f={})).TestGizmoAction="test_gizmo_action";var tk=new tv.V,tN=q.memo(function(e){var t,n,r,i=e.gizmoEditorData,o=e.isSavingDraft,a=e.showTitle,s=(0,q.useState)(function(){return(0,A.OX)()}),l=s[0],c=s[1],u=(0,q.useState)([]),d=u[0],p=u[1];(0,q.useEffect)(function(){p(function(e){return e[e.length-1]===l?e:[].concat((0,x.Z)(e),[l])})},[l]);var f=d.slice(0,-1);(0,A.ax)(l);var m=(0,A.UL)(l);(0,q.useEffect)(function(){null!=i.id&&A.tQ.setNewThreadConversationModeMetadata(l,{kind:$.OL.GizmoTest,gizmo_id:i.id})},[l,i.id]);var h=null===(r=i.files)||void 0===r?void 0:r.map(function(e){return e.file_id}).join();(0,q.useEffect)(function(){null!=A.tQ.getServerThreadId(l)&&c((0,A.OX)())},[i.id,i.instructions,i.welcomeMessage,i.tools,h,l]),(0,q.useEffect)(function(){(0,A.Zz)(l)&&A.iN.hasThread(l)&&m.lastModelUsed!==eE.mx&&(A.tQ.getOrInitThread(l),A.tQ.updateInitialThreadDataForNewThread(l,eE.mx,[]))},[l,m,i]);var g=(0,th.tN)(function(e){return e.activeSidebar}),b=(0,q.useMemo)(function(){return{gizmoEditorData:i,mode:"test"}},[i]),y=(0,q.useState)(0),w=y[0],P=y[1],k=function(){P(function(e){return e-360})},N=i.id,T=(n=(0,ty.Z)(l,void 0,K.noop,K.noop,K.noop,[]),(0,q.useCallback)((t=(0,v.Z)(j().mark(function e(t,r,i){var o,a,s,c,u,d;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(o=A.tQ.getThreadCurrentLeafId(l),a=(0,tb.Z)(),A.tQ.updateTree(l,function(e){e.addNodeToEnd(o,{id:a,children:[],parentId:o,message:{id:a,author:{role:$.uU.User},content:{content_type:$.PX.Text,parts:["Call the ".concat(r," API with the ").concat(i," operation")]},recipient:"all",metadata:{jit_plugin_data:{from_client:{user_action:{data:{type:"test",operation:i,tool_name:(0,tl.VN)(r)}}}}}}})}),s={conversationMode:{kind:$.OL.GizmoTest,gizmo_id:t}},c=[eE.S.GPT_4],u=(0,tx.Rr)((0,D.N$)(),c,$.OL.GizmoTest),d=null,!u){e.next=11;break}return e.next=10,tx.ZP.getEnforcementToken(c);case 10:d=e.sent;case 11:n({model:eE.mx,completionType:$.Os.Next,parentNodeId:a,metadata:{},focusOnNewCompletion:!0,arkoseToken:d,preflightTime:0,completionMetadata:s,extraStreamParams:{}});case 12:case"end":return e.stop()}},e)})),function(e,n,r){return t.apply(this,arguments)}),[l,n]));return(0,q.useEffect)(function(){return(0,tg.LW)(tk,{test_gizmo_action:function(e){var t=e.rootDomain,n=e.operationName;N&&T(N,t,n)}})},[T,N]),(0,O.jsx)(tj.D.Provider,{value:b,children:(0,O.jsxs)("div",{className:(0,H.default)("flex h-full w-full",o&&"cursor-wait opacity-80 transition"),children:[(0,O.jsxs)("div",{className:"flex grow flex-col",children:[(0,O.jsx)("div",{className:"relative mb-2 flex-shrink-0",children:(0,O.jsx)("div",{className:"flex justify-center py-1",children:(void 0===a||a)&&(0,O.jsxs)("div",{className:"group flex items-center gap-2 text-lg font-medium",children:[(0,O.jsx)("div",{className:"icon-md"}),(0,O.jsxs)("button",{onClick:function(){k(),p([]),c((0,A.OX)())},className:"flex items-center gap-2",children:["Preview",(0,O.jsx)(eA.E.div,{className:"text-token-text-primary",animate:{rotate:w},transition:{duration:.3},children:(0,O.jsx)(et.u8,{className:"icon-md invisible group-hover:visible"})})]})]})})}),(0,O.jsx)("div",{className:(0,H.default)("relative grow overflow-auto px-2",o&&"pointer-events-none"),children:(0,O.jsx)(tf.Z,{initialThreadData:m,clientThreadId:l,hideHeader:!0,renderEmptyState:(0,O.jsxs)("div",{className:"relative h-full w-full",children:[null!=f&&f.length>0&&(0,O.jsx)("div",{className:"h-full w-full opacity-20",children:(0,O.jsxs)(tm.I,{children:[(0,O.jsx)(td,{clientThreadIds:f}),(0,O.jsx)(tP,{})]})}),(0,O.jsx)("div",{className:"absolute left-0 top-0 h-full w-full",children:(0,O.jsx)(tw.r,{gizmo:i,isOwner:!0,hideOwner:!0})})]}),prependThreadChildren:f.length>0&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)("div",{className:"opacity-50",children:(0,O.jsx)(td,{clientThreadIds:f})}),(0,O.jsx)(tP,{})]})})})]}),"debug"===g&&(0,O.jsx)(tp.fv,{clientThreadId:l,slideOver:!1,onClose:function(){return th.vm.toggleActiveSidebar("debug")},isOpen:!0})]})})}),tT=["oauth_client_id","oauth_client_secret"],tO=["api_key"];function tz(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function tC(e){for(var t=1;t",type:"password",value:z.apiKeyValue,onChange:function(e){I({apiKeyValue:e.target.value})},className:"mb-2"}),(0,O.jsx)(t_,{children:"Auth Type"}),(0,O.jsxs)(eu.Root,{className:"mb-2 flex gap-6 overflow-hidden rounded-lg",value:z.httpAuthTypeValue,required:!0,onValueChange:function(e){I({httpAuthTypeValue:e})},children:[(0,O.jsx)(eI.Xb,{value:"basic",label:"Basic"}),(0,O.jsx)(eI.Xb,{value:"bearer",label:"Bearer"}),(0,O.jsx)(eI.Xb,{value:"custom",label:"Custom"})]}),"custom"===z.httpAuthTypeValue&&(0,O.jsxs)("div",{className:"mt-2",children:[(0,O.jsx)(t_,{children:"Custom Header Name"}),(0,O.jsx)(e8,{value:z.customHeaderValue,onChange:function(e){I({customHeaderValue:e.target.value})},className:"mb-2",placeholder:"X-Api-Key"})]})]}):"oauth"===z.authTypeValue?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(t_,{children:"Client ID"}),(0,O.jsx)(e8,{placeholder:"",type:"password",value:z.oauthClientIdValue,onChange:function(e){I({oauthClientIdValue:e.target.value})},className:"mb-2"}),(0,O.jsx)(t_,{children:"Client Secret"}),(0,O.jsx)(e8,{placeholder:"",type:"password",value:z.oauthClientSecretValue,onChange:function(e){I({oauthClientSecretValue:e.target.value})},className:"mb-2"}),(0,O.jsx)(t_,{children:"Authorization URL"}),(0,O.jsx)(e8,{value:z.oauthAuthUrlValue,onChange:function(e){I({oauthAuthUrlValue:e.target.value})},className:"mb-2"}),(0,O.jsx)(t_,{children:"Token URL"}),(0,O.jsx)(e8,{value:z.oauthTokenUrlValue,onChange:function(e){I({oauthTokenUrlValue:e.target.value})},className:"mb-2"}),(0,O.jsx)(t_,{children:"Scope"}),(0,O.jsx)(e8,{value:z.oauthScopeValue,onChange:function(e){I({oauthScopeValue:e.target.value})},className:"mb-2"}),(0,O.jsx)(t_,{children:"Token Exchange Method"}),(0,O.jsxs)(eu.Root,{value:z.tokenExchangeMethodValue,required:!0,onValueChange:function(e){I({tokenExchangeMethodValue:e})},children:[(0,O.jsx)(eI.Xb,{value:"default_post",label:"Default (POST request)"}),(0,O.jsx)(eI.Xb,{value:"basic_auth_header",label:"Basic authorization header"})]})]}):null]})}function tG(e){var t=e.onImport,n=e.onClose,r=(0,q.useState)(""),i=r[0],o=r[1],a=(0,q.useState)(!1),s=a[0],l=a[1];function c(){return(c=(0,v.Z)(j().mark(function e(){var r,o;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:e.prev=0,o=new URL(i),e.next=7;break;case 4:return e.prev=4,e.t0=e.catch(0),e.abrupt("return");case 7:if(!(null!==(r=o)&&void 0!==r&&r.hostname)){e.next=18;break}return l(!0),e.prev=9,e.next=12,T.U.fetchOpenAPISpec(i);case 12:t(e.sent.content),n();case 15:return e.prev=15,l(!1),e.finish(15);case 18:case"end":return e.stop()}},e,null,[[0,4],[9,,15,18]])}))).apply(this,arguments)}return(0,O.jsxs)("div",{className:"flex items-center gap-2",children:[(0,O.jsx)("input",{name:"url",value:i,onChange:function(e){o(e.target.value)},placeholder:"https://...",className:"h-8 rounded border border-token-border-light px-2 text-sm",autoFocus:!0}),(0,O.jsx)(eI.cY,{color:"dark",loading:s,onClick:function(){return c.apply(this,arguments)},children:"Import"}),(0,O.jsx)(eI.cY,{color:"neutral",onClick:n,children:"Cancel"})]})}function tM(e){var t=e.rootDomain,n=e.operations;return null==n||0===n.length?(0,O.jsx)("div",{className:"text-sm text-token-text-tertiary",children:"Operations in your schema will show here."}):(0,O.jsx)("table",{className:"w-full text-sm",children:(0,O.jsxs)("tbody",{children:[(0,O.jsxs)("tr",{className:"border-b border-token-border-light text-left text-xs text-token-text-tertiary",children:[(0,O.jsx)("th",{className:"py-1 font-normal",children:"Name"}),(0,O.jsx)("th",{className:"py-1 font-normal",children:"Method"}),(0,O.jsx)("th",{className:"py-1 font-normal",children:"Path"}),(0,O.jsx)("th",{className:"py-1 font-normal"})]}),n.map(function(e){return(0,O.jsxs)("tr",{className:"border-b border-token-border-light",children:[(0,O.jsx)("td",{className:"py-2",children:e.operationName}),(0,O.jsx)("td",{className:"py-2 uppercase",children:e.method}),(0,O.jsx)("td",{className:"py-2",children:e.path}),(0,O.jsx)("td",{className:"py-2",children:(0,O.jsx)(eI.cY,{color:"neutral",onClick:function(){t&&tk.publish({kind:f.TestGizmoAction,rootDomain:t,operationName:e.operationName})},children:"Test"})})]},e.operationName)})]})})}function tE(e){var t=e.validationResponse;return(0,O.jsxs)("div",{children:[(0,O.jsx)(tn,{label:"Available actions"}),(0,O.jsx)(tM,{rootDomain:t.success?t.spec.root_domain:void 0,operations:t.success?t.spec.operations:void 0})]})}function tD(e){var t,n,r,i,o,a,s,l,c=e.currentlyEditingActionDomain,u=e.gizmoEditorData,d=e.updateGizmo,p=e.onClose,f=(0,q.useState)(c),m=f[0],h=f[1],g=(0,q.useRef)(m);(0,q.useEffect)(function(){g.current=m},[m]);var b=null==u?void 0:null===(t=u.tools)||void 0===t?void 0:t.find(function(e){return e.type===w.qK.JIT_PLUGIN&&e.metadata.domain===m}),y=(0,q.useState)(function(){return null==b})[0],P=null!==(n=null==b?void 0:null===(r=b.metadata)||void 0===r?void 0:r.raw_spec)&&void 0!==n?n:"",k=(0,q.useState)(!1),N=k[0],z=k[1],C=(0,q.useState)(!1),I=C[0],_=C[1];function S(e){d(function(t){return tC(tC({},t),{},{tools:b?t.tools.map(function(t){return t.type===w.qK.JIT_PLUGIN&&t.metadata.domain===m?tC(tC({},t),{},{metadata:tC(tC({},t.metadata),e)}):t}):[].concat((0,x.Z)(t.tools),[{type:w.qK.JIT_PLUGIN,metadata:tC({raw_spec:"",domain:null!=m?m:"Unknown domain",action_id:""},e)}])})})}var G=(0,q.useState)(),M=G[0],E=G[1],D=(0,q.useState)(function(){var e;return(0,K.debounce)((e=(0,v.Z)(j().mark(function e(t){var n,r,i,o;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,T.U.validateOpenAPISpec(t);case 2:if(E(n=e.sent),!(r=n.success?n.spec.root_domain:void 0)){e.next=13;break}if(!(r!==g.current)||!(null==u?void 0:null===(i=u.tools)||void 0===i?void 0:i.find(function(e){return e.type===w.qK.JIT_PLUGIN&&e.metadata.domain===r}))){e.next=11;break}return E({success:!1,errors:["Action sets cannot have duplicate domains - ".concat(r," already exists on another action")]}),e.abrupt("return");case 11:d(function(e){return tC(tC({},e),{},{tools:e.tools.map(function(e){return e.type===w.qK.JIT_PLUGIN&&e.metadata.domain===g.current?tC(tC({},e),{},{metadata:tC(tC({},e.metadata),{},{domain:r})}):e})})}),h(r);case 13:n.success&&n.known_auth&&n.known_privacy_policy&&(o=tC({type:$.Jv.OAuth},n.known_auth),(0,K.isEqual)(b.metadata.auth,o)||S({auth:tC({type:$.Jv.OAuth},n.known_auth)}),b.metadata.privacy_policy_url!==n.known_privacy_policy&&S({privacy_policy_url:n.known_privacy_policy}));case 14:case"end":return e.stop()}},e)})),function(t){return e.apply(this,arguments)}),1e3)})[0],Z=null!=M?M.success?M.warnings:M.errors:void 0;(0,q.useEffect)(function(){""===P?(E(void 0),D.cancel()):D(P)},[D,P]);var A=function(e){try{S({raw_spec:JSON.stringify(JSON.parse(e),null,2)})}catch(t){try{S({raw_spec:er.ZP.stringify(er.ZP.parse(e),{lineWidth:120,indent:2})})}catch(e){}}};return(0,O.jsxs)("div",{className:"h-full overflow-auto px-4 pb-12 text-sm",children:[(0,O.jsxs)("div",{className:"relative flex flex-col items-center px-16 py-6 text-center",children:[(0,O.jsx)("div",{className:"absolute left-0 top-6",children:(0,O.jsx)(ee.z,{color:"neutral",onClick:p,children:(0,O.jsx)(et.L7,{className:"icon-md"})})}),null!=b&&(0,O.jsx)("div",{className:"absolute right-0 top-6",children:(0,O.jsx)(ee.z,{color:"neutral",onClick:function(){window.confirm("Are you sure you want to delete this action?")&&(d(function(e){return tC(tC({},e),{},{tools:e.tools.filter(function(e){return e.type!==w.qK.JIT_PLUGIN||e.metadata.domain!==m})})}),p())},className:"text-red-500",children:(0,O.jsx)(et.a_,{className:"icon-md"})})}),(0,O.jsx)("div",{className:"text-xl font-medium",children:y?"Add actions":"Edit actions"}),(0,O.jsx)("div",{className:"text-sm text-token-text-tertiary",children:"Let your GPT retrieve information or take actions outside of ChatGPT."}),(0,O.jsx)("div",{className:"text-sm text-token-text-tertiary",children:(0,O.jsx)("a",{href:"https://help.openai.com/en/articles/8554397-creating-a-gpt",target:"_blank",rel:"noreferrer",className:"font-medium",children:"Learn more."})})]}),(0,O.jsxs)(e6,{className:"relative",children:[(0,O.jsx)(tn,{label:"Authentication"}),(0,O.jsx)(ed,{onClick:function(){z(!0)},content:function(e){switch(e){case $.Jv.None:return"None";case $.Jv.OAuth:return"OAuth";case $.Jv.ServiceHTTP:return"API Key"}}(null!==(i=null==b?void 0:null===(o=b.metadata)||void 0===o?void 0:null===(a=o.auth)||void 0===a?void 0:a.type)&&void 0!==i?i:$.Jv.None),button:(0,O.jsx)("button",{color:"neutral",className:"flex items-center gap-2 px-3",children:(0,O.jsx)(et.RR,{className:"icon-sm"})})}),N&&(0,O.jsx)(tS,{jitPluginTool:b,onUpdateTool:function(e){switch(e.type){case $.Jv.None:S({auth:{type:$.Jv.None}});break;case $.Jv.OAuth:var t=e.oauth_client_id,n=e.oauth_client_secret;S({auth:(0,Q.Z)(e,tT),oauth_client_id:t,oauth_client_secret:n});break;case $.Jv.ServiceHTTP:var r=e.api_key;S({auth:(0,Q.Z)(e,tO),api_key:r})}},onClose:function(){z(!1)}})]}),(0,O.jsxs)("div",{children:[(0,O.jsxs)("div",{className:"mb-1 flex h-8 items-center justify-between",children:[(0,O.jsx)("label",{className:"font-medium text-token-text-primary",children:"Schema"}),(0,O.jsx)("div",{className:"flex items-center",children:I?(0,O.jsx)(tG,{onImport:function(e){A(e)},onClose:function(){_(!1)}}):(0,O.jsxs)("div",{className:"flex items-center gap-2",children:[(0,O.jsx)(eI.cY,{color:"neutral",onClick:function(){_(!0)},children:"Import from URL"}),(0,O.jsx)(ef,{onSelectExample:function(e){S({raw_spec:e})}})]})})]}),(0,O.jsxs)("div",{className:"mb-8 overflow-hidden rounded-lg border border-token-border-light",children:[(0,O.jsxs)("div",{className:"relative",children:[(0,O.jsx)("textarea",{value:P,onChange:function(e){S({raw_spec:e.target.value})},spellCheck:!1,placeholder:"Enter your OpenAPI schema here",className:"block h-96 w-full border-none bg-transparent p-2 font-mono text-xs text-token-text-primary"}),(0,O.jsx)("div",{className:"absolute bottom-2 right-2 flex gap-2",children:""!==P?(0,O.jsx)(eI.cY,{onClick:function(){A(P)},children:"Format"}):(0,O.jsxs)(eI.cY,{as:"a",to:tI,openNewTab:!0,children:[(0,O.jsx)(en.Z,{id:"gizmo.actions.actionsGptHelp",defaultMessage:"Get help from ActionsGPT"}),(0,O.jsx)(et.fe,{className:"icon-md"})]})})]}),null!=Z&&(null==Z?void 0:Z.length)>0&&(0,O.jsx)("div",{className:"border-t border-token-border-light p-2 text-red-500",children:Z.map(function(e,t){return(0,O.jsx)("div",{children:e},t)})})]})]}),null!=M&&(0,O.jsx)(tE,{validationResponse:M}),(0,O.jsxs)("div",{className:"mt-4",children:[(0,O.jsx)(tn,{label:"Privacy policy",description:"Privacy policy is required for all public GPTs."}),(0,O.jsx)(ei.Z,{name:"privacyPolicyUrl",value:null!==(s=null==b?void 0:null===(l=b.metadata)||void 0===l?void 0:l.privacy_policy_url)&&void 0!==s?s:"",placeholder:"https://api.example-weather-app.com/privacy",onChange:function(e){S({privacy_policy_url:e.target.value})}})]})]})}var tZ=n(87942),tA=n(6013),tL=n(20491),tU=n(37178),tR=n(34490);function tV(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function tq(e){for(var t=1;t1?e.back():e.push((0,V.L7)())}function tB(e){var t,n,r,i=e.gizmo,o=e.publishedGizmo,a=e.promoteGizmo,l=e.setStep,c=e.showActionsModal,u=(0,q.useState)(!1),d=u[0],p=u[1],f=(0,L.ec)(L.F_.isBusinessWorkspace),m=(0,X.Z)(),h=(0,q.useState)((0,g.Sg)(i)?f?G.Zz.Workspace:G.Zz.Marketplace:i.sharingRecipient),x=h[0],b=h[1],y=(0,g.WL)().data,P=(0,q.useState)(null!=o&&o.gizmo.display.categories.length>0?o.gizmo.display.categories[0]:void 0),k=P[0],N=P[1];(0,q.useEffect)(function(){N(null==o?void 0:o.gizmo.display.categories[0])},[null==o?void 0:o.gizmo.display.categories]);var z=(0,q.useState)(void 0),C=z[0],I=z[1],_=(0,q.useRef)((0,K.throttle)(function(e,t){return T.U.generateCategory(e,t)},1e3)),S=null!=y&&y.is_verified?void 0:m.formatMessage(t2.displayNameRequiredHint);x===G.Zz.Marketplace&&null!=S&&b(G.Zz.Link);var M=f&&!(null!==(t=i.allowedSharingRecipients)&&void 0!==t&&t.some(function(e){return e===G.Zz.Link})),E=e4(i,x,k),A=E.includes(s.MissingPublicActionPrivacyPolicyURL),U=i.tools.find(function(e){return e.type===w.qK.JIT_PLUGIN&&!e.metadata.privacy_policy_url}),R=(0,L.ec)(function(e){return e.currentWorkspace}),V=(0,D.hz)(),B=(0,g.Z1)();return(0,q.useEffect)(function(){if(!(null!=V&&V.includes(Z.L0.GizmoStore))){N("other");return}var e=!0;return(0,v.Z)(j().mark(function t(){var n;return j().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,!(null!=k)){t.next=3;break}return t.abrupt("return");case 3:return t.next=5,_.current(i.name,i.instructions);case 5:n=t.sent,e&&null==k&&(n?N(n.id):I(!0)),t.next=12;break;case 9:t.prev=9,t.t0=t.catch(0),e&&null==k&&I(!0);case 12:case"end":return t.stop()}},t,null,[[0,9]])}))(),function(){e=!1}},[i.instructions,i.name,V,k]),(0,O.jsxs)("div",{children:[(0,O.jsx)("div",{className:"mb-2 text-sm font-medium text-token-text-tertiary",children:(0,O.jsx)(en.Z,tq({},t2.publishTo))}),(0,O.jsxs)("div",{className:"flex flex-col gap-3 text-sm",children:[(0,O.jsxs)(F.fC,{value:x,onValueChange:function(e){return b(e)},className:"space-y-2",children:[i.allowedSharingRecipients&&i.allowedSharingRecipients.map(function(e,t){return(0,O.jsx)(eI.Xb,{value:e,disabled:e===G.Zz.Marketplace&&null!=S,tooltipText:e===G.Zz.Marketplace?null!=S?S:m.formatMessage(t2.publicSharingHint):void 0,label:(0,tl.MI)(e,R,m)},t)}),M&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(eI.Xb,{value:G.Zz.Link,disabled:!0,tooltipText:m.formatMessage(t2.workspaceDisabledHint),label:(0,tl.MI)(G.Zz.Link,R,m)}),(0,O.jsx)(eI.Xb,{value:G.Zz.Marketplace,disabled:!0,tooltipText:m.formatMessage(t2.workspaceDisabledHint),label:(0,tl.MI)(G.Zz.Marketplace,R,m)})]})]}),A&&(0,O.jsx)("div",{className:"text-xs text-red-500",children:(0,O.jsx)(en.Z,tq(tq({},t2.actionNeedsPrivacyPolicyURL),{},{values:{fixlink:function(e){return(0,O.jsx)("button",{onClick:function(){c(null==U?void 0:U.metadata.action_id)},className:"underline",children:e})}}}))}),x!==G.Zz.Private&&(0,O.jsx)(tR.QT,{gizmoAvatar:i.profilePictureUrl,gizmoName:i.name,canEdit:!0}),x===G.Zz.Marketplace&&(null==V?void 0:V.includes(Z.L0.GizmoStore))&&(C?(0,O.jsx)("div",{className:"text-xs text-red-500",children:(0,O.jsx)(en.Z,tq({},t2.categoryError))}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)("div",{className:"flex items-center justify-between text-sm font-medium text-token-text-tertiary",children:[(0,O.jsx)(en.Z,tq({},t2.categoryLabel)),(0,O.jsx)(ev.u,{label:(0,O.jsx)("span",{className:"w-36 text-xs",children:(0,O.jsx)(en.Z,tq({},t2.categoryLabelTooltip))}),side:"top",children:(0,O.jsx)(et.VX,{className:"icon-sm"})})]}),(0,O.jsx)(t0,{category:null!=k?k:"",categories:null!==(n=null===(r=B.data)||void 0===r?void 0:r.categories)&&void 0!==n?n:[],setCategory:N})]})),(0,O.jsx)(eI.cY,{color:"primary",disabled:E.length>0,loading:d,onClick:(0,v.Z)(j().mark(function e(){var t;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,p(!0),e.next=4,a(x,k);case 4:if(null!=(t=e.sent)){e.next=7;break}return e.abrupt("return");case 7:1===t.gizmo.live_version?Y().push((0,g.m_)(t)):l({type:"published",publishedGizmo:t});case 8:return e.prev=8,p(!1),e.finish(8);case 11:case"end":return e.stop()}},e,null,[[0,,8,11]])})),className:"w-full",children:(0,O.jsx)(en.Z,tq({},t2.privacyConfirm))})]})]})}function tW(e){return"".concat("https://chat.openai.com").concat((0,g.m_)(e))}function tH(e){var t=e.publishedGizmo,n=tW(t);return(0,O.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,O.jsx)("div",{className:"font-medium",children:(0,O.jsx)(en.Z,tq({},t2.publishedTitle))}),(0,O.jsxs)("div",{className:"flex gap-1 rounded bg-token-surface-secondary px-2 py-1",children:[(0,O.jsx)("div",{className:"text-ellipsis break-all line-clamp-1",children:n}),(0,O.jsx)("button",{onClick:function(){(0,tU.S)(tW(t))},className:"text-token-text-secondary transition hover:text-token-text-primary",children:(0,O.jsx)(et.dS,{className:"icon-sm"})})]}),(0,O.jsx)(eI.cY,{color:"primary",as:"link",to:n,className:"w-full",children:(0,O.jsx)(en.Z,tq({},t2.viewGPT))})]})}function tK(e){var t=e.gizmo,n=e.publishedGizmo,r=e.promoteGizmo,i=e.showActionsModal,o=(0,q.useState)({type:"privacy"}),a=o[0],s=o[1];return(0,O.jsx)("div",{className:"w-60 rounded-lg border border-token-border-medium bg-token-surface-primary p-4 text-sm",children:"privacy"===a.type?(0,O.jsx)(tB,{gizmo:t,publishedGizmo:n,promoteGizmo:r,setStep:s,showActionsModal:i}):(0,O.jsx)(tH,{publishedGizmo:a.publishedGizmo})})}function tJ(e){var t,n=e.gizmo,r=e.publishedGizmo,i=e.isLoading,o=e.isUploadingProfilePic,a=e.isGeneratingProfilePic,l=e.promoteGizmo,c=e.hasUnpublishedChanges,u=e.showActionsModal,d=null!=n?e4(n):[],p=(0,X.Z)();(null==n||i)&&d.push(s.Loading),o&&d.push(s.UploadingProfilePic),a&&d.push(s.GeneratingProfilePic);var f=(0,g.Sg)(n);return(0,O.jsxs)(tA.fC,{modal:!0,children:[(0,O.jsx)(tA.xz,{asChild:!0,children:(0,O.jsx)(eI.cY,{color:"primary",className:"cursor-pointer whitespace-nowrap",disabled:void 0===n.id,tooltip:d.length>0?d.map(e2).join("\n"):void 0,children:(0,O.jsxs)("div",{className:"flex items-center gap-1",children:[c&&!f?p.formatMessage(t2.publishChanges):p.formatMessage(t2.save),(0,O.jsx)(et.ud,{})]})})}),(0,O.jsx)(tA.h_,{children:(0,O.jsx)(tA.VY,{side:"bottom",align:"end",sideOffset:8,children:(0,O.jsx)(tK,{gizmo:n,publishedGizmo:r,promoteGizmo:l,showActionsModal:u})})})]})}function tY(e){var t=e.gizmoEditorData,n=e.publishedGizmo,r=e.revertDraft,i=(0,X.Z)(),o=(0,q.useState)(!1),a=o[0],s=o[1],l=(0,D.hz)();return null!=l&&l.includes("debug")||(null==t?void 0:t.id)!=null?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(eb.fC,{children:[(0,O.jsx)(eb.xz,{asChild:!0,children:(0,O.jsx)(eI.cY,{children:(0,O.jsx)(et.Yr,{className:"icon-md"})})}),(0,O.jsx)(eb.Uv,{children:(0,O.jsxs)(eb.VY,{className:"min-w-[180px] max-w-xs rounded-lg border border-gray-100 bg-token-surface-primary shadow-lg dark:border-gray-700",side:"top",align:"end",sideOffset:6,children:[null!=n&&(0,O.jsxs)(eI.UA,{onClick:function(){(0,tU.S)(tW(n))},children:[(0,O.jsx)(et.HN,{className:"icon-md"}),(0,O.jsx)(en.Z,tq({},t2.copyLink))]}),null!=r&&(0,O.jsxs)(eI.UA,{onClick:function(){window.confirm(i.formatMessage(t2.revertConfirm))&&r()},children:[(0,O.jsx)(et.Nt,{className:"icon-md"}),(0,O.jsx)(en.Z,tq({},t2.revertMenuItem))]}),(null==l?void 0:l.includes("debug"))&&(0,O.jsxs)(eI.UA,{onClick:function(){th.vm.toggleActiveSidebar("debug")},children:[(0,O.jsx)(et.WP,{className:"icon-md"}),"Debug (Internal only)"]}),(null==t?void 0:t.id)!=null&&(0,O.jsxs)(eI.UA,{color:"danger",onClick:function(){s(!0)},children:[(0,O.jsx)(et.a_,{className:"icon-md"}),(0,O.jsx)(en.Z,tq({},t2.deleteGPT))]})]})})]}),a&&(0,O.jsx)(tZ.b,{gizmoId:t.id,onSuccess:function(){return tF(Y())},onClose:function(){s(!1)}})]}):null}var tX=I.Z.div(m||(m=(0,C.Z)(["flex items-center gap-1"])));function tQ(e){var t=e.gizmoEditorData,n=(0,L.ec)(function(e){var t;return null===(t=e.currentWorkspace)||void 0===t?void 0:t.name});switch(t.sharingRecipient){case G.Zz.Private:return(0,O.jsxs)(tX,{children:[(0,O.jsx)(et.LX,{className:"icon-xs"}),(0,O.jsx)(en.Z,tq({},t2.onlyMe))]});case G.Zz.Link:return(0,O.jsxs)(tX,{children:[(0,O.jsx)(et.HN,{className:"icon-xs"}),(0,O.jsx)(en.Z,tq({},t2.anyoneWithLink))]});case G.Zz.Workspace:return(0,O.jsxs)(tX,{children:[(0,O.jsx)(et.oq,{className:"icon-xs"}),n]});case G.Zz.Marketplace:return(0,O.jsxs)(tX,{children:[(0,O.jsx)(et.hk,{className:"icon-xs"}),(0,O.jsx)(en.Z,tq({},t2.public))]})}return(0,O.jsx)("div",{})}function t$(e){var t=e.gizmoEditorData;return(0,O.jsxs)("div",{className:"flex items-center gap-2",children:[null!=t.profilePictureUrl?(0,O.jsx)(eC.Z,{isFirstParty:!1,src:t.profilePictureUrl,className:"h-8 w-8"}):(0,O.jsx)("div",{className:"h-8 w-8 rounded-full border-2 border-dashed border-token-border-medium"}),(0,O.jsxs)("div",{children:[(0,O.jsx)("div",{className:"text-sm font-medium",children:t.name||(0,O.jsx)(en.Z,tq({},t2.newGPT))}),(0,O.jsx)("div",{className:"text-xs text-token-text-secondary",children:(0,g.Sg)(t)?(0,O.jsxs)("div",{className:"flex items-center gap-1",children:[(0,O.jsx)("div",{className:"h-1.5 w-1.5 rounded-full bg-token-text-tertiary"}),(0,O.jsx)(en.Z,tq({},t2.draft))]}):(0,O.jsxs)("div",{className:"flex items-center gap-1",children:[(0,O.jsx)("div",{className:"h-1.5 w-1.5 rounded-full bg-brand-green"}),(0,O.jsx)(en.Z,tq({},t2.published))," \xb7 ",(0,O.jsx)(tQ,{gizmoEditorData:t})]})})]})]})}function t0(e){var t=e.category,n=e.categories,r=e.setCategory;return(0,O.jsxs)(tL.fC,{value:t,onValueChange:function(e){return r(e)},children:[(0,O.jsx)(tL.xz,{className:"flex justify-between rounded-xl bg-gray-50 p-3 font-medium dark:bg-gray-900",children:t?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(tL.B4,{}),(0,O.jsx)(tL.JO,{children:(0,O.jsx)(et.ud,{})})]}):(0,O.jsx)("div",{className:"flex w-full justify-center",children:(0,O.jsx)(M.Z,{})})}),(0,O.jsx)(tL.h_,{children:(0,O.jsx)(tL.VY,{className:"h-64 w-[var(--radix-select-trigger-width)] rounded-xl border bg-white p-1 py-2 dark:border-gray-600 dark:bg-gray-800",position:"popper",sideOffset:2,children:(0,O.jsx)("div",{className:"overflow-y-auto",children:n.map(function(e){return(0,O.jsxs)(tL.ck,{className:"flex w-full cursor-pointer justify-between rounded-lg p-2 pl-4 text-sm font-medium hover:bg-gray-50 dark:hover:bg-gray-700",value:e.id,children:[(0,O.jsx)(tL.eT,{children:e.title}),(0,O.jsx)(tL.wU,{className:"text-green-600",children:(0,O.jsx)(et.oS,{})})]},e.id)})})})})]})}function t1(e){var t=e.gizmoEditorData,n=e.isLoading,r=e.isUploadingProfilePic,i=e.isGeneratingProfilePic,o=e.publishedGizmo,a=e.promoteGizmo,s=e.revertDraft,l=e.draftMessage,c=e.className,u=e.hasUnpublishedChanges,d=e.showActionsModal;return(0,O.jsxs)("div",{className:(0,H.default)("relative flex h-14 w-full items-center justify-between gap-2 border-b border-token-border-medium px-3",c),children:[(0,O.jsxs)("div",{className:"flex items-center gap-2",children:[(0,O.jsx)("a",{className:"cursor-pointer text-token-text-primary",onClick:function(){return tF(Y())},children:(0,O.jsx)(et.L7,{className:"icon-lg"})}),(0,O.jsx)(t$,{gizmoEditorData:t})]}),(0,O.jsxs)("div",{className:"flex items-center gap-2",children:[l,(0,O.jsx)(tY,{gizmoEditorData:t,publishedGizmo:o,revertDraft:s}),(0,O.jsx)(tJ,{gizmo:t,publishedGizmo:o,isLoading:n,isUploadingProfilePic:r,isGeneratingProfilePic:i,promoteGizmo:a,hasUnpublishedChanges:u,showActionsModal:d})]})]})}var t2=(0,ep.vU)({privacyConfirm:{id:"gizmo.confirmPublish",defaultMessage:"Confirm"},workspaceDisabledHint:{id:"gizmo.workspaceDisabledHint",defaultMessage:"Your workspace administrator has disabled this setting"},publicSharingHint:{id:"gizmo.publicSharingHint",defaultMessage:"This GPT may appear in the GPT Store (coming soon)"},displayNameRequiredHint:{id:"gizmo.displayNameRequiredHint",defaultMessage:"To make your GPT public, set up your builder profile."},save:{id:"gizmo.save",defaultMessage:"Save"},publishChanges:{id:"gizmo.publishChanges",defaultMessage:"Update"},deleteGPT:{id:"gizmo.delete",defaultMessage:"Delete GPT"},actionNeedsPrivacyPolicyURL:{id:"gizmo.actionNeedsPrivacyPolicyURL",defaultMessage:"Public actions require valid privacy policy URLs. Click here to update."},publishTo:{id:"gizmo.publishTo",defaultMessage:"Publish to"},publishedTitle:{id:"gizmo.publishedTitle",defaultMessage:"Published!"},viewGPT:{id:"gizmo.viewGPT",defaultMessage:"View GPT"},revertMenuItem:{id:"gizmo.revertMenuItem",defaultMessage:"Revert..."},onlyMe:{id:"gizmo.onlyMe",defaultMessage:"Only me"},anyoneWithLink:{id:"gizmo.anyoneWithLink",defaultMessage:"Anyone with a link"},public:{id:"gizmo.public",defaultMessage:"Public"},newGPT:{id:"gizmo.newGPT",defaultMessage:"New GPT"},draft:{id:"gizmo.draft",defaultMessage:"Draft"},published:{id:"gizmo.published",defaultMessage:"Published"},revertConfirm:{id:"gizmo.revertConfirm",defaultMessage:"Are you sure you want to revert to the last saved version?"},copyLink:{id:"gizmo.copyLink",defaultMessage:"Copy link"},categoryLabel:{id:"gizmo.categoryLabel",defaultMessage:"Category"},categoryLabelTooltip:{id:"gizmo.categoryLabelTooltip",defaultMessage:"Your GPT may appear in this category on Explore"},categoryError:{id:"gizmo.categoryError",defaultMessage:"Error generating category"}});function t4(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function t3(e){var t=function(e,t){var n=e.response,r=(0,U.Ot)(e);if(!Array.isArray(n))return r;var i=(0,K.compact)(n.map(function(e){if("value_error.any_str.max_length"===e.type)switch(e.loc[1]){case"display":switch(e.loc[2]){case"name":return t.formatMessage(ts.nameTooLong,{length:e.ctx.limit_value});case"description":return t.formatMessage(ts.descriptionTooLong,{length:e.ctx.limit_value});case"welcome_message":return t.formatMessage(ts.welcomeMessageTooLong,{length:e.ctx.limit_value})}break;case"instructions":return t.formatMessage(ts.instructionsTooLong,{length:e.ctx.limit_value})}if("string"==typeof e.msg)return e.msg}));return i.length>0?i.join("\n"):r}(e.upsertDraftError,(0,X.Z)());return(0,O.jsxs)("div",{className:"flex items-center gap-2 text-red-500",children:[(0,O.jsx)("div",{children:(0,O.jsx)(en.Z,function(e){for(var t=1;t=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function t7(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n0&&N.push(t9.Cv.getTextAsMessage("The user has removed the following files from the GPT. You can no longer reference these files: ".concat(k.map(function(e){return e.file_id}).join(", ")),$.uU.System)),P.length>0&&N.push(t9.Cv.getTextAsMessage("The user is adding these files to the GPT. The GPT may reference these files. The file IDs are: ".concat(P.map(function(e){return e.file_id}).join(", ")),$.uU.System,{attachments:P.map(function(e){return{id:e.file_id,name:e.name,size:e.size}})})),N.length>0&&A.tQ.updateTree(e,function(e){var n,r=e.getNodeByIdOrMessageId(t).parentId,i=t6(N);try{for(i.s();!(n=i.n()).done;){var o=n.value,a=(0,tb.Z)();e.insertNodeBefore(t,{id:a,children:[],parentId:r,message:o,metadata:{isClientCreatedSystemMessage:!0}}),r=a}}catch(e){i.e(e)}finally{i.f()}})}}}var no=n(14402);function na(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ns(e){for(var t=1;t0)){e.next=4;break}return E.m.warning("Could not save GPT:\n\n".concat(r.map(function(e){return"- ".concat(e2(e))}).join("\n")),{duration:3}),e.abrupt("return");case 4:return e.next=6,Q();case 6:return o=(i=e.sent).gizmo.id,e.prev=8,eg({gizmoId:o,sharingRecipient:t}),e.next=12,F.mutateAsync({gizmoId:i.gizmo.id,data:{sharingRecipient:t,categories:null==n?void 0:[n]}},{onSuccess:function(e){W.E.setQueryData((0,g.Vw)(o).queryKey,e),W.E.invalidateQueries({queryKey:["gizmos"]}),W.E.invalidateQueries({queryKey:["gizmo",{gizmoId:o}]}),W.E.invalidateQueries({queryKey:["gizmo","userActionSettings",{gizmoId:o}]})}});case 12:return a=e.sent,e.abrupt("return",a);case 16:e.prev=16,e.t0=e.catch(8),e.t0 instanceof G.DC?(eu(!!e.t0.response.is_flagged_brand_name),ef(!0)):(console.error(e.t0),E.m.warning("Error saving GPT",{duration:2}));case 19:case"end":return e.stop()}},e,null,[[8,16]])})),function(e,t){return s.apply(this,arguments)}),ex=L.isPending||F.isPending,eb=(0,q.useState)(function(){var e=B.m.getItem(B.F.GizmoEditorTab);return Object.values(h).includes(e)?e:h.MAGIC_MAKER}),ey=eb[0],ej=eb[1],ew=(c=(l=(0,q.useState)({width:null,height:null}))[0],u=l[1],(0,q.useLayoutEffect)(function(){var e=function(){u({width:window.innerWidth,height:window.innerHeight})};return e(),window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}},[]),c).width;(0,q.useEffect)(function(){null!=ew&&ew>=768&&ey===h.PREVIEW&&ej(h.MAGIC_MAKER)},[ew,ey]);var eP=(0,q.useState)(!1),ek=eP[0],eN=eP[1],eT=(0,q.useState)(!1),eO=eT[0],ez=eT[1],eC=(0,q.useState)(void 0),eI=eC[0],e_=eC[1];return(0,O.jsxs)("div",{className:"flex h-screen w-full flex-col items-center",children:[(0,O.jsx)(t1,{gizmoEditorData:T,isLoading:ex,hasUnpublishedChanges:J,isUploadingProfilePic:ek,isGeneratingProfilePic:eO,publishedGizmo:M,promoteGizmo:(d=(0,v.Z)(j().mark(function e(t,n){var r;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ev(t,n);case 2:return r=e.sent,y.current=nu(nu({},y.current),{},{sharingRecipient:t}),C(y.current),B.m.setItem(B.F.GizmoEditorTab,ey),e.abrupt("return",r);case 7:case"end":return e.stop()}},e)})),function(e,t){return d.apply(this,arguments)}),revertDraft:null!=M&&J?function(){var e=W.E.getQueryData((0,g.Vw)(y.current.id).queryKey);if(null!=e){var t=nh(e);y.current=t,C(t),Q()}}:void 0,draftMessage:(0,O.jsx)(t5,{hasUnpublishedChanges:J,isSavingDraft:R,upsertDraftError:V,className:"text-sm"}),showActionsModal:function(e){e_(e)},className:"flex-shrink-0"}),Y&&f&&(0,O.jsx)(z,{gizmoId:f.gizmo.id}),ep&&eh&&(0,O.jsx)(S,{isFlaggedBrandName:ec,onClose:function(){return ef(!1)}}),(0,O.jsxs)("div",{className:"relative flex w-full grow overflow-hidden",children:[(0,O.jsx)("div",{className:"flex w-full justify-center md:w-1/2",children:(0,O.jsx)("div",{className:"h-full grow overflow-hidden",children:void 0!==eI?(0,O.jsx)(tD,{currentlyEditingActionDomain:eI,gizmoEditorData:T,updateGizmo:er,onClose:function(){e_(void 0)}}):(0,O.jsxs)("div",{className:"flex h-full flex-col px-2 pt-2",children:[(0,O.jsx)(np,{editorTab:ey,setEditorTab:ej,className:"mb-2 flex-shrink-0 self-center"}),(0,O.jsx)("div",{className:"grow overflow-hidden",children:ey===h.MAGIC_MAKER?(0,O.jsx)("div",{className:"h-full w-full pb-5",children:(0,O.jsx)(nl,{gizmoEditorData:T,updateGizmo:er,completionCallbackResponse:ea,clientThreadId:_,gizmoEditorDataRef:y,magicMakerBehaviorOverrides:ei,magicMakerConversationGizmoEditorDataRef:k,requireGizmoId:et},_)}):ey===h.ADVANCED?(0,O.jsx)(ta,{gizmoEditorData:T,updateGizmo:er,generateProfilePic:function(){ez(!0),es(y,k,["Generate a new profile picture for this GPT using gizmo_editor generate_profile_pic. Do not prompt the user for any clarification. Do not send extra text outside of the tool function call. Do not call update_behavior in your next message."])},setIsUploadingProfilePic:eN,isGeneratingProfilePic:eO,setIsGeneratingProfilePic:ez,requireGizmoId:et,onShowActionsEditor:function(e){e_(e)}}):(0,O.jsx)(tN,{gizmoEditorData:T,isSavingDraft:R,showTitle:!1})})]})})}),(0,O.jsx)("div",{className:(0,H.default)("hidden w-1/2 justify-center border-l border-token-border-medium bg-token-surface-secondary pt-4",ey!==h.PREVIEW&&"md:flex"),children:(0,O.jsx)("div",{className:"flex-grow pb-5",children:(0,O.jsx)("div",{className:"h-full",children:(0,O.jsx)(tN,{gizmoEditorData:T,isSavingDraft:R})})})})]})]})};function nv(e){var t=e.businessWorkspaceId,n=e.gizmoId,r=(0,g.b9)(n,!0).data,i=(0,L.ec)(L.F_.accountUserId),o=(0,L.aF)(),a=null==o?void 0:o.id,s=null!=r&&null!=i&&null!=a&&(0,tl.k1)(r,i,a,t);return null!=r&&s?(0,O.jsx)(ng,{gizmo:r}):null}function nx(e){var t=e.onNewGizmoId;return(0,O.jsx)(ng,{gizmo:void 0,onNewGizmoId:t})}function nb(e){var t=e.gizmoId,n=e.remixSourceId,r=(0,J.useRouter)(),i=(0,D.t)(),o=(0,L.ec)(L.F_.businessWorkspaceId),a=(0,q.useRef)(void 0),s=t;return null!=t&&a.current===t&&(s=void 0),(0,R.yx)({resetThreadAction:function(){r.push("/")}}),(0,O.jsx)("div",{children:null!=i&&i.data?(0,O.jsx)("div",{children:void 0!=s?(0,O.jsx)(nv,{businessWorkspaceId:o,gizmoId:s},s):(0,O.jsx)(nx,{remixSourceId:n,onNewGizmoId:function(e){a.current=e,window.history.replaceState(window.history.state,"",(0,V.AA)(e))}})}):(0,O.jsx)("div",{className:"flex min-h-screen items-center justify-center",children:(0,O.jsx)(M.Z,{})})})}var ny=n(85958),nj=!0;function nw(){var e,t=(0,D.t)();e=null==t||t.canCreateGizmos(),(0,q.useEffect)(function(){e||Y().replace((0,ny.M5)(ny.LT.NO_ACCESS),void 0,{shallow:!0})},[e]);var n=(0,J.useRouter)(),r=n.query.slug,i=r?(0,g.CR)(r):void 0,o=n.query.remixFrom,a=null==t?void 0:t.features.includes(Z.PL);return((0,q.useEffect)(function(){a&&tx.ZP.initializeAndGatherData()},[a]),(0,q.useEffect)(function(){null==t||t.canCreateGizmos()||n.push("/")},[t,n]),null!=t&&t.canCreateGizmos())?(0,O.jsx)(nb,{gizmoId:i,remixSourceId:o}):null}},87942:function(e,t,n){n.d(t,{b:function(){return d}});var r=n(50134),i=n(4399),o=n.n(i),a=n(3554),s=n(21120),l=n(37097),c=n(4748),u=n(35250);function d(e){var t,n=e.gizmoId,i=e.onSuccess,d=e.onClose,p=(0,l.kb)(),f=(t=(0,r.Z)(o().mark(function e(){return o().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,p.mutateAsync({gizmoId:n});case 3:i(),e.next=9;break;case 6:e.prev=6,e.t0=e.catch(0),c.m.danger("Failed to delete gizmo. Please try again.");case 9:case"end":return e.stop()}},e,null,[[0,6]])})),function(){return t.apply(this,arguments)});return(0,u.jsx)(s.Z,{isOpen:!0,onClose:d,type:"danger",title:"Delete GPT",primaryButton:(0,u.jsx)(a.ZP.Button,{title:"Delete GPT",color:"danger",loading:p.isPending,onClick:function(){f()}}),secondaryButton:(0,u.jsx)(a.ZP.Button,{title:"Cancel",color:"neutral",onClick:d}),children:(0,u.jsx)("div",{className:"text-sm",children:"Are you sure you want to delete this GPT? This cannot be undone."})})}}}]); \ No newline at end of file diff --git a/orig/_next/static/chunks/6276-32619f7589d1c892.js b/orig/_next/static/chunks/6276-32619f7589d1c892.js new file mode 100644 index 0000000..52d3160 --- /dev/null +++ b/orig/_next/static/chunks/6276-32619f7589d1c892.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6276],{56276:function(e,t,r){r.r(t),r.d(t,{__N_SSP:function(){return S},default:function(){return E}});var n=r(36112),s=r(7144),o=r(1890),i=r(83380),l=r(10721),a=r(70079),c=r(32004),u=r(94968),d=r(91559),f=r(63866),m=r(56685),p=r(37097),v=r(94734),x=r(35250);function g(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function h(){var e,t=(0,s.t)(),r=(0,l.useRouter)(),n=(0,p.Yp)(),a=n.data,c=n.isLoading;if((0,i.yx)({resetThreadAction:function(){r.push("/")}}),null==t)return null;var u=null!==(e=null==a?void 0:a.cuts.map(function(e){return{cutId:e.info.id,title:e.info.title,items:e.list.items,cursor:e.list.cursor}}))&&void 0!==e?e:[];return t.features.includes(o.L0.GizmoStore)&&(u=u.filter(function(e){return"mine"===e.cutId})),u.some(function(e){return"mine"===e.cutId})||u.unshift({cutId:"mine",title:"My GPTs",items:[],cursor:null}),(0,x.jsx)("div",{className:"mx-auto max-w-3xl px-4 py-12",children:c?(0,x.jsx)("div",{className:"flex justify-center",children:(0,x.jsx)(f.Z,{})}):u.map(function(e){return(0,x.jsx)(y,{cutId:e.cutId,title:e.title,items:e.items,cursor:e.cursor,createRowType:"mine"==e.cutId?t.canCreateGizmos()?m.a7.Enabled:m.a7.ComingSoon:void 0,canRemoveRecent:"recent"===e.cutId},e.cutId)})})}function y(e){var t=e.cutId,r=e.title,n=e.items,s=e.cursor,o=e.canRemoveRecent,i=e.createRowType;return(0,x.jsxs)(v.b1,{title:r,children:[null!=i&&(0,x.jsx)(m.at,{type:i}),n.map(function(e){return(0,x.jsx)(m.r1,{gizmoResource:e.resource,canRemoveRecent:o},e.resource.gizmo.id)}),null!=s&&(0,x.jsx)(b,{cutId:t,cursor:s,fetchOnMount:0===n.length})]})}function b(e){var t=e.cutId,r=e.cursor,s=e.fetchOnMount,o=(0,a.useState)(s),i=o[0],l=o[1],u=(0,p.Fi)(t,8,r,i),f=u.data,v=u.hasNextPage,h=u.fetchNextPage,y=u.isLoading;return(0,x.jsxs)("div",{children:[(0,x.jsx)("div",{children:null==f?void 0:f.pages.flatMap(function(e){return e.list.items.map(function(e){var t=e.resource;return(0,x.jsx)(m.r1,{gizmoResource:t},t.gizmo.id)})})}),!i||v||y?(0,x.jsx)(d.z,{color:"neutral",onClick:function(){i?h():l(!0)},loading:y,className:"w-full",children:(0,x.jsx)(c.Z,function(e){for(var t=1;t({...e,popoverState:(0,g.E)(e.popoverState,{0:1,1:0})}),1:e=>1===e.popoverState?e:{...e,popoverState:1},2:(e,t)=>e.button===t.button?e:{...e,button:t.button},3:(e,t)=>e.buttonId===t.buttonId?e:{...e,buttonId:t.buttonId},4:(e,t)=>e.panel===t.panel?e:{...e,panel:t.panel},5:(e,t)=>e.panelId===t.panelId?e:{...e,panelId:t.panelId}},_=(0,x.createContext)(null);function G(e){let t=(0,x.useContext)(_);if(null===t){let t=Error(`<${e} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,G),t}return t}_.displayName="PopoverContext";let A=(0,x.createContext)(null);function D(e){let t=(0,x.useContext)(A);if(null===t){let t=Error(`<${e} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,D),t}return t}A.displayName="PopoverAPIContext";let F=(0,x.createContext)(null);function L(){return(0,x.useContext)(F)}F.displayName="PopoverGroupContext";let U=(0,x.createContext)(null);function B(e,t){return(0,g.E)(t.type,Z,e,t)}U.displayName="PopoverPanelContext";let q=(0,h.yV)(function(e,t){var r;let n=`headlessui-popover-button-${(0,b.M)()}`,s=`headlessui-popover-panel-${(0,b.M)()}`,o=(0,x.useRef)(null),i=(0,y.T)(t,(0,y.h)(e=>{o.current=e})),l=(0,x.useReducer)(B,{popoverState:1,button:null,buttonId:n,panel:null,panelId:s,beforePanelSentinel:(0,x.createRef)(),afterPanelSentinel:(0,x.createRef)()}),[{popoverState:a,button:c,panel:u,beforePanelSentinel:d,afterPanelSentinel:f},m]=l,p=(0,E.i)(null!=(r=o.current)?r:c);(0,x.useEffect)(()=>m({type:3,buttonId:n}),[n,m]),(0,x.useEffect)(()=>m({type:5,panelId:s}),[s,m]);let v=(0,x.useMemo)(()=>{if(!c||!u)return!1;for(let e of document.querySelectorAll("body > *"))if(Number(null==e?void 0:e.contains(c))^Number(null==e?void 0:e.contains(u)))return!0;return!1},[c,u]),j=(0,x.useMemo)(()=>({buttonId:n,panelId:s,close:()=>m({type:1})}),[n,s,m]),N=L(),k=null==N?void 0:N.registerPopover,S=(0,R.z)(()=>{var e;return null!=(e=null==N?void 0:N.isFocusWithinPopoverGroup())?e:(null==p?void 0:p.activeElement)&&((null==c?void 0:c.contains(p.activeElement))||(null==u?void 0:u.contains(p.activeElement)))});(0,x.useEffect)(()=>null==k?void 0:k(j),[k,j]),(0,C.O)(null==p?void 0:p.defaultView,"focus",e=>{var t,r,n,s;0===a&&(S()||!c||!u||null!=(r=null==(t=d.current)?void 0:t.contains)&&r.call(t,e.target)||null!=(s=null==(n=f.current)?void 0:n.contains)&&s.call(n,e.target)||m({type:1}))},!0),(0,z.O)([c,u],(e,t)=>{m({type:1}),(0,P.sP)(t,P.tJ.Loose)||(e.preventDefault(),null==c||c.focus())},0===a);let M=(0,R.z)(e=>{m({type:1});let t=e?e instanceof HTMLElement?e:"current"in e&&e.current instanceof HTMLElement?e.current:c:c;null==t||t.focus()}),T=(0,x.useMemo)(()=>({close:M,isPortalled:v}),[M,v]),O=(0,x.useMemo)(()=>({open:0===a,close:M}),[a,M]);return x.createElement(_.Provider,{value:l},x.createElement(A.Provider,{value:T},x.createElement(w.up,{value:(0,g.E)(a,{0:w.ZM.Open,1:w.ZM.Closed})},(0,h.sY)({ourProps:{ref:i},theirProps:e,slot:O,defaultTag:"div",name:"Popover"}))))}),$=(0,h.yV)(function(e,t){let[r,n]=G("Popover.Button"),{isPortalled:s}=D("Popover.Button"),o=(0,x.useRef)(null),i=`headlessui-focus-sentinel-${(0,b.M)()}`,l=L(),a=null==l?void 0:l.closeOthers,c=(0,x.useContext)(U),u=null!==c&&c===r.panelId,d=(0,y.T)(o,t,u?null:e=>n({type:2,button:e})),f=(0,y.T)(o,t),m=(0,E.i)(o),p=(0,R.z)(e=>{var t,s,i;if(u){if(1===r.popoverState)return;switch(e.key){case j.R.Space:case j.R.Enter:e.preventDefault(),null==(s=(t=e.target).click)||s.call(t),n({type:1}),null==(i=r.button)||i.focus()}}else switch(e.key){case j.R.Space:case j.R.Enter:e.preventDefault(),e.stopPropagation(),1===r.popoverState&&(null==a||a(r.buttonId)),n({type:0});break;case j.R.Escape:if(0!==r.popoverState)return null==a?void 0:a(r.buttonId);if(!o.current||(null==m?void 0:m.activeElement)&&!o.current.contains(m.activeElement))return;e.preventDefault(),e.stopPropagation(),n({type:1})}}),v=(0,R.z)(e=>{u||e.key===j.R.Space&&e.preventDefault()}),w=(0,R.z)(t=>{var s,o;(0,N.P)(t.currentTarget)||e.disabled||(u?(n({type:1}),null==(s=r.button)||s.focus()):(t.preventDefault(),t.stopPropagation(),1===r.popoverState&&(null==a||a(r.buttonId)),n({type:0}),null==(o=r.button)||o.focus()))}),z=(0,R.z)(e=>{e.preventDefault(),e.stopPropagation()}),S=0===r.popoverState,C=(0,x.useMemo)(()=>({open:S}),[S]),O=(0,k.f)(e,o),I=u?{ref:f,type:O,onKeyDown:p,onClick:w}:{ref:d,id:r.buttonId,type:O,"aria-expanded":e.disabled?void 0:0===r.popoverState,"aria-controls":r.panel?r.panelId:void 0,onKeyDown:p,onKeyUp:v,onClick:w,onMouseDown:z},Z=(0,T.l)(),_=(0,R.z)(()=>{let e=r.panel;e&&(0,g.E)(Z.current,{[T.N.Forwards]:()=>(0,P.jA)(e,P.TO.First),[T.N.Backwards]:()=>(0,P.jA)(e,P.TO.Last)})});return x.createElement(x.Fragment,null,(0,h.sY)({ourProps:I,theirProps:e,slot:C,defaultTag:"button",name:"Popover.Button"}),S&&!u&&s&&x.createElement(M._,{id:i,features:M.A.Focusable,as:"button",type:"button",onFocus:_}))}),Y=h.AN.RenderStrategy|h.AN.Static,V=(0,h.yV)(function(e,t){let[{popoverState:r},n]=G("Popover.Overlay"),s=(0,y.T)(t),o=`headlessui-popover-overlay-${(0,b.M)()}`,i=(0,w.oJ)(),l=null!==i?i===w.ZM.Open:0===r,a=(0,R.z)(e=>{if((0,N.P)(e.currentTarget))return e.preventDefault();n({type:1})}),c=(0,x.useMemo)(()=>({open:0===r}),[r]);return(0,h.sY)({ourProps:{ref:s,id:o,"aria-hidden":!0,onClick:a},theirProps:e,slot:c,defaultTag:"div",features:Y,visible:l,name:"Popover.Overlay"})}),W=h.AN.RenderStrategy|h.AN.Static,H=Object.assign(q,{Button:$,Overlay:V,Panel:(0,h.yV)(function(e,t){let{focus:r=!1,...n}=e,[s,o]=G("Popover.Panel"),{close:i,isPortalled:l}=D("Popover.Panel"),a=`headlessui-focus-sentinel-before-${(0,b.M)()}`,c=`headlessui-focus-sentinel-after-${(0,b.M)()}`,u=(0,x.useRef)(null),d=(0,y.T)(u,t,e=>{o({type:4,panel:e})}),f=(0,E.i)(u),m=(0,w.oJ)(),p=null!==m?m===w.ZM.Open:0===s.popoverState,v=(0,R.z)(e=>{var t;if(e.key===j.R.Escape){if(0!==s.popoverState||!u.current||(null==f?void 0:f.activeElement)&&!u.current.contains(f.activeElement))return;e.preventDefault(),e.stopPropagation(),o({type:1}),null==(t=s.button)||t.focus()}});(0,x.useEffect)(()=>{var t;e.static||1===s.popoverState&&(null==(t=e.unmount)||t)&&o({type:4,panel:null})},[s.popoverState,e.unmount,e.static,o]),(0,x.useEffect)(()=>{if(!r||0!==s.popoverState||!u.current)return;let e=null==f?void 0:f.activeElement;u.current.contains(e)||(0,P.jA)(u.current,P.TO.First)},[r,u,s.popoverState]);let N=(0,x.useMemo)(()=>({open:0===s.popoverState,close:i}),[s,i]),k={ref:d,id:s.panelId,onKeyDown:v,onBlur:r&&0===s.popoverState?e=>{var t,r,n,i,l;let a=e.relatedTarget;!a||!u.current||null!=(t=u.current)&&t.contains(a)||(o({type:1}),((null==(n=null==(r=s.beforePanelSentinel.current)?void 0:r.contains)?void 0:n.call(r,a))||(null==(l=null==(i=s.afterPanelSentinel.current)?void 0:i.contains)?void 0:l.call(i,a)))&&a.focus({preventScroll:!0}))}:void 0,tabIndex:-1},z=(0,T.l)(),S=(0,R.z)(()=>{let e=u.current;e&&(0,g.E)(z.current,{[T.N.Forwards]:()=>{(0,P.jA)(e,P.TO.First)},[T.N.Backwards]:()=>{var e;null==(e=s.button)||e.focus({preventScroll:!0})}})}),C=(0,R.z)(()=>{let e=u.current;e&&(0,g.E)(z.current,{[T.N.Forwards]:()=>{var e,t,r;if(!s.button)return;let n=(0,P.GO)(),o=n.indexOf(s.button),i=n.slice(0,o+1),l=[...n.slice(o+1),...i];for(let n of l.slice())if((null==(t=null==(e=null==n?void 0:n.id)?void 0:e.startsWith)?void 0:t.call(e,"headlessui-focus-sentinel-"))||(null==(r=s.panel)?void 0:r.contains(n))){let e=l.indexOf(n);-1!==e&&l.splice(e,1)}(0,P.jA)(l,P.TO.First,!1)},[T.N.Backwards]:()=>(0,P.jA)(e,P.TO.Last)})});return x.createElement(U.Provider,{value:s.panelId},p&&l&&x.createElement(M._,{id:a,ref:s.beforePanelSentinel,features:M.A.Focusable,as:"button",type:"button",onFocus:S}),(0,h.sY)({ourProps:k,theirProps:n,slot:N,defaultTag:"div",features:W,visible:p,name:"Popover.Panel"}),p&&l&&x.createElement(M._,{id:c,ref:s.afterPanelSentinel,features:M.A.Focusable,as:"button",type:"button",onFocus:C}))}),Group:(0,h.yV)(function(e,t){let r=(0,x.useRef)(null),n=(0,y.T)(r,t),[s,o]=(0,x.useState)([]),i=(0,R.z)(e=>{o(t=>{let r=t.indexOf(e);if(-1!==r){let e=t.slice();return e.splice(r,1),e}return t})}),l=(0,R.z)(e=>(o(t=>[...t,e]),()=>i(e))),a=(0,R.z)(()=>{var e;let t=(0,S.r)(r);if(!t)return!1;let n=t.activeElement;return!!(null!=(e=r.current)&&e.contains(n))||s.some(e=>{var r,s;return(null==(r=t.getElementById(e.buttonId))?void 0:r.contains(n))||(null==(s=t.getElementById(e.panelId))?void 0:s.contains(n))})}),c=(0,R.z)(e=>{for(let t of s)t.buttonId!==e&&t.close()}),u=(0,x.useMemo)(()=>({registerPopover:l,unregisterPopover:i,isFocusWithinPopoverGroup:a,closeOthers:c}),[l,i,a,c]),d=(0,x.useMemo)(()=>({}),[]);return x.createElement(F.Provider,{value:u},(0,h.sY)({ourProps:{ref:n},theirProps:e,slot:d,defaultTag:"div",name:"Popover.Group"}))})});var X=r(25349),K=r(99893),J=r(19841),Q=r(43356),ee=r(61888),et=r(73040),er=r.n(et),en=r(10721),es=r(1454),eo=r(32004),ei=r(70671),el=r(94968),ea=r(21389),ec=r(8844),eu=r(218),ed=r(41202),ef=r(56685),em=r(85528),ep=r(65865),ev=r(79505),ex=r(5063),eg=r(35250);function eh(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function ey(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:s}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,l=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return i=e.done,e},e:function(e){l=!0,o=e},f:function(){try{i||null==r.return||r.return()}finally{if(l)throw o}}}}(h);try{for(r.s();!(t=r.n()).done;){var n=function(){var r=t.value,n=c[r.id];if(null==n||"function"==typeof n)return{v:void 0};(null==n?void 0:n.current)!=null&&e.target===n.current&&g(function(t){return ey(ey({},t),{},(0,l.Z)({},r.id,e.isIntersecting))})}();if("object"==typeof n)return n.v}}catch(e){r.e(e)}finally{r.f()}})},{root:null,rootMargin:"-96px",threshold:.1});return Object.values(c).forEach(function(t){"function"!=typeof t&&(null==t?void 0:t.current)!=null&&e.observe(t.current)}),function(){Object.values(c).forEach(function(t){"function"!=typeof t&&(null==t?void 0:t.current)!=null&&e.unobserve(t.current)})}},[c,h]);var j=(0,x.useRef)(null);return i?(0,eg.jsx)("div",{className:"flex h-full w-full items-center justify-center",children:(0,eg.jsx)(m.Z,{})}):(0,eg.jsxs)(eg.Fragment,{children:[n?(0,eg.jsx)(em.S,{redirectUrl:(0,v.cy)(),className:"sticky top-0 z-30 h-14 dark:bg-gray-800"}):(0,eg.jsx)(ez,{pageSearchRef:j}),(0,eg.jsxs)("div",{className:"mx-auto max-w-3xl overflow-x-clip px-4",children:[(0,eg.jsx)(eP,{}),!n&&(0,eg.jsx)(eR,{className:"z-20 mb-6 mt-2 flex-grow shadow-[0px_10px_10px_-3px_rgba(0,0,0,0.05)]",inputClassName:"md:h-14 h-12 text-base pl-12",iconClassName:"left-6",ref:j}),h.length>1&&(0,eg.jsx)(ew,{displayGroups:h,currentDisplayGroup:b,scrollToDisplayGroup:function(e){var t,r,n=null!==(t=c[e.id])&&void 0!==t?t:y;"function"!=typeof n&&(null==n||null===(r=n.current)||void 0===r||r.scrollIntoView({behavior:"smooth",block:"start"}))}}),(0,eg.jsx)("div",{ref:y,className:"scroll-mt-24"}),null!==(r=null==o?void 0:o.cuts.map(function(e){var t,r,n;return"featured"===e.info.display_type?(0,eg.jsx)(eS,{title:e.info.title,description:e.info.description,items:e.list.items,ref:null!==(t=c[e.info.id])&&void 0!==t?t:void 0},e.info.id):(0,eg.jsx)(eC,{title:e.info.title,description:e.info.description,items:e.list.items,cutId:e.info.id,cursor:null!==(r=e.list.cursor)&&void 0!==r?r:void 0,ref:null!==(n=c[e.info.id])&&void 0!==n?n:void 0},e.info.id)}))&&void 0!==r?r:[]]}),(null==o?void 0:o.workspace_filtered)&&(0,eg.jsx)(ek,{})]})}function eP(){return(0,eg.jsxs)("div",{className:"mb-6",children:[(0,eg.jsx)("div",{className:"my-2 text-center text-3xl font-bold md:my-4 md:text-5xl",children:(0,eg.jsx)(eo.Z,ey({},eG.discoverySplashHeader))}),(0,eg.jsx)("div",{className:"mx-auto w-full text-center text-sm font-light text-token-text-secondary md:text-lg md:leading-tight",children:(0,eg.jsx)(eo.Z,ey({},eG.discoverySplashDescription))})]})}function ew(e){var t=e.displayGroups,r=e.currentDisplayGroup,n=e.scrollToDisplayGroup,s=(0,x.useRef)(null),o=(0,x.useState)(!1),i=o[0],l=o[1],a=(0,x.useState)(!1),c=a[0],u=a[1];return(0,x.useEffect)(function(){var e=s.current,t=function(){null!=e&&(l(e.scrollLeft>0),u(e.scrollLeft+e.clientWidth