import{a as _,b as K,c as S}from"./chunk-XEHBQAFR.mjs";var C={};K(C,{default:()=>T});var f,T,b=_(()=>{"use strict";f=function(){var e={defaultValue:null,kind:"LocalArgument",name:"connections"},n={defaultValue:null,kind:"LocalArgument",name:"input"},a=[{kind:"Variable",name:"input",variableName:"input"}],t={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},r={alias:null,args:null,kind:"ScalarField",name:"total",storageKey:null},m={alias:null,args:null,concreteType:"CommentsCount",kind:"LinkedField",name:"commentsCount",plural:!1,selections:[r,{alias:null,args:null,kind:"ScalarField",name:"main",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"replies",storageKey:null}],storageKey:null},i=[t,m],o={alias:null,args:null,concreteType:"Comment",kind:"LinkedField",name:"inReplyTo",plural:!1,selections:i,storageKey:null},u={alias:null,args:null,concreteType:"ErrorType",kind:"LinkedField",name:"errors",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"field",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"messages",storageKey:null}],storageKey:null},l={alias:null,args:null,kind:"ScalarField",name:"pk",storageKey:null},d=[r];return{fragment:{argumentDefinitions:[e,n],kind:"Fragment",metadata:null,name:"CommentCreateMutation",selections:[{alias:null,args:a,concreteType:"CommentCreatePayload",kind:"LinkedField",name:"commentCreate",plural:!1,selections:[{alias:null,args:null,concreteType:"CommentEdge",kind:"LinkedField",name:"comment",plural:!1,selections:[{alias:null,args:null,concreteType:"Comment",kind:"LinkedField",name:"node",plural:!1,selections:[t,{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"target",plural:!1,selections:i,storageKey:null},o,{args:null,kind:"FragmentSpread",name:"CommentItem_comment"}],storageKey:null}],storageKey:null},u],storageKey:null}],type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[n,e],kind:"Operation",name:"CommentCreateMutation",selections:[{alias:null,args:a,concreteType:"CommentCreatePayload",kind:"LinkedField",name:"commentCreate",plural:!1,selections:[{alias:null,args:null,concreteType:"CommentEdge",kind:"LinkedField",name:"comment",plural:!1,selections:[{alias:null,args:null,concreteType:"Comment",kind:"LinkedField",name:"node",plural:!1,selections:[t,{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"target",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},t,m],storageKey:null},o,l,{alias:null,args:null,kind:"ScalarField",name:"body",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"isPinned",storageKey:null},{alias:null,args:null,concreteType:"User",kind:"LinkedField",name:"user",plural:!1,selections:[t,l,{alias:null,args:null,kind:"ScalarField",name:"fullName",storageKey:null},{alias:null,args:[{kind:"Literal",name:"height",value:50},{kind:"Literal",name:"width",value:50}],concreteType:"File",kind:"LinkedField",name:"avatar",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"url",storageKey:null}],storageKey:"avatar(height:50,width:50)"}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"created",storageKey:null},{alias:null,args:null,concreteType:"CommentsCount",kind:"LinkedField",name:"commentsCount",plural:!1,selections:d,storageKey:null},{alias:"canChange",args:[{kind:"Literal",name:"perm",value:"change"}],kind:"ScalarField",name:"hasPerm",storageKey:'hasPerm(perm:"change")'},{alias:"canDelete",args:[{kind:"Literal",name:"perm",value:"delete"}],kind:"ScalarField",name:"hasPerm",storageKey:'hasPerm(perm:"delete")'},{alias:"canReport",args:[{kind:"Literal",name:"perm",value:"report"}],kind:"ScalarField",name:"hasPerm",storageKey:'hasPerm(perm:"report")'},{alias:"canPin",args:[{kind:"Literal",name:"perm",value:"pin"}],kind:"ScalarField",name:"hasPerm",storageKey:'hasPerm(perm:"pin")'},{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"ReactionsCount",kind:"LinkedField",name:"reactionsCount",plural:!1,selections:d,storageKey:null},{alias:null,args:null,concreteType:"Reaction",kind:"LinkedField",name:"myReaction",plural:!1,selections:[t,{alias:null,args:null,kind:"ScalarField",name:"reactionType",storageKey:null}],storageKey:null}],type:"ReactionsInterface",abstractKey:"__isReactionsInterface"},{kind:"TypeDiscriminator",abstractKey:"__isCommentsInterface"}],storageKey:null}],storageKey:null},{alias:null,args:null,filters:null,handle:"prependEdge",key:"",kind:"LinkedHandle",name:"comment",handleArgs:[{kind:"Variable",name:"connections",variableName:"connections"}]},u],storageKey:null}]},params:{cacheID:"1df6b1cc4ffb8c4f9160a80391bb797e",id:null,metadata:{},name:"CommentCreateMutation",operationKind:"mutation",text:`mutation CommentCreateMutation(
  $input: CommentCreateInput!
) {
  commentCreate(input: $input) {
    comment {
      node {
        id
        target {
          __typename
          id
          commentsCount {
            total
            main
            replies
          }
        }
        inReplyTo {
          id
          commentsCount {
            total
            main
            replies
          }
        }
        ...CommentItem_comment
      }
    }
    errors {
      field
      messages
    }
  }
}

fragment CommentItem_comment on Comment {
  id
  pk
  body
  isPinned
  user {
    id
    pk
    fullName
    avatar(width: 50, height: 50) {
      url
    }
  }
  created
  commentsCount {
    total
  }
  canChange: hasPerm(perm: "change")
  canDelete: hasPerm(perm: "delete")
  canReport: hasPerm(perm: "report")
  canPin: hasPerm(perm: "pin")
  ...ReactionButton_target
  ...CommentItem_target
}

fragment CommentItem_target on CommentsInterface {
  __isCommentsInterface: __typename
  id
}

fragment ReactionButton_target on ReactionsInterface {
  __isReactionsInterface: __typename
  id
  reactionsCount {
    total
  }
  myReaction {
    id
    reactionType
  }
}
`}}}();f.hash="a8c11febd85db3454fcae2f3629bdff2";T=f});import{useNotification as A}from"@baseapp-frontend/utils";import{useMutation as E}from"react-relay";function y(e){"@babel/helpers - typeof";return y=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},y(e)}var c;function k(e,n){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n&&(t=t.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),a.push.apply(a,t)}return a}function v(e){for(var n=1;n<arguments.length;n++){var a=arguments[n]!=null?arguments[n]:{};n%2?k(Object(a),!0).forEach(function(t){P(e,t,a[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):k(Object(a)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))})}return e}function P(e,n,a){return(n=I(n))in e?Object.defineProperty(e,n,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[n]=a,e}function I(e){var n=L(e,"string");return y(n)=="symbol"?n:n+""}function L(e,n){if(y(e)!="object"||!e)return e;var a=e[Symbol.toPrimitive];if(a!==void 0){var t=a.call(e,n||"default");if(y(t)!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function R(e,n){return w(e)||j(e,n)||O(e,n)||M()}function M(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function O(e,n){if(e){if(typeof e=="string")return h(e,n);var a={}.toString.call(e).slice(8,-1);return a==="Object"&&e.constructor&&(a=e.constructor.name),a==="Map"||a==="Set"?Array.from(e):a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?h(e,n):void 0}}function h(e,n){(n==null||n>e.length)&&(n=e.length);for(var a=0,t=Array(n);a<n;a++)t[a]=e[a];return t}function j(e,n){var a=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(a!=null){var t,r,m,i,o=[],u=!0,l=!1;try{if(m=(a=a.call(e)).next,n===0){if(Object(a)!==a)return;u=!1}else for(;!(u=(t=m.call(a)).done)&&(o.push(t.value),o.length!==n);u=!0);}catch(d){l=!0,r=d}finally{try{if(!u&&a.return!=null&&(i=a.return(),Object(i)!==i))return}finally{if(l)throw r}}return o}}function w(e){if(Array.isArray(e))return e}var x=(c!==void 0||(c=(b(),S(C)),c.hash&&c.hash!=="a8c11febd85db3454fcae2f3629bdff2"&&console.error("The definition of 'CommentCreateMutation' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data.")),c),q=function(){var n=A(),a=n.sendToast,t=E(x),r=R(t,2),m=r[0],i=r[1],o=function(l){return m(v(v({},l),{},{onCompleted:function(p,s){var g;s?.forEach(function(F){a(F.message,{type:"error"})}),l==null||(g=l.onCompleted)===null||g===void 0||g.call(l,p,s)},onError:function(p){var s;a(p.message,{type:"error"}),l==null||(s=l.onError)===null||s===void 0||s.call(l,p)}}))};return[o,i]};export{x as a,q as b};
//# sourceMappingURL=chunk-JVKFJ2DY.mjs.map