@census-ai/census-sdk 0.4.5 → 0.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- 'use strict';var react=require('react'),jsxRuntime=require('react/jsx-runtime');var Vt="https://api.census.ai",Me=class{constructor(t){this.currentUserId=null;if(!t.apiKey)throw new Error("Census: apiKey is required");["cs_live_","cs_test_","op_live_","op_test_"].some(r=>t.apiKey.startsWith(r))||console.warn('Census: API key should start with "cs_live_" or "cs_test_"'),this.apiKey=t.apiKey,this.baseUrl=t.baseUrl||Vt,this.debug=t.debug||false,this.log("Initialized with base URL:",this.baseUrl);}async identify(t){if(!t.userId)throw new Error("Census: userId is required for identify()");this.currentUserId=t.userId,await this.request("/api/sdk/identify","POST",{userId:t.userId,email:t.email,name:t.name,avatarUrl:t.avatarUrl,metadata:t.metadata,organizationId:t.organizationId,organizationName:t.organizationName,organizationDomain:t.organizationDomain,organizationPlan:t.organizationPlan}),this.log("User identified:",t.userId);}reset(){this.currentUserId=null,this.log("User identity reset");}async submitFeedback(t){let o=["feedback","bug_report","feature_request","article_rating"];if(!t.type||!o.includes(t.type))throw new Error(`Census: type must be one of: ${o.join(", ")}`);if(t.type==="article_rating"){if(t.rating===void 0&&t.helpful===void 0)throw new Error("Census: article_rating requires rating or helpful field")}else if(!t.message)throw new Error("Census: message is required for this feedback type");let r=await this.request("/api/sdk/feedback","POST",{type:t.type,message:t.message,rating:t.rating,helpful:t.helpful,userId:this.currentUserId,articleId:t.articleId,pageUrl:typeof window<"u"?window.location.href:void 0,metadata:t.metadata});return this.log("Feedback submitted:",r.feedbackId),{feedbackId:r.feedbackId}}async getArticles(t){let o=new URLSearchParams;t?.category&&o.set("category",t.category),t?.search&&o.set("search",t.search),t?.limit&&o.set("limit",String(t.limit)),t?.offset&&o.set("offset",String(t.offset));let r=o.toString(),i=`/api/sdk/articles${r?`?${r}`:""}`,n=await this.request(i,"GET");return this.log("Fetched articles:",n.articles.length),n}async getArticle(t){try{let o=await this.request(`/api/sdk/articles/${encodeURIComponent(t)}`,"GET");return this.log("Fetched article:",t),o.article}catch(o){if(o.status===404)return null;throw o}}async getFeatureGroups(){let t=await this.request("/api/sdk/feature-groups","GET");return this.log("Fetched feature groups:",t.feature_groups.length),t}async getRequests(t){if(!this.currentUserId)throw new Error("Census: User must be identified before fetching requests. Call identify() first.");let o=new URLSearchParams;o.set("userId",this.currentUserId),t?.status&&o.set("status",t.status),t?.type&&o.set("type",t.type),t?.limit&&o.set("limit",String(t.limit)),t?.offset&&o.set("offset",String(t.offset));let r=await this.request(`/api/sdk/requests?${o.toString()}`,"GET");return this.log("Fetched requests:",r.requests.length),r}async track(t,o){if(!t)throw new Error("Census: eventType is required for track()");await this.request("/api/sdk/events","POST",{eventType:t,userId:this.currentUserId,properties:o}),this.log("Event tracked:",t);}async trackBatch(t){if(!t.events||t.events.length===0)throw new Error("Census: at least one event is required");if(t.events.length>100)throw new Error("Census: maximum 100 events per batch");let o=t.events.map(r=>({eventType:r.eventType,userId:this.currentUserId,articleId:r.articleId,featureId:r.featureId,properties:r.properties}));await this.request("/api/sdk/events","POST",{events:o}),this.log("Batch events tracked:",t.events.length);}async getGuides(t){let o=new URLSearchParams;t?.projectId&&o.set("project_id",t.projectId),t?.url&&o.set("url",t.url),t?.userId&&o.set("user_id",t.userId);let r=o.toString(),i=`/api/sdk/guides${r?`?${r}`:""}`,n=await this.request(i,"GET");return this.log("Fetched guides:",n.guides.length),n}async getGuide(t){try{let o=await this.request(`/api/sdk/guides/${encodeURIComponent(t)}`,"GET");return this.log("Fetched guide:",t),o.guide}catch(o){if(o.status===404)return null;throw o}}async createGuide(t){if(!t.name||!t.slug)throw new Error("Census: name and slug are required for createGuide()");let o=await this.request("/api/sdk/guides","POST",{name:t.name,slug:t.slug,description:t.description,project_id:t.projectId,trigger_type:t.triggerType||"manual",trigger_config:t.triggerConfig||{},theme:t.theme||{},allow_skip:t.allowSkip??true,show_progress:t.showProgress??true});return this.log("Guide created:",o.guide.id),o.guide}async updateGuide(t,o){if(!t)throw new Error("Census: guideId is required for updateGuide()");let r={};o.name!==void 0&&(r.name=o.name),o.slug!==void 0&&(r.slug=o.slug),o.description!==void 0&&(r.description=o.description),o.triggerType!==void 0&&(r.trigger_type=o.triggerType),o.triggerConfig!==void 0&&(r.trigger_config=o.triggerConfig),o.theme!==void 0&&(r.theme=o.theme),o.allowSkip!==void 0&&(r.allow_skip=o.allowSkip),o.showProgress!==void 0&&(r.show_progress=o.showProgress),o.status!==void 0&&(r.status=o.status);let i=await this.request(`/api/sdk/guides/${encodeURIComponent(t)}`,"PUT",r);return this.log("Guide updated:",t),i.guide}async deleteGuide(t){if(!t)throw new Error("Census: guideId is required for deleteGuide()");await this.request(`/api/sdk/guides/${encodeURIComponent(t)}`,"DELETE"),this.log("Guide deleted:",t);}async getGuideSteps(t){let o=await this.request(`/api/sdk/guides/${encodeURIComponent(t)}/steps`,"GET");return this.log("Fetched steps for guide:",t),o.steps}async addGuideStep(t,o){if(!t)throw new Error("Census: guideId is required for addGuideStep()");let r=await this.request(`/api/sdk/guides/${encodeURIComponent(t)}/steps`,"POST",{step_type:o.stepType||"tooltip",sort_order:o.sortOrder,selector_strategy:o.selectorStrategy||{},title:o.title,content:o.content,tooltip_position:o.tooltipPosition||"auto",rich_content:o.richContent||{},display_config:o.displayConfig||{},advance_config:o.advanceConfig||{trigger:"button"},style_config:o.styleConfig||{}});return this.log("Step added to guide:",t),r.step}async updateGuideStep(t,o,r){if(!t||!o)throw new Error("Census: guideId and stepId are required for updateGuideStep()");let i={};r.stepType!==void 0&&(i.step_type=r.stepType),r.sortOrder!==void 0&&(i.sort_order=r.sortOrder),r.selectorStrategy!==void 0&&(i.selector_strategy=r.selectorStrategy),r.title!==void 0&&(i.title=r.title),r.content!==void 0&&(i.content=r.content),r.tooltipPosition!==void 0&&(i.tooltip_position=r.tooltipPosition),r.richContent!==void 0&&(i.rich_content=r.richContent),r.displayConfig!==void 0&&(i.display_config=r.displayConfig),r.advanceConfig!==void 0&&(i.advance_config=r.advanceConfig),r.styleConfig!==void 0&&(i.style_config=r.styleConfig);let n=await this.request(`/api/sdk/guides/${encodeURIComponent(t)}/steps/${encodeURIComponent(o)}`,"PUT",i);return this.log("Step updated:",o),n.step}async deleteGuideStep(t,o){if(!t||!o)throw new Error("Census: guideId and stepId are required for deleteGuideStep()");await this.request(`/api/sdk/guides/${encodeURIComponent(t)}/steps/${encodeURIComponent(o)}`,"DELETE"),this.log("Step deleted:",o);}async reorderGuideSteps(t,o){if(!t)throw new Error("Census: guideId is required for reorderGuideSteps()");let r=await this.request(`/api/sdk/guides/${encodeURIComponent(t)}/steps`,"PUT",{steps:o});return this.log("Steps reordered for guide:",t),r.steps}async trackGuideEvent(t){if(!t.guideId||!t.eventType||!t.sessionId)throw new Error("Census: guideId, eventType, and sessionId are required for trackGuideEvent()");await this.request("/api/sdk/guides/events","POST",{guideId:t.guideId,eventType:t.eventType,stepId:t.stepId,stepIndex:t.stepIndex,pageUrl:t.pageUrl||(typeof window<"u"?window.location.href:void 0),sessionId:t.sessionId,userId:t.userId||this.currentUserId,metadata:t.metadata}),this.log("Guide event tracked:",t.eventType,t.guideId);}async markGuideCompleted(t){if(!t)throw new Error("Census: guideId is required for markGuideCompleted()");if(!this.currentUserId)throw new Error("Census: User must be identified before marking guides complete. Call identify() first.");await this.request("/api/sdk/guides/complete","POST",{guideId:t,userId:this.currentUserId}),this.log("Guide marked completed:",t);}getCurrentUserId(){return this.currentUserId}isIdentified(){return this.currentUserId!==null}async request(t,o,r){let i=`${this.baseUrl}${t}`,n={"X-Census-Key":this.apiKey};r&&(n["Content-Type"]="application/json"),this.log(`${o} ${t}`,r);let c=await fetch(i,{method:o,headers:n,body:r?JSON.stringify(r):void 0});if(!c.ok){let d=`Request failed with status ${c.status}`;try{d=(await c.json()).error||d;}catch{}throw {error:d,status:c.status}}return c.json()}log(...t){this.debug&&console.log("[Census]",...t);}};function at(e){return new Me(e)}var De=react.createContext(null);function Yt({apiKey:e,baseUrl:t,debug:o,user:r,theme:i={},children:n}){let[c,d]=react.useState(false),[a,l]=react.useState(false),s=react.useMemo(()=>at({apiKey:e,baseUrl:t,debug:o}),[e,t,o]);react.useEffect(()=>{r?s.identify(r).then(()=>{l(true),d(true);}).catch(f=>{console.error("[Census] Failed to identify user:",f),d(true);}):d(true);},[s,r]);let p=react.useMemo(()=>({client:s,theme:i,isReady:c,isIdentified:a}),[s,i,c,a]);return jsxRuntime.jsx(De.Provider,{value:p,children:n})}function Qt(){let e=react.useContext(De);if(!e)throw new Error("useCensus must be used within a CensusProvider");return e.client}function N(){let e=react.useContext(De);if(!e)throw new Error("useCensusContext must be used within a CensusProvider");return e}function Jt(){let{client:e}=N(),[t,o]=react.useState(false),[r,i]=react.useState(null);return {identify:async d=>{o(true),i(null);try{await e.identify(d);}catch(a){throw i(a instanceof Error?a:new Error("Failed to identify user")),a}finally{o(false);}},reset:()=>{e.reset();},isIdentifying:t,isIdentified:e.isIdentified(),error:r}}function me(){let{client:e}=N(),[t,o]=react.useState(false),[r,i]=react.useState(false),[n,c]=react.useState(null),[d,a]=react.useState(null),l=react.useCallback(async p=>{o(true),i(false),c(null),a(null);try{let f=await e.submitFeedback(p);return a(f.feedbackId),i(!0),f}catch(f){let m=f instanceof Error?f:new Error("Failed to submit feedback");throw c(m),m}finally{o(false);}},[e]),s=react.useCallback(()=>{i(false),c(null),a(null);},[]);return {submitFeedback:l,reset:s,isSubmitting:t,isSuccess:r,error:n,feedbackId:d}}function be(e){let{client:t,isReady:o}=N(),[r,i]=react.useState(null),[n,c]=react.useState(true),[d,a]=react.useState(null),l=react.useCallback(async()=>{c(true),a(null);try{let s=await t.getArticles(e);i(s);}catch(s){a(s instanceof Error?s:new Error("Failed to fetch articles"));}finally{c(false);}},[t,e?.category,e?.search,e?.limit,e?.offset]);return react.useEffect(()=>{o&&l();},[o,l]),{articles:r?.articles||[],pagination:r?.pagination,isLoading:n,error:d,refetch:l}}function ye(e){let{client:t,isReady:o}=N(),[r,i]=react.useState(null),[n,c]=react.useState(true),[d,a]=react.useState(null),l=react.useCallback(async()=>{if(!e){i(null),c(false);return}c(true),a(null);try{let s=await t.getArticle(e);i(s);}catch(s){a(s instanceof Error?s:new Error("Failed to fetch article"));}finally{c(false);}},[t,e]);return react.useEffect(()=>{o&&l();},[o,l]),{article:r,isLoading:n,error:d,refetch:l}}function Oe(){let{client:e,isReady:t}=N(),[o,r]=react.useState([]),[i,n]=react.useState(true),[c,d]=react.useState(null),a=react.useCallback(async()=>{n(true),d(null);try{let l=await e.getFeatureGroups();r(l.feature_groups);}catch(l){d(l instanceof Error?l:new Error("Failed to fetch feature groups"));}finally{n(false);}},[e]);return react.useEffect(()=>{t&&a();},[t,a]),{featureGroups:o,isLoading:i,error:c,refetch:a}}function xe(e){let{client:t,isReady:o,isIdentified:r}=N(),[i,n]=react.useState(null),[c,d]=react.useState(true),[a,l]=react.useState(null),s=react.useCallback(async()=>{if(!r){n(null),d(false);return}d(true),l(null);try{let p=await t.getRequests(e);n(p);}catch(p){l(p instanceof Error?p:new Error("Failed to fetch requests"));}finally{d(false);}},[t,r,e?.status,e?.type,e?.limit,e?.offset]);return react.useEffect(()=>{o&&r&&s();},[o,r,s]),{requests:i?.requests||[],pagination:i?.pagination,isLoading:c,error:a,refetch:s}}function to(){let{client:e}=N(),t=react.useCallback(async(r,i)=>{await e.track(r,i);},[e]),o=react.useCallback(async r=>{await e.trackBatch({events:r});},[e]);return {track:t,trackBatch:o}}function oo(e){let{client:t,isReady:o}=N(),[r,i]=react.useState(null),[n,c]=react.useState(true),[d,a]=react.useState(null),l=react.useCallback(async()=>{c(true),a(null);try{let s=await t.getGuides(e);i(s);}catch(s){a(s instanceof Error?s:new Error("Failed to fetch guides"));}finally{c(false);}},[t,e?.projectId,e?.url,e?.userId]);return react.useEffect(()=>{o&&l();},[o,l]),{guides:r?.guides||[],completedGuides:r?.completedGuides||[],isLoading:n,error:d,refetch:l}}function Ne(){let{client:e,isReady:t}=N(),[o,r]=react.useState(null),[i,n]=react.useState([]),[c,d]=react.useState(false),[a,l]=react.useState(false),[s,p]=react.useState(null),[f,m]=react.useState(null),u=react.useRef(false),k=react.useCallback(async w=>{d(true),p(null);try{let x=await e.getGuide(w);return x&&(r(x),n(x.guide_steps||[]),m(x.guide_steps?.[0]?.id||null)),x}catch(x){return p(x instanceof Error?x:new Error("Failed to load guide")),null}finally{d(false);}},[e]),G=react.useCallback(async w=>{l(true),p(null);try{let x=await e.createGuide(w);return r(x),n([]),m(null),x}catch(x){throw p(x instanceof Error?x:new Error("Failed to create guide")),x}finally{l(false);}},[e]),h=react.useCallback(async w=>{if(!o)throw new Error("No guide loaded");l(true),p(null);try{let x=await e.updateGuide(o.id,w);return r(x),u.current=!1,x}catch(x){throw p(x instanceof Error?x:new Error("Failed to update guide")),x}finally{l(false);}},[e,o]),T=react.useCallback(async()=>h({status:"published"}),[h]),R=react.useCallback(async()=>h({status:"draft"}),[h]),C=react.useCallback(async()=>{if(!o)throw new Error("No guide loaded");l(true),p(null);try{await e.deleteGuide(o.id),r(null),n([]),m(null);}catch(w){throw p(w instanceof Error?w:new Error("Failed to delete guide")),w}finally{l(false);}},[e,o]),E=react.useCallback(async w=>{if(!o)throw new Error("No guide loaded");l(true),p(null);try{let x=await e.addGuideStep(o.id,w);return n(W=>[...W,x]),m(x.id),u.current=!0,x}catch(x){throw p(x instanceof Error?x:new Error("Failed to add step")),x}finally{l(false);}},[e,o]),v=react.useCallback(async(w,x)=>{if(!o)throw new Error("No guide loaded");l(true),p(null);try{let W=await e.updateGuideStep(o.id,w,x);return n(q=>q.map(Y=>Y.id===w?W:Y)),u.current=!0,W}catch(W){throw p(W instanceof Error?W:new Error("Failed to update step")),W}finally{l(false);}},[e,o]),I=react.useCallback(async w=>{if(!o)throw new Error("No guide loaded");l(true),p(null);try{await e.deleteGuideStep(o.id,w),n(x=>x.filter(W=>W.id!==w)),f===w&&m(i[0]?.id||null),u.current=!0;}catch(x){throw p(x instanceof Error?x:new Error("Failed to delete step")),x}finally{l(false);}},[e,o,f,i]),g=react.useCallback(async w=>{if(!o)throw new Error("No guide loaded");l(true),p(null);try{let x=await e.reorderGuideSteps(o.id,w);return n(x),u.current=!0,x}catch(x){throw p(x instanceof Error?x:new Error("Failed to reorder steps")),x}finally{l(false);}},[e,o]),A=react.useCallback(async w=>{let x=i.findIndex(q=>q.id===w);if(x<=0)return;let W=i.map((q,Y)=>Y===x?{id:q.id,sort_order:x-1}:Y===x-1?{id:q.id,sort_order:x}:{id:q.id,sort_order:Y});return g(W)},[i,g]),D=react.useCallback(async w=>{let x=i.findIndex(q=>q.id===w);if(x<0||x>=i.length-1)return;let W=i.map((q,Y)=>Y===x?{id:q.id,sort_order:x+1}:Y===x+1?{id:q.id,sort_order:x}:{id:q.id,sort_order:Y});return g(W)},[i,g]),y=f&&i.find(w=>w.id===f)||null,P=react.useCallback(()=>{r(null),n([]),m(null),p(null),u.current=false;},[]);return {guide:o,steps:i,selectedStep:y,selectedStepId:f,isLoading:c,isSaving:a,error:s,isReady:t,hasUnsavedChanges:u.current,loadGuide:k,createGuide:G,updateGuide:h,publishGuide:T,unpublishGuide:R,deleteGuide:C,addStep:E,updateStep:v,deleteStep:I,reorderSteps:g,moveStepUp:A,moveStepDown:D,setSelectedStepId:m,reset:P}}function ro(){let{client:e,isReady:t}=N(),[o,r]=react.useState(null),[i,n]=react.useState(0),[c,d]=react.useState(false),[a,l]=react.useState([]),[s,p]=react.useState([]),f=react.useCallback((P,w=0)=>{r(P),n(w),d(true);},[]),m=react.useCallback(()=>{if(!o)return;let P=o.guide_steps||[];i<P.length-1?n(w=>w+1):(l(w=>[...w,o.id]),d(false),r(null));},[o,i]),u=react.useCallback(()=>{i>0&&n(P=>P-1);},[i]),k=react.useCallback(P=>{if(!o)return;let w=o.guide_steps||[];P>=0&&P<w.length&&n(P);},[o]),G=react.useCallback(()=>{o&&p(P=>[...P,o.id]),d(false),r(null),n(0);},[o]),h=react.useCallback(()=>{d(false);},[]),T=react.useCallback(()=>{o&&d(true);},[o]),R=react.useCallback(async(P,w)=>{let x=P.guide_steps?.[w];if(x)try{await e.track("guide_step_viewed",{guide_id:P.id,guide_name:P.name,step_id:x.id,step_index:w,step_type:x.step_type});}catch{}},[e]),C=react.useCallback(async P=>{try{await e.track("guide_completed",{guide_id:P.id,guide_name:P.name,total_steps:P.guide_steps?.length||0});}catch{}},[e]),E=react.useCallback(async(P,w)=>{try{await e.track("guide_dismissed",{guide_id:P.id,guide_name:P.name,dismissed_at_step:w,total_steps:P.guide_steps?.length||0});}catch{}},[e]),v=o?.guide_steps?.[i]||null,I=o?.guide_steps?.length||0,g=i===I-1,A=i===0,D=react.useCallback(P=>a.includes(P),[a]),y=react.useCallback(P=>s.includes(P),[s]);return {activeGuide:o,currentStep:v,currentStepIndex:i,totalSteps:I,isPlaying:c,isFirstStep:A,isLastStep:g,isReady:t,startGuide:f,nextStep:m,prevStep:u,goToStep:k,dismiss:G,pause:h,resume:T,trackStepView:R,trackGuideComplete:C,trackGuideDismiss:E,completedGuideIds:a,dismissedGuideIds:s,isGuideCompleted:D,isGuideDismissed:y}}var ie={button:{position:"fixed",padding:"12px 20px",border:"none",borderRadius:"8px",cursor:"pointer",fontFamily:"system-ui, -apple-system, sans-serif",fontSize:"14px",fontWeight:"500",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",transition:"transform 0.2s, box-shadow 0.2s",zIndex:9999},modal:{position:"fixed",inset:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:1e4},modalContent:{backgroundColor:"white",borderRadius:"12px",padding:"24px",width:"100%",maxWidth:"400px",margin:"16px",boxShadow:"0 20px 50px rgba(0, 0, 0, 0.2)",fontFamily:"system-ui, -apple-system, sans-serif"},textarea:{width:"100%",padding:"10px 12px",border:"1px solid #e0e0e0",borderRadius:"6px",fontSize:"14px",marginBottom:"16px",minHeight:"100px",resize:"vertical",boxSizing:"border-box",fontFamily:"inherit"},submitButton:{width:"100%",padding:"12px",border:"none",borderRadius:"6px",cursor:"pointer",fontSize:"14px",fontWeight:"500",transition:"opacity 0.2s"},typeButton:{padding:"8px 16px",border:"1px solid #e0e0e0",borderRadius:"6px",cursor:"pointer",fontSize:"13px",backgroundColor:"white",transition:"all 0.2s",marginRight:"8px",marginBottom:"8px"}},no={"bottom-right":{bottom:"20px",right:"20px"},"bottom-left":{bottom:"20px",left:"20px"},"top-right":{top:"20px",right:"20px"},"top-left":{top:"20px",left:"20px"}},io={feedback:"General Feedback",bug_report:"Bug Report",feature_request:"Feature Request",article_rating:"Article Rating"},so={feedback:"\u{1F4AC}",bug_report:"\u{1F41B}",feature_request:"\u{1F4A1}",article_rating:"\u2B50"};function ao(e){return {primaryColor:e.primaryColor||"#000000",textColor:e.textColor||"#333333",backgroundColor:e.backgroundColor||"#ffffff",borderRadius:e.borderRadius||"8px",fontFamily:e.fontFamily||"system-ui, -apple-system, sans-serif"}}function lo({position:e="bottom-right",text:t="Feedback",allowedTypes:o=["feedback","bug_report","feature_request"],theme:r,onSubmit:i,onError:n,children:c}){let{theme:d}=N(),{submitFeedback:a,isSubmitting:l,isSuccess:s,reset:p}=me(),[f,m]=react.useState(false),[u,k]=react.useState(o[0]),[G,h]=react.useState(""),T={...d,...r},R=ao(T),C=react.useCallback(()=>{m(true),p();},[p]),E=react.useCallback(()=>{m(false),h(""),k(o[0]);},[o]),v=react.useCallback(async I=>{I.preventDefault();let g={type:u,message:G};try{await a(g),i?.(g),setTimeout(E,1500);}catch(A){n?.(A instanceof Error?A:new Error("Failed to submit feedback"));}},[u,G,a,i,n,E]);return c?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{onClick:C,style:{cursor:"pointer"},children:c}),f&&jsxRuntime.jsx(ct,{isOpen:f,onClose:E,selectedType:u,onTypeChange:k,allowedTypes:o,message:G,onMessageChange:h,onSubmit:v,isSubmitting:l,isSuccess:s,themeStyles:R})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:C,style:{...ie.button,...no[e],backgroundColor:R.primaryColor,color:"white",borderRadius:R.borderRadius,fontFamily:R.fontFamily},"aria-label":"Open feedback form",children:t}),f&&jsxRuntime.jsx(ct,{isOpen:f,onClose:E,selectedType:u,onTypeChange:k,allowedTypes:o,message:G,onMessageChange:h,onSubmit:v,isSubmitting:l,isSuccess:s,themeStyles:R})]})}function ct({isOpen:e,onClose:t,selectedType:o,onTypeChange:r,allowedTypes:i,message:n,onMessageChange:c,onSubmit:d,isSubmitting:a,isSuccess:l,themeStyles:s}){return e?l?jsxRuntime.jsx("div",{style:ie.modal,onClick:t,children:jsxRuntime.jsxs("div",{style:{...ie.modalContent,textAlign:"center",fontFamily:s.fontFamily},onClick:p=>p.stopPropagation(),children:[jsxRuntime.jsx("div",{style:{fontSize:"48px",marginBottom:"16px"},children:"\u{1F389}"}),jsxRuntime.jsx("h3",{style:{margin:"0 0 8px 0",color:s.textColor},children:"Thanks for your feedback!"}),jsxRuntime.jsx("p",{style:{margin:0,color:"#666"},children:"We appreciate you taking the time to share."})]})}):jsxRuntime.jsx("div",{style:ie.modal,onClick:t,children:jsxRuntime.jsxs("div",{style:{...ie.modalContent,fontFamily:s.fontFamily},onClick:p=>p.stopPropagation(),children:[jsxRuntime.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"20px"},children:[jsxRuntime.jsx("h3",{style:{margin:0,color:s.textColor},children:"Send Feedback"}),jsxRuntime.jsx("button",{onClick:t,style:{background:"none",border:"none",fontSize:"24px",cursor:"pointer",color:"#999",padding:"0",lineHeight:"1"},"aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsxs("form",{onSubmit:d,children:[jsxRuntime.jsxs("div",{style:{marginBottom:"16px"},children:[jsxRuntime.jsx("label",{style:{display:"block",marginBottom:"8px",fontSize:"13px",color:"#666",fontWeight:"500"},children:"What kind of feedback?"}),jsxRuntime.jsx("div",{style:{display:"flex",flexWrap:"wrap"},children:i.map(p=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>r(p),style:{...ie.typeButton,backgroundColor:o===p?s.primaryColor:"white",color:o===p?"white":s.textColor,borderColor:o===p?s.primaryColor:"#e0e0e0"},children:[so[p]," ",io[p]]},p))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{style:{display:"block",marginBottom:"8px",fontSize:"13px",color:"#666",fontWeight:"500"},children:"Your message"}),jsxRuntime.jsx("textarea",{value:n,onChange:p=>c(p.target.value),placeholder:o==="bug_report"?"Describe the bug and steps to reproduce...":o==="feature_request"?"Describe the feature you would like...":"Share your thoughts...",style:ie.textarea,required:true})]}),jsxRuntime.jsx("button",{type:"submit",disabled:a||!n.trim(),style:{...ie.submitButton,backgroundColor:s.primaryColor,color:"white",opacity:a||!n.trim()?.6:1,cursor:a||!n.trim()?"not-allowed":"pointer"},children:a?"Sending...":"Send Feedback"})]})]})}):null}var M={container:{fontFamily:"system-ui, -apple-system, sans-serif",maxWidth:"800px"},searchInput:{width:"100%",padding:"12px 16px",border:"1px solid #e0e0e0",borderRadius:"8px",fontSize:"15px",marginBottom:"24px",boxSizing:"border-box"},categoryButton:{padding:"8px 16px",border:"1px solid #e0e0e0",borderRadius:"20px",cursor:"pointer",fontSize:"13px",backgroundColor:"white",transition:"all 0.2s",marginRight:"8px",marginBottom:"8px"},articleCard:{padding:"20px",border:"1px solid #e0e0e0",borderRadius:"8px",marginBottom:"12px",cursor:"pointer",transition:"box-shadow 0.2s, border-color 0.2s",backgroundColor:"white"},articleTitle:{margin:"0 0 8px 0",fontSize:"16px",fontWeight:"600"},articleDescription:{margin:0,fontSize:"14px",color:"#666",lineHeight:1.5},articleMeta:{display:"flex",gap:"16px",marginTop:"12px",fontSize:"12px",color:"#999"},backButton:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"8px 0",border:"none",background:"none",cursor:"pointer",fontSize:"14px",color:"#666",marginBottom:"16px"},articleContent:{lineHeight:1.7,fontSize:"15px"},loading:{textAlign:"center",padding:"40px",color:"#666"},error:{padding:"20px",backgroundColor:"#fef2f2",borderRadius:"8px",color:"#b91c1c",textAlign:"center"},empty:{textAlign:"center",padding:"40px",color:"#666"}};function po(e){return {primaryColor:e.primaryColor||"#000000",textColor:e.textColor||"#333333",backgroundColor:e.backgroundColor||"#ffffff",borderRadius:e.borderRadius||"8px",fontFamily:e.fontFamily||"system-ui, -apple-system, sans-serif"}}function uo({showSearch:e=true,showCategories:t=true,defaultCategory:o,theme:r,className:i,onArticleView:n}){let{theme:c}=N(),[d,a]=react.useState(""),[l,s]=react.useState(o),[p,f]=react.useState(null),m={...c,...r},u=po(m),{articles:k,isLoading:G,error:h}=be({category:l,search:d||void 0}),{article:T,isLoading:R,error:C}=ye(p||""),E=react.useMemo(()=>{let g=new Set;return k.forEach(A=>{A.category&&g.add(A.category);}),Array.from(g).sort()},[k]),v=g=>{f(g.slug),n?.(g);},I=()=>{f(null);};return p?R?jsxRuntime.jsx("div",{style:{...M.container,fontFamily:u.fontFamily},className:i,children:jsxRuntime.jsx("div",{style:M.loading,children:"Loading article..."})}):C?jsxRuntime.jsxs("div",{style:{...M.container,fontFamily:u.fontFamily},className:i,children:[jsxRuntime.jsx("button",{onClick:I,style:M.backButton,children:"\u2190 Back to articles"}),jsxRuntime.jsx("div",{style:M.error,children:"Failed to load article. Please try again."})]}):T?jsxRuntime.jsxs("div",{style:{...M.container,fontFamily:u.fontFamily},className:i,children:[jsxRuntime.jsx("button",{onClick:I,style:M.backButton,children:"\u2190 Back to articles"}),jsxRuntime.jsxs("article",{children:[jsxRuntime.jsx("h1",{style:{margin:"0 0 16px 0",color:u.textColor},children:T.title}),T.read_time_minutes&&jsxRuntime.jsxs("div",{style:{fontSize:"14px",color:"#666",marginBottom:"24px"},children:[T.read_time_minutes," min read"]}),T.content_html?jsxRuntime.jsx("div",{style:{...M.articleContent,color:u.textColor},dangerouslySetInnerHTML:{__html:T.content_html}}):jsxRuntime.jsx("div",{style:{...M.articleContent,color:u.textColor},children:typeof T.content=="string"?T.content:"No content available."})]})]}):jsxRuntime.jsxs("div",{style:{...M.container,fontFamily:u.fontFamily},className:i,children:[jsxRuntime.jsx("button",{onClick:I,style:M.backButton,children:"\u2190 Back to articles"}),jsxRuntime.jsx("div",{style:M.empty,children:"Article not found."})]}):jsxRuntime.jsxs("div",{style:{...M.container,fontFamily:u.fontFamily},className:i,children:[e&&jsxRuntime.jsx("input",{type:"text",placeholder:"Search articles...",value:d,onChange:g=>a(g.target.value),style:M.searchInput}),t&&E.length>0&&jsxRuntime.jsxs("div",{style:{marginBottom:"24px"},children:[jsxRuntime.jsx("button",{onClick:()=>s(void 0),style:{...M.categoryButton,backgroundColor:l?"white":u.primaryColor,color:l?u.textColor:"white",borderColor:l?"#e0e0e0":u.primaryColor},children:"All"}),E.map(g=>jsxRuntime.jsx("button",{onClick:()=>s(g),style:{...M.categoryButton,backgroundColor:l===g?u.primaryColor:"white",color:l===g?"white":u.textColor,borderColor:l===g?u.primaryColor:"#e0e0e0"},children:g},g))]}),G&&jsxRuntime.jsx("div",{style:M.loading,children:"Loading articles..."}),h&&jsxRuntime.jsx("div",{style:M.error,children:"Failed to load articles. Please try again."}),!G&&!h&&k.length===0&&jsxRuntime.jsx("div",{style:M.empty,children:d?`No articles found for "${d}"`:"No articles available yet."}),!G&&!h&&k.length>0&&jsxRuntime.jsx("div",{children:k.map(g=>jsxRuntime.jsxs("div",{onClick:()=>v(g),style:M.articleCard,role:"button",tabIndex:0,onKeyDown:A=>{(A.key==="Enter"||A.key===" ")&&v(g);},children:[jsxRuntime.jsx("h3",{style:{...M.articleTitle,color:u.textColor},children:g.title}),g.seo_description&&jsxRuntime.jsx("p",{style:M.articleDescription,children:g.seo_description}),jsxRuntime.jsxs("div",{style:M.articleMeta,children:[g.category&&jsxRuntime.jsx("span",{children:g.category}),g.read_time_minutes&&jsxRuntime.jsxs("span",{children:[g.read_time_minutes," min read"]})]})]},g.id))})]})}var K={container:{fontFamily:"system-ui, -apple-system, sans-serif"},list:{listStyle:"none",padding:0,margin:0,display:"flex",flexDirection:"column",gap:"12px"},card:{border:"1px solid #e5e7eb",borderRadius:"8px",padding:"16px",backgroundColor:"#ffffff",cursor:"pointer",transition:"border-color 0.15s, box-shadow 0.15s"},cardHover:{borderColor:"#d1d5db",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},header:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px",marginBottom:"8px"},badges:{display:"flex",alignItems:"center",gap:"6px"},badge:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"2px 8px",borderRadius:"9999px",fontSize:"12px",fontWeight:500},message:{fontSize:"14px",color:"#111827",margin:0,lineHeight:1.5},meta:{display:"flex",gap:"12px",marginTop:"8px",fontSize:"12px",color:"#6b7280"},empty:{textAlign:"center",padding:"32px 16px",color:"#6b7280"},emptyIcon:{width:"48px",height:"48px",margin:"0 auto 12px",color:"#d1d5db"},loading:{textAlign:"center",padding:"24px",color:"#6b7280"},error:{textAlign:"center",padding:"24px",color:"#dc2626"}},ut={feedback:{label:"Feedback",color:"#2563eb",bg:"#dbeafe"},bug_report:{label:"Bug Report",color:"#dc2626",bg:"#fee2e2"},feature_request:{label:"Feature Request",color:"#d97706",bg:"#fef3c7"},article_rating:{label:"Article Rating",color:"#7c3aed",bg:"#ede9fe"}},ft={new:{label:"New",color:"#6b7280",bg:"#f3f4f6"},reviewed:{label:"Reviewed",color:"#2563eb",bg:"#dbeafe"},in_progress:{label:"In Progress",color:"#d97706",bg:"#fef3c7"},resolved:{label:"Resolved",color:"#059669",bg:"#d1fae5"},closed:{label:"Closed",color:"#6b7280",bg:"#f3f4f6"}};function mo(e){return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function bo({status:e,type:t,limit:o=50,className:r,showEmptyState:i=true,onRequestClick:n}){let{isIdentified:c}=N(),[d,a]=react.useState(null),{requests:l,isLoading:s,error:p,refetch:f}=xe({status:e,type:t,limit:o}),m=react.useCallback(u=>{n?.(u);},[n]);return c?s?jsxRuntime.jsx("div",{style:K.loading,children:jsxRuntime.jsx("p",{children:"Loading requests..."})}):p?jsxRuntime.jsx("div",{style:K.error,children:jsxRuntime.jsxs("p",{children:["Failed to load requests. ",jsxRuntime.jsx("button",{onClick:f,style:{color:"inherit",textDecoration:"underline",background:"none",border:"none",cursor:"pointer"},children:"Try again"})]})}):l.length===0&&i?jsxRuntime.jsxs("div",{style:K.empty,children:[jsxRuntime.jsx("svg",{style:K.emptyIcon,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z"})}),jsxRuntime.jsx("p",{style:{margin:0,fontWeight:500,color:"#111827"},children:"No requests yet"}),jsxRuntime.jsx("p",{style:{margin:"8px 0 0",fontSize:"14px"},children:"When you submit feedback, bug reports, or feature requests, they'll appear here."})]}):jsxRuntime.jsx("div",{style:K.container,className:r,children:jsxRuntime.jsx("ul",{style:K.list,children:l.map(u=>{let k=ut[u.feedback_type]||ut.feedback,G=ft[u.status]||ft.new,h=d===u.id;return jsxRuntime.jsxs("li",{style:{...K.card,...h?K.cardHover:{}},onMouseEnter:()=>a(u.id),onMouseLeave:()=>a(null),onClick:()=>m(u),role:"button",tabIndex:0,onKeyDown:T=>{(T.key==="Enter"||T.key===" ")&&m(u);},children:[jsxRuntime.jsx("div",{style:K.header,children:jsxRuntime.jsxs("div",{style:K.badges,children:[jsxRuntime.jsx("span",{style:{...K.badge,color:k.color,backgroundColor:k.bg},children:k.label}),jsxRuntime.jsx("span",{style:{...K.badge,color:G.color,backgroundColor:G.bg},children:G.label})]})}),jsxRuntime.jsx("p",{style:K.message,children:u.message||"No message provided"}),jsxRuntime.jsxs("div",{style:K.meta,children:[jsxRuntime.jsx("span",{children:mo(u.created_at)}),u.page_url&&jsxRuntime.jsxs("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"200px"},children:["From: ",u.page_url]})]})]},u.id)})})}):i?jsxRuntime.jsx("div",{style:K.empty,children:jsxRuntime.jsx("p",{children:"Please sign in to view your requests."})}):null}var ho={articles:"Documentation",requests:"My Requests"},mt={feedback:{label:"Feedback",color:"#2563eb",bg:"#dbeafe"},bug_report:{label:"Bug Report",color:"#dc2626",bg:"#fee2e2"},feature_request:{label:"Feature Request",color:"#d97706",bg:"#fef3c7"},article_rating:{label:"Article Rating",color:"#7c3aed",bg:"#ede9fe"}},bt={new:{label:"New",color:"#6b7280",bg:"#f3f4f6"},planned:{label:"Planned",color:"#2563eb",bg:"#dbeafe"},in_progress:{label:"In Progress",color:"#d97706",bg:"#fef3c7"},resolved:{label:"Resolved",color:"#059669",bg:"#d1fae5"},closed:{label:"Closed",color:"#6b7280",bg:"#f3f4f6"}};function vo(e){return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}var So=[{value:"feedback",label:"Feedback"},{value:"bug_report",label:"Bug"},{value:"feature_request",label:"Feature"}],Co=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),yt=()=>jsxRuntime.jsx("svg",{width:"20",height:"20",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.747 0 3.332.477 4.5 1.253v13C19.832 18.477 18.247 18 16.5 18c-1.746 0-3.332.477-4.5 1.253"})}),xt=()=>jsxRuntime.jsx("svg",{width:"20",height:"20",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),wo=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})}),ko=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 19l-7-7m0 0l7-7m-7 7h18"})}),Ro=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})}),Go=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"})}),To=()=>jsxRuntime.jsx("svg",{width:"48",height:"48",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z"})}),Eo=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),je=()=>jsxRuntime.jsx("svg",{width:"20",height:"20",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",style:{animation:"spin 1s linear infinite"},children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})}),ht={light:{primary:"#c45a2c",primaryHover:"#a84a24",primaryLight:"rgba(196, 90, 44, 0.08)",primaryLightHover:"rgba(196, 90, 44, 0.15)",background:"transparent",surface:"#ffffff",surfaceHover:"#fafafa",border:"rgba(0, 0, 0, 0.08)",borderHover:"rgba(196, 90, 44, 0.25)",text:"#1a1a1a",textSecondary:"#525252",textMuted:"#737373",textLight:"#a3a3a3"},dark:{primary:"#e07347",primaryHover:"#f08a5d",primaryLight:"rgba(224, 115, 71, 0.12)",primaryLightHover:"rgba(224, 115, 71, 0.2)",background:"transparent",surface:"rgba(255, 255, 255, 0.03)",surfaceHover:"rgba(255, 255, 255, 0.06)",border:"rgba(255, 255, 255, 0.08)",borderHover:"rgba(224, 115, 71, 0.35)",text:"#fafafa",textSecondary:"#d4d4d4",textMuted:"#a3a3a3",textLight:"#737373"}},Io=e=>({container:{fontFamily:'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',minHeight:"400px",color:e.text},grid:{display:"grid",gridTemplateColumns:"220px 1fr",gap:"40px"},sidebar:{position:"sticky",top:"24px",height:"fit-content"},main:{minWidth:0},tabs:{display:"flex",borderBottom:`1px solid ${e.border}`,marginBottom:"28px",gap:"0"},tab:{padding:"10px 20px",fontSize:"14px",fontWeight:500,border:"none",borderBottom:"2px solid transparent",cursor:"pointer",transition:"all 0.15s",backgroundColor:"transparent",color:e.textMuted,marginBottom:"-1px"},tabActive:{color:e.primary,borderBottomColor:e.primary},searchContainer:{position:"relative",marginBottom:"20px"},searchIcon:{position:"absolute",left:"10px",top:"50%",transform:"translateY(-50%)",color:e.textLight},searchInput:{width:"100%",padding:"8px 10px 8px 32px",fontSize:"13px",border:`1px solid ${e.border}`,borderRadius:"6px",outline:"none",backgroundColor:"transparent",color:e.text,boxSizing:"border-box"},sectionTitle:{fontSize:"10px",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em",color:e.textLight,marginBottom:"8px",marginTop:"20px"},navList:{listStyle:"none",padding:0,margin:0},navItem:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",padding:"6px 10px",fontSize:"13px",color:e.textSecondary,backgroundColor:"transparent",border:"none",borderRadius:"6px",cursor:"pointer",textAlign:"left",transition:"all 0.15s"},navItemActive:{backgroundColor:e.surfaceHover,color:e.text,fontWeight:500},subNav:{marginLeft:"20px",marginTop:"2px",paddingLeft:"10px",borderLeft:`1px solid ${e.border}`},articleGrid:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(280px, 1fr))",gap:"12px"},articleCard:{display:"flex",alignItems:"flex-start",gap:"12px",padding:"14px",border:`1px solid ${e.border}`,borderRadius:"8px",backgroundColor:e.surface,cursor:"pointer",transition:"all 0.2s ease",textAlign:"left"},articleIcon:{flexShrink:0,width:"36px",height:"36px",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:e.primaryLight,borderRadius:"8px",color:e.primary,transition:"background-color 0.2s"},articleContent:{flex:1,minWidth:0},articleTitle:{fontSize:"14px",fontWeight:500,color:e.text,margin:0,lineHeight:1.4},articleDesc:{fontSize:"12px",color:e.textMuted,margin:"4px 0 0",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",lineHeight:1.5},articleMeta:{fontSize:"11px",color:e.textLight,marginTop:"6px"},articleChevron:{flexShrink:0,color:e.textLight,transition:"color 0.2s"},backButton:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"6px 0",fontSize:"13px",color:e.textMuted,backgroundColor:"transparent",border:"none",cursor:"pointer",marginBottom:"20px",transition:"color 0.15s"},articleDetail:{maxWidth:"720px"},articleDetailTitle:{fontSize:"28px",fontWeight:600,color:e.text,margin:0,lineHeight:1.3},articleDetailMeta:{display:"flex",alignItems:"center",gap:"6px",fontSize:"13px",color:e.textMuted,marginTop:"10px"},articleDetailContent:{marginTop:"28px",fontSize:"15px",lineHeight:1.7,color:e.textSecondary},emptyState:{textAlign:"center",padding:"48px 24px",color:e.textMuted},emptyIcon:{color:e.textLight,marginBottom:"12px",opacity:.5},emptyTitle:{fontSize:"16px",fontWeight:500,color:e.text,margin:"0 0 6px"},emptyText:{fontSize:"13px",margin:0,color:e.textMuted},loading:{display:"flex",alignItems:"center",justifyContent:"center",gap:"10px",padding:"48px",color:e.textMuted,fontSize:"13px"},requestCard:{border:`1px solid ${e.border}`,borderRadius:"8px",padding:"16px",backgroundColor:e.surface,marginBottom:"10px",transition:"border-color 0.2s"},requestHeader:{display:"flex",alignItems:"center",gap:"6px",marginBottom:"10px"},badge:{display:"inline-flex",alignItems:"center",padding:"3px 8px",borderRadius:"9999px",fontSize:"11px",fontWeight:500},requestMessage:{fontSize:"14px",color:e.text,margin:0,lineHeight:1.5},requestMeta:{display:"flex",gap:"12px",marginTop:"10px",fontSize:"12px",color:e.textMuted},form:{padding:"16px",backgroundColor:e.surface,borderRadius:"8px",border:`1px solid ${e.border}`,marginBottom:"20px"},formHeader:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"12px"},formTitle:{fontSize:"14px",fontWeight:500,color:e.text,margin:0},typeSelector:{display:"flex",gap:"6px",marginBottom:"12px"},typeButton:{padding:"6px 12px",borderRadius:"6px",border:`1px solid ${e.border}`,backgroundColor:"transparent",color:e.textSecondary,fontSize:"13px",cursor:"pointer",transition:"all 0.15s",fontWeight:500},typeButtonActive:{backgroundColor:e.primary,borderColor:e.primary,color:"#ffffff"},textarea:{width:"100%",padding:"10px 12px",borderRadius:"6px",border:`1px solid ${e.border}`,fontSize:"13px",resize:"vertical",minHeight:"80px",fontFamily:"inherit",marginBottom:"12px",boxSizing:"border-box",backgroundColor:"transparent",color:e.text},submitButton:{padding:"8px 16px",borderRadius:"6px",border:"none",backgroundColor:e.primary,color:"#ffffff",fontSize:"13px",fontWeight:500,cursor:"pointer",transition:"all 0.15s"},newRequestButton:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"8px 16px",borderRadius:"6px",border:"none",backgroundColor:e.primary,color:"#ffffff",fontSize:"13px",fontWeight:500,cursor:"pointer",marginBottom:"20px",transition:"background-color 0.15s"},successMessage:{padding:"12px 14px",backgroundColor:"rgba(5, 150, 105, 0.1)",borderRadius:"6px",color:"#059669",fontSize:"13px",marginBottom:"12px",fontWeight:500}}),Po=(e,t)=>`
1
+ 'use strict';var react=require('react'),jsxRuntime=require('react/jsx-runtime');var Vt="https://api.census.ai",Me=class{constructor(t){this.currentUserId=null;if(!t.apiKey)throw new Error("Census: apiKey is required");["cs_live_","cs_test_","op_live_","op_test_"].some(r=>t.apiKey.startsWith(r))||console.warn('Census: API key should start with "cs_live_" or "cs_test_"'),this.apiKey=t.apiKey,this.baseUrl=t.baseUrl||Vt,this.debug=t.debug||false,this.log("Initialized with base URL:",this.baseUrl);}async identify(t){if(!t.userId)throw new Error("Census: userId is required for identify()");this.currentUserId=t.userId,await this.request("/api/sdk/identify","POST",{userId:t.userId,email:t.email,name:t.name,avatarUrl:t.avatarUrl,metadata:t.metadata,organizationId:t.organizationId,organizationName:t.organizationName,organizationDomain:t.organizationDomain,organizationPlan:t.organizationPlan}),this.log("User identified:",t.userId);}reset(){this.currentUserId=null,this.log("User identity reset");}async submitFeedback(t){let o=["feedback","bug_report","feature_request","article_rating"];if(!t.type||!o.includes(t.type))throw new Error(`Census: type must be one of: ${o.join(", ")}`);if(t.type==="article_rating"){if(t.rating===void 0&&t.helpful===void 0)throw new Error("Census: article_rating requires rating or helpful field")}else if(!t.message)throw new Error("Census: message is required for this feedback type");let r=await this.request("/api/sdk/feedback","POST",{type:t.type,message:t.message,rating:t.rating,helpful:t.helpful,userId:this.currentUserId,articleId:t.articleId,pageUrl:typeof window<"u"?window.location.href:void 0,metadata:t.metadata});return this.log("Feedback submitted:",r.feedbackId),{feedbackId:r.feedbackId}}async getArticles(t){let o=new URLSearchParams;t?.category&&o.set("category",t.category),t?.search&&o.set("search",t.search),t?.limit&&o.set("limit",String(t.limit)),t?.offset&&o.set("offset",String(t.offset));let r=o.toString(),i=`/api/sdk/articles${r?`?${r}`:""}`,n=await this.request(i,"GET");return this.log("Fetched articles:",n.articles.length),n}async getArticle(t){try{let o=await this.request(`/api/sdk/articles/${encodeURIComponent(t)}`,"GET");return this.log("Fetched article:",t),o.article}catch(o){if(o.status===404)return null;throw o}}async getFeatureGroups(){let t=await this.request("/api/sdk/feature-groups","GET");return this.log("Fetched feature groups:",t.feature_groups.length),t}async getRequests(t){if(!this.currentUserId)throw new Error("Census: User must be identified before fetching requests. Call identify() first.");let o=new URLSearchParams;o.set("userId",this.currentUserId),t?.status&&o.set("status",t.status),t?.type&&o.set("type",t.type),t?.limit&&o.set("limit",String(t.limit)),t?.offset&&o.set("offset",String(t.offset));let r=await this.request(`/api/sdk/requests?${o.toString()}`,"GET");return this.log("Fetched requests:",r.requests.length),r}async track(t,o){if(!t)throw new Error("Census: eventType is required for track()");await this.request("/api/sdk/events","POST",{eventType:t,userId:this.currentUserId,properties:o}),this.log("Event tracked:",t);}async trackBatch(t){if(!t.events||t.events.length===0)throw new Error("Census: at least one event is required");if(t.events.length>100)throw new Error("Census: maximum 100 events per batch");let o=t.events.map(r=>({eventType:r.eventType,userId:this.currentUserId,articleId:r.articleId,featureId:r.featureId,properties:r.properties}));await this.request("/api/sdk/events","POST",{events:o}),this.log("Batch events tracked:",t.events.length);}async getGuides(t){let o=new URLSearchParams;t?.projectId&&o.set("project_id",t.projectId),t?.url&&o.set("url",t.url),t?.userId&&o.set("user_id",t.userId);let r=o.toString(),i=`/api/sdk/guides${r?`?${r}`:""}`,n=await this.request(i,"GET");return this.log("Fetched guides:",n.guides.length),n}async getGuide(t){try{let o=await this.request(`/api/sdk/guides/${encodeURIComponent(t)}`,"GET");return this.log("Fetched guide:",t),o.guide}catch(o){if(o.status===404)return null;throw o}}async createGuide(t){if(!t.name||!t.slug)throw new Error("Census: name and slug are required for createGuide()");let o=await this.request("/api/sdk/guides","POST",{name:t.name,slug:t.slug,description:t.description,project_id:t.projectId,trigger_type:t.triggerType||"manual",trigger_config:t.triggerConfig||{},theme:t.theme||{},allow_skip:t.allowSkip??true,show_progress:t.showProgress??true});return this.log("Guide created:",o.guide.id),o.guide}async updateGuide(t,o){if(!t)throw new Error("Census: guideId is required for updateGuide()");let r={};o.name!==void 0&&(r.name=o.name),o.slug!==void 0&&(r.slug=o.slug),o.description!==void 0&&(r.description=o.description),o.triggerType!==void 0&&(r.trigger_type=o.triggerType),o.triggerConfig!==void 0&&(r.trigger_config=o.triggerConfig),o.theme!==void 0&&(r.theme=o.theme),o.allowSkip!==void 0&&(r.allow_skip=o.allowSkip),o.showProgress!==void 0&&(r.show_progress=o.showProgress),o.status!==void 0&&(r.status=o.status);let i=await this.request(`/api/sdk/guides/${encodeURIComponent(t)}`,"PUT",r);return this.log("Guide updated:",t),i.guide}async deleteGuide(t){if(!t)throw new Error("Census: guideId is required for deleteGuide()");await this.request(`/api/sdk/guides/${encodeURIComponent(t)}`,"DELETE"),this.log("Guide deleted:",t);}async getGuideSteps(t){let o=await this.request(`/api/sdk/guides/${encodeURIComponent(t)}/steps`,"GET");return this.log("Fetched steps for guide:",t),o.steps}async addGuideStep(t,o){if(!t)throw new Error("Census: guideId is required for addGuideStep()");let r=await this.request(`/api/sdk/guides/${encodeURIComponent(t)}/steps`,"POST",{step_type:o.stepType||"tooltip",sort_order:o.sortOrder,selector_strategy:o.selectorStrategy||{},title:o.title,content:o.content,tooltip_position:o.tooltipPosition||"auto",rich_content:o.richContent||{},display_config:o.displayConfig||{},advance_config:o.advanceConfig||{trigger:"button"},style_config:o.styleConfig||{}});return this.log("Step added to guide:",t),r.step}async updateGuideStep(t,o,r){if(!t||!o)throw new Error("Census: guideId and stepId are required for updateGuideStep()");let i={};r.stepType!==void 0&&(i.step_type=r.stepType),r.sortOrder!==void 0&&(i.sort_order=r.sortOrder),r.selectorStrategy!==void 0&&(i.selector_strategy=r.selectorStrategy),r.title!==void 0&&(i.title=r.title),r.content!==void 0&&(i.content=r.content),r.tooltipPosition!==void 0&&(i.tooltip_position=r.tooltipPosition),r.richContent!==void 0&&(i.rich_content=r.richContent),r.displayConfig!==void 0&&(i.display_config=r.displayConfig),r.advanceConfig!==void 0&&(i.advance_config=r.advanceConfig),r.styleConfig!==void 0&&(i.style_config=r.styleConfig);let n=await this.request(`/api/sdk/guides/${encodeURIComponent(t)}/steps/${encodeURIComponent(o)}`,"PUT",i);return this.log("Step updated:",o),n.step}async deleteGuideStep(t,o){if(!t||!o)throw new Error("Census: guideId and stepId are required for deleteGuideStep()");await this.request(`/api/sdk/guides/${encodeURIComponent(t)}/steps/${encodeURIComponent(o)}`,"DELETE"),this.log("Step deleted:",o);}async reorderGuideSteps(t,o){if(!t)throw new Error("Census: guideId is required for reorderGuideSteps()");let r=await this.request(`/api/sdk/guides/${encodeURIComponent(t)}/steps`,"PUT",{steps:o});return this.log("Steps reordered for guide:",t),r.steps}async trackGuideEvent(t){if(!t.guideId||!t.eventType||!t.sessionId)throw new Error("Census: guideId, eventType, and sessionId are required for trackGuideEvent()");await this.request("/api/sdk/guides/events","POST",{guideId:t.guideId,eventType:t.eventType,stepId:t.stepId,stepIndex:t.stepIndex,pageUrl:t.pageUrl||(typeof window<"u"?window.location.href:void 0),sessionId:t.sessionId,userId:t.userId||this.currentUserId,metadata:t.metadata}),this.log("Guide event tracked:",t.eventType,t.guideId);}async markGuideCompleted(t){if(!t)throw new Error("Census: guideId is required for markGuideCompleted()");if(!this.currentUserId)throw new Error("Census: User must be identified before marking guides complete. Call identify() first.");await this.request("/api/sdk/guides/complete","POST",{guideId:t,userId:this.currentUserId}),this.log("Guide marked completed:",t);}getCurrentUserId(){return this.currentUserId}isIdentified(){return this.currentUserId!==null}async request(t,o,r){let i=`${this.baseUrl}${t}`,n={"X-Census-Key":this.apiKey};r&&(n["Content-Type"]="application/json"),this.log(`${o} ${t}`,r);let c=await fetch(i,{method:o,headers:n,body:r?JSON.stringify(r):void 0});if(!c.ok){let d=`Request failed with status ${c.status}`;try{d=(await c.json()).error||d;}catch{}throw {error:d,status:c.status}}return c.json()}log(...t){this.debug&&console.log("[Census]",...t);}};function at(e){return new Me(e)}var De=react.createContext(null);function Yt({apiKey:e,baseUrl:t,debug:o,user:r,theme:i={},children:n}){let[c,d]=react.useState(false),[a,l]=react.useState(false),s=react.useMemo(()=>at({apiKey:e,baseUrl:t,debug:o}),[e,t,o]);react.useEffect(()=>{r?s.identify(r).then(()=>{l(true),d(true);}).catch(f=>{console.error("[Census] Failed to identify user:",f),d(true);}):d(true);},[s,r]);let p=react.useMemo(()=>({client:s,theme:i,isReady:c,isIdentified:a}),[s,i,c,a]);return jsxRuntime.jsx(De.Provider,{value:p,children:n})}function Qt(){let e=react.useContext(De);if(!e)throw new Error("useCensus must be used within a CensusProvider");return e.client}function N(){let e=react.useContext(De);if(!e)throw new Error("useCensusContext must be used within a CensusProvider");return e}function Jt(){let{client:e}=N(),[t,o]=react.useState(false),[r,i]=react.useState(null);return {identify:async d=>{o(true),i(null);try{await e.identify(d);}catch(a){throw i(a instanceof Error?a:new Error("Failed to identify user")),a}finally{o(false);}},reset:()=>{e.reset();},isIdentifying:t,isIdentified:e.isIdentified(),error:r}}function me(){let{client:e}=N(),[t,o]=react.useState(false),[r,i]=react.useState(false),[n,c]=react.useState(null),[d,a]=react.useState(null),l=react.useCallback(async p=>{o(true),i(false),c(null),a(null);try{let f=await e.submitFeedback(p);return a(f.feedbackId),i(!0),f}catch(f){let m=f instanceof Error?f:new Error("Failed to submit feedback");throw c(m),m}finally{o(false);}},[e]),s=react.useCallback(()=>{i(false),c(null),a(null);},[]);return {submitFeedback:l,reset:s,isSubmitting:t,isSuccess:r,error:n,feedbackId:d}}function be(e){let{client:t,isReady:o}=N(),[r,i]=react.useState(null),[n,c]=react.useState(true),[d,a]=react.useState(null),l=react.useCallback(async()=>{c(true),a(null);try{let s=await t.getArticles(e);i(s);}catch(s){a(s instanceof Error?s:new Error("Failed to fetch articles"));}finally{c(false);}},[t,e?.category,e?.search,e?.limit,e?.offset]);return react.useEffect(()=>{o&&l();},[o,l]),{articles:r?.articles||[],pagination:r?.pagination,isLoading:n,error:d,refetch:l}}function ye(e){let{client:t,isReady:o}=N(),[r,i]=react.useState(null),[n,c]=react.useState(true),[d,a]=react.useState(null),l=react.useCallback(async()=>{if(!e){i(null),c(false);return}c(true),a(null);try{let s=await t.getArticle(e);i(s);}catch(s){a(s instanceof Error?s:new Error("Failed to fetch article"));}finally{c(false);}},[t,e]);return react.useEffect(()=>{o&&l();},[o,l]),{article:r,isLoading:n,error:d,refetch:l}}function Oe(){let{client:e,isReady:t}=N(),[o,r]=react.useState([]),[i,n]=react.useState(true),[c,d]=react.useState(null),a=react.useCallback(async()=>{n(true),d(null);try{let l=await e.getFeatureGroups();r(l.feature_groups);}catch(l){d(l instanceof Error?l:new Error("Failed to fetch feature groups"));}finally{n(false);}},[e]);return react.useEffect(()=>{t&&a();},[t,a]),{featureGroups:o,isLoading:i,error:c,refetch:a}}function xe(e){let{client:t,isReady:o,isIdentified:r}=N(),[i,n]=react.useState(null),[c,d]=react.useState(true),[a,l]=react.useState(null),s=react.useCallback(async()=>{if(!r){n(null),d(false);return}d(true),l(null);try{let p=await t.getRequests(e);n(p);}catch(p){l(p instanceof Error?p:new Error("Failed to fetch requests"));}finally{d(false);}},[t,r,e?.status,e?.type,e?.limit,e?.offset]);return react.useEffect(()=>{o&&r&&s();},[o,r,s]),{requests:i?.requests||[],pagination:i?.pagination,isLoading:c,error:a,refetch:s}}function to(){let{client:e}=N(),t=react.useCallback(async(r,i)=>{await e.track(r,i);},[e]),o=react.useCallback(async r=>{await e.trackBatch({events:r});},[e]);return {track:t,trackBatch:o}}function oo(e){let{client:t,isReady:o}=N(),[r,i]=react.useState(null),[n,c]=react.useState(true),[d,a]=react.useState(null),l=react.useCallback(async()=>{c(true),a(null);try{let s=await t.getGuides(e);i(s);}catch(s){a(s instanceof Error?s:new Error("Failed to fetch guides"));}finally{c(false);}},[t,e?.projectId,e?.url,e?.userId]);return react.useEffect(()=>{o&&l();},[o,l]),{guides:r?.guides||[],completedGuides:r?.completedGuides||[],isLoading:n,error:d,refetch:l}}function Ne(){let{client:e,isReady:t}=N(),[o,r]=react.useState(null),[i,n]=react.useState([]),[c,d]=react.useState(false),[a,l]=react.useState(false),[s,p]=react.useState(null),[f,m]=react.useState(null),u=react.useRef(false),k=react.useCallback(async w=>{d(true),p(null);try{let x=await e.getGuide(w);return x&&(r(x),n(x.guide_steps||[]),m(x.guide_steps?.[0]?.id||null)),x}catch(x){return p(x instanceof Error?x:new Error("Failed to load guide")),null}finally{d(false);}},[e]),G=react.useCallback(async w=>{l(true),p(null);try{let x=await e.createGuide(w);return r(x),n([]),m(null),x}catch(x){throw p(x instanceof Error?x:new Error("Failed to create guide")),x}finally{l(false);}},[e]),h=react.useCallback(async w=>{if(!o)throw new Error("No guide loaded");l(true),p(null);try{let x=await e.updateGuide(o.id,w);return r(x),u.current=!1,x}catch(x){throw p(x instanceof Error?x:new Error("Failed to update guide")),x}finally{l(false);}},[e,o]),T=react.useCallback(async()=>h({status:"published"}),[h]),R=react.useCallback(async()=>h({status:"draft"}),[h]),C=react.useCallback(async()=>{if(!o)throw new Error("No guide loaded");l(true),p(null);try{await e.deleteGuide(o.id),r(null),n([]),m(null);}catch(w){throw p(w instanceof Error?w:new Error("Failed to delete guide")),w}finally{l(false);}},[e,o]),E=react.useCallback(async w=>{if(!o)throw new Error("No guide loaded");l(true),p(null);try{let x=await e.addGuideStep(o.id,w);return n(W=>[...W,x]),m(x.id),u.current=!0,x}catch(x){throw p(x instanceof Error?x:new Error("Failed to add step")),x}finally{l(false);}},[e,o]),v=react.useCallback(async(w,x)=>{if(!o)throw new Error("No guide loaded");l(true),p(null);try{let W=await e.updateGuideStep(o.id,w,x);return n(q=>q.map(Y=>Y.id===w?W:Y)),u.current=!0,W}catch(W){throw p(W instanceof Error?W:new Error("Failed to update step")),W}finally{l(false);}},[e,o]),I=react.useCallback(async w=>{if(!o)throw new Error("No guide loaded");l(true),p(null);try{await e.deleteGuideStep(o.id,w),n(x=>x.filter(W=>W.id!==w)),f===w&&m(i[0]?.id||null),u.current=!0;}catch(x){throw p(x instanceof Error?x:new Error("Failed to delete step")),x}finally{l(false);}},[e,o,f,i]),g=react.useCallback(async w=>{if(!o)throw new Error("No guide loaded");l(true),p(null);try{let x=await e.reorderGuideSteps(o.id,w);return n(x),u.current=!0,x}catch(x){throw p(x instanceof Error?x:new Error("Failed to reorder steps")),x}finally{l(false);}},[e,o]),A=react.useCallback(async w=>{let x=i.findIndex(q=>q.id===w);if(x<=0)return;let W=i.map((q,Y)=>Y===x?{id:q.id,sort_order:x-1}:Y===x-1?{id:q.id,sort_order:x}:{id:q.id,sort_order:Y});return g(W)},[i,g]),D=react.useCallback(async w=>{let x=i.findIndex(q=>q.id===w);if(x<0||x>=i.length-1)return;let W=i.map((q,Y)=>Y===x?{id:q.id,sort_order:x+1}:Y===x+1?{id:q.id,sort_order:x}:{id:q.id,sort_order:Y});return g(W)},[i,g]),y=f&&i.find(w=>w.id===f)||null,P=react.useCallback(()=>{r(null),n([]),m(null),p(null),u.current=false;},[]);return {guide:o,steps:i,selectedStep:y,selectedStepId:f,isLoading:c,isSaving:a,error:s,isReady:t,hasUnsavedChanges:u.current,loadGuide:k,createGuide:G,updateGuide:h,publishGuide:T,unpublishGuide:R,deleteGuide:C,addStep:E,updateStep:v,deleteStep:I,reorderSteps:g,moveStepUp:A,moveStepDown:D,setSelectedStepId:m,reset:P}}function ro(){let{client:e,isReady:t}=N(),[o,r]=react.useState(null),[i,n]=react.useState(0),[c,d]=react.useState(false),[a,l]=react.useState([]),[s,p]=react.useState([]),f=react.useCallback((P,w=0)=>{r(P),n(w),d(true);},[]),m=react.useCallback(()=>{if(!o)return;let P=o.guide_steps||[];i<P.length-1?n(w=>w+1):(l(w=>[...w,o.id]),d(false),r(null));},[o,i]),u=react.useCallback(()=>{i>0&&n(P=>P-1);},[i]),k=react.useCallback(P=>{if(!o)return;let w=o.guide_steps||[];P>=0&&P<w.length&&n(P);},[o]),G=react.useCallback(()=>{o&&p(P=>[...P,o.id]),d(false),r(null),n(0);},[o]),h=react.useCallback(()=>{d(false);},[]),T=react.useCallback(()=>{o&&d(true);},[o]),R=react.useCallback(async(P,w)=>{let x=P.guide_steps?.[w];if(x)try{await e.track("guide_step_viewed",{guide_id:P.id,guide_name:P.name,step_id:x.id,step_index:w,step_type:x.step_type});}catch{}},[e]),C=react.useCallback(async P=>{try{await e.track("guide_completed",{guide_id:P.id,guide_name:P.name,total_steps:P.guide_steps?.length||0});}catch{}},[e]),E=react.useCallback(async(P,w)=>{try{await e.track("guide_dismissed",{guide_id:P.id,guide_name:P.name,dismissed_at_step:w,total_steps:P.guide_steps?.length||0});}catch{}},[e]),v=o?.guide_steps?.[i]||null,I=o?.guide_steps?.length||0,g=i===I-1,A=i===0,D=react.useCallback(P=>a.includes(P),[a]),y=react.useCallback(P=>s.includes(P),[s]);return {activeGuide:o,currentStep:v,currentStepIndex:i,totalSteps:I,isPlaying:c,isFirstStep:A,isLastStep:g,isReady:t,startGuide:f,nextStep:m,prevStep:u,goToStep:k,dismiss:G,pause:h,resume:T,trackStepView:R,trackGuideComplete:C,trackGuideDismiss:E,completedGuideIds:a,dismissedGuideIds:s,isGuideCompleted:D,isGuideDismissed:y}}var ie={button:{position:"fixed",padding:"12px 20px",border:"none",borderRadius:"8px",cursor:"pointer",fontFamily:"system-ui, -apple-system, sans-serif",fontSize:"14px",fontWeight:"500",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",transition:"transform 0.2s, box-shadow 0.2s",zIndex:9999},modal:{position:"fixed",inset:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:1e4},modalContent:{backgroundColor:"white",borderRadius:"12px",padding:"24px",width:"100%",maxWidth:"400px",margin:"16px",boxShadow:"0 20px 50px rgba(0, 0, 0, 0.2)",fontFamily:"system-ui, -apple-system, sans-serif"},textarea:{width:"100%",padding:"10px 12px",border:"1px solid #e0e0e0",borderRadius:"6px",fontSize:"14px",marginBottom:"16px",minHeight:"100px",resize:"vertical",boxSizing:"border-box",fontFamily:"inherit"},submitButton:{width:"100%",padding:"12px",border:"none",borderRadius:"6px",cursor:"pointer",fontSize:"14px",fontWeight:"500",transition:"opacity 0.2s"},typeButton:{padding:"8px 16px",border:"1px solid #e0e0e0",borderRadius:"6px",cursor:"pointer",fontSize:"13px",backgroundColor:"white",transition:"all 0.2s",marginRight:"8px",marginBottom:"8px"}},no={"bottom-right":{bottom:"20px",right:"20px"},"bottom-left":{bottom:"20px",left:"20px"},"top-right":{top:"20px",right:"20px"},"top-left":{top:"20px",left:"20px"}},io={feedback:"General Feedback",bug_report:"Bug Report",feature_request:"Feature Request",article_rating:"Article Rating"},so={feedback:"\u{1F4AC}",bug_report:"\u{1F41B}",feature_request:"\u{1F4A1}",article_rating:"\u2B50"};function ao(e){return {primaryColor:e.primaryColor||"#000000",textColor:e.textColor||"#333333",backgroundColor:e.backgroundColor||"#ffffff",borderRadius:e.borderRadius||"8px",fontFamily:e.fontFamily||"system-ui, -apple-system, sans-serif"}}function lo({position:e="bottom-right",text:t="Feedback",allowedTypes:o=["feedback","bug_report","feature_request"],theme:r,onSubmit:i,onError:n,children:c}){let{theme:d}=N(),{submitFeedback:a,isSubmitting:l,isSuccess:s,reset:p}=me(),[f,m]=react.useState(false),[u,k]=react.useState(o[0]),[G,h]=react.useState(""),T={...d,...r},R=ao(T),C=react.useCallback(()=>{m(true),p();},[p]),E=react.useCallback(()=>{m(false),h(""),k(o[0]);},[o]),v=react.useCallback(async I=>{I.preventDefault();let g={type:u,message:G};try{await a(g),i?.(g),setTimeout(E,1500);}catch(A){n?.(A instanceof Error?A:new Error("Failed to submit feedback"));}},[u,G,a,i,n,E]);return c?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{onClick:C,style:{cursor:"pointer"},children:c}),f&&jsxRuntime.jsx(ct,{isOpen:f,onClose:E,selectedType:u,onTypeChange:k,allowedTypes:o,message:G,onMessageChange:h,onSubmit:v,isSubmitting:l,isSuccess:s,themeStyles:R})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:C,style:{...ie.button,...no[e],backgroundColor:R.primaryColor,color:"white",borderRadius:R.borderRadius,fontFamily:R.fontFamily},"aria-label":"Open feedback form",children:t}),f&&jsxRuntime.jsx(ct,{isOpen:f,onClose:E,selectedType:u,onTypeChange:k,allowedTypes:o,message:G,onMessageChange:h,onSubmit:v,isSubmitting:l,isSuccess:s,themeStyles:R})]})}function ct({isOpen:e,onClose:t,selectedType:o,onTypeChange:r,allowedTypes:i,message:n,onMessageChange:c,onSubmit:d,isSubmitting:a,isSuccess:l,themeStyles:s}){return e?l?jsxRuntime.jsx("div",{style:ie.modal,onClick:t,children:jsxRuntime.jsxs("div",{style:{...ie.modalContent,textAlign:"center",fontFamily:s.fontFamily},onClick:p=>p.stopPropagation(),children:[jsxRuntime.jsx("div",{style:{fontSize:"48px",marginBottom:"16px"},children:"\u{1F389}"}),jsxRuntime.jsx("h3",{style:{margin:"0 0 8px 0",color:s.textColor},children:"Thanks for your feedback!"}),jsxRuntime.jsx("p",{style:{margin:0,color:"#666"},children:"We appreciate you taking the time to share."})]})}):jsxRuntime.jsx("div",{style:ie.modal,onClick:t,children:jsxRuntime.jsxs("div",{style:{...ie.modalContent,fontFamily:s.fontFamily},onClick:p=>p.stopPropagation(),children:[jsxRuntime.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"20px"},children:[jsxRuntime.jsx("h3",{style:{margin:0,color:s.textColor},children:"Send Feedback"}),jsxRuntime.jsx("button",{onClick:t,style:{background:"none",border:"none",fontSize:"24px",cursor:"pointer",color:"#999",padding:"0",lineHeight:"1"},"aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsxs("form",{onSubmit:d,children:[jsxRuntime.jsxs("div",{style:{marginBottom:"16px"},children:[jsxRuntime.jsx("label",{style:{display:"block",marginBottom:"8px",fontSize:"13px",color:"#666",fontWeight:"500"},children:"What kind of feedback?"}),jsxRuntime.jsx("div",{style:{display:"flex",flexWrap:"wrap"},children:i.map(p=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>r(p),style:{...ie.typeButton,backgroundColor:o===p?s.primaryColor:"white",color:o===p?"white":s.textColor,borderColor:o===p?s.primaryColor:"#e0e0e0"},children:[so[p]," ",io[p]]},p))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{style:{display:"block",marginBottom:"8px",fontSize:"13px",color:"#666",fontWeight:"500"},children:"Your message"}),jsxRuntime.jsx("textarea",{value:n,onChange:p=>c(p.target.value),placeholder:o==="bug_report"?"Describe the bug and steps to reproduce...":o==="feature_request"?"Describe the feature you would like...":"Share your thoughts...",style:ie.textarea,required:true})]}),jsxRuntime.jsx("button",{type:"submit",disabled:a||!n.trim(),style:{...ie.submitButton,backgroundColor:s.primaryColor,color:"white",opacity:a||!n.trim()?.6:1,cursor:a||!n.trim()?"not-allowed":"pointer"},children:a?"Sending...":"Send Feedback"})]})]})}):null}var M={container:{fontFamily:"system-ui, -apple-system, sans-serif",maxWidth:"800px"},searchInput:{width:"100%",padding:"12px 16px",border:"1px solid #e0e0e0",borderRadius:"8px",fontSize:"15px",marginBottom:"24px",boxSizing:"border-box"},categoryButton:{padding:"8px 16px",border:"1px solid #e0e0e0",borderRadius:"20px",cursor:"pointer",fontSize:"13px",backgroundColor:"white",transition:"all 0.2s",marginRight:"8px",marginBottom:"8px"},articleCard:{padding:"20px",border:"1px solid #e0e0e0",borderRadius:"8px",marginBottom:"12px",cursor:"pointer",transition:"box-shadow 0.2s, border-color 0.2s",backgroundColor:"white"},articleTitle:{margin:"0 0 8px 0",fontSize:"16px",fontWeight:"600"},articleDescription:{margin:0,fontSize:"14px",color:"#666",lineHeight:1.5},articleMeta:{display:"flex",gap:"16px",marginTop:"12px",fontSize:"12px",color:"#999"},backButton:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"8px 0",border:"none",background:"none",cursor:"pointer",fontSize:"14px",color:"#666",marginBottom:"16px"},articleContent:{lineHeight:1.7,fontSize:"15px"},loading:{textAlign:"center",padding:"40px",color:"#666"},error:{padding:"20px",backgroundColor:"#fef2f2",borderRadius:"8px",color:"#b91c1c",textAlign:"center"},empty:{textAlign:"center",padding:"40px",color:"#666"}};function po(e){return {primaryColor:e.primaryColor||"#000000",textColor:e.textColor||"#333333",backgroundColor:e.backgroundColor||"#ffffff",borderRadius:e.borderRadius||"8px",fontFamily:e.fontFamily||"system-ui, -apple-system, sans-serif"}}function uo({showSearch:e=true,showCategories:t=true,defaultCategory:o,theme:r,className:i,onArticleView:n}){let{theme:c}=N(),[d,a]=react.useState(""),[l,s]=react.useState(o),[p,f]=react.useState(null),m={...c,...r},u=po(m),{articles:k,isLoading:G,error:h}=be({category:l,search:d||void 0}),{article:T,isLoading:R,error:C}=ye(p||""),E=react.useMemo(()=>{let g=new Set;return k.forEach(A=>{A.category&&g.add(A.category);}),Array.from(g).sort()},[k]),v=g=>{f(g.slug),n?.(g);},I=()=>{f(null);};return p?R?jsxRuntime.jsx("div",{style:{...M.container,fontFamily:u.fontFamily},className:i,children:jsxRuntime.jsx("div",{style:M.loading,children:"Loading article..."})}):C?jsxRuntime.jsxs("div",{style:{...M.container,fontFamily:u.fontFamily},className:i,children:[jsxRuntime.jsx("button",{onClick:I,style:M.backButton,children:"\u2190 Back to articles"}),jsxRuntime.jsx("div",{style:M.error,children:"Failed to load article. Please try again."})]}):T?jsxRuntime.jsxs("div",{style:{...M.container,fontFamily:u.fontFamily},className:i,children:[jsxRuntime.jsx("button",{onClick:I,style:M.backButton,children:"\u2190 Back to articles"}),jsxRuntime.jsxs("article",{children:[jsxRuntime.jsx("h1",{style:{margin:"0 0 16px 0",color:u.textColor},children:T.title}),T.read_time_minutes&&jsxRuntime.jsxs("div",{style:{fontSize:"14px",color:"#666",marginBottom:"24px"},children:[T.read_time_minutes," min read"]}),T.content_html?jsxRuntime.jsx("div",{style:{...M.articleContent,color:u.textColor},dangerouslySetInnerHTML:{__html:T.content_html}}):jsxRuntime.jsx("div",{style:{...M.articleContent,color:u.textColor},children:typeof T.content=="string"?T.content:"No content available."})]})]}):jsxRuntime.jsxs("div",{style:{...M.container,fontFamily:u.fontFamily},className:i,children:[jsxRuntime.jsx("button",{onClick:I,style:M.backButton,children:"\u2190 Back to articles"}),jsxRuntime.jsx("div",{style:M.empty,children:"Article not found."})]}):jsxRuntime.jsxs("div",{style:{...M.container,fontFamily:u.fontFamily},className:i,children:[e&&jsxRuntime.jsx("input",{type:"text",placeholder:"Search articles...",value:d,onChange:g=>a(g.target.value),style:M.searchInput}),t&&E.length>0&&jsxRuntime.jsxs("div",{style:{marginBottom:"24px"},children:[jsxRuntime.jsx("button",{onClick:()=>s(void 0),style:{...M.categoryButton,backgroundColor:l?"white":u.primaryColor,color:l?u.textColor:"white",borderColor:l?"#e0e0e0":u.primaryColor},children:"All"}),E.map(g=>jsxRuntime.jsx("button",{onClick:()=>s(g),style:{...M.categoryButton,backgroundColor:l===g?u.primaryColor:"white",color:l===g?"white":u.textColor,borderColor:l===g?u.primaryColor:"#e0e0e0"},children:g},g))]}),G&&jsxRuntime.jsx("div",{style:M.loading,children:"Loading articles..."}),h&&jsxRuntime.jsx("div",{style:M.error,children:"Failed to load articles. Please try again."}),!G&&!h&&k.length===0&&jsxRuntime.jsx("div",{style:M.empty,children:d?`No articles found for "${d}"`:"No articles available yet."}),!G&&!h&&k.length>0&&jsxRuntime.jsx("div",{children:k.map(g=>jsxRuntime.jsxs("div",{onClick:()=>v(g),style:M.articleCard,role:"button",tabIndex:0,onKeyDown:A=>{(A.key==="Enter"||A.key===" ")&&v(g);},children:[jsxRuntime.jsx("h3",{style:{...M.articleTitle,color:u.textColor},children:g.title}),g.seo_description&&jsxRuntime.jsx("p",{style:M.articleDescription,children:g.seo_description}),jsxRuntime.jsxs("div",{style:M.articleMeta,children:[g.category&&jsxRuntime.jsx("span",{children:g.category}),g.read_time_minutes&&jsxRuntime.jsxs("span",{children:[g.read_time_minutes," min read"]})]})]},g.id))})]})}var K={container:{fontFamily:"system-ui, -apple-system, sans-serif"},list:{listStyle:"none",padding:0,margin:0,display:"flex",flexDirection:"column",gap:"12px"},card:{border:"1px solid #e5e7eb",borderRadius:"8px",padding:"16px",backgroundColor:"#ffffff",cursor:"pointer",transition:"border-color 0.15s, box-shadow 0.15s"},cardHover:{borderColor:"#d1d5db",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},header:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px",marginBottom:"8px"},badges:{display:"flex",alignItems:"center",gap:"6px"},badge:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"2px 8px",borderRadius:"9999px",fontSize:"12px",fontWeight:500},message:{fontSize:"14px",color:"#111827",margin:0,lineHeight:1.5},meta:{display:"flex",gap:"12px",marginTop:"8px",fontSize:"12px",color:"#6b7280"},empty:{textAlign:"center",padding:"32px 16px",color:"#6b7280"},emptyIcon:{width:"48px",height:"48px",margin:"0 auto 12px",color:"#d1d5db"},loading:{textAlign:"center",padding:"24px",color:"#6b7280"},error:{textAlign:"center",padding:"24px",color:"#dc2626"}},ut={feedback:{label:"Feedback",color:"#2563eb",bg:"#dbeafe"},bug_report:{label:"Bug Report",color:"#dc2626",bg:"#fee2e2"},feature_request:{label:"Feature Request",color:"#d97706",bg:"#fef3c7"},article_rating:{label:"Article Rating",color:"#7c3aed",bg:"#ede9fe"}},ft={new:{label:"New",color:"#6b7280",bg:"#f3f4f6"},reviewed:{label:"Reviewed",color:"#2563eb",bg:"#dbeafe"},in_progress:{label:"In Progress",color:"#d97706",bg:"#fef3c7"},resolved:{label:"Resolved",color:"#059669",bg:"#d1fae5"},closed:{label:"Closed",color:"#6b7280",bg:"#f3f4f6"}};function mo(e){return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function bo({status:e,type:t,limit:o=50,className:r,showEmptyState:i=true,onRequestClick:n}){let{isIdentified:c}=N(),[d,a]=react.useState(null),{requests:l,isLoading:s,error:p,refetch:f}=xe({status:e,type:t,limit:o}),m=react.useCallback(u=>{n?.(u);},[n]);return c?s?jsxRuntime.jsx("div",{style:K.loading,children:jsxRuntime.jsx("p",{children:"Loading requests..."})}):p?jsxRuntime.jsx("div",{style:K.error,children:jsxRuntime.jsxs("p",{children:["Failed to load requests. ",jsxRuntime.jsx("button",{onClick:f,style:{color:"inherit",textDecoration:"underline",background:"none",border:"none",cursor:"pointer"},children:"Try again"})]})}):l.length===0&&i?jsxRuntime.jsxs("div",{style:K.empty,children:[jsxRuntime.jsx("svg",{style:K.emptyIcon,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z"})}),jsxRuntime.jsx("p",{style:{margin:0,fontWeight:500,color:"#111827"},children:"No requests yet"}),jsxRuntime.jsx("p",{style:{margin:"8px 0 0",fontSize:"14px"},children:"When you submit feedback, bug reports, or feature requests, they'll appear here."})]}):jsxRuntime.jsx("div",{style:K.container,className:r,children:jsxRuntime.jsx("ul",{style:K.list,children:l.map(u=>{let k=ut[u.feedback_type]||ut.feedback,G=ft[u.status]||ft.new,h=d===u.id;return jsxRuntime.jsxs("li",{style:{...K.card,...h?K.cardHover:{}},onMouseEnter:()=>a(u.id),onMouseLeave:()=>a(null),onClick:()=>m(u),role:"button",tabIndex:0,onKeyDown:T=>{(T.key==="Enter"||T.key===" ")&&m(u);},children:[jsxRuntime.jsx("div",{style:K.header,children:jsxRuntime.jsxs("div",{style:K.badges,children:[jsxRuntime.jsx("span",{style:{...K.badge,color:k.color,backgroundColor:k.bg},children:k.label}),jsxRuntime.jsx("span",{style:{...K.badge,color:G.color,backgroundColor:G.bg},children:G.label})]})}),jsxRuntime.jsx("p",{style:K.message,children:u.message||"No message provided"}),jsxRuntime.jsxs("div",{style:K.meta,children:[jsxRuntime.jsx("span",{children:mo(u.created_at)}),u.page_url&&jsxRuntime.jsxs("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"200px"},children:["From: ",u.page_url]})]})]},u.id)})})}):i?jsxRuntime.jsx("div",{style:K.empty,children:jsxRuntime.jsx("p",{children:"Please sign in to view your requests."})}):null}var ho={articles:"Documentation",requests:"My Requests"},mt={feedback:{label:"Feedback",color:"#2563eb",bg:"#dbeafe"},bug_report:{label:"Bug Report",color:"#dc2626",bg:"#fee2e2"},feature_request:{label:"Feature Request",color:"#d97706",bg:"#fef3c7"},article_rating:{label:"Article Rating",color:"#7c3aed",bg:"#ede9fe"}},bt={new:{label:"New",color:"#6b7280",bg:"#f3f4f6"},planned:{label:"Planned",color:"#2563eb",bg:"#dbeafe"},in_progress:{label:"In Progress",color:"#d97706",bg:"#fef3c7"},resolved:{label:"Resolved",color:"#059669",bg:"#d1fae5"},closed:{label:"Closed",color:"#6b7280",bg:"#f3f4f6"}};function vo(e){return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}var So=[{value:"feedback",label:"Feedback"},{value:"bug_report",label:"Bug"},{value:"feature_request",label:"Feature"}],Co=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),yt=()=>jsxRuntime.jsx("svg",{width:"20",height:"20",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.747 0 3.332.477 4.5 1.253v13C19.832 18.477 18.247 18 16.5 18c-1.746 0-3.332.477-4.5 1.253"})}),xt=()=>jsxRuntime.jsx("svg",{width:"20",height:"20",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),wo=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})}),ko=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 19l-7-7m0 0l7-7m-7 7h18"})}),Ro=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})}),Go=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"})}),To=()=>jsxRuntime.jsx("svg",{width:"48",height:"48",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z"})}),Eo=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),je=()=>jsxRuntime.jsx("svg",{width:"20",height:"20",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",style:{animation:"spin 1s linear infinite"},children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})}),ht={light:{primary:"#c45a2c",primaryHover:"#a84a24",primaryLight:"rgba(196, 90, 44, 0.08)",primaryLightHover:"rgba(196, 90, 44, 0.15)",background:"transparent",surface:"#ffffff",surfaceHover:"#fafafa",border:"rgba(0, 0, 0, 0.08)",borderHover:"rgba(196, 90, 44, 0.25)",text:"#1a1a1a",textSecondary:"#525252",textMuted:"#737373",textLight:"#a3a3a3"},dark:{primary:"#e07347",primaryHover:"#f08a5d",primaryLight:"rgba(224, 115, 71, 0.12)",primaryLightHover:"rgba(224, 115, 71, 0.2)",background:"transparent",surface:"rgba(255, 255, 255, 0.03)",surfaceHover:"rgba(255, 255, 255, 0.06)",border:"rgba(255, 255, 255, 0.08)",borderHover:"rgba(224, 115, 71, 0.35)",text:"#fafafa",textSecondary:"#d4d4d4",textMuted:"#a3a3a3",textLight:"#737373"}},Io=e=>({container:{fontFamily:'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',minHeight:"400px",color:e.text},grid:{display:"grid",gridTemplateColumns:"220px 1fr",gap:"40px"},sidebar:{position:"sticky",top:"24px",height:"fit-content"},main:{minWidth:0},tabs:{display:"flex",borderBottom:`1px solid ${e.border}`,marginBottom:"28px",gap:"0"},tab:{padding:"10px 20px",fontSize:"14px",fontWeight:500,border:"none",borderBottomWidth:"2px",borderBottomStyle:"solid",borderBottomColor:"transparent",cursor:"pointer",transition:"all 0.15s",backgroundColor:"transparent",color:e.textMuted,marginBottom:"-1px"},tabActive:{color:e.primary,borderBottomColor:e.primary},searchContainer:{position:"relative",marginBottom:"20px"},searchIcon:{position:"absolute",left:"10px",top:"50%",transform:"translateY(-50%)",color:e.textLight},searchInput:{width:"100%",padding:"8px 10px 8px 32px",fontSize:"13px",border:`1px solid ${e.border}`,borderRadius:"6px",outline:"none",backgroundColor:"transparent",color:e.text,boxSizing:"border-box"},sectionTitle:{fontSize:"10px",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em",color:e.textLight,marginBottom:"8px",marginTop:"20px"},navList:{listStyle:"none",padding:0,margin:0},navItem:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",padding:"6px 10px",fontSize:"13px",color:e.textSecondary,backgroundColor:"transparent",border:"none",borderRadius:"6px",cursor:"pointer",textAlign:"left",transition:"all 0.15s"},navItemActive:{backgroundColor:e.surfaceHover,color:e.text,fontWeight:500},subNav:{marginLeft:"20px",marginTop:"2px",paddingLeft:"10px",borderLeft:`1px solid ${e.border}`},articleGrid:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(280px, 1fr))",gap:"12px"},articleCard:{display:"flex",alignItems:"flex-start",gap:"12px",padding:"14px",border:`1px solid ${e.border}`,borderRadius:"8px",backgroundColor:e.surface,cursor:"pointer",transition:"all 0.2s ease",textAlign:"left"},articleIcon:{flexShrink:0,width:"36px",height:"36px",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:e.primaryLight,borderRadius:"8px",color:e.primary,transition:"background-color 0.2s"},articleContent:{flex:1,minWidth:0},articleTitle:{fontSize:"14px",fontWeight:500,color:e.text,margin:0,lineHeight:1.4},articleDesc:{fontSize:"12px",color:e.textMuted,margin:"4px 0 0",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",lineHeight:1.5},articleMeta:{fontSize:"11px",color:e.textLight,marginTop:"6px"},articleChevron:{flexShrink:0,color:e.textLight,transition:"color 0.2s"},backButton:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"6px 0",fontSize:"13px",color:e.textMuted,backgroundColor:"transparent",border:"none",cursor:"pointer",marginBottom:"20px",transition:"color 0.15s"},articleDetail:{maxWidth:"720px"},articleDetailTitle:{fontSize:"28px",fontWeight:600,color:e.text,margin:0,lineHeight:1.3},articleDetailMeta:{display:"flex",alignItems:"center",gap:"6px",fontSize:"13px",color:e.textMuted,marginTop:"10px"},articleDetailContent:{marginTop:"28px",fontSize:"15px",lineHeight:1.7,color:e.textSecondary},emptyState:{textAlign:"center",padding:"48px 24px",color:e.textMuted},emptyIcon:{color:e.textLight,marginBottom:"12px",opacity:.5},emptyTitle:{fontSize:"16px",fontWeight:500,color:e.text,margin:"0 0 6px"},emptyText:{fontSize:"13px",margin:0,color:e.textMuted},loading:{display:"flex",alignItems:"center",justifyContent:"center",gap:"10px",padding:"48px",color:e.textMuted,fontSize:"13px"},requestCard:{border:`1px solid ${e.border}`,borderRadius:"8px",padding:"16px",backgroundColor:e.surface,marginBottom:"10px",transition:"border-color 0.2s"},requestHeader:{display:"flex",alignItems:"center",gap:"6px",marginBottom:"10px"},badge:{display:"inline-flex",alignItems:"center",padding:"3px 8px",borderRadius:"9999px",fontSize:"11px",fontWeight:500},requestMessage:{fontSize:"14px",color:e.text,margin:0,lineHeight:1.5},requestMeta:{display:"flex",gap:"12px",marginTop:"10px",fontSize:"12px",color:e.textMuted},form:{padding:"16px",backgroundColor:e.surface,borderRadius:"8px",border:`1px solid ${e.border}`,marginBottom:"20px"},formHeader:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"12px"},formTitle:{fontSize:"14px",fontWeight:500,color:e.text,margin:0},typeSelector:{display:"flex",gap:"6px",marginBottom:"12px"},typeButton:{padding:"6px 12px",borderRadius:"6px",border:`1px solid ${e.border}`,backgroundColor:"transparent",color:e.textSecondary,fontSize:"13px",cursor:"pointer",transition:"all 0.15s",fontWeight:500},typeButtonActive:{backgroundColor:e.primary,borderColor:e.primary,color:"#ffffff"},textarea:{width:"100%",padding:"10px 12px",borderRadius:"6px",border:`1px solid ${e.border}`,fontSize:"13px",resize:"vertical",minHeight:"80px",fontFamily:"inherit",marginBottom:"12px",boxSizing:"border-box",backgroundColor:"transparent",color:e.text},submitButton:{padding:"8px 16px",borderRadius:"6px",border:"none",backgroundColor:e.primary,color:"#ffffff",fontSize:"13px",fontWeight:500,cursor:"pointer",transition:"all 0.15s"},newRequestButton:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"8px 16px",borderRadius:"6px",border:"none",backgroundColor:e.primary,color:"#ffffff",fontSize:"13px",fontWeight:500,cursor:"pointer",marginBottom:"20px",transition:"background-color 0.15s"},successMessage:{padding:"12px 14px",backgroundColor:"rgba(5, 150, 105, 0.1)",borderRadius:"6px",color:"#059669",fontSize:"13px",marginBottom:"12px",fontWeight:500}}),Po=(e,t)=>`
2
2
  @keyframes spin {
3
3
  from { transform: rotate(0deg); }
4
4
  to { transform: rotate(360deg); }